use of org.killbill.billing.client.model.Payments in project killbill by killbill.
the class TestPayment method testWithFailedPaymentAndScheduledAttemptsGetPaymentsForAccount.
@Test(groups = "slow")
public void testWithFailedPaymentAndScheduledAttemptsGetPaymentsForAccount() throws Exception {
mockPaymentProviderPlugin.makeNextPaymentFailWithError();
final Account account = createAccountWithPMBundleAndSubscriptionAndWaitForFirstInvoice(false);
HashMultimap<String, String> queryParams = HashMultimap.create();
queryParams.put("withAttempts", "true");
RequestOptions inputOptions = RequestOptions.builder().withCreatedBy(createdBy).withReason(reason).withComment(comment).withQueryParams(queryParams).build();
Payments payments = accountApi.getPaymentsForAccount(account.getAccountId(), NULL_PLUGIN_PROPERTIES, inputOptions);
Assert.assertNotNull(payments.get(0).getPaymentAttempts());
Assert.assertEquals(payments.get(0).getPaymentAttempts().get(0).getStateName(), "RETRIED");
Assert.assertEquals(payments.get(0).getPaymentAttempts().get(1).getStateName(), "SCHEDULED");
}
use of org.killbill.billing.client.model.Payments in project killbill by killbill.
the class TestPayment method verifyComboPayment.
private void verifyComboPayment(final Payment payment, final String paymentExternalKey, final BigDecimal authAmount, final BigDecimal capturedAmount, final BigDecimal refundedAmount, final int nbTransactions, final int paymentNb) throws KillBillClientException {
Assert.assertNotNull(payment.getPaymentNumber());
assertEquals(payment.getPaymentExternalKey(), paymentExternalKey);
assertEquals(payment.getAuthAmount().compareTo(authAmount), 0);
assertEquals(payment.getCapturedAmount().compareTo(capturedAmount), 0);
assertEquals(payment.getRefundedAmount().compareTo(refundedAmount), 0);
assertEquals(payment.getTransactions().size(), nbTransactions);
final Payments Payments = paymentApi.getPayments(null, NULL_PLUGIN_PROPERTIES, requestOptions);
assertEquals(Payments.size(), paymentNb);
assertEquals(Payments.get(paymentNb - 1), payment);
}
Aggregations