killbill-memoizeit
Changes
.idea/libraries/Maven__com_ning_billing_killbill_entitlement_test_jar_tests_0_3_7_SNAPSHOT.xml 8(+4 -4)
.idea/libraries/Maven__com_ning_billing_killbill_junction_test_jar_tests_0_3_7_SNAPSHOT.xml 8(+4 -4)
account/killbill-account.iml 8(+4 -4)
api/killbill-internal-api.iml 4(+2 -2)
beatrix/killbill-beatrix.iml 16(+8 -8)
catalog/killbill-catalog.iml 8(+4 -4)
entitlement/killbill-entitlement.iml 10(+5 -5)
invoice/killbill-invoice.iml 10(+5 -5)
jaxrs/killbill-jaxrs.iml 8(+4 -4)
junction/killbill-junction.iml 12(+6 -6)
osgi/killbill-osgi.iml 8(+4 -4)
osgi-bundles/bundles/jruby/src/main/java/com/ning/billing/osgi/bundles/jruby/JRubyPaymentPlugin.java 12(+10 -2)
osgi-bundles/tests/beatrix/src/test/java/com/ning/billing/osgi/bundles/test/TestPaymentPluginApi.java 14(+11 -3)
osgi-bundles/tests/payment/src/test/java/com/ning/billing/osgi/bundles/test/TestPaymentPluginApi.java 7(+6 -1)
overdue/killbill-overdue.iml 10(+5 -5)
payment/killbill-payment.iml 14(+7 -7)
payment/src/main/java/com/ning/billing/payment/provider/DefaultNoOpPaymentMethodPlugin.java 13(+11 -2)
payment/src/main/java/com/ning/billing/payment/provider/DefaultNoOpPaymentProviderPlugin.java 20(+19 -1)
payment/src/main/java/com/ning/billing/payment/provider/ExternalPaymentProviderPlugin.java 12(+9 -3)
pom.xml 2(+1 -1)
server/killbill-server.iml 12(+6 -6)
subscription/killbill-subscription.iml 10(+5 -5)
tenant/killbill-tenant.iml 8(+4 -4)
usage/killbill-usage.iml 8(+4 -4)
util/killbill-util.iml 6(+3 -3)
Details
diff --git a/.idea/libraries/Maven__com_ning_billing_killbill_api_0_3_4_SNAPSHOT.xml b/.idea/libraries/Maven__com_ning_billing_killbill_api_0_3_4_SNAPSHOT.xml
new file mode 100644
index 0000000..6f05775
--- /dev/null
+++ b/.idea/libraries/Maven__com_ning_billing_killbill_api_0_3_4_SNAPSHOT.xml
@@ -0,0 +1,14 @@
+<component name="libraryTable">
+ <library name="Maven: com.ning.billing:killbill-api:0.3.4-SNAPSHOT">
+ <CLASSES>
+ <root url="jar://$MAVEN_REPOSITORY$/com/ning/billing/killbill-api/0.3.4-SNAPSHOT/killbill-api-0.3.4-SNAPSHOT.jar!/" />
+ </CLASSES>
+ <JAVADOC>
+ <root url="jar://$MAVEN_REPOSITORY$/com/ning/billing/killbill-api/0.3.4-SNAPSHOT/killbill-api-0.3.4-SNAPSHOT-javadoc.jar!/" />
+ </JAVADOC>
+ <SOURCES>
+ <root url="jar://$MAVEN_REPOSITORY$/com/ning/billing/killbill-api/0.3.4-SNAPSHOT/killbill-api-0.3.4-SNAPSHOT-sources.jar!/" />
+ <root url="file://$PROJECT_DIR$/../killbill-api/src/main/java" />
+ </SOURCES>
+ </library>
+</component>
\ No newline at end of file
account/killbill-account.iml 8(+4 -4)
diff --git a/account/killbill-account.iml b/account/killbill-account.iml
index e7f06bf..f71c6d8 100644
--- a/account/killbill-account.iml
+++ b/account/killbill-account.iml
@@ -20,10 +20,10 @@
<orderEntry type="library" scope="PROVIDED" name="Maven: javax.inject:javax.inject:1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: aopalliance:aopalliance:1.0" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: com.h2database:h2:1.3.158" level="project" />
- <orderEntry type="library" name="Maven: com.ning.billing:killbill-api:0.3.3" level="project" />
+ <orderEntry type="library" name="Maven: com.ning.billing:killbill-api:0.4.0" level="project" />
<orderEntry type="library" name="Maven: joda-time:joda-time:2.0" level="project" />
<orderEntry type="module" module-name="killbill-internal-api" />
- <orderEntry type="library" name="Maven: com.ning.billing.plugin:killbill-plugin-api-payment:0.2.6" level="project" />
+ <orderEntry type="library" name="Maven: com.ning.billing.plugin:killbill-plugin-api-payment:0.3.0" level="project" />
<orderEntry type="library" name="Maven: org.skife.config:config-magic:0.14" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.5" level="project" />
<orderEntry type="module" module-name="killbill-util" />
@@ -38,7 +38,7 @@
<orderEntry type="library" name="Maven: org.jdbi:jdbi:2.39.1" level="project" />
<orderEntry type="library" name="Maven: com.yammer.metrics:metrics-core:2.1.2" level="project" />
<orderEntry type="library" name="Maven: org.weakref:jmxutils:1.12" level="project" />
- <orderEntry type="library" name="Maven: com.ning.billing.plugin:killbill-plugin-api-notification:0.2.6" level="project" />
+ <orderEntry type="library" name="Maven: com.ning.billing.plugin:killbill-plugin-api-notification:0.3.0" level="project" />
<orderEntry type="library" name="Maven: com.samskivert:jmustache:1.5" level="project" />
<orderEntry type="library" name="Maven: net.sf.ehcache:ehcache-core:2.6.2" level="project" />
<orderEntry type="library" scope="RUNTIME" name="Maven: org.antlr:stringtemplate:3.2.1" level="project" />
@@ -47,7 +47,7 @@
<orderEntry type="library" name="Maven: javax.mail:mail:1.4.1" level="project" />
<orderEntry type="library" name="Maven: javax.activation:activation:1.1" level="project" />
<orderEntry type="module" module-name="killbill-util" scope="TEST" production-on-test="" />
- <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing:killbill-util:test-jar:tests:0.3.6-SNAPSHOT" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing:killbill-util:test-jar:tests:0.3.7-SNAPSHOT" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: com.ning.billing.commons:killbill-clock:test-jar:tests:0.1.7" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: mysql:mysql-connector-mxj:5.0.12" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: mysql:mysql-connector-mxj-db-files:5.0.12" level="project" />
diff --git a/account/src/main/java/com/ning/billing/account/api/user/DefaultAccountUserApi.java b/account/src/main/java/com/ning/billing/account/api/user/DefaultAccountUserApi.java
index a7c1714..0f7717f 100644
--- a/account/src/main/java/com/ning/billing/account/api/user/DefaultAccountUserApi.java
+++ b/account/src/main/java/com/ning/billing/account/api/user/DefaultAccountUserApi.java
@@ -90,6 +90,17 @@ public class DefaultAccountUserApi implements AccountUserApi {
}
@Override
+ public List<Account> searchAccounts(final String searchKey, final TenantContext context) {
+ final List<AccountModelDao> accountModelDaos = accountDao.searchAccounts(searchKey, internalCallContextFactory.createInternalTenantContext(context));
+ return ImmutableList.<Account>copyOf(Collections2.transform(accountModelDaos, new Function<AccountModelDao, Account>() {
+ @Override
+ public Account apply(final AccountModelDao input) {
+ return new DefaultAccount(input);
+ }
+ }));
+ }
+
+ @Override
public List<Account> getAccounts(final TenantContext context) {
final List<AccountModelDao> accountModelDaos = accountDao.get(internalCallContextFactory.createInternalTenantContext(context));
return ImmutableList.<Account>copyOf(Collections2.transform(accountModelDaos, new Function<AccountModelDao, Account>() {
diff --git a/account/src/main/java/com/ning/billing/account/dao/AccountDao.java b/account/src/main/java/com/ning/billing/account/dao/AccountDao.java
index 9f11a5e..f390c11 100644
--- a/account/src/main/java/com/ning/billing/account/dao/AccountDao.java
+++ b/account/src/main/java/com/ning/billing/account/dao/AccountDao.java
@@ -29,6 +29,8 @@ public interface AccountDao extends EntityDao<AccountModelDao, Account, AccountA
public AccountModelDao getAccountByKey(String key, InternalTenantContext context);
+ public List<AccountModelDao> searchAccounts(String searchKey, InternalTenantContext context);
+
/**
* @throws AccountApiException when externalKey is null
*/
diff --git a/account/src/main/java/com/ning/billing/account/dao/AccountSqlDao.java b/account/src/main/java/com/ning/billing/account/dao/AccountSqlDao.java
index f49f454..01aa04e 100644
--- a/account/src/main/java/com/ning/billing/account/dao/AccountSqlDao.java
+++ b/account/src/main/java/com/ning/billing/account/dao/AccountSqlDao.java
@@ -16,12 +16,14 @@
package com.ning.billing.account.dao;
+import java.util.List;
import java.util.UUID;
import org.skife.jdbi.v2.sqlobject.Bind;
import org.skife.jdbi.v2.sqlobject.BindBean;
import org.skife.jdbi.v2.sqlobject.SqlQuery;
import org.skife.jdbi.v2.sqlobject.SqlUpdate;
+import org.skife.jdbi.v2.sqlobject.customizers.Define;
import com.ning.billing.account.api.Account;
import com.ning.billing.util.audit.ChangeType;
@@ -39,6 +41,10 @@ public interface AccountSqlDao extends EntitySqlDao<AccountModelDao, Account> {
@BindBean final InternalTenantContext context);
@SqlQuery
+ public List<AccountModelDao> searchAccounts(@Define("searchKey") final String searchKey,
+ @BindBean final InternalTenantContext context);
+
+ @SqlQuery
public UUID getIdFromKey(@Bind("externalKey") final String key,
@BindBean final InternalTenantContext context);
diff --git a/account/src/main/java/com/ning/billing/account/dao/DefaultAccountDao.java b/account/src/main/java/com/ning/billing/account/dao/DefaultAccountDao.java
index 76aa8cc..d3f77ed 100644
--- a/account/src/main/java/com/ning/billing/account/dao/DefaultAccountDao.java
+++ b/account/src/main/java/com/ning/billing/account/dao/DefaultAccountDao.java
@@ -104,6 +104,16 @@ public class DefaultAccountDao extends EntityDaoBase<AccountModelDao, Account, A
}
@Override
+ public List<AccountModelDao> searchAccounts(final String searchKey, final InternalTenantContext context) {
+ return transactionalSqlDao.execute(new EntitySqlDaoTransactionWrapper<List<AccountModelDao>>() {
+ @Override
+ public List<AccountModelDao> inTransaction(final EntitySqlDaoWrapperFactory<EntitySqlDao> entitySqlDaoWrapperFactory) throws Exception {
+ return entitySqlDaoWrapperFactory.become(AccountSqlDao.class).searchAccounts(searchKey, context);
+ }
+ });
+ }
+
+ @Override
public UUID getIdFromKey(final String externalKey, final InternalTenantContext context) throws AccountApiException {
if (externalKey == null) {
throw new AccountApiException(ErrorCode.ACCOUNT_CANNOT_MAP_NULL_KEY, "");
diff --git a/account/src/main/resources/com/ning/billing/account/dao/AccountSqlDao.sql.stg b/account/src/main/resources/com/ning/billing/account/dao/AccountSqlDao.sql.stg
index 5ed297b..630f1dc 100644
--- a/account/src/main/resources/com/ning/billing/account/dao/AccountSqlDao.sql.stg
+++ b/account/src/main/resources/com/ning/billing/account/dao/AccountSqlDao.sql.stg
@@ -80,14 +80,30 @@ updatePaymentMethod() ::= <<
WHERE id = :id <AND_CHECK_TENANT()>;
>>
-
-
getAccountByKey() ::= <<
select <allTableFields()>
from accounts
where external_key = :externalKey <AND_CHECK_TENANT()>;
>>
+searchAccounts(searchKey) ::= <<
+select <allTableFields()>
+from accounts
+where name like ('%<searchKey>%') <AND_CHECK_TENANT()>
+union
+select <allTableFields()>
+from accounts
+where email like ('%<searchKey>%') <AND_CHECK_TENANT()>
+union
+select <allTableFields()>
+from accounts
+where external_key like ('%<searchKey>%') <AND_CHECK_TENANT()>
+union
+select <allTableFields()>
+from accounts
+where company_name like ('%<searchKey>%') <AND_CHECK_TENANT()>
+;
+>>
getIdFromKey() ::= <<
SELECT id
diff --git a/account/src/test/java/com/ning/billing/account/dao/MockAccountDao.java b/account/src/test/java/com/ning/billing/account/dao/MockAccountDao.java
index 8d10192..e4e3aa3 100644
--- a/account/src/test/java/com/ning/billing/account/dao/MockAccountDao.java
+++ b/account/src/test/java/com/ning/billing/account/dao/MockAccountDao.java
@@ -16,6 +16,7 @@
package com.ning.billing.account.dao;
+import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.UUID;
@@ -102,6 +103,20 @@ public class MockAccountDao extends MockEntityDaoBase<AccountModelDao, Account,
}
@Override
+ public List<AccountModelDao> searchAccounts(final String searchKey, final InternalTenantContext context) {
+ final List<AccountModelDao> results = new LinkedList<AccountModelDao>();
+ for (final AccountModelDao account : get(context)) {
+ if ((account.getName() != null && account.getName().contains(searchKey)) ||
+ (account.getEmail() != null && account.getEmail().contains(searchKey)) ||
+ (account.getExternalKey() != null && account.getExternalKey().contains(searchKey)) ||
+ (account.getCompanyName() != null && account.getCompanyName().contains(searchKey))) {
+ results.add(account);
+ }
+ }
+ return results;
+ }
+
+ @Override
public UUID getIdFromKey(final String externalKey, final InternalTenantContext context) {
final AccountModelDao account = getAccountByKey(externalKey, context);
return account == null ? null : account.getId();
api/killbill-internal-api.iml 4(+2 -2)
diff --git a/api/killbill-internal-api.iml b/api/killbill-internal-api.iml
index f3c9fd6..a7746a7 100644
--- a/api/killbill-internal-api.iml
+++ b/api/killbill-internal-api.iml
@@ -10,10 +10,10 @@
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.code.findbugs:jsr305:1.3.9" level="project" />
- <orderEntry type="library" name="Maven: com.ning.billing:killbill-api:0.3.3" level="project" />
+ <orderEntry type="library" name="Maven: com.ning.billing:killbill-api:0.4.0" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.1.0" level="project" />
<orderEntry type="library" name="Maven: joda-time:joda-time:2.0" level="project" />
- <orderEntry type="library" name="Maven: com.ning.billing.plugin:killbill-plugin-api-payment:0.2.6" level="project" />
+ <orderEntry type="library" name="Maven: com.ning.billing.plugin:killbill-plugin-api-payment:0.3.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: javax.servlet:javax.servlet-api:3.0.1" level="project" />
<orderEntry type="library" name="Maven: org.skife.config:config-magic:0.14" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.5" level="project" />
beatrix/killbill-beatrix.iml 16(+8 -8)
diff --git a/beatrix/killbill-beatrix.iml b/beatrix/killbill-beatrix.iml
index c1fc2d3..faab69b 100644
--- a/beatrix/killbill-beatrix.iml
+++ b/beatrix/killbill-beatrix.iml
@@ -25,14 +25,14 @@
<orderEntry type="library" name="Maven: com.jolbox:bonecp:0.7.1.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.5" level="project" />
<orderEntry type="module" module-name="killbill-account" scope="TEST" production-on-test="" />
- <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing:killbill-account:test-jar:tests:0.3.6-SNAPSHOT" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing:killbill-account:test-jar:tests:0.3.7-SNAPSHOT" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.1.0" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.1.0" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-core:2.1.0" level="project" />
- <orderEntry type="library" name="Maven: com.ning.billing:killbill-api:0.3.3" level="project" />
+ <orderEntry type="library" name="Maven: com.ning.billing:killbill-api:0.4.0" level="project" />
<orderEntry type="library" name="Maven: joda-time:joda-time:2.0" level="project" />
<orderEntry type="module" module-name="killbill-internal-api" />
- <orderEntry type="library" name="Maven: com.ning.billing.plugin:killbill-plugin-api-payment:0.2.6" level="project" />
+ <orderEntry type="library" name="Maven: com.ning.billing.plugin:killbill-plugin-api-payment:0.3.0" level="project" />
<orderEntry type="library" name="Maven: org.skife.config:config-magic:0.14" level="project" />
<orderEntry type="module" module-name="killbill-util" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.dataformat:jackson-dataformat-csv:2.1.0" level="project" />
@@ -45,7 +45,7 @@
<orderEntry type="library" name="Maven: org.jdbi:jdbi:2.39.1" level="project" />
<orderEntry type="library" name="Maven: com.yammer.metrics:metrics-core:2.1.2" level="project" />
<orderEntry type="library" name="Maven: org.weakref:jmxutils:1.12" level="project" />
- <orderEntry type="library" name="Maven: com.ning.billing.plugin:killbill-plugin-api-notification:0.2.6" level="project" />
+ <orderEntry type="library" name="Maven: com.ning.billing.plugin:killbill-plugin-api-notification:0.3.0" level="project" />
<orderEntry type="library" name="Maven: com.samskivert:jmustache:1.5" level="project" />
<orderEntry type="library" name="Maven: net.sf.ehcache:ehcache-core:2.6.2" level="project" />
<orderEntry type="library" name="Maven: org.antlr:stringtemplate:3.2.1" level="project" />
@@ -58,11 +58,11 @@
<orderEntry type="module" module-name="killbill-entitlement" />
<orderEntry type="module" module-name="killbill-invoice" />
<orderEntry type="module" module-name="killbill-invoice" scope="TEST" production-on-test="" />
- <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing:killbill-invoice:test-jar:tests:0.3.6-SNAPSHOT" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing:killbill-invoice:test-jar:tests:0.3.7-SNAPSHOT" level="project" />
<orderEntry type="module" module-name="killbill-junction" />
<orderEntry type="library" scope="RUNTIME" name="Maven: mysql:mysql-connector-java:5.1.22" level="project" />
<orderEntry type="module" module-name="killbill-junction" scope="TEST" production-on-test="" />
- <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing:killbill-junction:test-jar:tests:0.3.6-SNAPSHOT" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing:killbill-junction:test-jar:tests:0.3.7-SNAPSHOT" level="project" />
<orderEntry type="module" module-name="killbill-osgi" scope="TEST" />
<orderEntry type="module" module-name="killbill-osgi-bundles-lib-killbill" scope="TEST" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.code.findbugs:jsr305:1.3.9" level="project" />
@@ -77,11 +77,11 @@
<orderEntry type="module" module-name="killbill-osgi-bundles-test-beatrix" scope="TEST" />
<orderEntry type="module" module-name="killbill-osgi-bundles-test-payment" scope="TEST" />
<orderEntry type="module" module-name="killbill-util" scope="TEST" production-on-test="" />
- <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing:killbill-util:test-jar:tests:0.3.6-SNAPSHOT" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing:killbill-util:test-jar:tests:0.3.7-SNAPSHOT" level="project" />
<orderEntry type="module" module-name="killbill-overdue" scope="TEST" />
<orderEntry type="module" module-name="killbill-payment" />
<orderEntry type="module" module-name="killbill-payment" scope="TEST" production-on-test="" />
- <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing:killbill-payment:test-jar:tests:0.3.6-SNAPSHOT" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing:killbill-payment:test-jar:tests:0.3.7-SNAPSHOT" level="project" />
<orderEntry type="module" module-name="killbill-subscription" />
<orderEntry type="module" module-name="killbill-tenant" />
<orderEntry type="library" name="Maven: org.apache.shiro:shiro-core:1.2.1" level="project" />
catalog/killbill-catalog.iml 8(+4 -4)
diff --git a/catalog/killbill-catalog.iml b/catalog/killbill-catalog.iml
index 57ac341..a752e34 100644
--- a/catalog/killbill-catalog.iml
+++ b/catalog/killbill-catalog.iml
@@ -17,11 +17,11 @@
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.inject:guice:3.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: javax.inject:javax.inject:1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: aopalliance:aopalliance:1.0" level="project" />
- <orderEntry type="library" name="Maven: com.ning.billing:killbill-api:0.3.3" level="project" />
+ <orderEntry type="library" name="Maven: com.ning.billing:killbill-api:0.4.0" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.1.0" level="project" />
<orderEntry type="library" name="Maven: joda-time:joda-time:2.0" level="project" />
<orderEntry type="module" module-name="killbill-internal-api" />
- <orderEntry type="library" name="Maven: com.ning.billing.plugin:killbill-plugin-api-payment:0.2.6" level="project" />
+ <orderEntry type="library" name="Maven: com.ning.billing.plugin:killbill-plugin-api-payment:0.3.0" level="project" />
<orderEntry type="library" name="Maven: org.skife.config:config-magic:0.14" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.5" level="project" />
<orderEntry type="module" module-name="killbill-util" />
@@ -39,7 +39,7 @@
<orderEntry type="library" name="Maven: org.jdbi:jdbi:2.39.1" level="project" />
<orderEntry type="library" name="Maven: com.yammer.metrics:metrics-core:2.1.2" level="project" />
<orderEntry type="library" name="Maven: org.weakref:jmxutils:1.12" level="project" />
- <orderEntry type="library" name="Maven: com.ning.billing.plugin:killbill-plugin-api-notification:0.2.6" level="project" />
+ <orderEntry type="library" name="Maven: com.ning.billing.plugin:killbill-plugin-api-notification:0.3.0" level="project" />
<orderEntry type="library" name="Maven: com.samskivert:jmustache:1.5" level="project" />
<orderEntry type="library" name="Maven: net.sf.ehcache:ehcache-core:2.6.2" level="project" />
<orderEntry type="library" name="Maven: org.antlr:stringtemplate:3.2.1" level="project" />
@@ -48,7 +48,7 @@
<orderEntry type="library" name="Maven: javax.mail:mail:1.4.1" level="project" />
<orderEntry type="library" name="Maven: javax.activation:activation:1.1" level="project" />
<orderEntry type="module" module-name="killbill-util" scope="TEST" production-on-test="" />
- <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing:killbill-util:test-jar:tests:0.3.6-SNAPSHOT" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing:killbill-util:test-jar:tests:0.3.7-SNAPSHOT" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: com.ning.billing.commons:killbill-clock:test-jar:tests:0.1.7" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.mockito:mockito-all:1.9.0" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.slf4j:slf4j-simple:1.7.5" level="project" />
entitlement/killbill-entitlement.iml 10(+5 -5)
diff --git a/entitlement/killbill-entitlement.iml b/entitlement/killbill-entitlement.iml
index 73d6ded..87b3b90 100644
--- a/entitlement/killbill-entitlement.iml
+++ b/entitlement/killbill-entitlement.iml
@@ -19,12 +19,12 @@
<orderEntry type="library" scope="PROVIDED" name="Maven: javax.inject:javax.inject:1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: aopalliance:aopalliance:1.0" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: com.h2database:h2:1.3.158" level="project" />
- <orderEntry type="library" name="Maven: com.ning.billing:killbill-api:0.3.3" level="project" />
+ <orderEntry type="library" name="Maven: com.ning.billing:killbill-api:0.4.0" level="project" />
<orderEntry type="library" name="Maven: joda-time:joda-time:2.0" level="project" />
<orderEntry type="module" module-name="killbill-catalog" scope="TEST" production-on-test="" />
- <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing:killbill-catalog:test-jar:tests:0.3.6-SNAPSHOT" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing:killbill-catalog:test-jar:tests:0.3.7-SNAPSHOT" level="project" />
<orderEntry type="module" module-name="killbill-internal-api" />
- <orderEntry type="library" name="Maven: com.ning.billing.plugin:killbill-plugin-api-payment:0.2.6" level="project" />
+ <orderEntry type="library" name="Maven: com.ning.billing.plugin:killbill-plugin-api-payment:0.3.0" level="project" />
<orderEntry type="library" name="Maven: org.skife.config:config-magic:0.14" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.5" level="project" />
<orderEntry type="module" module-name="killbill-util" />
@@ -41,7 +41,7 @@
<orderEntry type="library" name="Maven: org.jdbi:jdbi:2.39.1" level="project" />
<orderEntry type="library" name="Maven: com.yammer.metrics:metrics-core:2.1.2" level="project" />
<orderEntry type="library" name="Maven: org.weakref:jmxutils:1.12" level="project" />
- <orderEntry type="library" name="Maven: com.ning.billing.plugin:killbill-plugin-api-notification:0.2.6" level="project" />
+ <orderEntry type="library" name="Maven: com.ning.billing.plugin:killbill-plugin-api-notification:0.3.0" level="project" />
<orderEntry type="library" name="Maven: com.samskivert:jmustache:1.5" level="project" />
<orderEntry type="library" name="Maven: net.sf.ehcache:ehcache-core:2.6.2" level="project" />
<orderEntry type="library" scope="RUNTIME" name="Maven: org.antlr:stringtemplate:3.2.1" level="project" />
@@ -51,7 +51,7 @@
<orderEntry type="library" name="Maven: javax.activation:activation:1.1" level="project" />
<orderEntry type="module" module-name="killbill-catalog" scope="TEST" />
<orderEntry type="module" module-name="killbill-util" scope="TEST" production-on-test="" />
- <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing:killbill-util:test-jar:tests:0.3.6-SNAPSHOT" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing:killbill-util:test-jar:tests:0.3.7-SNAPSHOT" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: com.ning.billing.commons:killbill-clock:test-jar:tests:0.1.7" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: com.ning.billing.commons:killbill-queue:test-jar:tests:0.1.7" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: mysql:mysql-connector-mxj:5.0.12" level="project" />
diff --git a/entitlement/src/main/java/com/ning/billing/entitlement/api/BlockingAccountUserApi.java b/entitlement/src/main/java/com/ning/billing/entitlement/api/BlockingAccountUserApi.java
index 10cdd5a..84b0533 100644
--- a/entitlement/src/main/java/com/ning/billing/entitlement/api/BlockingAccountUserApi.java
+++ b/entitlement/src/main/java/com/ning/billing/entitlement/api/BlockingAccountUserApi.java
@@ -80,6 +80,11 @@ public class BlockingAccountUserApi implements AccountUserApi {
}
@Override
+ public List<Account> searchAccounts(final String searchKey, final TenantContext tenantContext) {
+ return userApi.searchAccounts(searchKey, tenantContext);
+ }
+
+ @Override
public List<Account> getAccounts(final TenantContext context) {
return userApi.getAccounts(context);
}
invoice/killbill-invoice.iml 10(+5 -5)
diff --git a/invoice/killbill-invoice.iml b/invoice/killbill-invoice.iml
index d8d375a..f5a87c9 100644
--- a/invoice/killbill-invoice.iml
+++ b/invoice/killbill-invoice.iml
@@ -24,11 +24,11 @@
<orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-core:1.1" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: cglib:cglib-nodep:2.2" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.objenesis:objenesis:1.2" level="project" />
- <orderEntry type="library" name="Maven: com.ning.billing:killbill-api:0.3.3" level="project" />
+ <orderEntry type="library" name="Maven: com.ning.billing:killbill-api:0.4.0" level="project" />
<orderEntry type="library" name="Maven: joda-time:joda-time:2.0" level="project" />
<orderEntry type="module" module-name="killbill-catalog" scope="TEST" />
<orderEntry type="module" module-name="killbill-internal-api" />
- <orderEntry type="library" name="Maven: com.ning.billing.plugin:killbill-plugin-api-payment:0.2.6" level="project" />
+ <orderEntry type="library" name="Maven: com.ning.billing.plugin:killbill-plugin-api-payment:0.3.0" level="project" />
<orderEntry type="library" name="Maven: org.skife.config:config-magic:0.14" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.5" level="project" />
<orderEntry type="module" module-name="killbill-util" />
@@ -45,7 +45,7 @@
<orderEntry type="library" name="Maven: org.jdbi:jdbi:2.39.1" level="project" />
<orderEntry type="library" name="Maven: com.yammer.metrics:metrics-core:2.1.2" level="project" />
<orderEntry type="library" name="Maven: org.weakref:jmxutils:1.12" level="project" />
- <orderEntry type="library" name="Maven: com.ning.billing.plugin:killbill-plugin-api-notification:0.2.6" level="project" />
+ <orderEntry type="library" name="Maven: com.ning.billing.plugin:killbill-plugin-api-notification:0.3.0" level="project" />
<orderEntry type="library" name="Maven: com.samskivert:jmustache:1.5" level="project" />
<orderEntry type="library" name="Maven: net.sf.ehcache:ehcache-core:2.6.2" level="project" />
<orderEntry type="library" scope="RUNTIME" name="Maven: org.antlr:stringtemplate:3.2.1" level="project" />
@@ -54,9 +54,9 @@
<orderEntry type="library" name="Maven: javax.mail:mail:1.4.1" level="project" />
<orderEntry type="library" name="Maven: javax.activation:activation:1.1" level="project" />
<orderEntry type="module" module-name="killbill-catalog" scope="TEST" production-on-test="" />
- <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing:killbill-catalog:test-jar:tests:0.3.6-SNAPSHOT" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing:killbill-catalog:test-jar:tests:0.3.7-SNAPSHOT" level="project" />
<orderEntry type="module" module-name="killbill-util" scope="TEST" production-on-test="" />
- <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing:killbill-util:test-jar:tests:0.3.6-SNAPSHOT" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing:killbill-util:test-jar:tests:0.3.7-SNAPSHOT" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: com.ning.billing.commons:killbill-clock:test-jar:tests:0.1.7" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: mysql:mysql-connector-mxj:5.0.12" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: mysql:mysql-connector-mxj-db-files:5.0.12" level="project" />
jaxrs/killbill-jaxrs.iml 8(+4 -4)
diff --git a/jaxrs/killbill-jaxrs.iml b/jaxrs/killbill-jaxrs.iml
index 88aee35..b6dda69 100644
--- a/jaxrs/killbill-jaxrs.iml
+++ b/jaxrs/killbill-jaxrs.iml
@@ -16,7 +16,7 @@
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.inject:guice:3.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: javax.inject:javax.inject:1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: aopalliance:aopalliance:1.0" level="project" />
- <orderEntry type="library" name="Maven: com.ning.billing:killbill-api:0.3.3" level="project" />
+ <orderEntry type="library" name="Maven: com.ning.billing:killbill-api:0.4.0" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.1.0" level="project" />
<orderEntry type="library" name="Maven: joda-time:joda-time:2.0" level="project" />
<orderEntry type="module" module-name="killbill-util" />
@@ -29,7 +29,7 @@
<orderEntry type="library" name="Maven: com.mchange:c3p0:0.9.2" level="project" />
<orderEntry type="library" name="Maven: com.mchange:mchange-commons-java:0.2.3.3" level="project" />
<orderEntry type="module" module-name="killbill-internal-api" />
- <orderEntry type="library" name="Maven: com.ning.billing.plugin:killbill-plugin-api-payment:0.2.6" level="project" />
+ <orderEntry type="library" name="Maven: com.ning.billing.plugin:killbill-plugin-api-payment:0.3.0" level="project" />
<orderEntry type="library" name="Maven: org.skife.config:config-magic:0.14" level="project" />
<orderEntry type="library" name="Maven: com.ning.billing.commons:killbill-clock:0.1.7" level="project" />
<orderEntry type="library" name="Maven: com.ning.billing.commons:killbill-queue:0.1.7" level="project" />
@@ -38,7 +38,7 @@
<orderEntry type="library" name="Maven: org.jdbi:jdbi:2.39.1" level="project" />
<orderEntry type="library" name="Maven: com.yammer.metrics:metrics-core:2.1.2" level="project" />
<orderEntry type="library" name="Maven: org.weakref:jmxutils:1.12" level="project" />
- <orderEntry type="library" name="Maven: com.ning.billing.plugin:killbill-plugin-api-notification:0.2.6" level="project" />
+ <orderEntry type="library" name="Maven: com.ning.billing.plugin:killbill-plugin-api-notification:0.3.0" level="project" />
<orderEntry type="library" name="Maven: com.samskivert:jmustache:1.5" level="project" />
<orderEntry type="library" name="Maven: net.sf.ehcache:ehcache-core:2.6.2" level="project" />
<orderEntry type="library" name="Maven: org.antlr:stringtemplate:3.2.1" level="project" />
@@ -47,7 +47,7 @@
<orderEntry type="library" name="Maven: javax.mail:mail:1.4.1" level="project" />
<orderEntry type="library" name="Maven: javax.activation:activation:1.1" level="project" />
<orderEntry type="module" module-name="killbill-util" scope="TEST" production-on-test="" />
- <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing:killbill-util:test-jar:tests:0.3.6-SNAPSHOT" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing:killbill-util:test-jar:tests:0.3.7-SNAPSHOT" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: com.ning.billing.commons:killbill-clock:test-jar:tests:0.1.7" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: javax.servlet:javax.servlet-api:3.0.1" level="project" />
<orderEntry type="library" name="Maven: javax.ws.rs:jsr311-api:1.1.1" level="project" />
diff --git a/jaxrs/src/main/java/com/ning/billing/jaxrs/json/PaymentMethodJson.java b/jaxrs/src/main/java/com/ning/billing/jaxrs/json/PaymentMethodJson.java
index ebc4c8a..5321232 100644
--- a/jaxrs/src/main/java/com/ning/billing/jaxrs/json/PaymentMethodJson.java
+++ b/jaxrs/src/main/java/com/ning/billing/jaxrs/json/PaymentMethodJson.java
@@ -123,6 +123,11 @@ public class PaymentMethodJson {
public PaymentMethodPlugin getPluginDetail() {
return new PaymentMethodPlugin() {
@Override
+ public UUID getKbPaymentMethodId() {
+ return paymentMethodId == null ? null : UUID.fromString(paymentMethodId);
+ }
+
+ @Override
public boolean isDefaultPaymentMethod() {
// N/A
return false;
@@ -242,6 +247,58 @@ public class PaymentMethodJson {
return pluginInfo;
}
+ @Override
+ public String toString() {
+ final StringBuilder sb = new StringBuilder("PaymentMethodJson{");
+ sb.append("paymentMethodId='").append(paymentMethodId).append('\'');
+ sb.append(", accountId='").append(accountId).append('\'');
+ sb.append(", isDefault=").append(isDefault);
+ sb.append(", pluginName='").append(pluginName).append('\'');
+ sb.append(", pluginInfo=").append(pluginInfo);
+ sb.append('}');
+ return sb.toString();
+ }
+
+ @Override
+ public boolean equals(final Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+
+ final PaymentMethodJson that = (PaymentMethodJson) o;
+
+ if (accountId != null ? !accountId.equals(that.accountId) : that.accountId != null) {
+ return false;
+ }
+ if (isDefault != null ? !isDefault.equals(that.isDefault) : that.isDefault != null) {
+ return false;
+ }
+ if (paymentMethodId != null ? !paymentMethodId.equals(that.paymentMethodId) : that.paymentMethodId != null) {
+ return false;
+ }
+ if (pluginInfo != null ? !pluginInfo.equals(that.pluginInfo) : that.pluginInfo != null) {
+ return false;
+ }
+ if (pluginName != null ? !pluginName.equals(that.pluginName) : that.pluginName != null) {
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = paymentMethodId != null ? paymentMethodId.hashCode() : 0;
+ result = 31 * result + (accountId != null ? accountId.hashCode() : 0);
+ result = 31 * result + (isDefault != null ? isDefault.hashCode() : 0);
+ result = 31 * result + (pluginName != null ? pluginName.hashCode() : 0);
+ result = 31 * result + (pluginInfo != null ? pluginInfo.hashCode() : 0);
+ return result;
+ }
+
public static class PaymentMethodPluginDetailJson {
private final String externalPaymentId;
@@ -352,6 +409,108 @@ public class PaymentMethodJson {
public List<PaymentMethodProperties> getProperties() {
return properties;
}
+
+ @Override
+ public String toString() {
+ final StringBuilder sb = new StringBuilder("PaymentMethodPluginDetailJson{");
+ sb.append("externalPaymentId='").append(externalPaymentId).append('\'');
+ sb.append(", isDefaultPaymentMethod=").append(isDefaultPaymentMethod);
+ sb.append(", type='").append(type).append('\'');
+ sb.append(", ccName='").append(ccName).append('\'');
+ sb.append(", ccType='").append(ccType).append('\'');
+ sb.append(", ccExpirationMonth='").append(ccExpirationMonth).append('\'');
+ sb.append(", ccExpirationYear='").append(ccExpirationYear).append('\'');
+ sb.append(", ccLast4='").append(ccLast4).append('\'');
+ sb.append(", address1='").append(address1).append('\'');
+ sb.append(", address2='").append(address2).append('\'');
+ sb.append(", city='").append(city).append('\'');
+ sb.append(", state='").append(state).append('\'');
+ sb.append(", zip='").append(zip).append('\'');
+ sb.append(", country='").append(country).append('\'');
+ sb.append(", properties=").append(properties);
+ sb.append('}');
+ return sb.toString();
+ }
+
+ @Override
+ public boolean equals(final Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+
+ final PaymentMethodPluginDetailJson that = (PaymentMethodPluginDetailJson) o;
+
+ if (address1 != null ? !address1.equals(that.address1) : that.address1 != null) {
+ return false;
+ }
+ if (address2 != null ? !address2.equals(that.address2) : that.address2 != null) {
+ return false;
+ }
+ if (ccExpirationMonth != null ? !ccExpirationMonth.equals(that.ccExpirationMonth) : that.ccExpirationMonth != null) {
+ return false;
+ }
+ if (ccExpirationYear != null ? !ccExpirationYear.equals(that.ccExpirationYear) : that.ccExpirationYear != null) {
+ return false;
+ }
+ if (ccLast4 != null ? !ccLast4.equals(that.ccLast4) : that.ccLast4 != null) {
+ return false;
+ }
+ if (ccName != null ? !ccName.equals(that.ccName) : that.ccName != null) {
+ return false;
+ }
+ if (ccType != null ? !ccType.equals(that.ccType) : that.ccType != null) {
+ return false;
+ }
+ if (city != null ? !city.equals(that.city) : that.city != null) {
+ return false;
+ }
+ if (country != null ? !country.equals(that.country) : that.country != null) {
+ return false;
+ }
+ if (externalPaymentId != null ? !externalPaymentId.equals(that.externalPaymentId) : that.externalPaymentId != null) {
+ return false;
+ }
+ if (isDefaultPaymentMethod != null ? !isDefaultPaymentMethod.equals(that.isDefaultPaymentMethod) : that.isDefaultPaymentMethod != null) {
+ return false;
+ }
+ if (properties != null ? !properties.equals(that.properties) : that.properties != null) {
+ return false;
+ }
+ if (state != null ? !state.equals(that.state) : that.state != null) {
+ return false;
+ }
+ if (type != null ? !type.equals(that.type) : that.type != null) {
+ return false;
+ }
+ if (zip != null ? !zip.equals(that.zip) : that.zip != null) {
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = externalPaymentId != null ? externalPaymentId.hashCode() : 0;
+ result = 31 * result + (isDefaultPaymentMethod != null ? isDefaultPaymentMethod.hashCode() : 0);
+ result = 31 * result + (type != null ? type.hashCode() : 0);
+ result = 31 * result + (ccName != null ? ccName.hashCode() : 0);
+ result = 31 * result + (ccType != null ? ccType.hashCode() : 0);
+ result = 31 * result + (ccExpirationMonth != null ? ccExpirationMonth.hashCode() : 0);
+ result = 31 * result + (ccExpirationYear != null ? ccExpirationYear.hashCode() : 0);
+ result = 31 * result + (ccLast4 != null ? ccLast4.hashCode() : 0);
+ result = 31 * result + (address1 != null ? address1.hashCode() : 0);
+ result = 31 * result + (address2 != null ? address2.hashCode() : 0);
+ result = 31 * result + (city != null ? city.hashCode() : 0);
+ result = 31 * result + (state != null ? state.hashCode() : 0);
+ result = 31 * result + (zip != null ? zip.hashCode() : 0);
+ result = 31 * result + (country != null ? country.hashCode() : 0);
+ result = 31 * result + (properties != null ? properties.hashCode() : 0);
+ return result;
+ }
}
public static final class PaymentMethodProperties {
@@ -381,5 +540,47 @@ public class PaymentMethodJson {
public Boolean getIsUpdatable() {
return isUpdatable;
}
+
+ @Override
+ public String toString() {
+ final StringBuilder sb = new StringBuilder("PaymentMethodProperties{");
+ sb.append("key='").append(key).append('\'');
+ sb.append(", value='").append(value).append('\'');
+ sb.append(", isUpdatable=").append(isUpdatable);
+ sb.append('}');
+ return sb.toString();
+ }
+
+ @Override
+ public boolean equals(final Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+
+ final PaymentMethodProperties that = (PaymentMethodProperties) o;
+
+ if (isUpdatable != null ? !isUpdatable.equals(that.isUpdatable) : that.isUpdatable != null) {
+ return false;
+ }
+ if (key != null ? !key.equals(that.key) : that.key != null) {
+ return false;
+ }
+ if (value != null ? !value.equals(that.value) : that.value != null) {
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = key != null ? key.hashCode() : 0;
+ result = 31 * result + (value != null ? value.hashCode() : 0);
+ result = 31 * result + (isUpdatable != null ? isUpdatable.hashCode() : 0);
+ return result;
+ }
}
}
diff --git a/jaxrs/src/main/java/com/ning/billing/jaxrs/resources/AccountResource.java b/jaxrs/src/main/java/com/ning/billing/jaxrs/resources/AccountResource.java
index 241f21a..5dcb5e9 100644
--- a/jaxrs/src/main/java/com/ning/billing/jaxrs/resources/AccountResource.java
+++ b/jaxrs/src/main/java/com/ning/billing/jaxrs/resources/AccountResource.java
@@ -23,6 +23,7 @@ import java.util.LinkedList;
import java.util.List;
import java.util.UUID;
+import javax.annotation.Nullable;
import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
@@ -93,6 +94,7 @@ import com.ning.billing.util.tag.ControlTagType;
import com.google.common.base.Function;
import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.Collections2;
+import com.google.common.collect.ImmutableList;
import com.google.common.collect.Multimap;
import com.google.inject.Inject;
import com.google.inject.Singleton;
@@ -142,7 +144,26 @@ public class AccountResource extends JaxRsResourceBase {
@javax.ws.rs.core.Context final HttpServletRequest request) throws AccountApiException {
final TenantContext tenantContext = context.createContext(request);
final Account account = accountApi.getAccountById(UUID.fromString(accountId), tenantContext);
- return getAccount(account, accountWithBalance, accountWithBalanceAndCBA, tenantContext);
+ final AccountJson accountJson = getAccount(account, accountWithBalance, accountWithBalanceAndCBA, tenantContext);
+ return Response.status(Status.OK).entity(accountJson).build();
+ }
+
+ @GET
+ @Path("/" + SEARCH + "/{searchKey:" + ANYTHING_PATTERN + "}")
+ @Produces(APPLICATION_JSON)
+ public Response searchAccounts(@PathParam("searchKey") final String searchKey,
+ @QueryParam(QUERY_ACCOUNT_WITH_BALANCE) @DefaultValue("false") final Boolean accountWithBalance,
+ @QueryParam(QUERY_ACCOUNT_WITH_BALANCE_AND_CBA) @DefaultValue("false") final Boolean accountWithBalanceAndCBA,
+ @javax.ws.rs.core.Context final HttpServletRequest request) throws AccountApiException {
+ final TenantContext tenantContext = context.createContext(request);
+ final List<Account> accounts = accountApi.searchAccounts(searchKey, tenantContext);
+ final List<AccountJson> accountsJson = ImmutableList.<AccountJson>copyOf(Collections2.transform(accounts, new Function<Account, AccountJson>() {
+ @Override
+ public AccountJson apply(final Account account) {
+ return getAccount(account, accountWithBalance, accountWithBalanceAndCBA, tenantContext);
+ }
+ }));
+ return Response.status(Status.OK).entity(accountsJson).build();
}
@GET
@@ -180,22 +201,22 @@ public class AccountResource extends JaxRsResourceBase {
@javax.ws.rs.core.Context final HttpServletRequest request) throws AccountApiException {
final TenantContext tenantContext = context.createContext(request);
final Account account = accountApi.getAccountByKey(externalKey, tenantContext);
- return getAccount(account, accountWithBalance, accountWithBalanceAndCBA, tenantContext);
+ final AccountJson accountJson = getAccount(account, accountWithBalance, accountWithBalanceAndCBA, tenantContext);
+ return Response.status(Status.OK).entity(accountJson).build();
}
- private Response getAccount(final Account account, final Boolean accountWithBalance, final Boolean accountWithBalanceAndCBA, final TenantContext tenantContext) {
+ private AccountJson getAccount(final Account account, final Boolean accountWithBalance, final Boolean accountWithBalanceAndCBA, final TenantContext tenantContext) {
final AccountJson json;
if (accountWithBalanceAndCBA) {
final BigDecimal accountBalance = invoiceApi.getAccountBalance(account.getId(), tenantContext);
final BigDecimal accountCBA = invoiceApi.getAccountCBA(account.getId(), tenantContext);
- json = new AccountJsonWithBalanceAndCBA(account, accountBalance, accountCBA);
+ return new AccountJsonWithBalanceAndCBA(account, accountBalance, accountCBA);
} else if (accountWithBalance) {
final BigDecimal accountBalance = invoiceApi.getAccountBalance(account.getId(), tenantContext);
- json = new AccountJsonWithBalance(account, accountBalance);
+ return new AccountJsonWithBalance(account, accountBalance);
} else {
- json = new AccountJson(account);
+ return new AccountJson(account);
}
- return Response.status(Status.OK).entity(json).build();
}
@POST
diff --git a/jaxrs/src/main/java/com/ning/billing/jaxrs/resources/JaxrsResource.java b/jaxrs/src/main/java/com/ning/billing/jaxrs/resources/JaxrsResource.java
index d72e7f7..fc53f23 100644
--- a/jaxrs/src/main/java/com/ning/billing/jaxrs/resources/JaxrsResource.java
+++ b/jaxrs/src/main/java/com/ning/billing/jaxrs/resources/JaxrsResource.java
@@ -26,6 +26,7 @@ public interface JaxrsResource {
public static final String TIMELINE = "timeline";
public static final String REGISTER_NOTIFICATION_CALLBACK = "registerNotificationCallback";
+ public static final String SEARCH = "search";
/*
* Metadata Additional headers
@@ -40,6 +41,7 @@ public interface JaxrsResource {
public static String STRING_PATTERN = "[\\w-]+";
public static String UUID_PATTERN = "\\w+-\\w+-\\w+-\\w+-\\w+";
public static String NUMBER_PATTERN = "[0-9]+";
+ public static String ANYTHING_PATTERN = ".*";
/*
* Query parameters
@@ -66,6 +68,7 @@ public interface JaxrsResource {
public static final String QUERY_TAGS = "tagList";
public static final String QUERY_CUSTOM_FIELDS = "customFieldList";
+ public static final String QUERY_PAYMENT_METHOD_PLUGIN_NAME = "pluginName";
public static final String QUERY_PAYMENT_METHOD_PLUGIN_INFO = "withPluginInfo";
public static final String QUERY_PAYMENT_METHOD_IS_DEFAULT = "isDefault";
diff --git a/jaxrs/src/main/java/com/ning/billing/jaxrs/resources/PaymentMethodResource.java b/jaxrs/src/main/java/com/ning/billing/jaxrs/resources/PaymentMethodResource.java
index 6459b88..dfccbde 100644
--- a/jaxrs/src/main/java/com/ning/billing/jaxrs/resources/PaymentMethodResource.java
+++ b/jaxrs/src/main/java/com/ning/billing/jaxrs/resources/PaymentMethodResource.java
@@ -16,6 +16,9 @@
package com.ning.billing.jaxrs.resources;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
import java.util.UUID;
import javax.servlet.http.HttpServletRequest;
@@ -46,6 +49,9 @@ import com.ning.billing.util.api.TagUserApi;
import com.ning.billing.util.callcontext.CallContext;
import com.ning.billing.util.callcontext.TenantContext;
+import com.google.common.base.Function;
+import com.google.common.base.Strings;
+import com.google.common.collect.Lists;
import com.google.inject.Inject;
import com.google.inject.Singleton;
@@ -86,6 +92,40 @@ public class PaymentMethodResource extends JaxRsResourceBase {
return Response.status(Status.OK).entity(json).build();
}
+ @GET
+ @Path("/" + SEARCH + "/{searchKey:" + ANYTHING_PATTERN + "}")
+ @Produces(APPLICATION_JSON)
+ public Response searchPaymentMethods(@PathParam("searchKey") final String searchKey,
+ @QueryParam(QUERY_PAYMENT_METHOD_PLUGIN_NAME) final String pluginName,
+ @javax.ws.rs.core.Context final HttpServletRequest request) throws PaymentApiException, AccountApiException {
+ final TenantContext tenantContext = context.createContext(request);
+
+ // Search the plugin(s)
+ final List<PaymentMethod> paymentMethods;
+ if (Strings.isNullOrEmpty(pluginName)) {
+ paymentMethods = paymentApi.searchPaymentMethods(searchKey, tenantContext);
+ } else {
+ paymentMethods = paymentApi.searchPaymentMethods(searchKey, pluginName, tenantContext);
+ }
+
+ // Lookup the associated account(s)
+ final Map<UUID, Account> accounts = new HashMap<UUID, Account>();
+ for (final PaymentMethod paymentMethod : paymentMethods) {
+ if (accounts.get(paymentMethod.getAccountId()) == null) {
+ final Account account = accountApi.getAccountById(paymentMethod.getAccountId(), tenantContext);
+ accounts.put(paymentMethod.getAccountId(), account);
+ }
+ }
+
+ final List<PaymentMethodJson> json = Lists.transform(paymentMethods, new Function<PaymentMethod, PaymentMethodJson>() {
+ @Override
+ public PaymentMethodJson apply(final PaymentMethod paymentMethod) {
+ return PaymentMethodJson.toPaymentMethodJson(accounts.get(paymentMethod.getAccountId()), paymentMethod);
+ }
+ });
+ return Response.status(Status.OK).entity(json).build();
+ }
+
@DELETE
@Produces(APPLICATION_JSON)
@Path("/{paymentMethodId:" + UUID_PATTERN + "}")
junction/killbill-junction.iml 12(+6 -6)
diff --git a/junction/killbill-junction.iml b/junction/killbill-junction.iml
index a78fc69..2010abb 100644
--- a/junction/killbill-junction.iml
+++ b/junction/killbill-junction.iml
@@ -18,13 +18,13 @@
<orderEntry type="library" scope="PROVIDED" name="Maven: javax.inject:javax.inject:1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: aopalliance:aopalliance:1.0" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: com.h2database:h2:1.3.158" level="project" />
- <orderEntry type="library" name="Maven: com.ning.billing:killbill-api:0.3.3" level="project" />
+ <orderEntry type="library" name="Maven: com.ning.billing:killbill-api:0.4.0" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.1.0" level="project" />
<orderEntry type="library" name="Maven: joda-time:joda-time:2.0" level="project" />
<orderEntry type="module" module-name="killbill-catalog" scope="TEST" production-on-test="" />
- <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing:killbill-catalog:test-jar:tests:0.3.6-SNAPSHOT" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing:killbill-catalog:test-jar:tests:0.3.7-SNAPSHOT" level="project" />
<orderEntry type="module" module-name="killbill-internal-api" />
- <orderEntry type="library" name="Maven: com.ning.billing.plugin:killbill-plugin-api-payment:0.2.6" level="project" />
+ <orderEntry type="library" name="Maven: com.ning.billing.plugin:killbill-plugin-api-payment:0.3.0" level="project" />
<orderEntry type="library" name="Maven: org.skife.config:config-magic:0.14" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.5" level="project" />
<orderEntry type="module" module-name="killbill-util" />
@@ -41,7 +41,7 @@
<orderEntry type="library" name="Maven: org.jdbi:jdbi:2.39.1" level="project" />
<orderEntry type="library" name="Maven: com.yammer.metrics:metrics-core:2.1.2" level="project" />
<orderEntry type="library" name="Maven: org.weakref:jmxutils:1.12" level="project" />
- <orderEntry type="library" name="Maven: com.ning.billing.plugin:killbill-plugin-api-notification:0.2.6" level="project" />
+ <orderEntry type="library" name="Maven: com.ning.billing.plugin:killbill-plugin-api-notification:0.3.0" level="project" />
<orderEntry type="library" name="Maven: com.samskivert:jmustache:1.5" level="project" />
<orderEntry type="library" name="Maven: net.sf.ehcache:ehcache-core:2.6.2" level="project" />
<orderEntry type="library" name="Maven: org.antlr:stringtemplate:3.2.1" level="project" />
@@ -51,10 +51,10 @@
<orderEntry type="library" name="Maven: javax.activation:activation:1.1" level="project" />
<orderEntry type="module" module-name="killbill-catalog" scope="TEST" />
<orderEntry type="module" module-name="killbill-entitlement" scope="TEST" production-on-test="" />
- <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing:killbill-entitlement:test-jar:tests:0.3.6-SNAPSHOT" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing:killbill-entitlement:test-jar:tests:0.3.7-SNAPSHOT" level="project" />
<orderEntry type="module" module-name="killbill-entitlement" scope="TEST" />
<orderEntry type="module" module-name="killbill-util" scope="TEST" production-on-test="" />
- <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing:killbill-util:test-jar:tests:0.3.6-SNAPSHOT" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing:killbill-util:test-jar:tests:0.3.7-SNAPSHOT" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: com.ning.billing.commons:killbill-clock:test-jar:tests:0.1.7" level="project" />
<orderEntry type="library" scope="RUNTIME" name="Maven: mysql:mysql-connector-java:5.1.22" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: mysql:mysql-connector-mxj:5.0.12" level="project" />
osgi/killbill-osgi.iml 8(+4 -4)
diff --git a/osgi/killbill-osgi.iml b/osgi/killbill-osgi.iml
index 949cc1b..4afaa11 100644
--- a/osgi/killbill-osgi.iml
+++ b/osgi/killbill-osgi.iml
@@ -20,11 +20,11 @@
<orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-core:1.1" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: cglib:cglib-nodep:2.2" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.objenesis:objenesis:1.2" level="project" />
- <orderEntry type="library" name="Maven: com.ning.billing:killbill-api:0.3.3" level="project" />
+ <orderEntry type="library" name="Maven: com.ning.billing:killbill-api:0.4.0" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.1.0" level="project" />
<orderEntry type="library" name="Maven: joda-time:joda-time:2.0" level="project" />
<orderEntry type="module" module-name="killbill-internal-api" />
- <orderEntry type="library" name="Maven: com.ning.billing.plugin:killbill-plugin-api-payment:0.2.6" level="project" />
+ <orderEntry type="library" name="Maven: com.ning.billing.plugin:killbill-plugin-api-payment:0.3.0" level="project" />
<orderEntry type="library" name="Maven: org.skife.config:config-magic:0.14" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.5" level="project" />
<orderEntry type="module" module-name="killbill-osgi-bundles-lib-killbill" />
@@ -46,7 +46,7 @@
<orderEntry type="library" name="Maven: org.jdbi:jdbi:2.39.1" level="project" />
<orderEntry type="library" name="Maven: com.yammer.metrics:metrics-core:2.1.2" level="project" />
<orderEntry type="library" name="Maven: org.weakref:jmxutils:1.12" level="project" />
- <orderEntry type="library" name="Maven: com.ning.billing.plugin:killbill-plugin-api-notification:0.2.6" level="project" />
+ <orderEntry type="library" name="Maven: com.ning.billing.plugin:killbill-plugin-api-notification:0.3.0" level="project" />
<orderEntry type="library" name="Maven: com.samskivert:jmustache:1.5" level="project" />
<orderEntry type="library" name="Maven: net.sf.ehcache:ehcache-core:2.6.2" level="project" />
<orderEntry type="library" name="Maven: org.antlr:stringtemplate:3.2.1" level="project" />
@@ -55,7 +55,7 @@
<orderEntry type="library" name="Maven: javax.mail:mail:1.4.1" level="project" />
<orderEntry type="library" name="Maven: javax.activation:activation:1.1" level="project" />
<orderEntry type="module" module-name="killbill-util" scope="TEST" production-on-test="" />
- <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing:killbill-util:test-jar:tests:0.3.6-SNAPSHOT" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing:killbill-util:test-jar:tests:0.3.7-SNAPSHOT" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: com.ning.billing.commons:killbill-clock:test-jar:tests:0.1.7" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: javax.servlet:javax.servlet-api:3.0.1" level="project" />
<orderEntry type="library" name="Maven: org.apache.felix:org.apache.felix.framework:4.0.3" level="project" />
diff --git a/osgi-bundles/bundles/jruby/killbill-osgi-bundles-jruby.iml b/osgi-bundles/bundles/jruby/killbill-osgi-bundles-jruby.iml
index 48e4cbe..9354494 100644
--- a/osgi-bundles/bundles/jruby/killbill-osgi-bundles-jruby.iml
+++ b/osgi-bundles/bundles/jruby/killbill-osgi-bundles-jruby.iml
@@ -10,11 +10,11 @@
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Maven: com.google.guava:guava:14.0.1" level="project" />
- <orderEntry type="library" name="Maven: com.ning.billing:killbill-api:0.3.3" level="project" />
+ <orderEntry type="library" name="Maven: com.ning.billing:killbill-api:0.4.0" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.1.0" level="project" />
<orderEntry type="library" name="Maven: joda-time:joda-time:2.0" level="project" />
- <orderEntry type="library" name="Maven: com.ning.billing.plugin:killbill-plugin-api-notification:0.2.6" level="project" />
- <orderEntry type="library" name="Maven: com.ning.billing.plugin:killbill-plugin-api-payment:0.2.6" level="project" />
+ <orderEntry type="library" name="Maven: com.ning.billing.plugin:killbill-plugin-api-notification:0.3.0" level="project" />
+ <orderEntry type="library" name="Maven: com.ning.billing.plugin:killbill-plugin-api-payment:0.3.0" level="project" />
<orderEntry type="module" module-name="killbill-osgi-bundles-lib-killbill" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.code.findbugs:jsr305:1.3.9" level="project" />
<orderEntry type="library" name="Maven: org.osgi:org.osgi.compendium:4.3.1" level="project" />
diff --git a/osgi-bundles/bundles/jruby/src/main/java/com/ning/billing/osgi/bundles/jruby/JRubyPaymentPlugin.java b/osgi-bundles/bundles/jruby/src/main/java/com/ning/billing/osgi/bundles/jruby/JRubyPaymentPlugin.java
index ae9fecf..4868c1f 100644
--- a/osgi-bundles/bundles/jruby/src/main/java/com/ning/billing/osgi/bundles/jruby/JRubyPaymentPlugin.java
+++ b/osgi-bundles/bundles/jruby/src/main/java/com/ning/billing/osgi/bundles/jruby/JRubyPaymentPlugin.java
@@ -168,6 +168,16 @@ public class JRubyPaymentPlugin extends JRubyPlugin implements PaymentPluginApi
}
@Override
+ public List<PaymentMethodPlugin> searchPaymentMethods(final String searchKey, final TenantContext tenantContext) throws PaymentPluginApiException {
+ return callWithRuntimeAndChecking(new PluginCallback(VALIDATION_PLUGIN_TYPE.PAYMENT) {
+ @Override
+ public List<PaymentMethodPlugin> doCall(final Ruby runtime) throws PaymentPluginApiException {
+ return ((PaymentPluginApi) pluginInstance).searchPaymentMethods(searchKey, tenantContext);
+ }
+ });
+ }
+
+ @Override
public void resetPaymentMethods(final UUID kbAccountId, final List<PaymentMethodInfoPlugin> paymentMethods) throws PaymentPluginApiException {
callWithRuntimeAndChecking(new PluginCallback(VALIDATION_PLUGIN_TYPE.PAYMENT) {
@@ -178,6 +188,4 @@ public class JRubyPaymentPlugin extends JRubyPlugin implements PaymentPluginApi
}
});
}
-
-
}
diff --git a/osgi-bundles/defaultbundles/killbill-osgi-bundles-defaultbundles.iml b/osgi-bundles/defaultbundles/killbill-osgi-bundles-defaultbundles.iml
index 5abc8c3..9f8e6fa 100644
--- a/osgi-bundles/defaultbundles/killbill-osgi-bundles-defaultbundles.iml
+++ b/osgi-bundles/defaultbundles/killbill-osgi-bundles-defaultbundles.iml
@@ -11,11 +11,11 @@
<orderEntry type="library" name="Maven: com.ning.billing:killbill-osgi-bundles-analytics:0.3.4" level="project" />
<orderEntry type="module" module-name="killbill-osgi-bundles-jruby" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.guava:guava:14.0.1" level="project" />
- <orderEntry type="library" name="Maven: com.ning.billing:killbill-api:0.3.3" level="project" />
+ <orderEntry type="library" name="Maven: com.ning.billing:killbill-api:0.4.0" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.1.0" level="project" />
<orderEntry type="library" name="Maven: joda-time:joda-time:2.0" level="project" />
- <orderEntry type="library" name="Maven: com.ning.billing.plugin:killbill-plugin-api-notification:0.2.6" level="project" />
- <orderEntry type="library" name="Maven: com.ning.billing.plugin:killbill-plugin-api-payment:0.2.6" level="project" />
+ <orderEntry type="library" name="Maven: com.ning.billing.plugin:killbill-plugin-api-notification:0.3.0" level="project" />
+ <orderEntry type="library" name="Maven: com.ning.billing.plugin:killbill-plugin-api-payment:0.3.0" level="project" />
<orderEntry type="module" module-name="killbill-osgi-bundles-lib-killbill" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.code.findbugs:jsr305:1.3.9" level="project" />
<orderEntry type="library" name="Maven: org.osgi:org.osgi.compendium:4.3.1" level="project" />
diff --git a/osgi-bundles/libs/killbill/killbill-osgi-bundles-lib-killbill.iml b/osgi-bundles/libs/killbill/killbill-osgi-bundles-lib-killbill.iml
index bc7d006..fa7e486 100644
--- a/osgi-bundles/libs/killbill/killbill-osgi-bundles-lib-killbill.iml
+++ b/osgi-bundles/libs/killbill/killbill-osgi-bundles-lib-killbill.iml
@@ -13,10 +13,10 @@
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Maven: com.google.code.findbugs:jsr305:1.3.9" level="project" />
- <orderEntry type="library" scope="PROVIDED" name="Maven: com.ning.billing:killbill-api:0.3.3" level="project" />
+ <orderEntry type="library" scope="PROVIDED" name="Maven: com.ning.billing:killbill-api:0.4.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.1.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: joda-time:joda-time:2.0" level="project" />
- <orderEntry type="library" scope="PROVIDED" name="Maven: com.ning.billing.plugin:killbill-plugin-api-notification:0.2.6" level="project" />
+ <orderEntry type="library" scope="PROVIDED" name="Maven: com.ning.billing.plugin:killbill-plugin-api-notification:0.3.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: javax.servlet:javax.servlet-api:3.0.1" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.mockito:mockito-all:1.9.0" level="project" />
<orderEntry type="library" name="Maven: org.osgi:org.osgi.compendium:4.3.1" level="project" />
diff --git a/osgi-bundles/tests/beatrix/killbill-osgi-bundles-test-beatrix.iml b/osgi-bundles/tests/beatrix/killbill-osgi-bundles-test-beatrix.iml
index c2d3eb8..fa05771 100644
--- a/osgi-bundles/tests/beatrix/killbill-osgi-bundles-test-beatrix.iml
+++ b/osgi-bundles/tests/beatrix/killbill-osgi-bundles-test-beatrix.iml
@@ -12,15 +12,15 @@
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
- <orderEntry type="library" name="Maven: com.ning.billing:killbill-api:0.3.3" level="project" />
+ <orderEntry type="library" name="Maven: com.ning.billing:killbill-api:0.4.0" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.1.0" level="project" />
<orderEntry type="library" name="Maven: joda-time:joda-time:2.0" level="project" />
<orderEntry type="module" module-name="killbill-osgi-bundles-lib-killbill" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.code.findbugs:jsr305:1.3.9" level="project" />
<orderEntry type="library" name="Maven: org.osgi:org.osgi.compendium:4.3.1" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:osgi-over-slf4j:1.7.5" level="project" />
- <orderEntry type="library" name="Maven: com.ning.billing.plugin:killbill-plugin-api-notification:0.2.6" level="project" />
- <orderEntry type="library" name="Maven: com.ning.billing.plugin:killbill-plugin-api-payment:0.2.6" level="project" />
+ <orderEntry type="library" name="Maven: com.ning.billing.plugin:killbill-plugin-api-notification:0.3.0" level="project" />
+ <orderEntry type="library" name="Maven: com.ning.billing.plugin:killbill-plugin-api-payment:0.3.0" level="project" />
<orderEntry type="library" name="Maven: org.jdbi:jdbi:2.39.1" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.mockito:mockito-all:1.9.0" level="project" />
<orderEntry type="library" name="Maven: org.osgi:org.osgi.core:4.3.1" level="project" />
diff --git a/osgi-bundles/tests/beatrix/src/test/java/com/ning/billing/osgi/bundles/test/TestPaymentPluginApi.java b/osgi-bundles/tests/beatrix/src/test/java/com/ning/billing/osgi/bundles/test/TestPaymentPluginApi.java
index a20285d..600f5af 100644
--- a/osgi-bundles/tests/beatrix/src/test/java/com/ning/billing/osgi/bundles/test/TestPaymentPluginApi.java
+++ b/osgi-bundles/tests/beatrix/src/test/java/com/ning/billing/osgi/bundles/test/TestPaymentPluginApi.java
@@ -53,22 +53,27 @@ public class TestPaymentPluginApi implements PaymentPluginApi {
public BigDecimal getAmount() {
return amount;
}
+
@Override
public DateTime getCreatedDate() {
return new DateTime();
}
+
@Override
public DateTime getEffectiveDate() {
return new DateTime();
}
+
@Override
public PaymentPluginStatus getStatus() {
return PaymentPluginStatus.PROCESSED;
}
+
@Override
public String getGatewayError() {
return null;
}
+
@Override
public String getGatewayErrorCode() {
return null;
@@ -120,12 +125,15 @@ public class TestPaymentPluginApi implements PaymentPluginApi {
@Override
public List<PaymentMethodInfoPlugin> getPaymentMethods(final UUID kbAccountId, final boolean refreshFromGateway, final CallContext context) throws PaymentPluginApiException {
- return null;
+ return Collections.emptyList();
}
@Override
- public void resetPaymentMethods(final UUID kbAccountId, final List<PaymentMethodInfoPlugin> paymentMethods) throws PaymentPluginApiException {
+ public List<PaymentMethodPlugin> searchPaymentMethods(final String searchKey, final TenantContext tenantContext) throws PaymentPluginApiException {
+ return Collections.emptyList();
}
-
+ @Override
+ public void resetPaymentMethods(final UUID kbAccountId, final List<PaymentMethodInfoPlugin> paymentMethods) throws PaymentPluginApiException {
+ }
}
diff --git a/osgi-bundles/tests/payment/killbill-osgi-bundles-test-payment.iml b/osgi-bundles/tests/payment/killbill-osgi-bundles-test-payment.iml
index a0b3c91..314accd 100644
--- a/osgi-bundles/tests/payment/killbill-osgi-bundles-test-payment.iml
+++ b/osgi-bundles/tests/payment/killbill-osgi-bundles-test-payment.iml
@@ -11,7 +11,7 @@
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
- <orderEntry type="library" name="Maven: com.ning.billing:killbill-api:0.3.3" level="project" />
+ <orderEntry type="library" name="Maven: com.ning.billing:killbill-api:0.4.0" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.1.0" level="project" />
<orderEntry type="library" name="Maven: joda-time:joda-time:2.0" level="project" />
<orderEntry type="module" module-name="killbill-osgi-bundles-lib-killbill" />
@@ -19,7 +19,7 @@
<orderEntry type="library" name="Maven: org.osgi:org.osgi.compendium:4.3.1" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:osgi-over-slf4j:1.7.5" level="project" />
<orderEntry type="module" module-name="killbill-util" production-on-test="" />
- <orderEntry type="library" name="Maven: com.ning.billing:killbill-util:test-jar:tests:0.3.6-SNAPSHOT" level="project" />
+ <orderEntry type="library" name="Maven: com.ning.billing:killbill-util:test-jar:tests:0.3.7-SNAPSHOT" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.1.0" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-core:2.1.0" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.dataformat:jackson-dataformat-csv:2.1.0" level="project" />
@@ -29,7 +29,7 @@
<orderEntry type="library" name="Maven: com.mchange:c3p0:0.9.2" level="project" />
<orderEntry type="library" name="Maven: com.mchange:mchange-commons-java:0.2.3.3" level="project" />
<orderEntry type="module" module-name="killbill-internal-api" />
- <orderEntry type="library" name="Maven: com.ning.billing.plugin:killbill-plugin-api-payment:0.2.6" level="project" />
+ <orderEntry type="library" name="Maven: com.ning.billing.plugin:killbill-plugin-api-payment:0.3.0" level="project" />
<orderEntry type="library" name="Maven: org.skife.config:config-magic:0.14" level="project" />
<orderEntry type="library" name="Maven: com.ning.billing.commons:killbill-clock:0.1.7" level="project" />
<orderEntry type="library" name="Maven: com.ning.billing.commons:killbill-queue:0.1.7" level="project" />
@@ -38,7 +38,7 @@
<orderEntry type="library" name="Maven: org.jdbi:jdbi:2.39.1" level="project" />
<orderEntry type="library" name="Maven: com.yammer.metrics:metrics-core:2.1.2" level="project" />
<orderEntry type="library" name="Maven: org.weakref:jmxutils:1.12" level="project" />
- <orderEntry type="library" name="Maven: com.ning.billing.plugin:killbill-plugin-api-notification:0.2.6" level="project" />
+ <orderEntry type="library" name="Maven: com.ning.billing.plugin:killbill-plugin-api-notification:0.3.0" level="project" />
<orderEntry type="library" name="Maven: com.samskivert:jmustache:1.5" level="project" />
<orderEntry type="library" name="Maven: net.sf.ehcache:ehcache-core:2.6.2" level="project" />
<orderEntry type="library" name="Maven: org.antlr:stringtemplate:3.2.1" level="project" />
diff --git a/osgi-bundles/tests/payment/src/test/java/com/ning/billing/osgi/bundles/test/TestPaymentPluginApi.java b/osgi-bundles/tests/payment/src/test/java/com/ning/billing/osgi/bundles/test/TestPaymentPluginApi.java
index 65295ba..804e548 100644
--- a/osgi-bundles/tests/payment/src/test/java/com/ning/billing/osgi/bundles/test/TestPaymentPluginApi.java
+++ b/osgi-bundles/tests/payment/src/test/java/com/ning/billing/osgi/bundles/test/TestPaymentPluginApi.java
@@ -190,7 +190,12 @@ public class TestPaymentPluginApi implements PaymentPluginApiWithTestControl {
@Override
public List<PaymentMethodInfoPlugin> getPaymentMethods(final UUID kbAccountId, final boolean refreshFromGateway, final CallContext context) throws PaymentPluginApiException {
- return null;
+ return Collections.emptyList();
+ }
+
+ @Override
+ public List<PaymentMethodPlugin> searchPaymentMethods(final String s, final TenantContext tenantContext) throws PaymentPluginApiException {
+ return Collections.emptyList();
}
@Override
overdue/killbill-overdue.iml 10(+5 -5)
diff --git a/overdue/killbill-overdue.iml b/overdue/killbill-overdue.iml
index 2014aa0..2913d2d 100644
--- a/overdue/killbill-overdue.iml
+++ b/overdue/killbill-overdue.iml
@@ -22,13 +22,13 @@
<orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-core:1.1" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: cglib:cglib-nodep:2.2" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.objenesis:objenesis:1.2" level="project" />
- <orderEntry type="library" name="Maven: com.ning.billing:killbill-api:0.3.3" level="project" />
+ <orderEntry type="library" name="Maven: com.ning.billing:killbill-api:0.4.0" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.1.0" level="project" />
<orderEntry type="library" name="Maven: joda-time:joda-time:2.0" level="project" />
<orderEntry type="module" module-name="killbill-catalog" scope="TEST" production-on-test="" />
- <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing:killbill-catalog:test-jar:tests:0.3.6-SNAPSHOT" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing:killbill-catalog:test-jar:tests:0.3.7-SNAPSHOT" level="project" />
<orderEntry type="module" module-name="killbill-internal-api" />
- <orderEntry type="library" name="Maven: com.ning.billing.plugin:killbill-plugin-api-payment:0.2.6" level="project" />
+ <orderEntry type="library" name="Maven: com.ning.billing.plugin:killbill-plugin-api-payment:0.3.0" level="project" />
<orderEntry type="library" name="Maven: org.skife.config:config-magic:0.14" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.5" level="project" />
<orderEntry type="module" module-name="killbill-util" />
@@ -45,7 +45,7 @@
<orderEntry type="library" name="Maven: org.jdbi:jdbi:2.39.1" level="project" />
<orderEntry type="library" name="Maven: com.yammer.metrics:metrics-core:2.1.2" level="project" />
<orderEntry type="library" name="Maven: org.weakref:jmxutils:1.12" level="project" />
- <orderEntry type="library" name="Maven: com.ning.billing.plugin:killbill-plugin-api-notification:0.2.6" level="project" />
+ <orderEntry type="library" name="Maven: com.ning.billing.plugin:killbill-plugin-api-notification:0.3.0" level="project" />
<orderEntry type="library" name="Maven: com.samskivert:jmustache:1.5" level="project" />
<orderEntry type="library" name="Maven: net.sf.ehcache:ehcache-core:2.6.2" level="project" />
<orderEntry type="library" name="Maven: org.antlr:stringtemplate:3.2.1" level="project" />
@@ -55,7 +55,7 @@
<orderEntry type="library" name="Maven: javax.activation:activation:1.1" level="project" />
<orderEntry type="module" module-name="killbill-catalog" scope="TEST" />
<orderEntry type="module" module-name="killbill-util" scope="TEST" production-on-test="" />
- <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing:killbill-util:test-jar:tests:0.3.6-SNAPSHOT" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing:killbill-util:test-jar:tests:0.3.7-SNAPSHOT" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: com.ning.billing.commons:killbill-clock:test-jar:tests:0.1.7" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: com.ning.billing.commons:killbill-queue:test-jar:tests:0.1.7" level="project" />
<orderEntry type="library" scope="RUNTIME" name="Maven: mysql:mysql-connector-java:5.1.22" level="project" />
payment/killbill-payment.iml 14(+7 -7)
diff --git a/payment/killbill-payment.iml b/payment/killbill-payment.iml
index 79e1118..2b818dc 100644
--- a/payment/killbill-payment.iml
+++ b/payment/killbill-payment.iml
@@ -25,14 +25,14 @@
<orderEntry type="library" scope="TEST" name="Maven: cglib:cglib-nodep:2.2" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.objenesis:objenesis:1.2" level="project" />
<orderEntry type="module" module-name="killbill-account" scope="TEST" production-on-test="" />
- <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing:killbill-account:test-jar:tests:0.3.6-SNAPSHOT" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing:killbill-account:test-jar:tests:0.3.7-SNAPSHOT" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.1.0" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.1.0" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-core:2.1.0" level="project" />
- <orderEntry type="library" name="Maven: com.ning.billing:killbill-api:0.3.3" level="project" />
+ <orderEntry type="library" name="Maven: com.ning.billing:killbill-api:0.4.0" level="project" />
<orderEntry type="library" name="Maven: joda-time:joda-time:2.0" level="project" />
<orderEntry type="module" module-name="killbill-internal-api" />
- <orderEntry type="library" name="Maven: com.ning.billing.plugin:killbill-plugin-api-payment:0.2.6" level="project" />
+ <orderEntry type="library" name="Maven: com.ning.billing.plugin:killbill-plugin-api-payment:0.3.0" level="project" />
<orderEntry type="library" name="Maven: org.skife.config:config-magic:0.14" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.5" level="project" />
<orderEntry type="module" module-name="killbill-util" />
@@ -47,7 +47,7 @@
<orderEntry type="library" name="Maven: org.jdbi:jdbi:2.39.1" level="project" />
<orderEntry type="library" name="Maven: com.yammer.metrics:metrics-core:2.1.2" level="project" />
<orderEntry type="library" name="Maven: org.weakref:jmxutils:1.12" level="project" />
- <orderEntry type="library" name="Maven: com.ning.billing.plugin:killbill-plugin-api-notification:0.2.6" level="project" />
+ <orderEntry type="library" name="Maven: com.ning.billing.plugin:killbill-plugin-api-notification:0.3.0" level="project" />
<orderEntry type="library" name="Maven: com.samskivert:jmustache:1.5" level="project" />
<orderEntry type="library" name="Maven: net.sf.ehcache:ehcache-core:2.6.2" level="project" />
<orderEntry type="library" name="Maven: org.antlr:stringtemplate:3.2.1" level="project" />
@@ -56,12 +56,12 @@
<orderEntry type="library" name="Maven: javax.mail:mail:1.4.1" level="project" />
<orderEntry type="library" name="Maven: javax.activation:activation:1.1" level="project" />
<orderEntry type="module" module-name="killbill-invoice" scope="TEST" production-on-test="" />
- <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing:killbill-invoice:test-jar:tests:0.3.6-SNAPSHOT" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing:killbill-invoice:test-jar:tests:0.3.7-SNAPSHOT" level="project" />
<orderEntry type="module" module-name="killbill-junction" scope="TEST" production-on-test="" />
- <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing:killbill-junction:test-jar:tests:0.3.6-SNAPSHOT" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing:killbill-junction:test-jar:tests:0.3.7-SNAPSHOT" level="project" />
<orderEntry type="library" scope="RUNTIME" name="Maven: mysql:mysql-connector-java:5.1.22" level="project" />
<orderEntry type="module" module-name="killbill-util" scope="TEST" production-on-test="" />
- <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing:killbill-util:test-jar:tests:0.3.6-SNAPSHOT" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing:killbill-util:test-jar:tests:0.3.7-SNAPSHOT" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: com.ning.billing.commons:killbill-clock:test-jar:tests:0.1.7" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: com.ning.billing.commons:killbill-queue:test-jar:tests:0.1.7" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: mysql:mysql-connector-mxj:5.0.12" level="project" />
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 394c848..943f9d6 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
@@ -173,6 +173,16 @@ public class DefaultPaymentApi implements PaymentApi {
}
@Override
+ public List<PaymentMethod> searchPaymentMethods(final String searchKey, final TenantContext context) {
+ return methodProcessor.searchPaymentMethods(searchKey, internalCallContextFactory.createInternalTenantContext(context));
+ }
+
+ @Override
+ public List<PaymentMethod> searchPaymentMethods(final String searchKey, final String pluginName, final TenantContext context) throws PaymentApiException {
+ return methodProcessor.searchPaymentMethods(searchKey, pluginName, internalCallContextFactory.createInternalTenantContext(context));
+ }
+
+ @Override
public void deletedPaymentMethod(final Account account, final UUID paymentMethodId, final boolean deleteDefaultPaymentMethodWithAutoPayOff, final CallContext context)
throws PaymentApiException {
methodProcessor.deletedPaymentMethod(account, paymentMethodId, deleteDefaultPaymentMethodWithAutoPayOff, internalCallContextFactory.createInternalCallContext(account.getId(), context));
diff --git a/payment/src/main/java/com/ning/billing/payment/core/PaymentMethodProcessor.java b/payment/src/main/java/com/ning/billing/payment/core/PaymentMethodProcessor.java
index 2318459..28def62 100644
--- a/payment/src/main/java/com/ning/billing/payment/core/PaymentMethodProcessor.java
+++ b/payment/src/main/java/com/ning/billing/payment/core/PaymentMethodProcessor.java
@@ -18,6 +18,7 @@ package com.ning.billing.payment.core;
import java.util.ArrayList;
import java.util.Collections;
+import java.util.LinkedList;
import java.util.List;
import java.util.Set;
import java.util.UUID;
@@ -150,6 +151,45 @@ public class PaymentMethodProcessor extends ProcessorBase {
return new DefaultPaymentMethod(paymentMethodModelDao, paymentMethodPlugin);
}
+ public List<PaymentMethod> searchPaymentMethods(final String searchKey, final InternalTenantContext internalTenantContext) {
+ final List<PaymentMethod> results = new LinkedList<PaymentMethod>();
+
+ // Search in all plugins
+ for (final String pluginName : getAvailablePlugins()) {
+ try {
+ results.addAll(searchPaymentMethods(searchKey, pluginName, internalTenantContext));
+ } catch (PaymentApiException e) {
+ log.warn("Error while searching plugin " + pluginName, e);
+ // Non-fatal, continue to search other plugins
+ }
+ }
+
+ return results;
+ }
+
+ public List<PaymentMethod> searchPaymentMethods(final String searchKey, final String pluginName, final InternalTenantContext internalTenantContext) throws PaymentApiException {
+ final PaymentPluginApi pluginApi = getPaymentPluginApi(pluginName);
+ final List<PaymentMethodPlugin> paymentMethods;
+ try {
+ paymentMethods = pluginApi.searchPaymentMethods(searchKey, internalTenantContext.toTenantContext());
+ } catch (PaymentPluginApiException e) {
+ throw new PaymentApiException(e, ErrorCode.PAYMENT_PLUGIN_SEARCH_PAYMENT_METHODS, pluginName, searchKey);
+ }
+
+ final List<PaymentMethod> results = new LinkedList<PaymentMethod>();
+ for (final PaymentMethodPlugin paymentMethodPlugin : paymentMethods) {
+ final PaymentMethodModelDao paymentMethodModelDao = paymentDao.getPaymentMethodIncludedDeleted(paymentMethodPlugin.getKbPaymentMethodId(), internalTenantContext);
+ if (paymentMethodModelDao == null) {
+ log.warn("Unable to find payment method id " + paymentMethodPlugin.getKbPaymentMethodId() + " present in plugin " + pluginName);
+ continue;
+ }
+
+ results.add(new DefaultPaymentMethod(paymentMethodModelDao, paymentMethodPlugin));
+ }
+
+ return results;
+ }
+
public PaymentMethod getExternalPaymentMethod(final Account account, final InternalTenantContext context) throws PaymentApiException {
final List<PaymentMethod> paymentMethods = getPaymentMethods(account, false, context);
for (final PaymentMethod paymentMethod : paymentMethods) {
diff --git a/payment/src/main/java/com/ning/billing/payment/provider/DefaultNoOpPaymentMethodPlugin.java b/payment/src/main/java/com/ning/billing/payment/provider/DefaultNoOpPaymentMethodPlugin.java
index 89fc2d1..d431522 100644
--- a/payment/src/main/java/com/ning/billing/payment/provider/DefaultNoOpPaymentMethodPlugin.java
+++ b/payment/src/main/java/com/ning/billing/payment/provider/DefaultNoOpPaymentMethodPlugin.java
@@ -24,24 +24,33 @@ import com.ning.billing.payment.api.PaymentMethodPlugin;
public class DefaultNoOpPaymentMethodPlugin implements PaymentMethodPlugin {
+ private final UUID kbPaymentMethodId;
private final String externalId;
private final boolean isDefault;
private List<PaymentMethodKVInfo> props;
- public DefaultNoOpPaymentMethodPlugin(final PaymentMethodPlugin src) {
+ public DefaultNoOpPaymentMethodPlugin(final UUID kbPaymentMethodId, final PaymentMethodPlugin src) {
+ this.kbPaymentMethodId = kbPaymentMethodId;
this.externalId = UUID.randomUUID().toString();
this.isDefault = src.isDefaultPaymentMethod();
this.props = src.getProperties();
}
- public DefaultNoOpPaymentMethodPlugin(final String externalId, final boolean isDefault,
+ public DefaultNoOpPaymentMethodPlugin(final String externalId,
+ final boolean isDefault,
final List<PaymentMethodKVInfo> props) {
+ this.kbPaymentMethodId = null;
this.externalId = externalId;
this.isDefault = isDefault;
this.props = props;
}
@Override
+ public UUID getKbPaymentMethodId() {
+ return kbPaymentMethodId;
+ }
+
+ @Override
public String getExternalPaymentMethodId() {
return externalId;
}
diff --git a/payment/src/main/java/com/ning/billing/payment/provider/DefaultNoOpPaymentProviderPlugin.java b/payment/src/main/java/com/ning/billing/payment/provider/DefaultNoOpPaymentProviderPlugin.java
index 2cd4696..449324a 100644
--- a/payment/src/main/java/com/ning/billing/payment/provider/DefaultNoOpPaymentProviderPlugin.java
+++ b/payment/src/main/java/com/ning/billing/payment/provider/DefaultNoOpPaymentProviderPlugin.java
@@ -37,7 +37,9 @@ import com.ning.billing.util.callcontext.CallContext;
import com.ning.billing.util.callcontext.TenantContext;
import com.ning.billing.clock.Clock;
+import com.google.common.base.Predicate;
import com.google.common.collect.ImmutableList;
+import com.google.common.collect.Iterables;
import com.google.common.collect.LinkedListMultimap;
import com.google.common.collect.Multimap;
import com.google.inject.Inject;
@@ -108,7 +110,7 @@ public class DefaultNoOpPaymentProviderPlugin implements NoOpPaymentPluginApi {
@Override
public void addPaymentMethod(final UUID kbAccountId, final UUID kbPaymentMethodId, final PaymentMethodPlugin paymentMethodProps, final boolean setDefault, final CallContext context) throws PaymentPluginApiException {
- final PaymentMethodPlugin realWithID = new DefaultNoOpPaymentMethodPlugin(paymentMethodProps);
+ final PaymentMethodPlugin realWithID = new DefaultNoOpPaymentMethodPlugin(kbPaymentMethodId, paymentMethodProps);
List<PaymentMethodPlugin> pms = paymentMethods.get(kbPaymentMethodId.toString());
if (pms == null) {
pms = new LinkedList<PaymentMethodPlugin>();
@@ -155,6 +157,22 @@ public class DefaultNoOpPaymentProviderPlugin implements NoOpPaymentPluginApi {
}
@Override
+ public List<PaymentMethodPlugin> searchPaymentMethods(final String searchKey, final TenantContext tenantContext) throws PaymentPluginApiException {
+ return ImmutableList.<PaymentMethodPlugin>copyOf(Iterables.<PaymentMethodPlugin>filter(Iterables.<PaymentMethodPlugin>concat(paymentMethods.values()), new Predicate<PaymentMethodPlugin>() {
+ @Override
+ public boolean apply(final PaymentMethodPlugin input) {
+ return (input.getAddress1() != null && input.getAddress1().contains(searchKey)) ||
+ (input.getAddress2() != null && input.getAddress2().contains(searchKey)) ||
+ (input.getCCLast4() != null && input.getCCLast4().contains(searchKey)) ||
+ (input.getCCName() != null && input.getCCName().contains(searchKey)) ||
+ (input.getCity() != null && input.getCity().contains(searchKey)) ||
+ (input.getState() != null && input.getState().contains(searchKey)) ||
+ (input.getCountry() != null && input.getCountry().contains(searchKey));
+ }
+ }));
+ }
+
+ @Override
public void resetPaymentMethods(final UUID kbAccountId, final List<PaymentMethodInfoPlugin> paymentMethods) {
}
diff --git a/payment/src/main/java/com/ning/billing/payment/provider/ExternalPaymentProviderPlugin.java b/payment/src/main/java/com/ning/billing/payment/provider/ExternalPaymentProviderPlugin.java
index 0b9ee4a..b1b6915 100644
--- a/payment/src/main/java/com/ning/billing/payment/provider/ExternalPaymentProviderPlugin.java
+++ b/payment/src/main/java/com/ning/billing/payment/provider/ExternalPaymentProviderPlugin.java
@@ -22,6 +22,7 @@ import java.util.List;
import java.util.UUID;
import com.ning.billing.catalog.api.Currency;
+import com.ning.billing.clock.Clock;
import com.ning.billing.payment.api.PaymentMethodKVInfo;
import com.ning.billing.payment.api.PaymentMethodPlugin;
import com.ning.billing.payment.plugin.api.PaymentInfoPlugin;
@@ -33,8 +34,8 @@ import com.ning.billing.payment.plugin.api.RefundInfoPlugin;
import com.ning.billing.payment.plugin.api.RefundPluginStatus;
import com.ning.billing.util.callcontext.CallContext;
import com.ning.billing.util.callcontext.TenantContext;
-import com.ning.billing.clock.Clock;
+import com.google.common.collect.ImmutableList;
import com.google.inject.Inject;
/**
@@ -84,7 +85,7 @@ public class ExternalPaymentProviderPlugin implements PaymentPluginApi {
@Override
public PaymentMethodPlugin getPaymentMethodDetail(final UUID kbAccountId, final UUID kbPaymentMethodId, final TenantContext context) throws PaymentPluginApiException {
- return new DefaultNoOpPaymentMethodPlugin("unknow", false, Collections.<PaymentMethodKVInfo>emptyList());
+ return new DefaultNoOpPaymentMethodPlugin("unknown", false, Collections.<PaymentMethodKVInfo>emptyList());
}
@Override
@@ -93,7 +94,12 @@ public class ExternalPaymentProviderPlugin implements PaymentPluginApi {
@Override
public List<PaymentMethodInfoPlugin> getPaymentMethods(final UUID kbAccountId, final boolean refreshFromGateway, final CallContext context) throws PaymentPluginApiException {
- return null;
+ return ImmutableList.<PaymentMethodInfoPlugin>of();
+ }
+
+ @Override
+ public List<PaymentMethodPlugin> searchPaymentMethods(final String s, final TenantContext tenantContext) throws PaymentPluginApiException {
+ return ImmutableList.<PaymentMethodPlugin>of();
}
@Override
diff --git a/payment/src/test/java/com/ning/billing/payment/api/TestPaymentMethodPlugin.java b/payment/src/test/java/com/ning/billing/payment/api/TestPaymentMethodPlugin.java
index d0ae14b..76d28e1 100644
--- a/payment/src/test/java/com/ning/billing/payment/api/TestPaymentMethodPlugin.java
+++ b/payment/src/test/java/com/ning/billing/payment/api/TestPaymentMethodPlugin.java
@@ -17,20 +17,28 @@
package com.ning.billing.payment.api;
import java.util.List;
+import java.util.UUID;
public class TestPaymentMethodPlugin extends TestPaymentMethodPluginBase implements PaymentMethodPlugin {
+ private final UUID kbPaymentMethodId;
private final String externalPaymentMethodId;
private final boolean isDefaultPaymentMethod;
private final List<PaymentMethodKVInfo> properties;
- public TestPaymentMethodPlugin(final PaymentMethodPlugin src, final String externalPaymentId) {
+ public TestPaymentMethodPlugin(final UUID kbPaymentMethodId, final PaymentMethodPlugin src, final String externalPaymentId) {
+ this.kbPaymentMethodId = kbPaymentMethodId;
this.externalPaymentMethodId = externalPaymentId;
this.isDefaultPaymentMethod = src.isDefaultPaymentMethod();
this.properties = src.getProperties();
}
@Override
+ public UUID getKbPaymentMethodId() {
+ return kbPaymentMethodId;
+ }
+
+ @Override
public String getExternalPaymentMethodId() {
return externalPaymentMethodId;
}
@@ -44,5 +52,4 @@ public class TestPaymentMethodPlugin extends TestPaymentMethodPluginBase impleme
public List<PaymentMethodKVInfo> getProperties() {
return properties;
}
-
}
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 66e6b38..3768b18 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
@@ -25,20 +25,22 @@ import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicBoolean;
import com.ning.billing.catalog.api.Currency;
-import com.ning.billing.payment.api.TestPaymentMethodPlugin;
+import com.ning.billing.clock.Clock;
import com.ning.billing.payment.api.PaymentMethodPlugin;
+import com.ning.billing.payment.api.TestPaymentMethodPlugin;
import com.ning.billing.payment.plugin.api.NoOpPaymentPluginApi;
import com.ning.billing.payment.plugin.api.PaymentInfoPlugin;
-import com.ning.billing.payment.plugin.api.PaymentPluginStatus;
import com.ning.billing.payment.plugin.api.PaymentMethodInfoPlugin;
import com.ning.billing.payment.plugin.api.PaymentPluginApiException;
+import com.ning.billing.payment.plugin.api.PaymentPluginStatus;
import com.ning.billing.payment.plugin.api.RefundInfoPlugin;
import com.ning.billing.payment.plugin.api.RefundPluginStatus;
import com.ning.billing.util.callcontext.CallContext;
import com.ning.billing.util.callcontext.TenantContext;
-import com.ning.billing.clock.Clock;
+import com.google.common.base.Predicate;
import com.google.common.collect.ImmutableList;
+import com.google.common.collect.Iterables;
import com.google.common.collect.LinkedListMultimap;
import com.google.common.collect.Multimap;
import com.google.inject.Inject;
@@ -116,7 +118,7 @@ public class MockPaymentProviderPlugin implements NoOpPaymentPluginApi {
@Override
public void addPaymentMethod(final UUID kbAccountId, final UUID kbPaymentMethodId, final PaymentMethodPlugin paymentMethodProps, final boolean setDefault, final CallContext context) throws PaymentPluginApiException {
// externalPaymentMethodId is set to a random value
- final PaymentMethodPlugin realWithID = new TestPaymentMethodPlugin(paymentMethodProps, UUID.randomUUID().toString());
+ final PaymentMethodPlugin realWithID = new TestPaymentMethodPlugin(kbPaymentMethodId, paymentMethodProps, UUID.randomUUID().toString());
paymentMethods.put(kbPaymentMethodId.toString(), realWithID);
final PaymentMethodInfoPlugin realInfoWithID = new DefaultPaymentMethodInfoPlugin(kbAccountId, kbPaymentMethodId, setDefault, UUID.randomUUID().toString());
@@ -144,6 +146,22 @@ public class MockPaymentProviderPlugin implements NoOpPaymentPluginApi {
}
@Override
+ public List<PaymentMethodPlugin> searchPaymentMethods(final String searchKey, final TenantContext tenantContext) throws PaymentPluginApiException {
+ return ImmutableList.<PaymentMethodPlugin>copyOf(Iterables.<PaymentMethodPlugin>filter(paymentMethods.values(), new Predicate<PaymentMethodPlugin>() {
+ @Override
+ public boolean apply(final PaymentMethodPlugin input) {
+ return (input.getAddress1() != null && input.getAddress1().contains(searchKey)) ||
+ (input.getAddress2() != null && input.getAddress2().contains(searchKey)) ||
+ (input.getCCLast4() != null && input.getCCLast4().contains(searchKey)) ||
+ (input.getCCName() != null && input.getCCName().contains(searchKey)) ||
+ (input.getCity() != null && input.getCity().contains(searchKey)) ||
+ (input.getState() != null && input.getState().contains(searchKey)) ||
+ (input.getCountry() != null && input.getCountry().contains(searchKey));
+ }
+ }));
+ }
+
+ @Override
public void resetPaymentMethods(final UUID kbAccountId, final List<PaymentMethodInfoPlugin> input) {
paymentMethodsInfo.clear();
if (input != null) {
pom.xml 2(+1 -1)
diff --git a/pom.xml b/pom.xml
index 55a3396..82b42a7 100644
--- a/pom.xml
+++ b/pom.xml
@@ -19,7 +19,7 @@
<parent>
<artifactId>killbill-oss-parent</artifactId>
<groupId>com.ning.billing</groupId>
- <version>0.3.6</version>
+ <version>0.3.7</version>
</parent>
<artifactId>killbill</artifactId>
<version>0.3.7-SNAPSHOT</version>
server/killbill-server.iml 12(+6 -6)
diff --git a/server/killbill-server.iml b/server/killbill-server.iml
index c4a7e17..296c149 100644
--- a/server/killbill-server.iml
+++ b/server/killbill-server.iml
@@ -28,10 +28,10 @@
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.1.0" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.1.0" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-core:2.1.0" level="project" />
- <orderEntry type="library" name="Maven: com.ning.billing:killbill-api:0.3.3" level="project" />
+ <orderEntry type="library" name="Maven: com.ning.billing:killbill-api:0.4.0" level="project" />
<orderEntry type="library" name="Maven: joda-time:joda-time:2.0" level="project" />
<orderEntry type="module" module-name="killbill-internal-api" />
- <orderEntry type="library" name="Maven: com.ning.billing.plugin:killbill-plugin-api-payment:0.2.6" level="project" />
+ <orderEntry type="library" name="Maven: com.ning.billing.plugin:killbill-plugin-api-payment:0.3.0" level="project" />
<orderEntry type="library" name="Maven: org.skife.config:config-magic:0.14" level="project" />
<orderEntry type="module" module-name="killbill-util" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.dataformat:jackson-dataformat-csv:2.1.0" level="project" />
@@ -45,7 +45,7 @@
<orderEntry type="library" name="Maven: org.jdbi:jdbi:2.39.1" level="project" />
<orderEntry type="library" name="Maven: com.yammer.metrics:metrics-core:2.1.2" level="project" />
<orderEntry type="library" name="Maven: org.weakref:jmxutils:1.12" level="project" />
- <orderEntry type="library" name="Maven: com.ning.billing.plugin:killbill-plugin-api-notification:0.2.6" level="project" />
+ <orderEntry type="library" name="Maven: com.ning.billing.plugin:killbill-plugin-api-notification:0.3.0" level="project" />
<orderEntry type="library" name="Maven: com.samskivert:jmustache:1.5" level="project" />
<orderEntry type="library" name="Maven: net.sf.ehcache:ehcache-core:2.6.2" level="project" />
<orderEntry type="library" scope="RUNTIME" name="Maven: org.antlr:stringtemplate:3.2.1" level="project" />
@@ -67,7 +67,7 @@
<orderEntry type="module" module-name="killbill-usage" />
<orderEntry type="library" name="Maven: commons-io:commons-io:2.1" level="project" />
<orderEntry type="module" module-name="killbill-beatrix" scope="TEST" production-on-test="" />
- <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing:killbill-beatrix:test-jar:tests:0.3.6-SNAPSHOT" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing:killbill-beatrix:test-jar:tests:0.3.7-SNAPSHOT" level="project" />
<orderEntry type="module" module-name="killbill-jaxrs" />
<orderEntry type="library" name="Maven: javax.ws.rs:jsr311-api:1.1.1" level="project" />
<orderEntry type="module" module-name="killbill-osgi" />
@@ -79,9 +79,9 @@
<orderEntry type="library" name="Maven: org.apache.felix:org.osgi.core:1.0.1" level="project" />
<orderEntry type="module" module-name="killbill-overdue" />
<orderEntry type="module" module-name="killbill-payment" scope="TEST" production-on-test="" />
- <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing:killbill-payment:test-jar:tests:0.3.6-SNAPSHOT" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing:killbill-payment:test-jar:tests:0.3.7-SNAPSHOT" level="project" />
<orderEntry type="module" module-name="killbill-util" scope="TEST" production-on-test="" />
- <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing:killbill-util:test-jar:tests:0.3.6-SNAPSHOT" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing:killbill-util:test-jar:tests:0.3.7-SNAPSHOT" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: com.ning.billing.commons:killbill-clock:test-jar:tests:0.1.7" level="project" />
<orderEntry type="library" name="Maven: com.ning.jetty:ning-service-skeleton-base:0.1.7" level="project" />
<orderEntry type="library" name="Maven: com.ning:metrics.eventtracker-smile:4.1.2" level="project" />
diff --git a/server/src/test/java/com/ning/billing/jaxrs/KillbillClient.java b/server/src/test/java/com/ning/billing/jaxrs/KillbillClient.java
index ece110f..bc50ba1 100644
--- a/server/src/test/java/com/ning/billing/jaxrs/KillbillClient.java
+++ b/server/src/test/java/com/ning/billing/jaxrs/KillbillClient.java
@@ -181,6 +181,18 @@ public abstract class KillbillClient extends GuicyKillbillTestSuiteWithEmbeddedD
return objFromJson;
}
+ protected List<AccountJson> searchAccountsByKey(final String key) throws Exception {
+ final String uri = JaxrsResource.ACCOUNTS_PATH + "/" + JaxrsResource.SEARCH + "/" + key;
+ final Response response = doGet(uri, DEFAULT_EMPTY_QUERY, DEFAULT_HTTP_TIMEOUT_SEC);
+ Assert.assertEquals(response.getStatusCode(), Status.OK.getStatusCode());
+
+ final String baseJson = response.getResponseBody();
+ final List<AccountJson> objFromJson = mapper.readValue(baseJson, new TypeReference<List<AccountJson>>() {});
+ Assert.assertNotNull(objFromJson);
+
+ return objFromJson;
+ }
+
protected Response getAccountByExternalKeyNoValidation(final String externalKey) {
final Map<String, String> queryParams = new HashMap<String, String>();
queryParams.put(JaxrsResource.QUERY_EXTERNAL_KEY, externalKey);
@@ -569,8 +581,9 @@ public abstract class KillbillClient extends GuicyKillbillTestSuiteWithEmbeddedD
protected PaymentMethodJson getPaymentMethodWithPluginInfo(final String paymentMethodId) throws IOException {
final String paymentMethodURI = JaxrsResource.PAYMENT_METHODS_PATH + "/" + paymentMethodId;
- final Map<String, String> queryPaymentMethods = new HashMap<String, String>();
- final Response paymentMethodResponse = doGet(paymentMethodURI, queryPaymentMethods, DEFAULT_HTTP_TIMEOUT_SEC);
+ final Response paymentMethodResponse = doGet(paymentMethodURI,
+ ImmutableMap.<String, String>of(JaxrsResource.QUERY_PAYMENT_METHOD_PLUGIN_INFO, "true"),
+ DEFAULT_HTTP_TIMEOUT_SEC);
assertEquals(paymentMethodResponse.getStatusCode(), Status.OK.getStatusCode());
final PaymentMethodJson paymentMethodJson = mapper.readValue(paymentMethodResponse.getResponseBody(), PaymentMethodJson.class);
@@ -579,6 +592,24 @@ public abstract class KillbillClient extends GuicyKillbillTestSuiteWithEmbeddedD
return paymentMethodJson;
}
+ protected List<PaymentMethodJson> searchPaymentMethodsByKey(final String key) throws Exception {
+ return searchPaymentMethodsByKeyAndPlugin(key, null);
+ }
+
+ protected List<PaymentMethodJson> searchPaymentMethodsByKeyAndPlugin(final String key, @Nullable final String pluginName) throws Exception {
+ final String uri = JaxrsResource.PAYMENT_METHODS_PATH + "/" + JaxrsResource.SEARCH + "/" + key;
+ final Response response = doGet(uri,
+ pluginName == null ? DEFAULT_EMPTY_QUERY : ImmutableMap.<String, String>of(JaxrsResource.QUERY_PAYMENT_METHOD_PLUGIN_NAME, pluginName),
+ DEFAULT_HTTP_TIMEOUT_SEC);
+ Assert.assertEquals(response.getStatusCode(), Status.OK.getStatusCode());
+
+ final String baseJson = response.getResponseBody();
+ final List<PaymentMethodJson> objFromJson = mapper.readValue(baseJson, new TypeReference<List<PaymentMethodJson>>() {});
+ Assert.assertNotNull(objFromJson);
+
+ return objFromJson;
+ }
+
protected void deletePaymentMethod(final String paymentMethodId, final Boolean deleteDefault) throws IOException {
final String paymentMethodURI = JaxrsResource.PAYMENT_METHODS_PATH + "/" + paymentMethodId;
diff --git a/server/src/test/java/com/ning/billing/jaxrs/TestAccount.java b/server/src/test/java/com/ning/billing/jaxrs/TestAccount.java
index 4c90eab..73b0a44 100644
--- a/server/src/test/java/com/ning/billing/jaxrs/TestAccount.java
+++ b/server/src/test/java/com/ning/billing/jaxrs/TestAccount.java
@@ -23,6 +23,7 @@ import java.util.List;
import java.util.Map;
import java.util.UUID;
+import javax.annotation.Nullable;
import javax.ws.rs.core.Response.Status;
import org.testng.Assert;
@@ -56,6 +57,9 @@ public class TestAccount extends TestJaxrsBase {
final AccountJson retrievedAccount = getAccountByExternalKey(input.getExternalKey());
Assert.assertTrue(retrievedAccount.equals(input));
+ // Try search endpoint
+ searchAccount(input, retrievedAccount);
+
// Update Account
final AccountJson newInput = new AccountJson(input.getAccountId(),
"zozo", 4, input.getExternalKey(), "rr@google.com", 18,
@@ -63,6 +67,9 @@ public class TestAccount extends TestJaxrsBase {
false, false);
final AccountJson updatedAccount = updateAccount(input.getAccountId(), newInput);
Assert.assertTrue(updatedAccount.equals(newInput));
+
+ // Try search endpoint
+ searchAccount(input, null);
}
@Test(groups = "slow")
@@ -299,4 +306,32 @@ public class TestAccount extends TestJaxrsBase {
response = doGetWithUrl(url, DEFAULT_EMPTY_QUERY, DEFAULT_HTTP_TIMEOUT_SEC);
Assert.assertEquals(response.getStatusCode(), Status.OK.getStatusCode());
}
+
+ private void searchAccount(final AccountJson input, @Nullable final AccountJson output) throws Exception {
+ // Search by name
+ doSearchAccount(input.getName(), output);
+
+ // Search by email
+ doSearchAccount(input.getEmail(), output);
+
+ // Search by company name
+ doSearchAccount(input.getCompany(), output);
+
+ // Search by external key.
+ // Note: we will always find a match since we don't update it
+ final List<AccountJson> accountsByExternalKey = searchAccountsByKey(input.getExternalKey());
+ Assert.assertEquals(accountsByExternalKey.size(), 1);
+ Assert.assertEquals(accountsByExternalKey.get(0).getAccountId(), input.getAccountId());
+ Assert.assertEquals(accountsByExternalKey.get(0).getExternalKey(), input.getExternalKey());
+ }
+
+ private void doSearchAccount(final String key, @Nullable final AccountJson output) throws Exception {
+ final List<AccountJson> accountsByKey = searchAccountsByKey(key);
+ if (output == null) {
+ Assert.assertEquals(accountsByKey.size(), 0);
+ } else {
+ Assert.assertEquals(accountsByKey.size(), 1);
+ Assert.assertEquals(accountsByKey.get(0), output);
+ }
+ }
}
diff --git a/server/src/test/java/com/ning/billing/jaxrs/TestPaymentMethod.java b/server/src/test/java/com/ning/billing/jaxrs/TestPaymentMethod.java
new file mode 100644
index 0000000..4d1e2f8
--- /dev/null
+++ b/server/src/test/java/com/ning/billing/jaxrs/TestPaymentMethod.java
@@ -0,0 +1,68 @@
+/*
+ * Copyright 2010-2013 Ning, Inc.
+ *
+ * Ning licenses this file to you under the Apache License, version 2.0
+ * (the "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ */
+
+package com.ning.billing.jaxrs;
+
+import java.util.List;
+import java.util.UUID;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+import com.ning.billing.jaxrs.json.AccountJson;
+import com.ning.billing.jaxrs.json.PaymentMethodJson;
+
+public class TestPaymentMethod extends TestJaxrsBase {
+
+ @Test(groups = "slow")
+ public void testSearchPaymentMethods() throws Exception {
+ // Search random key
+ Assert.assertEquals(searchPaymentMethodsByKey(UUID.randomUUID().toString()).size(), 0);
+ Assert.assertEquals(searchPaymentMethodsByKeyAndPlugin(UUID.randomUUID().toString(), PLUGIN_NAME).size(), 0);
+
+ // Create a payment method
+ final AccountJson accountJson = createAccountWithDefaultPaymentMethod();
+ final PaymentMethodJson paymentMethodJson = getPaymentMethodWithPluginInfo(accountJson.getPaymentMethodId());
+
+ // Search random key again
+ Assert.assertEquals(searchPaymentMethodsByKey(UUID.randomUUID().toString()).size(), 0);
+ Assert.assertEquals(searchPaymentMethodsByKeyAndPlugin(UUID.randomUUID().toString(), PLUGIN_NAME).size(), 0);
+
+ // Make sure we can search the test plugin
+ // Values are hardcoded in TestPaymentMethodPluginBase and the search logic is in MockPaymentProviderPlugin
+ doSearch("Foo", paymentMethodJson);
+ // Last 4
+ doSearch("4365", paymentMethodJson);
+ // Name
+ doSearch("Bozo", paymentMethodJson);
+ // City
+ doSearch("SF", paymentMethodJson);
+ // State
+ doSearch("CA", paymentMethodJson);
+ // Country
+ doSearch("Zimbawe", paymentMethodJson);
+ }
+
+ private void doSearch(final String searchKey, final PaymentMethodJson paymentMethodJson) throws Exception {
+ final List<PaymentMethodJson> results1 = searchPaymentMethodsByKey(searchKey);
+ Assert.assertEquals(results1.size(), 1);
+ Assert.assertEquals(results1.get(0), paymentMethodJson);
+
+ final List<PaymentMethodJson> results2 = searchPaymentMethodsByKeyAndPlugin(searchKey, PLUGIN_NAME);
+ Assert.assertEquals(results2.size(), 1);
+ Assert.assertEquals(results2.get(0), paymentMethodJson);
+ }
+}
subscription/killbill-subscription.iml 10(+5 -5)
diff --git a/subscription/killbill-subscription.iml b/subscription/killbill-subscription.iml
index b0bce4d..739843c 100644
--- a/subscription/killbill-subscription.iml
+++ b/subscription/killbill-subscription.iml
@@ -24,12 +24,12 @@
<orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-core:1.1" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: cglib:cglib-nodep:2.2" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.objenesis:objenesis:1.2" level="project" />
- <orderEntry type="library" name="Maven: com.ning.billing:killbill-api:0.3.3" level="project" />
+ <orderEntry type="library" name="Maven: com.ning.billing:killbill-api:0.4.0" level="project" />
<orderEntry type="library" name="Maven: joda-time:joda-time:2.0" level="project" />
<orderEntry type="module" module-name="killbill-catalog" scope="TEST" production-on-test="" />
- <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing:killbill-catalog:test-jar:tests:0.3.6-SNAPSHOT" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing:killbill-catalog:test-jar:tests:0.3.7-SNAPSHOT" level="project" />
<orderEntry type="module" module-name="killbill-internal-api" />
- <orderEntry type="library" name="Maven: com.ning.billing.plugin:killbill-plugin-api-payment:0.2.6" level="project" />
+ <orderEntry type="library" name="Maven: com.ning.billing.plugin:killbill-plugin-api-payment:0.3.0" level="project" />
<orderEntry type="library" name="Maven: org.skife.config:config-magic:0.14" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.5" level="project" />
<orderEntry type="module" module-name="killbill-util" />
@@ -46,7 +46,7 @@
<orderEntry type="library" name="Maven: org.jdbi:jdbi:2.39.1" level="project" />
<orderEntry type="library" name="Maven: com.yammer.metrics:metrics-core:2.1.2" level="project" />
<orderEntry type="library" name="Maven: org.weakref:jmxutils:1.12" level="project" />
- <orderEntry type="library" name="Maven: com.ning.billing.plugin:killbill-plugin-api-notification:0.2.6" level="project" />
+ <orderEntry type="library" name="Maven: com.ning.billing.plugin:killbill-plugin-api-notification:0.3.0" level="project" />
<orderEntry type="library" name="Maven: com.samskivert:jmustache:1.5" level="project" />
<orderEntry type="library" name="Maven: net.sf.ehcache:ehcache-core:2.6.2" level="project" />
<orderEntry type="library" scope="RUNTIME" name="Maven: org.antlr:stringtemplate:3.2.1" level="project" />
@@ -56,7 +56,7 @@
<orderEntry type="library" name="Maven: javax.activation:activation:1.1" level="project" />
<orderEntry type="module" module-name="killbill-catalog" scope="TEST" />
<orderEntry type="module" module-name="killbill-util" scope="TEST" production-on-test="" />
- <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing:killbill-util:test-jar:tests:0.3.6-SNAPSHOT" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing:killbill-util:test-jar:tests:0.3.7-SNAPSHOT" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: com.ning.billing.commons:killbill-clock:test-jar:tests:0.1.7" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: com.ning.billing.commons:killbill-queue:test-jar:tests:0.1.7" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: mysql:mysql-connector-mxj:5.0.12" level="project" />
tenant/killbill-tenant.iml 8(+4 -4)
diff --git a/tenant/killbill-tenant.iml b/tenant/killbill-tenant.iml
index 400d933..aebee09 100644
--- a/tenant/killbill-tenant.iml
+++ b/tenant/killbill-tenant.iml
@@ -17,11 +17,11 @@
<orderEntry type="library" scope="PROVIDED" name="Maven: javax.inject:javax.inject:1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: aopalliance:aopalliance:1.0" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: com.h2database:h2:1.3.158" level="project" />
- <orderEntry type="library" name="Maven: com.ning.billing:killbill-api:0.3.3" level="project" />
+ <orderEntry type="library" name="Maven: com.ning.billing:killbill-api:0.4.0" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.1.0" level="project" />
<orderEntry type="library" name="Maven: joda-time:joda-time:2.0" level="project" />
<orderEntry type="module" module-name="killbill-internal-api" />
- <orderEntry type="library" name="Maven: com.ning.billing.plugin:killbill-plugin-api-payment:0.2.6" level="project" />
+ <orderEntry type="library" name="Maven: com.ning.billing.plugin:killbill-plugin-api-payment:0.3.0" level="project" />
<orderEntry type="library" name="Maven: org.skife.config:config-magic:0.14" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.5" level="project" />
<orderEntry type="module" module-name="killbill-util" />
@@ -38,7 +38,7 @@
<orderEntry type="library" name="Maven: org.jdbi:jdbi:2.39.1" level="project" />
<orderEntry type="library" name="Maven: com.yammer.metrics:metrics-core:2.1.2" level="project" />
<orderEntry type="library" name="Maven: org.weakref:jmxutils:1.12" level="project" />
- <orderEntry type="library" name="Maven: com.ning.billing.plugin:killbill-plugin-api-notification:0.2.6" level="project" />
+ <orderEntry type="library" name="Maven: com.ning.billing.plugin:killbill-plugin-api-notification:0.3.0" level="project" />
<orderEntry type="library" name="Maven: com.samskivert:jmustache:1.5" level="project" />
<orderEntry type="library" name="Maven: net.sf.ehcache:ehcache-core:2.6.2" level="project" />
<orderEntry type="library" scope="RUNTIME" name="Maven: org.antlr:stringtemplate:3.2.1" level="project" />
@@ -47,7 +47,7 @@
<orderEntry type="library" name="Maven: javax.mail:mail:1.4.1" level="project" />
<orderEntry type="library" name="Maven: javax.activation:activation:1.1" level="project" />
<orderEntry type="module" module-name="killbill-util" scope="TEST" production-on-test="" />
- <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing:killbill-util:test-jar:tests:0.3.6-SNAPSHOT" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing:killbill-util:test-jar:tests:0.3.7-SNAPSHOT" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: com.ning.billing.commons:killbill-clock:test-jar:tests:0.1.7" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: mysql:mysql-connector-mxj:5.0.12" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: mysql:mysql-connector-mxj-db-files:5.0.12" level="project" />
usage/killbill-usage.iml 8(+4 -4)
diff --git a/usage/killbill-usage.iml b/usage/killbill-usage.iml
index 653f8cb..06ea2ac 100644
--- a/usage/killbill-usage.iml
+++ b/usage/killbill-usage.iml
@@ -16,11 +16,11 @@
<orderEntry type="library" scope="PROVIDED" name="Maven: javax.inject:javax.inject:1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: aopalliance:aopalliance:1.0" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: com.h2database:h2:1.3.158" level="project" />
- <orderEntry type="library" name="Maven: com.ning.billing:killbill-api:0.3.3" level="project" />
+ <orderEntry type="library" name="Maven: com.ning.billing:killbill-api:0.4.0" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.1.0" level="project" />
<orderEntry type="library" name="Maven: joda-time:joda-time:2.0" level="project" />
<orderEntry type="module" module-name="killbill-internal-api" />
- <orderEntry type="library" name="Maven: com.ning.billing.plugin:killbill-plugin-api-payment:0.2.6" level="project" />
+ <orderEntry type="library" name="Maven: com.ning.billing.plugin:killbill-plugin-api-payment:0.3.0" level="project" />
<orderEntry type="library" name="Maven: org.skife.config:config-magic:0.14" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.5" level="project" />
<orderEntry type="module" module-name="killbill-util" />
@@ -37,7 +37,7 @@
<orderEntry type="library" name="Maven: org.jdbi:jdbi:2.39.1" level="project" />
<orderEntry type="library" name="Maven: com.yammer.metrics:metrics-core:2.1.2" level="project" />
<orderEntry type="library" name="Maven: org.weakref:jmxutils:1.12" level="project" />
- <orderEntry type="library" name="Maven: com.ning.billing.plugin:killbill-plugin-api-notification:0.2.6" level="project" />
+ <orderEntry type="library" name="Maven: com.ning.billing.plugin:killbill-plugin-api-notification:0.3.0" level="project" />
<orderEntry type="library" name="Maven: com.samskivert:jmustache:1.5" level="project" />
<orderEntry type="library" name="Maven: net.sf.ehcache:ehcache-core:2.6.2" level="project" />
<orderEntry type="library" scope="RUNTIME" name="Maven: org.antlr:stringtemplate:3.2.1" level="project" />
@@ -46,7 +46,7 @@
<orderEntry type="library" name="Maven: javax.mail:mail:1.4.1" level="project" />
<orderEntry type="library" name="Maven: javax.activation:activation:1.1" level="project" />
<orderEntry type="module" module-name="killbill-util" scope="TEST" production-on-test="" />
- <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing:killbill-util:test-jar:tests:0.3.6-SNAPSHOT" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing:killbill-util:test-jar:tests:0.3.7-SNAPSHOT" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: com.ning.billing.commons:killbill-clock:test-jar:tests:0.1.7" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: mysql:mysql-connector-mxj:5.0.12" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: mysql:mysql-connector-mxj-db-files:5.0.12" level="project" />
util/killbill-util.iml 6(+3 -3)
diff --git a/util/killbill-util.iml b/util/killbill-util.iml
index 2cea859..870bd00 100644
--- a/util/killbill-util.iml
+++ b/util/killbill-util.iml
@@ -34,9 +34,9 @@
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.5" level="project" />
<orderEntry type="library" name="Maven: com.mchange:c3p0:0.9.2" level="project" />
<orderEntry type="library" name="Maven: com.mchange:mchange-commons-java:0.2.3.3" level="project" />
- <orderEntry type="library" name="Maven: com.ning.billing:killbill-api:0.3.3" level="project" />
+ <orderEntry type="library" name="Maven: com.ning.billing:killbill-api:0.4.0" level="project" />
<orderEntry type="module" module-name="killbill-internal-api" />
- <orderEntry type="library" name="Maven: com.ning.billing.plugin:killbill-plugin-api-payment:0.2.6" level="project" />
+ <orderEntry type="library" name="Maven: com.ning.billing.plugin:killbill-plugin-api-payment:0.3.0" level="project" />
<orderEntry type="library" name="Maven: org.skife.config:config-magic:0.14" level="project" />
<orderEntry type="library" name="Maven: com.ning.billing.commons:killbill-clock:0.1.7" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: com.ning.billing.commons:killbill-clock:test-jar:tests:0.1.7" level="project" />
@@ -46,7 +46,7 @@
<orderEntry type="library" name="Maven: com.yammer.metrics:metrics-core:2.1.2" level="project" />
<orderEntry type="library" name="Maven: org.weakref:jmxutils:1.12" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: com.ning.billing.commons:killbill-queue:test-jar:tests:0.1.7" level="project" />
- <orderEntry type="library" name="Maven: com.ning.billing.plugin:killbill-plugin-api-notification:0.2.6" level="project" />
+ <orderEntry type="library" name="Maven: com.ning.billing.plugin:killbill-plugin-api-notification:0.3.0" level="project" />
<orderEntry type="library" name="Maven: com.samskivert:jmustache:1.5" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: mysql:mysql-connector-java:5.1.22" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: mysql:mysql-connector-mxj:5.0.12" level="project" />
diff --git a/util/src/test/java/com/ning/billing/mock/api/MockAccountUserApi.java b/util/src/test/java/com/ning/billing/mock/api/MockAccountUserApi.java
index 16c758f..488b8d8 100644
--- a/util/src/test/java/com/ning/billing/mock/api/MockAccountUserApi.java
+++ b/util/src/test/java/com/ning/billing/mock/api/MockAccountUserApi.java
@@ -17,6 +17,7 @@
package com.ning.billing.mock.api;
import java.util.ArrayList;
+import java.util.LinkedList;
import java.util.List;
import java.util.UUID;
import java.util.concurrent.CopyOnWriteArrayList;
@@ -106,6 +107,20 @@ public class MockAccountUserApi implements AccountUserApi {
}
@Override
+ public List<Account> searchAccounts(final String searchKey, final TenantContext tenantContext) {
+ final List<Account> results = new LinkedList<Account>();
+ for (final Account account : accounts) {
+ if ((account.getName() != null && account.getName().contains(searchKey)) ||
+ (account.getEmail() != null && account.getEmail().contains(searchKey)) ||
+ (account.getExternalKey() != null && account.getExternalKey().contains(searchKey)) ||
+ (account.getCompanyName() != null && account.getCompanyName().contains(searchKey))) {
+ results.add(account);
+ }
+ }
+ return results;
+ }
+
+ @Override
public List<Account> getAccounts(final TenantContext context) {
return new ArrayList<Account>(accounts);
}
diff --git a/util/src/test/java/com/ning/billing/payment/api/TestPaymentMethodPluginBase.java b/util/src/test/java/com/ning/billing/payment/api/TestPaymentMethodPluginBase.java
index 118303b..2737016 100644
--- a/util/src/test/java/com/ning/billing/payment/api/TestPaymentMethodPluginBase.java
+++ b/util/src/test/java/com/ning/billing/payment/api/TestPaymentMethodPluginBase.java
@@ -24,6 +24,11 @@ import com.google.common.collect.ImmutableList;
public class TestPaymentMethodPluginBase implements PaymentMethodPlugin {
@Override
+ public UUID getKbPaymentMethodId() {
+ return UUID.randomUUID();
+ }
+
+ @Override
public String getExternalPaymentMethodId() {
return UUID.randomUUID().toString();
}