Search in sources :

Example 16 with PaymentTransactionInfoPlugin

use of org.killbill.billing.payment.plugin.api.PaymentTransactionInfoPlugin in project killbill by killbill.

the class MockPaymentProviderPlugin method overridePaymentPluginStatus.

public void overridePaymentPluginStatus(final UUID kbPaymentId, final UUID kbTransactionId, final PaymentPluginStatus status) {
    final List<PaymentTransactionInfoPlugin> existingTransactions = paymentTransactions.remove(kbPaymentId.toString());
    final List<PaymentTransactionInfoPlugin> newTransactions = new LinkedList<PaymentTransactionInfoPlugin>();
    paymentTransactions.put(kbPaymentId.toString(), newTransactions);
    for (final PaymentTransactionInfoPlugin existingTransaction : existingTransactions) {
        if (existingTransaction.getKbTransactionPaymentId().equals(kbTransactionId)) {
            final PaymentTransactionInfoPlugin newTransaction = new DefaultNoOpPaymentInfoPlugin(existingTransaction.getKbPaymentId(), existingTransaction.getKbTransactionPaymentId(), existingTransaction.getTransactionType(), existingTransaction.getAmount(), existingTransaction.getCurrency(), existingTransaction.getEffectiveDate(), existingTransaction.getCreatedDate(), status, existingTransaction.getGatewayErrorCode(), existingTransaction.getGatewayError());
            newTransactions.add(newTransaction);
        } else {
            newTransactions.add(existingTransaction);
        }
    }
}
Also used : PaymentTransactionInfoPlugin(org.killbill.billing.payment.plugin.api.PaymentTransactionInfoPlugin) LinkedList(java.util.LinkedList)

Aggregations

PaymentTransactionInfoPlugin (org.killbill.billing.payment.plugin.api.PaymentTransactionInfoPlugin)16 PaymentTransactionModelDao (org.killbill.billing.payment.dao.PaymentTransactionModelDao)6 BigDecimal (java.math.BigDecimal)5 PaymentModelDao (org.killbill.billing.payment.dao.PaymentModelDao)5 DefaultNoOpPaymentInfoPlugin (org.killbill.billing.payment.provider.DefaultNoOpPaymentInfoPlugin)5 Test (org.testng.annotations.Test)5 LinkedList (java.util.LinkedList)4 PluginProperty (org.killbill.billing.payment.api.PluginProperty)4 Predicate (com.google.common.base.Predicate)3 PaymentApiException (org.killbill.billing.payment.api.PaymentApiException)3 PaymentPluginApi (org.killbill.billing.payment.plugin.api.PaymentPluginApi)3 UUID (java.util.UUID)2 PaymentPluginApiException (org.killbill.billing.payment.plugin.api.PaymentPluginApiException)2 EventBusException (org.killbill.bus.api.PersistentBus.EventBusException)2 ImmutableList (com.google.common.collect.ImmutableList)1 IOException (java.io.IOException)1 List (java.util.List)1 OperationException (org.killbill.automaton.OperationException)1 InternalTenantContext (org.killbill.billing.callcontext.InternalTenantContext)1 Currency (org.killbill.billing.catalog.api.Currency)1