killbill-memoizeit
Merge remote-tracking branch 'origin/master' into postgresql-support Signed-off-by: …
Changes
.gitignore 1(+1 -0)
account/pom.xml 2(+1 -1)
api/pom.xml 2(+1 -1)
beatrix/pom.xml 2(+1 -1)
catalog/pom.xml 2(+1 -1)
currency/pom.xml 2(+1 -1)
entitlement/pom.xml 2(+1 -1)
invoice/pom.xml 2(+1 -1)
jaxrs/pom.xml 2(+1 -1)
junction/pom.xml 2(+1 -1)
overdue/pom.xml 2(+1 -1)
payment/pom.xml 2(+1 -1)
payment/src/main/java/org/killbill/billing/payment/core/janitor/IncompletePaymentAttemptTask.java 9(+4 -5)
payment/src/main/java/org/killbill/billing/payment/core/PluginControlPaymentProcessor.java 10(+5 -5)
payment/src/main/java/org/killbill/billing/payment/core/sm/control/CompletionControlOperation.java 6(+3 -3)
payment/src/main/java/org/killbill/billing/payment/core/sm/control/DefaultControlCompleted.java 6(+3 -3)
payment/src/main/java/org/killbill/billing/payment/core/sm/control/DefaultControlInitiated.java 17(+9 -8)
payment/src/main/java/org/killbill/billing/payment/core/sm/control/OperationControlCallback.java 37(+18 -19)
payment/src/main/java/org/killbill/billing/payment/core/sm/PluginControlPaymentAutomatonRunner.java 34(+16 -18)
payment/src/main/java/org/killbill/billing/payment/glue/DefaultPaymentControlProviderPluginRegistryProvider.java 28(+12 -16)
payment/src/main/java/org/killbill/billing/payment/invoice/dao/InvoicePaymentControlDao.java 9(+5 -4)
payment/src/main/java/org/killbill/billing/payment/invoice/InvoicePaymentControlPluginApi.java 129(+61 -68)
payment/src/main/java/org/killbill/billing/payment/provider/DefaultPaymentControlProviderPlugin.java 2(+1 -1)
payment/src/test/java/org/killbill/billing/payment/core/sm/MockRetryablePaymentAutomatonRunner.java 15(+8 -7)
payment/src/test/java/org/killbill/billing/payment/invoice/dao/TestInvoicePaymentControlDao.java 50(+25 -25)
payment/src/test/java/org/killbill/billing/payment/provider/MockPaymentControlProviderPlugin.java 6(+3 -3)
pom.xml 2(+1 -1)
profiles/killbill/pom.xml 2(+1 -1)
profiles/killpay/pom.xml 2(+1 -1)
profiles/pom.xml 2(+1 -1)
subscription/pom.xml 2(+1 -1)
tenant/pom.xml 2(+1 -1)
usage/pom.xml 2(+1 -1)
util/pom.xml 2(+1 -1)
Details
.gitignore 1(+1 -0)
diff --git a/.gitignore b/.gitignore
index aeae6f2..5609cd9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -30,3 +30,4 @@ killbill.lock.db
killbill.trace.db
server/test.db
.idea/dictionaries/
+.idea/dbnavigator.xml
diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml
index e0ce11c..99aecde 100644
--- a/.idea/inspectionProfiles/Project_Default.xml
+++ b/.idea/inspectionProfiles/Project_Default.xml
@@ -7,13 +7,7 @@
<inspection_tool class="ControlFlowStatementWithoutBraces" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="CyclicClassDependency" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="FieldMayBeFinal" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="HardcodedFileSeparators" enabled="true" level="WARNING" enabled_by_default="true">
- <option name="m_recognizeExampleMediaType" value="false" />
- </inspection_tool>
<inspection_tool class="HardcodedLineSeparators" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="ImplicitCallToSuper" enabled="true" level="WARNING" enabled_by_default="true">
- <option name="m_ignoreForObjectSubclasses" value="false" />
- </inspection_tool>
<inspection_tool class="InconsistentLineSeparators" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="ListIndexOfReplaceableByContains" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="LiteralAsArgToStringEquals" enabled="true" level="WARNING" enabled_by_default="true" />
@@ -21,6 +15,10 @@
<option name="REPORT_VARIABLES" value="true" />
<option name="REPORT_PARAMETERS" value="true" />
</inspection_tool>
+ <inspection_tool class="LoggerInitializedWithForeignClass" enabled="false" level="WARNING" enabled_by_default="false">
+ <option name="loggerClassName" value="org.apache.log4j.Logger,org.slf4j.LoggerFactory,org.apache.commons.logging.LogFactory,java.util.logging.Logger" />
+ <option name="loggerFactoryMethodName" value="getLogger,getLogger,getLog,getLogger" />
+ </inspection_tool>
<inspection_tool class="MagicNumber" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="MissortedModifiers" enabled="true" level="WARNING" enabled_by_default="true">
<option name="m_requireAnnotationsFirst" value="true" />
account/pom.xml 2(+1 -1)
diff --git a/account/pom.xml b/account/pom.xml
index 8ac6d09..409da82 100644
--- a/account/pom.xml
+++ b/account/pom.xml
@@ -19,7 +19,7 @@
<parent>
<artifactId>killbill</artifactId>
<groupId>org.kill-bill.billing</groupId>
- <version>0.15.1-SNAPSHOT</version>
+ <version>0.15.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>killbill-account</artifactId>
api/pom.xml 2(+1 -1)
diff --git a/api/pom.xml b/api/pom.xml
index 693edc4..24958d8 100644
--- a/api/pom.xml
+++ b/api/pom.xml
@@ -19,7 +19,7 @@
<parent>
<artifactId>killbill</artifactId>
<groupId>org.kill-bill.billing</groupId>
- <version>0.15.1-SNAPSHOT</version>
+ <version>0.15.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>killbill-internal-api</artifactId>
beatrix/pom.xml 2(+1 -1)
diff --git a/beatrix/pom.xml b/beatrix/pom.xml
index 0a7ab00..765fdf3 100644
--- a/beatrix/pom.xml
+++ b/beatrix/pom.xml
@@ -19,7 +19,7 @@
<parent>
<artifactId>killbill</artifactId>
<groupId>org.kill-bill.billing</groupId>
- <version>0.15.1-SNAPSHOT</version>
+ <version>0.15.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>killbill-beatrix</artifactId>
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 439777e..a081939 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
@@ -84,7 +84,7 @@ import org.killbill.billing.payment.api.PaymentMethodPlugin;
import org.killbill.billing.payment.api.PaymentOptions;
import org.killbill.billing.payment.api.PluginProperty;
import org.killbill.billing.payment.api.TestPaymentMethodPluginBase;
-import org.killbill.billing.payment.invoice.InvoicePaymentRoutingPluginApi;
+import org.killbill.billing.payment.invoice.InvoicePaymentControlPluginApi;
import org.killbill.billing.payment.provider.MockPaymentProviderPlugin;
import org.killbill.billing.subscription.api.SubscriptionBase;
import org.killbill.billing.subscription.api.SubscriptionBaseService;
@@ -123,11 +123,10 @@ import static org.testng.Assert.fail;
public class TestIntegrationBase extends BeatrixTestSuiteWithEmbeddedDB {
protected static final DateTimeZone testTimeZone = DateTimeZone.UTC;
-
protected static final Logger log = LoggerFactory.getLogger(TestIntegrationBase.class);
protected static long AT_LEAST_ONE_MONTH_MS = 32L * 24L * 3600L * 1000L;
- protected final static PaymentOptions PAYMENT_OPTIONS = new PaymentOptions() {
+ protected static final PaymentOptions PAYMENT_OPTIONS = new PaymentOptions() {
@Override
public boolean isExternalPayment() {
return false;
@@ -135,11 +134,10 @@ public class TestIntegrationBase extends BeatrixTestSuiteWithEmbeddedDB {
@Override
public List<String> getPaymentControlPluginNames() {
- return ImmutableList.<String>of(InvoicePaymentRoutingPluginApi.PLUGIN_NAME);
+ return ImmutableList.<String>of(InvoicePaymentControlPluginApi.PLUGIN_NAME);
}
};
-
- protected final static PaymentOptions EXTERNAL_PAYMENT_OPTIONS = new PaymentOptions() {
+ protected static final PaymentOptions EXTERNAL_PAYMENT_OPTIONS = new PaymentOptions() {
@Override
public boolean isExternalPayment() {
return true;
@@ -147,7 +145,7 @@ public class TestIntegrationBase extends BeatrixTestSuiteWithEmbeddedDB {
@Override
public List<String> getPaymentControlPluginNames() {
- return ImmutableList.<String>of(InvoicePaymentRoutingPluginApi.PLUGIN_NAME);
+ return ImmutableList.<String>of(InvoicePaymentControlPluginApi.PLUGIN_NAME);
}
};
@@ -257,7 +255,6 @@ public class TestIntegrationBase extends BeatrixTestSuiteWithEmbeddedDB {
@Inject
protected TenantUserApi tenantUserApi;
-
protected void assertListenerStatus() {
busHandler.assertListenerStatus();
}
@@ -356,17 +353,6 @@ public class TestIntegrationBase extends BeatrixTestSuiteWithEmbeddedDB {
return accountUserApi.getAccountById(account.getId(), callContext);
}
- private class TestPaymentMethodPlugin extends TestPaymentMethodPluginBase {
-
- @Override
- public List<PluginProperty> getProperties() {
- final PluginProperty prop = new PluginProperty("whatever", "cool", Boolean.TRUE);
- final List<PluginProperty> res = new ArrayList<PluginProperty>();
- res.add(prop);
- return res;
- }
- }
-
protected PaymentMethodPlugin createPaymentMethodPlugin() {
return new TestPaymentMethodPlugin();
}
@@ -429,7 +415,7 @@ public class TestIntegrationBase extends BeatrixTestSuiteWithEmbeddedDB {
try {
final List<PluginProperty> properties = new ArrayList<PluginProperty>();
- final PluginProperty prop1 = new PluginProperty(InvoicePaymentRoutingPluginApi.PROP_IPCD_INVOICE_ID, invoice.getId().toString(), false);
+ final PluginProperty prop1 = new PluginProperty(InvoicePaymentControlPluginApi.PROP_IPCD_INVOICE_ID, invoice.getId().toString(), false);
properties.add(prop1);
return paymentApi.createPurchaseWithPaymentControl(account, account.getPaymentMethodId(), null, amount, currency, UUID.randomUUID().toString(),
UUID.randomUUID().toString(), properties, PAYMENT_OPTIONS, callContext);
@@ -447,7 +433,7 @@ public class TestIntegrationBase extends BeatrixTestSuiteWithEmbeddedDB {
public Payment apply(@Nullable final Void input) {
try {
final List<PluginProperty> properties = new ArrayList<PluginProperty>();
- final PluginProperty prop1 = new PluginProperty(InvoicePaymentRoutingPluginApi.PROP_IPCD_INVOICE_ID, invoice.getId().toString(), false);
+ final PluginProperty prop1 = new PluginProperty(InvoicePaymentControlPluginApi.PROP_IPCD_INVOICE_ID, invoice.getId().toString(), false);
properties.add(prop1);
return paymentApi.createPurchaseWithPaymentControl(account, account.getPaymentMethodId(), null, invoice.getBalance(), invoice.getCurrency(), UUID.randomUUID().toString(),
@@ -467,7 +453,7 @@ public class TestIntegrationBase extends BeatrixTestSuiteWithEmbeddedDB {
try {
final List<PluginProperty> properties = new ArrayList<PluginProperty>();
- final PluginProperty prop1 = new PluginProperty(InvoicePaymentRoutingPluginApi.PROP_IPCD_INVOICE_ID, invoice.getId().toString(), false);
+ final PluginProperty prop1 = new PluginProperty(InvoicePaymentControlPluginApi.PROP_IPCD_INVOICE_ID, invoice.getId().toString(), false);
properties.add(prop1);
return paymentApi.createPurchaseWithPaymentControl(account, account.getPaymentMethodId(), null, invoice.getBalance(), invoice.getCurrency(), UUID.randomUUID().toString(),
@@ -501,7 +487,7 @@ public class TestIntegrationBase extends BeatrixTestSuiteWithEmbeddedDB {
public Payment apply(@Nullable final Void input) {
final List<PluginProperty> properties = new ArrayList<PluginProperty>();
- final PluginProperty prop1 = new PluginProperty(InvoicePaymentRoutingPluginApi.PROP_IPCD_REFUND_WITH_ADJUSTMENTS, "true", false);
+ final PluginProperty prop1 = new PluginProperty(InvoicePaymentControlPluginApi.PROP_IPCD_REFUND_WITH_ADJUSTMENTS, "true", false);
properties.add(prop1);
try {
return paymentApi.createRefundWithPaymentControl(account, payment.getId(), payment.getPurchasedAmount(), payment.getCurrency(), UUID.randomUUID().toString(),
@@ -520,9 +506,9 @@ public class TestIntegrationBase extends BeatrixTestSuiteWithEmbeddedDB {
public Payment apply(@Nullable final Void input) {
final List<PluginProperty> properties = new ArrayList<PluginProperty>();
- final PluginProperty prop1 = new PluginProperty(InvoicePaymentRoutingPluginApi.PROP_IPCD_REFUND_WITH_ADJUSTMENTS, "true", false);
+ final PluginProperty prop1 = new PluginProperty(InvoicePaymentControlPluginApi.PROP_IPCD_REFUND_WITH_ADJUSTMENTS, "true", false);
properties.add(prop1);
- final PluginProperty prop2 = new PluginProperty(InvoicePaymentRoutingPluginApi.PROP_IPCD_REFUND_IDS_WITH_AMOUNT_KEY, iias, false);
+ final PluginProperty prop2 = new PluginProperty(InvoicePaymentControlPluginApi.PROP_IPCD_REFUND_IDS_WITH_AMOUNT_KEY, iias, false);
properties.add(prop2);
try {
@@ -553,12 +539,12 @@ public class TestIntegrationBase extends BeatrixTestSuiteWithEmbeddedDB {
}
protected DefaultEntitlement createBaseEntitlementWithPriceOverrideAndCheckForCompletion(final UUID accountId,
- final String bundleExternalKey,
- final String productName,
- final ProductCategory productCategory,
- final BillingPeriod billingPeriod,
- final List<PlanPhasePriceOverride> overrides,
- final NextEvent... events) {
+ final String bundleExternalKey,
+ final String productName,
+ final ProductCategory productCategory,
+ final BillingPeriod billingPeriod,
+ final List<PlanPhasePriceOverride> overrides,
+ final NextEvent... events) {
if (productCategory == ProductCategory.ADD_ON) {
throw new RuntimeException("Unxepected Call for creating ADD_ON");
}
@@ -580,7 +566,6 @@ public class TestIntegrationBase extends BeatrixTestSuiteWithEmbeddedDB {
}, events);
}
-
protected DefaultEntitlement createBaseEntitlementAndCheckForCompletion(final UUID accountId,
final String bundleExternalKey,
final String productName,
@@ -799,4 +784,15 @@ public class TestIntegrationBase extends BeatrixTestSuiteWithEmbeddedDB {
return null;
}
}
+
+ private class TestPaymentMethodPlugin extends TestPaymentMethodPluginBase {
+
+ @Override
+ public List<PluginProperty> getProperties() {
+ final PluginProperty prop = new PluginProperty("whatever", "cool", Boolean.TRUE);
+ final List<PluginProperty> res = new ArrayList<PluginProperty>();
+ res.add(prop);
+ return res;
+ }
+ }
}
catalog/pom.xml 2(+1 -1)
diff --git a/catalog/pom.xml b/catalog/pom.xml
index 5543d21..165e905 100644
--- a/catalog/pom.xml
+++ b/catalog/pom.xml
@@ -19,7 +19,7 @@
<parent>
<artifactId>killbill</artifactId>
<groupId>org.kill-bill.billing</groupId>
- <version>0.15.1-SNAPSHOT</version>
+ <version>0.15.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>killbill-catalog</artifactId>
currency/pom.xml 2(+1 -1)
diff --git a/currency/pom.xml b/currency/pom.xml
index 9fb4e1d..e03a711 100644
--- a/currency/pom.xml
+++ b/currency/pom.xml
@@ -19,7 +19,7 @@
<parent>
<artifactId>killbill</artifactId>
<groupId>org.kill-bill.billing</groupId>
- <version>0.15.1-SNAPSHOT</version>
+ <version>0.15.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>killbill-currency</artifactId>
entitlement/pom.xml 2(+1 -1)
diff --git a/entitlement/pom.xml b/entitlement/pom.xml
index 6d0260b..7b012fa 100644
--- a/entitlement/pom.xml
+++ b/entitlement/pom.xml
@@ -19,7 +19,7 @@
<parent>
<artifactId>killbill</artifactId>
<groupId>org.kill-bill.billing</groupId>
- <version>0.15.1-SNAPSHOT</version>
+ <version>0.15.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>killbill-entitlement</artifactId>
invoice/pom.xml 2(+1 -1)
diff --git a/invoice/pom.xml b/invoice/pom.xml
index 7646dad..987a318 100644
--- a/invoice/pom.xml
+++ b/invoice/pom.xml
@@ -19,7 +19,7 @@
<parent>
<artifactId>killbill</artifactId>
<groupId>org.kill-bill.billing</groupId>
- <version>0.15.1-SNAPSHOT</version>
+ <version>0.15.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>killbill-invoice</artifactId>
jaxrs/pom.xml 2(+1 -1)
diff --git a/jaxrs/pom.xml b/jaxrs/pom.xml
index c365864..401b515 100644
--- a/jaxrs/pom.xml
+++ b/jaxrs/pom.xml
@@ -21,7 +21,7 @@
<parent>
<artifactId>killbill</artifactId>
<groupId>org.kill-bill.billing</groupId>
- <version>0.15.1-SNAPSHOT</version>
+ <version>0.15.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>killbill-jaxrs</artifactId>
junction/pom.xml 2(+1 -1)
diff --git a/junction/pom.xml b/junction/pom.xml
index fca6924..6445dde 100644
--- a/junction/pom.xml
+++ b/junction/pom.xml
@@ -19,7 +19,7 @@
<parent>
<artifactId>killbill</artifactId>
<groupId>org.kill-bill.billing</groupId>
- <version>0.15.1-SNAPSHOT</version>
+ <version>0.15.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>killbill-junction</artifactId>
overdue/pom.xml 2(+1 -1)
diff --git a/overdue/pom.xml b/overdue/pom.xml
index 7d01545..1892035 100644
--- a/overdue/pom.xml
+++ b/overdue/pom.xml
@@ -19,7 +19,7 @@
<parent>
<artifactId>killbill</artifactId>
<groupId>org.kill-bill.billing</groupId>
- <version>0.15.1-SNAPSHOT</version>
+ <version>0.15.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>killbill-overdue</artifactId>
payment/pom.xml 2(+1 -1)
diff --git a/payment/pom.xml b/payment/pom.xml
index 56ac663..45ce609 100644
--- a/payment/pom.xml
+++ b/payment/pom.xml
@@ -19,7 +19,7 @@
<parent>
<artifactId>killbill</artifactId>
<groupId>org.kill-bill.billing</groupId>
- <version>0.15.1-SNAPSHOT</version>
+ <version>0.15.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>killbill-payment</artifactId>
diff --git a/payment/src/main/java/org/killbill/billing/payment/api/DefaultPaymentApi.java b/payment/src/main/java/org/killbill/billing/payment/api/DefaultPaymentApi.java
index 23fe159..d329f56 100644
--- a/payment/src/main/java/org/killbill/billing/payment/api/DefaultPaymentApi.java
+++ b/payment/src/main/java/org/killbill/billing/payment/api/DefaultPaymentApi.java
@@ -1,6 +1,6 @@
/*
- * Copyright 2014 Groupon, Inc
- * Copyright 2014 The Billing Project, LLC
+ * Copyright 2014-2015 Groupon, Inc
+ * Copyright 2014-2015 The Billing Project, LLC
*
* The Billing Project licenses this file to you under the Apache License, version 2.0
* (the "License"); you may not use this file except in compliance with the
@@ -31,8 +31,8 @@ import org.killbill.billing.callcontext.InternalCallContext;
import org.killbill.billing.catalog.api.Currency;
import org.killbill.billing.payment.core.PaymentMethodProcessor;
import org.killbill.billing.payment.core.PaymentProcessor;
-import org.killbill.billing.payment.core.PluginRoutingPaymentProcessor;
-import org.killbill.billing.payment.invoice.InvoicePaymentRoutingPluginApi;
+import org.killbill.billing.payment.core.PluginControlPaymentProcessor;
+import org.killbill.billing.payment.invoice.InvoicePaymentControlPluginApi;
import org.killbill.billing.util.UUIDs;
import org.killbill.billing.util.callcontext.CallContext;
import org.killbill.billing.util.callcontext.InternalCallContextFactory;
@@ -55,15 +55,15 @@ public class DefaultPaymentApi implements PaymentApi {
private final PaymentConfig paymentConfig;
private final PaymentProcessor paymentProcessor;
private final PaymentMethodProcessor paymentMethodProcessor;
- private final PluginRoutingPaymentProcessor pluginRoutingPaymentProcessor;
+ private final PluginControlPaymentProcessor pluginControlPaymentProcessor;
private final InternalCallContextFactory internalCallContextFactory;
@Inject
- public DefaultPaymentApi(final PaymentConfig paymentConfig, final PaymentProcessor paymentProcessor, final PaymentMethodProcessor paymentMethodProcessor, final PluginRoutingPaymentProcessor pluginRoutingPaymentProcessor, final InternalCallContextFactory internalCallContextFactory) {
+ public DefaultPaymentApi(final PaymentConfig paymentConfig, final PaymentProcessor paymentProcessor, final PaymentMethodProcessor paymentMethodProcessor, final PluginControlPaymentProcessor pluginControlPaymentProcessor, final InternalCallContextFactory internalCallContextFactory) {
this.paymentConfig = paymentConfig;
this.paymentProcessor = paymentProcessor;
this.paymentMethodProcessor = paymentMethodProcessor;
- this.pluginRoutingPaymentProcessor = pluginRoutingPaymentProcessor;
+ this.pluginControlPaymentProcessor = pluginControlPaymentProcessor;
this.internalCallContextFactory = internalCallContextFactory;
}
@@ -103,7 +103,7 @@ public class DefaultPaymentApi implements PaymentApi {
logAPICall(TransactionType.AUTHORIZE.name(), account, paymentMethodId, paymentId, null, amount, currency, paymentExternalKey, paymentTransactionExternalKey);
final InternalCallContext internalCallContext = internalCallContextFactory.createInternalCallContext(account.getId(), callContext);
- return pluginRoutingPaymentProcessor.createAuthorization(IS_API_PAYMENT, account, paymentMethodId, paymentId, amount, currency, paymentExternalKey, paymentTransactionExternalKey,
+ return pluginControlPaymentProcessor.createAuthorization(IS_API_PAYMENT, account, paymentMethodId, paymentId, amount, currency, paymentExternalKey, paymentTransactionExternalKey,
properties, paymentControlPluginNames, callContext, internalCallContext);
}
@@ -139,8 +139,8 @@ public class DefaultPaymentApi implements PaymentApi {
checkPositiveAmount(amount);
final InternalCallContext internalCallContext = internalCallContextFactory.createInternalCallContext(account.getId(), callContext);
- return pluginRoutingPaymentProcessor.createCapture(IS_API_PAYMENT, account, paymentId, amount, currency, paymentTransactionExternalKey,
- properties, paymentControlPluginNames, callContext, internalCallContext);
+ return pluginControlPaymentProcessor.createCapture(IS_API_PAYMENT, account, paymentId, amount, currency, paymentTransactionExternalKey,
+ properties, paymentControlPluginNames, callContext, internalCallContext);
}
@Override
@@ -187,7 +187,7 @@ public class DefaultPaymentApi implements PaymentApi {
final UUID nonNulPaymentMethodId = (paymentMethodId != null) ?
paymentMethodId :
paymentMethodProcessor.createOrGetExternalPaymentMethod(UUIDs.randomUUID().toString(), account, properties, callContext, internalCallContext);
- return pluginRoutingPaymentProcessor.createPurchase(IS_API_PAYMENT, account, nonNulPaymentMethodId, paymentId, amount, currency, paymentExternalKey, paymentTransactionExternalKey,
+ return pluginControlPaymentProcessor.createPurchase(IS_API_PAYMENT, account, nonNulPaymentMethodId, paymentId, amount, currency, paymentExternalKey, paymentTransactionExternalKey,
properties, paymentControlPluginNames, callContext, internalCallContext);
}
@@ -222,8 +222,8 @@ public class DefaultPaymentApi implements PaymentApi {
logAPICall(TransactionType.VOID.name(), account, null, paymentId, null, null, null, null, paymentTransactionExternalKey);
final InternalCallContext internalCallContext = internalCallContextFactory.createInternalCallContext(account.getId(), callContext);
- return pluginRoutingPaymentProcessor.createVoid(IS_API_PAYMENT, account, paymentId, paymentTransactionExternalKey,
- properties, paymentControlPluginNames, callContext, internalCallContext);
+ return pluginControlPaymentProcessor.createVoid(IS_API_PAYMENT, account, paymentId, paymentTransactionExternalKey,
+ properties, paymentControlPluginNames, callContext, internalCallContext);
}
@Override
@@ -264,7 +264,7 @@ public class DefaultPaymentApi implements PaymentApi {
logAPICall(TransactionType.REFUND.name(), account, null, paymentId, null, amount, currency, null, paymentTransactionExternalKey);
final InternalCallContext internalCallContext = internalCallContextFactory.createInternalCallContext(account.getId(), callContext);
- return pluginRoutingPaymentProcessor.createRefund(IS_API_PAYMENT, account, paymentId, amount, currency, paymentTransactionExternalKey,
+ return pluginControlPaymentProcessor.createRefund(IS_API_PAYMENT, account, paymentId, amount, currency, paymentTransactionExternalKey,
properties, paymentControlPluginNames, callContext, internalCallContext);
}
@@ -307,7 +307,7 @@ public class DefaultPaymentApi implements PaymentApi {
logAPICall(TransactionType.CREDIT.name(), account, paymentMethodId, paymentId, null, amount, currency, paymentExternalKey, paymentTransactionExternalKey);
final InternalCallContext internalCallContext = internalCallContextFactory.createInternalCallContext(account.getId(), callContext);
- return pluginRoutingPaymentProcessor.createCredit(IS_API_PAYMENT, account, paymentMethodId, paymentId, amount, currency, paymentExternalKey, paymentTransactionExternalKey,
+ return pluginControlPaymentProcessor.createCredit(IS_API_PAYMENT, account, paymentMethodId, paymentId, amount, currency, paymentExternalKey, paymentTransactionExternalKey,
properties, paymentControlPluginNames, callContext, internalCallContext);
}
@@ -357,7 +357,7 @@ public class DefaultPaymentApi implements PaymentApi {
checkPositiveAmount(amount);
final InternalCallContext internalCallContext = internalCallContextFactory.createInternalCallContext(account.getId(), callContext);
- return pluginRoutingPaymentProcessor.createChargeback(IS_API_PAYMENT, account, paymentId, paymentTransactionExternalKey, amount, currency,
+ return pluginControlPaymentProcessor.createChargeback(IS_API_PAYMENT, account, paymentId, paymentTransactionExternalKey, amount, currency,
paymentControlPluginNames, callContext, internalCallContext);
}
@@ -527,7 +527,7 @@ public class DefaultPaymentApi implements PaymentApi {
if (paymentConfig.getPaymentControlPluginNames() != null &&
paymentOptions.getPaymentControlPluginNames() != null &&
paymentOptions.getPaymentControlPluginNames().size() == 1 &&
- InvoicePaymentRoutingPluginApi.PLUGIN_NAME.equals(paymentOptions.getPaymentControlPluginNames().get(0))) {
+ InvoicePaymentControlPluginApi.PLUGIN_NAME.equals(paymentOptions.getPaymentControlPluginNames().get(0))) {
final List<String> paymentControlPluginNames = new LinkedList<String>(paymentOptions.getPaymentControlPluginNames());
paymentControlPluginNames.addAll(paymentConfig.getPaymentControlPluginNames());
return paymentControlPluginNames;
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 b58975c..c7705ec 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
@@ -18,7 +18,6 @@
package org.killbill.billing.payment.bus;
-import java.io.IOException;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.LinkedList;
@@ -31,12 +30,11 @@ import org.killbill.billing.account.api.AccountInternalApi;
import org.killbill.billing.callcontext.InternalCallContext;
import org.killbill.billing.events.InvoiceCreationInternalEvent;
import org.killbill.billing.events.PaymentInternalEvent;
-import org.killbill.billing.payment.api.DefaultPaymentInfoEvent;
import org.killbill.billing.payment.api.PaymentApiException;
import org.killbill.billing.payment.api.PluginProperty;
-import org.killbill.billing.payment.core.PluginRoutingPaymentProcessor;
+import org.killbill.billing.payment.core.PluginControlPaymentProcessor;
import org.killbill.billing.payment.core.janitor.Janitor;
-import org.killbill.billing.payment.invoice.InvoicePaymentRoutingPluginApi;
+import org.killbill.billing.payment.invoice.InvoicePaymentControlPluginApi;
import org.killbill.billing.util.UUIDs;
import org.killbill.billing.util.callcontext.CallContext;
import org.killbill.billing.util.callcontext.CallOrigin;
@@ -52,31 +50,31 @@ import com.google.inject.Inject;
public class PaymentBusEventHandler {
+ private static final Logger log = LoggerFactory.getLogger(PaymentBusEventHandler.class);
+
private final AccountInternalApi accountApi;
private final InternalCallContextFactory internalCallContextFactory;
- private final PluginRoutingPaymentProcessor pluginRoutingPaymentProcessor;
+ private final PluginControlPaymentProcessor pluginControlPaymentProcessor;
private final PaymentConfig paymentConfig;
private final Janitor janitor;
- private static final Logger log = LoggerFactory.getLogger(PaymentBusEventHandler.class);
-
@Inject
public PaymentBusEventHandler(final PaymentConfig paymentConfig,
final AccountInternalApi accountApi,
- final PluginRoutingPaymentProcessor pluginRoutingPaymentProcessor,
+ final PluginControlPaymentProcessor pluginControlPaymentProcessor,
final Janitor janitor,
final InternalCallContextFactory internalCallContextFactory) {
this.paymentConfig = paymentConfig;
this.accountApi = accountApi;
this.janitor = janitor;
this.internalCallContextFactory = internalCallContextFactory;
- this.pluginRoutingPaymentProcessor = pluginRoutingPaymentProcessor;
+ this.pluginControlPaymentProcessor = pluginControlPaymentProcessor;
}
@AllowConcurrentEvents
@Subscribe
public void processPaymentEvent(final PaymentInternalEvent event) {
- janitor.processPaymentEvent(event);
+ janitor.processPaymentEvent(event);
}
@AllowConcurrentEvents
@@ -91,15 +89,15 @@ public class PaymentBusEventHandler {
account = accountApi.getAccountById(event.getAccountId(), internalContext);
final List<PluginProperty> properties = new ArrayList<PluginProperty>();
- final PluginProperty prop1 = new PluginProperty(InvoicePaymentRoutingPluginApi.PROP_IPCD_INVOICE_ID, event.getInvoiceId().toString(), false);
+ final PluginProperty prop1 = new PluginProperty(InvoicePaymentControlPluginApi.PROP_IPCD_INVOICE_ID, event.getInvoiceId().toString(), false);
properties.add(prop1);
final CallContext callContext = internalCallContextFactory.createCallContext(internalContext);
final BigDecimal amountToBePaid = null; // We let the plugin compute how much should be paid
final List<String> paymentControlPluginNames = paymentConfig.getPaymentControlPluginNames() != null ? new LinkedList<String>(paymentConfig.getPaymentControlPluginNames()) : new LinkedList<String>();
- paymentControlPluginNames.add(InvoicePaymentRoutingPluginApi.PLUGIN_NAME);
- pluginRoutingPaymentProcessor.createPurchase(false, account, account.getPaymentMethodId(), null, amountToBePaid, account.getCurrency(), UUIDs.randomUUID().toString(), UUIDs.randomUUID().toString(),
+ paymentControlPluginNames.add(InvoicePaymentControlPluginApi.PLUGIN_NAME);
+ pluginControlPaymentProcessor.createPurchase(false, account, account.getPaymentMethodId(), null, amountToBePaid, account.getCurrency(), UUIDs.randomUUID().toString(), UUIDs.randomUUID().toString(),
properties, paymentControlPluginNames, callContext, internalContext);
} catch (final AccountApiException e) {
log.error("Failed to process invoice payment", e);
diff --git a/payment/src/main/java/org/killbill/billing/payment/core/janitor/IncompletePaymentAttemptTask.java b/payment/src/main/java/org/killbill/billing/payment/core/janitor/IncompletePaymentAttemptTask.java
index 01a9101..9e12621 100644
--- a/payment/src/main/java/org/killbill/billing/payment/core/janitor/IncompletePaymentAttemptTask.java
+++ b/payment/src/main/java/org/killbill/billing/payment/core/janitor/IncompletePaymentAttemptTask.java
@@ -17,7 +17,6 @@
package org.killbill.billing.payment.core.janitor;
-import java.io.IOException;
import java.util.List;
import javax.inject.Inject;
@@ -34,7 +33,7 @@ import org.killbill.billing.payment.api.PaymentApiException;
import org.killbill.billing.payment.api.TransactionStatus;
import org.killbill.billing.payment.core.sm.PaymentControlStateMachineHelper;
import org.killbill.billing.payment.core.sm.PaymentStateMachineHelper;
-import org.killbill.billing.payment.core.sm.PluginRoutingPaymentAutomatonRunner;
+import org.killbill.billing.payment.core.sm.PluginControlPaymentAutomatonRunner;
import org.killbill.billing.payment.core.sm.control.PaymentStateControlContext;
import org.killbill.billing.payment.dao.PaymentAttemptModelDao;
import org.killbill.billing.payment.dao.PaymentDao;
@@ -65,15 +64,15 @@ public class IncompletePaymentAttemptTask extends CompletionTaskBase<PaymentAtte
// Each paymentAttempt *should* transition to a new state, so fetching a limited size will still allow us to progress (as opposed to fetching the same entries over and over)
// We also don't expect to see too many entries in the INIT state.
//
- private final static long MAX_ATTEMPTS_PER_ITERATIONS = 1000L;
+ private static final long MAX_ATTEMPTS_PER_ITERATIONS = 1000L;
- private final PluginRoutingPaymentAutomatonRunner pluginControlledPaymentAutomatonRunner;
+ private final PluginControlPaymentAutomatonRunner pluginControlledPaymentAutomatonRunner;
@Inject
public IncompletePaymentAttemptTask(final InternalCallContextFactory internalCallContextFactory, final PaymentConfig paymentConfig,
final PaymentDao paymentDao, final Clock clock, final PaymentStateMachineHelper paymentStateMachineHelper,
final PaymentControlStateMachineHelper retrySMHelper, final AccountInternalApi accountInternalApi,
- final PluginRoutingPaymentAutomatonRunner pluginControlledPaymentAutomatonRunner,
+ final PluginControlPaymentAutomatonRunner pluginControlledPaymentAutomatonRunner,
final OSGIServiceRegistration<PaymentPluginApi> pluginRegistry, final GlobalLocker locker) {
super(internalCallContextFactory, paymentConfig, paymentDao, clock, paymentStateMachineHelper, retrySMHelper, accountInternalApi, pluginRegistry, locker);
this.pluginControlledPaymentAutomatonRunner = pluginControlledPaymentAutomatonRunner;
diff --git a/payment/src/main/java/org/killbill/billing/payment/core/sm/control/CompletionControlOperation.java b/payment/src/main/java/org/killbill/billing/payment/core/sm/control/CompletionControlOperation.java
index bc22687..a9361dc 100644
--- a/payment/src/main/java/org/killbill/billing/payment/core/sm/control/CompletionControlOperation.java
+++ b/payment/src/main/java/org/killbill/billing/payment/core/sm/control/CompletionControlOperation.java
@@ -1,6 +1,6 @@
/*
- * Copyright 2014 Groupon, Inc
- * Copyright 2014 The Billing Project, LLC
+ * Copyright 2014-2015 Groupon, Inc
+ * Copyright 2014-2015 The Billing Project, LLC
*
* The Billing Project licenses this file to you under the Apache License, version 2.0
* (the "License"); you may not use this file except in compliance with the
@@ -47,7 +47,7 @@ public class CompletionControlOperation extends OperationControlCallback {
@Override
public PluginDispatcherReturnType<OperationResult> doOperation() throws OperationException {
final PaymentTransactionModelDao transaction = paymentStateContext.getPaymentTransactionModelDao();
- final PaymentRoutingContext updatedPaymentControlContext = new DefaultPaymentRoutingContext(paymentStateContext.getAccount(),
+ final PaymentRoutingContext updatedPaymentControlContext = new DefaultPaymentControlContext(paymentStateContext.getAccount(),
paymentStateContext.getPaymentMethodId(),
paymentStateControlContext.getAttemptId(),
transaction.getPaymentId(),
diff --git a/payment/src/main/java/org/killbill/billing/payment/core/sm/control/DefaultControlCompleted.java b/payment/src/main/java/org/killbill/billing/payment/core/sm/control/DefaultControlCompleted.java
index f3daf43..86a22f1 100644
--- a/payment/src/main/java/org/killbill/billing/payment/core/sm/control/DefaultControlCompleted.java
+++ b/payment/src/main/java/org/killbill/billing/payment/core/sm/control/DefaultControlCompleted.java
@@ -26,8 +26,8 @@ import org.killbill.automaton.State;
import org.killbill.automaton.State.EnteringStateCallback;
import org.killbill.automaton.State.LeavingStateCallback;
import org.killbill.billing.ObjectType;
+import org.killbill.billing.payment.core.sm.PluginControlPaymentAutomatonRunner;
import org.killbill.billing.payment.api.TransactionStatus;
-import org.killbill.billing.payment.core.sm.PluginRoutingPaymentAutomatonRunner;
import org.killbill.billing.payment.dao.PaymentAttemptModelDao;
import org.killbill.billing.payment.dao.PaymentTransactionModelDao;
import org.killbill.billing.payment.retry.BaseRetryService.RetryServiceScheduler;
@@ -37,12 +37,12 @@ import com.google.common.collect.Iterables;
public class DefaultControlCompleted implements EnteringStateCallback {
- private PluginRoutingPaymentAutomatonRunner retryablePaymentAutomatonRunner;
private final PaymentStateControlContext paymentStateContext;
private final RetryServiceScheduler retryServiceScheduler;
private final State retriedState;
+ private final PluginControlPaymentAutomatonRunner retryablePaymentAutomatonRunner;
- public DefaultControlCompleted(final PluginRoutingPaymentAutomatonRunner retryablePaymentAutomatonRunner, final PaymentStateControlContext paymentStateContext,
+ public DefaultControlCompleted(final PluginControlPaymentAutomatonRunner retryablePaymentAutomatonRunner, final PaymentStateControlContext paymentStateContext,
final State retriedState, final RetryServiceScheduler retryServiceScheduler) {
this.retryablePaymentAutomatonRunner = retryablePaymentAutomatonRunner;
this.paymentStateContext = paymentStateContext;
diff --git a/payment/src/main/java/org/killbill/billing/payment/core/sm/control/DefaultControlInitiated.java b/payment/src/main/java/org/killbill/billing/payment/core/sm/control/DefaultControlInitiated.java
index e5c52b1..8086967 100644
--- a/payment/src/main/java/org/killbill/billing/payment/core/sm/control/DefaultControlInitiated.java
+++ b/payment/src/main/java/org/killbill/billing/payment/core/sm/control/DefaultControlInitiated.java
@@ -1,7 +1,8 @@
/*
- * Copyright 2014 Groupon, Inc
+ * Copyright 2014-2015 Groupon, Inc
+ * Copyright 2014-2015 The Billing Project, LLC
*
- * Groupon licenses this file to you under the Apache License, version 2.0
+ * The Billing Project licenses this file to you under the Apache License, version 2.0
* (the "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at:
*
@@ -22,7 +23,7 @@ import org.killbill.automaton.State;
import org.killbill.automaton.State.LeavingStateCallback;
import org.killbill.billing.payment.api.TransactionType;
import org.killbill.billing.payment.core.sm.PaymentStateContext;
-import org.killbill.billing.payment.core.sm.PluginRoutingPaymentAutomatonRunner;
+import org.killbill.billing.payment.core.sm.PluginControlPaymentAutomatonRunner;
import org.killbill.billing.payment.dao.PaymentAttemptModelDao;
import org.killbill.billing.payment.dao.PaymentDao;
import org.killbill.billing.payment.dao.PaymentModelDao;
@@ -35,16 +36,16 @@ import com.google.common.base.Preconditions;
public class DefaultControlInitiated implements LeavingStateCallback {
- private final PluginRoutingPaymentAutomatonRunner retryablePaymentAutomatonRunner;
+ private final PluginControlPaymentAutomatonRunner pluginControlPaymentAutomatonRunner;
private final PaymentStateControlContext stateContext;
private final State initialState;
private final State retriedState;
private final TransactionType transactionType;
private final PaymentDao paymentDao;
- public DefaultControlInitiated(final PluginRoutingPaymentAutomatonRunner retryablePaymentAutomatonRunner, final PaymentStateContext stateContext, final PaymentDao paymentDao,
+ public DefaultControlInitiated(final PluginControlPaymentAutomatonRunner pluginControlPaymentAutomatonRunner, final PaymentStateContext stateContext, final PaymentDao paymentDao,
final State initialState, final State retriedState, final TransactionType transactionType) {
- this.retryablePaymentAutomatonRunner = retryablePaymentAutomatonRunner;
+ this.pluginControlPaymentAutomatonRunner = pluginControlPaymentAutomatonRunner;
this.paymentDao = paymentDao;
this.initialState = initialState;
this.retriedState = retriedState;
@@ -54,7 +55,7 @@ public class DefaultControlInitiated implements LeavingStateCallback {
@Override
public void leavingState(final State state) throws OperationException {
- final DateTime utcNow = retryablePaymentAutomatonRunner.getClock().getUTCNow();
+ final DateTime utcNow = pluginControlPaymentAutomatonRunner.getClock().getUTCNow();
if (stateContext.getPaymentId() != null && stateContext.getPaymentExternalKey() == null) {
final PaymentModelDao payment = paymentDao.getPayment(stateContext.getPaymentId(), stateContext.getInternalCallContext());
@@ -81,7 +82,7 @@ public class DefaultControlInitiated implements LeavingStateCallback {
stateContext.getAmount(), stateContext.getCurrency(),
stateContext.getPaymentControlPluginNames(), serializedProperties);
- retryablePaymentAutomatonRunner.getPaymentDao().insertPaymentAttemptWithProperties(attempt, stateContext.getInternalCallContext());
+ pluginControlPaymentAutomatonRunner.getPaymentDao().insertPaymentAttemptWithProperties(attempt, stateContext.getInternalCallContext());
stateContext.setAttemptId(attempt.getId());
} catch (final PluginPropertySerializerException e) {
diff --git a/payment/src/main/java/org/killbill/billing/payment/core/sm/control/OperationControlCallback.java b/payment/src/main/java/org/killbill/billing/payment/core/sm/control/OperationControlCallback.java
index f718cff..34e2fd8 100644
--- a/payment/src/main/java/org/killbill/billing/payment/core/sm/control/OperationControlCallback.java
+++ b/payment/src/main/java/org/killbill/billing/payment/core/sm/control/OperationControlCallback.java
@@ -1,7 +1,8 @@
/*
- * Copyright 2014 Groupon, Inc
+ * Copyright 2014-2015 Groupon, Inc
+ * Copyright 2014-2015 The Billing Project, LLC
*
- * Groupon licenses this file to you under the Apache License, version 2.0
+ * The Billing Project licenses this file to you under the Apache License, version 2.0
* (the "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at:
*
@@ -57,11 +58,9 @@ import org.slf4j.LoggerFactory;
public abstract class OperationControlCallback extends OperationCallbackBase<Payment, PaymentApiException> implements OperationCallback {
- private final OSGIServiceRegistration<PaymentRoutingPluginApi> paymentControlPluginRegistry;
-
protected final PaymentProcessor paymentProcessor;
protected final PaymentStateControlContext paymentStateControlContext;
-
+ private final OSGIServiceRegistration<PaymentRoutingPluginApi> paymentControlPluginRegistry;
private final Logger logger = LoggerFactory.getLogger(OperationControlCallback.class);
protected OperationControlCallback(final GlobalLocker locker, final PluginDispatcher<OperationResult> paymentPluginDispatcher, final PaymentStateControlContext paymentStateContext, final PaymentProcessor paymentProcessor, final OSGIServiceRegistration<PaymentRoutingPluginApi> retryPluginRegistry) {
@@ -82,7 +81,7 @@ public abstract class OperationControlCallback extends OperationCallbackBase<Pay
@Override
public PluginDispatcherReturnType<OperationResult> doOperation() throws OperationException {
- final PaymentRoutingContext paymentControlContext = new DefaultPaymentRoutingContext(paymentStateContext.getAccount(),
+ final PaymentRoutingContext paymentControlContext = new DefaultPaymentControlContext(paymentStateContext.getAccount(),
paymentStateContext.getPaymentMethodId(),
paymentStateControlContext.getAttemptId(),
paymentStateContext.getPaymentId(),
@@ -118,7 +117,7 @@ public abstract class OperationControlCallback extends OperationCallbackBase<Pay
success = transaction.getTransactionStatus() == TransactionStatus.SUCCESS || transaction.getTransactionStatus() == TransactionStatus.PENDING;
if (success) {
- final PaymentRoutingContext updatedPaymentRoutingContext = new DefaultPaymentRoutingContext(paymentStateContext.getAccount(),
+ final PaymentRoutingContext updatedPaymentControlContext = new DefaultPaymentControlContext(paymentStateContext.getAccount(),
paymentStateContext.getPaymentMethodId(),
paymentStateControlContext.getAttemptId(),
result.getId(),
@@ -134,7 +133,7 @@ public abstract class OperationControlCallback extends OperationCallbackBase<Pay
paymentStateControlContext.isApiPayment(),
paymentStateContext.getCallContext());
- executePluginOnSuccessCalls(paymentStateControlContext.getPaymentControlPluginNames(), updatedPaymentRoutingContext);
+ executePluginOnSuccessCalls(paymentStateControlContext.getPaymentControlPluginNames(), updatedPaymentControlContext);
return PluginDispatcher.createPluginDispatcherReturnType(OperationResult.SUCCESS);
} else {
throw new OperationException(null, executePluginOnFailureCallsAndSetRetryDate(paymentStateControlContext, paymentControlContext));
@@ -220,7 +219,7 @@ public abstract class OperationControlCallback extends OperationCallbackBase<Pay
// Return as soon as the first plugin aborts, or the last result for the last plugin
PriorPaymentRoutingResult prevResult = null;
- PaymentRoutingContext inputPaymentRoutingContext = paymentControlContextArg;
+ PaymentRoutingContext inputPaymentControlContext = paymentControlContextArg;
for (final String pluginName : paymentControlPluginNames) {
final PaymentRoutingPluginApi plugin = paymentControlPluginRegistry.getServiceForName(pluginName);
@@ -229,20 +228,20 @@ public abstract class OperationControlCallback extends OperationCallbackBase<Pay
logger.warn("Skipping unknown payment control plugin {} when fetching results", pluginName);
continue;
}
- prevResult = plugin.priorCall(inputPaymentRoutingContext, paymentStateContext.getProperties());
+ prevResult = plugin.priorCall(inputPaymentControlContext, paymentStateContext.getProperties());
if (prevResult.isAborted()) {
break;
}
- inputPaymentRoutingContext = new DefaultPaymentRoutingContext(paymentStateContext.getAccount(),
- prevResult.getAdjustedPaymentMethodId() != null ? prevResult.getAdjustedPaymentMethodId() : inputPaymentRoutingContext.getPaymentMethodId(),
+ inputPaymentControlContext = new DefaultPaymentControlContext(paymentStateContext.getAccount(),
+ prevResult.getAdjustedPaymentMethodId() != null ? prevResult.getAdjustedPaymentMethodId() : inputPaymentControlContext.getPaymentMethodId(),
paymentStateControlContext.getAttemptId(),
paymentStateContext.getPaymentId(),
paymentStateContext.getPaymentExternalKey(),
paymentStateContext.getPaymentTransactionExternalKey(),
paymentStateContext.getTransactionType(),
- prevResult.getAdjustedAmount() != null ? prevResult.getAdjustedAmount() : inputPaymentRoutingContext.getAmount(),
- prevResult.getAdjustedCurrency() != null ? prevResult.getAdjustedCurrency() : inputPaymentRoutingContext.getCurrency(),
- prevResult.getAdjustedPluginProperties() != null ? prevResult.getAdjustedPluginProperties() : inputPaymentRoutingContext.getPluginProperties(),
+ prevResult.getAdjustedAmount() != null ? prevResult.getAdjustedAmount() : inputPaymentControlContext.getAmount(),
+ prevResult.getAdjustedCurrency() != null ? prevResult.getAdjustedCurrency() : inputPaymentControlContext.getCurrency(),
+ prevResult.getAdjustedPluginProperties() != null ? prevResult.getAdjustedPluginProperties() : inputPaymentControlContext.getPluginProperties(),
paymentStateControlContext.isApiPayment(),
paymentStateContext.getCallContext());
@@ -281,7 +280,7 @@ public abstract class OperationControlCallback extends OperationCallbackBase<Pay
return candidate;
}
- public static class DefaultPaymentRoutingContext extends DefaultCallContext implements PaymentRoutingContext {
+ public static class DefaultPaymentControlContext extends DefaultCallContext implements PaymentRoutingContext {
private final Account account;
private final UUID paymentMethodId;
@@ -298,12 +297,12 @@ public abstract class OperationControlCallback extends OperationCallbackBase<Pay
private final boolean isApiPayment;
private final Iterable<PluginProperty> properties;
- public DefaultPaymentRoutingContext(final Account account, final UUID paymentMethodId, final UUID attemptId, @Nullable final UUID paymentId, final String paymentExternalKey, final String transactionExternalKey, final TransactionType transactionType, final BigDecimal amount, final Currency currency,
+ public DefaultPaymentControlContext(final Account account, final UUID paymentMethodId, final UUID attemptId, @Nullable final UUID paymentId, final String paymentExternalKey, final String transactionExternalKey, final TransactionType transactionType, final BigDecimal amount, final Currency currency,
final Iterable<PluginProperty> properties, final boolean isApiPayment, final CallContext callContext) {
this(account, paymentMethodId, attemptId, paymentId, paymentExternalKey, null, transactionExternalKey, transactionType, amount, currency, null, null, properties, isApiPayment, callContext);
}
- public DefaultPaymentRoutingContext(final Account account, final UUID paymentMethodId, final UUID attemptId, @Nullable final UUID paymentId, final String paymentExternalKey, @Nullable final UUID transactionId, final String transactionExternalKey, final TransactionType transactionType,
+ public DefaultPaymentControlContext(final Account account, final UUID paymentMethodId, final UUID attemptId, @Nullable final UUID paymentId, final String paymentExternalKey, @Nullable final UUID transactionId, final String transactionExternalKey, final TransactionType transactionType,
final BigDecimal amount, final Currency currency, @Nullable final BigDecimal processedAmount, @Nullable final Currency processedCurrency, final Iterable<PluginProperty> properties, final boolean isApiPayment, final CallContext callContext) {
super(callContext.getTenantId(), callContext.getUserName(), callContext.getCallOrigin(), callContext.getUserType(), callContext.getReasonCode(), callContext.getComments(), callContext.getUserToken(), callContext.getCreatedDate(), callContext.getUpdatedDate());
this.account = account;
@@ -393,7 +392,7 @@ public abstract class OperationControlCallback extends OperationCallbackBase<Pay
@Override
public String toString() {
- return "DefaultPaymentRoutingContext{" +
+ return "DefaultPaymentControlContext{" +
"account=" + account +
", paymentMethodId=" + paymentMethodId +
", attemptId=" + attemptId +
diff --git a/payment/src/main/java/org/killbill/billing/payment/core/sm/PaymentAutomatonRunner.java b/payment/src/main/java/org/killbill/billing/payment/core/sm/PaymentAutomatonRunner.java
index 099ea97..4353d9e 100644
--- a/payment/src/main/java/org/killbill/billing/payment/core/sm/PaymentAutomatonRunner.java
+++ b/payment/src/main/java/org/killbill/billing/payment/core/sm/PaymentAutomatonRunner.java
@@ -1,8 +1,8 @@
/*
- * Copyright 2014 Groupon, Inc
- * Copyright 2014 The Billing Project, LLC
+ * Copyright 2014-2015 Groupon, Inc
+ * Copyright 2014-2015 The Billing Project, LLC
*
- * Groupon licenses this file to you under the Apache License, version 2.0
+ * The Billing Project licenses this file to you under the Apache License, version 2.0
* (the "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at:
*
@@ -70,7 +70,7 @@ import org.killbill.billing.payment.dao.PaymentDao;
import org.killbill.billing.payment.dao.PaymentModelDao;
import org.killbill.billing.payment.dispatcher.PluginDispatcher;
import org.killbill.billing.payment.glue.PaymentModule;
-import org.killbill.billing.payment.invoice.InvoicePaymentRoutingPluginApi;
+import org.killbill.billing.payment.invoice.InvoicePaymentControlPluginApi;
import org.killbill.billing.payment.plugin.api.PaymentPluginApi;
import org.killbill.billing.util.callcontext.CallContext;
import org.killbill.billing.util.config.PaymentConfig;
@@ -236,7 +236,7 @@ public class PaymentAutomatonRunner {
final PluginProperty invoiceProperty = Iterables.tryFind(properties, new Predicate<PluginProperty>() {
@Override
public boolean apply(final PluginProperty input) {
- return InvoicePaymentRoutingPluginApi.PROP_IPCD_INVOICE_ID.equals(input.getKey());
+ return InvoicePaymentControlPluginApi.PROP_IPCD_INVOICE_ID.equals(input.getKey());
}
}).orNull();
diff --git a/payment/src/main/java/org/killbill/billing/payment/glue/PaymentModule.java b/payment/src/main/java/org/killbill/billing/payment/glue/PaymentModule.java
index a602405..51fcc17 100644
--- a/payment/src/main/java/org/killbill/billing/payment/glue/PaymentModule.java
+++ b/payment/src/main/java/org/killbill/billing/payment/glue/PaymentModule.java
@@ -1,7 +1,7 @@
/*
* Copyright 2010-2013 Ning, Inc.
- * Copyright 2014 Groupon, Inc
- * Copyright 2014 The Billing Project, LLC
+ * Copyright 2014-2015 Groupon, Inc
+ * Copyright 2014-2015 The Billing Project, LLC
*
* The Billing Project licenses this file to you under the Apache License, version 2.0
* (the "License"); you may not use this file except in compliance with the
@@ -40,17 +40,17 @@ import org.killbill.billing.payment.bus.PaymentBusEventHandler;
import org.killbill.billing.payment.core.PaymentGatewayProcessor;
import org.killbill.billing.payment.core.PaymentMethodProcessor;
import org.killbill.billing.payment.core.PaymentProcessor;
-import org.killbill.billing.payment.core.PluginRoutingPaymentProcessor;
+import org.killbill.billing.payment.core.PluginControlPaymentProcessor;
import org.killbill.billing.payment.core.janitor.IncompletePaymentAttemptTask;
import org.killbill.billing.payment.core.janitor.IncompletePaymentTransactionTask;
import org.killbill.billing.payment.core.janitor.Janitor;
import org.killbill.billing.payment.core.sm.PaymentControlStateMachineHelper;
import org.killbill.billing.payment.core.sm.PaymentStateMachineHelper;
-import org.killbill.billing.payment.core.sm.PluginRoutingPaymentAutomatonRunner;
+import org.killbill.billing.payment.core.sm.PluginControlPaymentAutomatonRunner;
import org.killbill.billing.payment.dao.DefaultPaymentDao;
import org.killbill.billing.payment.dao.PaymentDao;
import org.killbill.billing.payment.invoice.PaymentTagHandler;
-import org.killbill.billing.payment.invoice.dao.InvoicePaymentRoutingDao;
+import org.killbill.billing.payment.invoice.dao.InvoicePaymentControlDao;
import org.killbill.billing.payment.plugin.api.PaymentPluginApi;
import org.killbill.billing.payment.retry.BaseRetryService.RetryServiceScheduler;
import org.killbill.billing.payment.retry.DefaultRetryService;
@@ -93,7 +93,7 @@ public class PaymentModule extends KillBillModule {
protected void installPaymentDao() {
bind(PaymentDao.class).to(DefaultPaymentDao.class).asEagerSingleton();
// Payment Control Plugin Dao
- bind(InvoicePaymentRoutingDao.class).asEagerSingleton();
+ bind(InvoicePaymentControlDao.class).asEagerSingleton();
}
protected void installPaymentProviderPlugins(final PaymentConfig config) {
@@ -127,26 +127,8 @@ public class PaymentModule extends KillBillModule {
bind(PaymentStateMachineHelper.class).asEagerSingleton();
}
- public static final class StateMachineProvider implements Provider<StateMachineConfig> {
-
- private final String stateMachineConfig;
-
- public StateMachineProvider(final String stateMachineConfig) {
- this.stateMachineConfig = stateMachineConfig;
- }
-
- @Override
- public StateMachineConfig get() {
- try {
- return XMLLoader.getObjectFromString(Resources.getResource(stateMachineConfig).toExternalForm(), DefaultStateMachineConfig.class);
- } catch (final Exception e) {
- throw new IllegalStateException(e);
- }
- }
- }
-
protected void installAutomatonRunner() {
- bind(PluginRoutingPaymentAutomatonRunner.class).asEagerSingleton();
+ bind(PluginControlPaymentAutomatonRunner.class).asEagerSingleton();
}
protected void installProcessors(final PaymentConfig paymentConfig) {
@@ -165,7 +147,7 @@ public class PaymentModule extends KillBillModule {
});
bind(ExecutorService.class).annotatedWith(Names.named(PLUGIN_EXECUTOR_NAMED)).toInstance(pluginExecutorService);
bind(PaymentProcessor.class).asEagerSingleton();
- bind(PluginRoutingPaymentProcessor.class).asEagerSingleton();
+ bind(PluginControlPaymentProcessor.class).asEagerSingleton();
bind(PaymentGatewayProcessor.class).asEagerSingleton();
bind(PaymentMethodProcessor.class).asEagerSingleton();
}
@@ -177,7 +159,7 @@ public class PaymentModule extends KillBillModule {
bind(PaymentConfig.class).toInstance(paymentConfig);
bind(new TypeLiteral<OSGIServiceRegistration<PaymentPluginApi>>() {}).toProvider(DefaultPaymentProviderPluginRegistryProvider.class).asEagerSingleton();
- bind(new TypeLiteral<OSGIServiceRegistration<PaymentRoutingPluginApi>>() {}).toProvider(DefaultPaymentRoutingProviderPluginRegistryProvider.class).asEagerSingleton();
+ bind(new TypeLiteral<OSGIServiceRegistration<PaymentRoutingPluginApi>>() {}).toProvider(DefaultPaymentControlProviderPluginRegistryProvider.class).asEagerSingleton();
bind(PaymentApi.class).to(DefaultPaymentApi.class).asEagerSingleton();
bind(PaymentGatewayApi.class).to(DefaultPaymentGatewayApi.class).asEagerSingleton();
@@ -193,4 +175,22 @@ public class PaymentModule extends KillBillModule {
installRetryEngines();
installJanitor();
}
+
+ public static final class StateMachineProvider implements Provider<StateMachineConfig> {
+
+ private final String stateMachineConfig;
+
+ public StateMachineProvider(final String stateMachineConfig) {
+ this.stateMachineConfig = stateMachineConfig;
+ }
+
+ @Override
+ public StateMachineConfig get() {
+ try {
+ return XMLLoader.getObjectFromString(Resources.getResource(stateMachineConfig).toExternalForm(), DefaultStateMachineConfig.class);
+ } catch (final Exception e) {
+ throw new IllegalStateException(e);
+ }
+ }
+ }
}
diff --git a/payment/src/main/java/org/killbill/billing/payment/invoice/PaymentTagHandler.java b/payment/src/main/java/org/killbill/billing/payment/invoice/PaymentTagHandler.java
index 3c1f13c..81eb214 100644
--- a/payment/src/main/java/org/killbill/billing/payment/invoice/PaymentTagHandler.java
+++ b/payment/src/main/java/org/killbill/billing/payment/invoice/PaymentTagHandler.java
@@ -1,7 +1,9 @@
/*
* Copyright 2010-2013 Ning, Inc.
+ * Copyright 2014-2015 Groupon, Inc
+ * Copyright 2014-2015 The Billing Project, LLC
*
- * Ning licenses this file to you under the Apache License, version 2.0
+ * The Billing Project licenses this file to you under the Apache License, version 2.0
* (the "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at:
*
@@ -25,13 +27,11 @@ import org.killbill.billing.account.api.AccountInternalApi;
import org.killbill.billing.callcontext.InternalCallContext;
import org.killbill.billing.events.ControlTagDeletionInternalEvent;
import org.killbill.billing.osgi.api.OSGIServiceRegistration;
-import org.killbill.billing.payment.core.PaymentProcessor;
import org.killbill.billing.routing.plugin.api.PaymentRoutingPluginApi;
import org.killbill.billing.util.callcontext.CallOrigin;
import org.killbill.billing.util.callcontext.InternalCallContextFactory;
import org.killbill.billing.util.callcontext.UserType;
import org.killbill.billing.util.tag.ControlTagType;
-import org.killbill.clock.Clock;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -43,32 +43,22 @@ public class PaymentTagHandler {
private static final Logger log = LoggerFactory.getLogger(PaymentTagHandler.class);
- private final Clock clock;
private final AccountInternalApi accountApi;
- private final PaymentProcessor paymentProcessor;
private final InternalCallContextFactory internalCallContextFactory;
- private final OSGIServiceRegistration<PaymentRoutingPluginApi> paymentControlPluginRegistry;
private final PaymentRoutingPluginApi invoicePaymentControlPlugin;
@Inject
- public PaymentTagHandler(final Clock clock,
- final AccountInternalApi accountApi,
- final PaymentProcessor paymentProcessor,
+ public PaymentTagHandler(final AccountInternalApi accountApi,
final OSGIServiceRegistration<PaymentRoutingPluginApi> paymentControlPluginRegistry,
final InternalCallContextFactory internalCallContextFactory) {
- this.clock = clock;
this.accountApi = accountApi;
- this.paymentProcessor = paymentProcessor;
- this.paymentControlPluginRegistry = paymentControlPluginRegistry;
- this.invoicePaymentControlPlugin = paymentControlPluginRegistry.getServiceForName(InvoicePaymentRoutingPluginApi.PLUGIN_NAME);
+ this.invoicePaymentControlPlugin = paymentControlPluginRegistry.getServiceForName(InvoicePaymentControlPluginApi.PLUGIN_NAME);
this.internalCallContextFactory = internalCallContextFactory;
}
-
@AllowConcurrentEvents
@Subscribe
public void process_AUTO_PAY_OFF_removal(final ControlTagDeletionInternalEvent event) {
-
if (event.getTagDefinition().getName().equals(ControlTagType.AUTO_PAY_OFF.toString()) && event.getObjectType() == ObjectType.ACCOUNT) {
final UUID accountId = event.getObjectId();
processUnpaid_AUTO_PAY_OFF_payments(accountId, event.getSearchKey1(), event.getSearchKey2(), event.getUserToken());
@@ -80,9 +70,9 @@ public class PaymentTagHandler {
final InternalCallContext internalCallContext = internalCallContextFactory.createInternalCallContext(tenantRecordId, accountRecordId,
"PaymentRequestProcessor", CallOrigin.INTERNAL, UserType.SYSTEM, userToken);
final Account account = accountApi.getAccountById(accountId, internalCallContext);
- ((InvoicePaymentRoutingPluginApi) invoicePaymentControlPlugin).process_AUTO_PAY_OFF_removal(account, internalCallContext);
+ ((InvoicePaymentControlPluginApi) invoicePaymentControlPlugin).process_AUTO_PAY_OFF_removal(account, internalCallContext);
- } catch (AccountApiException e) {
+ } catch (final AccountApiException e) {
log.warn(String.format("Failed to process process removal AUTO_PAY_OFF for account %s", accountId), e);
}
}
diff --git a/payment/src/main/java/org/killbill/billing/payment/retry/DefaultRetryService.java b/payment/src/main/java/org/killbill/billing/payment/retry/DefaultRetryService.java
index eaed99f..fb3a56e 100644
--- a/payment/src/main/java/org/killbill/billing/payment/retry/DefaultRetryService.java
+++ b/payment/src/main/java/org/killbill/billing/payment/retry/DefaultRetryService.java
@@ -1,7 +1,8 @@
/*
- * Copyright 2014 Groupon, Inc
+ * Copyright 2014-2015 Groupon, Inc
+ * Copyright 2014-2015 The Billing Project, LLC
*
- * Groupon licenses this file to you under the Apache License, version 2.0
+ * The Billing Project licenses this file to you under the Apache License, version 2.0
* (the "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at:
*
@@ -20,7 +21,7 @@ import java.util.List;
import java.util.UUID;
import org.killbill.billing.callcontext.InternalCallContext;
-import org.killbill.billing.payment.core.PluginRoutingPaymentProcessor;
+import org.killbill.billing.payment.core.PluginControlPaymentProcessor;
import org.killbill.billing.util.callcontext.InternalCallContextFactory;
import org.killbill.notificationq.api.NotificationQueueService;
@@ -30,10 +31,10 @@ public class DefaultRetryService extends BaseRetryService implements RetryServic
public static final String QUEUE_NAME = "retry";
- private final PluginRoutingPaymentProcessor processor;
+ private final PluginControlPaymentProcessor processor;
@Inject
- public DefaultRetryService(final NotificationQueueService notificationQueueService, final InternalCallContextFactory internalCallContextFactory, final PluginRoutingPaymentProcessor processor) {
+ public DefaultRetryService(final NotificationQueueService notificationQueueService, final InternalCallContextFactory internalCallContextFactory, final PluginControlPaymentProcessor processor) {
super(notificationQueueService, internalCallContextFactory);
this.processor = processor;
}
@@ -43,7 +44,6 @@ public class DefaultRetryService extends BaseRetryService implements RetryServic
return QUEUE_NAME;
}
-
@Override
public void retryPaymentTransaction(final UUID attemptId, final List<String> paymentControlPluginNames, final InternalCallContext context) {
processor.retryPaymentTransaction(attemptId, paymentControlPluginNames, context);
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 9732b7c..83ffc0d 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
@@ -1,7 +1,7 @@
/*
* Copyright 2010-2013 Ning, Inc.
- * Copyright 2014 Groupon, Inc
- * Copyright 2014 The Billing Project, LLC
+ * Copyright 2014-2015 Groupon, Inc
+ * Copyright 2014-2015 The Billing Project, LLC
*
* The Billing Project licenses this file to you under the Apache License, version 2.0
* (the "License"); you may not use this file except in compliance with the
@@ -33,13 +33,12 @@ import org.killbill.billing.invoice.api.InvoiceApiException;
import org.killbill.billing.invoice.api.InvoiceItem;
import org.killbill.billing.payment.MockRecurringInvoiceItem;
import org.killbill.billing.payment.PaymentTestSuiteWithEmbeddedDB;
-import org.killbill.billing.payment.invoice.InvoicePaymentRoutingPluginApi;
import org.killbill.billing.payment.dao.PaymentAttemptModelDao;
import org.killbill.billing.payment.dao.PaymentSqlDao;
+import org.killbill.billing.payment.invoice.InvoicePaymentControlPluginApi;
import org.killbill.billing.routing.plugin.api.PaymentRoutingApiException;
import org.killbill.bus.api.PersistentBus.EventBusException;
import org.testng.Assert;
-import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
@@ -59,7 +58,7 @@ public class TestPaymentApi extends PaymentTestSuiteWithEmbeddedDB {
@Override
public List<String> getPaymentControlPluginNames() {
- return ImmutableList.<String>of(InvoicePaymentRoutingPluginApi.PLUGIN_NAME);
+ return ImmutableList.<String>of(InvoicePaymentControlPluginApi.PLUGIN_NAME);
}
};
@@ -179,13 +178,13 @@ public class TestPaymentApi extends PaymentTestSuiteWithEmbeddedDB {
final String transactionExternalKey4 = "sioux4";
final Payment payment = paymentApi.createAuthorization(account, account.getPaymentMethodId(), null, authAmount, Currency.USD, paymentExternalKey, transactionExternalKey,
- ImmutableList.<PluginProperty>of(), callContext);
+ ImmutableList.<PluginProperty>of(), callContext);
paymentApi.createCapture(account, payment.getId(), captureAmount, Currency.USD, transactionExternalKey2,
ImmutableList.<PluginProperty>of(), callContext);
final Payment payment3 = paymentApi.createCapture(account, payment.getId(), captureAmount, Currency.USD, transactionExternalKey3,
- ImmutableList.<PluginProperty>of(), callContext);
+ ImmutableList.<PluginProperty>of(), callContext);
assertEquals(payment3.getExternalKey(), paymentExternalKey);
assertEquals(payment3.getPaymentMethodId(), account.getPaymentMethodId());
@@ -216,7 +215,6 @@ public class TestPaymentApi extends PaymentTestSuiteWithEmbeddedDB {
assertNull(payment4.getTransactions().get(3).getGatewayErrorCode());
}
-
@Test(groups = "slow")
public void testCreateSuccessPurchaseWithPaymentControl() throws PaymentApiException, InvoiceApiException, EventBusException {
@@ -241,7 +239,7 @@ public class TestPaymentApi extends PaymentTestSuiteWithEmbeddedDB {
Currency.USD));
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.getExternalKey(), paymentExternalKey);
assertEquals(payment.getPaymentMethodId(), account.getPaymentMethodId());
@@ -328,11 +326,11 @@ public class TestPaymentApi extends PaymentTestSuiteWithEmbeddedDB {
invoice.addInvoiceItem(invoiceItem);
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 = ImmutableList.<PluginProperty>of();
final Payment payment2 = paymentApi.createRefundWithPaymentControl(account, payment.getId(), requestedAmount, Currency.USD, transactionExternalKey2,
- refundProperties, INVOICE_PAYMENT, callContext);
+ refundProperties, INVOICE_PAYMENT, callContext);
assertEquals(payment2.getTransactions().size(), 2);
assertEquals(payment2.getExternalKey(), paymentExternalKey);
@@ -371,7 +369,7 @@ public class TestPaymentApi extends PaymentTestSuiteWithEmbeddedDB {
invoice.addInvoiceItem(invoiceItem);
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 = ImmutableList.<PluginProperty>of();
@@ -409,16 +407,16 @@ public class TestPaymentApi extends PaymentTestSuiteWithEmbeddedDB {
invoice.addInvoiceItem(invoiceItem);
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 HashMap<UUID, BigDecimal> uuidBigDecimalHashMap = new HashMap<UUID, BigDecimal>();
uuidBigDecimalHashMap.put(invoiceItem.getId(), null);
- final PluginProperty refundIdsProp = new PluginProperty(InvoicePaymentRoutingPluginApi.PROP_IPCD_REFUND_IDS_WITH_AMOUNT_KEY, uuidBigDecimalHashMap, false);
+ final PluginProperty refundIdsProp = new PluginProperty(InvoicePaymentControlPluginApi.PROP_IPCD_REFUND_IDS_WITH_AMOUNT_KEY, uuidBigDecimalHashMap, false);
refundProperties.add(refundIdsProp);
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.getExternalKey(), paymentExternalKey);
@@ -442,7 +440,7 @@ public class TestPaymentApi extends PaymentTestSuiteWithEmbeddedDB {
final Payment payment = paymentApi.createPurchase(account, account.getPaymentMethodId(), null, requestedAmount, Currency.AED, paymentExternalKey, transactionExternalKey,
ImmutableList.<PluginProperty>of(), callContext);
- paymentApi.createChargeback(account, payment.getId(), requestedAmount, Currency.AED, transactionExternalKey2, callContext);
+ paymentApi.createChargeback(account, payment.getId(), requestedAmount, Currency.AED, transactionExternalKey2, callContext);
final Payment payment2 = paymentApi.getPayment(payment.getId(), false, ImmutableList.<PluginProperty>of(), callContext);
assertEquals(payment2.getExternalKey(), paymentExternalKey);
@@ -487,7 +485,7 @@ public class TestPaymentApi extends PaymentTestSuiteWithEmbeddedDB {
final String transactionExternalKey = "vert";
final Payment initialPayment = paymentApi.createAuthorization(account, account.getPaymentMethodId(), null, authAmount, Currency.AED, paymentExternalKey, transactionExternalKey,
- ImmutableList.<PluginProperty>of(), callContext);
+ ImmutableList.<PluginProperty>of(), callContext);
// Update the payment/transaction by hand to simulate a PENDING state.
final PaymentTransaction paymentTransaction = initialPayment.getTransactions().get(0);
@@ -495,7 +493,6 @@ public class TestPaymentApi extends PaymentTestSuiteWithEmbeddedDB {
paymentTransaction.getId(), TransactionStatus.PENDING, paymentTransaction.getProcessedAmount(), paymentTransaction.getProcessedCurrency(),
null, null, internalCallContext);
-
final Payment payment = paymentApi.notifyPendingTransactionOfStateChanged(account, paymentTransaction.getId(), true, callContext);
assertEquals(payment.getExternalKey(), paymentExternalKey);
@@ -521,15 +518,12 @@ public class TestPaymentApi extends PaymentTestSuiteWithEmbeddedDB {
assertNull(payment.getTransactions().get(0).getGatewayErrorCode());
}
-
@Test(groups = "slow")
public void testSimpleAuthCaptureWithInvalidPaymentId() throws Exception {
final BigDecimal requestedAmount = new BigDecimal("80.0091");
final Payment initialPayment = paymentApi.createAuthorization(account, account.getPaymentMethodId(), null, requestedAmount, account.getCurrency(),
UUID.randomUUID().toString(), UUID.randomUUID().toString(), ImmutableList.<PluginProperty>of(), callContext);
-
-
try {
paymentApi.createCapture(account, UUID.randomUUID(), requestedAmount, account.getCurrency(), UUID.randomUUID().toString(), ImmutableList.<PluginProperty>of(), callContext);
Assert.fail("Expected capture to fail...");
@@ -541,14 +535,12 @@ public class TestPaymentApi extends PaymentTestSuiteWithEmbeddedDB {
}
}
-
@Test(groups = "slow")
public void testSimpleAuthCaptureWithInvalidCurrency() throws Exception {
final BigDecimal requestedAmount = new BigDecimal("80.0091");
final Payment initialPayment = paymentApi.createAuthorization(account, account.getPaymentMethodId(), null, requestedAmount, account.getCurrency(),
- UUID.randomUUID().toString(), UUID.randomUUID().toString(), ImmutableList.<PluginProperty>of(), callContext);
-
+ UUID.randomUUID().toString(), UUID.randomUUID().toString(), ImmutableList.<PluginProperty>of(), callContext);
try {
paymentApi.createCapture(account, initialPayment.getId(), requestedAmount, Currency.AMD, UUID.randomUUID().toString(), ImmutableList.<PluginProperty>of(), callContext);
@@ -570,7 +562,7 @@ public class TestPaymentApi extends PaymentTestSuiteWithEmbeddedDB {
final String transactionExternalKey = "grenouye";
final Payment payment = paymentApi.createAuthorization(account, account.getPaymentMethodId(), null, requestedAmount, Currency.EUR, paymentExternalKey, transactionExternalKey,
- ImmutableList.<PluginProperty>of(), callContext);
+ ImmutableList.<PluginProperty>of(), callContext);
// Hack the Database to make it look like it was a failure
paymentDao.updatePaymentAndTransactionOnCompletion(account.getId(), payment.getId(), TransactionType.AUTHORIZE, "AUTH_ERRORED", null,
@@ -581,12 +573,11 @@ public class TestPaymentApi extends PaymentTestSuiteWithEmbeddedDB {
try {
paymentApi.createCapture(account, payment.getId(), requestedAmount, Currency.EUR, "tetard", ImmutableList.<PluginProperty>of(), callContext);
Assert.fail("Unexpected success");
- } catch (final PaymentApiException e){
+ } catch (final PaymentApiException e) {
Assert.assertEquals(e.getCode(), ErrorCode.PAYMENT_INVALID_OPERATION.getCode());
}
}
-
@Test(groups = "slow")
public void testApiRetryWithUnknownPaymentTransaction() throws Exception {
final BigDecimal requestedAmount = BigDecimal.TEN;
@@ -597,17 +588,14 @@ public class TestPaymentApi extends PaymentTestSuiteWithEmbeddedDB {
final Payment badPayment = paymentApi.createAuthorization(account, account.getPaymentMethodId(), null, requestedAmount, account.getCurrency(),
paymentExternalKey, paymentTransactionExternalKey, ImmutableList.<PluginProperty>of(), callContext);
-
final String paymentStateName = paymentSMHelper.getErroredStateForTransaction(TransactionType.AUTHORIZE).toString();
paymentDao.updatePaymentAndTransactionOnCompletion(account.getId(), badPayment.getId(), TransactionType.AUTHORIZE, paymentStateName, paymentStateName,
badPayment.getTransactions().get(0).getId(), TransactionStatus.UNKNOWN, requestedAmount, account.getCurrency(),
"eroor 64", "bad something happened", internalCallContext);
-
final Payment payment = paymentApi.createAuthorization(account, account.getPaymentMethodId(), null, requestedAmount, account.getCurrency(),
paymentExternalKey, paymentTransactionExternalKey, ImmutableList.<PluginProperty>of(), callContext);
-
Assert.assertEquals(payment.getId(), badPayment.getId());
Assert.assertEquals(payment.getExternalKey(), paymentExternalKey);
Assert.assertEquals(payment.getExternalKey(), paymentExternalKey);
@@ -615,11 +603,9 @@ public class TestPaymentApi extends PaymentTestSuiteWithEmbeddedDB {
Assert.assertEquals(payment.getTransactions().size(), 1);
Assert.assertEquals(payment.getTransactions().get(0).getTransactionStatus(), TransactionStatus.SUCCESS);
Assert.assertEquals(payment.getTransactions().get(0).getExternalKey(), paymentTransactionExternalKey);
-
}
-
- // Example of a 3D secure payment for instnace
+ // Example of a 3D secure payment for instance
@Test(groups = "slow")
public void testApiWithPendingPaymentTransaction() throws Exception {
final BigDecimal requestedAmount = BigDecimal.TEN;
@@ -628,19 +614,16 @@ public class TestPaymentApi extends PaymentTestSuiteWithEmbeddedDB {
final String paymentTransactionExternalKey = UUID.randomUUID().toString();
final Payment pendingPayment = paymentApi.createAuthorization(account, account.getPaymentMethodId(), null, requestedAmount, account.getCurrency(),
- paymentExternalKey, paymentTransactionExternalKey, ImmutableList.<PluginProperty>of(), callContext);
-
+ paymentExternalKey, paymentTransactionExternalKey, ImmutableList.<PluginProperty>of(), callContext);
final String paymentStateName = paymentSMHelper.getPendingStateForTransaction(TransactionType.AUTHORIZE).toString();
paymentDao.updatePaymentAndTransactionOnCompletion(account.getId(), pendingPayment.getId(), TransactionType.AUTHORIZE, paymentStateName, paymentStateName,
pendingPayment.getTransactions().get(0).getId(), TransactionStatus.PENDING, requestedAmount, account.getCurrency(),
null, null, internalCallContext);
-
final Payment payment = paymentApi.createAuthorization(account, account.getPaymentMethodId(), pendingPayment.getId(), requestedAmount, account.getCurrency(),
paymentExternalKey, paymentTransactionExternalKey, ImmutableList.<PluginProperty>of(), callContext);
-
Assert.assertEquals(payment.getId(), pendingPayment.getId());
Assert.assertEquals(payment.getExternalKey(), paymentExternalKey);
Assert.assertEquals(payment.getExternalKey(), paymentExternalKey);
@@ -651,12 +634,9 @@ public class TestPaymentApi extends PaymentTestSuiteWithEmbeddedDB {
}
-
-
-
private List<PluginProperty> createPropertiesForInvoice(final Invoice invoice) {
final List<PluginProperty> result = new ArrayList<PluginProperty>();
- result.add(new PluginProperty(InvoicePaymentRoutingPluginApi.PROP_IPCD_INVOICE_ID, invoice.getId().toString(), false));
+ result.add(new PluginProperty(InvoicePaymentControlPluginApi.PROP_IPCD_INVOICE_ID, invoice.getId().toString(), false));
return result;
}
}
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 a56aa02..c19453b 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
@@ -1,7 +1,7 @@
/*
* Copyright 2010-2013 Ning, Inc.
- * Copyright 2014 Groupon, Inc
- * Copyright 2014 The Billing Project, LLC
+ * Copyright 2014-2015 Groupon, Inc
+ * Copyright 2014-2015 The Billing Project, LLC
*
* The Billing Project licenses this file to you under the Apache License, version 2.0
* (the "License"); you may not use this file except in compliance with the
@@ -29,7 +29,7 @@ import org.killbill.billing.catalog.api.Currency;
import org.killbill.billing.invoice.api.Invoice;
import org.killbill.billing.payment.MockRecurringInvoiceItem;
import org.killbill.billing.payment.PaymentTestSuiteNoDB;
-import org.killbill.billing.payment.invoice.InvoicePaymentRoutingPluginApi;
+import org.killbill.billing.payment.invoice.InvoicePaymentControlPluginApi;
import org.killbill.billing.payment.provider.DefaultNoOpPaymentMethodPlugin;
import org.killbill.billing.payment.provider.MockPaymentProviderPlugin;
import org.mockito.Mockito;
@@ -49,19 +49,19 @@ import static org.testng.Assert.fail;
public class TestPaymentApiNoDB extends PaymentTestSuiteNoDB {
private static final Logger log = LoggerFactory.getLogger(TestPaymentApiNoDB.class);
-
- private final Iterable<PluginProperty> PLUGIN_PROPERTIES = ImmutableList.<PluginProperty>of();
- private final static PaymentOptions PAYMENT_OPTIONS = new PaymentOptions() {
+ private static final PaymentOptions PAYMENT_OPTIONS = new PaymentOptions() {
@Override
public boolean isExternalPayment() {
return false;
}
+
@Override
public List<String> getPaymentControlPluginNames() {
- return ImmutableList.<String>of(InvoicePaymentRoutingPluginApi.PLUGIN_NAME);
+ return ImmutableList.<String>of(InvoicePaymentControlPluginApi.PLUGIN_NAME);
}
};
+ private final Iterable<PluginProperty> PLUGIN_PROPERTIES = ImmutableList.<PluginProperty>of();
private Account account;
@BeforeClass(groups = "fast")
@@ -133,11 +133,11 @@ public class TestPaymentApiNoDB extends PaymentTestSuiteNoDB {
try {
final List<PluginProperty> properties = new ArrayList<PluginProperty>();
- final PluginProperty prop1 = new PluginProperty(InvoicePaymentRoutingPluginApi.PROP_IPCD_INVOICE_ID, invoice.getId().toString(), false);
+ final PluginProperty prop1 = new PluginProperty(InvoicePaymentControlPluginApi.PROP_IPCD_INVOICE_ID, invoice.getId().toString(), false);
properties.add(prop1);
final Payment paymentInfo = paymentApi.createPurchaseWithPaymentControl(account, account.getPaymentMethodId(), null, requestedAmount, account.getCurrency(),
- invoice.getId().toString(), UUID.randomUUID().toString(), properties, PAYMENT_OPTIONS, callContext);
+ invoice.getId().toString(), UUID.randomUUID().toString(), properties, PAYMENT_OPTIONS, callContext);
if (expectedAmount == null) {
fail("Expected to fail because requested amount > invoice amount");
}
diff --git a/payment/src/test/java/org/killbill/billing/payment/core/sm/MockRetryablePaymentAutomatonRunner.java b/payment/src/test/java/org/killbill/billing/payment/core/sm/MockRetryablePaymentAutomatonRunner.java
index 62e0d44..9e6aeee 100644
--- a/payment/src/test/java/org/killbill/billing/payment/core/sm/MockRetryablePaymentAutomatonRunner.java
+++ b/payment/src/test/java/org/killbill/billing/payment/core/sm/MockRetryablePaymentAutomatonRunner.java
@@ -1,7 +1,8 @@
/*
- * Copyright 2014 Groupon, Inc
+ * Copyright 2014-2015 Groupon, Inc
+ * Copyright 2014-2015 The Billing Project, LLC
*
- * Groupon licenses this file to you under the Apache License, version 2.0
+ * The Billing Project licenses this file to you under the Apache License, version 2.0
* (the "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at:
*
@@ -53,7 +54,7 @@ import org.killbill.commons.locker.GlobalLocker;
import static org.killbill.billing.payment.glue.PaymentModule.PLUGIN_EXECUTOR_NAMED;
import static org.killbill.billing.payment.glue.PaymentModule.RETRYABLE_NAMED;
-public class MockRetryablePaymentAutomatonRunner extends PluginRoutingPaymentAutomatonRunner {
+public class MockRetryablePaymentAutomatonRunner extends PluginControlPaymentAutomatonRunner {
private OperationCallback operationCallback;
private PaymentStateControlContext context;
@@ -76,10 +77,10 @@ public class MockRetryablePaymentAutomatonRunner extends PluginRoutingPaymentAut
@Override
PaymentStateControlContext createContext(final boolean isApiPayment, final TransactionType transactionType, final Account account, @Nullable final UUID paymentMethodId,
- @Nullable final UUID paymentId, @Nullable final String paymentExternalKey, final String paymentTransactionExternalKey,
- @Nullable final BigDecimal amount, @Nullable final Currency currency,
- final Iterable<PluginProperty> properties,
- final List<String> pluginNames, final CallContext callContext, final InternalCallContext internalCallContext) throws PaymentApiException {
+ @Nullable final UUID paymentId, @Nullable final String paymentExternalKey, final String paymentTransactionExternalKey,
+ @Nullable final BigDecimal amount, @Nullable final Currency currency,
+ final Iterable<PluginProperty> properties,
+ final List<String> pluginNames, final CallContext callContext, final InternalCallContext internalCallContext) throws PaymentApiException {
if (context == null) {
return super.createContext(isApiPayment, transactionType, account, paymentMethodId, paymentId, paymentExternalKey, paymentTransactionExternalKey,
amount, currency, properties, pluginNames, callContext, internalCallContext);
diff --git a/payment/src/test/java/org/killbill/billing/payment/core/sm/TestRetryablePayment.java b/payment/src/test/java/org/killbill/billing/payment/core/sm/TestRetryablePayment.java
index fa4ef60..1707a37 100644
--- a/payment/src/test/java/org/killbill/billing/payment/core/sm/TestRetryablePayment.java
+++ b/payment/src/test/java/org/killbill/billing/payment/core/sm/TestRetryablePayment.java
@@ -40,7 +40,7 @@ import org.killbill.billing.payment.api.PluginProperty;
import org.killbill.billing.payment.api.TransactionStatus;
import org.killbill.billing.payment.api.TransactionType;
import org.killbill.billing.payment.core.PaymentProcessor;
-import org.killbill.billing.payment.core.PluginRoutingPaymentProcessor;
+import org.killbill.billing.payment.core.PluginControlPaymentProcessor;
import org.killbill.billing.payment.core.sm.control.PaymentStateControlContext;
import org.killbill.billing.payment.dao.MockPaymentDao;
import org.killbill.billing.payment.dao.PaymentAttemptModelDao;
@@ -50,7 +50,7 @@ import org.killbill.billing.payment.dao.PaymentTransactionModelDao;
import org.killbill.billing.payment.dao.PluginPropertySerializer;
import org.killbill.billing.payment.glue.PaymentModule;
import org.killbill.billing.payment.plugin.api.PaymentPluginApi;
-import org.killbill.billing.payment.provider.MockPaymentRoutingProviderPlugin;
+import org.killbill.billing.payment.provider.MockPaymentControlProviderPlugin;
import org.killbill.billing.payment.retry.BaseRetryService.RetryServiceScheduler;
import org.killbill.billing.routing.plugin.api.PaymentRoutingPluginApi;
import org.killbill.billing.tag.TagInternalApi;
@@ -120,13 +120,13 @@ public class TestRetryablePayment extends PaymentTestSuiteNoDB {
private final BigDecimal amount = BigDecimal.ONE;
private final Currency currency = Currency.EUR;
private final ImmutableList<PluginProperty> emptyProperties = ImmutableList.of();
- private final MockPaymentRoutingProviderPlugin mockRetryProviderPlugin = new MockPaymentRoutingProviderPlugin();
+ private final MockPaymentControlProviderPlugin mockRetryProviderPlugin = new MockPaymentControlProviderPlugin();
private byte[] EMPTY_PROPERTIES;
private MockRetryablePaymentAutomatonRunner runner;
private PaymentStateControlContext paymentStateContext;
private MockRetryAuthorizeOperationCallback mockRetryAuthorizeOperationCallback;
- private PluginRoutingPaymentProcessor processor;
+ private PluginControlPaymentProcessor processor;
@BeforeClass(groups = "fast")
public void beforeClass() throws Exception {
@@ -142,7 +142,7 @@ public class TestRetryablePayment extends PaymentTestSuiteNoDB {
@Override
public String getRegistrationName() {
- return MockPaymentRoutingProviderPlugin.PLUGIN_NAME;
+ return MockPaymentControlProviderPlugin.PLUGIN_NAME;
}
}, mockRetryProviderPlugin);
EMPTY_PROPERTIES = PluginPropertySerializer.serialize(ImmutableList.<PluginProperty>of());
@@ -172,7 +172,7 @@ public class TestRetryablePayment extends PaymentTestSuiteNoDB {
eventBus);
paymentStateContext =
- new PaymentStateControlContext(ImmutableList.<String>of(MockPaymentRoutingProviderPlugin.PLUGIN_NAME),
+ new PaymentStateControlContext(ImmutableList.<String>of(MockPaymentControlProviderPlugin.PLUGIN_NAME),
true,
null,
paymentExternalKey,
@@ -195,7 +195,7 @@ public class TestRetryablePayment extends PaymentTestSuiteNoDB {
paymentDao,
clock);
- processor = new PluginRoutingPaymentProcessor(pluginRegistry,
+ processor = new PluginControlPaymentProcessor(pluginRegistry,
accountInternalApi,
null,
tagApi,
@@ -637,7 +637,7 @@ public class TestRetryablePayment extends PaymentTestSuiteNoDB {
new PaymentTransactionModelDao(transactionId, attempt.getId(), paymentTransactionExternalKey, utcNow, utcNow, paymentId, TransactionType.AUTHORIZE, utcNow, TransactionStatus.PAYMENT_FAILURE, amount, currency, "bla", "foo"),
internalCallContext);
- processor.retryPaymentTransaction(attempt.getId(), ImmutableList.<String>of(MockPaymentRoutingProviderPlugin.PLUGIN_NAME), internalCallContext);
+ processor.retryPaymentTransaction(attempt.getId(), ImmutableList.<String>of(MockPaymentControlProviderPlugin.PLUGIN_NAME), internalCallContext);
final List<PaymentAttemptModelDao> pas = paymentDao.getPaymentAttemptByTransactionExternalKey(paymentTransactionExternalKey, internalCallContext);
assertEquals(pas.size(), 2);
@@ -681,7 +681,7 @@ public class TestRetryablePayment extends PaymentTestSuiteNoDB {
internalCallContext
);
- processor.retryPaymentTransaction(attempt.getId(), ImmutableList.<String>of(MockPaymentRoutingProviderPlugin.PLUGIN_NAME), internalCallContext);
+ processor.retryPaymentTransaction(attempt.getId(), ImmutableList.<String>of(MockPaymentControlProviderPlugin.PLUGIN_NAME), internalCallContext);
final List<PaymentAttemptModelDao> pas = paymentDao.getPaymentAttemptByTransactionExternalKey(paymentTransactionExternalKey, internalCallContext);
assertEquals(pas.size(), 2);
@@ -729,7 +729,7 @@ public class TestRetryablePayment extends PaymentTestSuiteNoDB {
internalCallContext
);
- processor.retryPaymentTransaction(attempt.getId(), ImmutableList.<String>of(MockPaymentRoutingProviderPlugin.PLUGIN_NAME), internalCallContext);
+ processor.retryPaymentTransaction(attempt.getId(), ImmutableList.<String>of(MockPaymentControlProviderPlugin.PLUGIN_NAME), internalCallContext);
final List<PaymentAttemptModelDao> pas = paymentDao.getPaymentAttemptByTransactionExternalKey(paymentTransactionExternalKey, internalCallContext);
assertEquals(pas.size(), 2);
@@ -746,7 +746,5 @@ public class TestRetryablePayment extends PaymentTestSuiteNoDB {
lock.release();
}
}
-
}
-
}
diff --git a/payment/src/test/java/org/killbill/billing/payment/glue/TestPaymentModuleNoDB.java b/payment/src/test/java/org/killbill/billing/payment/glue/TestPaymentModuleNoDB.java
index 503e8c2..cf7d254 100644
--- a/payment/src/test/java/org/killbill/billing/payment/glue/TestPaymentModuleNoDB.java
+++ b/payment/src/test/java/org/killbill/billing/payment/glue/TestPaymentModuleNoDB.java
@@ -22,7 +22,7 @@ import org.killbill.billing.GuicyKillbillTestNoDBModule;
import org.killbill.billing.mock.glue.MockAccountModule;
import org.killbill.billing.mock.glue.MockNonEntityDaoModule;
import org.killbill.billing.payment.core.sm.MockRetryablePaymentAutomatonRunner;
-import org.killbill.billing.payment.core.sm.PluginRoutingPaymentAutomatonRunner;
+import org.killbill.billing.payment.core.sm.PluginControlPaymentAutomatonRunner;
import org.killbill.billing.payment.dao.MockPaymentDao;
import org.killbill.billing.payment.dao.PaymentDao;
import org.killbill.billing.platform.api.KillbillConfigSource;
@@ -48,6 +48,6 @@ public class TestPaymentModuleNoDB extends TestPaymentModule {
}
protected void installAutomatonRunner() {
- bind(PluginRoutingPaymentAutomatonRunner.class).to(MockRetryablePaymentAutomatonRunner.class).asEagerSingleton();
+ bind(PluginControlPaymentAutomatonRunner.class).to(MockRetryablePaymentAutomatonRunner.class).asEagerSingleton();
}
}
diff --git a/payment/src/test/java/org/killbill/billing/payment/PaymentTestSuiteNoDB.java b/payment/src/test/java/org/killbill/billing/payment/PaymentTestSuiteNoDB.java
index 5cf500a..778f279 100644
--- a/payment/src/test/java/org/killbill/billing/payment/PaymentTestSuiteNoDB.java
+++ b/payment/src/test/java/org/killbill/billing/payment/PaymentTestSuiteNoDB.java
@@ -1,7 +1,7 @@
/*
* Copyright 2010-2013 Ning, Inc.
- * Copyright 2014 Groupon, Inc
- * Copyright 2014 The Billing Project, LLC
+ * Copyright 2014-2015 Groupon, Inc
+ * Copyright 2014-2015 The Billing Project, LLC
*
* The Billing Project licenses this file to you under the Apache License, version 2.0
* (the "License"); you may not use this file except in compliance with the
@@ -23,11 +23,11 @@ import org.killbill.billing.account.api.AccountInternalApi;
import org.killbill.billing.invoice.api.InvoiceInternalApi;
import org.killbill.billing.osgi.api.OSGIServiceRegistration;
import org.killbill.billing.payment.api.PaymentApi;
-import org.killbill.billing.payment.core.PaymentProcessor;
import org.killbill.billing.payment.core.PaymentMethodProcessor;
-import org.killbill.billing.payment.core.PluginRoutingPaymentProcessor;
+import org.killbill.billing.payment.core.PaymentProcessor;
+import org.killbill.billing.payment.core.PluginControlPaymentProcessor;
import org.killbill.billing.payment.core.sm.PaymentStateMachineHelper;
-import org.killbill.billing.payment.core.sm.PluginRoutingPaymentAutomatonRunner;
+import org.killbill.billing.payment.core.sm.PluginControlPaymentAutomatonRunner;
import org.killbill.billing.payment.dao.PaymentDao;
import org.killbill.billing.payment.glue.TestPaymentModuleNoDB;
import org.killbill.billing.payment.plugin.api.PaymentPluginApi;
@@ -72,9 +72,9 @@ public abstract class PaymentTestSuiteNoDB extends GuicyKillbillTestSuiteNoDB {
@Inject
protected PaymentProcessor paymentProcessor;
@Inject
- protected PluginRoutingPaymentProcessor pluginRoutingPaymentProcessor;
+ protected PluginControlPaymentProcessor pluginControlPaymentProcessor;
@Inject
- protected PluginRoutingPaymentAutomatonRunner retryablePaymentAutomatonRunner;
+ protected PluginControlPaymentAutomatonRunner retryablePaymentAutomatonRunner;
@Inject
protected DefaultRetryService retryService;
@Inject
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 cca3b59..7ed69f5 100644
--- a/payment/src/test/java/org/killbill/billing/payment/TestJanitor.java
+++ b/payment/src/test/java/org/killbill/billing/payment/TestJanitor.java
@@ -1,6 +1,6 @@
/*
- * Copyright 2014 Groupon, Inc
- * Copyright 2014 The Billing Project, LLC
+ * Copyright 2014-2015 Groupon, Inc
+ * Copyright 2014-2015 The Billing Project, LLC
*
* The Billing Project licenses this file to you under the Apache License, version 2.0
* (the "License"); you may not use this file except in compliance with the
@@ -24,7 +24,6 @@ import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.concurrent.Callable;
-import java.util.concurrent.TimeoutException;
import org.joda.time.LocalDate;
import org.killbill.billing.account.api.Account;
@@ -35,7 +34,6 @@ import org.killbill.billing.catalog.api.Currency;
import org.killbill.billing.invoice.api.Invoice;
import org.killbill.billing.invoice.api.InvoiceApiException;
import org.killbill.billing.invoice.api.InvoiceItem;
-import org.killbill.billing.payment.api.DefaultPayment;
import org.killbill.billing.payment.api.Payment;
import org.killbill.billing.payment.api.PaymentApiException;
import org.killbill.billing.payment.api.PaymentOptions;
@@ -48,12 +46,11 @@ import org.killbill.billing.payment.core.janitor.Janitor;
import org.killbill.billing.payment.dao.PaymentAttemptModelDao;
import org.killbill.billing.payment.dao.PaymentTransactionModelDao;
import org.killbill.billing.payment.glue.DefaultPaymentService;
-import org.killbill.billing.payment.invoice.InvoicePaymentRoutingPluginApi;
+import org.killbill.billing.payment.invoice.InvoicePaymentControlPluginApi;
import org.killbill.billing.payment.provider.MockPaymentProviderPlugin;
import org.killbill.billing.platform.api.KillbillConfigSource;
import org.killbill.billing.util.callcontext.InternalCallContextFactory;
import org.killbill.bus.api.PersistentBus.EventBusException;
-import org.killbill.commons.profiling.Profiling;
import org.killbill.notificationq.api.NotificationEvent;
import org.killbill.notificationq.api.NotificationEventWithMetadata;
import org.killbill.notificationq.api.NotificationQueueService;
@@ -67,10 +64,8 @@ import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
-import com.google.common.base.Predicate;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.Iterables;
import com.google.inject.Inject;
import static com.jayway.awaitility.Awaitility.await;
@@ -88,21 +83,20 @@ public class TestJanitor extends PaymentTestSuiteWithEmbeddedDB {
@Override
public List<String> getPaymentControlPluginNames() {
- return ImmutableList.of(InvoicePaymentRoutingPluginApi.PLUGIN_NAME);
+ return ImmutableList.of(InvoicePaymentControlPluginApi.PLUGIN_NAME);
}
};
@Inject
- private Janitor janitor;
- @Inject
- private PaymentBusEventHandler handler;
- @Inject
protected TestApiListener testListener;
@Inject
protected InternalCallContextFactory internalCallContextFactory;
@Inject
protected NotificationQueueService notificationQueueService;
-
+ @Inject
+ private Janitor janitor;
+ @Inject
+ private PaymentBusEventHandler handler;
private MockPaymentProviderPlugin mockPaymentProviderPlugin;
private Account account;
@@ -228,7 +222,7 @@ public class TestJanitor extends PaymentTestSuiteWithEmbeddedDB {
final List<PluginProperty> refundProperties = new ArrayList<PluginProperty>();
final HashMap<UUID, BigDecimal> uuidBigDecimalHashMap = new HashMap<UUID, BigDecimal>();
uuidBigDecimalHashMap.put(invoiceItem.getId(), new BigDecimal("1.0"));
- final PluginProperty refundIdsProp = new PluginProperty(InvoicePaymentRoutingPluginApi.PROP_IPCD_REFUND_IDS_WITH_AMOUNT_KEY, uuidBigDecimalHashMap, false);
+ final PluginProperty refundIdsProp = new PluginProperty(InvoicePaymentControlPluginApi.PROP_IPCD_REFUND_IDS_WITH_AMOUNT_KEY, uuidBigDecimalHashMap, false);
refundProperties.add(refundIdsProp);
final Payment payment2 = paymentApi.createRefundWithPaymentControl(account, payment.getId(), null, Currency.USD, transactionExternalKey2,
@@ -364,8 +358,6 @@ public class TestJanitor extends PaymentTestSuiteWithEmbeddedDB {
final List<PaymentTransactionModelDao> paymentTransactionHistoryBeforeJanitor = getPaymentTransactionHistory(transactionExternalKey);
Assert.assertEquals(paymentTransactionHistoryBeforeJanitor.size(), 3);
-
-
// Nothing new happened
final List<PaymentTransactionModelDao> paymentTransactionHistoryAfterJanitor = getPaymentTransactionHistory(transactionExternalKey);
Assert.assertEquals(paymentTransactionHistoryAfterJanitor.size(), 3);
@@ -401,10 +393,9 @@ public class TestJanitor extends PaymentTestSuiteWithEmbeddedDB {
Assert.assertEquals(updatedPayment.getTransactions().get(0).getTransactionStatus(), TransactionStatus.SUCCESS);
}
-
private List<PluginProperty> createPropertiesForInvoice(final Invoice invoice) {
final List<PluginProperty> result = new ArrayList<PluginProperty>();
- result.add(new PluginProperty(InvoicePaymentRoutingPluginApi.PROP_IPCD_INVOICE_ID, invoice.getId().toString(), false));
+ result.add(new PluginProperty(InvoicePaymentControlPluginApi.PROP_IPCD_INVOICE_ID, invoice.getId().toString(), false));
return result;
}
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 9c97fa7..2c46cfc 100644
--- a/payment/src/test/java/org/killbill/billing/payment/TestRetryService.java
+++ b/payment/src/test/java/org/killbill/billing/payment/TestRetryService.java
@@ -1,7 +1,9 @@
/*
* Copyright 2010-2013 Ning, Inc.
+ * Copyright 2014-2015 Groupon, Inc
+ * Copyright 2014-2015 The Billing Project, LLC
*
- * Ning licenses this file to you under the Apache License, version 2.0
+ * The Billing Project licenses this file to you under the Apache License, version 2.0
* (the "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at:
*
@@ -35,7 +37,7 @@ import org.killbill.billing.payment.api.PluginProperty;
import org.killbill.billing.payment.dao.MockPaymentDao;
import org.killbill.billing.payment.dao.PaymentAttemptModelDao;
import org.killbill.billing.payment.dao.PaymentTransactionModelDao;
-import org.killbill.billing.payment.invoice.InvoicePaymentRoutingPluginApi;
+import org.killbill.billing.payment.invoice.InvoicePaymentControlPluginApi;
import org.killbill.billing.payment.provider.MockPaymentProviderPlugin;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
@@ -133,8 +135,8 @@ public class TestRetryService extends PaymentTestSuiteNoDB {
final String paymentExternalKey = UUID.randomUUID().toString();
final String transactionExternalKey = UUID.randomUUID().toString();
try {
- pluginRoutingPaymentProcessor.createPurchase(false, account, account.getPaymentMethodId(), null, amount, Currency.USD, paymentExternalKey, transactionExternalKey,
- createPropertiesForInvoice(invoice), ImmutableList.<String>of(InvoicePaymentRoutingPluginApi.PLUGIN_NAME), callContext, internalCallContext);
+ pluginControlPaymentProcessor.createPurchase(false, account, account.getPaymentMethodId(), null, amount, Currency.USD, paymentExternalKey, transactionExternalKey,
+ createPropertiesForInvoice(invoice), ImmutableList.<String>of(InvoicePaymentControlPluginApi.PLUGIN_NAME), callContext, internalCallContext);
} catch (final PaymentApiException e) {
failed = true;
}
@@ -203,11 +205,6 @@ public class TestRetryService extends PaymentTestSuiteNoDB {
}
}
- private enum FailureType {
- PLUGIN_EXCEPTION,
- PAYMENT_FAILURE
- }
-
private void setPaymentFailure(final FailureType failureType) {
if (failureType == FailureType.PAYMENT_FAILURE) {
mockPaymentProviderPlugin.makeNextPaymentFailWithError();
@@ -236,8 +233,12 @@ public class TestRetryService extends PaymentTestSuiteNoDB {
private List<PluginProperty> createPropertiesForInvoice(final Invoice invoice) {
final List<PluginProperty> result = new ArrayList<PluginProperty>();
- result.add(new PluginProperty(InvoicePaymentRoutingPluginApi.PROP_IPCD_INVOICE_ID, invoice.getId().toString(), false));
+ result.add(new PluginProperty(InvoicePaymentControlPluginApi.PROP_IPCD_INVOICE_ID, invoice.getId().toString(), false));
return result;
}
+ private enum FailureType {
+ PLUGIN_EXCEPTION,
+ PAYMENT_FAILURE
+ }
}
pom.xml 2(+1 -1)
diff --git a/pom.xml b/pom.xml
index b217bcf..7d8a298 100644
--- a/pom.xml
+++ b/pom.xml
@@ -24,7 +24,7 @@
<version>0.28-SNAPSHOT</version>
</parent>
<artifactId>killbill</artifactId>
- <version>0.15.1-SNAPSHOT</version>
+ <version>0.15.2-SNAPSHOT</version>
<packaging>pom</packaging>
<name>killbill</name>
<description>Library for managing recurring subscriptions and the associated billing</description>
profiles/killbill/pom.xml 2(+1 -1)
diff --git a/profiles/killbill/pom.xml b/profiles/killbill/pom.xml
index 2dc774c..a3889a2 100644
--- a/profiles/killbill/pom.xml
+++ b/profiles/killbill/pom.xml
@@ -21,7 +21,7 @@
<parent>
<artifactId>killbill-profiles</artifactId>
<groupId>org.kill-bill.billing</groupId>
- <version>0.15.1-SNAPSHOT</version>
+ <version>0.15.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>killbill-profiles-killbill</artifactId>
profiles/killpay/pom.xml 2(+1 -1)
diff --git a/profiles/killpay/pom.xml b/profiles/killpay/pom.xml
index eb72d48..ad52eb1 100644
--- a/profiles/killpay/pom.xml
+++ b/profiles/killpay/pom.xml
@@ -20,7 +20,7 @@
<parent>
<artifactId>killbill-profiles</artifactId>
<groupId>org.kill-bill.billing</groupId>
- <version>0.15.1-SNAPSHOT</version>
+ <version>0.15.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>killbill-profiles-killpay</artifactId>
profiles/pom.xml 2(+1 -1)
diff --git a/profiles/pom.xml b/profiles/pom.xml
index 7d26dc8..65b88bb 100644
--- a/profiles/pom.xml
+++ b/profiles/pom.xml
@@ -19,7 +19,7 @@
<parent>
<artifactId>killbill</artifactId>
<groupId>org.kill-bill.billing</groupId>
- <version>0.15.1-SNAPSHOT</version>
+ <version>0.15.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>killbill-profiles</artifactId>
subscription/pom.xml 2(+1 -1)
diff --git a/subscription/pom.xml b/subscription/pom.xml
index 8d2682a..ddcae7a 100644
--- a/subscription/pom.xml
+++ b/subscription/pom.xml
@@ -19,7 +19,7 @@
<parent>
<artifactId>killbill</artifactId>
<groupId>org.kill-bill.billing</groupId>
- <version>0.15.1-SNAPSHOT</version>
+ <version>0.15.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>killbill-subscription</artifactId>
tenant/pom.xml 2(+1 -1)
diff --git a/tenant/pom.xml b/tenant/pom.xml
index e874891..f4bb849 100644
--- a/tenant/pom.xml
+++ b/tenant/pom.xml
@@ -19,7 +19,7 @@
<parent>
<artifactId>killbill</artifactId>
<groupId>org.kill-bill.billing</groupId>
- <version>0.15.1-SNAPSHOT</version>
+ <version>0.15.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>killbill-tenant</artifactId>
usage/pom.xml 2(+1 -1)
diff --git a/usage/pom.xml b/usage/pom.xml
index b8aa03b..7c1229d 100644
--- a/usage/pom.xml
+++ b/usage/pom.xml
@@ -19,7 +19,7 @@
<parent>
<artifactId>killbill</artifactId>
<groupId>org.kill-bill.billing</groupId>
- <version>0.15.1-SNAPSHOT</version>
+ <version>0.15.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>killbill-usage</artifactId>
util/pom.xml 2(+1 -1)
diff --git a/util/pom.xml b/util/pom.xml
index 94cb7c4..d6ff646 100644
--- a/util/pom.xml
+++ b/util/pom.xml
@@ -21,7 +21,7 @@
<parent>
<artifactId>killbill</artifactId>
<groupId>org.kill-bill.billing</groupId>
- <version>0.15.1-SNAPSHOT</version>
+ <version>0.15.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>killbill-util</artifactId>