Details
diff --git a/jaxrs/src/main/java/org/killbill/billing/jaxrs/json/PaymentTransactionJson.java b/jaxrs/src/main/java/org/killbill/billing/jaxrs/json/PaymentTransactionJson.java
index ea4b703..09fb976 100644
--- a/jaxrs/src/main/java/org/killbill/billing/jaxrs/json/PaymentTransactionJson.java
+++ b/jaxrs/src/main/java/org/killbill/billing/jaxrs/json/PaymentTransactionJson.java
@@ -79,21 +79,21 @@ public class PaymentTransactionJson extends JsonBase {
this.properties = properties;
}
- public PaymentTransactionJson(final PaymentTransaction dpt, final String paymentExternalKey, @Nullable final List<AuditLog> transactionLogs) {
- this(dpt.getId().toString(),
- dpt.getExternalKey(),
- dpt.getPaymentId().toString(),
+ public PaymentTransactionJson(final PaymentTransaction transaction, final String paymentExternalKey, @Nullable final List<AuditLog> transactionLogs) {
+ this(transaction.getId().toString(),
+ transaction.getExternalKey(),
+ transaction.getPaymentId().toString(),
paymentExternalKey,
- dpt.getTransactionType().toString(),
- dpt.getAmount(),
- dpt.getCurrency() != null ? dpt.getCurrency().toString() : null,
- dpt.getEffectiveDate(),
- dpt.getTransactionStatus() != null ? dpt.getTransactionStatus().toString() : null,
- dpt.getGatewayErrorCode(),
- dpt.getGatewayErrorMsg(),
- dpt.getPaymentInfoPlugin() == null ? null : dpt.getPaymentInfoPlugin().getFirstPaymentReferenceId(),
- dpt.getPaymentInfoPlugin() == null ? null : dpt.getPaymentInfoPlugin().getSecondPaymentReferenceId(),
- dpt.getPaymentInfoPlugin() == null ? null : toPluginPropertyJson(dpt.getPaymentInfoPlugin().getProperties()),
+ transaction.getTransactionType().toString(),
+ transaction.getAmount(),
+ transaction.getCurrency() != null ? transaction.getCurrency().toString() : null,
+ transaction.getEffectiveDate(),
+ transaction.getTransactionStatus() != null ? transaction.getTransactionStatus().toString() : null,
+ transaction.getGatewayErrorCode(),
+ transaction.getGatewayErrorMsg(),
+ transaction.getPaymentInfoPlugin() == null ? null : transaction.getPaymentInfoPlugin().getFirstPaymentReferenceId(),
+ transaction.getPaymentInfoPlugin() == null ? null : transaction.getPaymentInfoPlugin().getSecondPaymentReferenceId(),
+ transaction.getPaymentInfoPlugin() == null ? null : toPluginPropertyJson(transaction.getPaymentInfoPlugin().getProperties()),
toAuditLogJson(transactionLogs));
}
diff --git a/payment/src/main/java/org/killbill/billing/payment/api/DefaultPaymentApi.java b/payment/src/main/java/org/killbill/billing/payment/api/DefaultPaymentApi.java
index 75eab9a..087174e 100644
--- a/payment/src/main/java/org/killbill/billing/payment/api/DefaultPaymentApi.java
+++ b/payment/src/main/java/org/killbill/billing/payment/api/DefaultPaymentApi.java
@@ -134,7 +134,6 @@ public class DefaultPaymentApi implements PaymentApi {
final InternalCallContext internalCallContext = internalCallContextFactory.createInternalCallContext(account.getId(), callContext);
- // STEPH should throw PaymentApiException -- at least when coming from API; also add description.
final UUID nonNulPaymentMethodId = (paymentMethodId != null) ?
paymentMethodId :
paymentMethodProcessor.createOrGetExternalPaymentMethod(UUID.randomUUID().toString(), account, properties, callContext, internalCallContext);
@@ -300,7 +299,7 @@ public class DefaultPaymentApi implements PaymentApi {
return payment;
}
- // STEPH TODO withPluginInfo needs to be honored...
+ // TODO withPluginInfo needs to be honored...
@Override
public Pagination<Payment> searchPayments(final String searchKey, final Long offset, final Long limit, final boolean withPluginInfo, final Iterable<PluginProperty> properties, final TenantContext context) {
return paymentProcessor.searchPayments(searchKey, offset, limit, properties, context, internalCallContextFactory.createInternalTenantContext(context));
diff --git a/payment/src/main/java/org/killbill/billing/payment/control/dao/InvoicePaymentControlDao.java b/payment/src/main/java/org/killbill/billing/payment/control/dao/InvoicePaymentControlDao.java
index b9920c0..0d59ea4 100644
--- a/payment/src/main/java/org/killbill/billing/payment/control/dao/InvoicePaymentControlDao.java
+++ b/payment/src/main/java/org/killbill/billing/payment/control/dao/InvoicePaymentControlDao.java
@@ -63,7 +63,7 @@ public class InvoicePaymentControlDao {
return dbi.withHandle(new HandleCallback<List<PluginAutoPayOffModelDao>>() {
@Override
public List<PluginAutoPayOffModelDao> withHandle(final Handle handle) throws Exception {
- final List<Map<String, Object>> queryResult = handle.select("select * from _invoice_payment_control_plugin_auto_pay_off where account_id = ?", accountId.toString());
+ final List<Map<String, Object>> queryResult = handle.select("select * from _invoice_payment_control_plugin_auto_pay_off where account_id = ? and is_active", accountId.toString());
final List<PluginAutoPayOffModelDao> result = new ArrayList<PluginAutoPayOffModelDao>(queryResult.size());
for (final Map<String, Object> row : queryResult) {
@@ -87,12 +87,11 @@ public class InvoicePaymentControlDao {
});
}
- // STEPH soft delete?
public void removeAutoPayOffEntry(final UUID accountId) {
dbi.withHandle(new HandleCallback<Void>() {
@Override
public Void withHandle(final Handle handle) throws Exception {
- handle.execute("delete from _invoice_payment_control_plugin_auto_pay_off where account_id = ?", accountId.toString());
+ handle.execute("update _invoice_payment_control_plugin_auto_pay_off set is_active = 0 where account_id = ?", accountId.toString());
return null;
}
});
diff --git a/payment/src/main/resources/org/killbill/billing/payment/ddl.sql b/payment/src/main/resources/org/killbill/billing/payment/ddl.sql
index d0ca568..a97090b 100644
--- a/payment/src/main/resources/org/killbill/billing/payment/ddl.sql
+++ b/payment/src/main/resources/org/killbill/billing/payment/ddl.sql
@@ -221,6 +221,7 @@ CREATE TABLE _invoice_payment_control_plugin_auto_pay_off (
payment_method_id char(36) NOT NULL,
amount numeric(15,9),
currency char(3),
+ is_active bool DEFAULT true,
created_by varchar(50) NOT NULL,
created_date datetime NOT NULL,
PRIMARY KEY (record_id)