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;
}
Aggregations