Skip to content

Commit

Permalink
Add new janitor tests for UnknownPaymentTransactionTask and PendingPa…
Browse files Browse the repository at this point in the history
…ymentTransactionTask

A bit of renaming in the janitor tasks
Fix MockPaymentProviderPlugin to keep track of PaymentTransactionInfoPlugin
  • Loading branch information
sbrossie committed Jun 12, 2015
1 parent d434647 commit 9254f84
Show file tree
Hide file tree
Showing 8 changed files with 108 additions and 43 deletions.
Expand Up @@ -51,12 +51,12 @@
* If the state of the transaction associated with the attempt completed, but the attempt state machine did not, * If the state of the transaction associated with the attempt completed, but the attempt state machine did not,
* we rerun the retry state machine to complete the call and transition the attempt into a terminal state. * we rerun the retry state machine to complete the call and transition the attempt into a terminal state.
*/ */
final class AttemptCompletionTask extends CompletionTaskBase<PaymentAttemptModelDao> { final class IncompletePaymentAttemptTask extends CompletionTaskBase<PaymentAttemptModelDao> {


public AttemptCompletionTask(final Janitor janitor, final InternalCallContextFactory internalCallContextFactory, final PaymentConfig paymentConfig, public IncompletePaymentAttemptTask(final Janitor janitor, final InternalCallContextFactory internalCallContextFactory, final PaymentConfig paymentConfig,
final PaymentDao paymentDao, final Clock clock, final PaymentStateMachineHelper paymentStateMachineHelper, final PaymentDao paymentDao, final Clock clock, final PaymentStateMachineHelper paymentStateMachineHelper,
final PaymentControlStateMachineHelper retrySMHelper, final AccountInternalApi accountInternalApi, final PaymentControlStateMachineHelper retrySMHelper, final AccountInternalApi accountInternalApi,
final PluginRoutingPaymentAutomatonRunner pluginControlledPaymentAutomatonRunner, final OSGIServiceRegistration<PaymentPluginApi> pluginRegistry) { final PluginRoutingPaymentAutomatonRunner pluginControlledPaymentAutomatonRunner, final OSGIServiceRegistration<PaymentPluginApi> pluginRegistry) {
super(janitor, internalCallContextFactory, paymentConfig, paymentDao, clock, paymentStateMachineHelper, retrySMHelper, accountInternalApi, pluginControlledPaymentAutomatonRunner, pluginRegistry); super(janitor, internalCallContextFactory, paymentConfig, paymentDao, clock, paymentStateMachineHelper, retrySMHelper, accountInternalApi, pluginControlledPaymentAutomatonRunner, pluginRegistry);
} }


Expand Down
Expand Up @@ -48,9 +48,9 @@ public class Janitor {


private final ScheduledExecutorService janitorExecutor; private final ScheduledExecutorService janitorExecutor;
private final PaymentConfig paymentConfig; private final PaymentConfig paymentConfig;
private final PendingTransactionTask pendingTransactionTask; private final PendingPaymentTransactionTask pendingPaymentTransactionTask;
private final AttemptCompletionTask attemptCompletionTask; private final IncompletePaymentAttemptTask incompletePaymentAttemptTask;
private final ErroredPaymentTask erroredPaymentCompletionTask; private final UnknownPaymentTransactionTask erroredPaymentCompletionTask;


private volatile boolean isStopped; private volatile boolean isStopped;


Expand All @@ -67,11 +67,11 @@ public Janitor(final AccountInternalApi accountInternalApi,
final OSGIServiceRegistration<PaymentPluginApi> pluginRegistry) { final OSGIServiceRegistration<PaymentPluginApi> pluginRegistry) {
this.janitorExecutor = janitorExecutor; this.janitorExecutor = janitorExecutor;
this.paymentConfig = paymentConfig; this.paymentConfig = paymentConfig;
this.pendingTransactionTask = new PendingTransactionTask(this, internalCallContextFactory, paymentConfig, paymentDao, clock, paymentSMHelper, retrySMHelper, this.pendingPaymentTransactionTask = new PendingPaymentTransactionTask(this, internalCallContextFactory, paymentConfig, paymentDao, clock, paymentSMHelper, retrySMHelper,
accountInternalApi, pluginControlledPaymentAutomatonRunner, pluginRegistry); accountInternalApi, pluginControlledPaymentAutomatonRunner, pluginRegistry);
this.attemptCompletionTask = new AttemptCompletionTask(this, internalCallContextFactory, paymentConfig, paymentDao, clock, paymentSMHelper, retrySMHelper, this.incompletePaymentAttemptTask = new IncompletePaymentAttemptTask(this, internalCallContextFactory, paymentConfig, paymentDao, clock, paymentSMHelper, retrySMHelper,
accountInternalApi, pluginControlledPaymentAutomatonRunner, pluginRegistry); accountInternalApi, pluginControlledPaymentAutomatonRunner, pluginRegistry);
this.erroredPaymentCompletionTask = new ErroredPaymentTask(this, internalCallContextFactory, paymentConfig, paymentDao, clock, paymentSMHelper, retrySMHelper, this.erroredPaymentCompletionTask = new UnknownPaymentTransactionTask(this, internalCallContextFactory, paymentConfig, paymentDao, clock, paymentSMHelper, retrySMHelper,
accountInternalApi, pluginControlledPaymentAutomatonRunner, pluginRegistry); accountInternalApi, pluginControlledPaymentAutomatonRunner, pluginRegistry);
this.isStopped = false; this.isStopped = false;
} }
Expand All @@ -85,12 +85,12 @@ public void start() {
// Start task for removing old pending payments. // Start task for removing old pending payments.
final TimeUnit pendingRateUnit = paymentConfig.getJanitorRunningRate().getUnit(); final TimeUnit pendingRateUnit = paymentConfig.getJanitorRunningRate().getUnit();
final long pendingPeriod = paymentConfig.getJanitorRunningRate().getPeriod(); final long pendingPeriod = paymentConfig.getJanitorRunningRate().getPeriod();
janitorExecutor.scheduleAtFixedRate(pendingTransactionTask, pendingPeriod, pendingPeriod, pendingRateUnit); janitorExecutor.scheduleAtFixedRate(pendingPaymentTransactionTask, pendingPeriod, pendingPeriod, pendingRateUnit);


// Start task for completing incomplete payment attempts // Start task for completing incomplete payment attempts
final TimeUnit attemptCompletionRateUnit = paymentConfig.getJanitorRunningRate().getUnit(); final TimeUnit attemptCompletionRateUnit = paymentConfig.getJanitorRunningRate().getUnit();
final long attemptCompletionPeriod = paymentConfig.getJanitorRunningRate().getPeriod(); final long attemptCompletionPeriod = paymentConfig.getJanitorRunningRate().getPeriod();
janitorExecutor.scheduleAtFixedRate(attemptCompletionTask, attemptCompletionPeriod, attemptCompletionPeriod, attemptCompletionRateUnit); janitorExecutor.scheduleAtFixedRate(incompletePaymentAttemptTask, attemptCompletionPeriod, attemptCompletionPeriod, attemptCompletionRateUnit);


// Start task for completing incomplete payment attempts // Start task for completing incomplete payment attempts
final TimeUnit erroredCompletionRateUnit = paymentConfig.getJanitorRunningRate().getUnit(); final TimeUnit erroredCompletionRateUnit = paymentConfig.getJanitorRunningRate().getUnit();
Expand Down
Expand Up @@ -39,12 +39,12 @@
/** /**
* Task to find old PENDING transactions and move them into * Task to find old PENDING transactions and move them into
*/ */
final class PendingTransactionTask extends CompletionTaskBase<PaymentTransactionModelDao> { final class PendingPaymentTransactionTask extends CompletionTaskBase<PaymentTransactionModelDao> {


public PendingTransactionTask(final Janitor janitor, final InternalCallContextFactory internalCallContextFactory, final PaymentConfig paymentConfig, public PendingPaymentTransactionTask(final Janitor janitor, final InternalCallContextFactory internalCallContextFactory, final PaymentConfig paymentConfig,
final PaymentDao paymentDao, final Clock clock, final PaymentStateMachineHelper paymentStateMachineHelper, final PaymentDao paymentDao, final Clock clock, final PaymentStateMachineHelper paymentStateMachineHelper,
final PaymentControlStateMachineHelper retrySMHelper, final AccountInternalApi accountInternalApi, final PaymentControlStateMachineHelper retrySMHelper, final AccountInternalApi accountInternalApi,
final PluginRoutingPaymentAutomatonRunner pluginControlledPaymentAutomatonRunner, final OSGIServiceRegistration<PaymentPluginApi> pluginRegistry) { final PluginRoutingPaymentAutomatonRunner pluginControlledPaymentAutomatonRunner, final OSGIServiceRegistration<PaymentPluginApi> pluginRegistry) {
super(janitor, internalCallContextFactory, paymentConfig, paymentDao, clock, paymentStateMachineHelper, retrySMHelper, accountInternalApi, pluginControlledPaymentAutomatonRunner, pluginRegistry); super(janitor, internalCallContextFactory, paymentConfig, paymentDao, clock, paymentStateMachineHelper, retrySMHelper, accountInternalApi, pluginControlledPaymentAutomatonRunner, pluginRegistry);
} }


Expand Down
Expand Up @@ -52,17 +52,17 @@
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.google.common.collect.Iterables; import com.google.common.collect.Iterables;


public class ErroredPaymentTask extends CompletionTaskBase<PaymentModelDao> { public class UnknownPaymentTransactionTask extends CompletionTaskBase<PaymentModelDao> {


// We could configure all that if this becomes useful but we also want to avoid a flurry of parameters. // We could configure all that if this becomes useful but we also want to avoid a flurry of parameters.
private static final int SAFETY_DELAY_MS = (3 * 60 * 1000); // 3 minutes private static final int SAFETY_DELAY_MS = (3 * 60 * 1000); // 3 minutes
private final int OLDER_PAYMENTS_IN_DAYS = 3; // don't look at ERRORED payment older than 3 days private final int OLDER_PAYMENTS_IN_DAYS = 3; // don't look at ERRORED payment older than 3 days
private final int MAX_ITEMS_PER_LOOP = 100; // Limit of items per iteration private final int MAX_ITEMS_PER_LOOP = 100; // Limit of items per iteration


public ErroredPaymentTask(final Janitor janitor, final InternalCallContextFactory internalCallContextFactory, final PaymentConfig paymentConfig, public UnknownPaymentTransactionTask(final Janitor janitor, final InternalCallContextFactory internalCallContextFactory, final PaymentConfig paymentConfig,
final PaymentDao paymentDao, final Clock clock, final PaymentDao paymentDao, final Clock clock,
final PaymentStateMachineHelper paymentStateMachineHelper, final PaymentControlStateMachineHelper retrySMHelper, final AccountInternalApi accountInternalApi, final PaymentStateMachineHelper paymentStateMachineHelper, final PaymentControlStateMachineHelper retrySMHelper, final AccountInternalApi accountInternalApi,
final PluginRoutingPaymentAutomatonRunner pluginControlledPaymentAutomatonRunner, final OSGIServiceRegistration<PaymentPluginApi> pluginRegistry) { final PluginRoutingPaymentAutomatonRunner pluginControlledPaymentAutomatonRunner, final OSGIServiceRegistration<PaymentPluginApi> pluginRegistry) {
super(janitor, internalCallContextFactory, paymentConfig, paymentDao, clock, paymentStateMachineHelper, retrySMHelper, accountInternalApi, pluginControlledPaymentAutomatonRunner, pluginRegistry); super(janitor, internalCallContextFactory, paymentConfig, paymentDao, clock, paymentStateMachineHelper, retrySMHelper, accountInternalApi, pluginControlledPaymentAutomatonRunner, pluginRegistry);
} }


Expand Down Expand Up @@ -106,7 +106,7 @@ public void doIteration(final PaymentModelDao item) {


pluginErroredTransaction = Iterables.tryFind(result, new Predicate<PaymentTransactionInfoPlugin>() { pluginErroredTransaction = Iterables.tryFind(result, new Predicate<PaymentTransactionInfoPlugin>() {
@Override @Override
public boolean apply(@Nullable final PaymentTransactionInfoPlugin input) { public boolean apply(final PaymentTransactionInfoPlugin input) {
return input.getKbTransactionPaymentId().equals(unknownTransaction.getId()); return input.getKbTransactionPaymentId().equals(unknownTransaction.getId());
} }
}).orNull(); }).orNull();
Expand Down
Expand Up @@ -86,6 +86,7 @@ public void beforeMethod() throws Exception {
super.beforeMethod(); super.beforeMethod();
eventBus.start(); eventBus.start();
Profiling.resetPerThreadProfilingData(); Profiling.resetPerThreadProfilingData();
clock.resetDeltaFromReality();


} }


Expand Down
Expand Up @@ -30,18 +30,19 @@
import org.killbill.billing.invoice.api.InvoiceApiException; import org.killbill.billing.invoice.api.InvoiceApiException;
import org.killbill.billing.invoice.api.InvoiceItem; import org.killbill.billing.invoice.api.InvoiceItem;
import org.killbill.billing.payment.api.Payment; import org.killbill.billing.payment.api.Payment;
import org.killbill.billing.payment.api.PaymentTransaction;
import org.killbill.billing.payment.api.PaymentApiException; import org.killbill.billing.payment.api.PaymentApiException;
import org.killbill.billing.payment.api.PaymentOptions; import org.killbill.billing.payment.api.PaymentOptions;
import org.killbill.billing.payment.api.PaymentTransaction;
import org.killbill.billing.payment.api.PluginProperty; import org.killbill.billing.payment.api.PluginProperty;
import org.killbill.billing.payment.api.TransactionStatus; import org.killbill.billing.payment.api.TransactionStatus;
import org.killbill.billing.payment.api.TransactionType; import org.killbill.billing.payment.api.TransactionType;
import org.killbill.billing.payment.invoice.InvoicePaymentRoutingPluginApi;
import org.killbill.billing.payment.core.janitor.Janitor; import org.killbill.billing.payment.core.janitor.Janitor;
import org.killbill.billing.payment.dao.PaymentAttemptModelDao; import org.killbill.billing.payment.dao.PaymentAttemptModelDao;
import org.killbill.billing.payment.invoice.InvoicePaymentRoutingPluginApi;
import org.killbill.billing.payment.provider.MockPaymentProviderPlugin; import org.killbill.billing.payment.provider.MockPaymentProviderPlugin;
import org.killbill.billing.platform.api.KillbillConfigSource; import org.killbill.billing.platform.api.KillbillConfigSource;
import org.killbill.bus.api.PersistentBus.EventBusException; import org.killbill.bus.api.PersistentBus.EventBusException;
import org.testng.Assert;
import org.testng.annotations.AfterClass; import org.testng.annotations.AfterClass;
import org.testng.annotations.AfterMethod; import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeClass; import org.testng.annotations.BeforeClass;
Expand All @@ -68,7 +69,6 @@ public List<String> getPaymentControlPluginNames() {
} }
}; };



@Inject @Inject
private Janitor janitor; private Janitor janitor;


Expand All @@ -94,7 +94,6 @@ protected void afterClass() throws Exception {
janitor.stop(); janitor.stop();
} }



@BeforeMethod(groups = "slow") @BeforeMethod(groups = "slow")
public void beforeMethod() throws Exception { public void beforeMethod() throws Exception {
super.beforeMethod(); super.beforeMethod();
Expand Down Expand Up @@ -131,7 +130,7 @@ public void testCreateSuccessPurchaseWithPaymentControl() throws PaymentApiExcep
Currency.USD)); Currency.USD));


final Payment payment = paymentApi.createPurchaseWithPaymentControl(account, account.getPaymentMethodId(), null, requestedAmount, Currency.USD, paymentExternalKey, transactionExternalKey, final Payment payment = paymentApi.createPurchaseWithPaymentControl(account, account.getPaymentMethodId(), null, requestedAmount, Currency.USD, paymentExternalKey, transactionExternalKey,
createPropertiesForInvoice(invoice), INVOICE_PAYMENT, callContext); createPropertiesForInvoice(invoice), INVOICE_PAYMENT, callContext);
assertEquals(payment.getTransactions().size(), 1); assertEquals(payment.getTransactions().size(), 1);
assertEquals(payment.getTransactions().get(0).getTransactionStatus(), TransactionStatus.SUCCESS); assertEquals(payment.getTransactions().get(0).getTransactionStatus(), TransactionStatus.SUCCESS);
assertEquals(payment.getTransactions().get(0).getTransactionType(), TransactionType.PURCHASE); assertEquals(payment.getTransactions().get(0).getTransactionType(), TransactionType.PURCHASE);
Expand All @@ -148,7 +147,11 @@ public void testCreateSuccessPurchaseWithPaymentControl() throws PaymentApiExcep
assertEquals(attempt2.getStateName(), "INIT"); assertEquals(attempt2.getStateName(), "INIT");


clock.addDays(1); clock.addDays(1);
try { Thread.sleep(1500); } catch (InterruptedException e) {}; try {
Thread.sleep(1500);
} catch (InterruptedException e) {
}
;

This comment has been minimized.

Copy link
@pierre

pierre Jun 13, 2015

Member

Nit: extra ;.

This comment has been minimized.

Copy link
@sbrossie

sbrossie Jun 13, 2015

Author Member

Will do...

What does 'Nit;" means exactly?

This comment has been minimized.

Copy link
@pierre

pierre Jun 14, 2015

Member

In this context, detail (trivial, non critical stuff). If I put nit, you don't have to reply/fix it. Otherwise, you do! 😼

From https://en.wikipedia.org/wiki/Nitpicking:

As nitpicking inherently requires fastidious, meticulous attention to detail, the term has become appropriated to describe the practice of meticulously searching for minor, even trivial errors in detail (often referred to as "nits" as well), and then criticising them (see hypercriticism).



final PaymentAttemptModelDao attempt3 = paymentDao.getPaymentAttempt(attempt.getId(), internalCallContext); final PaymentAttemptModelDao attempt3 = paymentDao.getPaymentAttempt(attempt.getId(), internalCallContext);
assertEquals(attempt3.getStateName(), "SUCCESS"); assertEquals(attempt3.getStateName(), "SUCCESS");
Expand Down Expand Up @@ -180,7 +183,7 @@ public void testCreateSuccessRefundPaymentControlWithItemAdjustments() throws Pa
invoice.addInvoiceItem(invoiceItem); invoice.addInvoiceItem(invoiceItem);


final Payment payment = paymentApi.createPurchaseWithPaymentControl(account, account.getPaymentMethodId(), null, requestedAmount, Currency.USD, paymentExternalKey, transactionExternalKey, final Payment payment = paymentApi.createPurchaseWithPaymentControl(account, account.getPaymentMethodId(), null, requestedAmount, Currency.USD, paymentExternalKey, transactionExternalKey,
createPropertiesForInvoice(invoice), INVOICE_PAYMENT, callContext); createPropertiesForInvoice(invoice), INVOICE_PAYMENT, callContext);


final List<PluginProperty> refundProperties = new ArrayList<PluginProperty>(); final List<PluginProperty> refundProperties = new ArrayList<PluginProperty>();
final HashMap<UUID, BigDecimal> uuidBigDecimalHashMap = new HashMap<UUID, BigDecimal>(); final HashMap<UUID, BigDecimal> uuidBigDecimalHashMap = new HashMap<UUID, BigDecimal>();
Expand All @@ -189,7 +192,7 @@ public void testCreateSuccessRefundPaymentControlWithItemAdjustments() throws Pa
refundProperties.add(refundIdsProp); refundProperties.add(refundIdsProp);


final Payment payment2 = paymentApi.createRefundWithPaymentControl(account, payment.getId(), null, Currency.USD, transactionExternalKey2, final Payment payment2 = paymentApi.createRefundWithPaymentControl(account, payment.getId(), null, Currency.USD, transactionExternalKey2,
refundProperties, INVOICE_PAYMENT, callContext); refundProperties, INVOICE_PAYMENT, callContext);


assertEquals(payment2.getTransactions().size(), 2); assertEquals(payment2.getTransactions().size(), 2);
PaymentTransaction refundTransaction = payment2.getTransactions().get(1); PaymentTransaction refundTransaction = payment2.getTransactions().get(1);
Expand All @@ -207,15 +210,71 @@ public void testCreateSuccessRefundPaymentControlWithItemAdjustments() throws Pa
assertEquals(attempt2.getStateName(), "INIT"); assertEquals(attempt2.getStateName(), "INIT");


clock.addDays(1); clock.addDays(1);
try { Thread.sleep(1500); } catch (InterruptedException e) {}; try {
Thread.sleep(1500);
} catch (InterruptedException e) {
}
;

This comment has been minimized.

Copy link
@pierre

pierre Jun 13, 2015

Member

Nit: extra ;.

This comment has been minimized.

Copy link
@sbrossie

sbrossie Jun 13, 2015

Author Member

Will do.



final PaymentAttemptModelDao attempt3 = paymentDao.getPaymentAttempt(refundAttempt.getId(), internalCallContext); final PaymentAttemptModelDao attempt3 = paymentDao.getPaymentAttempt(refundAttempt.getId(), internalCallContext);
assertEquals(attempt3.getStateName(), "SUCCESS"); assertEquals(attempt3.getStateName(), "SUCCESS");
}

