killbill-memoizeit
Changes
payment/pom.xml 7(+1 -6)
Details
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 8ecae71..2983a22 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
@@ -17,6 +17,7 @@
package com.ning.billing.payment.api;
import java.util.List;
+import java.util.UUID;
import javax.annotation.Nullable;
@@ -38,6 +39,7 @@ public interface PaymentApi {
List<Either<PaymentError, PaymentInfo>> createPayment(String accountKey, List<String> invoiceIds);
List<Either<PaymentError, PaymentInfo>> createPayment(Account account, List<String> invoiceIds);
+ Either<PaymentError, PaymentInfo> createPayment(UUID paymentAttemptId);
List<Either<PaymentError, PaymentInfo>> createRefund(Account account, List<String> invoiceIds); //TODO
@@ -53,4 +55,5 @@ public interface PaymentApi {
PaymentAttempt getPaymentAttemptForInvoiceId(String invoiceId);
+
}
payment/pom.xml 7(+1 -6)
diff --git a/payment/pom.xml b/payment/pom.xml
index 3e050f0..98c98bc 100644
--- a/payment/pom.xml
+++ b/payment/pom.xml
@@ -62,7 +62,7 @@
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
- <version>2.0.1</version>
+ <scope>provided</scope>
</dependency>
<dependency>
<groupId>commons-collections</groupId>
@@ -86,11 +86,6 @@
<dependency>
<groupId>com.ning.billing</groupId>
<artifactId>killbill-util</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>com.ning.billing</groupId>
- <artifactId>killbill-util</artifactId>
<type>test-jar</type>
<scope>test</scope>
</dependency>
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 5d9f58f..23ff871 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
@@ -24,6 +24,8 @@ import java.util.UUID;
import javax.annotation.Nullable;
import org.apache.commons.lang.StringUtils;
+import org.joda.time.DateTime;
+import org.joda.time.DateTimeZone;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -131,40 +133,26 @@ public class DefaultPaymentApi implements PaymentApi {
return createPayment(account, invoiceIds);
}
- private void addRetry(UUID paymentAttemptId, String error) {
-// PaymentAttempt paymentAttempt = paymentDao.getPaymentAttemptById(paymentAttemptId);
-// final List<String> retryDays = config.getPaymentRetryDays();
-//
-// int retryCount = 0;
-//
-// if (paymentAttempt != null && paymentAttempt.getRetryCount() != null) {
-// retryCount = paymentAttempt.getRetryCount();
-// }
-//
-// if (retryCount < retryDays.size()) {
-// int retryInDays = 0;
-// DateTime nextRetryDate = new DateTime(DateTimeZone.UTC);
-//
-// try {
-// retryInDays = Integer.valueOf(retryDays.get(retryCount));
-// nextRetryDate = nextRetryDate.plusDays(retryInDays);
-// }
-// catch (NumberFormatException ex) {
-// log.error("Could not get retry day for retry count {}", retryCount);
-// }
-//
-// PaymentAttemptRetry updatedPaymentAttemptRetry = paymentAttempt.cloner().setRetryCount(retryCount + 1)
-// .setNextRetryDate(nextRetryDate)
-// .build();
-//
-// paymentDao.updatePaymentAttempt(updatedPaymentAttemptRetry);
-// }
-// else if (retryCount == retryDays.size()) {
-// log.info("Last payment retry failed for {} ", paymentAttempt);
-// }
-// else {
-// log.error("Cannot update payment retry information because retry count is invalid {} ", retryCount);
-// }
+ @Override
+ public Either<PaymentError, PaymentInfo> createPayment(UUID paymentAttemptId) {
+ PaymentAttempt paymentAttempt = paymentDao.getPaymentAttemptById(paymentAttemptId);
+
+ if (paymentAttempt != null) {
+ Invoice invoice = invoicePaymentApi.getInvoice(paymentAttempt.getInvoiceId());
+ Account account = accountUserApi.getAccountById(paymentAttempt.getAccountId());
+
+ if (invoice != null && account != null) {
+ 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);
+ Either.left(new PaymentError("invoice_balance_0", "Invoice balance was 0"));
+ }
+ else {
+ return processPayment(getPaymentProviderPlugin(account), account, invoice, paymentAttempt);
+ }
+ }
+ }
+ return Either.left(new PaymentError("retry_payment_error", "Could not load payment attempt, invoice or account for id " + paymentAttemptId));
}
@Override
@@ -177,63 +165,94 @@ public class DefaultPaymentApi implements PaymentApi {
Invoice invoice = invoicePaymentApi.getInvoice(UUID.fromString(invoiceId));
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);
- }
- else if (invoiceId.equals(paymentDao.getPaymentAttemptForInvoiceId(invoiceId))) {
- //TODO: do equals on invoice instead and only reject when invoice is exactly the same?
- log.info("Duplicate invoice payment event, already received invoice {} ", invoice);
+ // TODO: send a notification that invoice was ignored?
+ log.info("Received invoice for payment with balance of 0 {} ", invoice);
+ Either.left(new PaymentError("invoice_balance_0", "Invoice balance was 0"));
}
else {
PaymentAttempt paymentAttempt = paymentDao.createPaymentAttempt(invoice);
- Either<PaymentError, PaymentInfo> paymentOrError = plugin.processInvoice(account, invoice);
- processedPaymentsOrErrors.add(paymentOrError);
- PaymentInfo paymentInfo = null;
-
- if (paymentOrError.isLeft()) {
- String error = StringUtils.substring(paymentOrError.getLeft().getMessage() + paymentOrError.getLeft().getType(), 0, 100);
- log.info("Could not process a payment for " + paymentAttempt + " error was " + error);
+ processedPaymentsOrErrors.add(processPayment(plugin, account, invoice, paymentAttempt));
+ }
+ }
- addRetry(paymentAttempt.getPaymentAttemptId(), error);
- }
+ return processedPaymentsOrErrors;
+ }
- if (paymentOrError.isRight()) {
- paymentInfo = paymentOrError.getRight();
- paymentDao.savePaymentInfo(paymentInfo);
+ private Either<PaymentError, PaymentInfo> processPayment(PaymentProviderPlugin plugin, Account account, Invoice invoice, PaymentAttempt paymentAttempt) {
+ Either<PaymentError, PaymentInfo> paymentOrError = plugin.processInvoice(account, invoice);
+ PaymentInfo paymentInfo = null;
- Either<PaymentError, PaymentMethodInfo> paymentMethodInfoOrError = plugin.getPaymentMethodInfo(paymentInfo.getPaymentMethodId());
+ if (paymentOrError.isLeft()) {
+ String error = StringUtils.substring(paymentOrError.getLeft().getMessage() + paymentOrError.getLeft().getType(), 0, 100);
+ log.info("Could not process a payment for " + paymentAttempt + " error was " + error);
- if (paymentMethodInfoOrError.isRight()) {
- PaymentMethodInfo paymentMethodInfo = paymentMethodInfoOrError.getRight();
+ scheduleRetry(paymentAttempt, error);
+ }
+ else {
+ paymentInfo = paymentOrError.getRight();
+ paymentDao.savePaymentInfo(paymentInfo);
- if (paymentMethodInfo instanceof CreditCardPaymentMethodInfo) {
- CreditCardPaymentMethodInfo ccPaymentMethod = (CreditCardPaymentMethodInfo)paymentMethodInfo;
- paymentDao.updatePaymentInfo(ccPaymentMethod.getType(), paymentInfo.getPaymentId(), ccPaymentMethod.getCardType(), ccPaymentMethod.getCardCountry());
- }
- else if (paymentMethodInfo instanceof PaypalPaymentMethodInfo) {
- PaypalPaymentMethodInfo paypalPaymentMethodInfo = (PaypalPaymentMethodInfo)paymentMethodInfo;
- paymentDao.updatePaymentInfo(paypalPaymentMethodInfo.getType(), paymentInfo.getPaymentId(), null, null);
- }
- }
+ Either<PaymentError, PaymentMethodInfo> paymentMethodInfoOrError = plugin.getPaymentMethodInfo(paymentInfo.getPaymentMethodId());
+ if (paymentMethodInfoOrError.isRight()) {
+ PaymentMethodInfo paymentMethodInfo = paymentMethodInfoOrError.getRight();
- if (paymentInfo.getPaymentId() != null) {
- paymentDao.updatePaymentAttemptWithPaymentId(paymentAttempt.getPaymentAttemptId(), paymentInfo.getPaymentId());
- }
+ if (paymentMethodInfo instanceof CreditCardPaymentMethodInfo) {
+ CreditCardPaymentMethodInfo ccPaymentMethod = (CreditCardPaymentMethodInfo)paymentMethodInfo;
+ paymentDao.updatePaymentInfo(ccPaymentMethod.getType(), paymentInfo.getPaymentId(), ccPaymentMethod.getCardType(), ccPaymentMethod.getCardCountry());
+ }
+ else if (paymentMethodInfo instanceof PaypalPaymentMethodInfo) {
+ PaypalPaymentMethodInfo paypalPaymentMethodInfo = (PaypalPaymentMethodInfo)paymentMethodInfo;
+ paymentDao.updatePaymentInfo(paypalPaymentMethodInfo.getType(), paymentInfo.getPaymentId(), null, null);
}
+ }
- invoicePaymentApi.notifyOfPaymentAttempt(new DefaultInvoicePayment(paymentAttempt.getPaymentAttemptId(),
- invoice.getId(),
- paymentAttempt.getPaymentAttemptDate(),
- paymentInfo == null ? null : paymentInfo.getAmount(),
-// paymentInfo.getRefundAmount(), TODO
- paymentInfo == null ? null : invoice.getCurrency()));
+ if (paymentInfo.getPaymentId() != null) {
+ paymentDao.updatePaymentAttemptWithPaymentId(paymentAttempt.getPaymentAttemptId(), paymentInfo.getPaymentId());
}
}
- return processedPaymentsOrErrors;
+ invoicePaymentApi.notifyOfPaymentAttempt(new DefaultInvoicePayment(paymentAttempt.getPaymentAttemptId(),
+ invoice.getId(),
+ paymentAttempt.getPaymentAttemptDate(),
+ paymentInfo == null ? null : paymentInfo.getAmount(),
+// paymentInfo.getRefundAmount(), TODO
+ paymentInfo == null ? null : invoice.getCurrency()));
+
+ return paymentOrError;
+ }
+
+ private void scheduleRetry(PaymentAttempt paymentAttempt, String error) {
+ final List<Integer> retryDays = config.getPaymentRetryDays();
+
+ int retryCount = 0;
+
+ if (paymentAttempt.getRetryCount() != null) {
+ retryCount = paymentAttempt.getRetryCount();
+ }
+
+ if (retryCount < retryDays.size()) {
+ int retryInDays = 0;
+ DateTime nextRetryDate = new DateTime(DateTimeZone.UTC);
+
+ try {
+ retryInDays = retryDays.get(retryCount);
+ nextRetryDate = nextRetryDate.plusDays(retryInDays);
+ }
+ catch (NumberFormatException ex) {
+ log.error("Could not get retry day for retry count {}", retryCount);
+ }
+
+ paymentDao.updatePaymentAttemptWithRetryInfo(paymentAttempt.getPaymentAttemptId(), retryCount + 1, nextRetryDate);
+ }
+ else if (retryCount == retryDays.size()) {
+ log.info("Last payment retry failed for {} ", paymentAttempt);
+ }
+ else {
+ log.error("Cannot update payment retry information because retry count is invalid {} ", retryCount);
+ }
}
@Override
diff --git a/payment/src/main/java/com/ning/billing/payment/dao/DefaultPaymentDao.java b/payment/src/main/java/com/ning/billing/payment/dao/DefaultPaymentDao.java
index 9a96631..7366deb 100644
--- a/payment/src/main/java/com/ning/billing/payment/dao/DefaultPaymentDao.java
+++ b/payment/src/main/java/com/ning/billing/payment/dao/DefaultPaymentDao.java
@@ -19,6 +19,7 @@ package com.ning.billing.payment.dao;
import java.util.List;
import java.util.UUID;
+import org.joda.time.DateTime;
import org.skife.jdbi.v2.IDBI;
import com.google.inject.Inject;
@@ -83,4 +84,14 @@ public class DefaultPaymentDao implements PaymentDao {
return sqlDao.getPaymentAttemptsForInvoiceIds(invoiceIds);
}
+ @Override
+ public void updatePaymentAttemptWithRetryInfo(UUID paymentAttemptId, int retryCount, DateTime nextRetryDate) {
+ sqlDao.updatePaymentAttemptWithRetryInfo(paymentAttemptId.toString(), retryCount, nextRetryDate);
+ }
+
+ @Override
+ public PaymentAttempt getPaymentAttemptById(UUID paymentAttemptId) {
+ return sqlDao.getPaymentAttemptById(paymentAttemptId.toString());
+ }
+
}
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 4d4a411..01716c5 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
@@ -19,6 +19,8 @@ package com.ning.billing.payment.dao;
import java.util.List;
import java.util.UUID;
+import org.joda.time.DateTime;
+
import com.ning.billing.invoice.api.Invoice;
import com.ning.billing.payment.api.PaymentAttempt;
import com.ning.billing.payment.api.PaymentInfo;
@@ -34,6 +36,7 @@ public interface PaymentDao {
List<PaymentAttempt> getPaymentAttemptsForInvoiceIds(List<String> invoiceIds);
void updatePaymentAttemptWithPaymentId(UUID paymentAttemptId, String paymentId);
+ void updatePaymentAttemptWithRetryInfo(UUID paymentAttemptId, int retryCount, DateTime nextRetryDate);
PaymentAttempt getPaymentAttemptForInvoiceId(String invoiceId);
@@ -41,4 +44,6 @@ public interface PaymentDao {
List<PaymentInfo> getPaymentInfo(List<String> invoiceIds);
+ PaymentAttempt getPaymentAttemptById(UUID 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 13b5f51..b2566e4 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
@@ -55,6 +55,10 @@ public interface PaymentSqlDao extends Transactional<PaymentSqlDao>, CloseMe, Tr
@SqlQuery
@Mapper(PaymentAttemptMapper.class)
+ PaymentAttempt getPaymentAttemptById(@Bind("payment_attempt_id") String paymentAttemptId);
+
+ @SqlQuery
+ @Mapper(PaymentAttemptMapper.class)
PaymentAttempt getPaymentAttemptForInvoiceId(@Bind("invoice_id") String invoiceId);
@SqlQuery
@@ -66,6 +70,11 @@ public interface PaymentSqlDao extends Transactional<PaymentSqlDao>, CloseMe, Tr
@Bind("payment_id") String paymentId);
@SqlUpdate
+ void updatePaymentAttemptWithRetryInfo(@Bind("payment_attempt_id") String paymentAttemptId,
+ @Bind("retry_count") int retryCount,
+ @Bind("next_retry_dt") DateTime nextRetryDate);
+
+ @SqlUpdate
void updatePaymentInfo(@Bind("payment_method") String paymentMethod,
@Bind("payment_id") String paymentId,
@Bind("card_type") String cardType,
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 49acce3..31020cc 100644
--- a/payment/src/main/java/com/ning/billing/payment/RetryService.java
+++ b/payment/src/main/java/com/ning/billing/payment/RetryService.java
@@ -16,6 +16,8 @@
package com.ning.billing.payment;
+import java.util.UUID;
+
import org.joda.time.DateTime;
import org.skife.jdbi.v2.sqlobject.mixins.Transmogrifier;
@@ -23,6 +25,8 @@ import com.google.inject.Inject;
import com.ning.billing.lifecycle.KillbillService;
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.setup.PaymentConfig;
import com.ning.billing.util.notificationq.NotificationKey;
import com.ning.billing.util.notificationq.NotificationQueue;
@@ -36,11 +40,15 @@ public class RetryService implements KillbillService {
private final NotificationQueueService notificationQueueService;
private final PaymentConfig config;
+ private final PaymentApi paymentApi;
private NotificationQueue retryQueue;
@Inject
- public RetryService(NotificationQueueService notificationQueueService, PaymentConfig config) {
+ public RetryService(NotificationQueueService notificationQueueService,
+ PaymentConfig config,
+ PaymentApi paymentApi) {
this.notificationQueueService = notificationQueueService;
+ this.paymentApi = paymentApi;
this.config = config;
}
@@ -85,6 +93,6 @@ public class RetryService implements KillbillService {
}
private void retry(String paymentAttemptId) {
- // TODO
+ paymentApi.createPayment(UUID.fromString(paymentAttemptId));
}
}
diff --git a/payment/src/main/java/com/ning/billing/payment/setup/PaymentConfig.java b/payment/src/main/java/com/ning/billing/payment/setup/PaymentConfig.java
index af0b3d8..6ec83c4 100644
--- a/payment/src/main/java/com/ning/billing/payment/setup/PaymentConfig.java
+++ b/payment/src/main/java/com/ning/billing/payment/setup/PaymentConfig.java
@@ -31,8 +31,8 @@ public interface PaymentConfig extends NotificationConfig {
public String getDefaultPaymentProvider();
@Config("killbill.payment.retry.days")
- @DefaultNull
- public List<String> getPaymentRetryDays();
+ @Default("8,8,8")
+ public List<Integer> getPaymentRetryDays();
@Config("killbill.payment.dao.claim.time")
@Default("60000")
@@ -47,7 +47,8 @@ public interface PaymentConfig extends NotificationConfig {
public long getNotificationSleepTimeMs();
@Config("killbill.payment.engine.events.off")
- @Default("false")
+ // turn off payment retries by default
+ @Default("true")
public boolean isNotificationProcessingOff();
}
diff --git a/payment/src/main/resources/com/ning/billing/payment/dao/PaymentSqlDao.sql.stg b/payment/src/main/resources/com/ning/billing/payment/dao/PaymentSqlDao.sql.stg
index aea2272..a2ea441 100644
--- a/payment/src/main/resources/com/ning/billing/payment/dao/PaymentSqlDao.sql.stg
+++ b/payment/src/main/resources/com/ning/billing/payment/dao/PaymentSqlDao.sql.stg
@@ -44,6 +44,12 @@ getPaymentAttemptForPaymentId() ::= <<
WHERE payment_id = :payment_id
>>
+getPaymentAttemptById() ::= <<
+ SELECT <paymentAttemptFields()>
+ FROM payment_attempts
+ WHERE payment_attempt_id = :payment_attempt_id
+>>
+
getPaymentAttemptsForInvoiceIds(invoiceIds) ::= <<
SELECT <paymentAttemptFields()>
FROM payment_attempts
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 786ef34..1f8f681 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
@@ -208,4 +208,5 @@ public abstract class TestPaymentApi {
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 071ce94..4c60171 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
@@ -22,6 +22,8 @@ import java.util.Map;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
+import org.joda.time.DateTime;
+
import com.google.common.base.Predicate;
import com.google.common.collect.Collections2;
import com.ning.billing.invoice.api.Invoice;
@@ -82,8 +84,11 @@ public class MockPaymentDao implements PaymentDao {
@Override
public void updatePaymentInfo(String paymentMethodType, String paymentId, String cardType, String cardCountry) {
- // TODO Auto-generated method stub
-
+ PaymentInfo existingPayment = payments.get(paymentId);
+ if (existingPayment != null) {
+ PaymentInfo payment = existingPayment.cloner().setPaymentMethod(paymentMethodType).setCardType(cardType).setCardCountry(cardCountry).build();
+ payments.put(paymentId, payment);
+ }
}
@Override
@@ -114,4 +119,18 @@ public class MockPaymentDao implements PaymentDao {
return paymentAttempts;
}
+ @Override
+ public void updatePaymentAttemptWithRetryInfo(UUID paymentAttemptId, int retryCount, DateTime nextRetryDate) {
+ PaymentAttempt existingAttempt = paymentAttempts.get(paymentAttemptId);
+ if (existingAttempt != null) {
+ PaymentAttempt attempt = existingAttempt.cloner().setPaymentAttemptId(paymentAttemptId).setRetryCount(retryCount).setNextRetryDate(nextRetryDate).build();
+ paymentAttempts.put(paymentAttemptId, attempt);
+ }
+ }
+
+ @Override
+ public PaymentAttempt getPaymentAttemptById(UUID paymentAttemptId) {
+ return paymentAttempts.get(paymentAttemptId);
+ }
+
}
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 7d65b8b..18b0a15 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
@@ -95,6 +95,10 @@ public abstract class TestPaymentDao {
Assert.assertEquals(attempt, attempt3);
+ PaymentAttempt attempt4 = paymentDao.getPaymentAttemptById(attempt3.getPaymentAttemptId());
+
+ Assert.assertEquals(attempt3, attempt4);
+
PaymentInfo originalPaymentInfo = new PaymentInfo.Builder().setPaymentId(paymentId)
.setAmount(invoiceAmount)
.setStatus("Processed")
diff --git a/payment/src/test/java/com/ning/billing/payment/TestNotifyInvoicePaymentApi.java b/payment/src/test/java/com/ning/billing/payment/TestNotifyInvoicePaymentApi.java
index 80de67f..e691f25 100644
--- a/payment/src/test/java/com/ning/billing/payment/TestNotifyInvoicePaymentApi.java
+++ b/payment/src/test/java/com/ning/billing/payment/TestNotifyInvoicePaymentApi.java
@@ -20,7 +20,6 @@ import static org.testng.Assert.assertNotNull;
import java.util.UUID;
-import com.ning.billing.invoice.api.InvoicePayment;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Guice;
@@ -31,8 +30,10 @@ import com.ning.billing.account.api.Account;
import com.ning.billing.account.api.AccountApiException;
import com.ning.billing.account.glue.AccountModuleWithMocks;
import com.ning.billing.invoice.api.Invoice;
+import com.ning.billing.invoice.api.InvoicePayment;
import com.ning.billing.invoice.api.InvoicePaymentApi;
import com.ning.billing.invoice.glue.InvoiceModuleWithMocks;
+import com.ning.billing.payment.api.PaymentAttempt;
import com.ning.billing.payment.setup.PaymentTestModuleWithMocks;
import com.ning.billing.util.bus.Bus;
import com.ning.billing.util.bus.Bus.EventBusException;