public List<String> getPaymentControlPluginNames(final UUID kbPaymentId, final TenantContext context) throws PaymentApiException { if (!withControl) { // Note that we could have decided to always call the control APIs with an empty list, since Kill Bill would have defaulted // to the non-control APIs. However, it might be better for the long term to not rely on that specific implementation behavior // (we have two APIs after all). return null; } final Payment payment = osgiKillbillAPI.getPaymentApi().getPayment(kbPaymentId, false, true, ImmutableList.<PluginProperty>of(), context); if (payment.getPaymentAttempts() != null && !payment.getPaymentAttempts().isEmpty()) { return ImmutableList.<String>copyOf(Splitter.on(",").split(payment.getPaymentAttempts().get(0).getPluginName())); } else { return ImmutableList.<String>of(); } }
public PaymentAttemptJson(final PaymentAttempt paymentAttempt, final String paymentExternalKey, @Nullable final List<AuditLog> attemptsLogs) { this(paymentAttempt.getAccountId(), // Could be null if aborted in the priorCall paymentAttempt.getPaymentMethodId(), paymentExternalKey, paymentAttempt.getTransactionId(), paymentAttempt.getTransactionExternalKey(), paymentAttempt.getTransactionType(), paymentAttempt.getEffectiveDate(), paymentAttempt.getStateName(), paymentAttempt.getAmount(), paymentAttempt.getCurrency() != null ? paymentAttempt.getCurrency() : null, paymentAttempt.getPluginName(), paymentAttempt.getPluginProperties() == null ? null : toPluginPropertyJson(paymentAttempt.getPluginProperties()), toAuditLogJson(attemptsLogs)); }
assertEquals(payments.get(0).getTransactions().get(0).getTransactionStatus(), TransactionStatus.PENDING); assertEquals(payments.get(0).getPaymentAttempts().size(), 1); assertEquals(payments.get(0).getPaymentAttempts().get(0).getPluginName(), InvoicePaymentControlPluginApi.PLUGIN_NAME); assertEquals(payments.get(0).getPaymentAttempts().get(0).getStateName(), "SUCCESS"); assertEquals(payments2.get(0).getTransactions().get(0).getTransactionStatus(), TransactionStatus.PAYMENT_FAILURE); assertEquals(payments2.get(0).getPaymentAttempts().size(), 1); assertEquals(payments2.get(0).getPaymentAttempts().get(0).getPluginName(), InvoicePaymentControlPluginApi.PLUGIN_NAME);
assertEquals(payments.get(0).getTransactions().get(0).getTransactionStatus(), TransactionStatus.SUCCESS); assertEquals(payments.get(0).getPaymentAttempts().size(), 1); assertEquals(payments.get(0).getPaymentAttempts().get(0).getPluginName(), InvoicePaymentControlPluginApi.PLUGIN_NAME); assertEquals(payments.get(0).getPaymentAttempts().get(0).getStateName(), "SUCCESS"); assertEquals(payments2.get(0).getTransactions().get(0).getTransactionStatus(), TransactionStatus.PAYMENT_FAILURE); assertEquals(payments2.get(0).getPaymentAttempts().size(), 1); assertEquals(payments2.get(0).getPaymentAttempts().get(0).getPluginName(), InvoicePaymentControlPluginApi.PLUGIN_NAME);
assertEquals(payments.get(0).getTransactions().get(0).getTransactionStatus(), TransactionStatus.PAYMENT_FAILURE); assertEquals(payments.get(0).getPaymentAttempts().size(), 2); assertEquals(payments.get(0).getPaymentAttempts().get(0).getPluginName(), InvoicePaymentControlPluginApi.PLUGIN_NAME); assertEquals(payments.get(0).getPaymentAttempts().get(0).getStateName(), "RETRIED"); assertEquals(payments.get(0).getPaymentAttempts().get(1).getPluginName(), InvoicePaymentControlPluginApi.PLUGIN_NAME); assertEquals(payments.get(0).getPaymentAttempts().get(1).getStateName(), "SCHEDULED"); assertEquals(payments2.get(0).getTransactions().get(0).getTransactionStatus(), TransactionStatus.SUCCESS); assertEquals(payments2.get(0).getPaymentAttempts().size(), 1); assertEquals(payments2.get(0).getPaymentAttempts().get(0).getPluginName(), InvoicePaymentControlPluginApi.PLUGIN_NAME); assertEquals(payments2.get(0).getPaymentAttempts().get(0).getStateName(), "SUCCESS");
assertEquals(payments.get(0).getTransactions().get(0).getTransactionStatus(), TransactionStatus.PENDING); assertEquals(payments.get(0).getPaymentAttempts().size(), 1); assertEquals(payments.get(0).getPaymentAttempts().get(0).getPluginName(), InvoicePaymentControlPluginApi.PLUGIN_NAME); assertEquals(payments.get(0).getPaymentAttempts().get(0).getStateName(), "SUCCESS"); assertEquals(payments2.get(0).getTransactions().get(0).getTransactionStatus(), TransactionStatus.SUCCESS); assertEquals(payments2.get(0).getPaymentAttempts().size(), 1); assertEquals(payments2.get(0).getPaymentAttempts().get(0).getPluginName(), InvoicePaymentControlPluginApi.PLUGIN_NAME); assertEquals(payments2.get(0).getPaymentAttempts().get(0).getStateName(), "SUCCESS");
assertEquals(payments.get(0).getTransactions().get(0).getTransactionStatus(), TransactionStatus.UNKNOWN); assertEquals(payments.get(0).getPaymentAttempts().size(), 1); assertEquals(payments.get(0).getPaymentAttempts().get(0).getPluginName(), InvoicePaymentControlPluginApi.PLUGIN_NAME); assertEquals(payments.get(0).getPaymentAttempts().get(0).getStateName(), "ABORTED"); assertEquals(payments2.get(0).getTransactions().get(0).getTransactionStatus(), TransactionStatus.SUCCESS); assertEquals(payments2.get(0).getPaymentAttempts().size(), 1); assertEquals(payments2.get(0).getPaymentAttempts().get(0).getPluginName(), InvoicePaymentControlPluginApi.PLUGIN_NAME); assertEquals(payments2.get(0).getPaymentAttempts().get(0).getStateName(), "SUCCESS");
assertEquals(payments.get(0).getTransactions().get(0).getTransactionStatus(), TransactionStatus.UNKNOWN); assertEquals(payments.get(0).getPaymentAttempts().size(), 1); assertEquals(payments.get(0).getPaymentAttempts().get(0).getPluginName(), InvoicePaymentControlPluginApi.PLUGIN_NAME); assertEquals(payments.get(0).getPaymentAttempts().get(0).getStateName(), "ABORTED"); assertEquals(payments2.get(0).getTransactions().get(0).getTransactionStatus(), TransactionStatus.SUCCESS); assertEquals(payments2.get(0).getPaymentAttempts().size(), 1); assertEquals(payments2.get(0).getPaymentAttempts().get(0).getPluginName(), InvoicePaymentControlPluginApi.PLUGIN_NAME); assertEquals(payments2.get(0).getPaymentAttempts().get(0).getStateName(), "SUCCESS");