@Test(groups = "slow")
public void testUnknownEntries() throws PaymentApiException, InvoiceApiException, EventBusException {

final BigDecimal requestedAmount = BigDecimal.TEN;
final String paymentExternalKey = "qwru";
final String transactionExternalKey = "lkjdsf";

final Payment payment = paymentApi.createAuthorization(account, account.getPaymentMethodId(), null, requestedAmount, account.getCurrency(), paymentExternalKey,
transactionExternalKey, ImmutableList.<PluginProperty>of(), callContext);

// Artificially move the transaction status to UNKNOWN
final String paymentStateName = paymentSMHelper.getErroredStateForTransaction(TransactionType.AUTHORIZE).toString();
paymentDao.updatePaymentAndTransactionOnCompletion(account.getId(), payment.getId(), TransactionType.AUTHORIZE, paymentStateName, paymentStateName,
payment.getTransactions().get(0).getId(), TransactionStatus.UNKNOWN, requestedAmount, account.getCurrency(),
"foo", "bar", internalCallContext);
// The UnknownPaymentTransactionTask will look for UNKNOWN payment that *just happened* (in the last SAFETY_DELAY_MS=3min delay), and that are not too old (less than 3 days)
clock.addDays(1);
try {
Thread.sleep(1500);
} catch (InterruptedException e) {
}

final Payment updatedPayment = paymentApi.getPayment(payment.getId(), false, ImmutableList.<PluginProperty>of(), callContext);
assertEquals(updatedPayment.getTransactions().get(0).getTransactionStatus(), TransactionStatus.SUCCESS);


} }






