killbill-memoizeit

payment: update InvoicePaymentApi Signed-off-by: Pierre-Alexandre

6/17/2018 2:38:38 AM

Details

diff --git a/api/src/main/java/org/killbill/billing/payment/api/InvoicePaymentInternalApi.java b/api/src/main/java/org/killbill/billing/payment/api/InvoicePaymentInternalApi.java
index 327dbf3..1fa47a0 100644
--- a/api/src/main/java/org/killbill/billing/payment/api/InvoicePaymentInternalApi.java
+++ b/api/src/main/java/org/killbill/billing/payment/api/InvoicePaymentInternalApi.java
@@ -28,17 +28,17 @@ import org.killbill.billing.invoice.api.InvoicePayment;
 
 public interface InvoicePaymentInternalApi {
 
-    public InvoicePayment createPurchaseForInvoice(boolean isApiPayment,
-                                                   Account account,
-                                                   UUID invoiceId,
-                                                   UUID paymentMethodId,
-                                                   UUID paymentId,
-                                                   BigDecimal amount,
-                                                   Currency currency,
-                                                   DateTime effectiveDate,
-                                                   String paymentExternalKey,
-                                                   String paymentTransactionExternalKey,
-                                                   Iterable<PluginProperty> properties,
-                                                   PaymentOptions paymentOptions,
-                                                   InternalCallContext context) throws PaymentApiException;
+    public InvoicePayment createPurchaseForInvoicePayment(boolean isApiPayment,
+                                                          Account account,
+                                                          UUID invoiceId,
+                                                          UUID paymentMethodId,
+                                                          UUID paymentId,
+                                                          BigDecimal amount,
+                                                          Currency currency,
+                                                          DateTime effectiveDate,
+                                                          String paymentExternalKey,
+                                                          String paymentTransactionExternalKey,
+                                                          Iterable<PluginProperty> properties,
+                                                          PaymentOptions paymentOptions,
+                                                          InternalCallContext context) throws PaymentApiException;
 }
