Details
diff --git a/analytics/src/main/java/com/ning/billing/analytics/AnalyticsListener.java b/analytics/src/main/java/com/ning/billing/analytics/AnalyticsListener.java
index 2d52ca8..fb9f4d7 100644
--- a/analytics/src/main/java/com/ning/billing/analytics/AnalyticsListener.java
+++ b/analytics/src/main/java/com/ning/billing/analytics/AnalyticsListener.java
@@ -23,8 +23,8 @@ import com.ning.billing.account.api.AccountChangeEvent;
import com.ning.billing.account.api.AccountCreationEvent;
import com.ning.billing.entitlement.api.user.SubscriptionEventTransition;
import com.ning.billing.invoice.api.InvoiceCreationEvent;
-import com.ning.billing.payment.api.PaymentError;
-import com.ning.billing.payment.api.PaymentInfo;
+import com.ning.billing.payment.api.PaymentErrorEvent;
+import com.ning.billing.payment.api.PaymentInfoEvent;
public class AnalyticsListener {
private final BusinessSubscriptionTransitionRecorder bstRecorder;
@@ -85,12 +85,12 @@ public class AnalyticsListener {
}
@Subscribe
- public void handlePaymentInfo(final PaymentInfo paymentInfo) {
+ public void handlePaymentInfo(final PaymentInfoEvent paymentInfo) {
bacRecorder.accountUpdated(paymentInfo);
}
@Subscribe
- public void handlePaymentError(final PaymentError paymentError) {
+ public void handlePaymentError(final PaymentErrorEvent paymentError) {
// TODO - we can't tie the error back to an account yet
}
}
diff --git a/analytics/src/main/java/com/ning/billing/analytics/BusinessAccountRecorder.java b/analytics/src/main/java/com/ning/billing/analytics/BusinessAccountRecorder.java
index 6832a2b..92c3bb0 100644
--- a/analytics/src/main/java/com/ning/billing/analytics/BusinessAccountRecorder.java
+++ b/analytics/src/main/java/com/ning/billing/analytics/BusinessAccountRecorder.java
@@ -26,7 +26,7 @@ import com.ning.billing.invoice.api.Invoice;
import com.ning.billing.invoice.api.InvoiceUserApi;
import com.ning.billing.payment.api.PaymentApi;
import com.ning.billing.payment.api.PaymentAttempt;
-import com.ning.billing.payment.api.PaymentInfo;
+import com.ning.billing.payment.api.PaymentInfoEvent;
import com.ning.billing.util.tag.Tag;
import org.joda.time.DateTime;
import org.slf4j.Logger;
@@ -77,7 +77,7 @@ public class BusinessAccountRecorder {
*
* @param paymentInfo payment object (from the payment plugin)
*/
- public void accountUpdated(final PaymentInfo paymentInfo) {
+ public void accountUpdated(final PaymentInfoEvent paymentInfo) {
final PaymentAttempt paymentAttempt = paymentApi.getPaymentAttemptForPaymentId(paymentInfo.getPaymentId());
if (paymentAttempt == null) {
return;
@@ -162,9 +162,9 @@ public class BusinessAccountRecorder {
// Retrieve payments information for these invoices
DateTime lastPaymentDate = null;
- final List<PaymentInfo> payments = paymentApi.getPaymentInfo(invoiceIds);
+ final List<PaymentInfoEvent> payments = paymentApi.getPaymentInfo(invoiceIds);
if (payments != null) {
- for (final PaymentInfo payment : payments) {
+ for (final PaymentInfoEvent payment : payments) {
// Use the last payment method/type/country as the default one for the account
if (lastPaymentDate == null || payment.getCreatedDate().isAfter(lastPaymentDate)) {
lastPaymentDate = payment.getCreatedDate();
diff --git a/analytics/src/test/java/com/ning/billing/analytics/api/TestAnalyticsService.java b/analytics/src/test/java/com/ning/billing/analytics/api/TestAnalyticsService.java
index a086b35..ac25c74 100644
--- a/analytics/src/test/java/com/ning/billing/analytics/api/TestAnalyticsService.java
+++ b/analytics/src/test/java/com/ning/billing/analytics/api/TestAnalyticsService.java
@@ -78,7 +78,7 @@ import com.ning.billing.invoice.model.DefaultInvoice;
import com.ning.billing.invoice.model.FixedPriceInvoiceItem;
import com.ning.billing.payment.api.DefaultPaymentInfo;
import com.ning.billing.payment.api.PaymentAttempt;
-import com.ning.billing.payment.api.PaymentInfo;
+import com.ning.billing.payment.api.PaymentInfoEvent;
import com.ning.billing.payment.dao.PaymentDao;
import com.ning.billing.util.bus.Bus;
import com.ning.billing.util.clock.Clock;
@@ -138,7 +138,7 @@ public class TestAnalyticsService {
private AccountCreationEvent accountCreationNotification;
private InvoiceCreationEvent invoiceCreationNotification;
- private PaymentInfo paymentInfoNotification;
+ private PaymentInfoEvent paymentInfoNotification;
@BeforeMethod(groups = "slow")
public void cleanup() throws Exception
diff --git a/api/src/main/java/com/ning/billing/payment/api/PaymentApi.java b/api/src/main/java/com/ning/billing/payment/api/PaymentApi.java
index 9076256..1679f50 100644
--- a/api/src/main/java/com/ning/billing/payment/api/PaymentApi.java
+++ b/api/src/main/java/com/ning/billing/payment/api/PaymentApi.java
@@ -26,36 +26,36 @@ import com.ning.billing.util.callcontext.CallContext;
public interface PaymentApi {
- Either<PaymentError, Void> updatePaymentGateway(String accountKey, CallContext context);
+ Either<PaymentErrorEvent, Void> updatePaymentGateway(String accountKey, CallContext context);
- Either<PaymentError, PaymentMethodInfo> getPaymentMethod(@Nullable String accountKey, String paymentMethodId);
+ Either<PaymentErrorEvent, PaymentMethodInfo> getPaymentMethod(@Nullable String accountKey, String paymentMethodId);
- Either<PaymentError, List<PaymentMethodInfo>> getPaymentMethods(String accountKey);
+ Either<PaymentErrorEvent, List<PaymentMethodInfo>> getPaymentMethods(String accountKey);
- Either<PaymentError, String> addPaymentMethod(@Nullable String accountKey, PaymentMethodInfo paymentMethod, CallContext context);
+ Either<PaymentErrorEvent, String> addPaymentMethod(@Nullable String accountKey, PaymentMethodInfo paymentMethod, CallContext context);
- Either<PaymentError, PaymentMethodInfo> updatePaymentMethod(String accountKey, PaymentMethodInfo paymentMethodInfo, CallContext context);
+ Either<PaymentErrorEvent, PaymentMethodInfo> updatePaymentMethod(String accountKey, PaymentMethodInfo paymentMethodInfo, CallContext context);
- Either<PaymentError, Void> deletePaymentMethod(String accountKey, String paymentMethodId, CallContext context);
+ Either<PaymentErrorEvent, Void> deletePaymentMethod(String accountKey, String paymentMethodId, CallContext context);
- List<Either<PaymentError, PaymentInfo>> createPayment(String accountKey, List<String> invoiceIds, CallContext context);
- List<Either<PaymentError, PaymentInfo>> createPayment(Account account, List<String> invoiceIds, CallContext context);
- Either<PaymentError, PaymentInfo> createPaymentForPaymentAttempt(UUID paymentAttemptId, CallContext context);
+ List<Either<PaymentErrorEvent, PaymentInfoEvent>> createPayment(String accountKey, List<String> invoiceIds, CallContext context);
+ List<Either<PaymentErrorEvent, PaymentInfoEvent>> createPayment(Account account, List<String> invoiceIds, CallContext context);
+ Either<PaymentErrorEvent, PaymentInfoEvent> createPaymentForPaymentAttempt(UUID paymentAttemptId, CallContext context);
- List<Either<PaymentError, PaymentInfo>> createRefund(Account account, List<String> invoiceIds, CallContext context); //TODO
+ List<Either<PaymentErrorEvent, PaymentInfoEvent>> createRefund(Account account, List<String> invoiceIds, CallContext context); //TODO
- Either<PaymentError, PaymentProviderAccount> getPaymentProviderAccount(String accountKey);
+ Either<PaymentErrorEvent, PaymentProviderAccount> getPaymentProviderAccount(String accountKey);
- Either<PaymentError, String> createPaymentProviderAccount(Account account, CallContext context);
+ Either<PaymentErrorEvent, String> createPaymentProviderAccount(Account account, CallContext context);
- Either<PaymentError, Void> updatePaymentProviderAccountContact(String accountKey, CallContext context);
+ Either<PaymentErrorEvent, Void> updatePaymentProviderAccountContact(String accountKey, CallContext context);
PaymentAttempt getPaymentAttemptForPaymentId(String id);
- List<PaymentInfo> getPaymentInfo(List<String> invoiceIds);
+ List<PaymentInfoEvent> getPaymentInfo(List<String> invoiceIds);
List<PaymentAttempt> getPaymentAttemptsForInvoiceId(String invoiceId);
- PaymentInfo getPaymentInfoForPaymentAttemptId(String paymentAttemptId);
+ PaymentInfoEvent getPaymentInfoForPaymentAttemptId(String paymentAttemptId);
}
diff --git a/api/src/main/java/com/ning/billing/util/userrequest/CompletionUserRequestWaiter.java b/api/src/main/java/com/ning/billing/util/userrequest/CompletionUserRequestWaiter.java
index b66d677..b1c35f6 100644
--- a/api/src/main/java/com/ning/billing/util/userrequest/CompletionUserRequestWaiter.java
+++ b/api/src/main/java/com/ning/billing/util/userrequest/CompletionUserRequestWaiter.java
@@ -24,8 +24,8 @@ import com.ning.billing.account.api.AccountCreationEvent;
import com.ning.billing.entitlement.api.user.SubscriptionEventTransition;
import com.ning.billing.invoice.api.EmptyInvoiceEvent;
import com.ning.billing.invoice.api.InvoiceCreationEvent;
-import com.ning.billing.payment.api.PaymentError;
-import com.ning.billing.payment.api.PaymentInfo;
+import com.ning.billing.payment.api.PaymentErrorEvent;
+import com.ning.billing.payment.api.PaymentInfoEvent;
import com.ning.billing.util.bus.BusEvent;
public interface CompletionUserRequestWaiter {
@@ -42,7 +42,7 @@ public interface CompletionUserRequestWaiter {
public void onEmptyInvoice(final EmptyInvoiceEvent curEvent);
- public void onPaymentInfo(final PaymentInfo curEvent);
+ public void onPaymentInfo(final PaymentInfoEvent curEvent);
- public void onPaymentError(final PaymentError curEvent);
+ public void onPaymentError(final PaymentErrorEvent curEvent);
}
diff --git a/beatrix/src/test/java/com/ning/billing/beatrix/integration/TestBusHandler.java b/beatrix/src/test/java/com/ning/billing/beatrix/integration/TestBusHandler.java
index 9eb5fb8..ffa25e6 100644
--- a/beatrix/src/test/java/com/ning/billing/beatrix/integration/TestBusHandler.java
+++ b/beatrix/src/test/java/com/ning/billing/beatrix/integration/TestBusHandler.java
@@ -29,8 +29,8 @@ import com.google.common.base.Joiner;
import com.google.common.eventbus.Subscribe;
import com.ning.billing.entitlement.api.user.SubscriptionEventTransition;
import com.ning.billing.invoice.api.InvoiceCreationEvent;
-import com.ning.billing.payment.api.PaymentError;
-import com.ning.billing.payment.api.PaymentInfo;
+import com.ning.billing.payment.api.PaymentErrorEvent;
+import com.ning.billing.payment.api.PaymentInfoEvent;
public class TestBusHandler {
@@ -104,14 +104,14 @@ public class TestBusHandler {
}
@Subscribe
- public void handlePaymentEvents(PaymentInfo event) {
+ public void handlePaymentEvents(PaymentInfoEvent event) {
log.info(String.format("TestBusHandler Got PaymentInfo event %s", event.toString()));
assertEqualsNicely(NextEvent.PAYMENT);
notifyIfStackEmpty();
}
@Subscribe
- public void handlePaymentErrorEvents(PaymentError event) {
+ public void handlePaymentErrorEvents(PaymentErrorEvent event) {
log.info(String.format("TestBusHandler Got PaymentError event %s", event.toString()));
//Assert.fail("Unexpected payment failure");
}
diff --git a/jaxrs/src/main/java/com/ning/billing/jaxrs/resources/SubscriptionResource.java b/jaxrs/src/main/java/com/ning/billing/jaxrs/resources/SubscriptionResource.java
index 3099f9d..8c5c5bd 100644
--- a/jaxrs/src/main/java/com/ning/billing/jaxrs/resources/SubscriptionResource.java
+++ b/jaxrs/src/main/java/com/ning/billing/jaxrs/resources/SubscriptionResource.java
@@ -56,8 +56,8 @@ import com.ning.billing.jaxrs.json.SubscriptionJson;
import com.ning.billing.jaxrs.util.Context;
import com.ning.billing.jaxrs.util.JaxrsUriBuilder;
import com.ning.billing.jaxrs.util.KillbillEventHandler;
-import com.ning.billing.payment.api.PaymentError;
-import com.ning.billing.payment.api.PaymentInfo;
+import com.ning.billing.payment.api.PaymentErrorEvent;
+import com.ning.billing.payment.api.PaymentInfoEvent;
import com.ning.billing.util.callcontext.CallContext;
import com.ning.billing.util.clock.Clock;
import com.ning.billing.util.userrequest.CompletionUserRequestBase;
@@ -254,12 +254,12 @@ public class SubscriptionResource implements BaseJaxrsResource{
}
}
@Override
- public void onPaymentInfo(PaymentInfo curEvent) {
+ public void onPaymentInfo(PaymentInfoEvent curEvent) {
log.info(String.format("Got event PaymentInfo token = %s ", curEvent.getUserToken()));
notifyForCompletion();
}
@Override
- public void onPaymentError(PaymentError curEvent) {
+ public void onPaymentError(PaymentErrorEvent curEvent) {
log.info(String.format("Got event PaymentError token = %s ", curEvent.getUserToken()));
notifyForCompletion();
}
diff --git a/payment/src/main/java/com/ning/billing/payment/api/DefaultPaymentApi.java b/payment/src/main/java/com/ning/billing/payment/api/DefaultPaymentApi.java
index ab171ae..e565ccc 100644
--- a/payment/src/main/java/com/ning/billing/payment/api/DefaultPaymentApi.java
+++ b/payment/src/main/java/com/ning/billing/payment/api/DefaultPaymentApi.java
@@ -68,7 +68,7 @@ public class DefaultPaymentApi implements PaymentApi {
}
@Override
- public Either<PaymentError, PaymentMethodInfo> getPaymentMethod(@Nullable String accountKey, String paymentMethodId) {
+ public Either<PaymentErrorEvent, PaymentMethodInfo> getPaymentMethod(@Nullable String accountKey, String paymentMethodId) {
final PaymentProviderPlugin plugin = getPaymentProviderPlugin(accountKey);
return plugin.getPaymentMethodInfo(paymentMethodId);
}
@@ -97,49 +97,49 @@ public class DefaultPaymentApi implements PaymentApi {
}
@Override
- public Either<PaymentError, List<PaymentMethodInfo>> getPaymentMethods(String accountKey) {
+ public Either<PaymentErrorEvent, List<PaymentMethodInfo>> getPaymentMethods(String accountKey) {
final PaymentProviderPlugin plugin = getPaymentProviderPlugin(accountKey);
return plugin.getPaymentMethods(accountKey);
}
@Override
- public Either<PaymentError, Void> updatePaymentGateway(String accountKey, CallContext context) {
+ public Either<PaymentErrorEvent, Void> updatePaymentGateway(String accountKey, CallContext context) {
final PaymentProviderPlugin plugin = getPaymentProviderPlugin(accountKey);
return plugin.updatePaymentGateway(accountKey);
}
@Override
- public Either<PaymentError, PaymentProviderAccount> getPaymentProviderAccount(String accountKey) {
+ public Either<PaymentErrorEvent, PaymentProviderAccount> getPaymentProviderAccount(String accountKey) {
final PaymentProviderPlugin plugin = getPaymentProviderPlugin(accountKey);
return plugin.getPaymentProviderAccount(accountKey);
}
@Override
- public Either<PaymentError, String> addPaymentMethod(@Nullable String accountKey, PaymentMethodInfo paymentMethod, CallContext context) {
+ public Either<PaymentErrorEvent, String> addPaymentMethod(@Nullable String accountKey, PaymentMethodInfo paymentMethod, CallContext context) {
final PaymentProviderPlugin plugin = getPaymentProviderPlugin(accountKey);
return plugin.addPaymentMethod(accountKey, paymentMethod);
}
@Override
- public Either<PaymentError, Void> deletePaymentMethod(String accountKey, String paymentMethodId, CallContext context) {
+ public Either<PaymentErrorEvent, Void> deletePaymentMethod(String accountKey, String paymentMethodId, CallContext context) {
final PaymentProviderPlugin plugin = getPaymentProviderPlugin(accountKey);
return plugin.deletePaymentMethod(accountKey, paymentMethodId);
}
@Override
- public Either<PaymentError, PaymentMethodInfo> updatePaymentMethod(String accountKey, PaymentMethodInfo paymentMethodInfo, CallContext context) {
+ public Either<PaymentErrorEvent, PaymentMethodInfo> updatePaymentMethod(String accountKey, PaymentMethodInfo paymentMethodInfo, CallContext context) {
final PaymentProviderPlugin plugin = getPaymentProviderPlugin(accountKey);
return plugin.updatePaymentMethod(accountKey, paymentMethodInfo);
}
@Override
- public List<Either<PaymentError, PaymentInfo>> createPayment(String accountKey, List<String> invoiceIds, CallContext context) {
+ public List<Either<PaymentErrorEvent, PaymentInfoEvent>> createPayment(String accountKey, List<String> invoiceIds, CallContext context) {
final Account account = accountUserApi.getAccountByKey(accountKey);
return createPayment(account, invoiceIds, context);
}
@Override
- public Either<PaymentError, PaymentInfo> createPaymentForPaymentAttempt(UUID paymentAttemptId, CallContext context) {
+ public Either<PaymentErrorEvent, PaymentInfoEvent> createPaymentForPaymentAttempt(UUID paymentAttemptId, CallContext context) {
PaymentAttempt paymentAttempt = paymentDao.getPaymentAttemptById(paymentAttemptId);
if (paymentAttempt != null) {
@@ -150,7 +150,7 @@ public class DefaultPaymentApi implements PaymentApi {
if (invoice.getBalance().compareTo(BigDecimal.ZERO) <= 0 ) {
// TODO: send a notification that invoice was ignored?
log.info("Received invoice for payment with outstanding amount of 0 {} ", invoice);
- return Either.left((PaymentError) new DefaultPaymentError("invoice_balance_0",
+ return Either.left((PaymentErrorEvent) new DefaultPaymentError("invoice_balance_0",
"Invoice balance was 0 or less",
paymentAttempt.getAccountId(),
paymentAttempt.getInvoiceId(),
@@ -167,7 +167,7 @@ public class DefaultPaymentApi implements PaymentApi {
}
}
}
- return Either.left((PaymentError) new DefaultPaymentError("retry_payment_error",
+ return Either.left((PaymentErrorEvent) new DefaultPaymentError("retry_payment_error",
"Could not load payment attempt, invoice or account for id " + paymentAttemptId,
paymentAttempt.getAccountId(),
paymentAttempt.getInvoiceId(),
@@ -175,10 +175,10 @@ public class DefaultPaymentApi implements PaymentApi {
}
@Override
- public List<Either<PaymentError, PaymentInfo>> createPayment(Account account, List<String> invoiceIds, CallContext context) {
+ public List<Either<PaymentErrorEvent, PaymentInfoEvent>> createPayment(Account account, List<String> invoiceIds, CallContext context) {
final PaymentProviderPlugin plugin = getPaymentProviderPlugin(account);
- List<Either<PaymentError, PaymentInfo>> processedPaymentsOrErrors = new ArrayList<Either<PaymentError, PaymentInfo>>(invoiceIds.size());
+ List<Either<PaymentErrorEvent, PaymentInfoEvent>> processedPaymentsOrErrors = new ArrayList<Either<PaymentErrorEvent, PaymentInfoEvent>>(invoiceIds.size());
for (String invoiceId : invoiceIds) {
Invoice invoice = invoicePaymentApi.getInvoice(UUID.fromString(invoiceId));
@@ -186,7 +186,7 @@ public class DefaultPaymentApi implements PaymentApi {
if (invoice.getBalance().compareTo(BigDecimal.ZERO) <= 0 ) {
// TODO: send a notification that invoice was ignored?
log.info("Received invoice for payment with balance of 0 {} ", invoice);
- Either<PaymentError, PaymentInfo> result = Either.left((PaymentError) new DefaultPaymentError("invoice_balance_0",
+ Either<PaymentErrorEvent, PaymentInfoEvent> result = Either.left((PaymentErrorEvent) new DefaultPaymentError("invoice_balance_0",
"Invoice balance was 0 or less",
account.getId(),
UUID.fromString(invoiceId),
@@ -195,7 +195,7 @@ public class DefaultPaymentApi implements PaymentApi {
}
else if (invoice.isMigrationInvoice()) {
log.info("Received invoice for payment that is a migration invoice - don't know how to handle those yet: {}", invoice);
- Either<PaymentError, PaymentInfo> result = Either.left((PaymentError) new DefaultPaymentError("migration invoice",
+ Either<PaymentErrorEvent, PaymentInfoEvent> result = Either.left((PaymentErrorEvent) new DefaultPaymentError("migration invoice",
"Invoice balance was a migration invoice",
account.getId(),
UUID.fromString(invoiceId),
@@ -212,10 +212,10 @@ public class DefaultPaymentApi implements PaymentApi {
return processedPaymentsOrErrors;
}
- private Either<PaymentError, PaymentInfo> processPayment(PaymentProviderPlugin plugin, Account account, Invoice invoice,
+ private Either<PaymentErrorEvent, PaymentInfoEvent> processPayment(PaymentProviderPlugin plugin, Account account, Invoice invoice,
PaymentAttempt paymentAttempt, CallContext context) {
- Either<PaymentError, PaymentInfo> paymentOrError = plugin.processInvoice(account, invoice);
- PaymentInfo paymentInfo = null;
+ Either<PaymentErrorEvent, PaymentInfoEvent> paymentOrError = plugin.processInvoice(account, invoice);
+ PaymentInfoEvent paymentInfo = null;
if (paymentOrError.isLeft()) {
String error = StringUtils.substring(paymentOrError.getLeft().getMessage() + paymentOrError.getLeft().getBusEventType(), 0, 100);
@@ -229,7 +229,7 @@ public class DefaultPaymentApi implements PaymentApi {
final String paymentMethodId = paymentInfo.getPaymentMethodId();
log.debug("Fetching payment method info for payment method id " + ((paymentMethodId == null) ? "null" : paymentMethodId));
- Either<PaymentError, PaymentMethodInfo> paymentMethodInfoOrError = plugin.getPaymentMethodInfo(paymentMethodId);
+ Either<PaymentErrorEvent, PaymentMethodInfo> paymentMethodInfoOrError = plugin.getPaymentMethodInfo(paymentMethodId);
if (paymentMethodInfoOrError.isRight()) {
PaymentMethodInfo paymentMethodInfo = paymentMethodInfoOrError.getRight();
@@ -294,13 +294,13 @@ public class DefaultPaymentApi implements PaymentApi {
}
@Override
- public Either<PaymentError, String> createPaymentProviderAccount(Account account, CallContext context) {
+ public Either<PaymentErrorEvent, String> createPaymentProviderAccount(Account account, CallContext context) {
final PaymentProviderPlugin plugin = getPaymentProviderPlugin((Account)null);
return plugin.createPaymentProviderAccount(account);
}
@Override
- public Either<PaymentError, Void> updatePaymentProviderAccountContact(String externalKey, CallContext context) {
+ public Either<PaymentErrorEvent, Void> updatePaymentProviderAccountContact(String externalKey, CallContext context) {
Account account = accountUserApi.getAccountByKey(externalKey);
final PaymentProviderPlugin plugin = getPaymentProviderPlugin(account);
return plugin.updatePaymentProviderAccountExistingContact(account);
@@ -312,13 +312,13 @@ public class DefaultPaymentApi implements PaymentApi {
}
@Override
- public List<Either<PaymentError, PaymentInfo>> createRefund(Account account, List<String> invoiceIds, CallContext context) {
+ public List<Either<PaymentErrorEvent, PaymentInfoEvent>> createRefund(Account account, List<String> invoiceIds, CallContext context) {
//TODO
throw new UnsupportedOperationException();
}
@Override
- public List<PaymentInfo> getPaymentInfo(List<String> invoiceIds) {
+ public List<PaymentInfoEvent> getPaymentInfo(List<String> invoiceIds) {
return paymentDao.getPaymentInfo(invoiceIds);
}
@@ -328,7 +328,7 @@ public class DefaultPaymentApi implements PaymentApi {
}
@Override
- public PaymentInfo getPaymentInfoForPaymentAttemptId(String paymentAttemptId) {
+ public PaymentInfoEvent getPaymentInfoForPaymentAttemptId(String paymentAttemptId) {
return paymentDao.getPaymentInfoForPaymentAttemptId(paymentAttemptId);
}
diff --git a/payment/src/main/java/com/ning/billing/payment/dao/AuditedPaymentDao.java b/payment/src/main/java/com/ning/billing/payment/dao/AuditedPaymentDao.java
index bcdda9a..a21a90c 100644
--- a/payment/src/main/java/com/ning/billing/payment/dao/AuditedPaymentDao.java
+++ b/payment/src/main/java/com/ning/billing/payment/dao/AuditedPaymentDao.java
@@ -29,7 +29,7 @@ import com.google.common.collect.ImmutableList;
import com.google.inject.Inject;
import com.ning.billing.invoice.api.Invoice;
import com.ning.billing.payment.api.PaymentAttempt;
-import com.ning.billing.payment.api.PaymentInfo;
+import com.ning.billing.payment.api.PaymentInfoEvent;
import org.skife.jdbi.v2.Transaction;
import org.skife.jdbi.v2.TransactionStatus;
@@ -87,7 +87,7 @@ public class AuditedPaymentDao implements PaymentDao {
}
@Override
- public void savePaymentInfo(final PaymentInfo info, final CallContext context) {
+ public void savePaymentInfo(final PaymentInfoEvent info, final CallContext context) {
sqlDao.inTransaction(new Transaction<Void, PaymentSqlDao>() {
@Override
public Void inTransaction(PaymentSqlDao transactional, TransactionStatus status) throws Exception {
@@ -128,7 +128,7 @@ public class AuditedPaymentDao implements PaymentDao {
@Override
public Void inTransaction(PaymentSqlDao transactional, TransactionStatus status) throws Exception {
transactional.updatePaymentInfo(type, paymentId, cardType, cardCountry, context);
- PaymentInfo paymentInfo = transactional.getPaymentInfo(paymentId);
+ PaymentInfoEvent paymentInfo = transactional.getPaymentInfo(paymentId);
UUID historyRecordId = UUID.randomUUID();
transactional.insertPaymentInfoHistory(historyRecordId.toString(), paymentInfo, context);
AuditSqlDao auditSqlDao = transactional.become(AuditSqlDao.class);
@@ -141,9 +141,9 @@ public class AuditedPaymentDao implements PaymentDao {
}
@Override
- public List<PaymentInfo> getPaymentInfo(List<String> invoiceIds) {
+ public List<PaymentInfoEvent> getPaymentInfo(List<String> invoiceIds) {
if (invoiceIds == null || invoiceIds.size() == 0) {
- return ImmutableList.<PaymentInfo>of();
+ return ImmutableList.<PaymentInfoEvent>of();
} else {
return sqlDao.getPaymentInfos(invoiceIds);
}
@@ -164,7 +164,7 @@ public class AuditedPaymentDao implements PaymentDao {
}
@Override
- public PaymentInfo getPaymentInfoForPaymentAttemptId(String paymentAttemptIdStr) {
+ public PaymentInfoEvent getPaymentInfoForPaymentAttemptId(String paymentAttemptIdStr) {
return sqlDao.getPaymentInfoForPaymentAttemptId(paymentAttemptIdStr);
}
diff --git a/payment/src/main/java/com/ning/billing/payment/dao/PaymentDao.java b/payment/src/main/java/com/ning/billing/payment/dao/PaymentDao.java
index ce6adf6..8c07824 100644
--- a/payment/src/main/java/com/ning/billing/payment/dao/PaymentDao.java
+++ b/payment/src/main/java/com/ning/billing/payment/dao/PaymentDao.java
@@ -21,7 +21,7 @@ import java.util.UUID;
import com.ning.billing.invoice.api.Invoice;
import com.ning.billing.payment.api.PaymentAttempt;
-import com.ning.billing.payment.api.PaymentInfo;
+import com.ning.billing.payment.api.PaymentInfoEvent;
import com.ning.billing.util.callcontext.CallContext;
public interface PaymentDao {
@@ -29,7 +29,7 @@ public interface PaymentDao {
PaymentAttempt createPaymentAttempt(Invoice invoice, CallContext context);
PaymentAttempt createPaymentAttempt(PaymentAttempt paymentAttempt, CallContext context);
- void savePaymentInfo(PaymentInfo right, CallContext context);
+ void savePaymentInfo(PaymentInfoEvent right, CallContext context);
PaymentAttempt getPaymentAttemptForPaymentId(String paymentId);
List<PaymentAttempt> getPaymentAttemptsForInvoiceIds(List<String> invoiceIds);
@@ -40,8 +40,8 @@ public interface PaymentDao {
void updatePaymentInfo(String paymentMethodType, String paymentId, String cardType, String cardCountry, CallContext context);
- List<PaymentInfo> getPaymentInfo(List<String> invoiceIds);
+ List<PaymentInfoEvent> getPaymentInfo(List<String> invoiceIds);
PaymentAttempt getPaymentAttemptById(UUID paymentAttemptId);
- PaymentInfo getPaymentInfoForPaymentAttemptId(String paymentAttemptId);
+ PaymentInfoEvent getPaymentInfoForPaymentAttemptId(String paymentAttemptId);
}
diff --git a/payment/src/main/java/com/ning/billing/payment/dao/PaymentSqlDao.java b/payment/src/main/java/com/ning/billing/payment/dao/PaymentSqlDao.java
index 76b48af..2748111 100644
--- a/payment/src/main/java/com/ning/billing/payment/dao/PaymentSqlDao.java
+++ b/payment/src/main/java/com/ning/billing/payment/dao/PaymentSqlDao.java
@@ -44,7 +44,7 @@ import org.skife.jdbi.v2.unstable.BindIn;
import com.ning.billing.catalog.api.Currency;
import com.ning.billing.payment.api.DefaultPaymentInfo;
import com.ning.billing.payment.api.PaymentAttempt;
-import com.ning.billing.payment.api.PaymentInfo;
+import com.ning.billing.payment.api.PaymentInfoEvent;
@ExternalizedSqlViaStringTemplate3()
@RegisterMapper({PaymentSqlDao.PaymentAttemptMapper.class, PaymentSqlDao.PaymentInfoMapper.class})
@@ -71,7 +71,7 @@ public interface PaymentSqlDao extends Transactional<PaymentSqlDao>, CloseMe, Tr
List<PaymentAttempt> getPaymentAttemptsForInvoiceIds(@BindIn("invoiceIds") List<String> invoiceIds);
@SqlQuery
- PaymentInfo getPaymentInfoForPaymentAttemptId(@Bind("payment_attempt_id") String paymentAttemptId);
+ PaymentInfoEvent getPaymentInfoForPaymentAttemptId(@Bind("payment_attempt_id") String paymentAttemptId);
@SqlUpdate
void updatePaymentAttemptWithPaymentId(@Bind("payment_attempt_id") String paymentAttemptId,
@@ -91,19 +91,19 @@ public interface PaymentSqlDao extends Transactional<PaymentSqlDao>, CloseMe, Tr
@CallContextBinder CallContext context);
@SqlQuery
- List<PaymentInfo> getPaymentInfos(@BindIn("invoiceIds") final List<String> invoiceIds);
+ List<PaymentInfoEvent> getPaymentInfos(@BindIn("invoiceIds") final List<String> invoiceIds);
@SqlUpdate
- void insertPaymentInfo(@Bind(binder = PaymentInfoBinder.class) final PaymentInfo paymentInfo,
+ void insertPaymentInfo(@Bind(binder = PaymentInfoBinder.class) final PaymentInfoEvent paymentInfo,
@CallContextBinder final CallContext context);
@SqlUpdate
void insertPaymentInfoHistory(@Bind("historyRecordId") final String historyRecordId,
- @Bind(binder = PaymentInfoBinder.class) final PaymentInfo paymentInfo,
+ @Bind(binder = PaymentInfoBinder.class) final PaymentInfoEvent paymentInfo,
@CallContextBinder final CallContext context);
@SqlQuery
- PaymentInfo getPaymentInfo(@Bind("paymentId") final String paymentId);
+ PaymentInfoEvent getPaymentInfo(@Bind("paymentId") final String paymentId);
public static final class PaymentAttemptBinder extends BinderBase implements Binder<Bind, PaymentAttempt> {
@Override
@@ -152,9 +152,9 @@ public interface PaymentSqlDao extends Transactional<PaymentSqlDao>, CloseMe, Tr
}
}
- public static final class PaymentInfoBinder extends BinderBase implements Binder<Bind, PaymentInfo> {
+ public static final class PaymentInfoBinder extends BinderBase implements Binder<Bind, PaymentInfoEvent> {
@Override
- public void bind(@SuppressWarnings("rawtypes") SQLStatement stmt, Bind bind, PaymentInfo paymentInfo) {
+ public void bind(@SuppressWarnings("rawtypes") SQLStatement stmt, Bind bind, PaymentInfoEvent paymentInfo) {
stmt.bind("payment_id", paymentInfo.getPaymentId().toString());
stmt.bind("amount", paymentInfo.getAmount());
stmt.bind("refund_amount", paymentInfo.getRefundAmount());
@@ -173,9 +173,9 @@ public interface PaymentSqlDao extends Transactional<PaymentSqlDao>, CloseMe, Tr
}
}
- public static class PaymentInfoMapper extends MapperBase implements ResultSetMapper<PaymentInfo> {
+ public static class PaymentInfoMapper extends MapperBase implements ResultSetMapper<PaymentInfoEvent> {
@Override
- public PaymentInfo map(int index, ResultSet rs, StatementContext ctx) throws SQLException {
+ public PaymentInfoEvent map(int index, ResultSet rs, StatementContext ctx) throws SQLException {
String paymentId = rs.getString("payment_id");
BigDecimal amount = rs.getBigDecimal("amount");
diff --git a/payment/src/main/java/com/ning/billing/payment/provider/NoOpPaymentProviderPlugin.java b/payment/src/main/java/com/ning/billing/payment/provider/NoOpPaymentProviderPlugin.java
index 58ecd00..23dfe51 100644
--- a/payment/src/main/java/com/ning/billing/payment/provider/NoOpPaymentProviderPlugin.java
+++ b/payment/src/main/java/com/ning/billing/payment/provider/NoOpPaymentProviderPlugin.java
@@ -28,16 +28,16 @@ import com.ning.billing.invoice.api.Invoice;
import com.ning.billing.payment.api.DefaultPaymentError;
import com.ning.billing.payment.api.DefaultPaymentInfo;
import com.ning.billing.payment.api.Either;
-import com.ning.billing.payment.api.PaymentError;
-import com.ning.billing.payment.api.PaymentInfo;
+import com.ning.billing.payment.api.PaymentErrorEvent;
+import com.ning.billing.payment.api.PaymentInfoEvent;
import com.ning.billing.payment.api.PaymentMethodInfo;
import com.ning.billing.payment.api.PaymentProviderAccount;
public class NoOpPaymentProviderPlugin implements PaymentProviderPlugin {
@Override
- public Either<PaymentError, PaymentInfo> processInvoice(Account account, Invoice invoice) {
- PaymentInfo payment = new DefaultPaymentInfo.Builder()
+ public Either<PaymentErrorEvent, PaymentInfoEvent> processInvoice(Account account, Invoice invoice) {
+ PaymentInfoEvent payment = new DefaultPaymentInfo.Builder()
.setPaymentId(UUID.randomUUID().toString())
.setAmount(invoice.getBalance())
.setStatus("Processed")
@@ -49,25 +49,25 @@ public class NoOpPaymentProviderPlugin implements PaymentProviderPlugin {
}
@Override
- public Either<PaymentError, PaymentInfo> getPaymentInfo(String paymentId) {
+ public Either<PaymentErrorEvent, PaymentInfoEvent> getPaymentInfo(String paymentId) {
return Either.right(null);
}
@Override
- public Either<PaymentError, String> createPaymentProviderAccount(Account account) {
- return Either.left((PaymentError) new DefaultPaymentError("unsupported",
+ public Either<PaymentErrorEvent, String> createPaymentProviderAccount(Account account) {
+ return Either.left((PaymentErrorEvent) new DefaultPaymentError("unsupported",
"Account creation not supported in this plugin",
account.getId(),
null, null));
}
@Override
- public Either<PaymentError, PaymentProviderAccount> getPaymentProviderAccount(String accountKey) {
+ public Either<PaymentErrorEvent, PaymentProviderAccount> getPaymentProviderAccount(String accountKey) {
return Either.right(null);
}
@Override
- public Either<PaymentError, String> addPaymentMethod(String accountKey, PaymentMethodInfo paymentMethod) {
+ public Either<PaymentErrorEvent, String> addPaymentMethod(String accountKey, PaymentMethodInfo paymentMethod) {
return Either.right(null);
}
@@ -76,37 +76,37 @@ public class NoOpPaymentProviderPlugin implements PaymentProviderPlugin {
}
@Override
- public Either<PaymentError, PaymentMethodInfo> updatePaymentMethod(String accountKey, PaymentMethodInfo paymentMethod) {
+ public Either<PaymentErrorEvent, PaymentMethodInfo> updatePaymentMethod(String accountKey, PaymentMethodInfo paymentMethod) {
return Either.right(paymentMethod);
}
@Override
- public Either<PaymentError, Void> deletePaymentMethod(String accountKey, String paymentMethodId) {
+ public Either<PaymentErrorEvent, Void> deletePaymentMethod(String accountKey, String paymentMethodId) {
return Either.right(null);
}
@Override
- public Either<PaymentError, PaymentMethodInfo> getPaymentMethodInfo(String paymentMethodId) {
+ public Either<PaymentErrorEvent, PaymentMethodInfo> getPaymentMethodInfo(String paymentMethodId) {
return Either.right(null);
}
@Override
- public Either<PaymentError, List<PaymentMethodInfo>> getPaymentMethods(final String accountKey) {
+ public Either<PaymentErrorEvent, List<PaymentMethodInfo>> getPaymentMethods(final String accountKey) {
return Either.right(Arrays.<PaymentMethodInfo>asList());
}
@Override
- public Either<PaymentError, Void> updatePaymentGateway(String accountKey) {
+ public Either<PaymentErrorEvent, Void> updatePaymentGateway(String accountKey) {
return Either.right(null);
}
@Override
- public Either<PaymentError, Void> updatePaymentProviderAccountExistingContact(Account account) {
+ public Either<PaymentErrorEvent, Void> updatePaymentProviderAccountExistingContact(Account account) {
return Either.right(null);
}
@Override
- public Either<PaymentError, Void> updatePaymentProviderAccountWithNewContact(Account account) {
+ public Either<PaymentErrorEvent, Void> updatePaymentProviderAccountWithNewContact(Account account) {
return Either.right(null);
}
diff --git a/payment/src/main/java/com/ning/billing/payment/provider/PaymentProviderPlugin.java b/payment/src/main/java/com/ning/billing/payment/provider/PaymentProviderPlugin.java
index 7a9ae71..c46d24d 100644
--- a/payment/src/main/java/com/ning/billing/payment/provider/PaymentProviderPlugin.java
+++ b/payment/src/main/java/com/ning/billing/payment/provider/PaymentProviderPlugin.java
@@ -21,26 +21,26 @@ import java.util.List;
import com.ning.billing.account.api.Account;
import com.ning.billing.invoice.api.Invoice;
import com.ning.billing.payment.api.Either;
-import com.ning.billing.payment.api.PaymentError;
-import com.ning.billing.payment.api.PaymentInfo;
+import com.ning.billing.payment.api.PaymentErrorEvent;
+import com.ning.billing.payment.api.PaymentInfoEvent;
import com.ning.billing.payment.api.PaymentMethodInfo;
import com.ning.billing.payment.api.PaymentProviderAccount;
public interface PaymentProviderPlugin {
- Either<PaymentError, PaymentInfo> processInvoice(Account account, Invoice invoice);
- Either<PaymentError, String> createPaymentProviderAccount(Account account);
+ Either<PaymentErrorEvent, PaymentInfoEvent> processInvoice(Account account, Invoice invoice);
+ Either<PaymentErrorEvent, String> createPaymentProviderAccount(Account account);
- Either<PaymentError, PaymentInfo> getPaymentInfo(String paymentId);
- Either<PaymentError, PaymentProviderAccount> getPaymentProviderAccount(String accountKey);
- Either<PaymentError, Void> updatePaymentGateway(String accountKey);
+ Either<PaymentErrorEvent, PaymentInfoEvent> getPaymentInfo(String paymentId);
+ Either<PaymentErrorEvent, PaymentProviderAccount> getPaymentProviderAccount(String accountKey);
+ Either<PaymentErrorEvent, Void> updatePaymentGateway(String accountKey);
- Either<PaymentError, PaymentMethodInfo> getPaymentMethodInfo(String paymentMethodId);
- Either<PaymentError, List<PaymentMethodInfo>> getPaymentMethods(String accountKey);
- Either<PaymentError, String> addPaymentMethod(String accountKey, PaymentMethodInfo paymentMethod);
- Either<PaymentError, PaymentMethodInfo> updatePaymentMethod(String accountKey, PaymentMethodInfo paymentMethodInfo);
- Either<PaymentError, Void> deletePaymentMethod(String accountKey, String paymentMethodId);
+ Either<PaymentErrorEvent, PaymentMethodInfo> getPaymentMethodInfo(String paymentMethodId);
+ Either<PaymentErrorEvent, List<PaymentMethodInfo>> getPaymentMethods(String accountKey);
+ Either<PaymentErrorEvent, String> addPaymentMethod(String accountKey, PaymentMethodInfo paymentMethod);
+ Either<PaymentErrorEvent, PaymentMethodInfo> updatePaymentMethod(String accountKey, PaymentMethodInfo paymentMethodInfo);
+ Either<PaymentErrorEvent, Void> deletePaymentMethod(String accountKey, String paymentMethodId);
- Either<PaymentError, Void> updatePaymentProviderAccountExistingContact(Account account);
- Either<PaymentError, Void> updatePaymentProviderAccountWithNewContact(Account account);
+ Either<PaymentErrorEvent, Void> updatePaymentProviderAccountExistingContact(Account account);
+ Either<PaymentErrorEvent, Void> updatePaymentProviderAccountWithNewContact(Account account);
}
diff --git a/payment/src/main/java/com/ning/billing/payment/RequestProcessor.java b/payment/src/main/java/com/ning/billing/payment/RequestProcessor.java
index 77c12e3..45afaa7 100644
--- a/payment/src/main/java/com/ning/billing/payment/RequestProcessor.java
+++ b/payment/src/main/java/com/ning/billing/payment/RequestProcessor.java
@@ -34,8 +34,8 @@ import com.ning.billing.account.api.AccountUserApi;
import com.ning.billing.invoice.api.InvoiceCreationEvent;
import com.ning.billing.payment.api.Either;
import com.ning.billing.payment.api.PaymentApi;
-import com.ning.billing.payment.api.PaymentError;
-import com.ning.billing.payment.api.PaymentInfo;
+import com.ning.billing.payment.api.PaymentErrorEvent;
+import com.ning.billing.payment.api.PaymentInfoEvent;
import com.ning.billing.payment.provider.PaymentProviderPluginRegistry;
import com.ning.billing.util.bus.Bus;
import com.ning.billing.util.bus.Bus.EventBusException;
@@ -72,9 +72,9 @@ public class RequestProcessor {
}
else {
CallContext context = new DefaultCallContext("PaymentRequestProcessor", CallOrigin.INTERNAL, UserType.SYSTEM, clock);
- List<Either<PaymentError, PaymentInfo>> results = paymentApi.createPayment(account, Arrays.asList(event.getInvoiceId().toString()), context);
+ List<Either<PaymentErrorEvent, PaymentInfoEvent>> results = paymentApi.createPayment(account, Arrays.asList(event.getInvoiceId().toString()), context);
if (!results.isEmpty()) {
- Either<PaymentError, PaymentInfo> result = results.get(0);
+ Either<PaymentErrorEvent, PaymentInfoEvent> result = results.get(0);
eventBus.post(result.isLeft() ? result.getLeft() : result.getRight());
}
}
diff --git a/payment/src/main/java/com/ning/billing/payment/RetryService.java b/payment/src/main/java/com/ning/billing/payment/RetryService.java
index d189159..7558fbe 100644
--- a/payment/src/main/java/com/ning/billing/payment/RetryService.java
+++ b/payment/src/main/java/com/ning/billing/payment/RetryService.java
@@ -32,7 +32,7 @@ import com.ning.billing.lifecycle.LifecycleHandlerType;
import com.ning.billing.lifecycle.LifecycleHandlerType.LifecycleLevel;
import com.ning.billing.payment.api.PaymentApi;
import com.ning.billing.payment.api.PaymentAttempt;
-import com.ning.billing.payment.api.PaymentInfo;
+import com.ning.billing.payment.api.PaymentInfoEvent;
import com.ning.billing.payment.api.PaymentStatus;
import com.ning.billing.util.notificationq.NotificationKey;
@@ -104,7 +104,7 @@ public class RetryService implements KillbillService {
}
private void retry(String paymentAttemptId, CallContext context) {
- PaymentInfo paymentInfo = paymentApi.getPaymentInfoForPaymentAttemptId(paymentAttemptId);
+ PaymentInfoEvent paymentInfo = paymentApi.getPaymentInfoForPaymentAttemptId(paymentAttemptId);
if (paymentInfo != null && PaymentStatus.Processed.equals(PaymentStatus.valueOf(paymentInfo.getStatus()))) {
// update payment attempt with success and notify invoice api of payment
diff --git a/payment/src/test/java/com/ning/billing/payment/api/TestPaymentApi.java b/payment/src/test/java/com/ning/billing/payment/api/TestPaymentApi.java
index ad0bd03..c4fd34a 100644
--- a/payment/src/test/java/com/ning/billing/payment/api/TestPaymentApi.java
+++ b/payment/src/test/java/com/ning/billing/payment/api/TestPaymentApi.java
@@ -92,12 +92,12 @@ public abstract class TestPaymentApi {
new BigDecimal("1.0"),
Currency.USD));
- List<Either<PaymentError, PaymentInfo>> results = paymentApi.createPayment(account.getExternalKey(), Arrays.asList(invoice.getId().toString()), context);
+ List<Either<PaymentErrorEvent, PaymentInfoEvent>> results = paymentApi.createPayment(account.getExternalKey(), Arrays.asList(invoice.getId().toString()), context);
assertEquals(results.size(), 1);
assertTrue(results.get(0).isRight());
- PaymentInfo paymentInfo = results.get(0).getRight();
+ PaymentInfoEvent paymentInfo = results.get(0).getRight();
assertNotNull(paymentInfo.getPaymentId());
assertTrue(paymentInfo.getAmount().compareTo(amount) == 0);
@@ -115,11 +115,11 @@ public abstract class TestPaymentApi {
DateTime paymentAttemptDateTruncated = paymentAttempt.getPaymentAttemptDate().withMillisOfSecond(0).withSecondOfMinute(0);
assertEquals(paymentAttemptDateTruncated.compareTo(nowTruncated), 0);
- List<PaymentInfo> paymentInfos = paymentApi.getPaymentInfo(Arrays.asList(invoice.getId().toString()));
+ List<PaymentInfoEvent> paymentInfos = paymentApi.getPaymentInfo(Arrays.asList(invoice.getId().toString()));
assertNotNull(paymentInfos);
assertTrue(paymentInfos.size() > 0);
- PaymentInfo paymentInfoFromGet = paymentInfos.get(0);
+ PaymentInfoEvent paymentInfoFromGet = paymentInfos.get(0);
assertEquals(paymentInfo.getAmount(), paymentInfoFromGet.getAmount());
assertEquals(paymentInfo.getRefundAmount(), paymentInfoFromGet.getRefundAmount());
assertEquals(paymentInfo.getPaymentId(), paymentInfoFromGet.getPaymentId());
@@ -146,17 +146,17 @@ public abstract class TestPaymentApi {
.setEmail(account.getEmail())
.setDefaultMethod(true)
.build();
- Either<PaymentError, String> paymentMethodIdOrError = paymentApi.addPaymentMethod(accountKey, paymentMethod, context);
+ Either<PaymentErrorEvent, String> paymentMethodIdOrError = paymentApi.addPaymentMethod(accountKey, paymentMethod, context);
assertTrue(paymentMethodIdOrError.isRight());
assertNotNull(paymentMethodIdOrError.getRight());
- Either<PaymentError, PaymentMethodInfo> paymentMethodInfoOrError = paymentApi.getPaymentMethod(accountKey, paymentMethodIdOrError.getRight());
+ Either<PaymentErrorEvent, PaymentMethodInfo> paymentMethodInfoOrError = paymentApi.getPaymentMethod(accountKey, paymentMethodIdOrError.getRight());
assertTrue(paymentMethodInfoOrError.isRight());
assertNotNull(paymentMethodInfoOrError.getRight());
- Either<PaymentError, PaymentProviderAccount> accountOrError = paymentApi.getPaymentProviderAccount(accountKey);
+ Either<PaymentErrorEvent, PaymentProviderAccount> accountOrError = paymentApi.getPaymentProviderAccount(accountKey);
assertTrue(accountOrError.isRight());
@@ -167,7 +167,7 @@ public abstract class TestPaymentApi {
public void testCreatePaypalPaymentMethod() throws AccountApiException, EntityPersistenceException {
PaymentProviderAccount account = setupAccountWithPaypalPaymentMethod();
assertNotNull(account);
- Either<PaymentError, List<PaymentMethodInfo>> paymentMethodsOrError = paymentApi.getPaymentMethods(account.getAccountKey());
+ Either<PaymentErrorEvent, List<PaymentMethodInfo>> paymentMethodsOrError = paymentApi.getPaymentMethods(account.getAccountKey());
}
@Test(enabled=true)
@@ -188,7 +188,7 @@ public abstract class TestPaymentApi {
.billingCycleDay(account.getBillCycleDay())
.build();
- Either<PaymentError, Void> voidOrError = paymentApi.updatePaymentProviderAccountContact(accountToUpdate.getExternalKey(), context);
+ Either<PaymentErrorEvent, Void> voidOrError = paymentApi.updatePaymentProviderAccountContact(accountToUpdate.getExternalKey(), context);
assertTrue(voidOrError.isRight());
}
@@ -196,7 +196,7 @@ public abstract class TestPaymentApi {
public void testCannotDeleteDefaultPaymentMethod() throws AccountApiException, EntityPersistenceException {
PaymentProviderAccount account = setupAccountWithPaypalPaymentMethod();
- Either<PaymentError, Void> errorOrVoid = paymentApi.deletePaymentMethod(account.getAccountKey(), account.getDefaultPaymentMethodId(), context);
+ Either<PaymentErrorEvent, Void> errorOrVoid = paymentApi.deletePaymentMethod(account.getAccountKey(), account.getDefaultPaymentMethodId(), context);
assertTrue(errorOrVoid.isLeft());
}
@@ -209,24 +209,24 @@ public abstract class TestPaymentApi {
String accountKey = account.getExternalKey();
PaypalPaymentMethodInfo paymentMethod1 = new PaypalPaymentMethodInfo.Builder().setDefaultMethod(false).setBaid("12345").setEmail(account.getEmail()).build();
- Either<PaymentError, String> paymentMethodIdOrError1 = paymentApi.addPaymentMethod(accountKey, paymentMethod1, context);
+ Either<PaymentErrorEvent, String> paymentMethodIdOrError1 = paymentApi.addPaymentMethod(accountKey, paymentMethod1, context);
assertTrue(paymentMethodIdOrError1.isRight());
assertNotNull(paymentMethodIdOrError1.getRight());
PaypalPaymentMethodInfo paymentMethod2 = new PaypalPaymentMethodInfo.Builder().setDefaultMethod(true).setBaid("12345").setEmail(account.getEmail()).build();
- Either<PaymentError, String> paymentMethodIdOrError2 = paymentApi.addPaymentMethod(accountKey, paymentMethod2, context);
+ Either<PaymentErrorEvent, String> paymentMethodIdOrError2 = paymentApi.addPaymentMethod(accountKey, paymentMethod2, context);
assertTrue(paymentMethodIdOrError2.isRight());
assertNotNull(paymentMethodIdOrError2.getRight());
- Either<PaymentError, List<PaymentMethodInfo>> paymentMethodsOrError = paymentApi.getPaymentMethods(accountKey);
+ Either<PaymentErrorEvent, List<PaymentMethodInfo>> paymentMethodsOrError = paymentApi.getPaymentMethods(accountKey);
assertTrue(paymentMethodsOrError.isRight());
- Either<PaymentError, Void> errorOrVoid1 = paymentApi.deletePaymentMethod(accountKey, paymentMethodIdOrError1.getRight(), context);
- Either<PaymentError, Void> errorOrVoid2 = paymentApi.deletePaymentMethod(accountKey, paymentMethodIdOrError2.getRight(), context);
+ Either<PaymentErrorEvent, Void> errorOrVoid1 = paymentApi.deletePaymentMethod(accountKey, paymentMethodIdOrError1.getRight(), context);
+ Either<PaymentErrorEvent, Void> errorOrVoid2 = paymentApi.deletePaymentMethod(accountKey, paymentMethodIdOrError2.getRight(), context);
assertTrue(errorOrVoid1.isRight());
assertTrue(errorOrVoid2.isLeft());
diff --git a/payment/src/test/java/com/ning/billing/payment/dao/MockPaymentDao.java b/payment/src/test/java/com/ning/billing/payment/dao/MockPaymentDao.java
index ae62011..a0a77ad 100644
--- a/payment/src/test/java/com/ning/billing/payment/dao/MockPaymentDao.java
+++ b/payment/src/test/java/com/ning/billing/payment/dao/MockPaymentDao.java
@@ -31,10 +31,10 @@ import com.google.common.collect.Collections2;
import com.ning.billing.invoice.api.Invoice;
import com.ning.billing.payment.api.DefaultPaymentInfo;
import com.ning.billing.payment.api.PaymentAttempt;
-import com.ning.billing.payment.api.PaymentInfo;
+import com.ning.billing.payment.api.PaymentInfoEvent;
public class MockPaymentDao implements PaymentDao {
- private final Map<String, PaymentInfo> payments = new ConcurrentHashMap<String, PaymentInfo>();
+ private final Map<String, PaymentInfoEvent> payments = new ConcurrentHashMap<String, PaymentInfoEvent>();
private final Map<UUID, PaymentAttempt> paymentAttempts = new ConcurrentHashMap<UUID, PaymentAttempt>();
@Override
@@ -71,7 +71,7 @@ public class MockPaymentDao implements PaymentDao {
}
@Override
- public void savePaymentInfo(PaymentInfo paymentInfo, CallContext context) {
+ public void savePaymentInfo(PaymentInfoEvent paymentInfo, CallContext context) {
payments.put(paymentInfo.getPaymentId(), paymentInfo);
}
@@ -100,7 +100,7 @@ public class MockPaymentDao implements PaymentDao {
public void updatePaymentInfo(String paymentMethodType, String paymentId, String cardType, String cardCountry, CallContext context) {
DefaultPaymentInfo existingPayment = (DefaultPaymentInfo) payments.get(paymentId);
if (existingPayment != null) {
- PaymentInfo payment = existingPayment.cloner()
+ PaymentInfoEvent payment = existingPayment.cloner()
.setPaymentMethod(paymentMethodType)
.setCardType(cardType)
.setCardCountry(cardCountry)
@@ -111,14 +111,14 @@ public class MockPaymentDao implements PaymentDao {
}
@Override
- public List<PaymentInfo> getPaymentInfo(List<String> invoiceIds) {
+ public List<PaymentInfoEvent> getPaymentInfo(List<String> invoiceIds) {
List<PaymentAttempt> attempts = getPaymentAttemptsForInvoiceIds(invoiceIds);
- List<PaymentInfo> paymentsToReturn = new ArrayList<PaymentInfo>(invoiceIds.size());
+ List<PaymentInfoEvent> paymentsToReturn = new ArrayList<PaymentInfoEvent>(invoiceIds.size());
for (final PaymentAttempt attempt : attempts) {
- paymentsToReturn.addAll(Collections2.filter(payments.values(), new Predicate<PaymentInfo>() {
+ paymentsToReturn.addAll(Collections2.filter(payments.values(), new Predicate<PaymentInfoEvent>() {
@Override
- public boolean apply(PaymentInfo input) {
+ public boolean apply(PaymentInfoEvent input) {
return input.getPaymentId().equals(attempt.getPaymentId());
}
}));
@@ -144,7 +144,7 @@ public class MockPaymentDao implements PaymentDao {
}
@Override
- public PaymentInfo getPaymentInfoForPaymentAttemptId(String paymentAttemptId) {
+ public PaymentInfoEvent getPaymentInfoForPaymentAttemptId(String paymentAttemptId) {
// TODO Auto-generated method stub
return null;
}
diff --git a/payment/src/test/java/com/ning/billing/payment/dao/TestPaymentDao.java b/payment/src/test/java/com/ning/billing/payment/dao/TestPaymentDao.java
index aeb327a..6bbc037 100644
--- a/payment/src/test/java/com/ning/billing/payment/dao/TestPaymentDao.java
+++ b/payment/src/test/java/com/ning/billing/payment/dao/TestPaymentDao.java
@@ -36,7 +36,7 @@ import com.ning.billing.account.api.AccountApiException;
import com.ning.billing.catalog.api.Currency;
import com.ning.billing.payment.api.DefaultPaymentInfo;
import com.ning.billing.payment.api.PaymentAttempt;
-import com.ning.billing.payment.api.PaymentInfo;
+import com.ning.billing.payment.api.PaymentInfoEvent;
public abstract class TestPaymentDao {
protected PaymentDao paymentDao;
@@ -44,7 +44,7 @@ public abstract class TestPaymentDao {
@Test
public void testCreatePayment() {
- PaymentInfo paymentInfo = new DefaultPaymentInfo.Builder().setPaymentId(UUID.randomUUID().toString())
+ PaymentInfoEvent paymentInfo = new DefaultPaymentInfo.Builder().setPaymentId(UUID.randomUUID().toString())
.setAmount(BigDecimal.TEN)
.setStatus("Processed")
.setBankIdentificationNumber("1234")
@@ -60,7 +60,7 @@ public abstract class TestPaymentDao {
@Test
public void testUpdatePaymentInfo() {
- PaymentInfo paymentInfo = new DefaultPaymentInfo.Builder().setPaymentId(UUID.randomUUID().toString())
+ PaymentInfoEvent paymentInfo = new DefaultPaymentInfo.Builder().setPaymentId(UUID.randomUUID().toString())
.setAmount(BigDecimal.TEN)
.setStatus("Processed")
.setBankIdentificationNumber("1234")
@@ -119,7 +119,7 @@ public abstract class TestPaymentDao {
Assert.assertEquals(attempt3, attempt4);
- PaymentInfo originalPaymentInfo = new DefaultPaymentInfo.Builder().setPaymentId(paymentId)
+ PaymentInfoEvent originalPaymentInfo = new DefaultPaymentInfo.Builder().setPaymentId(paymentId)
.setAmount(invoiceAmount)
.setStatus("Processed")
.setBankIdentificationNumber("1234")
@@ -133,7 +133,7 @@ public abstract class TestPaymentDao {
.build();
paymentDao.savePaymentInfo(originalPaymentInfo, thisContext);
- PaymentInfo paymentInfo = paymentDao.getPaymentInfo(Arrays.asList(invoiceId.toString())).get(0);
+ PaymentInfoEvent paymentInfo = paymentDao.getPaymentInfo(Arrays.asList(invoiceId.toString())).get(0);
Assert.assertEquals(paymentInfo, originalPaymentInfo);
clock.setDeltaFromReality(60 * 60 * 1000); // move clock forward one hour
diff --git a/payment/src/test/java/com/ning/billing/payment/MockPaymentInfoReceiver.java b/payment/src/test/java/com/ning/billing/payment/MockPaymentInfoReceiver.java
index cf2494d..f4a30a9 100644
--- a/payment/src/test/java/com/ning/billing/payment/MockPaymentInfoReceiver.java
+++ b/payment/src/test/java/com/ning/billing/payment/MockPaymentInfoReceiver.java
@@ -21,29 +21,29 @@ import java.util.Collections;
import java.util.List;
import com.google.common.eventbus.Subscribe;
-import com.ning.billing.payment.api.PaymentError;
-import com.ning.billing.payment.api.PaymentInfo;
+import com.ning.billing.payment.api.PaymentErrorEvent;
+import com.ning.billing.payment.api.PaymentInfoEvent;
public class MockPaymentInfoReceiver {
- private final List<PaymentInfo> processedPayments = Collections.synchronizedList(new ArrayList<PaymentInfo>());
- private final List<PaymentError> errors = Collections.synchronizedList(new ArrayList<PaymentError>());
+ private final List<PaymentInfoEvent> processedPayments = Collections.synchronizedList(new ArrayList<PaymentInfoEvent>());
+ private final List<PaymentErrorEvent> errors = Collections.synchronizedList(new ArrayList<PaymentErrorEvent>());
@Subscribe
- public void processedPayment(PaymentInfo paymentInfo) {
+ public void processedPayment(PaymentInfoEvent paymentInfo) {
processedPayments.add(paymentInfo);
}
@Subscribe
- public void processedPaymentError(PaymentError paymentError) {
+ public void processedPaymentError(PaymentErrorEvent paymentError) {
errors.add(paymentError);
}
- public List<PaymentInfo> getProcessedPayments() {
- return new ArrayList<PaymentInfo>(processedPayments);
+ public List<PaymentInfoEvent> getProcessedPayments() {
+ return new ArrayList<PaymentInfoEvent>(processedPayments);
}
- public List<PaymentError> getErrors() {
- return new ArrayList<PaymentError>(errors);
+ public List<PaymentErrorEvent> getErrors() {
+ return new ArrayList<PaymentErrorEvent>(errors);
}
public void clear() {
diff --git a/payment/src/test/java/com/ning/billing/payment/provider/MockPaymentProviderPlugin.java b/payment/src/test/java/com/ning/billing/payment/provider/MockPaymentProviderPlugin.java
index 5a39a5c..074676b 100644
--- a/payment/src/test/java/com/ning/billing/payment/provider/MockPaymentProviderPlugin.java
+++ b/payment/src/test/java/com/ning/billing/payment/provider/MockPaymentProviderPlugin.java
@@ -37,15 +37,15 @@ import com.ning.billing.payment.api.CreditCardPaymentMethodInfo;
import com.ning.billing.payment.api.DefaultPaymentError;
import com.ning.billing.payment.api.DefaultPaymentInfo;
import com.ning.billing.payment.api.Either;
-import com.ning.billing.payment.api.PaymentError;
-import com.ning.billing.payment.api.PaymentInfo;
+import com.ning.billing.payment.api.PaymentErrorEvent;
+import com.ning.billing.payment.api.PaymentInfoEvent;
import com.ning.billing.payment.api.PaymentMethodInfo;
import com.ning.billing.payment.api.PaymentProviderAccount;
import com.ning.billing.payment.api.PaypalPaymentMethodInfo;
public class MockPaymentProviderPlugin implements PaymentProviderPlugin {
private final AtomicBoolean makeNextInvoiceFail = new AtomicBoolean(false);
- private final Map<String, PaymentInfo> payments = new ConcurrentHashMap<String, PaymentInfo>();
+ private final Map<String, PaymentInfoEvent> payments = new ConcurrentHashMap<String, PaymentInfoEvent>();
private final Map<String, PaymentProviderAccount> accounts = new ConcurrentHashMap<String, PaymentProviderAccount>();
private final Map<String, PaymentMethodInfo> paymentMethods = new ConcurrentHashMap<String, PaymentMethodInfo>();
private final Clock clock;
@@ -60,12 +60,12 @@ public class MockPaymentProviderPlugin implements PaymentProviderPlugin {
}
@Override
- public Either<PaymentError, PaymentInfo> processInvoice(Account account, Invoice invoice) {
+ public Either<PaymentErrorEvent, PaymentInfoEvent> processInvoice(Account account, Invoice invoice) {
if (makeNextInvoiceFail.getAndSet(false)) {
- return Either.left((PaymentError) new DefaultPaymentError("unknown", "test error", account.getId(), invoice.getId(), null));
+ return Either.left((PaymentErrorEvent) new DefaultPaymentError("unknown", "test error", account.getId(), invoice.getId(), null));
}
else {
- PaymentInfo payment = new DefaultPaymentInfo.Builder().setPaymentId(UUID.randomUUID().toString())
+ PaymentInfoEvent payment = new DefaultPaymentInfo.Builder().setPaymentId(UUID.randomUUID().toString())
.setAmount(invoice.getBalance())
.setStatus("Processed")
.setBankIdentificationNumber("1234")
@@ -81,11 +81,11 @@ public class MockPaymentProviderPlugin implements PaymentProviderPlugin {
}
@Override
- public Either<PaymentError, PaymentInfo> getPaymentInfo(String paymentId) {
- PaymentInfo payment = payments.get(paymentId);
+ public Either<PaymentErrorEvent, PaymentInfoEvent> getPaymentInfo(String paymentId) {
+ PaymentInfoEvent payment = payments.get(paymentId);
if (payment == null) {
- return Either.left((PaymentError) new DefaultPaymentError("notfound", "No payment found for id " + paymentId, null, null, null));
+ return Either.left((PaymentErrorEvent) new DefaultPaymentError("notfound", "No payment found for id " + paymentId, null, null, null));
}
else {
return Either.right(payment);
@@ -93,7 +93,7 @@ public class MockPaymentProviderPlugin implements PaymentProviderPlugin {
}
@Override
- public Either<PaymentError, String> createPaymentProviderAccount(Account account) {
+ public Either<PaymentErrorEvent, String> createPaymentProviderAccount(Account account) {
if (account != null) {
String id = String.valueOf(RandomStringUtils.randomAlphanumeric(10));
accounts.put(account.getExternalKey(),
@@ -104,22 +104,22 @@ public class MockPaymentProviderPlugin implements PaymentProviderPlugin {
return Either.right(id);
}
else {
- return Either.left((PaymentError) new DefaultPaymentError("unknown", "Did not get account to create payment provider account", null, null, null));
+ return Either.left((PaymentErrorEvent) new DefaultPaymentError("unknown", "Did not get account to create payment provider account", null, null, null));
}
}
@Override
- public Either<PaymentError, PaymentProviderAccount> getPaymentProviderAccount(String accountKey) {
+ public Either<PaymentErrorEvent, PaymentProviderAccount> getPaymentProviderAccount(String accountKey) {
if (accountKey != null) {
return Either.right(accounts.get(accountKey));
}
else {
- return Either.left((PaymentError) new DefaultPaymentError("unknown", "Did not get account for accountKey " + accountKey, null, null, null));
+ return Either.left((PaymentErrorEvent) new DefaultPaymentError("unknown", "Did not get account for accountKey " + accountKey, null, null, null));
}
}
@Override
- public Either<PaymentError, String> addPaymentMethod(String accountKey, PaymentMethodInfo paymentMethod) {
+ public Either<PaymentErrorEvent, String> addPaymentMethod(String accountKey, PaymentMethodInfo paymentMethod) {
if (paymentMethod != null) {
PaymentProviderAccount account = accounts.get(accountKey);
@@ -146,7 +146,7 @@ public class MockPaymentProviderPlugin implements PaymentProviderPlugin {
realPaymentMethod = new CreditCardPaymentMethodInfo.Builder(ccPaymentMethod).setId(paymentMethodId).build();
}
if (realPaymentMethod == null) {
- return Either.left((PaymentError) new DefaultPaymentError("unsupported", "Payment method " + paymentMethod.getType() + " not supported by the plugin", null, null, null));
+ return Either.left((PaymentErrorEvent) new DefaultPaymentError("unsupported", "Payment method " + paymentMethod.getType() + " not supported by the plugin", null, null, null));
}
else {
if (shouldBeDefault) {
@@ -157,11 +157,11 @@ public class MockPaymentProviderPlugin implements PaymentProviderPlugin {
}
}
else {
- return Either.left((PaymentError) new DefaultPaymentError("noaccount", "Could not retrieve account for accountKey " + accountKey, null, null, null));
+ return Either.left((PaymentErrorEvent) new DefaultPaymentError("noaccount", "Could not retrieve account for accountKey " + accountKey, null, null, null));
}
}
else {
- return Either.left((PaymentError) new DefaultPaymentError("unknown", "Could not create add payment method " + paymentMethod + " for " + accountKey, null, null, null));
+ return Either.left((PaymentErrorEvent) new DefaultPaymentError("unknown", "Could not create add payment method " + paymentMethod + " for " + accountKey, null, null, null));
}
}
@@ -192,7 +192,7 @@ public class MockPaymentProviderPlugin implements PaymentProviderPlugin {
}
@Override
- public Either<PaymentError, PaymentMethodInfo> updatePaymentMethod(String accountKey, PaymentMethodInfo paymentMethod) {
+ public Either<PaymentErrorEvent, PaymentMethodInfo> updatePaymentMethod(String accountKey, PaymentMethodInfo paymentMethod) {
if (paymentMethod != null) {
PaymentMethodInfo realPaymentMethod = null;
@@ -205,7 +205,7 @@ public class MockPaymentProviderPlugin implements PaymentProviderPlugin {
realPaymentMethod = new CreditCardPaymentMethodInfo.Builder(ccPaymentMethod).build();
}
if (realPaymentMethod == null) {
- return Either.left((PaymentError) new DefaultPaymentError("unsupported", "Payment method " + paymentMethod.getType() + " not supported by the plugin", null, null, null));
+ return Either.left((PaymentErrorEvent) new DefaultPaymentError("unsupported", "Payment method " + paymentMethod.getType() + " not supported by the plugin", null, null, null));
}
else {
paymentMethods.put(paymentMethod.getId(), paymentMethod);
@@ -213,37 +213,37 @@ public class MockPaymentProviderPlugin implements PaymentProviderPlugin {
}
}
else {
- return Either.left((PaymentError) new DefaultPaymentError("unknown", "Could not create add payment method " + paymentMethod + " for " + accountKey, null, null, null));
+ return Either.left((PaymentErrorEvent) new DefaultPaymentError("unknown", "Could not create add payment method " + paymentMethod + " for " + accountKey, null, null, null));
}
}
@Override
- public Either<PaymentError, Void> deletePaymentMethod(String accountKey, String paymentMethodId) {
+ public Either<PaymentErrorEvent, Void> deletePaymentMethod(String accountKey, String paymentMethodId) {
PaymentMethodInfo paymentMethodInfo = paymentMethods.get(paymentMethodId);
if (paymentMethodInfo != null) {
if (Boolean.FALSE.equals(paymentMethodInfo.getDefaultMethod()) || paymentMethodInfo.getDefaultMethod() == null) {
if (paymentMethods.remove(paymentMethodId) == null) {
- return Either.left((PaymentError) new DefaultPaymentError("unknown", "Did not get any result back", null, null, null));
+ return Either.left((PaymentErrorEvent) new DefaultPaymentError("unknown", "Did not get any result back", null, null, null));
}
}
else {
- return Either.left((PaymentError) new DefaultPaymentError("error", "Cannot delete default payment method", null, null, null));
+ return Either.left((PaymentErrorEvent) new DefaultPaymentError("error", "Cannot delete default payment method", null, null, null));
}
}
return Either.right(null);
}
@Override
- public Either<PaymentError, PaymentMethodInfo> getPaymentMethodInfo(String paymentMethodId) {
+ public Either<PaymentErrorEvent, PaymentMethodInfo> getPaymentMethodInfo(String paymentMethodId) {
if (paymentMethodId == null) {
- return Either.left((PaymentError) new DefaultPaymentError("unknown", "Could not retrieve payment method for paymentMethodId " + paymentMethodId, null, null, null));
+ return Either.left((PaymentErrorEvent) new DefaultPaymentError("unknown", "Could not retrieve payment method for paymentMethodId " + paymentMethodId, null, null, null));
}
return Either.right(paymentMethods.get(paymentMethodId));
}
@Override
- public Either<PaymentError, List<PaymentMethodInfo>> getPaymentMethods(final String accountKey) {
+ public Either<PaymentErrorEvent, List<PaymentMethodInfo>> getPaymentMethods(final String accountKey) {
Collection<PaymentMethodInfo> filteredPaymentMethods = Collections2.filter(paymentMethods.values(), new Predicate<PaymentMethodInfo>() {
@Override
@@ -256,18 +256,18 @@ public class MockPaymentProviderPlugin implements PaymentProviderPlugin {
}
@Override
- public Either<PaymentError, Void> updatePaymentGateway(String accountKey) {
+ public Either<PaymentErrorEvent, Void> updatePaymentGateway(String accountKey) {
return Either.right(null);
}
@Override
- public Either<PaymentError, Void> updatePaymentProviderAccountExistingContact(Account account) {
+ public Either<PaymentErrorEvent, Void> updatePaymentProviderAccountExistingContact(Account account) {
// nothing to do here
return Either.right(null);
}
@Override
- public Either<PaymentError, Void> updatePaymentProviderAccountWithNewContact(Account account) {
+ public Either<PaymentErrorEvent, Void> updatePaymentProviderAccountWithNewContact(Account account) {
// nothing to do here
return Either.right(null);
}
diff --git a/payment/src/test/java/com/ning/billing/payment/TestPaymentInvoiceIntegration.java b/payment/src/test/java/com/ning/billing/payment/TestPaymentInvoiceIntegration.java
index 8b71c10..d30ec44 100644
--- a/payment/src/test/java/com/ning/billing/payment/TestPaymentInvoiceIntegration.java
+++ b/payment/src/test/java/com/ning/billing/payment/TestPaymentInvoiceIntegration.java
@@ -50,8 +50,8 @@ import com.ning.billing.invoice.api.InvoicePaymentApi;
import com.ning.billing.invoice.glue.InvoiceModuleWithMocks;
import com.ning.billing.payment.api.PaymentApi;
import com.ning.billing.payment.api.PaymentAttempt;
-import com.ning.billing.payment.api.PaymentError;
-import com.ning.billing.payment.api.PaymentInfo;
+import com.ning.billing.payment.api.PaymentErrorEvent;
+import com.ning.billing.payment.api.PaymentInfoEvent;
import com.ning.billing.payment.setup.PaymentTestModuleWithEmbeddedDb;
import com.ning.billing.util.bus.Bus;
import com.ning.billing.util.bus.Bus.EventBusException;
@@ -137,8 +137,8 @@ public class TestPaymentInvoiceIntegration {
await().atMost(1, MINUTES).until(new Callable<Boolean>() {
@Override
public Boolean call() throws Exception {
- List<PaymentInfo> processedPayments = paymentInfoReceiver.getProcessedPayments();
- List<PaymentError> errors = paymentInfoReceiver.getErrors();
+ List<PaymentInfoEvent> processedPayments = paymentInfoReceiver.getProcessedPayments();
+ List<PaymentErrorEvent> errors = paymentInfoReceiver.getErrors();
return processedPayments.size() == 1 || errors.size() == 1;
}
@@ -147,7 +147,7 @@ public class TestPaymentInvoiceIntegration {
assertFalse(paymentInfoReceiver.getProcessedPayments().isEmpty());
assertTrue(paymentInfoReceiver.getErrors().isEmpty());
- List<PaymentInfo> payments = paymentInfoReceiver.getProcessedPayments();
+ List<PaymentInfoEvent> payments = paymentInfoReceiver.getProcessedPayments();
PaymentAttempt paymentAttempt = paymentApi.getPaymentAttemptForPaymentId(payments.get(0).getPaymentId());
Assert.assertNotNull(paymentAttempt);
diff --git a/payment/src/test/java/com/ning/billing/payment/TestPaymentProvider.java b/payment/src/test/java/com/ning/billing/payment/TestPaymentProvider.java
index dd4b996..983fc3b 100644
--- a/payment/src/test/java/com/ning/billing/payment/TestPaymentProvider.java
+++ b/payment/src/test/java/com/ning/billing/payment/TestPaymentProvider.java
@@ -34,8 +34,8 @@ import com.google.inject.Inject;
import com.ning.billing.account.api.Account;
import com.ning.billing.account.glue.AccountModuleWithMocks;
import com.ning.billing.invoice.glue.InvoiceModuleWithMocks;
-import com.ning.billing.payment.api.PaymentError;
-import com.ning.billing.payment.api.PaymentInfo;
+import com.ning.billing.payment.api.PaymentErrorEvent;
+import com.ning.billing.payment.api.PaymentInfoEvent;
import com.ning.billing.payment.setup.PaymentTestModuleWithMocks;
import com.ning.billing.util.bus.Bus;
import com.ning.billing.util.bus.Bus.EventBusException;
@@ -80,8 +80,8 @@ public class TestPaymentProvider {
await().atMost(1, MINUTES).until(new Callable<Boolean>() {
@Override
public Boolean call() throws Exception {
- List<PaymentInfo> processedPayments = paymentInfoReceiver.getProcessedPayments();
- List<PaymentError> errors = paymentInfoReceiver.getErrors();
+ List<PaymentInfoEvent> processedPayments = paymentInfoReceiver.getProcessedPayments();
+ List<PaymentErrorEvent> errors = paymentInfoReceiver.getErrors();
return processedPayments.size() == 1 || errors.size() == 1;
}
diff --git a/payment/src/test/java/com/ning/billing/payment/TestRetryService.java b/payment/src/test/java/com/ning/billing/payment/TestRetryService.java
index 6d8102a..1fe2cc4 100644
--- a/payment/src/test/java/com/ning/billing/payment/TestRetryService.java
+++ b/payment/src/test/java/com/ning/billing/payment/TestRetryService.java
@@ -48,8 +48,8 @@ import com.ning.billing.invoice.model.RecurringInvoiceItem;
import com.ning.billing.payment.api.Either;
import com.ning.billing.payment.api.PaymentApi;
import com.ning.billing.payment.api.PaymentAttempt;
-import com.ning.billing.payment.api.PaymentError;
-import com.ning.billing.payment.api.PaymentInfo;
+import com.ning.billing.payment.api.PaymentErrorEvent;
+import com.ning.billing.payment.api.PaymentInfoEvent;
import com.ning.billing.payment.api.PaymentStatus;
import com.ning.billing.payment.dao.PaymentDao;
import com.ning.billing.payment.provider.MockPaymentProviderPlugin;
@@ -131,7 +131,7 @@ public class TestRetryService {
mockPaymentProviderPlugin.makeNextInvoiceFail();
- List<Either<PaymentError, PaymentInfo>> results = paymentApi.createPayment(account.getExternalKey(), Arrays.asList(invoice.getId().toString()), context);
+ List<Either<PaymentErrorEvent, PaymentInfoEvent>> results = paymentApi.createPayment(account.getExternalKey(), Arrays.asList(invoice.getId().toString()), context);
assertEquals(results.size(), 1);
assertTrue(results.get(0).isLeft());
@@ -185,10 +185,10 @@ public class TestRetryService {
List<Notification> pendingNotifications = mockNotificationQueue.getPendingEvents();
assertEquals(pendingNotifications.size(), 0);
- List<PaymentInfo> paymentInfoList = paymentApi.getPaymentInfo(Arrays.asList(invoice.getId().toString()));
+ List<PaymentInfoEvent> paymentInfoList = paymentApi.getPaymentInfo(Arrays.asList(invoice.getId().toString()));
assertEquals(paymentInfoList.size(), 1);
- PaymentInfo paymentInfo = paymentInfoList.get(0);
+ PaymentInfoEvent paymentInfo = paymentInfoList.get(0);
assertEquals(paymentInfo.getStatus(), PaymentStatus.Processed.toString());
List<PaymentAttempt> updatedAttempts = paymentApi.getPaymentAttemptsForInvoiceId(invoice.getId().toString());
diff --git a/util/src/main/java/com/ning/billing/util/userrequest/CompletionUserRequestBase.java b/util/src/main/java/com/ning/billing/util/userrequest/CompletionUserRequestBase.java
index d188438..10983d8 100644
--- a/util/src/main/java/com/ning/billing/util/userrequest/CompletionUserRequestBase.java
+++ b/util/src/main/java/com/ning/billing/util/userrequest/CompletionUserRequestBase.java
@@ -25,8 +25,8 @@ import com.ning.billing.account.api.AccountCreationEvent;
import com.ning.billing.entitlement.api.user.SubscriptionEventTransition;
import com.ning.billing.invoice.api.EmptyInvoiceEvent;
import com.ning.billing.invoice.api.InvoiceCreationEvent;
-import com.ning.billing.payment.api.PaymentError;
-import com.ning.billing.payment.api.PaymentInfo;
+import com.ning.billing.payment.api.PaymentErrorEvent;
+import com.ning.billing.payment.api.PaymentInfoEvent;
import com.ning.billing.util.bus.BusEvent;
public abstract class CompletionUserRequestBase implements CompletionUserRequest {
@@ -112,10 +112,10 @@ public abstract class CompletionUserRequestBase implements CompletionUserRequest
onInvoiceCreation((InvoiceCreationEvent) curEvent);
break;
case PAYMENT_INFO:
- onPaymentInfo((PaymentInfo) curEvent);
+ onPaymentInfo((PaymentInfoEvent) curEvent);
break;
case PAYMENT_ERROR:
- onPaymentError((PaymentError) curEvent);
+ onPaymentError((PaymentErrorEvent) curEvent);
break;
default:
throw new RuntimeException("Unexpected event type " + curEvent.getBusEventType());
@@ -147,10 +147,10 @@ public abstract class CompletionUserRequestBase implements CompletionUserRequest
}
@Override
- public void onPaymentInfo(final PaymentInfo curEvent) {
+ public void onPaymentInfo(final PaymentInfoEvent curEvent) {
}
@Override
- public void onPaymentError(final PaymentError curEvent) {
+ public void onPaymentError(final PaymentErrorEvent curEvent) {
}
}