@Test(groups = "slow")
public void testPendingEntries() throws PaymentApiException, InvoiceApiException, EventBusException {

final BigDecimal requestedAmount = BigDecimal.TEN;
final String paymentExternalKey = "jhj44";
final String transactionExternalKey = "4jhjj2";

final Payment payment = paymentApi.createAuthorization(account, account.getPaymentMethodId(), null, requestedAmount, account.getCurrency(), paymentExternalKey,
transactionExternalKey, ImmutableList.<PluginProperty>of(), callContext);

// Artificially move the transaction status to PENDING
final String paymentStateName = paymentSMHelper.getPendingStateForTransaction(TransactionType.AUTHORIZE).toString();
paymentDao.updatePaymentAndTransactionOnCompletion(account.getId(), payment.getId(), TransactionType.AUTHORIZE, paymentStateName, paymentStateName,
payment.getTransactions().get(0).getId(), TransactionStatus.PENDING, requestedAmount, account.getCurrency(),
"loup", "chat", internalCallContext);
clock.addDays(1);
try {
Thread.sleep(1500);
} catch (InterruptedException e) {
}

final Payment updatedPayment = paymentApi.getPayment(payment.getId(), false, ImmutableList.<PluginProperty>of(), callContext);
Assert.assertEquals(updatedPayment.getTransactions().get(0).getTransactionStatus(), TransactionStatus.PAYMENT_FAILURE);

This comment has been minimized.

Copy link
@pierre

pierre Jun 13, 2015

Member

Correctly updated in c336156 👍

This comment has been minimized.

Copy link
@sbrossie

sbrossie Jun 13, 2015

Author Member

yep..


}

