Search in sources :

Example 6 with PaymentMethodModelDao

use of org.killbill.billing.payment.dao.PaymentMethodModelDao in project killbill by killbill.

the class PaymentMethodProcessor method getPaymentMethodInternal.

private List<PaymentMethod> getPaymentMethodInternal(final Collection<PaymentMethodModelDao> paymentMethodModels, final boolean withPluginInfo, final Iterable<PluginProperty> properties, final TenantContext tenantContext, final InternalTenantContext context) throws PaymentApiException {
    final List<PaymentMethod> result = new ArrayList<PaymentMethod>(paymentMethodModels.size());
    for (final PaymentMethodModelDao paymentMethodModel : paymentMethodModels) {
        final PaymentMethod pm = buildDefaultPaymentMethod(paymentMethodModel, withPluginInfo, properties, tenantContext, context);
        result.add(pm);
    }
    return result;
}
Also used : ArrayList(java.util.ArrayList) PaymentMethodModelDao(org.killbill.billing.payment.dao.PaymentMethodModelDao) PaymentMethod(org.killbill.billing.payment.api.PaymentMethod) DefaultPaymentMethod(org.killbill.billing.payment.api.DefaultPaymentMethod)

Example 7 with PaymentMethodModelDao

use of org.killbill.billing.payment.dao.PaymentMethodModelDao in project killbill by killbill.

the class TestPaymentOperation method setUp.

private void setUp(final PaymentPluginStatus paymentPluginStatus) throws Exception {
    final GlobalLocker locker = new MemoryGlobalLocker();
    final PluginDispatcher<OperationResult> paymentPluginDispatcher = new PluginDispatcher<OperationResult>(1, paymentExecutors);
    paymentStateContext = new PaymentStateContext(true, UUID.randomUUID(), null, null, UUID.randomUUID().toString(), UUID.randomUUID().toString(), TransactionType.CAPTURE, Mockito.mock(Account.class), UUID.randomUUID(), new BigDecimal("192.3920111"), Currency.BRL, null, null, false, null, ImmutableList.<PluginProperty>of(), internalCallContext, callContext);
    final PaymentMethodModelDao paymentMethodModelDao = new PaymentMethodModelDao(paymentStateContext.getPaymentMethodId(), UUID.randomUUID().toString(), clock.getUTCNow(), clock.getUTCNow(), paymentStateContext.getAccount().getId(), MockPaymentProviderPlugin.PLUGIN_NAME, true);
    final PaymentDao paymentDao = Mockito.mock(PaymentDao.class);
    Mockito.when(paymentDao.getPaymentMethod(paymentStateContext.getPaymentMethodId(), internalCallContext)).thenReturn(paymentMethodModelDao);
    final PaymentPluginServiceRegistration paymentPluginServiceRegistration = new PaymentPluginServiceRegistration(paymentDao, registry);
    final PaymentAutomatonDAOHelper daoHelper = new PaymentAutomatonDAOHelper(paymentStateContext, clock.getUTCNow(), paymentDao, paymentPluginServiceRegistration, internalCallContext, eventBus, paymentSMHelper);
    paymentOperation = new PaymentOperationTest(paymentPluginStatus, daoHelper, locker, paymentPluginDispatcher, paymentConfig, paymentStateContext);
}
Also used : GlobalLocker(org.killbill.commons.locker.GlobalLocker) MemoryGlobalLocker(org.killbill.commons.locker.memory.MemoryGlobalLocker) PaymentMethodModelDao(org.killbill.billing.payment.dao.PaymentMethodModelDao) OperationResult(org.killbill.automaton.OperationResult) BigDecimal(java.math.BigDecimal) PluginProperty(org.killbill.billing.payment.api.PluginProperty) MemoryGlobalLocker(org.killbill.commons.locker.memory.MemoryGlobalLocker) PluginDispatcher(org.killbill.billing.payment.dispatcher.PluginDispatcher) PaymentPluginServiceRegistration(org.killbill.billing.payment.core.PaymentPluginServiceRegistration) PaymentDao(org.killbill.billing.payment.dao.PaymentDao)

Aggregations

PaymentMethodModelDao (org.killbill.billing.payment.dao.PaymentMethodModelDao)7 PaymentMethod (org.killbill.billing.payment.api.PaymentMethod)4 UUID (java.util.UUID)3 DefaultPaymentMethod (org.killbill.billing.payment.api.DefaultPaymentMethod)3 ArrayList (java.util.ArrayList)2 AccountApiException (org.killbill.billing.account.api.AccountApiException)2 PaymentApiException (org.killbill.billing.payment.api.PaymentApiException)2 PaymentPluginApi (org.killbill.billing.payment.plugin.api.PaymentPluginApi)2 PaymentPluginApiException (org.killbill.billing.payment.plugin.api.PaymentPluginApiException)2 ImmutableList (com.google.common.collect.ImmutableList)1 BigDecimal (java.math.BigDecimal)1 List (java.util.List)1 OperationResult (org.killbill.automaton.OperationResult)1 Account (org.killbill.billing.account.api.Account)1 PluginProperty (org.killbill.billing.payment.api.PluginProperty)1 PaymentPluginServiceRegistration (org.killbill.billing.payment.core.PaymentPluginServiceRegistration)1 PaymentDao (org.killbill.billing.payment.dao.PaymentDao)1 PluginDispatcher (org.killbill.billing.payment.dispatcher.PluginDispatcher)1 PluginDispatcherReturnType (org.killbill.billing.payment.dispatcher.PluginDispatcher.PluginDispatcherReturnType)1 PaymentMethodInfoPlugin (org.killbill.billing.payment.plugin.api.PaymentMethodInfoPlugin)1