use of org.killbill.billing.client.model.gen.ComboPaymentTransaction in project killbill by killbill.
the class TestPayment method testComboAuthorizationAbortedPayment.
@Test(groups = "slow")
public void testComboAuthorizationAbortedPayment() throws Exception {
final Account accountJson = getAccount();
accountJson.setAccountId(null);
final String paymentExternalKey = UUID.randomUUID().toString();
final ComboPaymentTransaction comboPaymentTransaction = createComboPaymentTransaction(accountJson, paymentExternalKey);
mockPaymentControlProviderPlugin.setAborted(true);
try {
paymentApi.createComboPayment(comboPaymentTransaction, Arrays.asList(MockPaymentControlProviderPlugin.PLUGIN_NAME), requestOptions);
fail();
} catch (KillBillClientException e) {
assertEquals(e.getResponse().getStatusCode(), 422);
}
assertFalse(mockPaymentControlProviderPlugin.isOnFailureCallExecuted());
assertFalse(mockPaymentControlProviderPlugin.isOnSuccessCallExecuted());
}
use of org.killbill.billing.client.model.gen.ComboPaymentTransaction in project killbill by killbill.
the class TestTenantKV method createComboPaymentTransaction.
private Payment createComboPaymentTransaction(final RequestOptions requestOptions) throws KillBillClientException {
final Account accountJson = getAccount();
accountJson.setAccountId(null);
final PaymentMethodPluginDetail info = new PaymentMethodPluginDetail();
info.setProperties(null);
final String paymentMethodExternalKey = UUID.randomUUID().toString();
final PaymentMethod paymentMethodJson = new PaymentMethod(null, paymentMethodExternalKey, null, true, PLUGIN_NAME, info, null);
final String authTransactionExternalKey = UUID.randomUUID().toString();
final PaymentTransaction authTransactionJson = new PaymentTransaction();
authTransactionJson.setAmount(BigDecimal.TEN);
authTransactionJson.setCurrency(accountJson.getCurrency());
authTransactionJson.setPaymentExternalKey(UUID.randomUUID().toString());
authTransactionJson.setTransactionExternalKey(authTransactionExternalKey);
authTransactionJson.setTransactionType(TransactionType.AUTHORIZE);
callbackServlet.pushExpectedEvents(ExtBusEventType.ACCOUNT_CREATION, ExtBusEventType.ACCOUNT_CHANGE, ExtBusEventType.PAYMENT_SUCCESS);
final ComboPaymentTransaction comboAuthorization = new ComboPaymentTransaction(accountJson, paymentMethodJson, authTransactionJson, ImmutableList.<PluginProperty>of(), ImmutableList.<PluginProperty>of(), null);
final Payment payment = paymentApi.createComboPayment(comboAuthorization, NULL_PLUGIN_NAMES, requestOptions);
callbackServlet.assertListenerStatus();
assertEquals(payment.getTransactions().get(0).getStatus(), TransactionStatus.SUCCESS);
return payment;
}
Aggregations