@Test(groups = "slow") public void testCreatePurchaseWithControlPluginRuntimeException() throws Exception { mockPaymentControlProviderPlugin.throwsException(new IllegalStateException()); final BigDecimal requestedAmount = BigDecimal.TEN; final String paymentExternalKey = "pay controle external key"; final String transactionExternalKey = "txn control external key"; try { paymentApi.createPurchaseWithPaymentControl( account, account.getPaymentMethodId(), null, requestedAmount, Currency.AED, null, paymentExternalKey, transactionExternalKey, ImmutableList.<PluginProperty>of(), CONTROL_PLUGIN_OPTIONS, callContext); fail(); } catch (PaymentApiException e) { assertTrue(e.getCause() instanceof IllegalStateException); } }
@Test(groups = "slow") public void testCreatePurchaseWithControlPaymentPluginException() throws Exception { mockPaymentProviderPlugin.makeNextPaymentFailWithException(); final BigDecimal requestedAmount = BigDecimal.TEN; final String paymentExternalKey = "pay controle external key"; final String transactionExternalKey = "txn control external key"; try { paymentApi.createPurchaseWithPaymentControl( account, account.getPaymentMethodId(), null, requestedAmount, Currency.AED, null, paymentExternalKey, transactionExternalKey, ImmutableList.<PluginProperty>of(), CONTROL_PLUGIN_OPTIONS, callContext); fail(); } catch (PaymentApiException e) { assertTrue(e.getCause() instanceof PaymentPluginApiException); } }
@Test(groups = "slow") public void testCreatePurchaseWithControlPluginException() throws Exception { mockPaymentControlProviderPlugin.throwsException(new PaymentControlApiException()); final BigDecimal requestedAmount = BigDecimal.TEN; final String paymentExternalKey = "pay controle external key"; final String transactionExternalKey = "txn control external key"; try { paymentApi.createPurchaseWithPaymentControl( account, account.getPaymentMethodId(), null, requestedAmount, Currency.AED, null, paymentExternalKey, transactionExternalKey, ImmutableList.<PluginProperty>of(), CONTROL_PLUGIN_OPTIONS, callContext); fail(); } catch (PaymentApiException e) { assertTrue(e.getCause() instanceof PaymentControlApiException); } }
break; case PURCHASE: result = paymentApi.createPurchaseWithPaymentControl(account, paymentMethodId, paymentId, paymentTransactionJson.getAmount(), currency, paymentTransactionJson.getEffectiveDate(), paymentTransactionJson.getPaymentExternalKey(), paymentTransactionJson.getTransactionExternalKey(), transactionPluginProperties, paymentOptions, callContext);
@Test(groups = "slow") public void testCreatePurchaseWithControlTimeout() throws Exception { final BigDecimal requestedAmount = BigDecimal.ONE; final String paymentExternalKey = "111111"; final String transactionExternalKey = "11111"; mockPaymentProviderPlugin.makePluginWaitSomeMilliseconds((int) (paymentConfig.getPaymentPluginTimeout().getMillis() + 100)); try { paymentApi.createPurchaseWithPaymentControl( account, account.getPaymentMethodId(), null, requestedAmount, Currency.AED, null, paymentExternalKey, transactionExternalKey, ImmutableList.<PluginProperty>of(), CONTROL_PLUGIN_OPTIONS, callContext); fail(); } catch (PaymentApiException e) { assertEquals(e.getCode(), ErrorCode.PAYMENT_PLUGIN_TIMEOUT.getCode()); } }
break; case PURCHASE: result = paymentApi.createPurchaseWithPaymentControl(account, paymentMethodId, paymentId, json.getAmount(), currency, json.getEffectiveDate(), json.getPaymentExternalKey(), json.getTransactionExternalKey(), pluginProperties, paymentOptions, callContext);
context); } else { createdPayment = osgiKillbillAPI.getPaymentApi().createPurchaseWithPaymentControl(account, kbPaymentMethodId, kbPaymentId,
break; case PURCHASE: paymentApi.createPurchaseWithPaymentControl(account, initialPayment.getPaymentMethodId(), initialPayment.getId(), amount, currency, null, initialPayment.getExternalKey(), pendingTransaction.getExternalKey(), pluginProperties, paymentOptions, callContext);