Search in sources :

Example 41 with Payment

use of org.killbill.billing.client.model.gen.Payment 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;
}
Also used : PaymentTransaction(org.killbill.billing.client.model.gen.PaymentTransaction) ComboPaymentTransaction(org.killbill.billing.client.model.gen.ComboPaymentTransaction) Account(org.killbill.billing.client.model.gen.Account) ComboPaymentTransaction(org.killbill.billing.client.model.gen.ComboPaymentTransaction) Payment(org.killbill.billing.client.model.gen.Payment) PaymentMethodPluginDetail(org.killbill.billing.client.model.gen.PaymentMethodPluginDetail) PaymentMethod(org.killbill.billing.client.model.gen.PaymentMethod)

Aggregations

Payment (org.killbill.billing.client.model.gen.Payment)41 InvoicePayment (org.killbill.billing.client.model.gen.InvoicePayment)36 Test (org.testng.annotations.Test)34 Account (org.killbill.billing.client.model.gen.Account)28 PaymentTransaction (org.killbill.billing.client.model.gen.PaymentTransaction)23 ComboPaymentTransaction (org.killbill.billing.client.model.gen.ComboPaymentTransaction)18 BigDecimal (java.math.BigDecimal)16 UUID (java.util.UUID)14 InvoicePaymentTransaction (org.killbill.billing.client.model.gen.InvoicePaymentTransaction)13 TransactionType (org.killbill.billing.payment.api.TransactionType)8 DateTime (org.joda.time.DateTime)7 InvoicePayments (org.killbill.billing.client.model.InvoicePayments)7 Payments (org.killbill.billing.client.model.Payments)7 InvoiceItem (org.killbill.billing.client.model.gen.InvoiceItem)7 PaymentMethod (org.killbill.billing.client.model.gen.PaymentMethod)5 KillBillClientException (org.killbill.billing.client.KillBillClientException)4 Invoices (org.killbill.billing.client.model.Invoices)4 Invoice (org.killbill.billing.client.model.gen.Invoice)4 PaymentMethodPluginDetail (org.killbill.billing.client.model.gen.PaymentMethodPluginDetail)4 RequestOptions (org.killbill.billing.client.RequestOptions)2