diff --git a/beatrix/src/test/java/org/killbill/billing/beatrix/integration/TestIntegrationBase.java b/beatrix/src/test/java/org/killbill/billing/beatrix/integration/TestIntegrationBase.java
index 9b44721..822cffe 100644
--- a/beatrix/src/test/java/org/killbill/billing/beatrix/integration/TestIntegrationBase.java
+++ b/beatrix/src/test/java/org/killbill/billing/beatrix/integration/TestIntegrationBase.java
@@ -523,18 +523,18 @@ public class TestIntegrationBase extends BeatrixTestSuiteWithEmbeddedDB implemen
             @Override
             public Payment apply(@Nullable final Void input) {
                 try {
-                    final InvoicePayment invoicePayment = invoicePaymentApi.createPurchaseForInvoice(account,
-                                                                                                     invoice.getId(),
-                                                                                                     account.getPaymentMethodId(),
-                                                                                                     null,
-                                                                                                     amount,
-                                                                                                     currency,
-                                                                                                     null,
-                                                                                                     UUID.randomUUID().toString(),
-                                                                                                     UUID.randomUUID().toString(),
-                                                                                                     ImmutableList.<PluginProperty>of(),
-                                                                                                     PAYMENT_OPTIONS,
-                                                                                                     callContext);
+                    final InvoicePayment invoicePayment = invoicePaymentApi.createPurchaseForInvoicePayment(account,
+                                                                                                            invoice.getId(),
+                                                                                                            account.getPaymentMethodId(),
+                                                                                                            null,
+                                                                                                            amount,
+                                                                                                            currency,
+                                                                                                            null,
+                                                                                                            UUID.randomUUID().toString(),
+                                                                                                            UUID.randomUUID().toString(),
+                                                                                                            ImmutableList.<PluginProperty>of(),
+                                                                                                            PAYMENT_OPTIONS,
+                                                                                                            callContext);
                     return paymentApi.getPayment(invoicePayment.getPaymentId(), false, false, ImmutableList.<PluginProperty>of(), callContext);
                 } catch (final PaymentApiException e) {
                     fail(e.toString());
@@ -553,18 +553,18 @@ public class TestIntegrationBase extends BeatrixTestSuiteWithEmbeddedDB implemen
             @Override
             public Payment apply(@Nullable final Void input) {
                 try {
-                    final InvoicePayment invoicePayment = invoicePaymentApi.createPurchaseForInvoice(account,
-                                                                                                     invoice.getId(),
-                                                                                                     account.getPaymentMethodId(),
-                                                                                                     null,
-                                                                                                     invoice.getBalance(),
-                                                                                                     invoice.getCurrency(),
-                                                                                                     null,
-                                                                                                     UUID.randomUUID().toString(),
-                                                                                                     UUID.randomUUID().toString(),
-                                                                                                     ImmutableList.<PluginProperty>of(),
-                                                                                                     EXTERNAL_PAYMENT_OPTIONS,
-                                                                                                     callContext);
+                    final InvoicePayment invoicePayment = invoicePaymentApi.createPurchaseForInvoicePayment(account,
+                                                                                                            invoice.getId(),
+                                                                                                            account.getPaymentMethodId(),
+                                                                                                            null,
+                                                                                                            invoice.getBalance(),
+                                                                                                            invoice.getCurrency(),
+                                                                                                            null,
+                                                                                                            UUID.randomUUID().toString(),
+                                                                                                            UUID.randomUUID().toString(),
+                                                                                                            ImmutableList.<PluginProperty>of(),
+                                                                                                            EXTERNAL_PAYMENT_OPTIONS,
+                                                                                                            callContext);
                     return paymentApi.getPayment(invoicePayment.getPaymentId(), false, false, ImmutableList.<PluginProperty>of(), callContext);
                 } catch (final PaymentApiException e) {
                     fail(e.toString());
@@ -603,8 +603,8 @@ public class TestIntegrationBase extends BeatrixTestSuiteWithEmbeddedDB implemen
             @Override
             public Payment apply(@Nullable final Void input) {
                 try {
-                    final InvoicePayment invoicePayment = invoicePaymentApi.createRefundForInvoice(true, iias, account, payment.getId(), amount, currency, null, UUID.randomUUID().toString(),
-                                                                                                   ImmutableList.<PluginProperty>of(), PAYMENT_OPTIONS, callContext);
+                    final InvoicePayment invoicePayment = invoicePaymentApi.createRefundForInvoicePayment(true, iias, account, payment.getId(), amount, currency, null, UUID.randomUUID().toString(),
+                                                                                                          ImmutableList.<PluginProperty>of(), PAYMENT_OPTIONS, callContext);
                     return paymentApi.getPayment(invoicePayment.getPaymentId(), false, false, ImmutableList.<PluginProperty>of(), callContext);
                 } catch (final PaymentApiException e) {
                     fail(e.toString());
diff --git a/beatrix/src/test/java/org/killbill/billing/beatrix/integration/TestIntegrationParentInvoice.java b/beatrix/src/test/java/org/killbill/billing/beatrix/integration/TestIntegrationParentInvoice.java
index 1c01ac6..d099c50 100644
--- a/beatrix/src/test/java/org/killbill/billing/beatrix/integration/TestIntegrationParentInvoice.java
+++ b/beatrix/src/test/java/org/killbill/billing/beatrix/integration/TestIntegrationParentInvoice.java
@@ -1155,24 +1155,23 @@ public class TestIntegrationParentInvoice extends TestIntegrationBase {
         assertEquals(invoiceUserApi.getAccountBalance(parentAccount.getId(), callContext).compareTo(new BigDecimal("249.95")), 0);
         assertEquals(invoiceUserApi.getAccountBalance(childAccount.getId(), callContext).compareTo(new BigDecimal("249.95")), 0);
 
-
         // Verify Invoice apis getParentAccountId/getParentInvoiceId
         assertEquals(childInvoices.get(1).getParentAccountId(), parentAccount.getId());
         assertEquals(childInvoices.get(1).getParentInvoiceId(), parentInvoice.getId());
 
         try {
-            invoicePaymentApi.createPurchaseForInvoice(childAccount,
-                                                       childInvoices.get(1).getId(),
-                                                       childAccount.getPaymentMethodId(),
-                                                       null,
-                                                       childInvoices.get(1).getBalance(),
-                                                       childInvoices.get(1).getCurrency(),
-                                                       null,
-                                                       UUID.randomUUID().toString(),
-                                                       UUID.randomUUID().toString(),
-                                                       ImmutableList.<PluginProperty>of(),
-                                                       PAYMENT_OPTIONS,
-                                                       callContext);
+            invoicePaymentApi.createPurchaseForInvoicePayment(childAccount,
+                                                              childInvoices.get(1).getId(),
+                                                              childAccount.getPaymentMethodId(),
+                                                              null,
+                                                              childInvoices.get(1).getBalance(),
+                                                              childInvoices.get(1).getCurrency(),
+                                                              null,
+                                                              UUID.randomUUID().toString(),
+                                                              UUID.randomUUID().toString(),
+                                                              ImmutableList.<PluginProperty>of(),
+                                                              PAYMENT_OPTIONS,
+                                                              callContext);
             Assert.fail("Payment should fail, invoice belongs to parent");
         } catch (final PaymentApiException e) {
             assertEquals(ErrorCode.PAYMENT_PLUGIN_API_ABORTED.getCode(), e.getCode());
diff --git a/beatrix/src/test/java/org/killbill/billing/beatrix/integration/TestInvoicePayment.java b/beatrix/src/test/java/org/killbill/billing/beatrix/integration/TestInvoicePayment.java
index 218d916..b00c5e3 100644
--- a/beatrix/src/test/java/org/killbill/billing/beatrix/integration/TestInvoicePayment.java
+++ b/beatrix/src/test/java/org/killbill/billing/beatrix/integration/TestInvoicePayment.java
@@ -1065,18 +1065,18 @@ public class TestInvoicePayment extends TestIntegrationBase {
         //
         busHandler.pushExpectedEvents(NextEvent.INVOICE_PAYMENT);
         try {
-            invoicePaymentApi.createPurchaseForInvoice(account,
-                                                       updateInvoice2.getId(),
-                                                       account.getPaymentMethodId(),
-                                                       null,
-                                                       updateInvoice2.getBalance(),
-                                                       updateInvoice2.getCurrency(),
-                                                       null,
-                                                       UUID.randomUUID().toString(),
-                                                       UUID.randomUUID().toString(),
-                                                       ImmutableList.<PluginProperty>of(),
-                                                       PAYMENT_OPTIONS,
-                                                       callContext);
+            invoicePaymentApi.createPurchaseForInvoicePayment(account,
+                                                              updateInvoice2.getId(),
+                                                              account.getPaymentMethodId(),
+                                                              null,
+                                                              updateInvoice2.getBalance(),
+                                                              updateInvoice2.getCurrency(),
+                                                              null,
+                                                              UUID.randomUUID().toString(),
+                                                              UUID.randomUUID().toString(),
+                                                              ImmutableList.<PluginProperty>of(),
+                                                              PAYMENT_OPTIONS,
+                                                              callContext);
             Assert.fail("The payment should not succeed (and yet it will repair the broken state....)");
         } catch (final PaymentApiException expected) {
             Assert.assertEquals(expected.getCode(), ErrorCode.PAYMENT_PLUGIN_API_ABORTED.getCode());
diff --git a/beatrix/src/test/java/org/killbill/billing/beatrix/integration/TestPaymentRefund.java b/beatrix/src/test/java/org/killbill/billing/beatrix/integration/TestPaymentRefund.java
index fe761be..ad12eae 100644
--- a/beatrix/src/test/java/org/killbill/billing/beatrix/integration/TestPaymentRefund.java
+++ b/beatrix/src/test/java/org/killbill/billing/beatrix/integration/TestPaymentRefund.java
@@ -115,8 +115,8 @@ public class TestPaymentRefund extends TestIntegrationBase {
     @Test(groups = "slow")
     public void testFailedRefundWithInvoiceAdjustment() throws Exception {
         try {
-            invoicePaymentApi.createRefundForInvoice(true, null, account, payment.getId(), payment.getPurchasedAmount(), payment.getCurrency(), null, UUID.randomUUID().toString(),
-                                                     ImmutableList.<PluginProperty>of(), PAYMENT_OPTIONS, callContext);
+            invoicePaymentApi.createRefundForInvoicePayment(true, null, account, payment.getId(), payment.getPurchasedAmount(), payment.getCurrency(), null, UUID.randomUUID().toString(),
+                                                            ImmutableList.<PluginProperty>of(), PAYMENT_OPTIONS, callContext);
             fail("Refund with invoice adjustment should now throw an Exception");
         } catch (final PaymentApiException e) {
             Assert.assertEquals(e.getCause(), null);
diff --git a/jaxrs/src/main/java/org/killbill/billing/jaxrs/resources/InvoicePaymentResource.java b/jaxrs/src/main/java/org/killbill/billing/jaxrs/resources/InvoicePaymentResource.java
index eed3dfd..54aa634 100644
--- a/jaxrs/src/main/java/org/killbill/billing/jaxrs/resources/InvoicePaymentResource.java
+++ b/jaxrs/src/main/java/org/killbill/billing/jaxrs/resources/InvoicePaymentResource.java
@@ -189,32 +189,32 @@ public class InvoicePaymentResource extends JaxRsResourceBase {
 
         final InvoicePayment result;
         if (externalPayment) {
-            result = invoicePaymentApi.createCreditForInvoice(isAdjusted,
-                                                              adjustments,
-                                                              account,
-                                                              paymentId,
-                                                              paymentMethodId,
-                                                              null,
-                                                              json.getAmount(),
-                                                              account.getCurrency(),
-                                                              json.getEffectiveDate(),
-                                                              paymentExternalKey,
-                                                              transactionExternalKey,
-                                                              pluginProperties,
-                                                              createInvoicePaymentControlPluginApiPaymentOptions(true),
-                                                              callContext);
+            result = invoicePaymentApi.createCreditForInvoicePayment(isAdjusted,
+                                                                     adjustments,
+                                                                     account,
+                                                                     paymentId,
+                                                                     paymentMethodId,
+                                                                     null,
+                                                                     json.getAmount(),
+                                                                     account.getCurrency(),
+                                                                     json.getEffectiveDate(),
+                                                                     paymentExternalKey,
+                                                                     transactionExternalKey,
+                                                                     pluginProperties,
+                                                                     createInvoicePaymentControlPluginApiPaymentOptions(true),
+                                                                     callContext);
         } else {
-            result = invoicePaymentApi.createRefundForInvoice(isAdjusted,
-                                                              adjustments,
-                                                              account,
-                                                              payment.getId(),
-                                                              json.getAmount(),
-                                                              account.getCurrency(),
-                                                              json.getEffectiveDate(),
-                                                              transactionExternalKey,
-                                                              pluginProperties,
-                                                              createInvoicePaymentControlPluginApiPaymentOptions(false),
-                                                              callContext);
+            result = invoicePaymentApi.createRefundForInvoicePayment(isAdjusted,
+                                                                     adjustments,
+                                                                     account,
+                                                                     payment.getId(),
+                                                                     json.getAmount(),
+                                                                     account.getCurrency(),
+                                                                     json.getEffectiveDate(),
+                                                                     transactionExternalKey,
+                                                                     pluginProperties,
+                                                                     createInvoicePaymentControlPluginApiPaymentOptions(false),
+                                                                     callContext);
         }
 
         return uriBuilder.buildResponse(uriInfo, InvoicePaymentResource.class, "getInvoicePayment", result.getId(), request);
@@ -336,9 +336,9 @@ public class InvoicePaymentResource extends JaxRsResourceBase {
         }
 
         final PaymentOptions paymentOptions = createControlPluginApiPaymentOptions(paymentControlPluginNames);
-        invoicePaymentApi.createPurchaseForInvoice(account, invoiceId, payment.getPaymentMethodId(), payment.getId(), amount, currency, null,
-                                                   payment.getExternalKey(), pendingOrSuccessTransaction.getExternalKey(),
-                                                   pluginProperties, paymentOptions, callContext);
+        invoicePaymentApi.createPurchaseForInvoicePayment(account, invoiceId, payment.getPaymentMethodId(), payment.getId(), amount, currency, null,
+                                                          payment.getExternalKey(), pendingOrSuccessTransaction.getExternalKey(),
+                                                          pluginProperties, paymentOptions, callContext);
 
         return Response.status(Status.NO_CONTENT).build();
     }
diff --git a/jaxrs/src/main/java/org/killbill/billing/jaxrs/resources/JaxRsResourceBase.java b/jaxrs/src/main/java/org/killbill/billing/jaxrs/resources/JaxRsResourceBase.java
index c58b4ac..92dc6b6 100644
--- a/jaxrs/src/main/java/org/killbill/billing/jaxrs/resources/JaxRsResourceBase.java
+++ b/jaxrs/src/main/java/org/killbill/billing/jaxrs/resources/JaxRsResourceBase.java
@@ -546,19 +546,18 @@ public abstract class JaxRsResourceBase implements JaxrsResource {
 
     protected InvoicePayment createPurchaseForInvoice(final Account account, final UUID invoiceId, final BigDecimal amountToPay, final UUID paymentMethodId, final Boolean externalPayment, final String paymentExternalKey, final String transactionExternalKey, final Iterable<PluginProperty> pluginProperties, final CallContext callContext) throws PaymentApiException {
         try {
-            return invoicePaymentApi.createPurchaseForInvoice(account,
-                                                              invoiceId,
-                                                              paymentMethodId,
-                                                              null, amountToPay,
-                                                              account.getCurrency(),
-                                                              null,
-                                                              paymentExternalKey,
-                                                              transactionExternalKey,
-                                                              pluginProperties,
-                                                              createInvoicePaymentControlPluginApiPaymentOptions(externalPayment),
-                                                              callContext);
+            return invoicePaymentApi.createPurchaseForInvoicePayment(account,
+                                                                     invoiceId,
+                                                                     paymentMethodId,
+                                                                     null, amountToPay,
+                                                                     account.getCurrency(),
+                                                                     null,
+                                                                     paymentExternalKey,
+                                                                     transactionExternalKey,
+                                                                     pluginProperties,
+                                                                     createInvoicePaymentControlPluginApiPaymentOptions(externalPayment),
+                                                                     callContext);
         } catch (final PaymentApiException e) {
-
             if (e.getCode() == ErrorCode.PAYMENT_PLUGIN_EXCEPTION.getCode() /* &&
                 e.getMessage().contains("Invalid amount") */) { /* Plugin received bad input */
                 throw e;
diff --git a/payment/src/main/java/org/killbill/billing/payment/api/DefaultInvoicePaymentApi.java b/payment/src/main/java/org/killbill/billing/payment/api/DefaultInvoicePaymentApi.java
index c0ffe20..23b45ff 100644
--- a/payment/src/main/java/org/killbill/billing/payment/api/DefaultInvoicePaymentApi.java
+++ b/payment/src/main/java/org/killbill/billing/payment/api/DefaultInvoicePaymentApi.java
@@ -57,45 +57,45 @@ public class DefaultInvoicePaymentApi implements InvoicePaymentApi {
     }
 
     @Override
-    public InvoicePayment createPurchaseForInvoice(final Account account,
-                                                   final UUID invoiceId,
-                                                   final UUID paymentMethodId,
-                                                   final UUID paymentId,
-                                                   final BigDecimal amount,
-                                                   final Currency currency,
-                                                   final DateTime effectiveDate,
-                                                   final String paymentExternalKey,
-                                                   final String paymentTransactionExternalKey,
-                                                   final Iterable<PluginProperty> properties,
-                                                   final PaymentOptions paymentOptions,
-                                                   final CallContext context) throws PaymentApiException {
-        return invoicePaymentInternalApi.createPurchaseForInvoice(true,
-                                                                  account,
-                                                                  invoiceId,
-                                                                  paymentMethodId,
-                                                                  paymentId,
-                                                                  amount,
-                                                                  currency,
-                                                                  effectiveDate,
-                                                                  paymentExternalKey,
-                                                                  paymentTransactionExternalKey,
-                                                                  properties,
-                                                                  paymentOptions,
-                                                                  internalCallContextFactory.createInternalCallContext(account.getId(), context));
+    public InvoicePayment createPurchaseForInvoicePayment(final Account account,
+                                                          final UUID invoiceId,
+                                                          final UUID paymentMethodId,
+                                                          final UUID paymentId,
+                                                          final BigDecimal amount,
+                                                          final Currency currency,
+                                                          final DateTime effectiveDate,
+                                                          final String paymentExternalKey,
+                                                          final String paymentTransactionExternalKey,
+                                                          final Iterable<PluginProperty> properties,
+                                                          final PaymentOptions paymentOptions,
+                                                          final CallContext context) throws PaymentApiException {
+        return invoicePaymentInternalApi.createPurchaseForInvoicePayment(true,
+                                                                         account,
+                                                                         invoiceId,
+                                                                         paymentMethodId,
+                                                                         paymentId,
+                                                                         amount,
+                                                                         currency,
+                                                                         effectiveDate,
+                                                                         paymentExternalKey,
+                                                                         paymentTransactionExternalKey,
+                                                                         properties,
+                                                                         paymentOptions,
+                                                                         internalCallContextFactory.createInternalCallContext(account.getId(), context));
     }
 
     @Override
-    public InvoicePayment createRefundForInvoice(final boolean isAdjusted,
-                                                 final Map<UUID, BigDecimal> adjustments,
-                                                 final Account account,
-                                                 final UUID paymentId,
-                                                 final BigDecimal amount,
-                                                 final Currency currency,
-                                                 final DateTime effectiveDate,
-                                                 final String originalPaymentTransactionExternalKey,
-                                                 final Iterable<PluginProperty> originalProperties,
-                                                 final PaymentOptions paymentOptions,
-                                                 final CallContext context) throws PaymentApiException {
+    public InvoicePayment createRefundForInvoicePayment(final boolean isAdjusted,
+                                                        final Map<UUID, BigDecimal> adjustments,
+                                                        final Account account,
+                                                        final UUID paymentId,
+                                                        final BigDecimal amount,
+                                                        final Currency currency,
+                                                        final DateTime effectiveDate,
+                                                        final String originalPaymentTransactionExternalKey,
+                                                        final Iterable<PluginProperty> originalProperties,
+                                                        final PaymentOptions paymentOptions,
+                                                        final CallContext context) throws PaymentApiException {
         final Collection<PluginProperty> pluginProperties = preparePluginPropertiesForRefundOrCredit(isAdjusted, adjustments, originalProperties);
         final String paymentTransactionExternalKey = MoreObjects.firstNonNull(originalPaymentTransactionExternalKey, UUIDs.randomUUID().toString());
 
@@ -113,28 +113,28 @@ public class DefaultInvoicePaymentApi implements InvoicePaymentApi {
     }
 
     @Override
-    public InvoicePayment createCreditForInvoice(final boolean isAdjusted,
-                                                 final Map<UUID, BigDecimal> adjustments,
-                                                 final Account account,
-                                                 final UUID originalPaymentId,
-                                                 final UUID paymentMethodId,
-                                                 final UUID paymentId,
-                                                 final BigDecimal amount,
-                                                 final Currency currency,
-                                                 final DateTime effectiveDate,
-                                                 final String paymentExternalKey,
-                                                 final String originalPaymentTransactionExternalKey,
-                                                 final Iterable<PluginProperty> originalProperties,
-                                                 final PaymentOptions paymentOptions,
-                                                 final CallContext context) throws PaymentApiException {
+    public InvoicePayment createCreditForInvoicePayment(final boolean isAdjusted,
+                                                        final Map<UUID, BigDecimal> adjustments,
+                                                        final Account account,
+                                                        final UUID originalPaymentId,
+                                                        final UUID paymentMethodId,
+                                                        final UUID paymentId,
+                                                        final BigDecimal amount,
+                                                        final Currency currency,
+                                                        final DateTime effectiveDate,
+                                                        final String paymentExternalKey,
+                                                        final String originalPaymentTransactionExternalKey,
+                                                        final Iterable<PluginProperty> originalProperties,
+                                                        final PaymentOptions paymentOptions,
+                                                        final CallContext context) throws PaymentApiException {
         final Collection<PluginProperty> pluginProperties = preparePluginPropertiesForRefundOrCredit(isAdjusted, adjustments, originalProperties);
         pluginProperties.add(new PluginProperty("IPCD_PAYMENT_ID", originalPaymentId, false));
 
         final String paymentTransactionExternalKey = MoreObjects.firstNonNull(originalPaymentTransactionExternalKey, UUIDs.randomUUID().toString());
 
         final Payment payment = paymentApi.createCreditWithPaymentControl(account,
+                                                                          paymentMethodId,
                                                                           paymentId,
-                                                                          null,
                                                                           amount,
                                                                           currency,
                                                                           effectiveDate,
diff --git a/payment/src/main/java/org/killbill/billing/payment/api/svcs/DefaultInvoicePaymentInternalApi.java b/payment/src/main/java/org/killbill/billing/payment/api/svcs/DefaultInvoicePaymentInternalApi.java
index 4b8313f..ede6c16 100644
--- a/payment/src/main/java/org/killbill/billing/payment/api/svcs/DefaultInvoicePaymentInternalApi.java
+++ b/payment/src/main/java/org/killbill/billing/payment/api/svcs/DefaultInvoicePaymentInternalApi.java
@@ -68,19 +68,19 @@ public class DefaultInvoicePaymentInternalApi implements InvoicePaymentInternalA
     }
 
     @Override
-    public InvoicePayment createPurchaseForInvoice(final boolean isApiPayment,
-                                                   final Account account,
-                                                   final UUID invoiceId,
-                                                   final UUID paymentMethodId,
-                                                   final UUID paymentId,
-                                                   final BigDecimal amount,
-                                                   final Currency currency,
-                                                   final DateTime effectiveDate,
-                                                   final String paymentExternalKey,
-                                                   final String originalPaymentTransactionExternalKey,
-                                                   final Iterable<PluginProperty> originalProperties,
-                                                   final PaymentOptions paymentOptions,
-                                                   final InternalCallContext internalCallContext) throws PaymentApiException {
+    public InvoicePayment createPurchaseForInvoicePayment(final boolean isApiPayment,
+                                                          final Account account,
+                                                          final UUID invoiceId,
+                                                          final UUID paymentMethodId,
+                                                          final UUID paymentId,
+                                                          final BigDecimal amount,
+                                                          final Currency currency,
+                                                          final DateTime effectiveDate,
+                                                          final String paymentExternalKey,
+                                                          final String originalPaymentTransactionExternalKey,
+                                                          final Iterable<PluginProperty> originalProperties,
+                                                          final PaymentOptions paymentOptions,
+                                                          final InternalCallContext internalCallContext) throws PaymentApiException {
         final Collection<PluginProperty> pluginProperties = new LinkedList<PluginProperty>();
         if (originalProperties != null) {
             for (final PluginProperty pluginProperty : originalProperties) {
diff --git a/payment/src/main/java/org/killbill/billing/payment/bus/PaymentBusEventHandler.java b/payment/src/main/java/org/killbill/billing/payment/bus/PaymentBusEventHandler.java
index 4566e17..7255944 100644
--- a/payment/src/main/java/org/killbill/billing/payment/bus/PaymentBusEventHandler.java
+++ b/payment/src/main/java/org/killbill/billing/payment/bus/PaymentBusEventHandler.java
@@ -89,18 +89,18 @@ public class PaymentBusEventHandler {
         try {
             account = accountApi.getAccountById(event.getAccountId(), internalContext);
 
-            invoicePaymentInternalApi.createPurchaseForInvoice(false,
-                                                               account,
-                                                               event.getInvoiceId(),
-                                                               account.getPaymentMethodId(),
-                                                               null,
-                                                               amountToBePaid,
-                                                               account.getCurrency(),
-                                                               null,
-                                                               null,
-                                                               null,
-                                                               ImmutableList.<PluginProperty>of(),
-                                                               new PaymentOptions() {
+            invoicePaymentInternalApi.createPurchaseForInvoicePayment(false,
+                                                                      account,
+                                                                      event.getInvoiceId(),
+                                                                      account.getPaymentMethodId(),
+                                                                      null,
+                                                                      amountToBePaid,
+                                                                      account.getCurrency(),
+                                                                      null,
+                                                                      null,
+                                                                      null,
+                                                                      ImmutableList.<PluginProperty>of(),
+                                                                      new PaymentOptions() {
                                                                    @Override
                                                                    public boolean isExternalPayment() {
                                                                        return false;
@@ -111,7 +111,7 @@ public class PaymentBusEventHandler {
                                                                        return paymentControlPluginNames;
                                                                    }
                                                                },
-                                                               internalContext);
+                                                                      internalContext);
         } catch (final AccountApiException e) {
             log.warn("Failed to process invoice payment", e);
         } catch (final PaymentApiException e) {
diff --git a/payment/src/test/java/org/killbill/billing/payment/api/TestPaymentApi.java b/payment/src/test/java/org/killbill/billing/payment/api/TestPaymentApi.java
index 8d86ede..ec94497 100644
--- a/payment/src/test/java/org/killbill/billing/payment/api/TestPaymentApi.java
+++ b/payment/src/test/java/org/killbill/billing/payment/api/TestPaymentApi.java
@@ -866,18 +866,18 @@ public class TestPaymentApi extends PaymentTestSuiteWithEmbeddedDB {
                                                             requestedAmount,
                                                             new BigDecimal("1.0"),
                                                             Currency.USD));
-        invoicePaymentApi.createPurchaseForInvoice(account,
-                                                   invoice.getId(),
-                                                   account.getPaymentMethodId(),
-                                                   null,
-                                                   requestedAmount,
-                                                   Currency.USD,
-                                                   null,
-                                                   paymentExternalKey,
-                                                   transactionExternalKey,
-                                                   ImmutableList.<PluginProperty>of(),
-                                                   INVOICE_PAYMENT,
-                                                   callContext);
+        invoicePaymentApi.createPurchaseForInvoicePayment(account,
+                                                          invoice.getId(),
+                                                          account.getPaymentMethodId(),
+                                                          null,
+                                                          requestedAmount,
+                                                          Currency.USD,
+                                                          null,
+                                                          paymentExternalKey,
+                                                          transactionExternalKey,
+                                                          ImmutableList.<PluginProperty>of(),
+                                                          INVOICE_PAYMENT,
+                                                          callContext);
         final Payment payment = paymentApi.getPaymentByExternalKey(paymentExternalKey, false, false, ImmutableList.<PluginProperty>of(), callContext);
         assertEquals(payment.getExternalKey(), paymentExternalKey);
         assertEquals(payment.getPaymentMethodId(), account.getPaymentMethodId());
@@ -917,18 +917,18 @@ public class TestPaymentApi extends PaymentTestSuiteWithEmbeddedDB {
         final String transactionExternalKey = "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis,.";
 
         try {
-            invoicePaymentApi.createPurchaseForInvoice(account,
-                                                       invoice.getId(),
-                                                       account.getPaymentMethodId(),
-                                                       null,
-                                                       requestedAmount,
-                                                       Currency.USD,
-                                                       null,
-                                                       paymentExternalKey,
-                                                       transactionExternalKey,
-                                                       ImmutableList.<PluginProperty>of(),
-                                                       INVOICE_PAYMENT,
-                                                       callContext);
+            invoicePaymentApi.createPurchaseForInvoicePayment(account,
+                                                              invoice.getId(),
+                                                              account.getPaymentMethodId(),
+                                                              null,
+                                                              requestedAmount,
+                                                              Currency.USD,
+                                                              null,
+                                                              paymentExternalKey,
+                                                              transactionExternalKey,
+                                                              ImmutableList.<PluginProperty>of(),
+                                                              INVOICE_PAYMENT,
+                                                              callContext);
             Assert.fail();
         } catch (final PaymentApiException e) {
             assertEquals(e.getCode(), ErrorCode.EXTERNAL_KEY_LIMIT_EXCEEDED.getCode());
@@ -960,18 +960,18 @@ public class TestPaymentApi extends PaymentTestSuiteWithEmbeddedDB {
                                                             new BigDecimal("1.0"),
                                                             Currency.USD));
         try {
-            invoicePaymentApi.createPurchaseForInvoice(account,
-                                                       invoice.getId(),
-                                                       account.getPaymentMethodId(),
-                                                       null,
-                                                       requestedAmount,
-                                                       Currency.USD,
-                                                       null,
-                                                       paymentExternalKey,
-                                                       transactionExternalKey,
-                                                       ImmutableList.<PluginProperty>of(),
-                                                       INVOICE_PAYMENT,
-                                                       callContext);
+            invoicePaymentApi.createPurchaseForInvoicePayment(account,
+                                                              invoice.getId(),
+                                                              account.getPaymentMethodId(),
+                                                              null,
+                                                              requestedAmount,
+                                                              Currency.USD,
+                                                              null,
+                                                              paymentExternalKey,
+                                                              transactionExternalKey,
+                                                              ImmutableList.<PluginProperty>of(),
+                                                              INVOICE_PAYMENT,
+                                                              callContext);
         } catch (final PaymentApiException expected) {
             assertTrue(true);
         }
@@ -1027,18 +1027,18 @@ public class TestPaymentApi extends PaymentTestSuiteWithEmbeddedDB {
                                                             new BigDecimal("1.0"),
                                                             Currency.USD));
         try {
-            invoicePaymentApi.createPurchaseForInvoice(account,
-                                                       invoice.getId(),
-                                                       account.getPaymentMethodId(),
-                                                       null,
-                                                       requestedAmount,
-                                                       Currency.USD,
-                                                       null,
-                                                       paymentExternalKey,
-                                                       transactionExternalKey,
-                                                       ImmutableList.<PluginProperty>of(),
-                                                       INVOICE_PAYMENT,
-                                                       callContext);
+            invoicePaymentApi.createPurchaseForInvoicePayment(account,
+                                                              invoice.getId(),
+                                                              account.getPaymentMethodId(),
+                                                              null,
+                                                              requestedAmount,
+                                                              Currency.USD,
+                                                              null,
+                                                              paymentExternalKey,
+                                                              transactionExternalKey,
+                                                              ImmutableList.<PluginProperty>of(),
+                                                              INVOICE_PAYMENT,
+                                                              callContext);
         } catch (final PaymentApiException expected) {
             assertTrue(true);
         }
@@ -1068,18 +1068,18 @@ public class TestPaymentApi extends PaymentTestSuiteWithEmbeddedDB {
         assertEquals(payment.getTransactions().get(0).getTransactionType(), TransactionType.PURCHASE);
 
         // Make sure we can retry and that works
-        invoicePaymentApi.createPurchaseForInvoice(account,
-                                                   invoice.getId(),
-                                                   account.getPaymentMethodId(),
-                                                   null,
-                                                   requestedAmount,
-                                                   Currency.USD,
-                                                   null,
-                                                   paymentExternalKey,
-                                                   transactionExternalKey,
-                                                   ImmutableList.<PluginProperty>of(),
-                                                   INVOICE_PAYMENT,
-                                                   callContext);
+        invoicePaymentApi.createPurchaseForInvoicePayment(account,
+                                                          invoice.getId(),
+                                                          account.getPaymentMethodId(),
+                                                          null,
+                                                          requestedAmount,
+                                                          Currency.USD,
+                                                          null,
+                                                          paymentExternalKey,
+                                                          transactionExternalKey,
+                                                          ImmutableList.<PluginProperty>of(),
+                                                          INVOICE_PAYMENT,
+                                                          callContext);
 
         final List<Payment> accountPayments2 = paymentApi.getAccountPayments(account.getId(), false, false, ImmutableList.<PluginProperty>of(), callContext);
         assertEquals(accountPayments2.size(), 1);
@@ -1121,18 +1121,18 @@ public class TestPaymentApi extends PaymentTestSuiteWithEmbeddedDB {
                                                             Currency.USD));
 
         try {
-            invoicePaymentApi.createPurchaseForInvoice(account,
-                                                       invoice.getId(),
-                                                       account.getPaymentMethodId(),
-                                                       null,
-                                                       requestedAmount,
-                                                       Currency.USD,
-                                                       null,
-                                                       paymentExternalKey,
-                                                       transactionExternalKey,
-                                                       ImmutableList.<PluginProperty>of(),
-                                                       INVOICE_PAYMENT,
-                                                       callContext);
+            invoicePaymentApi.createPurchaseForInvoicePayment(account,
+                                                              invoice.getId(),
+                                                              account.getPaymentMethodId(),
+                                                              null,
+                                                              requestedAmount,
+                                                              Currency.USD,
+                                                              null,
+                                                              paymentExternalKey,
+                                                              transactionExternalKey,
+                                                              ImmutableList.<PluginProperty>of(),
+                                                              INVOICE_PAYMENT,
+                                                              callContext);
             Assert.fail("Unexpected success");
         } catch (final PaymentApiException e) {
         }
@@ -1163,18 +1163,18 @@ public class TestPaymentApi extends PaymentTestSuiteWithEmbeddedDB {
                                                                      Currency.USD);
         invoice.addInvoiceItem(invoiceItem);
 
-        invoicePaymentApi.createPurchaseForInvoice(account,
-                                                   invoice.getId(),
-                                                   account.getPaymentMethodId(),
-                                                   null,
-                                                   requestedAmount,
-                                                   Currency.USD,
-                                                   null,
-                                                   paymentExternalKey,
-                                                   transactionExternalKey,
-                                                   ImmutableList.<PluginProperty>of(),
-                                                   INVOICE_PAYMENT,
-                                                   callContext);
+        invoicePaymentApi.createPurchaseForInvoicePayment(account,
+                                                          invoice.getId(),
+                                                          account.getPaymentMethodId(),
+                                                          null,
+                                                          requestedAmount,
+                                                          Currency.USD,
+                                                          null,
+                                                          paymentExternalKey,
+                                                          transactionExternalKey,
+                                                          ImmutableList.<PluginProperty>of(),
+                                                          INVOICE_PAYMENT,
+                                                          callContext);
         final Payment payment = paymentApi.getPaymentByExternalKey(paymentExternalKey, false, false, ImmutableList.<PluginProperty>of(), callContext);
 
         final List<PluginProperty> refundProperties = ImmutableList.<PluginProperty>of();
@@ -1217,18 +1217,18 @@ public class TestPaymentApi extends PaymentTestSuiteWithEmbeddedDB {
                                                                      Currency.USD);
         invoice.addInvoiceItem(invoiceItem);
 
-        invoicePaymentApi.createPurchaseForInvoice(account,
-                                                   invoice.getId(),
-                                                   account.getPaymentMethodId(),
-                                                   null,
-                                                   requestedAmount,
-                                                   Currency.USD,
-                                                   null,
-                                                   paymentExternalKey,
-                                                   transactionExternalKey,
-                                                   ImmutableList.<PluginProperty>of(),
-                                                   INVOICE_PAYMENT,
-                                                   callContext);
+        invoicePaymentApi.createPurchaseForInvoicePayment(account,
+                                                          invoice.getId(),
+                                                          account.getPaymentMethodId(),
+                                                          null,
+                                                          requestedAmount,
+                                                          Currency.USD,
+                                                          null,
+                                                          paymentExternalKey,
+                                                          transactionExternalKey,
+                                                          ImmutableList.<PluginProperty>of(),
+                                                          INVOICE_PAYMENT,
+                                                          callContext);
         final Payment payment = paymentApi.getPaymentByExternalKey(paymentExternalKey, false, false, ImmutableList.<PluginProperty>of(), callContext);
 
         final List<PluginProperty> refundProperties = ImmutableList.<PluginProperty>of();
@@ -1266,26 +1266,26 @@ public class TestPaymentApi extends PaymentTestSuiteWithEmbeddedDB {
                                                                      Currency.USD);
         invoice.addInvoiceItem(invoiceItem);
 
-        invoicePaymentApi.createPurchaseForInvoice(account,
-                                                   invoice.getId(),
-                                                   account.getPaymentMethodId(),
-                                                   null,
-                                                   requestedAmount,
-                                                   Currency.USD,
-                                                   null,
-                                                   paymentExternalKey,
-                                                   transactionExternalKey,
-                                                   ImmutableList.<PluginProperty>of(),
-                                                   INVOICE_PAYMENT,
-                                                   callContext);
+        invoicePaymentApi.createPurchaseForInvoicePayment(account,
+                                                          invoice.getId(),
+                                                          account.getPaymentMethodId(),
+                                                          null,
+                                                          requestedAmount,
+                                                          Currency.USD,
+                                                          null,
+                                                          paymentExternalKey,
+                                                          transactionExternalKey,
+                                                          ImmutableList.<PluginProperty>of(),
+                                                          INVOICE_PAYMENT,
+                                                          callContext);
         final Payment payment = paymentApi.getPaymentByExternalKey(paymentExternalKey, false, false, ImmutableList.<PluginProperty>of(), callContext);
 
         final List<PluginProperty> refundProperties = new ArrayList<PluginProperty>();
         final HashMap<UUID, BigDecimal> uuidBigDecimalHashMap = new HashMap<UUID, BigDecimal>();
         uuidBigDecimalHashMap.put(invoiceItem.getId(), null);
 
-        invoicePaymentApi.createRefundForInvoice(true, uuidBigDecimalHashMap, account, payment.getId(), null, Currency.USD, null, transactionExternalKey2,
-                                                 refundProperties, INVOICE_PAYMENT, callContext);
+        invoicePaymentApi.createRefundForInvoicePayment(true, uuidBigDecimalHashMap, account, payment.getId(), null, Currency.USD, null, transactionExternalKey2,
+                                                        refundProperties, INVOICE_PAYMENT, callContext);
         final Payment payment2 = paymentApi.getPayment(payment.getId(), false, false, ImmutableList.<PluginProperty>of(), callContext);
 
         assertEquals(payment2.getTransactions().size(), 2);
diff --git a/payment/src/test/java/org/killbill/billing/payment/api/TestPaymentApiNoDB.java b/payment/src/test/java/org/killbill/billing/payment/api/TestPaymentApiNoDB.java
index 096b5cf..6a83d74 100644
--- a/payment/src/test/java/org/killbill/billing/payment/api/TestPaymentApiNoDB.java
+++ b/payment/src/test/java/org/killbill/billing/payment/api/TestPaymentApiNoDB.java
@@ -124,18 +124,18 @@ public class TestPaymentApiNoDB extends PaymentTestSuiteNoDB {
                                                             Currency.USD));
 
         try {
-            invoicePaymentApi.createPurchaseForInvoice(account,
-                                                       invoice.getId(),
-                                                       account.getPaymentMethodId(),
-                                                       null,
-                                                       requestedAmount,
-                                                       account.getCurrency(),
-                                                       null,
-                                                       invoice.getId().toString(),
-                                                       UUID.randomUUID().toString(),
-                                                       ImmutableList.<PluginProperty>of(),
-                                                       PAYMENT_OPTIONS,
-                                                       callContext);
+            invoicePaymentApi.createPurchaseForInvoicePayment(account,
+                                                              invoice.getId(),
+                                                              account.getPaymentMethodId(),
+                                                              null,
+                                                              requestedAmount,
+                                                              account.getCurrency(),
+                                                              null,
+                                                              invoice.getId().toString(),
+                                                              UUID.randomUUID().toString(),
+                                                              ImmutableList.<PluginProperty>of(),
+                                                              PAYMENT_OPTIONS,
+                                                              callContext);
             final Payment paymentInfo = paymentApi.getPaymentByExternalKey(invoice.getId().toString(), false, false, ImmutableList.<PluginProperty>of(), callContext);
             if (requestedAmount != null && expectedAmount == null) {
                 fail("Expected to fail because requested amount > invoice amount");
diff --git a/payment/src/test/java/org/killbill/billing/payment/TestJanitor.java b/payment/src/test/java/org/killbill/billing/payment/TestJanitor.java
index 4cf43a5..7a9a1e1 100644
--- a/payment/src/test/java/org/killbill/billing/payment/TestJanitor.java
+++ b/payment/src/test/java/org/killbill/billing/payment/TestJanitor.java
@@ -191,18 +191,18 @@ public class TestJanitor extends PaymentTestSuiteWithEmbeddedDB {
                                                             Currency.USD));
 
         testListener.pushExpectedEvent(NextEvent.PAYMENT);
-        invoicePaymentApi.createPurchaseForInvoice(account,
-                                                   invoice.getId(),
-                                                   account.getPaymentMethodId(),
-                                                   null,
-                                                   requestedAmount,
-                                                   Currency.USD,
-                                                   null,
-                                                   paymentExternalKey,
-                                                   transactionExternalKey,
-                                                   ImmutableList.<PluginProperty>of(),
-                                                   INVOICE_PAYMENT,
-                                                   callContext);
+        invoicePaymentApi.createPurchaseForInvoicePayment(account,
+                                                          invoice.getId(),
+                                                          account.getPaymentMethodId(),
+                                                          null,
+                                                          requestedAmount,
+                                                          Currency.USD,
+                                                          null,
+                                                          paymentExternalKey,
+                                                          transactionExternalKey,
+                                                          ImmutableList.<PluginProperty>of(),
+                                                          INVOICE_PAYMENT,
+                                                          callContext);
         final Payment payment = paymentApi.getPaymentByExternalKey(paymentExternalKey, false, false, ImmutableList.<PluginProperty>of(), callContext);
         testListener.assertListenerStatus();
         assertEquals(payment.getTransactions().size(), 1);
@@ -258,18 +258,18 @@ public class TestJanitor extends PaymentTestSuiteWithEmbeddedDB {
         invoice.addInvoiceItem(invoiceItem);
 
         testListener.pushExpectedEvent(NextEvent.PAYMENT);
-        invoicePaymentApi.createPurchaseForInvoice(account,
-                                                   invoice.getId(),
-                                                   account.getPaymentMethodId(),
-                                                   null,
-                                                   requestedAmount,
-                                                   Currency.USD,
-                                                   null,
-                                                   paymentExternalKey,
-                                                   transactionExternalKey,
-                                                   ImmutableList.<PluginProperty>of(),
-                                                   INVOICE_PAYMENT,
-                                                   callContext);
+        invoicePaymentApi.createPurchaseForInvoicePayment(account,
+                                                          invoice.getId(),
+                                                          account.getPaymentMethodId(),
+                                                          null,
+                                                          requestedAmount,
+                                                          Currency.USD,
+                                                          null,
+                                                          paymentExternalKey,
+                                                          transactionExternalKey,
+                                                          ImmutableList.<PluginProperty>of(),
+                                                          INVOICE_PAYMENT,
+                                                          callContext);
         final Payment payment = paymentApi.getPaymentByExternalKey(paymentExternalKey, false, false, ImmutableList.<PluginProperty>of(), callContext);
         testListener.assertListenerStatus();
 
@@ -278,8 +278,8 @@ public class TestJanitor extends PaymentTestSuiteWithEmbeddedDB {
         uuidBigDecimalHashMap.put(invoiceItem.getId(), new BigDecimal("1.0"));
 
         testListener.pushExpectedEvent(NextEvent.PAYMENT);
-        invoicePaymentApi.createRefundForInvoice(false, uuidBigDecimalHashMap, account, payment.getId(), null, Currency.USD, null, transactionExternalKey2,
-                                                 refundProperties, INVOICE_PAYMENT, callContext);
+        invoicePaymentApi.createRefundForInvoicePayment(false, uuidBigDecimalHashMap, account, payment.getId(), null, Currency.USD, null, transactionExternalKey2,
+                                                        refundProperties, INVOICE_PAYMENT, callContext);
         final Payment payment2 = paymentApi.getPayment(payment.getId(), false, false, refundProperties, callContext);
         testListener.assertListenerStatus();
 
diff --git a/payment/src/test/java/org/killbill/billing/payment/TestRetryService.java b/payment/src/test/java/org/killbill/billing/payment/TestRetryService.java
index 8780762..1f2c90f 100644
--- a/payment/src/test/java/org/killbill/billing/payment/TestRetryService.java
+++ b/payment/src/test/java/org/killbill/billing/payment/TestRetryService.java
@@ -118,18 +118,18 @@ public class TestRetryService extends PaymentTestSuiteNoDB {
         final String paymentExternalKey = UUID.randomUUID().toString();
         final String transactionExternalKey = UUID.randomUUID().toString();
         try {
-            invoicePaymentApi.createPurchaseForInvoice(account,
-                                                       invoice.getId(),
-                                                       account.getPaymentMethodId(),
-                                                       null,
-                                                       amount,
-                                                       Currency.USD,
-                                                       null,
-                                                       paymentExternalKey,
-                                                       transactionExternalKey,
-                                                       NO_PROPERTIES,
-                                                       PAYMENT_OPTIONS,
-                                                       callContext);
+            invoicePaymentApi.createPurchaseForInvoicePayment(account,
+                                                              invoice.getId(),
+                                                              account.getPaymentMethodId(),
+                                                              null,
+                                                              amount,
+                                                              Currency.USD,
+                                                              null,
+                                                              paymentExternalKey,
+                                                              transactionExternalKey,
+                                                              NO_PROPERTIES,
+                                                              PAYMENT_OPTIONS,
+                                                              callContext);
         } catch (final PaymentApiException e) {
             failed = true;
         }
@@ -173,18 +173,18 @@ public class TestRetryService extends PaymentTestSuiteNoDB {
 
         final String paymentExternalKey = UUID.randomUUID().toString();
         final String transactionExternalKey = UUID.randomUUID().toString();
-        invoicePaymentApi.createPurchaseForInvoice(account,
-                                                   invoice.getId(),
-                                                   account.getPaymentMethodId(),
-                                                   null,
-                                                   amount,
-                                                   Currency.USD,
-                                                   null,
-                                                   paymentExternalKey,
-                                                   transactionExternalKey,
-                                                   NO_PROPERTIES,
-                                                   PAYMENT_OPTIONS,
-                                                   callContext);
+        invoicePaymentApi.createPurchaseForInvoicePayment(account,
+                                                          invoice.getId(),
+                                                          account.getPaymentMethodId(),
+                                                          null,
+                                                          amount,
+                                                          Currency.USD,
+                                                          null,
+                                                          paymentExternalKey,
+                                                          transactionExternalKey,
+                                                          NO_PROPERTIES,
+                                                          PAYMENT_OPTIONS,
+                                                          callContext);
 
         Payment payment = getPaymentForExternalKey(paymentExternalKey);
         List<PaymentAttemptModelDao> attempts = paymentDao.getPaymentAttempts(paymentExternalKey, internalCallContext);
@@ -256,18 +256,18 @@ public class TestRetryService extends PaymentTestSuiteNoDB {
 
         final String paymentExternalKey = UUID.randomUUID().toString();
         final String transactionExternalKey = UUID.randomUUID().toString();
-        invoicePaymentApi.createPurchaseForInvoice(account,
-                                                   invoice.getId(),
-                                                   account.getPaymentMethodId(),
-                                                   null,
-                                                   amount,
-                                                   Currency.USD,
-                                                   null,
-                                                   paymentExternalKey,
-                                                   transactionExternalKey,
-                                                   NO_PROPERTIES,
-                                                   PAYMENT_OPTIONS,
-                                                   callContext);
+        invoicePaymentApi.createPurchaseForInvoicePayment(account,
+                                                          invoice.getId(),
+                                                          account.getPaymentMethodId(),
+                                                          null,
+                                                          amount,
+                                                          Currency.USD,
+                                                          null,
+                                                          paymentExternalKey,
+                                                          transactionExternalKey,
+                                                          NO_PROPERTIES,
+                                                          PAYMENT_OPTIONS,
+                                                          callContext);
 
         Payment payment = getPaymentForExternalKey(paymentExternalKey);
         List<PaymentAttemptModelDao> attempts = paymentDao.getPaymentAttempts(paymentExternalKey, internalCallContext);
@@ -349,18 +349,18 @@ public class TestRetryService extends PaymentTestSuiteNoDB {
 
         final String paymentExternalKey = UUID.randomUUID().toString();
         final String transactionExternalKey = UUID.randomUUID().toString();
-        invoicePaymentApi.createPurchaseForInvoice(account,
-                                                   invoice.getId(),
-                                                   account.getPaymentMethodId(),
-                                                   null,
-                                                   amount,
-                                                   Currency.USD,
-                                                   null,
-                                                   paymentExternalKey,
-                                                   transactionExternalKey,
-                                                   NO_PROPERTIES,
-                                                   PAYMENT_OPTIONS,
-                                                   callContext);
+        invoicePaymentApi.createPurchaseForInvoicePayment(account,
+                                                          invoice.getId(),
+                                                          account.getPaymentMethodId(),
+                                                          null,
+                                                          amount,
+                                                          Currency.USD,
+                                                          null,
+                                                          paymentExternalKey,
+                                                          transactionExternalKey,
+                                                          NO_PROPERTIES,
+                                                          PAYMENT_OPTIONS,
+                                                          callContext);
 
         Payment payment = getPaymentForExternalKey(paymentExternalKey);
         List<PaymentAttemptModelDao> attempts = paymentDao.getPaymentAttempts(paymentExternalKey, internalCallContext);