Search in sources :

Example 6 with ComboPaymentTransaction

use of org.killbill.billing.client.model.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 {
        killBillClient.createPayment(comboPaymentTransaction, Arrays.asList(MockPaymentControlProviderPlugin.PLUGIN_NAME), ImmutableMap.<String, String>of(), requestOptions);
        fail();
    } catch (KillBillClientException e) {
        assertEquals(e.getResponse().getStatusCode(), 422);
    }
    assertFalse(mockPaymentControlProviderPlugin.isOnFailureCallExecuted());
    assertFalse(mockPaymentControlProviderPlugin.isOnSuccessCallExecuted());
}
Also used : Account(org.killbill.billing.client.model.Account) ComboPaymentTransaction(org.killbill.billing.client.model.ComboPaymentTransaction) KillBillClientException(org.killbill.billing.client.KillBillClientException) Test(org.testng.annotations.Test)

Aggregations

ComboPaymentTransaction (org.killbill.billing.client.model.ComboPaymentTransaction)6 Account (org.killbill.billing.client.model.Account)5 Test (org.testng.annotations.Test)4 Payment (org.killbill.billing.client.model.Payment)3 PaymentMethod (org.killbill.billing.client.model.PaymentMethod)3 PaymentMethodPluginDetail (org.killbill.billing.client.model.PaymentMethodPluginDetail)3 KillBillClientException (org.killbill.billing.client.KillBillClientException)2 PaymentTransaction (org.killbill.billing.client.model.PaymentTransaction)2 UUID (java.util.UUID)1