killbill-memoizeit
Changes
account/pom.xml 2(+1 -1)
analytics/pom.xml 2(+1 -1)
api/pom.xml 2(+1 -1)
beatrix/pom.xml 2(+1 -1)
catalog/pom.xml 2(+1 -1)
entitlement/pom.xml 2(+1 -1)
invoice/pom.xml 2(+1 -1)
jaxrs/pom.xml 2(+1 -1)
junction/pom.xml 2(+1 -1)
overdue/pom.xml 2(+1 -1)
payment/pom.xml 2(+1 -1)
pom.xml 2(+1 -1)
server/pom.xml 2(+1 -1)
usage/pom.xml 2(+1 -1)
util/pom.xml 2(+1 -1)
Details
account/pom.xml 2(+1 -1)
diff --git a/account/pom.xml b/account/pom.xml
index 08c9b82..24ef96d 100644
--- a/account/pom.xml
+++ b/account/pom.xml
@@ -13,7 +13,7 @@
<parent>
<groupId>com.ning.billing</groupId>
<artifactId>killbill</artifactId>
- <version>0.1.33-SNAPSHOT</version>
+ <version>0.1.34-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>killbill-account</artifactId>
analytics/pom.xml 2(+1 -1)
diff --git a/analytics/pom.xml b/analytics/pom.xml
index 53de795..2c1ca24 100644
--- a/analytics/pom.xml
+++ b/analytics/pom.xml
@@ -13,7 +13,7 @@
<parent>
<groupId>com.ning.billing</groupId>
<artifactId>killbill</artifactId>
- <version>0.1.33-SNAPSHOT</version>
+ <version>0.1.34-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>killbill-analytics</artifactId>
api/pom.xml 2(+1 -1)
diff --git a/api/pom.xml b/api/pom.xml
index 55bb654..fb3616f 100644
--- a/api/pom.xml
+++ b/api/pom.xml
@@ -13,7 +13,7 @@
<parent>
<groupId>com.ning.billing</groupId>
<artifactId>killbill</artifactId>
- <version>0.1.33-SNAPSHOT</version>
+ <version>0.1.34-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>killbill-api</artifactId>
beatrix/pom.xml 2(+1 -1)
diff --git a/beatrix/pom.xml b/beatrix/pom.xml
index e27395f..1701554 100644
--- a/beatrix/pom.xml
+++ b/beatrix/pom.xml
@@ -13,7 +13,7 @@
<parent>
<groupId>com.ning.billing</groupId>
<artifactId>killbill</artifactId>
- <version>0.1.33-SNAPSHOT</version>
+ <version>0.1.34-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>killbill-beatrix</artifactId>
catalog/pom.xml 2(+1 -1)
diff --git a/catalog/pom.xml b/catalog/pom.xml
index 38f9b36..768e35c 100644
--- a/catalog/pom.xml
+++ b/catalog/pom.xml
@@ -13,7 +13,7 @@
<parent>
<groupId>com.ning.billing</groupId>
<artifactId>killbill</artifactId>
- <version>0.1.33-SNAPSHOT</version>
+ <version>0.1.34-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>killbill-catalog</artifactId>
entitlement/pom.xml 2(+1 -1)
diff --git a/entitlement/pom.xml b/entitlement/pom.xml
index fb87ac7..6e619a1 100644
--- a/entitlement/pom.xml
+++ b/entitlement/pom.xml
@@ -13,7 +13,7 @@
<parent>
<groupId>com.ning.billing</groupId>
<artifactId>killbill</artifactId>
- <version>0.1.33-SNAPSHOT</version>
+ <version>0.1.34-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>killbill-entitlement</artifactId>
invoice/pom.xml 2(+1 -1)
diff --git a/invoice/pom.xml b/invoice/pom.xml
index 2175b23..f5325e8 100644
--- a/invoice/pom.xml
+++ b/invoice/pom.xml
@@ -13,7 +13,7 @@
<parent>
<groupId>com.ning.billing</groupId>
<artifactId>killbill</artifactId>
- <version>0.1.33-SNAPSHOT</version>
+ <version>0.1.34-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>killbill-invoice</artifactId>
jaxrs/pom.xml 2(+1 -1)
diff --git a/jaxrs/pom.xml b/jaxrs/pom.xml
index c17f07f..3dad564 100644
--- a/jaxrs/pom.xml
+++ b/jaxrs/pom.xml
@@ -13,7 +13,7 @@
<parent>
<groupId>com.ning.billing</groupId>
<artifactId>killbill</artifactId>
- <version>0.1.33-SNAPSHOT</version>
+ <version>0.1.34-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>killbill-jaxrs</artifactId>
junction/pom.xml 2(+1 -1)
diff --git a/junction/pom.xml b/junction/pom.xml
index 6036e03..afe2b87 100644
--- a/junction/pom.xml
+++ b/junction/pom.xml
@@ -13,7 +13,7 @@
<parent>
<groupId>com.ning.billing</groupId>
<artifactId>killbill</artifactId>
- <version>0.1.33-SNAPSHOT</version>
+ <version>0.1.34-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>killbill-junction</artifactId>
overdue/pom.xml 2(+1 -1)
diff --git a/overdue/pom.xml b/overdue/pom.xml
index 1446d42..6e67379 100644
--- a/overdue/pom.xml
+++ b/overdue/pom.xml
@@ -13,7 +13,7 @@
<parent>
<groupId>com.ning.billing</groupId>
<artifactId>killbill</artifactId>
- <version>0.1.33-SNAPSHOT</version>
+ <version>0.1.34-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>killbill-overdue</artifactId>
payment/pom.xml 2(+1 -1)
diff --git a/payment/pom.xml b/payment/pom.xml
index 0f9685f..cf53adf 100644
--- a/payment/pom.xml
+++ b/payment/pom.xml
@@ -13,7 +13,7 @@
<parent>
<groupId>com.ning.billing</groupId>
<artifactId>killbill</artifactId>
- <version>0.1.33-SNAPSHOT</version>
+ <version>0.1.34-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>killbill-payment</artifactId>
diff --git a/payment/src/main/java/com/ning/billing/payment/api/DefaultPaymentMethodPlugin.java b/payment/src/main/java/com/ning/billing/payment/api/DefaultPaymentMethodPlugin.java
index c0aefd3..b500ee4 100644
--- a/payment/src/main/java/com/ning/billing/payment/api/DefaultPaymentMethodPlugin.java
+++ b/payment/src/main/java/com/ning/billing/payment/api/DefaultPaymentMethodPlugin.java
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 2010-2011 Ning, Inc.
*
* Ning licenses this file to you under the Apache License, version 2.0
@@ -46,7 +46,11 @@ public class DefaultPaymentMethodPlugin implements PaymentMethodPlugin {
@Override
public String getValueString(final String key) {
- throw new RuntimeException("Not implemented");
+ for (PaymentMethodKVInfo cur : properties) {
+ if (cur.getKey().equals(key)) {
+ return cur.getValue() != null ? cur.getValue().toString() : null;
+ }
+ }
+ return null;
}
-
}
diff --git a/payment/src/main/java/com/ning/billing/payment/bus/InvoiceHandler.java b/payment/src/main/java/com/ning/billing/payment/bus/InvoiceHandler.java
index 8cae63a..2006984 100644
--- a/payment/src/main/java/com/ning/billing/payment/bus/InvoiceHandler.java
+++ b/payment/src/main/java/com/ning/billing/payment/bus/InvoiceHandler.java
@@ -20,8 +20,6 @@ package com.ning.billing.payment.bus;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import com.google.common.eventbus.Subscribe;
-import com.google.inject.Inject;
import com.ning.billing.ErrorCode;
import com.ning.billing.account.api.Account;
import com.ning.billing.account.api.AccountApiException;
@@ -36,6 +34,9 @@ import com.ning.billing.util.callcontext.DefaultCallContext;
import com.ning.billing.util.callcontext.UserType;
import com.ning.billing.util.clock.Clock;
+import com.google.common.eventbus.Subscribe;
+import com.google.inject.Inject;
+
public class InvoiceHandler {
@@ -74,7 +75,9 @@ public class InvoiceHandler {
} catch (AccountApiException e) {
log.error("Failed to process invoice payment", e);
} catch (PaymentApiException e) {
- if (e.getCode() != ErrorCode.PAYMENT_NULL_INVOICE.getCode()) {
+ // Log as error unless:
+ if (e.getCode() != ErrorCode.PAYMENT_NULL_INVOICE.getCode() /* Nothing to left be paid*/ &&
+ e.getCode() != ErrorCode.PAYMENT_CREATE_PAYMENT.getCode() /* User payment error */) {
log.error("Failed to process invoice payment {}", e.toString());
}
}
diff --git a/payment/src/main/java/com/ning/billing/payment/core/PaymentProcessor.java b/payment/src/main/java/com/ning/billing/payment/core/PaymentProcessor.java
index 241027b..b837f5e 100644
--- a/payment/src/main/java/com/ning/billing/payment/core/PaymentProcessor.java
+++ b/payment/src/main/java/com/ning/billing/payment/core/PaymentProcessor.java
@@ -33,9 +33,6 @@ import javax.inject.Inject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import com.google.common.base.Predicate;
-import com.google.common.collect.Collections2;
-import com.google.inject.name.Named;
import com.ning.billing.ErrorCode;
import com.ning.billing.account.api.Account;
import com.ning.billing.account.api.AccountApiException;
@@ -73,6 +70,10 @@ import com.ning.billing.util.callcontext.UserType;
import com.ning.billing.util.clock.Clock;
import com.ning.billing.util.globallocker.GlobalLocker;
+import com.google.common.base.Predicate;
+import com.google.common.collect.Collections2;
+import com.google.inject.name.Named;
+
public class PaymentProcessor extends ProcessorBase {
private final PaymentMethodProcessor paymentMethodProcessor;
@@ -461,7 +462,7 @@ public class PaymentProcessor extends ProcessorBase {
paymentDao.updateStatusForPaymentWithAttempt(paymentInput.getId(), paymentStatus, paymentPluginInfo.getGatewayErrorCode(), paymentPluginInfo.getGatewayError(),null, null, attemptInput.getId(), context);
- log.warn(String.format("Could not process payment for account %s, invoice %s, error = %s",
+ log.info(String.format("Could not process payment for account %s, invoice %s, error = %s",
account.getId(), invoice.getId(), paymentPluginInfo.getGatewayError()));
event = new DefaultPaymentErrorEvent(account.getId(), invoice.getId(), paymentInput.getId(), paymentPluginInfo.getGatewayError(), context.getUserToken());
diff --git a/payment/src/main/java/com/ning/billing/payment/core/ProcessorBase.java b/payment/src/main/java/com/ning/billing/payment/core/ProcessorBase.java
index 7d542e9..d10b308 100644
--- a/payment/src/main/java/com/ning/billing/payment/core/ProcessorBase.java
+++ b/payment/src/main/java/com/ning/billing/payment/core/ProcessorBase.java
@@ -97,7 +97,7 @@ public abstract class ProcessorBase {
}
protected PaymentPluginApi getPaymentProviderPlugin(final UUID paymentMethodId) throws PaymentApiException {
- final PaymentMethodModelDao methodDao = paymentDao.getPaymentMethod(paymentMethodId);
+ final PaymentMethodModelDao methodDao = paymentDao.getPaymentMethodIncludedDeleted(paymentMethodId);
if (methodDao == null) {
log.error("PaymentMethod dpes not exist", paymentMethodId);
throw new PaymentApiException(ErrorCode.PAYMENT_NO_SUCH_PAYMENT_METHOD, paymentMethodId);
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 80676f3..b4271ac 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
@@ -16,7 +16,6 @@
package com.ning.billing.payment.dao;
import java.math.BigDecimal;
-import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
@@ -26,9 +25,6 @@ import org.skife.jdbi.v2.IDBI;
import org.skife.jdbi.v2.Transaction;
import org.skife.jdbi.v2.TransactionStatus;
-import com.google.inject.Inject;
-
-import com.ning.billing.payment.api.PaymentMethod;
import com.ning.billing.payment.api.PaymentStatus;
import com.ning.billing.payment.dao.RefundModelDao.RefundStatus;
import com.ning.billing.payment.retry.PluginFailureRetryService.PluginFailureRetryServiceScheduler;
@@ -38,6 +34,8 @@ import com.ning.billing.util.dao.EntityAudit;
import com.ning.billing.util.dao.EntityHistory;
import com.ning.billing.util.dao.TableName;
+import com.google.inject.Inject;
+
public class AuditedPaymentDao implements PaymentDao {
@@ -335,6 +333,11 @@ public class AuditedPaymentDao implements PaymentDao {
return getPaymentMethodInTransaction(paymentMethodSqlDao, paymentMethodId);
}
+ @Override
+ public PaymentMethodModelDao getPaymentMethodIncludedDeleted(final UUID paymentMethodId) {
+ return paymentMethodSqlDao.getPaymentMethodIncludedDelete(paymentMethodId.toString());
+ }
+
private PaymentMethodModelDao getPaymentMethodInTransaction(final PaymentMethodSqlDao transactional, final UUID paymentMethodId) {
return transactional.getPaymentMethod(paymentMethodId.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 78c4630..326389e 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
@@ -18,7 +18,6 @@ package com.ning.billing.payment.dao;
import java.util.List;
import java.util.UUID;
-import com.ning.billing.payment.api.PaymentMethod;
import com.ning.billing.payment.api.PaymentStatus;
import com.ning.billing.payment.dao.RefundModelDao.RefundStatus;
import com.ning.billing.util.callcontext.CallContext;
@@ -60,6 +59,8 @@ public interface PaymentDao {
public PaymentMethodModelDao getPaymentMethod(final UUID paymentMethodId);
+ public PaymentMethodModelDao getPaymentMethodIncludedDeleted(final UUID paymentMethodId);
+
public List<PaymentMethodModelDao> getPaymentMethods(final UUID accountId);
public void deletedPaymentMethod(final UUID paymentMethodId);
diff --git a/payment/src/main/java/com/ning/billing/payment/dao/PaymentMethodSqlDao.java b/payment/src/main/java/com/ning/billing/payment/dao/PaymentMethodSqlDao.java
index 3065883..33b101e 100644
--- a/payment/src/main/java/com/ning/billing/payment/dao/PaymentMethodSqlDao.java
+++ b/payment/src/main/java/com/ning/billing/payment/dao/PaymentMethodSqlDao.java
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 2010-2011 Ning, Inc.
*
* Ning licenses this file to you under the Apache License, version 2.0
@@ -59,6 +59,9 @@ public interface PaymentMethodSqlDao extends Transactional<PaymentMethodSqlDao>,
PaymentMethodModelDao getPaymentMethod(@Bind("id") final String paymentMethodId);
@SqlQuery
+ PaymentMethodModelDao getPaymentMethodIncludedDelete(@Bind("id") final String paymentMethodId);
+
+ @SqlQuery
List<PaymentMethodModelDao> getPaymentMethods(@Bind("accountId") final String accountId);
diff --git a/payment/src/main/resources/com/ning/billing/payment/dao/PaymentMethodSqlDao.sql.stg b/payment/src/main/resources/com/ning/billing/payment/dao/PaymentMethodSqlDao.sql.stg
index 75662f3..bff218a 100644
--- a/payment/src/main/resources/com/ning/billing/payment/dao/PaymentMethodSqlDao.sql.stg
+++ b/payment/src/main/resources/com/ning/billing/payment/dao/PaymentMethodSqlDao.sql.stg
@@ -35,6 +35,12 @@ getPaymentMethod() ::= <<
WHERE id = :id AND is_active = 1;
>>
+getPaymentMethodIncludedDelete() ::= <<
+ SELECT <paymentMethodFields()>
+ FROM payment_methods
+ WHERE id = :id;
+>>
+
getPaymentMethods() ::= <<
SELECT <paymentMethodFields()>
FROM payment_methods
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 1c47a7c..c63b519 100644
--- a/payment/src/main/resources/com/ning/billing/payment/ddl.sql
+++ b/payment/src/main/resources/com/ning/billing/payment/ddl.sql
@@ -7,7 +7,7 @@ CREATE TABLE payments (
account_id char(36) COLLATE utf8_bin NOT NULL,
invoice_id char(36) COLLATE utf8_bin NOT NULL,
payment_method_id char(36) COLLATE utf8_bin NOT NULL,
- amount decimal(8,2),
+ amount numeric(10,4),
currency char(3),
effective_date datetime,
payment_status varchar(50),
@@ -33,7 +33,7 @@ CREATE TABLE payment_history (
account_id char(36) COLLATE utf8_bin NOT NULL,
invoice_id char(36) COLLATE utf8_bin NOT NULL,
payment_method_id char(36) COLLATE utf8_bin NOT NULL,
- amount decimal(8,2),
+ amount numeric(10,4),
currency char(3),
effective_date datetime,
payment_status varchar(50),
@@ -58,7 +58,7 @@ CREATE TABLE payment_attempts (
gateway_error_code varchar(32),
gateway_error_msg varchar(256),
processing_status varchar(50),
- requested_amount decimal(8,2),
+ requested_amount numeric(10,4),
created_by varchar(50) NOT NULL,
created_date datetime NOT NULL,
updated_by varchar(50) NOT NULL,
@@ -80,7 +80,7 @@ CREATE TABLE payment_attempt_history (
gateway_error_code varchar(32),
gateway_error_msg varchar(256),
processing_status varchar(50),
- requested_amount decimal(8,2),
+ requested_amount numeric(10,4),
created_by varchar(50) NOT NULL,
created_date datetime NOT NULL,
updated_by varchar(50) NOT NULL,
@@ -137,7 +137,7 @@ CREATE TABLE refunds (
id char(36) NOT NULL,
account_id char(36) COLLATE utf8_bin NOT NULL,
payment_id char(36) COLLATE utf8_bin NOT NULL,
- amount decimal(8,2),
+ amount numeric(10,4),
currency char(3),
is_adjusted tinyint(1),
refund_status varchar(50),
@@ -160,7 +160,7 @@ CREATE TABLE refund_history (
id char(36) NOT NULL,
account_id char(36) COLLATE utf8_bin NOT NULL,
payment_id char(36) COLLATE utf8_bin NOT NULL,
- amount decimal(8,2),
+ amount numeric(10,4),
currency char(3),
is_adjusted tinyint(1),
refund_status varchar(50),
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 b8b14bc..0c08df9 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
@@ -24,7 +24,6 @@ import java.util.List;
import java.util.Map;
import java.util.UUID;
-import com.ning.billing.payment.api.PaymentMethod;
import com.ning.billing.payment.api.PaymentStatus;
import com.ning.billing.payment.dao.RefundModelDao.RefundStatus;
import com.ning.billing.util.callcontext.CallContext;
@@ -202,4 +201,10 @@ public class MockPaymentDao implements PaymentDao {
UUID paymentMethodId) {
return null;
}
+
+ @Override
+ public PaymentMethodModelDao getPaymentMethodIncludedDeleted(
+ UUID paymentMethodId) {
+ return getPaymentMethod(paymentMethodId);
+ }
}
pom.xml 2(+1 -1)
diff --git a/pom.xml b/pom.xml
index 4fbee08..9d36b5f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -17,7 +17,7 @@
<groupId>com.ning.billing</groupId>
<artifactId>killbill</artifactId>
<packaging>pom</packaging>
- <version>0.1.33-SNAPSHOT</version>
+ <version>0.1.34-SNAPSHOT</version>
<name>killbill</name>
<description>Library for managing recurring subscriptions and the associated billing</description>
<url>http://github.com/ning/killbill</url>
server/pom.xml 2(+1 -1)
diff --git a/server/pom.xml b/server/pom.xml
index 7b38e08..3c57dd3 100644
--- a/server/pom.xml
+++ b/server/pom.xml
@@ -13,7 +13,7 @@
<parent>
<groupId>com.ning.billing</groupId>
<artifactId>killbill</artifactId>
- <version>0.1.33-SNAPSHOT</version>
+ <version>0.1.34-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>killbill-server</artifactId>
usage/pom.xml 2(+1 -1)
diff --git a/usage/pom.xml b/usage/pom.xml
index 15813fd..4d63bba 100644
--- a/usage/pom.xml
+++ b/usage/pom.xml
@@ -13,7 +13,7 @@
<parent>
<groupId>com.ning.billing</groupId>
<artifactId>killbill</artifactId>
- <version>0.1.33-SNAPSHOT</version>
+ <version>0.1.34-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>killbill-usage</artifactId>
util/pom.xml 2(+1 -1)
diff --git a/util/pom.xml b/util/pom.xml
index de8d974..bbc63c1 100644
--- a/util/pom.xml
+++ b/util/pom.xml
@@ -13,7 +13,7 @@
<parent>
<groupId>com.ning.billing</groupId>
<artifactId>killbill</artifactId>
- <version>0.1.33-SNAPSHOT</version>
+ <version>0.1.34-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>killbill-util</artifactId>