private List<PluginProperty> createPropertiesForInvoice(final Invoice invoice) { private List<PluginProperty> createPropertiesForInvoice(final Invoice invoice) {
final List<PluginProperty> result = new ArrayList<PluginProperty>(); final List<PluginProperty> result = new ArrayList<PluginProperty>();
result.add(new PluginProperty(InvoicePaymentRoutingPluginApi.PROP_IPCD_INVOICE_ID, invoice.getId().toString(), false)); result.add(new PluginProperty(InvoicePaymentRoutingPluginApi.PROP_IPCD_INVOICE_ID, invoice.getId().toString(), false));
Expand Down
Expand Up @@ -535,7 +535,7 @@ public void testSimpleAuthCaptureWithInvalidPaymentId() throws Exception {
} catch (final PaymentApiException e) { } catch (final PaymentApiException e) {
Assert.assertEquals(e.getCode(), ErrorCode.PAYMENT_NO_SUCH_PAYMENT.getCode()); Assert.assertEquals(e.getCode(), ErrorCode.PAYMENT_NO_SUCH_PAYMENT.getCode());


final Payment latestPayment = paymentApi.getPayment(initialPayment.getId(), false, ImmutableList.<PluginProperty>of(), callContext); final Payment latestPayment = paymentApi.getPayment(initialPayment.getId(), true, ImmutableList.<PluginProperty>of(), callContext);
assertEquals(latestPayment, initialPayment); assertEquals(latestPayment, initialPayment);
} }
} }
Expand All @@ -555,7 +555,7 @@ public void testSimpleAuthCaptureWithInvalidCurrency() throws Exception {
} catch (final PaymentApiException e) { } catch (final PaymentApiException e) {
Assert.assertEquals(e.getCode(), ErrorCode.PAYMENT_INVALID_PARAMETER.getCode()); Assert.assertEquals(e.getCode(), ErrorCode.PAYMENT_INVALID_PARAMETER.getCode());


final Payment latestPayment = paymentApi.getPayment(initialPayment.getId(), false, ImmutableList.<PluginProperty>of(), callContext); final Payment latestPayment = paymentApi.getPayment(initialPayment.getId(), true, ImmutableList.<PluginProperty>of(), callContext);
assertEquals(latestPayment, initialPayment); assertEquals(latestPayment, initialPayment);
} }
} }
Expand Down

0 comments on commit 9254f84

Please sign in to comment.