Details
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 06d954f..852d4fc 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
@@ -16,6 +16,24 @@
package com.ning.billing.analytics.api;
+import static org.testng.Assert.fail;
+
+import java.io.IOException;
+import java.math.BigDecimal;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.UUID;
+
+import org.apache.commons.io.IOUtils;
+import org.joda.time.DateTime;
+import org.testng.Assert;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Guice;
+import org.testng.annotations.Test;
+
import com.google.inject.Inject;
import com.ning.billing.account.api.Account;
import com.ning.billing.account.api.AccountCreationNotification;
@@ -62,23 +80,6 @@ import com.ning.billing.util.tag.DefaultTagDefinition;
import com.ning.billing.util.tag.DescriptiveTag;
import com.ning.billing.util.tag.Tag;
import com.ning.billing.util.tag.dao.TagDefinitionSqlDao;
-import org.apache.commons.io.IOUtils;
-import org.joda.time.DateTime;
-import org.testng.Assert;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Guice;
-import org.testng.annotations.Test;
-
-import java.io.IOException;
-import java.math.BigDecimal;
-import java.sql.SQLException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.UUID;
-
-import static org.testng.Assert.fail;
@Guice(modules = AnalyticsTestModule.class)
public class TestAnalyticsService {
@@ -242,7 +243,7 @@ public class TestAnalyticsService {
paymentInfoNotification = new PaymentInfo.Builder().setPaymentId(UUID.randomUUID().toString()).setPaymentMethod(PAYMENT_METHOD).setCardCountry(CARD_COUNTRY).build();
final PaymentAttempt paymentAttempt = new PaymentAttempt(UUID.randomUUID(), invoice.getId(), account.getId(), BigDecimal.TEN,
- ACCOUNT_CURRENCY, clock.getUTCNow(), clock.getUTCNow(), paymentInfoNotification.getPaymentId(), 1, clock.getUTCNow().plusDays(1));
+ ACCOUNT_CURRENCY, clock.getUTCNow(), clock.getUTCNow(), paymentInfoNotification.getPaymentId(), 1);
paymentDao.createPaymentAttempt(paymentAttempt);
paymentDao.savePaymentInfo(paymentInfoNotification);
Assert.assertEquals(paymentDao.getPaymentInfo(Arrays.asList(invoice.getId().toString())).size(), 1);
diff --git a/api/src/main/java/com/ning/billing/payment/api/PaymentAttempt.java b/api/src/main/java/com/ning/billing/payment/api/PaymentAttempt.java
index b099739..8085310 100644
--- a/api/src/main/java/com/ning/billing/payment/api/PaymentAttempt.java
+++ b/api/src/main/java/com/ning/billing/payment/api/PaymentAttempt.java
@@ -36,7 +36,6 @@ public class PaymentAttempt {
private final DateTime invoiceDate;
private final DateTime paymentAttemptDate;
private final Integer retryCount;
- private final DateTime nextRetryDate;
private final DateTime createdDate;
private final DateTime updatedDate;
@@ -49,7 +48,6 @@ public class PaymentAttempt {
DateTime paymentAttemptDate,
String paymentId,
Integer retryCount,
- DateTime nextRetryDate,
DateTime createdDate,
DateTime updatedDate) {
this.paymentAttemptId = paymentAttemptId;
@@ -61,7 +59,6 @@ public class PaymentAttempt {
this.paymentAttemptDate = paymentAttemptDate == null ? new DateTime(DateTimeZone.UTC) : paymentAttemptDate;
this.paymentId = paymentId;
this.retryCount = retryCount == null ? 0 : retryCount;
- this.nextRetryDate = nextRetryDate;
this.createdDate = createdDate == null ? new DateTime(DateTimeZone.UTC) : createdDate;
this.updatedDate = updatedDate == null ? new DateTime(DateTimeZone.UTC) : updatedDate;
}
@@ -74,8 +71,7 @@ public class PaymentAttempt {
DateTime invoiceDate,
DateTime paymentAttemptDate,
String paymentId,
- Integer retryCount,
- DateTime nextRetryDate) {
+ Integer retryCount) {
this(paymentAttemptId,
invoiceId,
accountId,
@@ -85,21 +81,20 @@ public class PaymentAttempt {
paymentAttemptDate,
paymentId,
retryCount,
- nextRetryDate,
null,
null);
}
public PaymentAttempt(UUID paymentAttemptId, UUID invoiceId, UUID accountId, BigDecimal amount, Currency currency, DateTime invoiceDate, DateTime paymentAttemptDate) {
- this(paymentAttemptId, invoiceId, accountId, amount, currency, invoiceDate, paymentAttemptDate, null, null, null);
+ this(paymentAttemptId, invoiceId, accountId, amount, currency, invoiceDate, paymentAttemptDate, null, null);
}
public PaymentAttempt(UUID paymentAttemptId, UUID invoiceId, UUID accountId, DateTime invoiceDate, DateTime paymentAttemptDate) {
- this(paymentAttemptId, invoiceId, accountId, null, null, invoiceDate, paymentAttemptDate, null, null, null);
+ this(paymentAttemptId, invoiceId, accountId, null, null, invoiceDate, paymentAttemptDate, null, null);
}
public PaymentAttempt(UUID paymentAttemptId, Invoice invoice) {
- this(paymentAttemptId, invoice.getId(), invoice.getAccountId(), invoice.getBalance(), invoice.getCurrency(), invoice.getInvoiceDate(), null, null, null, null);
+ this(paymentAttemptId, invoice.getId(), invoice.getAccountId(), invoice.getBalance(), invoice.getCurrency(), invoice.getInvoiceDate(), null, null, null);
}
public DateTime getInvoiceDate() {
@@ -146,13 +141,9 @@ public class PaymentAttempt {
return retryCount;
}
- public DateTime getNextRetryDate() {
- return nextRetryDate;
- }
-
@Override
public String toString() {
- return "PaymentAttempt [paymentAttemptId=" + paymentAttemptId + ", invoiceId=" + invoiceId + ", accountId=" + accountId + ", amount=" + amount + ", currency=" + currency + ", paymentId=" + paymentId + ", invoiceDate=" + invoiceDate + ", paymentAttemptDate=" + paymentAttemptDate + ", retryCount=" + retryCount + ", nextRetryDate=" + nextRetryDate + ", createdDate=" + createdDate + ", updatedDate=" + updatedDate + "]";
+ return "PaymentAttempt [paymentAttemptId=" + paymentAttemptId + ", invoiceId=" + invoiceId + ", accountId=" + accountId + ", amount=" + amount + ", currency=" + currency + ", paymentId=" + paymentId + ", invoiceDate=" + invoiceDate + ", paymentAttemptDate=" + paymentAttemptDate + ", retryCount=" + retryCount + ", createdDate=" + createdDate + ", updatedDate=" + updatedDate + "]";
}
public Builder cloner() {
@@ -169,7 +160,6 @@ public class PaymentAttempt {
private DateTime paymentAttemptDate;
private String paymentId;
private Integer retryCount;
- private DateTime nextRetryDate;
private DateTime createdDate;
private DateTime updatedDate;
@@ -186,7 +176,6 @@ public class PaymentAttempt {
this.paymentAttemptDate = src.paymentAttemptDate;
this.paymentId = src.paymentId;
this.retryCount = src.retryCount;
- this.nextRetryDate = src.nextRetryDate;
this.createdDate = src.createdDate;
this.updatedDate = src.updatedDate;
}
@@ -246,11 +235,6 @@ public class PaymentAttempt {
return this;
}
- public Builder setNextRetryDate(DateTime nextRetryDate) {
- this.nextRetryDate = nextRetryDate;
- return this;
- }
-
public PaymentAttempt build() {
return new PaymentAttempt(paymentAttemptId,
invoiceId,
@@ -261,7 +245,6 @@ public class PaymentAttempt {
paymentAttemptDate,
paymentId,
retryCount,
- nextRetryDate,
createdDate,
updatedDate);
}
@@ -279,7 +262,6 @@ public class PaymentAttempt {
paymentAttemptDate,
paymentId,
retryCount,
- nextRetryDate,
createdDate,
updatedDate);
}
@@ -297,8 +279,6 @@ public class PaymentAttempt {
if (currency != that.currency) return false;
if (invoiceDate != null ? !(getUnixTimestamp(invoiceDate) == getUnixTimestamp(that.invoiceDate)) : that.invoiceDate != null) return false;
if (invoiceId != null ? !invoiceId.equals(that.invoiceId) : that.invoiceId != null) return false;
- if (nextRetryDate != null ? !(getUnixTimestamp(nextRetryDate) == getUnixTimestamp(that.nextRetryDate)) : that.nextRetryDate != null)
- return false;
if (paymentAttemptDate != null ? !(getUnixTimestamp(paymentAttemptDate) == getUnixTimestamp(that.paymentAttemptDate)) : that.paymentAttemptDate != null)
return false;
if (paymentAttemptId != null ? !paymentAttemptId.equals(that.paymentAttemptId) : that.paymentAttemptId != null)
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 4dd5040..3d8740a 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
@@ -154,7 +154,13 @@ public class DefaultPaymentApi implements PaymentApi {
paymentAttempt.getInvoiceId()));
}
else {
- return processPayment(getPaymentProviderPlugin(account), account, invoice, paymentAttempt);
+ PaymentAttempt newPaymentAttempt = new PaymentAttempt.Builder(paymentAttempt)
+ .setRetryCount(paymentAttempt.getRetryCount() + 1)
+ .setPaymentAttemptId(UUID.randomUUID())
+ .build();
+
+ paymentDao.createPaymentAttempt(newPaymentAttempt);
+ return processPayment(getPaymentProviderPlugin(account), account, invoice, newPaymentAttempt);
}
}
}
@@ -258,7 +264,6 @@ public class DefaultPaymentApi implements PaymentApi {
}
retryService.scheduleRetry(paymentAttempt, nextRetryDate);
- paymentDao.updatePaymentAttemptWithRetryInfo(paymentAttempt.getPaymentAttemptId(), retryCount + 1, nextRetryDate);
}
else if (retryCount == retryDays.size()) {
log.info("Last payment retry failed for {} ", paymentAttempt);
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 49a4165..00cdb31 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
@@ -16,11 +16,9 @@
package com.ning.billing.payment.dao;
-import java.util.Date;
import java.util.List;
import java.util.UUID;
-import org.joda.time.DateTime;
import org.skife.jdbi.v2.IDBI;
import com.google.common.collect.ImmutableList;
@@ -98,13 +96,6 @@ public class DefaultPaymentDao implements PaymentDao {
}
@Override
- public void updatePaymentAttemptWithRetryInfo(UUID paymentAttemptId, int retryCount, DateTime nextRetryDate) {
-
- final Date retryDate = nextRetryDate == null ? null : nextRetryDate.toDate();
- sqlDao.updatePaymentAttemptWithRetryInfo(paymentAttemptId.toString(), retryCount, retryDate, clock.getUTCNow().toDate());
- }
-
- @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 de2d8cc..2c9ee06 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,8 +19,6 @@ 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;
@@ -36,7 +34,6 @@ 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);
@@ -46,5 +43,4 @@ public interface PaymentDao {
PaymentAttempt getPaymentAttemptById(UUID paymentAttemptId);
PaymentInfo 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 ea564f3..69117fb 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
@@ -77,11 +77,9 @@ public interface PaymentSqlDao extends Transactional<PaymentSqlDao>, CloseMe, Tr
@SqlUpdate
void updatePaymentAttemptWithRetryInfo(@Bind("payment_attempt_id") String paymentAttemptId,
@Bind("retry_count") int retryCount,
- @Bind("next_retry_dt") Date nextRetryDate,
@Bind("updated_dt") Date updatedDate);
@SqlUpdate
-
void updatePaymentInfo(@Bind("payment_method") String paymentMethod,
@Bind("payment_id") String paymentId,
@Bind("card_type") String cardType,
@@ -112,7 +110,6 @@ public interface PaymentSqlDao extends Transactional<PaymentSqlDao>, CloseMe, Tr
stmt.bind("payment_attempt_dt", getDate(paymentAttempt.getPaymentAttemptDate()));
stmt.bind("payment_id", paymentAttempt.getPaymentId());
stmt.bind("retry_count", paymentAttempt.getRetryCount());
- stmt.bind("next_retry_dt", getDate(paymentAttempt.getNextRetryDate()));
stmt.bind("created_dt", getDate(paymentAttempt.getCreatedDate()));
stmt.bind("updated_dt", getDate(paymentAttempt.getUpdatedDate()));
}
@@ -137,7 +134,6 @@ public interface PaymentSqlDao extends Transactional<PaymentSqlDao>, CloseMe, Tr
DateTime paymentAttemptDate = getDate(rs, "payment_attempt_dt");
String paymentId = rs.getString("payment_id");
Integer retryCount = rs.getInt("retry_count");
- DateTime nextRetryDate = getDate(rs, "next_retry_dt");
DateTime createdDate = getDate(rs, "created_dt");
DateTime updatedDate = getDate(rs, "updated_dt");
@@ -150,7 +146,6 @@ public interface PaymentSqlDao extends Transactional<PaymentSqlDao>, CloseMe, Tr
paymentAttemptDate,
paymentId,
retryCount,
- nextRetryDate,
createdDate,
updatedDate);
}
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 ee57397..b4ceb5f 100644
--- a/payment/src/main/java/com/ning/billing/payment/RetryService.java
+++ b/payment/src/main/java/com/ning/billing/payment/RetryService.java
@@ -96,7 +96,10 @@ public class RetryService implements KillbillService {
private void retry(String paymentAttemptId) {
PaymentInfo paymentInfo = paymentApi.getPaymentInfoForPaymentAttemptId(paymentAttemptId);
- if (paymentInfo == null || !PaymentStatus.Processed.equals(PaymentStatus.valueOf(paymentInfo.getStatus()))) {
+ if (paymentInfo != null && PaymentStatus.Processed.equals(PaymentStatus.valueOf(paymentInfo.getStatus()))) {
+ // update payment attempt with success and notify invoice api of payment
+ }
+ else {
paymentApi.createPaymentForPaymentAttempt(UUID.fromString(paymentAttemptId));
}
}
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 b349b5e..91eeb22 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
@@ -10,7 +10,6 @@ paymentAttemptFields(prefix) ::= <<
<prefix>payment_attempt_dt,
<prefix>invoice_dt,
<prefix>retry_count,
- <prefix>next_retry_dt,
<prefix>created_dt,
<prefix>updated_dt
>>
@@ -35,7 +34,7 @@ paymentInfoFields(prefix) ::= <<
insertPaymentAttempt() ::= <<
INSERT INTO payment_attempts (<paymentAttemptFields()>)
- VALUES (:payment_attempt_id, :invoice_id, :account_id, :amount, :currency, :payment_id, :payment_attempt_dt, :invoice_dt, :retry_count, :next_retry_dt, :created_dt, :updated_dt);
+ VALUES (:payment_attempt_id, :invoice_id, :account_id, :amount, :currency, :payment_id, :payment_attempt_dt, :invoice_dt, :retry_count, :created_dt, :updated_dt);
>>
getPaymentAttemptForPaymentId() ::= <<
@@ -83,17 +82,16 @@ updatePaymentInfo() ::= <<
WHERE payment_id = :payment_id
>>
-updatePaymentAttemptWithRetryInfo() ::= <<
- UPDATE payment_attempts
- SET retry_count = :retry_count,
- next_retry_dt = :next_retry_dt,
- updated_dt = :updated_dt
- WHERE payment_attempt_id = :payment_attempt_id
->>
-
getPaymentInfos(invoiceIds) ::= <<
SELECT <paymentInfoFields("p.")>
FROM payments p, payment_attempts pa
WHERE pa.invoice_id in (<invoiceIds>)
AND pa.payment_id = p.payment_id
->>
\ No newline at end of file
+>>
+
+getPaymentInfoForPaymentAttemptId() ::= <<
+ SELECT <paymentInfoFields("p.")>
+ FROM payments p, payment_attempts pa
+ WHERE pa.payment_attempt_id = :payment_attempt_id
+ AND pa.payment_id = p.payment_id
+>>
diff --git a/payment/src/main/resources/com/ning/billing/payment/ddl.sql b/payment/src/main/resources/com/ning/billing/payment/ddl.sql
index abbd8a6..3d0cc1a 100644
--- a/payment/src/main/resources/com/ning/billing/payment/ddl.sql
+++ b/payment/src/main/resources/com/ning/billing/payment/ddl.sql
@@ -8,7 +8,6 @@ CREATE TABLE payment_attempts (
payment_attempt_dt datetime NOT NULL,
payment_id varchar(36) COLLATE utf8_bin,
retry_count tinyint,
- next_retry_dt datetime,
invoice_dt datetime NOT NULL,
created_dt datetime NOT NULL,
updated_dt datetime NOT NULL,
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 10b81da..b4bfb51 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
@@ -23,13 +23,13 @@ import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
import org.joda.time.DateTime;
+import org.joda.time.DateTimeZone;
import com.google.common.base.Predicate;
import com.google.common.collect.Collections2;
import com.ning.billing.invoice.api.Invoice;
import com.ning.billing.payment.api.PaymentAttempt;
import com.ning.billing.payment.api.PaymentInfo;
-import org.joda.time.DateTimeZone;
public class MockPaymentDao implements PaymentDao {
private final Map<String, PaymentInfo> payments = new ConcurrentHashMap<String, PaymentInfo>();
@@ -127,15 +127,6 @@ public class MockPaymentDao implements PaymentDao {
}
@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 6318d28..70708eb 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
@@ -16,18 +16,19 @@
package com.ning.billing.payment.dao;
-import com.ning.billing.account.api.AccountApiException;
-import com.ning.billing.catalog.api.Currency;
-import com.ning.billing.payment.api.PaymentAttempt;
-import com.ning.billing.payment.api.PaymentInfo;
+import java.math.BigDecimal;
+import java.util.Arrays;
+import java.util.UUID;
+
import org.joda.time.DateTime;
import org.joda.time.DateTimeZone;
import org.testng.Assert;
import org.testng.annotations.Test;
-import java.math.BigDecimal;
-import java.util.Arrays;
-import java.util.UUID;
+import com.ning.billing.account.api.AccountApiException;
+import com.ning.billing.catalog.api.Currency;
+import com.ning.billing.payment.api.PaymentAttempt;
+import com.ning.billing.payment.api.PaymentInfo;
public abstract class TestPaymentDao {
@@ -69,7 +70,6 @@ public abstract class TestPaymentDao {
paymentDao.savePaymentInfo(paymentInfo);
paymentDao.updatePaymentInfo("CreditCard", paymentInfo.getPaymentId(), "Visa", "US");
-
}
@Test
@@ -86,8 +86,6 @@ public abstract class TestPaymentDao {
.build();
paymentDao.createPaymentAttempt(paymentAttempt);
-
- paymentDao.updatePaymentAttemptWithRetryInfo(paymentAttempt.getPaymentAttemptId(), 1, paymentAttempt.getCreatedDate().plusDays(1));
}
@Test
@@ -101,7 +99,7 @@ public abstract class TestPaymentDao {
// Move the clock backwards to test the updated_date field (see below)
final DateTime now = new DateTime(DateTimeZone.UTC).minusDays(1);
- PaymentAttempt originalPaymenAttempt = new PaymentAttempt(paymentAttemptId, invoiceId, accountId, invoiceAmount, Currency.USD, now, now, paymentId, null, null);
+ PaymentAttempt originalPaymenAttempt = new PaymentAttempt(paymentAttemptId, invoiceId, accountId, invoiceAmount, Currency.USD, now, now, paymentId, 0);
PaymentAttempt attempt = paymentDao.createPaymentAttempt(originalPaymenAttempt);
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 6a08eb5..75a21ee 100644
--- a/payment/src/test/java/com/ning/billing/payment/TestRetryService.java
+++ b/payment/src/test/java/com/ning/billing/payment/TestRetryService.java
@@ -134,12 +134,10 @@ public class TestRetryService {
assertNotNull(paymentAttempt);
assertEquals(notification.getNotificationKey(), paymentAttempt.getPaymentAttemptId().toString());
- assertEquals(paymentAttempt.getRetryCount(), new Integer(1));
DateTime expectedRetryDate = paymentAttempt.getPaymentAttemptDate().plusDays(paymentConfig.getPaymentRetryDays().get(0));
assertEquals(notification.getEffectiveDate(), expectedRetryDate);
- assertEquals(paymentAttempt.getNextRetryDate(), expectedRetryDate);
}
@Test
@@ -166,14 +164,13 @@ public class TestRetryService {
PaymentAttempt paymentAttempt = new PaymentAttempt(UUID.randomUUID(), invoice).cloner()
.setRetryCount(1)
.setPaymentAttemptDate(paymentAttemptDate)
- .setNextRetryDate(nextRetryDate)
.build();
paymentDao.createPaymentAttempt(paymentAttempt);
retryService.scheduleRetry(paymentAttempt, nextRetryDate);
// wait a little to give the queue time to process
- Thread.sleep(paymentConfig.getNotificationSleepTimeMs() * 2);
+ Thread.sleep(paymentConfig.getNotificationSleepTimeMs() * 10);
List<Notification> pendingNotifications = mockNotificationQueue.getPendingEvents();
@@ -189,7 +186,6 @@ public class TestRetryService {
PaymentAttempt updatedAttempt = paymentApi.getPaymentAttemptForInvoiceId(invoice.getId().toString());
- assertEquals(updatedAttempt.getPaymentAttemptId(), paymentAttempt.getPaymentAttemptId());
assertEquals(paymentInfo.getPaymentId(), updatedAttempt.getPaymentId());
}