killbill-aplcache
Changes
account/pom.xml 2(+1 -1)
analytics/pom.xml 2(+1 -1)
api/pom.xml 2(+1 -1)
beatrix/pom.xml 2(+1 -1)
catalog/pom.xml 2(+1 -1)
entitlement/pom.xml 2(+1 -1)
invoice/pom.xml 2(+1 -1)
payment/pom.xml 2(+1 -1)
pom.xml 4(+2 -2)
util/pom.xml 2(+1 -1)
Details
account/pom.xml 2(+1 -1)
diff --git a/account/pom.xml b/account/pom.xml
index 44b4543..0146205 100644
--- a/account/pom.xml
+++ b/account/pom.xml
@@ -13,7 +13,7 @@
<parent>
<groupId>com.ning.billing</groupId>
<artifactId>killbill</artifactId>
- <version>0.1.2-SNAPSHOT</version>
+ <version>0.1.3-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>killbill-account</artifactId>
diff --git a/account/src/main/java/com/ning/billing/account/api/DefaultAccount.java b/account/src/main/java/com/ning/billing/account/api/DefaultAccount.java
index 4b4cfc7..0c22000 100644
--- a/account/src/main/java/com/ning/billing/account/api/DefaultAccount.java
+++ b/account/src/main/java/com/ning/billing/account/api/DefaultAccount.java
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 2010-2011 Ning, Inc.
*
* Ning licenses this file to you under the Apache License, version 2.0
@@ -18,208 +18,251 @@ package com.ning.billing.account.api;
import java.util.List;
import java.util.UUID;
+
import org.joda.time.DateTime;
import org.joda.time.DateTimeZone;
+
import com.ning.billing.catalog.api.Currency;
import com.ning.billing.util.customfield.CustomizableEntityBase;
-import com.ning.billing.util.tag.DescriptiveTag;
import com.ning.billing.util.tag.DefaultTagStore;
+import com.ning.billing.util.tag.DescriptiveTag;
import com.ning.billing.util.tag.Tag;
import com.ning.billing.util.tag.TagDefinition;
public class DefaultAccount extends CustomizableEntityBase implements Account {
- //public final static String OBJECT_TYPE = "Account";
-
- private final String externalKey;
- private final String email;
- private final String name;
- private final int firstNameLength;
- private final Currency currency;
- private final int billCycleDay;
- private final String paymentProviderName;
- private final DefaultTagStore tags;
- private final DateTimeZone timeZone;
- private final String locale;
- private final String address1;
- private final String address2;
- private final String companyName;
- private final String city;
- private final String stateOrProvince;
- private final String country;
- private final String postalCode;
- private final String phone;
-
- public DefaultAccount(final AccountData data) {
- this(UUID.randomUUID(), data);
- }
-
- public DefaultAccount(final UUID id, final AccountData data) {
- this(id, data.getExternalKey(), data.getEmail(), data.getName(), data.getFirstNameLength(),
- data.getCurrency(), data.getBillCycleDay(), data.getPaymentProviderName(),
- data.getTimeZone(), data.getLocale(),
- data.getAddress1(), data.getAddress2(), data.getCompanyName(),
- data.getCity(), data.getStateOrProvince(), data.getCountry(),
- data.getPostalCode(), data.getPhone());
- }
-
- public DefaultAccount(final UUID id, final String externalKey, final String email, final String name, final int firstNameLength,
- final Currency currency, final int billCycleDay, final String paymentProviderName,
- final DateTimeZone timeZone, final String locale,
- final String address1, final String address2, final String companyName,
- final String city,
- final String stateOrProvince, final String country, final String postalCode, final String phone) {
- super(id);
- this.externalKey = externalKey;
- this.email = email;
- this.name = name;
- this.firstNameLength = firstNameLength;
- this.currency = currency;
- this.billCycleDay = billCycleDay;
- this.paymentProviderName = paymentProviderName;
- this.timeZone = timeZone;
- this.locale = locale;
- this.address1 = address1;
- this.address2 = address2;
- this.companyName = companyName;
- this.city = city;
- this.stateOrProvince = stateOrProvince;
- this.postalCode = postalCode;
- this.country = country;
- this.phone = phone;
-
- this.tags = new DefaultTagStore(id, getObjectName());
- }
-
- @Override
- public String getObjectName() {
- return "Account";
- }
-
- @Override
- public String getExternalKey() {
- return externalKey;
- }
-
- @Override
- public String getName() {
- return name;
- }
-
- @Override
- public String getEmail() {
- return email;
- }
-
- @Override
- public int getFirstNameLength() {
- return firstNameLength;
- }
-
- @Override
- public Currency getCurrency() {
- return currency;
- }
-
- @Override
- public int getBillCycleDay() {
- return billCycleDay;
- }
-
- @Override
- public String getPaymentProviderName() {
- return paymentProviderName;
- }
-
- @Override
- public DateTimeZone getTimeZone() {
- return timeZone;
- }
-
- @Override
- public String getLocale() {
- return locale;
- }
-
- @Override
- public String getAddress1() {
- return address1;
- }
-
- @Override
- public String getAddress2() {
- return address2;
- }
-
- @Override
- public String getCompanyName() {
- return companyName;
- }
-
- @Override
- public String getCity() {
- return city;
- }
-
- @Override
- public String getStateOrProvince() {
- return stateOrProvince;
- }
-
- @Override
- public String getPostalCode() {
- return postalCode;
- }
-
- @Override
- public String getCountry() {
- return country;
- }
-
- @Override
- public String getPhone() {
- return phone;
- }
-
- @Override
- public List<Tag> getTagList() {
- return tags.getEntityList();
- }
-
- @Override
- public boolean hasTag(String tagName) {
- return tags.containsTag(tagName);
- }
-
- @Override
- public void addTag(TagDefinition definition, String addedBy, DateTime dateAdded) {
- Tag tag = new DescriptiveTag(definition, addedBy, dateAdded);
- tags.add(tag) ;
- }
-
- @Override
- public void addTags(List<Tag> tags) {
- if (tags != null) {
- this.tags.add(tags);
- }
- }
-
- @Override
- public void clearTags() {
- this.tags.clear();
- }
-
- @Override
- public void removeTag(TagDefinition definition) {
- tags.remove(definition.getName());
- }
-
- @Override
- public boolean generateInvoice() {
- return tags.generateInvoice();
- }
-
- @Override
- public boolean processPayment() {
- return tags.processPayment();
- }
+ //public final static String OBJECT_TYPE = "Account";
+
+ private final String externalKey;
+ private final String email;
+ private final String name;
+ private final int firstNameLength;
+ private final Currency currency;
+ private final int billCycleDay;
+ private final String paymentProviderName;
+ private final DefaultTagStore tags;
+ private final DateTimeZone timeZone;
+ private final String locale;
+ private final String address1;
+ private final String address2;
+ private final String companyName;
+ private final String city;
+ private final String stateOrProvince;
+ private final String country;
+ private final String postalCode;
+ private final String phone;
+ private final DateTime createdDate;
+ private final DateTime updatedDate;
+
+ public DefaultAccount(final AccountData data) {
+ this(UUID.randomUUID(), data, null, null);
+ }
+
+ public DefaultAccount(final UUID id, final AccountData data, DateTime createdDate, DateTime updatedDate) {
+ this(id, data.getExternalKey(), data.getEmail(), data.getName(), data.getFirstNameLength(),
+ data.getCurrency(), data.getBillCycleDay(), data.getPaymentProviderName(),
+ data.getTimeZone(), data.getLocale(),
+ data.getAddress1(), data.getAddress2(), data.getCompanyName(),
+ data.getCity(), data.getStateOrProvince(), data.getCountry(),
+ data.getPostalCode(), data.getPhone(), createdDate, updatedDate);
+ }
+
+ public DefaultAccount(final UUID id, final String externalKey, final String email, final String name, final int firstNameLength,
+ final Currency currency, final int billCycleDay, final String paymentProviderName,
+ final DateTimeZone timeZone, final String locale,
+ final String address1, final String address2, final String companyName,
+ final String city,
+ final String stateOrProvince, final String country, final String postalCode, final String phone, DateTime createdDate, DateTime updatedDate) {
+
+ super(id);
+ this.externalKey = externalKey;
+ this.email = email;
+ this.name = name;
+ this.firstNameLength = firstNameLength;
+ this.currency = currency;
+ this.billCycleDay = billCycleDay;
+ this.paymentProviderName = paymentProviderName;
+ this.timeZone = timeZone;
+ this.locale = locale;
+ this.address1 = address1;
+ this.address2 = address2;
+ this.companyName = companyName;
+ this.city = city;
+ this.stateOrProvince = stateOrProvince;
+ this.postalCode = postalCode;
+ this.country = country;
+ this.phone = phone;
+ this.createdDate = createdDate == null ? new DateTime(DateTimeZone.UTC) : createdDate;
+ this.updatedDate = updatedDate == null ? new DateTime(DateTimeZone.UTC) : updatedDate;
+ this.tags = new DefaultTagStore(id, getObjectName());
+ }
+
+ @Override
+ public String getObjectName() {
+ return "Account";
+ }
+
+ @Override
+ public String getExternalKey() {
+ return externalKey;
+ }
+
+ @Override
+ public String getName() {
+ return name;
+ }
+
+ @Override
+ public String getEmail() {
+ return email;
+ }
+
+ public DefaultTagStore getTags() {
+ return tags;
+ }
+
+ @Override
+ public DateTime getCreatedDate() {
+ return createdDate;
+ }
+
+ @Override
+ public DateTime getUpdatedDate() {
+ return updatedDate;
+ }
+
+ @Override
+ public int getFirstNameLength() {
+ return firstNameLength;
+ }
+
+ @Override
+ public Currency getCurrency() {
+ return currency;
+ }
+
+ @Override
+ public int getBillCycleDay() {
+ return billCycleDay;
+ }
+
+ @Override
+ public String getPaymentProviderName() {
+ return paymentProviderName;
+ }
+
+ @Override
+ public DateTimeZone getTimeZone() {
+ return timeZone;
+ }
+
+ @Override
+ public String getLocale() {
+ return locale;
+ }
+
+ @Override
+ public String getAddress1() {
+ return address1;
+ }
+
+ @Override
+ public String getAddress2() {
+ return address2;
+ }
+
+ @Override
+ public String getCompanyName() {
+ return companyName;
+ }
+
+ @Override
+ public String getCity() {
+ return city;
+ }
+
+ @Override
+ public String getStateOrProvince() {
+ return stateOrProvince;
+ }
+
+ @Override
+ public String getPostalCode() {
+ return postalCode;
+ }
+
+ @Override
+ public String getCountry() {
+ return country;
+ }
+
+ @Override
+ public String getPhone() {
+ return phone;
+ }
+
+ @Override
+ public List<Tag> getTagList() {
+ return tags.getEntityList();
+ }
+
+ @Override
+ public boolean hasTag(String tagName) {
+ return tags.containsTag(tagName);
+ }
+
+ @Override
+ public void addTag(TagDefinition definition, String addedBy, DateTime dateAdded) {
+ Tag tag = new DescriptiveTag(definition, addedBy, dateAdded);
+ tags.add(tag) ;
+ }
+
+ @Override
+ public void addTags(List<Tag> tags) {
+ if (tags != null) {
+ this.tags.add(tags);
+ }
+ }
+
+ @Override
+ public void clearTags() {
+ this.tags.clear();
+ }
+
+ @Override
+ public void removeTag(TagDefinition definition) {
+ tags.remove(definition.getName());
+ }
+
+ @Override
+ public boolean generateInvoice() {
+ return tags.generateInvoice();
+ }
+
+ @Override
+ public boolean processPayment() {
+ return tags.processPayment();
+ }
+
+ @Override
+ public String toString() {
+ return "DefaultAccount [externalKey=" + externalKey + ", email=" + email +
+ ", name=" + name + ", " +
+ "firstNameLength=" + firstNameLength +
+ ", phone=" + phone + ", " +
+ "currency=" + currency +
+ ", billCycleDay=" + billCycleDay +
+ ", paymentProviderName=" + paymentProviderName +
+ ", timezone=" + timeZone +
+ ", locale=" + locale +
+ ", address1" + address1 +
+ ", address2" + address2 +
+ ", companyName" + companyName +
+ ", city" + city +
+ ", stateOrProvince" + stateOrProvince +
+ ", postalCode" + postalCode +
+ ", country" +
+ ", tags=" + tags +
+ ", createdDate=" + createdDate +
+ ", updatedDate=" + updatedDate + "]";
+ }
}
\ No newline at end of file
diff --git a/account/src/main/java/com/ning/billing/account/api/user/AccountBuilder.java b/account/src/main/java/com/ning/billing/account/api/user/AccountBuilder.java
index 3a303a1..95eb5d8 100644
--- a/account/src/main/java/com/ning/billing/account/api/user/AccountBuilder.java
+++ b/account/src/main/java/com/ning/billing/account/api/user/AccountBuilder.java
@@ -16,16 +16,16 @@
package com.ning.billing.account.api.user;
-import com.ning.billing.account.api.DefaultAccount;
-import com.ning.billing.catalog.api.Currency;
-
-import java.math.BigDecimal;
import java.util.UUID;
+
import org.joda.time.DateTime;
import org.joda.time.DateTimeZone;
+import com.ning.billing.account.api.DefaultAccount;
+import com.ning.billing.catalog.api.Currency;
+
public class AccountBuilder {
- private UUID id;
+ private final UUID id;
private String externalKey;
private String email;
private String name;
@@ -43,7 +43,8 @@ public class AccountBuilder {
private String country;
private String postalCode;
private String phone;
-
+ private DateTime createdDate;
+ private DateTime updatedDate;
public AccountBuilder() {
this(UUID.randomUUID());
@@ -138,11 +139,22 @@ public class AccountBuilder {
return this;
}
+ public AccountBuilder createdDate(DateTime createdDate) {
+ this.createdDate = createdDate;
+ return this;
+ }
+
+ public AccountBuilder updatedDate(DateTime updatedDate) {
+ this.updatedDate = updatedDate;
+ return this;
+ }
+
public DefaultAccount build() {
return new DefaultAccount(id, externalKey, email, name, firstNameLength,
currency, billingCycleDay, paymentProviderName,
timeZone, locale,
address1, address2, companyName, city, stateOrProvince, country,
- postalCode, phone);
+ postalCode, phone,
+ createdDate, updatedDate);
}
}
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 323ae0f..42ec5a8 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
@@ -23,8 +23,11 @@ import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import java.sql.ResultSet;
import java.sql.SQLException;
+import java.sql.Timestamp;
+import java.util.Date;
import java.util.UUID;
+import org.joda.time.DateTime;
import org.joda.time.DateTimeZone;
import org.skife.jdbi.v2.SQLStatement;
import org.skife.jdbi.v2.StatementContext;
@@ -68,8 +71,15 @@ public interface AccountSqlDao extends EntityDao<Account>, Transactional<Account
public void deleteByKey(@Bind("externalKey") final String key);
public static class AccountMapper implements ResultSetMapper<Account> {
+
+ private DateTime getDate(ResultSet rs, String fieldName) throws SQLException {
+ final Timestamp resultStamp = rs.getTimestamp(fieldName);
+ return rs.wasNull() ? null : new DateTime(resultStamp).toDateTime(DateTimeZone.UTC);
+ }
+
@Override
public Account map(int index, ResultSet result, StatementContext context) throws SQLException {
+
UUID id = UUID.fromString(result.getString("id"));
String externalKey = result.getString("external_key");
String email = result.getString("email");
@@ -81,6 +91,8 @@ public interface AccountSqlDao extends EntityDao<Account>, Transactional<Account
Currency currency = (currencyString == null) ? null : Currency.valueOf(currencyString);
String paymentProviderName = result.getString("payment_provider_name");
+ DateTime createdDate = getDate(result, "created_dt");
+ DateTime updatedDate = getDate(result, "updated_dt");
String timeZoneId = result.getString("time_zone");
DateTimeZone timeZone = (timeZoneId == null) ? null : DateTimeZone.forID(timeZoneId);
@@ -106,6 +118,8 @@ public interface AccountSqlDao extends EntityDao<Account>, Transactional<Account
.companyName(companyName)
.city(city).stateOrProvince(stateOrProvince)
.postalCode(postalCode).country(country)
+ .createdDate(createdDate)
+ .updatedDate(updatedDate)
.build();
}
}
@@ -115,25 +129,27 @@ public interface AccountSqlDao extends EntityDao<Account>, Transactional<Account
@Target({ElementType.PARAMETER})
public @interface AccountBinder {
public static class AccountBinderFactory implements BinderFactory {
+ @Override
public Binder<AccountBinder, Account> build(Annotation annotation) {
return new Binder<AccountBinder, Account>() {
- public void bind(SQLStatement q, AccountBinder bind, Account account) {
+ private Date getDate(DateTime dateTime) {
+ return dateTime == null ? null : dateTime.toDate();
+ }
+
+ @Override
+ public void bind(@SuppressWarnings("rawtypes") SQLStatement q, AccountBinder bind, Account account) {
q.bind("id", account.getId().toString());
q.bind("externalKey", account.getExternalKey());
q.bind("email", account.getEmail());
q.bind("name", account.getName());
q.bind("firstNameLength", account.getFirstNameLength());
-
Currency currency = account.getCurrency();
q.bind("currency", (currency == null) ? null : currency.toString());
-
q.bind("billingCycleDay", account.getBillCycleDay());
q.bind("paymentProviderName", account.getPaymentProviderName());
-
DateTimeZone timeZone = account.getTimeZone();
q.bind("timeZone", (timeZone == null) ? null : timeZone.toString());
q.bind("locale", account.getLocale());
-
q.bind("address1", account.getAddress1());
q.bind("address2", account.getAddress2());
q.bind("companyName", account.getCompanyName());
@@ -142,6 +158,8 @@ public interface AccountSqlDao extends EntityDao<Account>, Transactional<Account
q.bind("country", account.getCountry());
q.bind("postalCode", account.getPostalCode());
q.bind("phone", account.getPhone());
+ q.bind("createdDate", getDate(account.getCreatedDate()));
+ q.bind("updatedDate", getDate(account.getUpdatedDate()));
}
};
}
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 f45df50..7e93ff2 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
@@ -1,14 +1,37 @@
group AccountDaoSql;
+accountFields(prefix) ::= <<
+ <prefix>id,
+ <prefix>external_key,
+ <prefix>email,
+ <prefix>name,
+ <prefix>first_name_length,
+ <prefix>currency,
+ <prefix>billing_cycle_day,
+ <prefix>payment_provider_name,
+ <prefix>time_zone,
+ <prefix>locale,
+ <prefix>address1,
+ <prefix>address2,
+ <prefix>company_name,
+ <prefix>city,
+ <prefix>state_or_province,
+ <prefix>country,
+ <prefix>postal_code,
+ <prefix>phone,
+ <prefix>created_dt,
+ <prefix>updated_dt
+>>
+
+
create() ::= <<
INSERT INTO accounts
- (id, external_key, email, name, first_name_length, currency, billing_cycle_day,
- payment_provider_name, time_zone, locale,
- address1, address2, company_name, city, state_or_province, country, postal_code, phone)
+ (<accountFields()>)
VALUES
(:id, :externalKey, :email, :name, :firstNameLength, :currency, :billingCycleDay,
:paymentProviderName, :timeZone, :locale,
- :address1, :address2, :companyName, :city, :stateOrProvince, :country, :postalCode, :phone);
+ :address1, :address2, :companyName, :city, :stateOrProvince, :country, :postalCode, :phone,
+ :createdDate, :updatedDate);
>>
update() ::= <<
@@ -17,7 +40,8 @@ update() ::= <<
currency = :currency, billing_cycle_day = :billingCycleDay, payment_provider_name = :paymentProviderName,
time_zone = :timeZone, locale = :locale,
address1 = :address1, address2 = :address2, company_name = :companyName, city = :city, state_or_province = :stateOrProvince,
- country = :country, postal_code = :postalCode, phone = :phone
+ country = :country, postal_code = :postalCode, phone = :phone,
+ updated_dt = NOW()
WHERE id = :id;
>>
@@ -28,35 +52,29 @@ deleteByKey() ::= <<
getAccountByKey() ::= <<
- select id, external_key, email, name, first_name_length, currency, billing_cycle_day,
- payment_provider_name, time_zone, locale,
- address1, address2, company_name, city, state_or_province, country, postal_code, phone
+ select <accountFields()>
from accounts
where external_key = :externalKey;
>>
getById() ::= <<
- select id, external_key, email, name, first_name_length, currency, billing_cycle_day,
- payment_provider_name, time_zone, locale,
- address1, address2, company_name, city, state_or_province, country, postal_code, phone
- from accounts
- where id = :id;
+ SELECT <accountFields()>
+ FROM accounts
+ WHERE id = :id;
>>
get() ::= <<
- select id, external_key, email, name, first_name_length, currency, billing_cycle_day,
- payment_provider_name, time_zone, locale,
- address1, address2, company_name, city, state_or_province, country, postal_code, phone
- from accounts;
+ SELECT <accountFields()>
+ FROM accounts;
>>
getIdFromKey() ::= <<
- select id
- from accounts
- where external_key = :externalKey;
+ SELECT id
+ FROM accounts
+ WHERE external_key = :externalKey;
>>
test() ::= <<
- select 1 from accounts;
+ SELECT 1 FROM accounts;
>>
;
\ No newline at end of file
diff --git a/account/src/main/resources/com/ning/billing/account/ddl.sql b/account/src/main/resources/com/ning/billing/account/ddl.sql
index 5f3ac8c..58b47f0 100644
--- a/account/src/main/resources/com/ning/billing/account/ddl.sql
+++ b/account/src/main/resources/com/ning/billing/account/ddl.sql
@@ -18,6 +18,8 @@ CREATE TABLE accounts (
country varchar(50) DEFAULT NULL,
postal_code varchar(11) DEFAULT NULL,
phone varchar(13) DEFAULT NULL,
+ created_dt datetime,
+ updated_dt datetime,
PRIMARY KEY(id)
) ENGINE=innodb;
CREATE UNIQUE INDEX accounts_external_key ON accounts(external_key);
diff --git a/account/src/test/java/com/ning/billing/account/api/MockAccountUserApi.java b/account/src/test/java/com/ning/billing/account/api/MockAccountUserApi.java
index 49bd534..433a663 100644
--- a/account/src/test/java/com/ning/billing/account/api/MockAccountUserApi.java
+++ b/account/src/test/java/com/ning/billing/account/api/MockAccountUserApi.java
@@ -54,7 +54,7 @@ public class MockAccountUserApi implements AccountUserApi {
Account result = new DefaultAccount(id, externalKey, email, name,
firstNameLength, currency, billCycleDay, paymentProviderName,
timeZone, locale, address1, address2, companyName, city,
- stateOrProvince, country, postalCode, phone);
+ stateOrProvince, country, postalCode, phone, null, null);
accounts.add(result);
return result;
}
diff --git a/account/src/test/java/com/ning/billing/account/dao/TestSimpleAccountDao.java b/account/src/test/java/com/ning/billing/account/dao/TestSimpleAccountDao.java
index 6fd395e..fd5350b 100644
--- a/account/src/test/java/com/ning/billing/account/dao/TestSimpleAccountDao.java
+++ b/account/src/test/java/com/ning/billing/account/dao/TestSimpleAccountDao.java
@@ -16,28 +16,30 @@
package com.ning.billing.account.dao;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.assertTrue;
+import static org.testng.Assert.fail;
+
import java.util.List;
import java.util.UUID;
+
import org.joda.time.DateTime;
import org.joda.time.DateTimeZone;
import org.testng.annotations.Test;
+
import com.ning.billing.account.api.Account;
import com.ning.billing.account.api.AccountApiException;
import com.ning.billing.account.api.AccountData;
import com.ning.billing.account.api.DefaultAccount;
-import com.ning.billing.util.tag.DefaultTagDefinition;
-import com.ning.billing.util.tag.Tag;
-import com.ning.billing.util.tag.TagDefinition;
import com.ning.billing.account.api.user.AccountBuilder;
import com.ning.billing.catalog.api.Currency;
import com.ning.billing.util.clock.DefaultClock;
+import com.ning.billing.util.tag.DefaultTagDefinition;
+import com.ning.billing.util.tag.Tag;
+import com.ning.billing.util.tag.TagDefinition;
import com.ning.billing.util.tag.dao.TagDefinitionSqlDao;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.assertTrue;
-import static org.testng.Assert.fail;
-
@Test(groups = {"account-dao"})
public class TestSimpleAccountDao extends AccountDaoTestBase {
private DefaultAccount createTestAccount() {
@@ -50,10 +52,21 @@ public class TestSimpleAccountDao extends AccountDaoTestBase {
String locale = "EN-US";
DateTimeZone timeZone = DateTimeZone.forID("America/Los_Angeles");
+ DateTime createdDate = new DateTime(DateTimeZone.UTC);
+ DateTime updatedDate = new DateTime(DateTimeZone.UTC);
+
int firstNameLength = firstName.length();
- return new AccountBuilder().externalKey(thisKey).name(name).phone(phone).firstNameLength(firstNameLength)
- .email(thisEmail).currency(Currency.USD).locale(locale)
- .timeZone(timeZone).build();
+ return new AccountBuilder().externalKey(thisKey)
+ .name(name)
+ .phone(phone)
+ .firstNameLength(firstNameLength)
+ .email(thisEmail)
+ .currency(Currency.USD)
+ .locale(locale)
+ .timeZone(timeZone)
+ .createdDate(createdDate)
+ .updatedDate(updatedDate)
+ .build();
}
public void testBasic() throws AccountApiException {
@@ -159,30 +172,37 @@ public class TestSimpleAccountDao extends AccountDaoTestBase {
public String getExternalKey() {
return account.getExternalKey();
}
+
@Override
public String getName() {
return "Jane Doe";
}
+
@Override
public int getFirstNameLength() {
return 4;
}
+
@Override
public String getEmail() {
return account.getEmail();
}
+
@Override
public String getPhone() {
return account.getPhone();
}
+
@Override
public int getBillCycleDay() {
return account.getBillCycleDay();
}
+
@Override
public Currency getCurrency() {
return account.getCurrency();
}
+
@Override
public String getPaymentProviderName() {
return account.getPaymentProviderName();
@@ -232,7 +252,7 @@ public class TestSimpleAccountDao extends AccountDaoTestBase {
}
};
- Account updatedAccount = new DefaultAccount(account.getId(), accountData);
+ Account updatedAccount = new DefaultAccount(account.getId(), accountData, null, null);
accountDao.update(updatedAccount);
Account savedAccount = accountDao.getAccountByKey(account.getExternalKey());
@@ -260,7 +280,7 @@ public class TestSimpleAccountDao extends AccountDaoTestBase {
DefaultAccount account = new DefaultAccount(accountId, "extKey123456", "myemail123456@glam.com",
"John Smith", 4, Currency.USD, 15, null,
DateTimeZone.forID("America/Cambridge_Bay"), "EN-CA",
- null, null, null, null, null, null, null, null);
+ null, null, null, null, null, null, null, null,null,null);
accountDao.create(account);
String address1 = "123 address 1";
@@ -276,7 +296,7 @@ public class TestSimpleAccountDao extends AccountDaoTestBase {
"John Smith", 4, Currency.USD, 15, null,
DateTimeZone.forID("America/Cambridge_Bay"), "EN-CA",
address1, address2, companyName, city, stateOrProvince, country,
- postalCode, phone);
+ postalCode, phone, null,null);
accountDao.update(updatedAccount);
@@ -302,13 +322,13 @@ public class TestSimpleAccountDao extends AccountDaoTestBase {
"John Smith", 4, Currency.USD, 15, null,
DateTimeZone.forID("America/Cambridge_Bay"), "EN-CA",
"123 address 1", "456 address 2", null, "Cambridge Bay",
- "Nunavut", "Canada", "X0B 0C0", "18001112222");
+ "Nunavut", "Canada", "X0B 0C0", "18001112222", null, null);
accountDao.create(account);
DefaultAccount updatedAccount = new DefaultAccount(accountId, "extKey654321", "myemail654321@glam.com",
"John Smith", 4, Currency.USD, 15, null,
DateTimeZone.forID("America/Cambridge_Bay"), "EN-CA",
- null, null, null, null, null, null, null, null);
+ null, null, null, null, null, null, null, null, null, null);
accountDao.update(updatedAccount);
@@ -333,12 +353,12 @@ public class TestSimpleAccountDao extends AccountDaoTestBase {
DefaultAccount account = new DefaultAccount(accountId, originalExternalKey, "myemail1337@glam.com",
"John Smith", 4, Currency.USD, 15, null,
- null, null, null, null, null, null, null, null, null, null);
+ null, null, null, null, null, null, null, null, null, null, null, null);
accountDao.create(account);
DefaultAccount updatedAccount = new DefaultAccount(accountId, "extKey1338", "myemail1337@glam.com",
"John Smith", 4, Currency.USD, 15, null,
- null, null, null, null, null, null, null, null, null, null);
+ null, null, null, null, null, null, null, null, null, null,null, null);
accountDao.update(updatedAccount);
}
analytics/pom.xml 2(+1 -1)
diff --git a/analytics/pom.xml b/analytics/pom.xml
index 278348b..4cd7332 100644
--- a/analytics/pom.xml
+++ b/analytics/pom.xml
@@ -13,7 +13,7 @@
<parent>
<groupId>com.ning.billing</groupId>
<artifactId>killbill</artifactId>
- <version>0.1.2-SNAPSHOT</version>
+ <version>0.1.3-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>killbill-analytics</artifactId>
diff --git a/analytics/src/test/java/com/ning/billing/analytics/MockAccount.java b/analytics/src/test/java/com/ning/billing/analytics/MockAccount.java
index 02f4a0c..d57de25 100644
--- a/analytics/src/test/java/com/ning/billing/analytics/MockAccount.java
+++ b/analytics/src/test/java/com/ning/billing/analytics/MockAccount.java
@@ -16,12 +16,13 @@
package com.ning.billing.analytics;
-import sun.reflect.generics.reflectiveObjects.NotImplementedException;
-
import java.util.List;
import java.util.UUID;
+
+import org.apache.commons.lang.NotImplementedException;
import org.joda.time.DateTime;
import org.joda.time.DateTimeZone;
+
import com.ning.billing.account.api.Account;
import com.ning.billing.catalog.api.Currency;
import com.ning.billing.util.customfield.CustomField;
@@ -206,4 +207,15 @@ public class MockAccount implements Account
public boolean processPayment() {
throw new NotImplementedException();
}
+
+ @Override
+ public DateTime getCreatedDate() {
+ return new DateTime(DateTimeZone.UTC);
+ }
+
+ @Override
+ public DateTime getUpdatedDate() {
+ return new DateTime(DateTimeZone.UTC);
+ }
+
}
api/pom.xml 2(+1 -1)
diff --git a/api/pom.xml b/api/pom.xml
index ca679be..89f3a43 100644
--- a/api/pom.xml
+++ b/api/pom.xml
@@ -13,7 +13,7 @@
<parent>
<groupId>com.ning.billing</groupId>
<artifactId>killbill</artifactId>
- <version>0.1.2-SNAPSHOT</version>
+ <version>0.1.3-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>killbill-api</artifactId>
diff --git a/api/src/main/java/com/ning/billing/account/api/Account.java b/api/src/main/java/com/ning/billing/account/api/Account.java
index 065ed3c..68909c3 100644
--- a/api/src/main/java/com/ning/billing/account/api/Account.java
+++ b/api/src/main/java/com/ning/billing/account/api/Account.java
@@ -16,9 +16,15 @@
package com.ning.billing.account.api;
-import java.math.BigDecimal;
+import org.joda.time.DateTime;
+
import com.ning.billing.util.customfield.CustomizableEntity;
import com.ning.billing.util.tag.Taggable;
public interface Account extends AccountData, CustomizableEntity, Taggable {
+
+ public DateTime getCreatedDate();
+
+ public DateTime getUpdatedDate();
+
}
diff --git a/api/src/main/java/com/ning/billing/invoice/api/InvoiceUserApi.java b/api/src/main/java/com/ning/billing/invoice/api/InvoiceUserApi.java
index a44b2d2..94b28e5 100644
--- a/api/src/main/java/com/ning/billing/invoice/api/InvoiceUserApi.java
+++ b/api/src/main/java/com/ning/billing/invoice/api/InvoiceUserApi.java
@@ -39,4 +39,5 @@ public interface InvoiceUserApi {
// UUID paymentId, DateTime paymentDate);
public BigDecimal getAccountBalance(UUID accountId);
+
}
diff --git a/api/src/main/java/com/ning/billing/payment/api/CreditCardPaymentMethodInfo.java b/api/src/main/java/com/ning/billing/payment/api/CreditCardPaymentMethodInfo.java
index 2071982..75a4ab2 100644
--- a/api/src/main/java/com/ning/billing/payment/api/CreditCardPaymentMethodInfo.java
+++ b/api/src/main/java/com/ning/billing/payment/api/CreditCardPaymentMethodInfo.java
@@ -69,7 +69,7 @@ public final class CreditCardPaymentMethodInfo extends PaymentMethodInfo {
String cardType,
String expirationDate,
String maskNumber) {
- super(id, accountId, defaultMethod, "creditCard");
+ super(id, accountId, defaultMethod, "CreditCard");
this.cardHolderName = cardHolderName;
this.cardType = cardType;
this.expirationDate = expirationDate;
diff --git a/api/src/main/java/com/ning/billing/payment/api/PaypalPaymentMethodInfo.java b/api/src/main/java/com/ning/billing/payment/api/PaypalPaymentMethodInfo.java
index 702d672..65c36e9 100644
--- a/api/src/main/java/com/ning/billing/payment/api/PaypalPaymentMethodInfo.java
+++ b/api/src/main/java/com/ning/billing/payment/api/PaypalPaymentMethodInfo.java
@@ -55,7 +55,7 @@ public final class PaypalPaymentMethodInfo extends PaymentMethodInfo {
Boolean defaultMethod,
String baid,
String email) {
- super(id, accountId, defaultMethod, "paypal");
+ super(id, accountId, defaultMethod, "PayPal");
if (Strings.isNullOrEmpty(accountId) || Strings.isNullOrEmpty(baid) || Strings.isNullOrEmpty(email)) {
throw new IllegalArgumentException("accountId, baid and email should be present");
beatrix/pom.xml 2(+1 -1)
diff --git a/beatrix/pom.xml b/beatrix/pom.xml
index 32ceef9..9e2fdba 100644
--- a/beatrix/pom.xml
+++ b/beatrix/pom.xml
@@ -13,7 +13,7 @@
<parent>
<groupId>com.ning.billing</groupId>
<artifactId>killbill</artifactId>
- <version>0.1.2-SNAPSHOT</version>
+ <version>0.1.3-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>killbill-beatrix</artifactId>
catalog/pom.xml 2(+1 -1)
diff --git a/catalog/pom.xml b/catalog/pom.xml
index 1b5b8d6..1324140 100644
--- a/catalog/pom.xml
+++ b/catalog/pom.xml
@@ -13,7 +13,7 @@
<parent>
<groupId>com.ning.billing</groupId>
<artifactId>killbill</artifactId>
- <version>0.1.2-SNAPSHOT</version>
+ <version>0.1.3-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>killbill-catalog</artifactId>
entitlement/pom.xml 2(+1 -1)
diff --git a/entitlement/pom.xml b/entitlement/pom.xml
index 627ad6b..4ed28e9 100644
--- a/entitlement/pom.xml
+++ b/entitlement/pom.xml
@@ -13,7 +13,7 @@
<parent>
<groupId>com.ning.billing</groupId>
<artifactId>killbill</artifactId>
- <version>0.1.2-SNAPSHOT</version>
+ <version>0.1.3-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>killbill-entitlement</artifactId>
diff --git a/entitlement/src/test/java/com/ning/billing/entitlement/api/billing/BrainDeadAccount.java b/entitlement/src/test/java/com/ning/billing/entitlement/api/billing/BrainDeadAccount.java
index 355ab61..73b7369 100644
--- a/entitlement/src/test/java/com/ning/billing/entitlement/api/billing/BrainDeadAccount.java
+++ b/entitlement/src/test/java/com/ning/billing/entitlement/api/billing/BrainDeadAccount.java
@@ -186,7 +186,17 @@ public class BrainDeadAccount implements Account {
@Override
public void addFields(List<CustomField> fields) {
throw new UnsupportedOperationException();
-
+
}
+ @Override
+ public DateTime getCreatedDate() {
+ return new DateTime(DateTimeZone.UTC);
+ }
+
+ @Override
+ public DateTime getUpdatedDate() {
+ return new DateTime(DateTimeZone.UTC);
+ }
+
}
diff --git a/entitlement/src/test/java/com/ning/billing/entitlement/api/TestApiBase.java b/entitlement/src/test/java/com/ning/billing/entitlement/api/TestApiBase.java
index 5e994aa..81696b0 100644
--- a/entitlement/src/test/java/com/ning/billing/entitlement/api/TestApiBase.java
+++ b/entitlement/src/test/java/com/ning/billing/entitlement/api/TestApiBase.java
@@ -16,11 +16,16 @@
package com.ning.billing.entitlement.api;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.assertTrue;
+
import java.io.IOException;
-import java.lang.reflect.Method;
import java.net.URL;
import java.util.List;
import java.util.UUID;
+
import org.joda.time.DateTime;
import org.joda.time.DateTimeZone;
import org.slf4j.Logger;
@@ -30,6 +35,7 @@ import org.testng.annotations.AfterClass;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeMethod;
+
import com.google.inject.Injector;
import com.ning.billing.account.api.AccountData;
import com.ning.billing.catalog.DefaultCatalogService;
@@ -44,7 +50,6 @@ import com.ning.billing.catalog.api.ProductCategory;
import com.ning.billing.catalog.api.TimeUnit;
import com.ning.billing.config.EntitlementConfig;
import com.ning.billing.entitlement.api.ApiTestListener.NextEvent;
-import com.ning.billing.entitlement.api.EntitlementService;
import com.ning.billing.entitlement.api.billing.EntitlementBillingApi;
import com.ning.billing.entitlement.api.migration.EntitlementMigrationApi;
import com.ning.billing.entitlement.api.user.EntitlementUserApi;
@@ -65,11 +70,6 @@ import com.ning.billing.util.clock.ClockMock;
import com.ning.billing.util.eventbus.DefaultEventBusService;
import com.ning.billing.util.eventbus.EventBusService;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.assertTrue;
-
public abstract class TestApiBase {
@@ -291,22 +291,27 @@ public abstract class TestApiBase {
public String getEmail() {
return "accountName@yahoo.com";
}
+
@Override
public String getPhone() {
return "4152876341";
}
+
@Override
public String getExternalKey() {
return "k123456";
}
+
@Override
public int getBillCycleDay() {
return 1;
}
+
@Override
public Currency getCurrency() {
return Currency.USD;
}
+
@Override
public String getPaymentProviderName() {
return "Paypal";
invoice/pom.xml 2(+1 -1)
diff --git a/invoice/pom.xml b/invoice/pom.xml
index 8c939ca..cdc1725 100644
--- a/invoice/pom.xml
+++ b/invoice/pom.xml
@@ -13,7 +13,7 @@
<parent>
<groupId>com.ning.billing</groupId>
<artifactId>killbill</artifactId>
- <version>0.1.2-SNAPSHOT</version>
+ <version>0.1.3-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>killbill-invoice</artifactId>
payment/pom.xml 2(+1 -1)
diff --git a/payment/pom.xml b/payment/pom.xml
index f7ebbc4..5baa4d4 100644
--- a/payment/pom.xml
+++ b/payment/pom.xml
@@ -13,7 +13,7 @@
<parent>
<groupId>com.ning.billing</groupId>
<artifactId>killbill</artifactId>
- <version>0.1.2-SNAPSHOT</version>
+ <version>0.1.3-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>killbill-payment</artifactId>
pom.xml 4(+2 -2)
diff --git a/pom.xml b/pom.xml
index 6d4aab5..7b8944a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -17,7 +17,7 @@
<groupId>com.ning.billing</groupId>
<artifactId>killbill</artifactId>
<packaging>pom</packaging>
- <version>0.1.2-SNAPSHOT</version>
+ <version>0.1.3-SNAPSHOT</version>
<name>killbill</name>
<description>Library for managing recurring subscriptions and the associated billing</description>
<url>http://github.com/ning/killbill</url>
@@ -29,7 +29,7 @@
</license>
</licenses>
<scm>
- <connection>scm:git:git://github.com/stephane/killbill.git</connection>
+ <connection>scm:git:git://github.com/ning/killbill.git</connection>
<developerConnection>scm:git:git@github.com:ning/killbill.git</developerConnection>
<url>http://github.com/ning/killbill/tree/master</url>
</scm>
util/pom.xml 2(+1 -1)
diff --git a/util/pom.xml b/util/pom.xml
index d78bc6c..c2894a7 100644
--- a/util/pom.xml
+++ b/util/pom.xml
@@ -13,7 +13,7 @@
<parent>
<groupId>com.ning.billing</groupId>
<artifactId>killbill</artifactId>
- <version>0.1.2-SNAPSHOT</version>
+ <version>0.1.3-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>killbill-util</artifactId>