killbill-memoizeit

Merge branch 'integration' of github.com:ning/killbill

7/6/2012 6:43:35 PM

Changes

util/src/main/resources/com/ning/billing/util/template/translation/CatalogTranslation_en_US.properties 2(+0 -2)

util/src/main/resources/com/ning/billing/util/template/translation/CatalogTranslation_fr_CA.properties 1(+0 -1)

Details

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 c2273de..b540d4a 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
@@ -41,9 +41,9 @@ public class DefaultAccount extends EntityBase implements Account {
     private final String externalKey;
     private final String email;
     private final String name;
-    private final int firstNameLength;
+    private final Integer firstNameLength;
     private final Currency currency;
-    private final int billCycleDay;
+    private final Integer billCycleDay;
     private final UUID paymentMethodId;
     private final DateTimeZone timeZone;
     private final String locale;
@@ -55,8 +55,8 @@ public class DefaultAccount extends EntityBase implements Account {
     private final String country;
     private final String postalCode;
     private final String phone;
-    private final boolean isMigrated;
-    private final boolean isNotifiedForInvoices;
+    private final Boolean isMigrated;
+    private final Boolean isNotifiedForInvoices;
 
     public DefaultAccount(final AccountData data) {
         this(UUID.randomUUID(), data);
@@ -81,13 +81,13 @@ public class DefaultAccount extends EntityBase implements Account {
     * This call is used for testing and update from an existing account
     */
     public DefaultAccount(final UUID id, final String externalKey, final String email,
-                          final String name, final int firstNameLength,
-                          final Currency currency, final int billCycleDay, final UUID paymentMethodId,
+                          final String name, final Integer firstNameLength,
+                          final Currency currency, final Integer billCycleDay, final UUID paymentMethodId,
                           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,
-                          final boolean isMigrated, final boolean isNotifiedForInvoices) {
+                          final Boolean isMigrated, final Boolean isNotifiedForInvoices) {
         super(id);
         this.externalKey = externalKey;
         this.email = email;
diff --git a/analytics/src/main/java/com/ning/billing/analytics/AnalyticsListener.java b/analytics/src/main/java/com/ning/billing/analytics/AnalyticsListener.java
index af8c7c6..6337422 100644
--- a/analytics/src/main/java/com/ning/billing/analytics/AnalyticsListener.java
+++ b/analytics/src/main/java/com/ning/billing/analytics/AnalyticsListener.java
@@ -44,6 +44,7 @@ public class AnalyticsListener {
     private final BusinessAccountRecorder bacRecorder;
     private final BusinessInvoiceRecorder invoiceRecorder;
     private final BusinessOverdueStatusRecorder bosRecorder;
+    private final BusinessInvoicePaymentRecorder bipRecorder;
     private final BusinessTagRecorder tagRecorder;
 
     @Inject
@@ -51,11 +52,13 @@ public class AnalyticsListener {
                              final BusinessAccountRecorder bacRecorder,
                              final BusinessInvoiceRecorder invoiceRecorder,
                              final BusinessOverdueStatusRecorder bosRecorder,
+                             final BusinessInvoicePaymentRecorder bipRecorder,
                              final BusinessTagRecorder tagRecorder) {
         this.bstRecorder = bstRecorder;
         this.bacRecorder = bacRecorder;
         this.invoiceRecorder = invoiceRecorder;
         this.bosRecorder = bosRecorder;
+        this.bipRecorder = bipRecorder;
         this.tagRecorder = tagRecorder;
     }
 
@@ -104,12 +107,18 @@ public class AnalyticsListener {
 
     @Subscribe
     public void handlePaymentInfo(final PaymentInfoEvent paymentInfo) {
-        bacRecorder.accountUpdated(paymentInfo);
+        bipRecorder.invoicePaymentPosted(paymentInfo.getAccountId(),
+                                         paymentInfo.getPaymentId(),
+                                         paymentInfo.getExtPaymentRefId(),
+                                         paymentInfo.getStatus().toString());
     }
 
     @Subscribe
     public void handlePaymentError(final PaymentErrorEvent paymentError) {
-        // TODO - we can't tie the error back to an account yet
+        bipRecorder.invoicePaymentPosted(paymentError.getAccountId(),
+                                         paymentError.getPaymentId(),
+                                         null,
+                                         paymentError.getMessage());
     }
 
     @Subscribe
diff --git a/analytics/src/main/java/com/ning/billing/analytics/api/user/DefaultAnalyticsUserApi.java b/analytics/src/main/java/com/ning/billing/analytics/api/user/DefaultAnalyticsUserApi.java
index 102fb95..4d90894 100644
--- a/analytics/src/main/java/com/ning/billing/analytics/api/user/DefaultAnalyticsUserApi.java
+++ b/analytics/src/main/java/com/ning/billing/analytics/api/user/DefaultAnalyticsUserApi.java
@@ -25,6 +25,7 @@ import com.ning.billing.analytics.model.BusinessAccount;
 import com.ning.billing.analytics.model.BusinessAccountTag;
 import com.ning.billing.analytics.model.BusinessInvoice;
 import com.ning.billing.analytics.model.BusinessInvoiceItem;
+import com.ning.billing.analytics.model.BusinessInvoicePayment;
 import com.ning.billing.analytics.model.BusinessOverdueStatus;
 import com.ning.billing.analytics.model.BusinessSubscriptionTransition;
 
@@ -60,4 +61,8 @@ public class DefaultAnalyticsUserApi {
     public List<BusinessInvoiceItem> getInvoiceItemsForInvoice(final UUID invoiceId) {
         return analyticsDao.getInvoiceItemsForInvoice(invoiceId.toString());
     }
+
+    public List<BusinessInvoicePayment> getInvoicePaymentsForAccount(final String accountKey) {
+        return analyticsDao.getInvoicePaymentsForAccountByKey(accountKey);
+    }
 }
diff --git a/analytics/src/main/java/com/ning/billing/analytics/BusinessAccountRecorder.java b/analytics/src/main/java/com/ning/billing/analytics/BusinessAccountRecorder.java
index 0919746..7ecd1b3 100644
--- a/analytics/src/main/java/com/ning/billing/analytics/BusinessAccountRecorder.java
+++ b/analytics/src/main/java/com/ning/billing/analytics/BusinessAccountRecorder.java
@@ -36,7 +36,6 @@ import com.ning.billing.invoice.api.InvoiceUserApi;
 import com.ning.billing.payment.api.Payment;
 import com.ning.billing.payment.api.PaymentApi;
 import com.ning.billing.payment.api.PaymentApiException;
-import com.ning.billing.payment.api.PaymentInfoEvent;
 
 public class BusinessAccountRecorder {
     private static final Logger log = LoggerFactory.getLogger(BusinessAccountRecorder.class);
@@ -70,41 +69,33 @@ public class BusinessAccountRecorder {
     }
 
     /**
-     * Notification handler for Payment creations
-     *
-     * @param paymentInfo payment object (from the payment plugin)
-     */
-    public void accountUpdated(final PaymentInfoEvent paymentInfo) {
-        try {
-            final Account account = accountApi.getAccountById(paymentInfo.getAccountId());
-            accountUpdated(account.getId());
-        } catch (AccountApiException e) {
-            log.warn("Error encountered creating BusinessAccount", e);
-        }
-    }
-
-    /**
      * Notification handler for Invoice creations
      *
      * @param accountId account id associated with the created invoice
      */
     public void accountUpdated(final UUID accountId) {
+        final Account account;
         try {
-            final Account account = accountApi.getAccountById(accountId);
-
-            BusinessAccount bac = sqlDao.getAccount(accountId.toString());
-            if (bac == null) {
-                bac = new BusinessAccount(accountId);
-                updateBusinessAccountFromAccount(account, bac);
-                log.info("ACCOUNT CREATION " + bac);
-                sqlDao.createAccount(bac);
-            } else {
-                updateBusinessAccountFromAccount(account, bac);
-                log.info("ACCOUNT UPDATE " + bac);
-                sqlDao.saveAccount(bac);
-            }
+            account = accountApi.getAccountById(accountId);
         } catch (AccountApiException e) {
             log.warn("Error encountered creating BusinessAccount", e);
+            return;
+        }
+
+        updateAccountInTransaction(account, sqlDao);
+    }
+
+    public void updateAccountInTransaction(final Account account, final BusinessAccountSqlDao transactional) {
+        BusinessAccount bac = transactional.getAccount(account.getId().toString());
+        if (bac == null) {
+            bac = new BusinessAccount(account.getId());
+            updateBusinessAccountFromAccount(account, bac);
+            log.info("ACCOUNT CREATION " + bac);
+            transactional.createAccount(bac);
+        } else {
+            updateBusinessAccountFromAccount(account, bac);
+            log.info("ACCOUNT UPDATE " + bac);
+            transactional.saveAccount(bac);
         }
     }
 
@@ -142,7 +133,7 @@ public class BusinessAccountRecorder {
                         if (lastPaymentDate == null || cur.getEffectiveDate().isAfter(lastPaymentDate)) {
                             lastPaymentDate = cur.getEffectiveDate();
                             lastPaymentStatus = cur.getPaymentStatus().toString();
-                            // STEPH talk to Pierre
+                            // TODO STEPH talk to Pierre
                             paymentMethod = null;
                             creditCardType = null;
                             billingAddressCountry = null;
diff --git a/analytics/src/main/java/com/ning/billing/analytics/BusinessInvoicePaymentRecorder.java b/analytics/src/main/java/com/ning/billing/analytics/BusinessInvoicePaymentRecorder.java
new file mode 100644
index 0000000..1d7c3d0
--- /dev/null
+++ b/analytics/src/main/java/com/ning/billing/analytics/BusinessInvoicePaymentRecorder.java
@@ -0,0 +1,160 @@
+/*
+ * Copyright 2010-2012 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.analytics;
+
+import javax.annotation.Nullable;
+import javax.inject.Inject;
+import java.util.UUID;
+
+import org.skife.jdbi.v2.Transaction;
+import org.skife.jdbi.v2.TransactionStatus;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.ning.billing.account.api.Account;
+import com.ning.billing.account.api.AccountApiException;
+import com.ning.billing.account.api.AccountUserApi;
+import com.ning.billing.analytics.dao.BusinessAccountSqlDao;
+import com.ning.billing.analytics.dao.BusinessInvoicePaymentSqlDao;
+import com.ning.billing.analytics.dao.BusinessInvoiceSqlDao;
+import com.ning.billing.analytics.model.BusinessInvoicePayment;
+import com.ning.billing.invoice.api.InvoicePayment;
+import com.ning.billing.invoice.api.InvoicePaymentApi;
+import com.ning.billing.payment.api.Payment;
+import com.ning.billing.payment.api.PaymentApi;
+import com.ning.billing.payment.api.PaymentApiException;
+import com.ning.billing.payment.api.PaymentMethod;
+import com.ning.billing.payment.api.PaymentMethodPlugin;
+import com.ning.billing.util.clock.Clock;
+
+public class BusinessInvoicePaymentRecorder {
+    private static final Logger log = LoggerFactory.getLogger(BusinessInvoicePaymentRecorder.class);
+
+    private final BusinessInvoicePaymentSqlDao invoicePaymentSqlDao;
+    private final AccountUserApi accountApi;
+    private final InvoicePaymentApi invoicePaymentApi;
+    private final PaymentApi paymentApi;
+    private final Clock clock;
+    private final BusinessInvoiceRecorder invoiceRecorder;
+    private final BusinessAccountRecorder accountRecorder;
+
+    @Inject
+    public BusinessInvoicePaymentRecorder(final BusinessInvoicePaymentSqlDao invoicePaymentSqlDao, final AccountUserApi accountApi,
+                                          final InvoicePaymentApi invoicePaymentApi, final PaymentApi paymentApi, final Clock clock,
+                                          final BusinessInvoiceRecorder invoiceRecorder, final BusinessAccountRecorder accountRecorder) {
+        this.invoicePaymentSqlDao = invoicePaymentSqlDao;
+        this.accountApi = accountApi;
+        this.invoicePaymentApi = invoicePaymentApi;
+        this.paymentApi = paymentApi;
+        this.clock = clock;
+        this.invoiceRecorder = invoiceRecorder;
+        this.accountRecorder = accountRecorder;
+    }
+
+    public void invoicePaymentPosted(final UUID accountId, final UUID paymentId, @Nullable final String extPaymentRefId, final String message) {
+        final Account account;
+        try {
+            account = accountApi.getAccountById(accountId);
+        } catch (AccountApiException e) {
+            log.warn("Ignoring payment {}: account {} does not exist", paymentId, accountId);
+            return;
+        }
+
+        final Payment payment;
+        try {
+            payment = paymentApi.getPayment(paymentId);
+        } catch (PaymentApiException e) {
+            log.warn("Ignoring payment {}: payment does not exist", paymentId);
+            return;
+        }
+
+        final InvoicePayment invoicePayment = invoicePaymentApi.getInvoicePayment(paymentId);
+
+        final PaymentMethod paymentMethod;
+        try {
+            paymentMethod = paymentApi.getPaymentMethod(account, payment.getPaymentMethodId(), true);
+        } catch (PaymentApiException e) {
+            log.warn("Ignoring payment {}: payment method {} does not exist", paymentId, payment.getPaymentMethodId());
+            return;
+        }
+
+        createPayment(account, invoicePayment, payment, paymentMethod, extPaymentRefId, message);
+    }
+
+    private void createPayment(final Account account, @Nullable final InvoicePayment invoicePayment, final Payment payment,
+                               final PaymentMethod paymentMethod, final String extPaymentRefId, final String message) {
+        final PaymentMethodPlugin pluginDetail = paymentMethod.getPluginDetail();
+        // TODO - make it generic
+        final String cardCountry = pluginDetail != null ? pluginDetail.getValueString("country") : null;
+        final String cardType = pluginDetail != null ? pluginDetail.getValueString("cardType") : null;
+        // TODO support CreditCard, DebitCard, WireTransfer, BankTransfer, Check, ACH, Cash, Paypal
+        final String paymentMethodString = cardType != null ? "CreditCard" : "Other";
+
+        invoicePaymentSqlDao.inTransaction(new Transaction<Void, BusinessInvoicePaymentSqlDao>() {
+            @Override
+            public Void inTransaction(final BusinessInvoicePaymentSqlDao transactional, final TransactionStatus status) throws Exception {
+                // Delete the existing payment if it exists - this is to make the call idempotent
+                transactional.deleteInvoicePayment(payment.getId().toString());
+
+                // invoicePayment may be null on payment failures
+                final String invoicePaymentType;
+                final UUID linkedInvoicePaymentId;
+                if (invoicePayment != null) {
+                    invoicePaymentType = invoicePayment.getType().toString();
+                    linkedInvoicePaymentId = invoicePayment.getLinkedInvoicePaymentId();
+                } else {
+                    invoicePaymentType = null;
+                    linkedInvoicePaymentId = null;
+                }
+
+                // Create the bip record
+                final BusinessInvoicePayment businessInvoicePayment = new BusinessInvoicePayment(
+                        account.getExternalKey(),
+                        payment.getAmount(),
+                        extPaymentRefId,
+                        cardCountry,
+                        cardType,
+                        clock.getUTCNow(),
+                        payment.getCurrency(),
+                        payment.getEffectiveDate(),
+                        payment.getInvoiceId(),
+                        message,
+                        payment.getId(),
+                        paymentMethodString,
+                        "Electronic",
+                        paymentMethod.getPluginName(),
+                        payment.getPaymentStatus().toString(),
+                        payment.getAmount(),
+                        clock.getUTCNow(),
+                        invoicePaymentType,
+                        linkedInvoicePaymentId);
+                transactional.createInvoicePayment(businessInvoicePayment);
+
+                // Update bin to get the latest invoice(s) balance(s)
+                final BusinessInvoiceSqlDao invoiceSqlDao = transactional.become(BusinessInvoiceSqlDao.class);
+                invoiceRecorder.rebuildInvoicesForAccountInTransaction(account.getId(), invoiceSqlDao);
+
+                // Update bac to get the latest account balance, total invoice balance, etc.
+                final BusinessAccountSqlDao accountSqlDao = transactional.become(BusinessAccountSqlDao.class);
+                accountRecorder.updateAccountInTransaction(account, accountSqlDao);
+
+                log.info("Added payment {}", businessInvoicePayment);
+                return null;
+            }
+        });
+    }
+}
diff --git a/analytics/src/main/java/com/ning/billing/analytics/BusinessInvoiceRecorder.java b/analytics/src/main/java/com/ning/billing/analytics/BusinessInvoiceRecorder.java
index b3c6996..30baa4a 100644
--- a/analytics/src/main/java/com/ning/billing/analytics/BusinessInvoiceRecorder.java
+++ b/analytics/src/main/java/com/ning/billing/analytics/BusinessInvoiceRecorder.java
@@ -69,6 +69,16 @@ public class BusinessInvoiceRecorder {
     }
 
     public void rebuildInvoicesForAccount(final UUID accountId) {
+        sqlDao.inTransaction(new Transaction<Void, BusinessInvoiceSqlDao>() {
+            @Override
+            public Void inTransaction(final BusinessInvoiceSqlDao transactional, final TransactionStatus status) throws Exception {
+                rebuildInvoicesForAccountInTransaction(accountId, transactional);
+                return null;
+            }
+        });
+    }
+
+    public void rebuildInvoicesForAccountInTransaction(final UUID accountId, final BusinessInvoiceSqlDao transactional) {
         // Lookup the associated account
         final String accountKey;
         try {
@@ -79,20 +89,14 @@ public class BusinessInvoiceRecorder {
             return;
         }
 
-        sqlDao.inTransaction(new Transaction<Void, BusinessInvoiceSqlDao>() {
-            @Override
-            public Void inTransaction(final BusinessInvoiceSqlDao transactional, final TransactionStatus status) throws Exception {
-                log.info("Started rebuilding transitions for account id {}", accountId);
-                deleteInvoicesAndInvoiceItemsForAccountInTransaction(transactional, accountId);
+        log.info("Started rebuilding transitions for account id {}", accountId);
+        deleteInvoicesAndInvoiceItemsForAccountInTransaction(transactional, accountId);
 
-                for (final Invoice invoice : invoiceApi.getInvoicesByAccount(accountId)) {
-                    createInvoiceInTransaction(transactional, accountKey, invoice);
-                }
+        for (final Invoice invoice : invoiceApi.getInvoicesByAccount(accountId)) {
+            createInvoiceInTransaction(transactional, accountKey, invoice);
+        }
 
-                log.info("Finished rebuilding transitions for account id {}", accountId);
-                return null;
-            }
-        });
+        log.info("Finished rebuilding transitions for account id {}", accountId);
     }
 
     private void deleteInvoicesAndInvoiceItemsForAccountInTransaction(final BusinessInvoiceSqlDao transactional, final UUID accountId) {
diff --git a/analytics/src/main/java/com/ning/billing/analytics/dao/AnalyticsDao.java b/analytics/src/main/java/com/ning/billing/analytics/dao/AnalyticsDao.java
index 97d72f2..0e349fc 100644
--- a/analytics/src/main/java/com/ning/billing/analytics/dao/AnalyticsDao.java
+++ b/analytics/src/main/java/com/ning/billing/analytics/dao/AnalyticsDao.java
@@ -22,6 +22,7 @@ import com.ning.billing.analytics.model.BusinessAccount;
 import com.ning.billing.analytics.model.BusinessAccountTag;
 import com.ning.billing.analytics.model.BusinessInvoice;
 import com.ning.billing.analytics.model.BusinessInvoiceItem;
+import com.ning.billing.analytics.model.BusinessInvoicePayment;
 import com.ning.billing.analytics.model.BusinessOverdueStatus;
 import com.ning.billing.analytics.model.BusinessSubscriptionTransition;
 
@@ -37,4 +38,6 @@ public interface AnalyticsDao {
     List<BusinessInvoiceItem> getInvoiceItemsForInvoice(final String invoiceId);
 
     List<BusinessOverdueStatus> getOverdueStatusesForBundleByKey(final String externalKey);
+
+    List<BusinessInvoicePayment> getInvoicePaymentsForAccountByKey(final String accountKey);
 }
diff --git a/analytics/src/main/java/com/ning/billing/analytics/dao/BusinessAccountFieldSqlDao.java b/analytics/src/main/java/com/ning/billing/analytics/dao/BusinessAccountFieldSqlDao.java
index 3bf8b43..4aed48a 100644
--- a/analytics/src/main/java/com/ning/billing/analytics/dao/BusinessAccountFieldSqlDao.java
+++ b/analytics/src/main/java/com/ning/billing/analytics/dao/BusinessAccountFieldSqlDao.java
@@ -30,7 +30,7 @@ import com.ning.billing.analytics.model.BusinessAccountField;
 @RegisterMapper(BusinessAccountFieldMapper.class)
 public interface BusinessAccountFieldSqlDao {
     @SqlQuery
-    List<BusinessAccountField> getFieldsForAccount(@Bind("account_key") final String accountKey);
+    List<BusinessAccountField> getFieldsForAccountByKey(@Bind("account_key") final String accountKey);
 
     @SqlUpdate
     int addField(@Bind("account_id") final String accountId, @Bind("account_key") final String accountKey,
diff --git a/analytics/src/main/java/com/ning/billing/analytics/dao/BusinessAccountTagSqlDao.java b/analytics/src/main/java/com/ning/billing/analytics/dao/BusinessAccountTagSqlDao.java
index 26bc628..77cb020 100644
--- a/analytics/src/main/java/com/ning/billing/analytics/dao/BusinessAccountTagSqlDao.java
+++ b/analytics/src/main/java/com/ning/billing/analytics/dao/BusinessAccountTagSqlDao.java
@@ -30,7 +30,7 @@ import com.ning.billing.analytics.model.BusinessAccountTag;
 @RegisterMapper(BusinessAccountTagMapper.class)
 public interface BusinessAccountTagSqlDao {
     @SqlQuery
-    List<BusinessAccountTag> getTagsForAccount(@Bind("account_key") final String accountKey);
+    List<BusinessAccountTag> getTagsForAccountByKey(@Bind("account_key") final String accountKey);
 
     @SqlUpdate
     int addTag(@Bind("account_id") final String accountId, @Bind("account_key") final String accountKey, @Bind("name") final String name);
diff --git a/analytics/src/main/java/com/ning/billing/analytics/dao/BusinessInvoiceItemSqlDao.java b/analytics/src/main/java/com/ning/billing/analytics/dao/BusinessInvoiceItemSqlDao.java
index dd18e3a..f94293a 100644
--- a/analytics/src/main/java/com/ning/billing/analytics/dao/BusinessInvoiceItemSqlDao.java
+++ b/analytics/src/main/java/com/ning/billing/analytics/dao/BusinessInvoiceItemSqlDao.java
@@ -38,15 +38,12 @@ public interface BusinessInvoiceItemSqlDao extends Transactional<BusinessInvoice
     List<BusinessInvoiceItem> getInvoiceItemsForInvoice(@Bind("invoice_id") final String invoiceId);
 
     @SqlQuery
-    List<BusinessInvoiceItem> getInvoiceItemsForBundle(@Bind("external_key") final String externalKey);
+    List<BusinessInvoiceItem> getInvoiceItemsForBundleByKey(@Bind("external_key") final String externalKey);
 
     @SqlUpdate
     int createInvoiceItem(@BusinessInvoiceItemBinder final BusinessInvoiceItem invoiceItem);
 
     @SqlUpdate
-    int updateInvoiceItem(@BusinessInvoiceItemBinder final BusinessInvoiceItem invoiceItem);
-
-    @SqlUpdate
     int deleteInvoiceItem(@Bind("item_id") final String itemId);
 
     @SqlUpdate
diff --git a/analytics/src/main/java/com/ning/billing/analytics/dao/BusinessInvoicePaymentBinder.java b/analytics/src/main/java/com/ning/billing/analytics/dao/BusinessInvoicePaymentBinder.java
index 8c01e8f..c55111c 100644
--- a/analytics/src/main/java/com/ning/billing/analytics/dao/BusinessInvoicePaymentBinder.java
+++ b/analytics/src/main/java/com/ning/billing/analytics/dao/BusinessInvoicePaymentBinder.java
@@ -22,6 +22,7 @@ import java.lang.annotation.Retention;
 import java.lang.annotation.RetentionPolicy;
 import java.lang.annotation.Target;
 import java.sql.Types;
+import java.util.UUID;
 
 import org.joda.time.DateTime;
 import org.joda.time.DateTimeZone;
@@ -56,7 +57,7 @@ public @interface BusinessInvoicePaymentBinder {
                         q.bind("updated_date", dateTimeNow.getMillis());
                     }
 
-                    q.bind("attempt_id", invoicePayment.getAttemptId().toString());
+                    q.bind("ext_payment_ref_id", invoicePayment.getExtPaymentRefId());
                     q.bind("account_key", invoicePayment.getAccountKey());
                     q.bind("invoice_id", invoicePayment.getInvoiceId().toString());
 
@@ -76,6 +77,14 @@ public @interface BusinessInvoicePaymentBinder {
                     q.bind("payment_method", invoicePayment.getPaymentMethod());
                     q.bind("card_type", invoicePayment.getCardType());
                     q.bind("card_country", invoicePayment.getCardCountry());
+                    q.bind("invoice_payment_type", invoicePayment.getInvoicePaymentType());
+
+                    final UUID linkedInvoicePaymentId = invoicePayment.getLinkedInvoicePaymentId();
+                    if (linkedInvoicePaymentId != null) {
+                        q.bind("linked_invoice_payment_id", linkedInvoicePaymentId.toString());
+                    } else {
+                        q.bindNull("linked_invoice_payment_id", Types.VARCHAR);
+                    }
                 }
             };
         }
diff --git a/analytics/src/main/java/com/ning/billing/analytics/dao/BusinessInvoicePaymentMapper.java b/analytics/src/main/java/com/ning/billing/analytics/dao/BusinessInvoicePaymentMapper.java
index af80d53..de11209 100644
--- a/analytics/src/main/java/com/ning/billing/analytics/dao/BusinessInvoicePaymentMapper.java
+++ b/analytics/src/main/java/com/ning/billing/analytics/dao/BusinessInvoicePaymentMapper.java
@@ -35,7 +35,7 @@ public class BusinessInvoicePaymentMapper implements ResultSetMapper<BusinessInv
         final UUID paymentId = UUID.fromString(r.getString(1));
         final DateTime createdDate = new DateTime(r.getLong(2), DateTimeZone.UTC);
         final DateTime updatedDate = new DateTime(r.getLong(3), DateTimeZone.UTC);
-        final UUID attemptId = UUID.fromString(r.getString(4));
+        final String extPaymentRefId = r.getString(4);
         final String accountKey = r.getString(5);
         final UUID invoiceId = UUID.fromString(r.getString(6));
         final DateTime effectiveDate = new DateTime(r.getLong(7), DateTimeZone.UTC);
@@ -49,9 +49,19 @@ public class BusinessInvoicePaymentMapper implements ResultSetMapper<BusinessInv
         final String paymentMethod = r.getString(15);
         final String cardType = r.getString(16);
         final String cardCountry = r.getString(17);
+        final String invoicePaymentType = r.getString(18);
+        final String linkedInvoicePaymentIdString = r.getString(19);
 
-        return new BusinessInvoicePayment(accountKey, amount, attemptId, cardCountry, cardType, createdDate, currency,
+        final UUID linkedInvoicePaymentId;
+        if (linkedInvoicePaymentIdString != null) {
+            linkedInvoicePaymentId = UUID.fromString(linkedInvoicePaymentIdString);
+        } else {
+            linkedInvoicePaymentId = null;
+        }
+
+        return new BusinessInvoicePayment(accountKey, amount, extPaymentRefId, cardCountry, cardType, createdDate, currency,
                                           effectiveDate, invoiceId, paymentError, paymentId, paymentMethod, paymentType,
-                                          pluginName, processingStatus, requestedAmount, updatedDate);
+                                          pluginName, processingStatus, requestedAmount, updatedDate, invoicePaymentType,
+                                          linkedInvoicePaymentId);
     }
 }
diff --git a/analytics/src/main/java/com/ning/billing/analytics/dao/BusinessInvoicePaymentSqlDao.java b/analytics/src/main/java/com/ning/billing/analytics/dao/BusinessInvoicePaymentSqlDao.java
index 681378d..d21613a 100644
--- a/analytics/src/main/java/com/ning/billing/analytics/dao/BusinessInvoicePaymentSqlDao.java
+++ b/analytics/src/main/java/com/ning/billing/analytics/dao/BusinessInvoicePaymentSqlDao.java
@@ -22,30 +22,26 @@ import org.skife.jdbi.v2.sqlobject.Bind;
 import org.skife.jdbi.v2.sqlobject.SqlQuery;
 import org.skife.jdbi.v2.sqlobject.SqlUpdate;
 import org.skife.jdbi.v2.sqlobject.customizers.RegisterMapper;
+import org.skife.jdbi.v2.sqlobject.mixins.Transactional;
+import org.skife.jdbi.v2.sqlobject.mixins.Transmogrifier;
 import org.skife.jdbi.v2.sqlobject.stringtemplate.ExternalizedSqlViaStringTemplate3;
 
 import com.ning.billing.analytics.model.BusinessInvoicePayment;
 
 @ExternalizedSqlViaStringTemplate3()
 @RegisterMapper(BusinessInvoicePaymentMapper.class)
-public interface BusinessInvoicePaymentSqlDao {
+public interface BusinessInvoicePaymentSqlDao extends Transactional<BusinessInvoicePaymentSqlDao>, Transmogrifier {
     @SqlQuery
-    BusinessInvoicePayment getInvoicePaymentForPaymentAttempt(@Bind("attempt_id") final String attemptId);
+    BusinessInvoicePayment getInvoicePayment(@Bind("payment_id") final String paymentId);
 
     @SqlQuery
-    List<BusinessInvoicePayment> getInvoicePaymentsForPayment(@Bind("payment_id") final String paymentId);
-
-    @SqlQuery
-    List<BusinessInvoicePayment> getInvoicePaymentsForAccount(@Bind("account_key") final String accountKey);
+    List<BusinessInvoicePayment> getInvoicePaymentsForAccountByKey(@Bind("account_key") final String accountKey);
 
     @SqlUpdate
     int createInvoicePayment(@BusinessInvoicePaymentBinder final BusinessInvoicePayment payment);
 
     @SqlUpdate
-    int updateInvoicePaymentForPaymentAttempt(@BusinessInvoicePaymentBinder final BusinessInvoicePayment payment);
-
-    @SqlUpdate
-    int deleteInvoicePaymentForPaymentAttempt(@Bind("attempt_id") final String attemptId);
+    int deleteInvoicePayment(@Bind("payment_id") final String paymentId);
 
     @SqlUpdate
     void test();
diff --git a/analytics/src/main/java/com/ning/billing/analytics/dao/BusinessOverdueStatusSqlDao.java b/analytics/src/main/java/com/ning/billing/analytics/dao/BusinessOverdueStatusSqlDao.java
index b910919..c0d501b 100644
--- a/analytics/src/main/java/com/ning/billing/analytics/dao/BusinessOverdueStatusSqlDao.java
+++ b/analytics/src/main/java/com/ning/billing/analytics/dao/BusinessOverdueStatusSqlDao.java
@@ -32,7 +32,7 @@ import com.ning.billing.analytics.model.BusinessOverdueStatus;
 @RegisterMapper(BusinessOverdueStatusMapper.class)
 public interface BusinessOverdueStatusSqlDao extends Transactional<BusinessOverdueStatusSqlDao>, Transmogrifier {
     @SqlQuery
-    List<BusinessOverdueStatus> getOverdueStatusesForBundle(@Bind("external_key") final String externalKey);
+    List<BusinessOverdueStatus> getOverdueStatusesForBundleByKey(@Bind("external_key") final String externalKey);
 
     @SqlUpdate
     int createOverdueStatus(@BusinessOverdueStatusBinder final BusinessOverdueStatus status);
diff --git a/analytics/src/main/java/com/ning/billing/analytics/dao/BusinessSubscriptionTransitionFieldSqlDao.java b/analytics/src/main/java/com/ning/billing/analytics/dao/BusinessSubscriptionTransitionFieldSqlDao.java
index e000dcc..3a3411d 100644
--- a/analytics/src/main/java/com/ning/billing/analytics/dao/BusinessSubscriptionTransitionFieldSqlDao.java
+++ b/analytics/src/main/java/com/ning/billing/analytics/dao/BusinessSubscriptionTransitionFieldSqlDao.java
@@ -30,7 +30,7 @@ import com.ning.billing.analytics.model.BusinessSubscriptionTransitionField;
 @RegisterMapper(BusinessSubscriptionTransitionFieldMapper.class)
 public interface BusinessSubscriptionTransitionFieldSqlDao {
     @SqlQuery
-    List<BusinessSubscriptionTransitionField> getFieldsForBusinessSubscriptionTransition(@Bind("external_key") final String externalKey);
+    List<BusinessSubscriptionTransitionField> getFieldsForBusinessSubscriptionTransitionByKey(@Bind("external_key") final String externalKey);
 
     @SqlUpdate
     int addField(@Bind("account_key") final String accountKey, @Bind("bundle_id") final String bundleId, @Bind("external_key") final String externalKey,
diff --git a/analytics/src/main/java/com/ning/billing/analytics/dao/BusinessSubscriptionTransitionSqlDao.java b/analytics/src/main/java/com/ning/billing/analytics/dao/BusinessSubscriptionTransitionSqlDao.java
index 254e59e..3c8fd44 100644
--- a/analytics/src/main/java/com/ning/billing/analytics/dao/BusinessSubscriptionTransitionSqlDao.java
+++ b/analytics/src/main/java/com/ning/billing/analytics/dao/BusinessSubscriptionTransitionSqlDao.java
@@ -31,7 +31,7 @@ import com.ning.billing.analytics.model.BusinessSubscriptionTransition;
 @RegisterMapper(BusinessSubscriptionTransitionMapper.class)
 public interface BusinessSubscriptionTransitionSqlDao extends Transactional<BusinessSubscriptionTransitionSqlDao> {
     @SqlQuery
-    List<BusinessSubscriptionTransition> getTransitions(@Bind("external_key") final String externalKey);
+    List<BusinessSubscriptionTransition> getTransitionsByKey(@Bind("external_key") final String externalKey);
 
     @SqlQuery
     List<BusinessSubscriptionTransition> getTransitionForSubscription(@Bind("subscription_id") final String subscriptionId);
diff --git a/analytics/src/main/java/com/ning/billing/analytics/dao/BusinessSubscriptionTransitionTagSqlDao.java b/analytics/src/main/java/com/ning/billing/analytics/dao/BusinessSubscriptionTransitionTagSqlDao.java
index fef5a05..07d4f24 100644
--- a/analytics/src/main/java/com/ning/billing/analytics/dao/BusinessSubscriptionTransitionTagSqlDao.java
+++ b/analytics/src/main/java/com/ning/billing/analytics/dao/BusinessSubscriptionTransitionTagSqlDao.java
@@ -30,7 +30,7 @@ import com.ning.billing.analytics.model.BusinessSubscriptionTransitionTag;
 @RegisterMapper(BusinessSubscriptionTransitionTagMapper.class)
 public interface BusinessSubscriptionTransitionTagSqlDao {
     @SqlQuery
-    List<BusinessSubscriptionTransitionTag> getTagsForBusinessSubscriptionTransition(@Bind("external_key") final String externalKey);
+    List<BusinessSubscriptionTransitionTag> getTagsForBusinessSubscriptionTransitionByKey(@Bind("external_key") final String externalKey);
 
     @SqlUpdate
     int addTag(@Bind("account_key") final String accountKey, @Bind("bundle_id") final String bundleId,
diff --git a/analytics/src/main/java/com/ning/billing/analytics/dao/DefaultAnalyticsDao.java b/analytics/src/main/java/com/ning/billing/analytics/dao/DefaultAnalyticsDao.java
index 5ab5dbb..d4855fd 100644
--- a/analytics/src/main/java/com/ning/billing/analytics/dao/DefaultAnalyticsDao.java
+++ b/analytics/src/main/java/com/ning/billing/analytics/dao/DefaultAnalyticsDao.java
@@ -23,6 +23,7 @@ import com.ning.billing.analytics.model.BusinessAccount;
 import com.ning.billing.analytics.model.BusinessAccountTag;
 import com.ning.billing.analytics.model.BusinessInvoice;
 import com.ning.billing.analytics.model.BusinessInvoiceItem;
+import com.ning.billing.analytics.model.BusinessInvoicePayment;
 import com.ning.billing.analytics.model.BusinessOverdueStatus;
 import com.ning.billing.analytics.model.BusinessSubscriptionTransition;
 
@@ -33,6 +34,7 @@ public class DefaultAnalyticsDao implements AnalyticsDao {
     private final BusinessInvoiceItemSqlDao invoiceItemSqlDao;
     private final BusinessAccountTagSqlDao accountTagSqlDao;
     private final BusinessOverdueStatusSqlDao overdueStatusSqlDao;
+    private final BusinessInvoicePaymentSqlDao invoicePaymentSqlDao;
 
     @Inject
     public DefaultAnalyticsDao(final BusinessAccountSqlDao accountSqlDao,
@@ -40,13 +42,15 @@ public class DefaultAnalyticsDao implements AnalyticsDao {
                                final BusinessInvoiceSqlDao invoiceSqlDao,
                                final BusinessInvoiceItemSqlDao invoiceItemSqlDao,
                                final BusinessAccountTagSqlDao accountTagSqlDao,
-                               final BusinessOverdueStatusSqlDao overdueStatusSqlDao) {
+                               final BusinessOverdueStatusSqlDao overdueStatusSqlDao,
+                               final BusinessInvoicePaymentSqlDao invoicePaymentSqlDao) {
         this.accountSqlDao = accountSqlDao;
         this.subscriptionTransitionSqlDao = subscriptionTransitionSqlDao;
         this.invoiceSqlDao = invoiceSqlDao;
         this.invoiceItemSqlDao = invoiceItemSqlDao;
         this.accountTagSqlDao = accountTagSqlDao;
         this.overdueStatusSqlDao = overdueStatusSqlDao;
+        this.invoicePaymentSqlDao = invoicePaymentSqlDao;
     }
 
     @Override
@@ -56,7 +60,7 @@ public class DefaultAnalyticsDao implements AnalyticsDao {
 
     @Override
     public List<BusinessSubscriptionTransition> getTransitionsByKey(final String externalKey) {
-        return subscriptionTransitionSqlDao.getTransitions(externalKey);
+        return subscriptionTransitionSqlDao.getTransitionsByKey(externalKey);
     }
 
     @Override
@@ -66,7 +70,7 @@ public class DefaultAnalyticsDao implements AnalyticsDao {
 
     @Override
     public List<BusinessAccountTag> getTagsForAccount(final String accountKey) {
-        return accountTagSqlDao.getTagsForAccount(accountKey);
+        return accountTagSqlDao.getTagsForAccountByKey(accountKey);
     }
 
     @Override
@@ -76,6 +80,11 @@ public class DefaultAnalyticsDao implements AnalyticsDao {
 
     @Override
     public List<BusinessOverdueStatus> getOverdueStatusesForBundleByKey(final String externalKey) {
-        return overdueStatusSqlDao.getOverdueStatusesForBundle(externalKey);
+        return overdueStatusSqlDao.getOverdueStatusesForBundleByKey(externalKey);
+    }
+
+    @Override
+    public List<BusinessInvoicePayment> getInvoicePaymentsForAccountByKey(final String accountKey) {
+        return invoicePaymentSqlDao.getInvoicePaymentsForAccountByKey(accountKey);
     }
 }
diff --git a/analytics/src/main/java/com/ning/billing/analytics/model/BusinessInvoice.java b/analytics/src/main/java/com/ning/billing/analytics/model/BusinessInvoice.java
index cb3138a..caae2a3 100644
--- a/analytics/src/main/java/com/ning/billing/analytics/model/BusinessInvoice.java
+++ b/analytics/src/main/java/com/ning/billing/analytics/model/BusinessInvoice.java
@@ -61,8 +61,7 @@ public class BusinessInvoice {
     }
 
     public BusinessInvoice(final String accountKey, final Invoice invoice) {
-        // TODO STEPH this is probably not what we want (CBA versus credit)
-        this(invoice.getAccountId(), accountKey, invoice.getChargedAmount(), invoice.getCBAAmount(), invoice.getPaidAmount(), invoice.getBalance(),
+        this(invoice.getAccountId(), accountKey, invoice.getChargedAmount(), invoice.getCreditAdjAmount(), invoice.getPaidAmount(), invoice.getBalance(),
              new DateTime(DateTimeZone.UTC), invoice.getCurrency(), invoice.getInvoiceDate(), invoice.getId(), invoice.getInvoiceNumber(), invoice.getTargetDate(),
              new DateTime(DateTimeZone.UTC));
     }
diff --git a/analytics/src/main/java/com/ning/billing/analytics/model/BusinessInvoiceItem.java b/analytics/src/main/java/com/ning/billing/analytics/model/BusinessInvoiceItem.java
index 03cb50c..357f4d1 100644
--- a/analytics/src/main/java/com/ning/billing/analytics/model/BusinessInvoiceItem.java
+++ b/analytics/src/main/java/com/ning/billing/analytics/model/BusinessInvoiceItem.java
@@ -31,21 +31,20 @@ import com.ning.billing.invoice.api.InvoiceItem;
 public class BusinessInvoiceItem {
     private final UUID itemId;
     private final DateTime createdDate;
-
-    private DateTime updatedDate;
-    private UUID invoiceId;
-    private String itemType;
-    private String externalKey;
-    private String productName;
-    private String productType;
-    private String productCategory;
-    private String slug;
-    private String phase;
-    private String billingPeriod;
-    private DateTime startDate;
-    private DateTime endDate;
-    private BigDecimal amount;
-    private Currency currency;
+    private final DateTime updatedDate;
+    private final UUID invoiceId;
+    private final String itemType;
+    private final String externalKey;
+    private final String productName;
+    private final String productType;
+    private final String productCategory;
+    private final String slug;
+    private final String phase;
+    private final String billingPeriod;
+    private final DateTime startDate;
+    private final DateTime endDate;
+    private final BigDecimal amount;
+    private final Currency currency;
 
     public BusinessInvoiceItem(final BigDecimal amount, final String billingPeriod, final DateTime createdDate,
                                final Currency currency, final DateTime endDate, final String externalKey,
@@ -89,114 +88,58 @@ public class BusinessInvoiceItem {
         return amount;
     }
 
-    public void setAmount(final BigDecimal amount) {
-        this.amount = amount;
-    }
-
     public String getBillingPeriod() {
         return billingPeriod;
     }
 
-    public void setBillingPeriod(final String billingPeriod) {
-        this.billingPeriod = billingPeriod;
-    }
-
     public Currency getCurrency() {
         return currency;
     }
 
-    public void setCurrency(final Currency currency) {
-        this.currency = currency;
-    }
-
     public DateTime getEndDate() {
         return endDate;
     }
 
-    public void setEndDate(final DateTime endDate) {
-        this.endDate = endDate;
-    }
-
     public String getExternalKey() {
         return externalKey;
     }
 
-    public void setExternalKey(final String externalKey) {
-        this.externalKey = externalKey;
-    }
-
     public UUID getInvoiceId() {
         return invoiceId;
     }
 
-    public void setInvoiceId(final UUID invoiceId) {
-        this.invoiceId = invoiceId;
-    }
-
     public String getItemType() {
         return itemType;
     }
 
-    public void setItemType(final String itemType) {
-        this.itemType = itemType;
-    }
-
     public String getPhase() {
         return phase;
     }
 
-    public void setPhase(final String phase) {
-        this.phase = phase;
-    }
-
     public String getProductCategory() {
         return productCategory;
     }
 
-    public void setProductCategory(final String productCategory) {
-        this.productCategory = productCategory;
-    }
-
     public String getProductName() {
         return productName;
     }
 
-    public void setProductName(final String productName) {
-        this.productName = productName;
-    }
-
     public String getProductType() {
         return productType;
     }
 
-    public void setProductType(final String productType) {
-        this.productType = productType;
-    }
-
     public String getSlug() {
         return slug;
     }
 
-    public void setSlug(final String slug) {
-        this.slug = slug;
-    }
-
     public DateTime getStartDate() {
         return startDate;
     }
 
-    public void setStartDate(final DateTime startDate) {
-        this.startDate = startDate;
-    }
-
     public DateTime getUpdatedDate() {
         return updatedDate;
     }
 
-    public void setUpdatedDate(final DateTime updatedDate) {
-        this.updatedDate = updatedDate;
-    }
-
     @Override
     public String toString() {
         final StringBuilder sb = new StringBuilder();
diff --git a/analytics/src/main/java/com/ning/billing/analytics/model/BusinessInvoicePayment.java b/analytics/src/main/java/com/ning/billing/analytics/model/BusinessInvoicePayment.java
index 2622437..73a1f8d 100644
--- a/analytics/src/main/java/com/ning/billing/analytics/model/BusinessInvoicePayment.java
+++ b/analytics/src/main/java/com/ning/billing/analytics/model/BusinessInvoicePayment.java
@@ -16,6 +16,7 @@
 
 package com.ning.billing.analytics.model;
 
+import javax.annotation.Nullable;
 import java.math.BigDecimal;
 import java.util.UUID;
 
@@ -27,32 +28,34 @@ import com.ning.billing.catalog.api.Currency;
 public class BusinessInvoicePayment {
     private final UUID paymentId;
     private final DateTime createdDate;
-    private final UUID attemptId;
-
-    private DateTime updatedDate;
-    private String accountKey;
-    private UUID invoiceId;
-    private DateTime effectiveDate;
-    private BigDecimal amount;
-    private Currency currency;
-    private String paymentError;
-    private String processingStatus;
-    private BigDecimal requestedAmount;
-    private String pluginName;
-    private String paymentType;
-    private String paymentMethod;
-    private String cardType;
-    private String cardCountry;
-
-    public BusinessInvoicePayment(final String accountKey, final BigDecimal amount, final UUID attemptId,
+    private final String extPaymentRefId;
+    private final DateTime updatedDate;
+    private final String accountKey;
+    private final UUID invoiceId;
+    private final DateTime effectiveDate;
+    private final BigDecimal amount;
+    private final Currency currency;
+    private final String paymentError;
+    private final String processingStatus;
+    private final BigDecimal requestedAmount;
+    private final String pluginName;
+    private final String paymentType;
+    private final String paymentMethod;
+    private final String cardType;
+    private final String cardCountry;
+    private final String invoicePaymentType;
+    private final UUID linkedInvoicePaymentId;
+
+    public BusinessInvoicePayment(final String accountKey, final BigDecimal amount, final String extPaymentRefId,
                                   final String cardCountry, final String cardType, final DateTime createdDate,
                                   final Currency currency, final DateTime effectiveDate, final UUID invoiceId,
                                   final String paymentError, final UUID paymentId, final String paymentMethod,
                                   final String paymentType, final String pluginName, final String processingStatus,
-                                  final BigDecimal requestedAmount, final DateTime updatedDate) {
+                                  final BigDecimal requestedAmount, final DateTime updatedDate, @Nullable final String invoicePaymentType,
+                                  @Nullable final UUID linkedInvoicePaymentId) {
         this.accountKey = accountKey;
         this.amount = amount;
-        this.attemptId = attemptId;
+        this.extPaymentRefId = extPaymentRefId;
         this.cardCountry = cardCountry;
         this.cardType = cardType;
         this.createdDate = createdDate;
@@ -67,10 +70,12 @@ public class BusinessInvoicePayment {
         this.processingStatus = processingStatus;
         this.requestedAmount = requestedAmount;
         this.updatedDate = updatedDate;
+        this.invoicePaymentType = invoicePaymentType;
+        this.linkedInvoicePaymentId = linkedInvoicePaymentId;
     }
 
-    public UUID getAttemptId() {
-        return attemptId;
+    public String getExtPaymentRefId() {
+        return extPaymentRefId;
     }
 
     public DateTime getCreatedDate() {
@@ -85,112 +90,64 @@ public class BusinessInvoicePayment {
         return accountKey;
     }
 
-    public void setAccountKey(final String accountKey) {
-        this.accountKey = accountKey;
-    }
-
     public BigDecimal getAmount() {
         return amount;
     }
 
-    public void setAmount(final BigDecimal amount) {
-        this.amount = amount;
-    }
-
     public String getCardCountry() {
         return cardCountry;
     }
 
-    public void setCardCountry(final String cardCountry) {
-        this.cardCountry = cardCountry;
-    }
-
     public String getCardType() {
         return cardType;
     }
 
-    public void setCardType(final String cardType) {
-        this.cardType = cardType;
-    }
-
     public Currency getCurrency() {
         return currency;
     }
 
-    public void setCurrency(final Currency currency) {
-        this.currency = currency;
-    }
-
     public DateTime getEffectiveDate() {
         return effectiveDate;
     }
 
-    public void setEffectiveDate(final DateTime effectiveDate) {
-        this.effectiveDate = effectiveDate;
-    }
-
     public UUID getInvoiceId() {
         return invoiceId;
     }
 
-    public void setInvoiceId(final UUID invoiceId) {
-        this.invoiceId = invoiceId;
-    }
-
     public String getPaymentError() {
         return paymentError;
     }
 
-    public void setPaymentError(final String paymentError) {
-        this.paymentError = paymentError;
-    }
-
     public String getPaymentMethod() {
         return paymentMethod;
     }
 
-    public void setPaymentMethod(final String paymentMethod) {
-        this.paymentMethod = paymentMethod;
-    }
-
     public String getPaymentType() {
         return paymentType;
     }
 
-    public void setPaymentType(final String paymentType) {
-        this.paymentType = paymentType;
-    }
-
     public String getPluginName() {
         return pluginName;
     }
 
-    public void setPluginName(final String pluginName) {
-        this.pluginName = pluginName;
-    }
-
     public String getProcessingStatus() {
         return processingStatus;
     }
 
-    public void setProcessingStatus(final String processingStatus) {
-        this.processingStatus = processingStatus;
-    }
-
     public BigDecimal getRequestedAmount() {
         return requestedAmount;
     }
 
-    public void setRequestedAmount(final BigDecimal requestedAmount) {
-        this.requestedAmount = requestedAmount;
-    }
-
     public DateTime getUpdatedDate() {
         return updatedDate;
     }
 
-    public void setUpdatedDate(final DateTime updatedDate) {
-        this.updatedDate = updatedDate;
+    public String getInvoicePaymentType() {
+        return invoicePaymentType;
+    }
+
+    public UUID getLinkedInvoicePaymentId() {
+        return linkedInvoicePaymentId;
     }
 
     @Override
@@ -200,7 +157,7 @@ public class BusinessInvoicePayment {
         sb.append("{accountKey='").append(accountKey).append('\'');
         sb.append(", paymentId=").append(paymentId);
         sb.append(", createdDate=").append(createdDate);
-        sb.append(", attemptId=").append(attemptId);
+        sb.append(", extPaymentRefId=").append(extPaymentRefId);
         sb.append(", updatedDate=").append(updatedDate);
         sb.append(", invoiceId=").append(invoiceId);
         sb.append(", effectiveDate=").append(effectiveDate);
@@ -214,6 +171,8 @@ public class BusinessInvoicePayment {
         sb.append(", paymentMethod='").append(paymentMethod).append('\'');
         sb.append(", cardType='").append(cardType).append('\'');
         sb.append(", cardCountry='").append(cardCountry).append('\'');
+        sb.append(", invoicePaymentType='").append(invoicePaymentType).append('\'');
+        sb.append(", linkedInvoicePaymentId='").append(linkedInvoicePaymentId).append('\'');
         sb.append('}');
         return sb.toString();
     }
@@ -235,7 +194,7 @@ public class BusinessInvoicePayment {
         if (amount != null ? Rounder.round(amount) != Rounder.round(that.amount) : that.amount != null) {
             return false;
         }
-        if (attemptId != null ? !attemptId.equals(that.attemptId) : that.attemptId != null) {
+        if (extPaymentRefId != null ? !extPaymentRefId.equals(that.extPaymentRefId) : that.extPaymentRefId != null) {
             return false;
         }
         if (cardCountry != null ? !cardCountry.equals(that.cardCountry) : that.cardCountry != null) {
@@ -280,6 +239,12 @@ public class BusinessInvoicePayment {
         if (updatedDate != null ? !updatedDate.equals(that.updatedDate) : that.updatedDate != null) {
             return false;
         }
+        if (invoicePaymentType != null ? !invoicePaymentType.equals(that.invoicePaymentType) : that.invoicePaymentType != null) {
+            return false;
+        }
+        if (linkedInvoicePaymentId != null ? !linkedInvoicePaymentId.equals(that.linkedInvoicePaymentId) : that.linkedInvoicePaymentId != null) {
+            return false;
+        }
 
         return true;
     }
@@ -288,7 +253,7 @@ public class BusinessInvoicePayment {
     public int hashCode() {
         int result = paymentId != null ? paymentId.hashCode() : 0;
         result = 31 * result + (createdDate != null ? createdDate.hashCode() : 0);
-        result = 31 * result + (attemptId != null ? attemptId.hashCode() : 0);
+        result = 31 * result + (extPaymentRefId != null ? extPaymentRefId.hashCode() : 0);
         result = 31 * result + (updatedDate != null ? updatedDate.hashCode() : 0);
         result = 31 * result + (accountKey != null ? accountKey.hashCode() : 0);
         result = 31 * result + (invoiceId != null ? invoiceId.hashCode() : 0);
diff --git a/analytics/src/main/resources/com/ning/billing/analytics/dao/BusinessAccountFieldSqlDao.sql.stg b/analytics/src/main/resources/com/ning/billing/analytics/dao/BusinessAccountFieldSqlDao.sql.stg
index 43b90ab..2fd6b5c 100644
--- a/analytics/src/main/resources/com/ning/billing/analytics/dao/BusinessAccountFieldSqlDao.sql.stg
+++ b/analytics/src/main/resources/com/ning/billing/analytics/dao/BusinessAccountFieldSqlDao.sql.stg
@@ -1,6 +1,6 @@
 group BusinessAccountField;
 
-getFieldsForAccount(account_key) ::=<<
+getFieldsForAccountByKey(account_key) ::=<<
 select
   account_id
 , account_key
diff --git a/analytics/src/main/resources/com/ning/billing/analytics/dao/BusinessAccountTagSqlDao.sql.stg b/analytics/src/main/resources/com/ning/billing/analytics/dao/BusinessAccountTagSqlDao.sql.stg
index 1b4762c..5c9a954 100644
--- a/analytics/src/main/resources/com/ning/billing/analytics/dao/BusinessAccountTagSqlDao.sql.stg
+++ b/analytics/src/main/resources/com/ning/billing/analytics/dao/BusinessAccountTagSqlDao.sql.stg
@@ -1,6 +1,6 @@
 group BusinessAccountTag;
 
-getTagsForAccount(account_key) ::=<<
+getTagsForAccountByKey(account_key) ::=<<
 select
   account_id
 , account_key
diff --git a/analytics/src/main/resources/com/ning/billing/analytics/dao/BusinessInvoiceItemSqlDao.sql.stg b/analytics/src/main/resources/com/ning/billing/analytics/dao/BusinessInvoiceItemSqlDao.sql.stg
index 7952eb6..2d55e1f 100644
--- a/analytics/src/main/resources/com/ning/billing/analytics/dao/BusinessInvoiceItemSqlDao.sql.stg
+++ b/analytics/src/main/resources/com/ning/billing/analytics/dao/BusinessInvoiceItemSqlDao.sql.stg
@@ -48,7 +48,7 @@ order by created_date asc
 ;
 >>
 
-getInvoiceItemsForBundle(external_key) ::= <<
+getInvoiceItemsForBundleByKey(external_key) ::= <<
 select
   item_id
 , created_date
@@ -110,30 +110,10 @@ insert into bii (
 );
 >>
 
-updateInvoiceItem() ::= <<
-update bii set
-  updated_date = :updated_date
-, invoice_id = :invoice_id
-, item_type = :item_type
-, external_key = :external_key
-, product_name = :product_name
-, product_type = :product_type
-, product_category = :product_category
-, slug = :slug
-, phase = :phase
-, billing_period = :billing_period
-, start_date = :start_date
-, end_date = :end_date
-, amount = :amount
-, currency = :currency
-where item_id = :item_id
-;
->>
-
 deleteInvoiceItem(item_id) ::= <<
 delete from bii where item_id = :item_id;
 >>
 
 test() ::= <<
 select 1 from bii;
->>
\ No newline at end of file
+>>
diff --git a/analytics/src/main/resources/com/ning/billing/analytics/dao/BusinessInvoicePaymentSqlDao.sql.stg b/analytics/src/main/resources/com/ning/billing/analytics/dao/BusinessInvoicePaymentSqlDao.sql.stg
index c5d0fb8..a71f3d5 100644
--- a/analytics/src/main/resources/com/ning/billing/analytics/dao/BusinessInvoicePaymentSqlDao.sql.stg
+++ b/analytics/src/main/resources/com/ning/billing/analytics/dao/BusinessInvoicePaymentSqlDao.sql.stg
@@ -1,36 +1,11 @@
 group BusinessInvoicePayment;
 
-getInvoicePaymentForPaymentAttempt(attempt_id) ::= <<
+getInvoicePayment(payment_id) ::= <<
 select
   payment_id
 , created_date
 , updated_date
-, attempt_id
-, account_key
-, invoice_id
-, effective_date
-, amount
-, currency
-, payment_error
-, processing_status
-, requested_amount
-, plugin_name
-, payment_type
-, payment_method
-, card_type
-, card_country
-from bip
-where attempt_id = :attempt_id
-limit 1
-;
->>
-
-getInvoicePaymentsForPayment(payment_id) ::= <<
-select
-  payment_id
-, created_date
-, updated_date
-, attempt_id
+, ext_payment_ref_id
 , account_key
 , invoice_id
 , effective_date
@@ -44,18 +19,20 @@ select
 , payment_method
 , card_type
 , card_country
+, invoice_payment_type
+, linked_invoice_payment_id
 from bip
 where payment_id = :payment_id
-order by created_date asc
+limit 1
 ;
 >>
 
-getInvoicePaymentsForAccount(account_key) ::= <<
+getInvoicePaymentsForAccountByKey(account_key) ::= <<
 select
   payment_id
 , created_date
 , updated_date
-, attempt_id
+, ext_payment_ref_id
 , account_key
 , invoice_id
 , effective_date
@@ -69,6 +46,8 @@ select
 , payment_method
 , card_type
 , card_country
+, invoice_payment_type
+, linked_invoice_payment_id
 from bip
 where account_key = :account_key
 order by created_date asc
@@ -80,7 +59,7 @@ insert into bip (
   payment_id
 , created_date
 , updated_date
-, attempt_id
+, ext_payment_ref_id
 , account_key
 , invoice_id
 , effective_date
@@ -94,11 +73,13 @@ insert into bip (
 , payment_method
 , card_type
 , card_country
+, invoice_payment_type
+, linked_invoice_payment_id
 ) values (
   :payment_id
 , :created_date
 , :updated_date
-, :attempt_id
+, :ext_payment_ref_id
 , :account_key
 , :invoice_id
 , :effective_date
@@ -112,33 +93,15 @@ insert into bip (
 , :payment_method
 , :card_type
 , :card_country
+, :invoice_payment_type
+, :linked_invoice_payment_id
 );
 >>
 
-updateInvoicePaymentForPaymentAttempt() ::= <<
-update bip set
-  updated_date = :updated_date
-, account_key = :account_key
-, invoice_id = :invoice_id
-, effective_date = :effective_date
-, amount = :amount
-, currency = :currency
-, payment_error = :payment_error
-, processing_status = :processing_status
-, requested_amount = :requested_amount
-, plugin_name = :plugin_name
-, payment_type = :payment_type
-, payment_method = :payment_method
-, card_type = :card_type
-, card_country = :card_country
-where attempt_id = :attempt_id
-;
->>
-
-deleteInvoicePaymentForPaymentAttempt(attempt_id) ::= <<
-delete from bip where attempt_id = :attempt_id
+deleteInvoicePayment(payment_id) ::= <<
+delete from bip where payment_id = :payment_id
 >>
 
 test() ::= <<
 select 1 from bip;
->>
\ No newline at end of file
+>>
diff --git a/analytics/src/main/resources/com/ning/billing/analytics/dao/BusinessOverdueStatusSqlDao.sql.stg b/analytics/src/main/resources/com/ning/billing/analytics/dao/BusinessOverdueStatusSqlDao.sql.stg
index fddafdb..532a39b 100644
--- a/analytics/src/main/resources/com/ning/billing/analytics/dao/BusinessOverdueStatusSqlDao.sql.stg
+++ b/analytics/src/main/resources/com/ning/billing/analytics/dao/BusinessOverdueStatusSqlDao.sql.stg
@@ -1,6 +1,6 @@
 group BusinessOverdueStatus;
 
-getOverdueStatusesForBundle(external_key) ::= <<
+getOverdueStatusesForBundleByKey(external_key) ::= <<
 select
   bundle_id
 , external_key
diff --git a/analytics/src/main/resources/com/ning/billing/analytics/dao/BusinessSubscriptionTransitionFieldSqlDao.sql.stg b/analytics/src/main/resources/com/ning/billing/analytics/dao/BusinessSubscriptionTransitionFieldSqlDao.sql.stg
index a9e9a2b..8480e3f 100644
--- a/analytics/src/main/resources/com/ning/billing/analytics/dao/BusinessSubscriptionTransitionFieldSqlDao.sql.stg
+++ b/analytics/src/main/resources/com/ning/billing/analytics/dao/BusinessSubscriptionTransitionFieldSqlDao.sql.stg
@@ -1,6 +1,6 @@
 group BusinessSubscriptionTransitionField;
 
-getFieldsForBusinessSubscriptionTransition(external_key) ::=<<
+getFieldsForBusinessSubscriptionTransitionByKey(external_key) ::=<<
 select
   bundle_id
 , external_key
diff --git a/analytics/src/main/resources/com/ning/billing/analytics/dao/BusinessSubscriptionTransitionSqlDao.sql.stg b/analytics/src/main/resources/com/ning/billing/analytics/dao/BusinessSubscriptionTransitionSqlDao.sql.stg
index 58d04f4..6bda4e4 100644
--- a/analytics/src/main/resources/com/ning/billing/analytics/dao/BusinessSubscriptionTransitionSqlDao.sql.stg
+++ b/analytics/src/main/resources/com/ning/billing/analytics/dao/BusinessSubscriptionTransitionSqlDao.sql.stg
@@ -1,6 +1,6 @@
 group BusinessSubscriptionTransition;
 
-getTransitions(external_key) ::= <<
+getTransitionsByKey(external_key) ::= <<
   select
     total_ordering
   , bundle_id
diff --git a/analytics/src/main/resources/com/ning/billing/analytics/dao/BusinessSubscriptionTransitionTagSqlDao.sql.stg b/analytics/src/main/resources/com/ning/billing/analytics/dao/BusinessSubscriptionTransitionTagSqlDao.sql.stg
index c33c98e..2eb6f37 100644
--- a/analytics/src/main/resources/com/ning/billing/analytics/dao/BusinessSubscriptionTransitionTagSqlDao.sql.stg
+++ b/analytics/src/main/resources/com/ning/billing/analytics/dao/BusinessSubscriptionTransitionTagSqlDao.sql.stg
@@ -1,6 +1,6 @@
 group BusinessSubscriptionTransitionTag;
 
-getTagsForBusinessSubscriptionTransition(external_key) ::=<<
+getTagsForBusinessSubscriptionTransitionByKey(external_key) ::=<<
 select
   bundle_id
 , external_key
diff --git a/analytics/src/main/resources/com/ning/billing/analytics/ddl.sql b/analytics/src/main/resources/com/ning/billing/analytics/ddl.sql
index 09d0a0c..102a442 100644
--- a/analytics/src/main/resources/com/ning/billing/analytics/ddl.sql
+++ b/analytics/src/main/resources/com/ning/billing/analytics/ddl.sql
@@ -106,7 +106,7 @@ create table bip (
 , payment_id char(36) not null
 , created_date bigint not null
 , updated_date bigint not null
-, attempt_id char(36) not null
+, ext_payment_ref_id varchar(64) default null
 , account_key varchar(50) not null comment 'Account external key'
 , invoice_id char(36) not null
 , effective_date bigint default null
@@ -120,9 +120,11 @@ create table bip (
 , payment_method varchar(20) default null
 , card_type varchar(20) default null
 , card_country varchar(20) default null
+, invoice_payment_type varchar(24) default null
+, linked_invoice_payment_id char(36) default null
 , primary key(record_id)
-) engine=innodb comment 'Business Invoice Payments, track all payment attempts';
-create unique index bip_key_index on bip (attempt_id);
+) engine=innodb comment 'Business Invoice Payments, track all payments';
+create unique index bip_key_index on bip (payment_id);
 
 drop table if exists bos;
 create table bos (
diff --git a/analytics/src/test/java/com/ning/billing/analytics/api/TestAnalyticsService.java b/analytics/src/test/java/com/ning/billing/analytics/api/TestAnalyticsService.java
index 2df1254..405c431 100644
--- a/analytics/src/test/java/com/ning/billing/analytics/api/TestAnalyticsService.java
+++ b/analytics/src/test/java/com/ning/billing/analytics/api/TestAnalyticsService.java
@@ -267,8 +267,8 @@ public class TestAnalyticsService extends TestWithEmbeddedDB {
         bus.post(accountCreationNotification);
         Thread.sleep(5000);
 
-        Assert.assertEquals(subscriptionSqlDao.getTransitions(EXTERNAL_KEY).size(), 1);
-        Assert.assertEquals(subscriptionSqlDao.getTransitions(EXTERNAL_KEY).get(0), expectedTransition);
+        Assert.assertEquals(subscriptionSqlDao.getTransitionsByKey(EXTERNAL_KEY).size(), 1);
+        Assert.assertEquals(subscriptionSqlDao.getTransitionsByKey(EXTERNAL_KEY).get(0), expectedTransition);
 
         // Test invoice integration - the account creation notification has triggered a BAC update
         Assert.assertTrue(accountSqlDao.getAccountByKey(ACCOUNT_KEY).getTotalInvoiceBalance().compareTo(INVOICE_AMOUNT) == 0);
diff --git a/analytics/src/test/java/com/ning/billing/analytics/dao/TestAnalyticsDao.java b/analytics/src/test/java/com/ning/billing/analytics/dao/TestAnalyticsDao.java
index c03f999..b083b48 100644
--- a/analytics/src/test/java/com/ning/billing/analytics/dao/TestAnalyticsDao.java
+++ b/analytics/src/test/java/com/ning/billing/analytics/dao/TestAnalyticsDao.java
@@ -131,7 +131,7 @@ public class TestAnalyticsDao extends TestWithEmbeddedDB {
         );
         businessSubscriptionTransitionSqlDao.createTransition(transitionWithNullPrev);
 
-        final List<BusinessSubscriptionTransition> transitions = businessSubscriptionTransitionSqlDao.getTransitions(EXTERNAL_KEY);
+        final List<BusinessSubscriptionTransition> transitions = businessSubscriptionTransitionSqlDao.getTransitionsByKey(EXTERNAL_KEY);
         Assert.assertEquals(transitions.size(), 1);
         Assert.assertEquals(transitions.get(0), transitionWithNullPrev);
     }
@@ -152,7 +152,7 @@ public class TestAnalyticsDao extends TestWithEmbeddedDB {
         );
         businessSubscriptionTransitionSqlDao.createTransition(transitionWithNullNext);
 
-        final List<BusinessSubscriptionTransition> transitions = businessSubscriptionTransitionSqlDao.getTransitions(EXTERNAL_KEY);
+        final List<BusinessSubscriptionTransition> transitions = businessSubscriptionTransitionSqlDao.getTransitionsByKey(EXTERNAL_KEY);
         Assert.assertEquals(transitions.size(), 1);
         Assert.assertEquals(transitions.get(0), transitionWithNullNext);
     }
@@ -174,7 +174,7 @@ public class TestAnalyticsDao extends TestWithEmbeddedDB {
         );
         businessSubscriptionTransitionSqlDao.createTransition(transitionWithNullFields);
 
-        final List<BusinessSubscriptionTransition> transitions = businessSubscriptionTransitionSqlDao.getTransitions(EXTERNAL_KEY);
+        final List<BusinessSubscriptionTransition> transitions = businessSubscriptionTransitionSqlDao.getTransitionsByKey(EXTERNAL_KEY);
         Assert.assertEquals(transitions.size(), 1);
         Assert.assertEquals(transitions.get(0), transitionWithNullFields);
     }
@@ -196,7 +196,7 @@ public class TestAnalyticsDao extends TestWithEmbeddedDB {
         );
         businessSubscriptionTransitionSqlDao.createTransition(transitionWithNullPlanAndPhase);
 
-        final List<BusinessSubscriptionTransition> transitions = businessSubscriptionTransitionSqlDao.getTransitions(EXTERNAL_KEY);
+        final List<BusinessSubscriptionTransition> transitions = businessSubscriptionTransitionSqlDao.getTransitionsByKey(EXTERNAL_KEY);
         Assert.assertEquals(transitions.size(), 1);
         Assert.assertEquals(transitions.get(0).getExternalKey(), transition.getExternalKey());
         Assert.assertEquals(transitions.get(0).getRequestedTimestamp(), transition.getRequestedTimestamp());
@@ -222,7 +222,7 @@ public class TestAnalyticsDao extends TestWithEmbeddedDB {
         );
         businessSubscriptionTransitionSqlDao.createTransition(transitionWithNullPlan);
 
-        final List<BusinessSubscriptionTransition> transitions = businessSubscriptionTransitionSqlDao.getTransitions(EXTERNAL_KEY);
+        final List<BusinessSubscriptionTransition> transitions = businessSubscriptionTransitionSqlDao.getTransitionsByKey(EXTERNAL_KEY);
         Assert.assertEquals(transitions.size(), 1);
         // Null Plan but Phase - we don't turn the subscription into a null
         Assert.assertEquals(transitions.get(0), transitionWithNullPlan);
@@ -245,7 +245,7 @@ public class TestAnalyticsDao extends TestWithEmbeddedDB {
         );
         businessSubscriptionTransitionSqlDao.createTransition(transitionWithNullPhase);
 
-        final List<BusinessSubscriptionTransition> transitions = businessSubscriptionTransitionSqlDao.getTransitions(EXTERNAL_KEY);
+        final List<BusinessSubscriptionTransition> transitions = businessSubscriptionTransitionSqlDao.getTransitionsByKey(EXTERNAL_KEY);
         Assert.assertEquals(transitions.size(), 1);
         Assert.assertEquals(transitions.get(0).getExternalKey(), transition.getExternalKey());
         Assert.assertEquals(transitions.get(0).getRequestedTimestamp(), transition.getRequestedTimestamp());
@@ -261,11 +261,11 @@ public class TestAnalyticsDao extends TestWithEmbeddedDB {
     public void testCreateAndRetrieveTransitions() {
         businessSubscriptionTransitionSqlDao.createTransition(transition);
 
-        final List<BusinessSubscriptionTransition> transitions = businessSubscriptionTransitionSqlDao.getTransitions(EXTERNAL_KEY);
+        final List<BusinessSubscriptionTransition> transitions = businessSubscriptionTransitionSqlDao.getTransitionsByKey(EXTERNAL_KEY);
         Assert.assertEquals(transitions.size(), 1);
         Assert.assertEquals(transitions.get(0), transition);
 
-        Assert.assertEquals(businessSubscriptionTransitionSqlDao.getTransitions("Doesn't exist").size(), 0);
+        Assert.assertEquals(businessSubscriptionTransitionSqlDao.getTransitionsByKey("Doesn't exist").size(), 0);
     }
 
     @Test(groups = "slow")
diff --git a/analytics/src/test/java/com/ning/billing/analytics/dao/TestBusinessAccountFieldSqlDao.java b/analytics/src/test/java/com/ning/billing/analytics/dao/TestBusinessAccountFieldSqlDao.java
index 2dae790..2c44668 100644
--- a/analytics/src/test/java/com/ning/billing/analytics/dao/TestBusinessAccountFieldSqlDao.java
+++ b/analytics/src/test/java/com/ning/billing/analytics/dao/TestBusinessAccountFieldSqlDao.java
@@ -44,12 +44,12 @@ public class TestBusinessAccountFieldSqlDao extends TestWithEmbeddedDB {
         final String value = UUID.randomUUID().toString();
 
         // Verify initial state
-        Assert.assertEquals(accountFieldSqlDao.getFieldsForAccount(accountKey).size(), 0);
+        Assert.assertEquals(accountFieldSqlDao.getFieldsForAccountByKey(accountKey).size(), 0);
         Assert.assertEquals(accountFieldSqlDao.removeField(accountId.toString(), name), 0);
 
         // Add an entry
         Assert.assertEquals(accountFieldSqlDao.addField(accountId.toString(), accountKey, name, value), 1);
-        final List<BusinessAccountField> fieldsForAccount = accountFieldSqlDao.getFieldsForAccount(accountKey);
+        final List<BusinessAccountField> fieldsForAccount = accountFieldSqlDao.getFieldsForAccountByKey(accountKey);
         Assert.assertEquals(fieldsForAccount.size(), 1);
 
         // Retrieve it
@@ -61,7 +61,7 @@ public class TestBusinessAccountFieldSqlDao extends TestWithEmbeddedDB {
 
         // Delete it
         Assert.assertEquals(accountFieldSqlDao.removeField(accountId.toString(), name), 1);
-        Assert.assertEquals(accountFieldSqlDao.getFieldsForAccount(accountKey).size(), 0);
+        Assert.assertEquals(accountFieldSqlDao.getFieldsForAccountByKey(accountKey).size(), 0);
     }
 
     @Test(groups = "slow")
@@ -77,14 +77,14 @@ public class TestBusinessAccountFieldSqlDao extends TestWithEmbeddedDB {
         Assert.assertEquals(accountFieldSqlDao.addField(accountId1.toString(), accountKey1, name1, UUID.randomUUID().toString()), 1);
         Assert.assertEquals(accountFieldSqlDao.addField(accountId2.toString(), accountKey2, name2, UUID.randomUUID().toString()), 1);
 
-        Assert.assertEquals(accountFieldSqlDao.getFieldsForAccount(accountKey1).size(), 1);
-        Assert.assertEquals(accountFieldSqlDao.getFieldsForAccount(accountKey2).size(), 1);
+        Assert.assertEquals(accountFieldSqlDao.getFieldsForAccountByKey(accountKey1).size(), 1);
+        Assert.assertEquals(accountFieldSqlDao.getFieldsForAccountByKey(accountKey2).size(), 1);
 
         // Remove the field for the first account
         Assert.assertEquals(accountFieldSqlDao.removeField(accountId1.toString(), name1), 1);
 
-        Assert.assertEquals(accountFieldSqlDao.getFieldsForAccount(accountKey1).size(), 0);
-        Assert.assertEquals(accountFieldSqlDao.getFieldsForAccount(accountKey2).size(), 1);
+        Assert.assertEquals(accountFieldSqlDao.getFieldsForAccountByKey(accountKey1).size(), 0);
+        Assert.assertEquals(accountFieldSqlDao.getFieldsForAccountByKey(accountKey2).size(), 1);
     }
 
     @Test(groups = "slow")
diff --git a/analytics/src/test/java/com/ning/billing/analytics/dao/TestBusinessAccountTagSqlDao.java b/analytics/src/test/java/com/ning/billing/analytics/dao/TestBusinessAccountTagSqlDao.java
index 8c05270..01e50a4 100644
--- a/analytics/src/test/java/com/ning/billing/analytics/dao/TestBusinessAccountTagSqlDao.java
+++ b/analytics/src/test/java/com/ning/billing/analytics/dao/TestBusinessAccountTagSqlDao.java
@@ -43,12 +43,12 @@ public class TestBusinessAccountTagSqlDao extends TestWithEmbeddedDB {
         final String name = UUID.randomUUID().toString().substring(0, 20);
 
         // Verify initial state
-        Assert.assertEquals(accountTagSqlDao.getTagsForAccount(accountKey).size(), 0);
+        Assert.assertEquals(accountTagSqlDao.getTagsForAccountByKey(accountKey).size(), 0);
         Assert.assertEquals(accountTagSqlDao.removeTag(accountId.toString(), name), 0);
 
         // Add an entry
         Assert.assertEquals(accountTagSqlDao.addTag(accountId.toString(), accountKey, name), 1);
-        final List<BusinessAccountTag> tagsForAccount = accountTagSqlDao.getTagsForAccount(accountKey);
+        final List<BusinessAccountTag> tagsForAccount = accountTagSqlDao.getTagsForAccountByKey(accountKey);
         Assert.assertEquals(tagsForAccount.size(), 1);
 
         // Retrieve it
@@ -59,7 +59,7 @@ public class TestBusinessAccountTagSqlDao extends TestWithEmbeddedDB {
 
         // Delete it
         Assert.assertEquals(accountTagSqlDao.removeTag(accountId.toString(), name), 1);
-        Assert.assertEquals(accountTagSqlDao.getTagsForAccount(accountKey).size(), 0);
+        Assert.assertEquals(accountTagSqlDao.getTagsForAccountByKey(accountKey).size(), 0);
     }
 
     @Test(groups = "slow")
@@ -75,14 +75,14 @@ public class TestBusinessAccountTagSqlDao extends TestWithEmbeddedDB {
         Assert.assertEquals(accountTagSqlDao.addTag(accountId1.toString(), accountKey1, name1), 1);
         Assert.assertEquals(accountTagSqlDao.addTag(accountId2.toString(), accountKey2, name2), 1);
 
-        Assert.assertEquals(accountTagSqlDao.getTagsForAccount(accountKey1).size(), 1);
-        Assert.assertEquals(accountTagSqlDao.getTagsForAccount(accountKey2).size(), 1);
+        Assert.assertEquals(accountTagSqlDao.getTagsForAccountByKey(accountKey1).size(), 1);
+        Assert.assertEquals(accountTagSqlDao.getTagsForAccountByKey(accountKey2).size(), 1);
 
         // Remove the tag for the first account
         Assert.assertEquals(accountTagSqlDao.removeTag(accountId1.toString(), name1), 1);
 
-        Assert.assertEquals(accountTagSqlDao.getTagsForAccount(accountKey1).size(), 0);
-        Assert.assertEquals(accountTagSqlDao.getTagsForAccount(accountKey2).size(), 1);
+        Assert.assertEquals(accountTagSqlDao.getTagsForAccountByKey(accountKey1).size(), 0);
+        Assert.assertEquals(accountTagSqlDao.getTagsForAccountByKey(accountKey2).size(), 1);
     }
 
     @Test(groups = "slow")
diff --git a/analytics/src/test/java/com/ning/billing/analytics/dao/TestBusinessInvoiceItemSqlDao.java b/analytics/src/test/java/com/ning/billing/analytics/dao/TestBusinessInvoiceItemSqlDao.java
index 1bd7b31..4d4a324 100644
--- a/analytics/src/test/java/com/ning/billing/analytics/dao/TestBusinessInvoiceItemSqlDao.java
+++ b/analytics/src/test/java/com/ning/billing/analytics/dao/TestBusinessInvoiceItemSqlDao.java
@@ -54,24 +54,15 @@ public class TestBusinessInvoiceItemSqlDao extends TestWithEmbeddedDB {
 
         // Retrieve it
         Assert.assertEquals(invoiceItemSqlDao.getInvoiceItem(invoiceItem.getItemId().toString()), invoiceItem);
-        Assert.assertEquals(invoiceItemSqlDao.getInvoiceItemsForBundle(invoiceItem.getExternalKey()).size(), 1);
-        Assert.assertEquals(invoiceItemSqlDao.getInvoiceItemsForBundle(invoiceItem.getExternalKey()).get(0), invoiceItem);
-        Assert.assertEquals(invoiceItemSqlDao.getInvoiceItemsForInvoice(invoiceItem.getInvoiceId().toString()).size(), 1);
-        Assert.assertEquals(invoiceItemSqlDao.getInvoiceItemsForInvoice(invoiceItem.getInvoiceId().toString()).get(0), invoiceItem);
-
-        // Update and retrieve it
-        invoiceItem.setProductName(UUID.randomUUID().toString().substring(0, 20));
-        Assert.assertEquals(invoiceItemSqlDao.updateInvoiceItem(invoiceItem), 1);
-        Assert.assertEquals(invoiceItemSqlDao.getInvoiceItem(invoiceItem.getItemId().toString()), invoiceItem);
-        Assert.assertEquals(invoiceItemSqlDao.getInvoiceItemsForBundle(invoiceItem.getExternalKey()).size(), 1);
-        Assert.assertEquals(invoiceItemSqlDao.getInvoiceItemsForBundle(invoiceItem.getExternalKey()).get(0), invoiceItem);
+        Assert.assertEquals(invoiceItemSqlDao.getInvoiceItemsForBundleByKey(invoiceItem.getExternalKey()).size(), 1);
+        Assert.assertEquals(invoiceItemSqlDao.getInvoiceItemsForBundleByKey(invoiceItem.getExternalKey()).get(0), invoiceItem);
         Assert.assertEquals(invoiceItemSqlDao.getInvoiceItemsForInvoice(invoiceItem.getInvoiceId().toString()).size(), 1);
         Assert.assertEquals(invoiceItemSqlDao.getInvoiceItemsForInvoice(invoiceItem.getInvoiceId().toString()).get(0), invoiceItem);
 
         // Delete it
         Assert.assertEquals(invoiceItemSqlDao.deleteInvoiceItem(invoiceItem.getItemId().toString()), 1);
         Assert.assertNull(invoiceItemSqlDao.getInvoiceItem(invoiceItem.getItemId().toString()));
-        Assert.assertEquals(invoiceItemSqlDao.getInvoiceItemsForBundle(invoiceItem.getExternalKey()).size(), 0);
+        Assert.assertEquals(invoiceItemSqlDao.getInvoiceItemsForBundleByKey(invoiceItem.getExternalKey()).size(), 0);
         Assert.assertEquals(invoiceItemSqlDao.getInvoiceItemsForInvoice(invoiceItem.getInvoiceId().toString()).size(), 0);
     }
 
@@ -88,16 +79,16 @@ public class TestBusinessInvoiceItemSqlDao extends TestWithEmbeddedDB {
         Assert.assertEquals(invoiceItemSqlDao.createInvoiceItem(invoiceItem1), 1);
         Assert.assertEquals(invoiceItemSqlDao.createInvoiceItem(invoiceItem2), 1);
 
-        Assert.assertEquals(invoiceItemSqlDao.getInvoiceItemsForBundle(externalKey1).size(), 1);
-        Assert.assertEquals(invoiceItemSqlDao.getInvoiceItemsForBundle(externalKey2).size(), 1);
+        Assert.assertEquals(invoiceItemSqlDao.getInvoiceItemsForBundleByKey(externalKey1).size(), 1);
+        Assert.assertEquals(invoiceItemSqlDao.getInvoiceItemsForBundleByKey(externalKey2).size(), 1);
         Assert.assertEquals(invoiceItemSqlDao.getInvoiceItemsForInvoice(invoiceId1.toString()).size(), 1);
         Assert.assertEquals(invoiceItemSqlDao.getInvoiceItemsForInvoice(invoiceId2.toString()).size(), 1);
 
         // Remove the first invoice item
         Assert.assertEquals(invoiceItemSqlDao.deleteInvoiceItem(invoiceItem1.getItemId().toString()), 1);
 
-        Assert.assertEquals(invoiceItemSqlDao.getInvoiceItemsForBundle(externalKey1).size(), 0);
-        Assert.assertEquals(invoiceItemSqlDao.getInvoiceItemsForBundle(externalKey2).size(), 1);
+        Assert.assertEquals(invoiceItemSqlDao.getInvoiceItemsForBundleByKey(externalKey1).size(), 0);
+        Assert.assertEquals(invoiceItemSqlDao.getInvoiceItemsForBundleByKey(externalKey2).size(), 1);
         Assert.assertEquals(invoiceItemSqlDao.getInvoiceItemsForInvoice(invoiceId1.toString()).size(), 0);
         Assert.assertEquals(invoiceItemSqlDao.getInvoiceItemsForInvoice(invoiceId2.toString()).size(), 1);
     }
diff --git a/analytics/src/test/java/com/ning/billing/analytics/dao/TestBusinessInvoicePaymentSqlDao.java b/analytics/src/test/java/com/ning/billing/analytics/dao/TestBusinessInvoicePaymentSqlDao.java
index 94a8066..9ec7696 100644
--- a/analytics/src/test/java/com/ning/billing/analytics/dao/TestBusinessInvoicePaymentSqlDao.java
+++ b/analytics/src/test/java/com/ning/billing/analytics/dao/TestBusinessInvoicePaymentSqlDao.java
@@ -41,69 +41,53 @@ public class TestBusinessInvoicePaymentSqlDao extends TestWithEmbeddedDB {
 
     @Test(groups = "slow")
     public void testCRUD() throws Exception {
-        final UUID attemptId = UUID.randomUUID();
+        final String extPaymentRefId = UUID.randomUUID().toString();
         final String accountKey = UUID.randomUUID().toString();
-        final BusinessInvoicePayment invoicePayment = createInvoicePayment(attemptId, accountKey);
+        final BusinessInvoicePayment invoicePayment = createInvoicePayment(extPaymentRefId, accountKey);
 
         // Verify initial state
-        Assert.assertNull(invoicePaymentSqlDao.getInvoicePaymentForPaymentAttempt(invoicePayment.getAttemptId().toString()));
-        Assert.assertEquals(invoicePaymentSqlDao.deleteInvoicePaymentForPaymentAttempt(invoicePayment.getAttemptId().toString()), 0);
+        Assert.assertNull(invoicePaymentSqlDao.getInvoicePayment(invoicePayment.getPaymentId().toString()));
+        Assert.assertEquals(invoicePaymentSqlDao.getInvoicePaymentsForAccountByKey(invoicePayment.getAccountKey()).size(), 0);
 
         // Add the invoice payment
         Assert.assertEquals(invoicePaymentSqlDao.createInvoicePayment(invoicePayment), 1);
 
         // Retrieve it
-        Assert.assertEquals(invoicePaymentSqlDao.getInvoicePaymentForPaymentAttempt(invoicePayment.getAttemptId().toString()), invoicePayment);
-        Assert.assertEquals(invoicePaymentSqlDao.getInvoicePaymentsForAccount(invoicePayment.getAccountKey()).size(), 1);
-        Assert.assertEquals(invoicePaymentSqlDao.getInvoicePaymentsForAccount(invoicePayment.getAccountKey()).get(0), invoicePayment);
-        Assert.assertEquals(invoicePaymentSqlDao.getInvoicePaymentsForPayment(invoicePayment.getPaymentId().toString()).size(), 1);
-        Assert.assertEquals(invoicePaymentSqlDao.getInvoicePaymentsForPayment(invoicePayment.getPaymentId().toString()).get(0), invoicePayment);
-
-        // Update and retrieve it
-        invoicePayment.setCardType(UUID.randomUUID().toString().substring(0, 20));
-        Assert.assertEquals(invoicePaymentSqlDao.updateInvoicePaymentForPaymentAttempt(invoicePayment), 1);
-        Assert.assertEquals(invoicePaymentSqlDao.getInvoicePaymentForPaymentAttempt(invoicePayment.getAttemptId().toString()), invoicePayment);
-        Assert.assertEquals(invoicePaymentSqlDao.getInvoicePaymentsForAccount(invoicePayment.getAccountKey()).size(), 1);
-        Assert.assertEquals(invoicePaymentSqlDao.getInvoicePaymentsForAccount(invoicePayment.getAccountKey()).get(0), invoicePayment);
-        Assert.assertEquals(invoicePaymentSqlDao.getInvoicePaymentsForPayment(invoicePayment.getPaymentId().toString()).size(), 1);
-        Assert.assertEquals(invoicePaymentSqlDao.getInvoicePaymentsForPayment(invoicePayment.getPaymentId().toString()).get(0), invoicePayment);
+        Assert.assertEquals(invoicePaymentSqlDao.getInvoicePayment(invoicePayment.getPaymentId().toString()), invoicePayment);
+        Assert.assertEquals(invoicePaymentSqlDao.getInvoicePaymentsForAccountByKey(invoicePayment.getAccountKey()).size(), 1);
+        Assert.assertEquals(invoicePaymentSqlDao.getInvoicePaymentsForAccountByKey(invoicePayment.getAccountKey()).get(0), invoicePayment);
 
         // Delete it
-        Assert.assertEquals(invoicePaymentSqlDao.deleteInvoicePaymentForPaymentAttempt(invoicePayment.getAttemptId().toString()), 1);
-        Assert.assertNull(invoicePaymentSqlDao.getInvoicePaymentForPaymentAttempt(invoicePayment.getAttemptId().toString()));
-        Assert.assertEquals(invoicePaymentSqlDao.getInvoicePaymentsForAccount(invoicePayment.getAccountKey()).size(), 0);
-        Assert.assertEquals(invoicePaymentSqlDao.getInvoicePaymentsForPayment(invoicePayment.getPaymentId().toString()).size(), 0);
+        Assert.assertEquals(invoicePaymentSqlDao.deleteInvoicePayment(invoicePayment.getPaymentId().toString()), 1);
+        Assert.assertNull(invoicePaymentSqlDao.getInvoicePayment(invoicePayment.getPaymentId().toString()));
+        Assert.assertEquals(invoicePaymentSqlDao.getInvoicePaymentsForAccountByKey(invoicePayment.getAccountKey()).size(), 0);
     }
 
     @Test(groups = "slow")
     public void testSegmentation() throws Exception {
-        final UUID attemptId1 = UUID.randomUUID();
+        final String extPaymentRefId1 = UUID.randomUUID().toString();
         final String accountKey1 = UUID.randomUUID().toString();
-        final BusinessInvoicePayment invoicePayment1 = createInvoicePayment(attemptId1, accountKey1);
-        final UUID attemptId2 = UUID.randomUUID();
+        final BusinessInvoicePayment invoicePayment1 = createInvoicePayment(extPaymentRefId1, accountKey1);
+        final String extPaymentRefId2 = UUID.randomUUID().toString();
         final String accountKey2 = UUID.randomUUID().toString();
-        final BusinessInvoicePayment invoicePayment2 = createInvoicePayment(attemptId2, accountKey2);
+        final BusinessInvoicePayment invoicePayment2 = createInvoicePayment(extPaymentRefId2, accountKey2);
 
         // Create both invoice payments
         Assert.assertEquals(invoicePaymentSqlDao.createInvoicePayment(invoicePayment1), 1);
         Assert.assertEquals(invoicePaymentSqlDao.createInvoicePayment(invoicePayment2), 1);
 
-        Assert.assertEquals(invoicePaymentSqlDao.getInvoicePaymentForPaymentAttempt(invoicePayment1.getAttemptId().toString()), invoicePayment1);
-        Assert.assertEquals(invoicePaymentSqlDao.getInvoicePaymentForPaymentAttempt(invoicePayment2.getAttemptId().toString()), invoicePayment2);
-        Assert.assertEquals(invoicePaymentSqlDao.getInvoicePaymentsForAccount(invoicePayment1.getAccountKey()).size(), 1);
-        Assert.assertEquals(invoicePaymentSqlDao.getInvoicePaymentsForAccount(invoicePayment2.getAccountKey()).size(), 1);
-        Assert.assertEquals(invoicePaymentSqlDao.getInvoicePaymentsForPayment(invoicePayment1.getPaymentId().toString()).size(), 1);
-        Assert.assertEquals(invoicePaymentSqlDao.getInvoicePaymentsForPayment(invoicePayment2.getPaymentId().toString()).size(), 1);
+        Assert.assertEquals(invoicePaymentSqlDao.getInvoicePayment(invoicePayment1.getPaymentId().toString()), invoicePayment1);
+        Assert.assertEquals(invoicePaymentSqlDao.getInvoicePayment(invoicePayment2.getPaymentId().toString()), invoicePayment2);
+        Assert.assertEquals(invoicePaymentSqlDao.getInvoicePaymentsForAccountByKey(invoicePayment1.getAccountKey()).size(), 1);
+        Assert.assertEquals(invoicePaymentSqlDao.getInvoicePaymentsForAccountByKey(invoicePayment2.getAccountKey()).size(), 1);
 
         // Remove the first invoice payment
-        Assert.assertEquals(invoicePaymentSqlDao.deleteInvoicePaymentForPaymentAttempt(invoicePayment1.getAttemptId().toString()), 1);
-
-        Assert.assertNull(invoicePaymentSqlDao.getInvoicePaymentForPaymentAttempt(invoicePayment1.getAttemptId().toString()));
-        Assert.assertEquals(invoicePaymentSqlDao.getInvoicePaymentForPaymentAttempt(invoicePayment2.getAttemptId().toString()), invoicePayment2);
-        Assert.assertEquals(invoicePaymentSqlDao.getInvoicePaymentsForAccount(invoicePayment1.getAccountKey()).size(), 0);
-        Assert.assertEquals(invoicePaymentSqlDao.getInvoicePaymentsForAccount(invoicePayment2.getAccountKey()).size(), 1);
-        Assert.assertEquals(invoicePaymentSqlDao.getInvoicePaymentsForPayment(invoicePayment1.getPaymentId().toString()).size(), 0);
-        Assert.assertEquals(invoicePaymentSqlDao.getInvoicePaymentsForPayment(invoicePayment2.getPaymentId().toString()).size(), 1);
+        Assert.assertEquals(invoicePaymentSqlDao.deleteInvoicePayment(invoicePayment1.getPaymentId().toString()), 1);
+
+        Assert.assertNull(invoicePaymentSqlDao.getInvoicePayment(invoicePayment1.getPaymentId().toString()));
+        Assert.assertEquals(invoicePaymentSqlDao.getInvoicePayment(invoicePayment2.getPaymentId().toString()), invoicePayment2);
+        Assert.assertEquals(invoicePaymentSqlDao.getInvoicePaymentsForAccountByKey(invoicePayment1.getAccountKey()).size(), 0);
+        Assert.assertEquals(invoicePaymentSqlDao.getInvoicePaymentsForAccountByKey(invoicePayment2.getAccountKey()).size(), 1);
     }
 
     @Test(groups = "slow")
@@ -116,7 +100,7 @@ public class TestBusinessInvoicePaymentSqlDao extends TestWithEmbeddedDB {
         }
     }
 
-    private BusinessInvoicePayment createInvoicePayment(final UUID attemptId, final String accountKey) {
+    private BusinessInvoicePayment createInvoicePayment(final String extPaymentRefId, final String accountKey) {
         final BigDecimal amount = BigDecimal.ONE;
         final String cardCountry = UUID.randomUUID().toString().substring(0, 20);
         final String cardType = UUID.randomUUID().toString().substring(0, 20);
@@ -132,12 +116,15 @@ public class TestBusinessInvoicePaymentSqlDao extends TestWithEmbeddedDB {
         final String processingStatus = UUID.randomUUID().toString();
         final BigDecimal requestedAmount = BigDecimal.ZERO;
         final DateTime updatedDate = new DateTime(DateTimeZone.UTC);
+        final String invoicePaymentType = UUID.randomUUID().toString().substring(0, 10);
+        final UUID linkedInvoicePaymentId = UUID.randomUUID();
 
-        return new BusinessInvoicePayment(accountKey, amount, attemptId,
+        return new BusinessInvoicePayment(accountKey, amount, extPaymentRefId,
                                           cardCountry, cardType, createdDate,
                                           currency, effectiveDate, invoiceId,
                                           paymentError, paymentId, paymentMethod,
                                           paymentType, pluginName, processingStatus,
-                                          requestedAmount, updatedDate);
+                                          requestedAmount, updatedDate, invoicePaymentType,
+                                          linkedInvoicePaymentId);
     }
 }
diff --git a/analytics/src/test/java/com/ning/billing/analytics/dao/TestBusinessOverdueStatusSqlDao.java b/analytics/src/test/java/com/ning/billing/analytics/dao/TestBusinessOverdueStatusSqlDao.java
index 7153da2..ead1a4b 100644
--- a/analytics/src/test/java/com/ning/billing/analytics/dao/TestBusinessOverdueStatusSqlDao.java
+++ b/analytics/src/test/java/com/ning/billing/analytics/dao/TestBusinessOverdueStatusSqlDao.java
@@ -45,23 +45,23 @@ public class TestBusinessOverdueStatusSqlDao extends TestWithEmbeddedDB {
         final BusinessOverdueStatus firstOverdueStatus = createOverdueStatus(accountKey, bundleId, externalKey);
 
         // Verify initial state
-        Assert.assertEquals(overdueStatusSqlDao.getOverdueStatusesForBundle(externalKey).size(), 0);
+        Assert.assertEquals(overdueStatusSqlDao.getOverdueStatusesForBundleByKey(externalKey).size(), 0);
 
         // Add the overdue status
         Assert.assertEquals(overdueStatusSqlDao.createOverdueStatus(firstOverdueStatus), 1);
 
         // Retrieve it
-        Assert.assertEquals(overdueStatusSqlDao.getOverdueStatusesForBundle(externalKey).size(), 1);
-        Assert.assertEquals(overdueStatusSqlDao.getOverdueStatusesForBundle(externalKey).get(0), firstOverdueStatus);
+        Assert.assertEquals(overdueStatusSqlDao.getOverdueStatusesForBundleByKey(externalKey).size(), 1);
+        Assert.assertEquals(overdueStatusSqlDao.getOverdueStatusesForBundleByKey(externalKey).get(0), firstOverdueStatus);
 
         // Add a second one
         final BusinessOverdueStatus secondOverdueStatus = createOverdueStatus(accountKey, bundleId, externalKey);
         Assert.assertEquals(overdueStatusSqlDao.createOverdueStatus(secondOverdueStatus), 1);
 
         // Retrieve both
-        Assert.assertEquals(overdueStatusSqlDao.getOverdueStatusesForBundle(externalKey).size(), 2);
-        Assert.assertEquals(overdueStatusSqlDao.getOverdueStatusesForBundle(externalKey).get(0), firstOverdueStatus);
-        Assert.assertEquals(overdueStatusSqlDao.getOverdueStatusesForBundle(externalKey).get(1), secondOverdueStatus);
+        Assert.assertEquals(overdueStatusSqlDao.getOverdueStatusesForBundleByKey(externalKey).size(), 2);
+        Assert.assertEquals(overdueStatusSqlDao.getOverdueStatusesForBundleByKey(externalKey).get(0), firstOverdueStatus);
+        Assert.assertEquals(overdueStatusSqlDao.getOverdueStatusesForBundleByKey(externalKey).get(1), secondOverdueStatus);
     }
 
     @Test(groups = "slow")
diff --git a/analytics/src/test/java/com/ning/billing/analytics/dao/TestBusinessSubscriptionTransitionFieldSqlDao.java b/analytics/src/test/java/com/ning/billing/analytics/dao/TestBusinessSubscriptionTransitionFieldSqlDao.java
index 9880ebc..528dc65 100644
--- a/analytics/src/test/java/com/ning/billing/analytics/dao/TestBusinessSubscriptionTransitionFieldSqlDao.java
+++ b/analytics/src/test/java/com/ning/billing/analytics/dao/TestBusinessSubscriptionTransitionFieldSqlDao.java
@@ -45,12 +45,12 @@ public class TestBusinessSubscriptionTransitionFieldSqlDao extends TestWithEmbed
         final String value = UUID.randomUUID().toString();
 
         // Verify initial state
-        Assert.assertEquals(subscriptionTransitionFieldSqlDao.getFieldsForBusinessSubscriptionTransition(externalKey).size(), 0);
+        Assert.assertEquals(subscriptionTransitionFieldSqlDao.getFieldsForBusinessSubscriptionTransitionByKey(externalKey).size(), 0);
         Assert.assertEquals(subscriptionTransitionFieldSqlDao.removeField(bundleId.toString(), name), 0);
 
         // Add an entry
         Assert.assertEquals(subscriptionTransitionFieldSqlDao.addField(accountKey, bundleId.toString(), externalKey, name, value), 1);
-        final List<BusinessSubscriptionTransitionField> fieldsForBusinessSubscriptionTransition = subscriptionTransitionFieldSqlDao.getFieldsForBusinessSubscriptionTransition(externalKey);
+        final List<BusinessSubscriptionTransitionField> fieldsForBusinessSubscriptionTransition = subscriptionTransitionFieldSqlDao.getFieldsForBusinessSubscriptionTransitionByKey(externalKey);
         Assert.assertEquals(fieldsForBusinessSubscriptionTransition.size(), 1);
 
         // Retrieve it
@@ -62,7 +62,7 @@ public class TestBusinessSubscriptionTransitionFieldSqlDao extends TestWithEmbed
 
         // Delete it
         Assert.assertEquals(subscriptionTransitionFieldSqlDao.removeField(bundleId.toString(), name), 1);
-        Assert.assertEquals(subscriptionTransitionFieldSqlDao.getFieldsForBusinessSubscriptionTransition(externalKey).size(), 0);
+        Assert.assertEquals(subscriptionTransitionFieldSqlDao.getFieldsForBusinessSubscriptionTransitionByKey(externalKey).size(), 0);
     }
 
     @Test(groups = "slow")
@@ -79,14 +79,14 @@ public class TestBusinessSubscriptionTransitionFieldSqlDao extends TestWithEmbed
         Assert.assertEquals(subscriptionTransitionFieldSqlDao.addField(accountKey, bundleId1.toString(), externalKey1, name1, UUID.randomUUID().toString()), 1);
         Assert.assertEquals(subscriptionTransitionFieldSqlDao.addField(accountKey, bundleId2.toString(), externalKey2, name2, UUID.randomUUID().toString()), 1);
 
-        Assert.assertEquals(subscriptionTransitionFieldSqlDao.getFieldsForBusinessSubscriptionTransition(externalKey1).size(), 1);
-        Assert.assertEquals(subscriptionTransitionFieldSqlDao.getFieldsForBusinessSubscriptionTransition(externalKey2).size(), 1);
+        Assert.assertEquals(subscriptionTransitionFieldSqlDao.getFieldsForBusinessSubscriptionTransitionByKey(externalKey1).size(), 1);
+        Assert.assertEquals(subscriptionTransitionFieldSqlDao.getFieldsForBusinessSubscriptionTransitionByKey(externalKey2).size(), 1);
 
         // Remove the field for the first transition
         Assert.assertEquals(subscriptionTransitionFieldSqlDao.removeField(bundleId1.toString(), name1), 1);
 
-        Assert.assertEquals(subscriptionTransitionFieldSqlDao.getFieldsForBusinessSubscriptionTransition(externalKey1).size(), 0);
-        Assert.assertEquals(subscriptionTransitionFieldSqlDao.getFieldsForBusinessSubscriptionTransition(externalKey2).size(), 1);
+        Assert.assertEquals(subscriptionTransitionFieldSqlDao.getFieldsForBusinessSubscriptionTransitionByKey(externalKey1).size(), 0);
+        Assert.assertEquals(subscriptionTransitionFieldSqlDao.getFieldsForBusinessSubscriptionTransitionByKey(externalKey2).size(), 1);
     }
 
     @Test(groups = "slow")
diff --git a/analytics/src/test/java/com/ning/billing/analytics/dao/TestBusinessSubscriptionTransitionTagSqlDao.java b/analytics/src/test/java/com/ning/billing/analytics/dao/TestBusinessSubscriptionTransitionTagSqlDao.java
index bce20fb..4ab67ad 100644
--- a/analytics/src/test/java/com/ning/billing/analytics/dao/TestBusinessSubscriptionTransitionTagSqlDao.java
+++ b/analytics/src/test/java/com/ning/billing/analytics/dao/TestBusinessSubscriptionTransitionTagSqlDao.java
@@ -44,12 +44,12 @@ public class TestBusinessSubscriptionTransitionTagSqlDao extends TestWithEmbedde
         final String name = UUID.randomUUID().toString().substring(0, 20);
 
         // Verify initial state
-        Assert.assertEquals(subscriptionTransitionTagSqlDao.getTagsForBusinessSubscriptionTransition(externalKey).size(), 0);
+        Assert.assertEquals(subscriptionTransitionTagSqlDao.getTagsForBusinessSubscriptionTransitionByKey(externalKey).size(), 0);
         Assert.assertEquals(subscriptionTransitionTagSqlDao.removeTag(bundleId.toString(), name), 0);
 
         // Add an entry
         Assert.assertEquals(subscriptionTransitionTagSqlDao.addTag(accountKey, bundleId.toString(), externalKey, name), 1);
-        final List<BusinessSubscriptionTransitionTag> tagsForBusinessSubscriptionTransition = subscriptionTransitionTagSqlDao.getTagsForBusinessSubscriptionTransition(externalKey);
+        final List<BusinessSubscriptionTransitionTag> tagsForBusinessSubscriptionTransition = subscriptionTransitionTagSqlDao.getTagsForBusinessSubscriptionTransitionByKey(externalKey);
         Assert.assertEquals(tagsForBusinessSubscriptionTransition.size(), 1);
 
         // Retrieve it
@@ -60,7 +60,7 @@ public class TestBusinessSubscriptionTransitionTagSqlDao extends TestWithEmbedde
 
         // Delete it
         Assert.assertEquals(subscriptionTransitionTagSqlDao.removeTag(bundleId.toString(), name), 1);
-        Assert.assertEquals(subscriptionTransitionTagSqlDao.getTagsForBusinessSubscriptionTransition(externalKey).size(), 0);
+        Assert.assertEquals(subscriptionTransitionTagSqlDao.getTagsForBusinessSubscriptionTransitionByKey(externalKey).size(), 0);
     }
 
     @Test(groups = "slow")
@@ -77,14 +77,14 @@ public class TestBusinessSubscriptionTransitionTagSqlDao extends TestWithEmbedde
         Assert.assertEquals(subscriptionTransitionTagSqlDao.addTag(accountKey, bundleId1.toString(), externalKey1, name1), 1);
         Assert.assertEquals(subscriptionTransitionTagSqlDao.addTag(accountKey, bundleId2.toString(), externalKey2, name2), 1);
 
-        Assert.assertEquals(subscriptionTransitionTagSqlDao.getTagsForBusinessSubscriptionTransition(externalKey1).size(), 1);
-        Assert.assertEquals(subscriptionTransitionTagSqlDao.getTagsForBusinessSubscriptionTransition(externalKey2).size(), 1);
+        Assert.assertEquals(subscriptionTransitionTagSqlDao.getTagsForBusinessSubscriptionTransitionByKey(externalKey1).size(), 1);
+        Assert.assertEquals(subscriptionTransitionTagSqlDao.getTagsForBusinessSubscriptionTransitionByKey(externalKey2).size(), 1);
 
         // Remove the tag for the first transition
         Assert.assertEquals(subscriptionTransitionTagSqlDao.removeTag(bundleId1.toString(), name1), 1);
 
-        Assert.assertEquals(subscriptionTransitionTagSqlDao.getTagsForBusinessSubscriptionTransition(externalKey1).size(), 0);
-        Assert.assertEquals(subscriptionTransitionTagSqlDao.getTagsForBusinessSubscriptionTransition(externalKey2).size(), 1);
+        Assert.assertEquals(subscriptionTransitionTagSqlDao.getTagsForBusinessSubscriptionTransitionByKey(externalKey1).size(), 0);
+        Assert.assertEquals(subscriptionTransitionTagSqlDao.getTagsForBusinessSubscriptionTransitionByKey(externalKey2).size(), 1);
     }
 
     @Test(groups = "slow")
diff --git a/analytics/src/test/java/com/ning/billing/analytics/MockBusinessSubscriptionTransitionSqlDao.java b/analytics/src/test/java/com/ning/billing/analytics/MockBusinessSubscriptionTransitionSqlDao.java
index d9691f4..2269957 100644
--- a/analytics/src/test/java/com/ning/billing/analytics/MockBusinessSubscriptionTransitionSqlDao.java
+++ b/analytics/src/test/java/com/ning/billing/analytics/MockBusinessSubscriptionTransitionSqlDao.java
@@ -35,7 +35,7 @@ public class MockBusinessSubscriptionTransitionSqlDao implements BusinessSubscri
     private final Map<String, String> keyForBundleId = new HashMap<String, String>();
 
     @Override
-    public List<BusinessSubscriptionTransition> getTransitions(@Bind("event_key") final String key) {
+    public List<BusinessSubscriptionTransition> getTransitionsByKey(@Bind("event_key") final String key) {
         return content.get(key);
     }
 
diff --git a/analytics/src/test/java/com/ning/billing/analytics/model/TestBusinessInvoiceItem.java b/analytics/src/test/java/com/ning/billing/analytics/model/TestBusinessInvoiceItem.java
index e4460f6..50fac73 100644
--- a/analytics/src/test/java/com/ning/billing/analytics/model/TestBusinessInvoiceItem.java
+++ b/analytics/src/test/java/com/ning/billing/analytics/model/TestBusinessInvoiceItem.java
@@ -73,22 +73,5 @@ public class TestBusinessInvoiceItem extends AnalyticsTestSuite {
         final BusinessInvoiceItem otherInvoiceItem = new BusinessInvoiceItem(null, null, createdDate, null, null, null, null, itemId,
                                                                              null, null, null, null, null, null, null, null);
         Assert.assertFalse(invoiceItem.equals(otherInvoiceItem));
-
-        // Test setters
-        otherInvoiceItem.setAmount(amount);
-        otherInvoiceItem.setBillingPeriod(billingPeriod);
-        otherInvoiceItem.setCurrency(currency);
-        otherInvoiceItem.setEndDate(endDate);
-        otherInvoiceItem.setExternalKey(externalKey);
-        otherInvoiceItem.setInvoiceId(invoiceId);
-        otherInvoiceItem.setItemType(itemType);
-        otherInvoiceItem.setPhase(phase);
-        otherInvoiceItem.setProductCategory(productCategory);
-        otherInvoiceItem.setProductName(productName);
-        otherInvoiceItem.setProductType(productType);
-        otherInvoiceItem.setSlug(slug);
-        otherInvoiceItem.setStartDate(startDate);
-        otherInvoiceItem.setUpdatedDate(updatedDate);
-        Assert.assertTrue(invoiceItem.equals(otherInvoiceItem));
     }
 }
diff --git a/analytics/src/test/java/com/ning/billing/analytics/model/TestBusinessInvoicePayment.java b/analytics/src/test/java/com/ning/billing/analytics/model/TestBusinessInvoicePayment.java
index 709db0f..ce31865 100644
--- a/analytics/src/test/java/com/ning/billing/analytics/model/TestBusinessInvoicePayment.java
+++ b/analytics/src/test/java/com/ning/billing/analytics/model/TestBusinessInvoicePayment.java
@@ -32,7 +32,7 @@ public class TestBusinessInvoicePayment extends AnalyticsTestSuite {
     public void testEquals() throws Exception {
         final String accountKey = UUID.randomUUID().toString();
         final BigDecimal amount = BigDecimal.ONE;
-        final UUID attemptId = UUID.randomUUID();
+        final String extPaymentRefId = UUID.randomUUID().toString();
         final String cardCountry = UUID.randomUUID().toString();
         final String cardType = UUID.randomUUID().toString();
         final DateTime createdDate = new DateTime(DateTimeZone.UTC);
@@ -47,18 +47,21 @@ public class TestBusinessInvoicePayment extends AnalyticsTestSuite {
         final String processingStatus = UUID.randomUUID().toString();
         final BigDecimal requestedAmount = BigDecimal.ZERO;
         final DateTime updatedDate = new DateTime(DateTimeZone.UTC);
-        final BusinessInvoicePayment invoicePayment = new BusinessInvoicePayment(accountKey, amount, attemptId,
+        final String invoicePaymentType = UUID.randomUUID().toString();
+        final UUID linkedInvoicePaymentId = UUID.randomUUID();
+        final BusinessInvoicePayment invoicePayment = new BusinessInvoicePayment(accountKey, amount, extPaymentRefId,
                                                                                  cardCountry, cardType, createdDate,
                                                                                  currency, effectiveDate, invoiceId,
                                                                                  paymentError, paymentId, paymentMethod,
                                                                                  paymentType, pluginName, processingStatus,
-                                                                                 requestedAmount, updatedDate);
+                                                                                 requestedAmount, updatedDate, invoicePaymentType,
+                                                                                 linkedInvoicePaymentId);
         Assert.assertSame(invoicePayment, invoicePayment);
         Assert.assertEquals(invoicePayment, invoicePayment);
         Assert.assertTrue(invoicePayment.equals(invoicePayment));
         Assert.assertEquals(invoicePayment.getAccountKey(), accountKey);
         Assert.assertEquals(invoicePayment.getAmount(), amount);
-        Assert.assertEquals(invoicePayment.getAttemptId(), attemptId);
+        Assert.assertEquals(invoicePayment.getExtPaymentRefId(), extPaymentRefId);
         Assert.assertEquals(invoicePayment.getCardCountry(), cardCountry);
         Assert.assertEquals(invoicePayment.getCardType(), cardType);
         Assert.assertEquals(invoicePayment.getCreatedDate(), createdDate);
@@ -73,27 +76,12 @@ public class TestBusinessInvoicePayment extends AnalyticsTestSuite {
         Assert.assertEquals(invoicePayment.getProcessingStatus(), processingStatus);
         Assert.assertEquals(invoicePayment.getRequestedAmount(), requestedAmount);
         Assert.assertEquals(invoicePayment.getUpdatedDate(), updatedDate);
+        Assert.assertEquals(invoicePayment.getInvoicePaymentType(), invoicePaymentType);
+        Assert.assertEquals(invoicePayment.getLinkedInvoicePaymentId(), linkedInvoicePaymentId);
 
-        final BusinessInvoicePayment otherInvoicePayment = new BusinessInvoicePayment(null, null, attemptId, null, null, createdDate,
+        final BusinessInvoicePayment otherInvoicePayment = new BusinessInvoicePayment(null, null, extPaymentRefId, null, null, createdDate,
                                                                                       null, null, null, null, paymentId, null,
-                                                                                      null, null, null, null, null);
+                                                                                      null, null, null, null, null, null, null);
         Assert.assertFalse(invoicePayment.equals(otherInvoicePayment));
-
-        // Test setters
-        otherInvoicePayment.setAccountKey(accountKey);
-        otherInvoicePayment.setAmount(amount);
-        otherInvoicePayment.setCardCountry(cardCountry);
-        otherInvoicePayment.setCardType(cardType);
-        otherInvoicePayment.setCurrency(currency);
-        otherInvoicePayment.setEffectiveDate(effectiveDate);
-        otherInvoicePayment.setInvoiceId(invoiceId);
-        otherInvoicePayment.setPaymentError(paymentError);
-        otherInvoicePayment.setPaymentMethod(paymentMethod);
-        otherInvoicePayment.setPaymentType(paymentType);
-        otherInvoicePayment.setPluginName(pluginName);
-        otherInvoicePayment.setProcessingStatus(processingStatus);
-        otherInvoicePayment.setRequestedAmount(requestedAmount);
-        otherInvoicePayment.setUpdatedDate(updatedDate);
-        Assert.assertTrue(invoicePayment.equals(otherInvoicePayment));
     }
 }
diff --git a/analytics/src/test/java/com/ning/billing/analytics/TestBusinessSubscriptionTransitionRecorder.java b/analytics/src/test/java/com/ning/billing/analytics/TestBusinessSubscriptionTransitionRecorder.java
index abc7559..44ccbce 100644
--- a/analytics/src/test/java/com/ning/billing/analytics/TestBusinessSubscriptionTransitionRecorder.java
+++ b/analytics/src/test/java/com/ning/billing/analytics/TestBusinessSubscriptionTransitionRecorder.java
@@ -85,8 +85,8 @@ public class TestBusinessSubscriptionTransitionRecorder extends AnalyticsTestSui
         final BusinessSubscriptionTransitionRecorder recorder = new BusinessSubscriptionTransitionRecorder(sqlDao, catalogService, entitlementApi, accountApi, new DefaultClock());
         recorder.rebuildTransitionsForBundle(bundle.getId());
 
-        Assert.assertEquals(sqlDao.getTransitions(externalKey.toString()).size(), 1);
-        final BusinessSubscriptionTransition transition = sqlDao.getTransitions(externalKey.toString()).get(0);
+        Assert.assertEquals(sqlDao.getTransitionsByKey(externalKey.toString()).size(), 1);
+        final BusinessSubscriptionTransition transition = sqlDao.getTransitionsByKey(externalKey.toString()).get(0);
         Assert.assertEquals(transition.getTotalOrdering(), (long) eventEffective.getTotalOrdering());
         Assert.assertEquals(transition.getAccountKey(), externalKey.toString());
         // Make sure all the prev_ columns are null
diff --git a/analytics/src/test/java/com/ning/billing/analytics/TestBusinessTagRecorder.java b/analytics/src/test/java/com/ning/billing/analytics/TestBusinessTagRecorder.java
index 79e762f..e2d9242 100644
--- a/analytics/src/test/java/com/ning/billing/analytics/TestBusinessTagRecorder.java
+++ b/analytics/src/test/java/com/ning/billing/analytics/TestBusinessTagRecorder.java
@@ -115,11 +115,11 @@ public class TestBusinessTagRecorder extends TestWithEmbeddedDB {
         final Account account = accountUserApi.createAccount(accountData, callContext);
         final UUID accountId = account.getId();
 
-        Assert.assertEquals(accountTagSqlDao.getTagsForAccount(accountKey).size(), 0);
+        Assert.assertEquals(accountTagSqlDao.getTagsForAccountByKey(accountKey).size(), 0);
         tagRecorder.tagAdded(ObjectType.ACCOUNT, accountId, name);
-        Assert.assertEquals(accountTagSqlDao.getTagsForAccount(accountKey).size(), 1);
+        Assert.assertEquals(accountTagSqlDao.getTagsForAccountByKey(accountKey).size(), 1);
         tagRecorder.tagRemoved(ObjectType.ACCOUNT, accountId, name);
-        Assert.assertEquals(accountTagSqlDao.getTagsForAccount(accountKey).size(), 0);
+        Assert.assertEquals(accountTagSqlDao.getTagsForAccountByKey(accountKey).size(), 0);
     }
 
     @Test(groups = "slow")
@@ -135,10 +135,10 @@ public class TestBusinessTagRecorder extends TestWithEmbeddedDB {
         final SubscriptionBundle bundle = entitlementUserApi.createBundleForAccount(account.getId(), externalKey, callContext);
         final UUID bundleId = bundle.getId();
 
-        Assert.assertEquals(subscriptionTransitionTagSqlDao.getTagsForBusinessSubscriptionTransition(externalKey).size(), 0);
+        Assert.assertEquals(subscriptionTransitionTagSqlDao.getTagsForBusinessSubscriptionTransitionByKey(externalKey).size(), 0);
         tagRecorder.tagAdded(ObjectType.BUNDLE, bundleId, name);
-        Assert.assertEquals(subscriptionTransitionTagSqlDao.getTagsForBusinessSubscriptionTransition(externalKey).size(), 1);
+        Assert.assertEquals(subscriptionTransitionTagSqlDao.getTagsForBusinessSubscriptionTransitionByKey(externalKey).size(), 1);
         tagRecorder.tagRemoved(ObjectType.BUNDLE, bundleId, name);
-        Assert.assertEquals(subscriptionTransitionTagSqlDao.getTagsForBusinessSubscriptionTransition(externalKey).size(), 0);
+        Assert.assertEquals(subscriptionTransitionTagSqlDao.getTagsForBusinessSubscriptionTransitionByKey(externalKey).size(), 0);
     }
 }
diff --git a/api/src/main/java/com/ning/billing/invoice/api/Invoice.java b/api/src/main/java/com/ning/billing/invoice/api/Invoice.java
index 460f962..f79a46e 100644
--- a/api/src/main/java/com/ning/billing/invoice/api/Invoice.java
+++ b/api/src/main/java/com/ning/billing/invoice/api/Invoice.java
@@ -54,7 +54,7 @@ public interface Invoice extends Entity {
 
     Currency getCurrency();
 
-    DateTime getLastPaymentAttempt();
+    DateTime getLastPaymentDate();
 
     BigDecimal getPaidAmount();
 
diff --git a/api/src/main/java/com/ning/billing/invoice/api/InvoicePayment.java b/api/src/main/java/com/ning/billing/invoice/api/InvoicePayment.java
index 102eb64..c5b331e 100644
--- a/api/src/main/java/com/ning/billing/invoice/api/InvoicePayment.java
+++ b/api/src/main/java/com/ning/billing/invoice/api/InvoicePayment.java
@@ -25,13 +25,13 @@ import com.ning.billing.catalog.api.Currency;
 import com.ning.billing.util.entity.Entity;
 
 public interface InvoicePayment extends Entity {
-    UUID getPaymentAttemptId();
+    UUID getPaymentId();
 
     InvoicePaymentType getType();
 
     UUID getInvoiceId();
 
-    DateTime getPaymentAttemptDate();
+    DateTime getPaymentDate();
 
     BigDecimal getAmount();
 
diff --git a/api/src/main/java/com/ning/billing/invoice/api/InvoicePaymentApi.java b/api/src/main/java/com/ning/billing/invoice/api/InvoicePaymentApi.java
index 54e03bf..197d8b9 100644
--- a/api/src/main/java/com/ning/billing/invoice/api/InvoicePaymentApi.java
+++ b/api/src/main/java/com/ning/billing/invoice/api/InvoicePaymentApi.java
@@ -27,22 +27,22 @@ import com.ning.billing.util.callcontext.CallContext;
 
 public interface InvoicePaymentApi {
     /**
-     * @param accountId
+     * @param accountId id of the account
      * @return All invoices, including migrated invoices
      */
     public List<Invoice> getAllInvoicesByAccount(UUID accountId);
 
     public Invoice getInvoice(UUID invoiceId);
 
-    public Invoice getInvoiceForPaymentAttemptId(UUID paymentAttemptId);
+    public Invoice getInvoiceForPaymentId(UUID paymentId);
 
-    public InvoicePayment getInvoicePayment(UUID paymentAttemptId);
+    public InvoicePayment getInvoicePayment(UUID paymentId);
 
-    public void notifyOfPaymentAttempt(InvoicePayment invoicePayment, CallContext context);
+    public void notifyOfPayment(InvoicePayment invoicePayment, CallContext context);
 
-    public void notifyOfPaymentAttempt(UUID invoiceId, BigDecimal amountOutstanding, Currency currency, UUID paymentAttemptId, DateTime paymentAttemptDate, CallContext context);
+    public void notifyOfPayment(UUID invoiceId, BigDecimal amountOutstanding, Currency currency, UUID paymentId, DateTime paymentDate, CallContext context);
 
-    public InvoicePayment createRefund(UUID paymentAttemptId, BigDecimal amount, boolean isInvoiceAdjusted, UUID paymentCookieId, CallContext context) throws InvoiceApiException;
+    public InvoicePayment createRefund(UUID paymentId, BigDecimal amount, boolean isInvoiceAdjusted, UUID paymentCookieId, CallContext context) throws InvoiceApiException;
 
     public InvoicePayment createChargeback(UUID invoicePaymentId, BigDecimal amount, CallContext context) throws InvoiceApiException;
 
@@ -54,7 +54,7 @@ public interface InvoicePaymentApi {
 
     public UUID getAccountIdFromInvoicePaymentId(UUID uuid) throws InvoiceApiException;
 
-    public List<InvoicePayment> getChargebacksByPaymentAttemptId(UUID paymentAttemptId);
+    public List<InvoicePayment> getChargebacksByPaymentId(UUID paymentId);
 
     public InvoicePayment getChargebackById(UUID chargebackId) throws InvoiceApiException;
 }
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 a3ef34c..403d176 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
@@ -38,7 +38,7 @@ public interface InvoiceUserApi {
 
     public Invoice getInvoice(UUID invoiceId);
 
-    public void notifyOfPaymentAttempt(InvoicePayment invoicePayment, CallContext context);
+    public void notifyOfPayment(InvoicePayment invoicePayment, CallContext context);
 
     public Collection<Invoice> getUnpaidInvoicesByAccountId(UUID accountId, DateTime upToDate);
 
diff --git a/api/src/main/java/com/ning/billing/util/template/translation/TranslatorConfig.java b/api/src/main/java/com/ning/billing/util/template/translation/TranslatorConfig.java
index 14dacf5..8d4e06e 100644
--- a/api/src/main/java/com/ning/billing/util/template/translation/TranslatorConfig.java
+++ b/api/src/main/java/com/ning/billing/util/template/translation/TranslatorConfig.java
@@ -22,13 +22,23 @@ import org.skife.config.Default;
 import com.ning.billing.invoice.api.formatters.InvoiceFormatterFactory;
 
 public interface TranslatorConfig {
-    @Config("killbill.template.default.locale")
+    // Common
+
+    @Config("killbill.default.locale")
     @Default("en_US")
     public String getDefaultLocale();
 
+    // Catalog
+
+    @Config("killbill.catalog.bundlePath")
+    @Default("com/ning/billing/util/template/translation/CatalogTranslation")
+    String getCatalogBundlePath();
+
+    // Invoices
+
     @Config("killbill.template.bundlePath")
     @Default("com/ning/billing/util/template/translation/InvoiceTranslation")
-    public String getBundlePath();
+    public String getInvoiceTemplateBundlePath();
 
     @Config("killbill.template.name")
     @Default("com/ning/billing/util/email/templates/HtmlInvoiceTemplate.mustache")
diff --git a/beatrix/src/test/java/com/ning/billing/beatrix/integration/TestAnalytics.java b/beatrix/src/test/java/com/ning/billing/beatrix/integration/TestAnalytics.java
index cc7b531..adc0fc6 100644
--- a/beatrix/src/test/java/com/ning/billing/beatrix/integration/TestAnalytics.java
+++ b/beatrix/src/test/java/com/ning/billing/beatrix/integration/TestAnalytics.java
@@ -53,6 +53,7 @@ import com.ning.billing.entitlement.api.user.EntitlementUserApiException;
 import com.ning.billing.entitlement.api.user.Subscription;
 import com.ning.billing.entitlement.api.user.SubscriptionBundle;
 import com.ning.billing.overdue.config.OverdueConfig;
+import com.ning.billing.payment.api.PaymentStatus;
 import com.ning.billing.util.api.TagApiException;
 import com.ning.billing.util.api.TagDefinitionApiException;
 import com.ning.billing.util.config.XMLLoader;
@@ -199,6 +200,13 @@ public class TestAnalytics extends TestIntegrationBase {
         final Subscription subscription = verifyFirstSubscription(account, bundle);
         assertTrue(busHandler.isCompleted(DELAY));
 
+        // Verify the initial state of payments
+        Assert.assertEquals(analyticsUserApi.getInvoicePaymentsForAccount(account.getExternalKey()).size(), 0);
+
+        // Verify the account payment fields
+        Assert.assertEquals(analyticsUserApi.getAccountByKey(account.getExternalKey()).getBalance().doubleValue(), Rounder.round(BigDecimal.ZERO));
+        Assert.assertNull(analyticsUserApi.getAccountByKey(account.getExternalKey()).getLastPaymentStatus());
+
         // Verify the initial overdue status
         Assert.assertEquals(analyticsUserApi.getOverdueStatusesForBundle(bundle.getKey()).size(), 0);
 
@@ -206,10 +214,29 @@ public class TestAnalytics extends TestIntegrationBase {
         busHandler.pushExpectedEvents(TestApiListener.NextEvent.PHASE, TestApiListener.NextEvent.INVOICE, TestApiListener.NextEvent.PAYMENT_ERROR);
         clock.addDays(30); // DAY 30 have to get out of trial before first payment
         Assert.assertTrue(busHandler.isCompleted(DELAY));
+        waitALittle();
 
         // Check BST - nothing should have changed
         verifyBSTWithTrialAndEvergreenPhases(account, bundle, subscription);
 
+        // Verify the payments - we should have received one
+        Assert.assertEquals(analyticsUserApi.getInvoicePaymentsForAccount(account.getExternalKey()).size(), 1);
+        Assert.assertEquals(analyticsUserApi.getInvoicePaymentsForAccount(account.getExternalKey()).get(0).getAccountKey(), account.getExternalKey());
+        Assert.assertTrue(analyticsUserApi.getInvoicePaymentsForAccount(account.getExternalKey()).get(0).getAmount().compareTo(BigDecimal.ZERO) > 0);
+        Assert.assertTrue(analyticsUserApi.getInvoicePaymentsForAccount(account.getExternalKey()).get(0).getRequestedAmount().compareTo(BigDecimal.ZERO) > 0);
+        Assert.assertNull(analyticsUserApi.getInvoicePaymentsForAccount(account.getExternalKey()).get(0).getExtPaymentRefId());
+        Assert.assertEquals(analyticsUserApi.getInvoicePaymentsForAccount(account.getExternalKey()).get(0).getProcessingStatus(), PaymentStatus.PAYMENT_FAILURE.toString());
+        Assert.assertEquals(analyticsUserApi.getInvoicePaymentsForAccount(account.getExternalKey()).get(0).getPluginName(), BeatrixModule.PLUGIN_NAME);
+
+        // Verify the account object has been updated
+        Assert.assertEquals(analyticsUserApi.getAccountByKey(account.getExternalKey()).getBalance(),
+                            analyticsUserApi.getInvoicePaymentsForAccount(account.getExternalKey()).get(0).getAmount());
+
+        // Verify the invoice balance isn't zero and is equal to the payment amount (don't look at the first, trial, invoice)
+        Assert.assertTrue(analyticsUserApi.getInvoicesForAccount(account.getExternalKey()).get(1).getBalance().compareTo(BigDecimal.ZERO) > 0);
+        Assert.assertEquals(analyticsUserApi.getInvoicesForAccount(account.getExternalKey()).get(1).getBalance(),
+                            analyticsUserApi.getInvoicePaymentsForAccount(account.getExternalKey()).get(0).getAmount());
+
         // Verify overdue status - we should still be in clear state
         Assert.assertEquals(analyticsUserApi.getOverdueStatusesForBundle(bundle.getKey()).size(), 0);
 
diff --git a/invoice/src/main/java/com/ning/billing/invoice/api/invoice/DefaultInvoicePaymentApi.java b/invoice/src/main/java/com/ning/billing/invoice/api/invoice/DefaultInvoicePaymentApi.java
index be8aa79..dfb40b4 100644
--- a/invoice/src/main/java/com/ning/billing/invoice/api/invoice/DefaultInvoicePaymentApi.java
+++ b/invoice/src/main/java/com/ning/billing/invoice/api/invoice/DefaultInvoicePaymentApi.java
@@ -43,8 +43,8 @@ public class DefaultInvoicePaymentApi implements InvoicePaymentApi {
     }
 
     @Override
-    public void notifyOfPaymentAttempt(final InvoicePayment invoicePayment, final CallContext context) {
-        dao.notifyOfPaymentAttempt(invoicePayment, context);
+    public void notifyOfPayment(final InvoicePayment invoicePayment, final CallContext context) {
+        dao.notifyOfPayment(invoicePayment, context);
     }
 
     @Override
@@ -58,20 +58,20 @@ public class DefaultInvoicePaymentApi implements InvoicePaymentApi {
     }
 
     @Override
-    public Invoice getInvoiceForPaymentAttemptId(final UUID paymentAttemptId) {
-        final UUID invoiceIdStr = dao.getInvoiceIdByPaymentAttemptId(paymentAttemptId);
+    public Invoice getInvoiceForPaymentId(final UUID paymentId) {
+        final UUID invoiceIdStr = dao.getInvoiceIdByPaymentId(paymentId);
         return invoiceIdStr == null ? null : dao.getById(invoiceIdStr);
     }
 
     @Override
-    public InvoicePayment getInvoicePayment(final UUID paymentAttemptId) {
-        return dao.getInvoicePayment(paymentAttemptId);
+    public InvoicePayment getInvoicePayment(final UUID paymentId) {
+        return dao.getInvoicePayment(paymentId);
     }
 
     @Override
-    public void notifyOfPaymentAttempt(final UUID invoiceId, final BigDecimal amount, final Currency currency, final UUID paymentAttemptId, final DateTime paymentAttemptDate, final CallContext context) {
-        final InvoicePayment invoicePayment = new DefaultInvoicePayment(InvoicePaymentType.ATTEMPT, paymentAttemptId, invoiceId, paymentAttemptDate, amount, currency);
-        dao.notifyOfPaymentAttempt(invoicePayment, context);
+    public void notifyOfPayment(final UUID invoiceId, final BigDecimal amount, final Currency currency, final UUID paymentId, final DateTime paymentDate, final CallContext context) {
+        final InvoicePayment invoicePayment = new DefaultInvoicePayment(InvoicePaymentType.ATTEMPT, paymentId, invoiceId, paymentDate, amount, currency);
+        dao.notifyOfPayment(invoicePayment, context);
     }
 
     @Override
@@ -95,8 +95,8 @@ public class DefaultInvoicePaymentApi implements InvoicePaymentApi {
     }
 
     @Override
-    public List<InvoicePayment> getChargebacksByPaymentAttemptId(final UUID paymentAttemptId) {
-        return dao.getChargebacksByPaymentAttemptId(paymentAttemptId);
+    public List<InvoicePayment> getChargebacksByPaymentId(final UUID paymentId) {
+        return dao.getChargebacksByPaymentId(paymentId);
     }
 
     @Override
@@ -110,9 +110,8 @@ public class DefaultInvoicePaymentApi implements InvoicePaymentApi {
     }
 
     @Override
-    public InvoicePayment createRefund(UUID paymentAttemptId,
-            BigDecimal amount, boolean isInvoiceAdjusted, UUID paymentCookieId, CallContext context)
-            throws InvoiceApiException {
-        return dao.createRefund(paymentAttemptId, amount, isInvoiceAdjusted, paymentCookieId, context);
+    public InvoicePayment createRefund(final UUID paymentId, final BigDecimal amount, final boolean isInvoiceAdjusted,
+                                       final UUID paymentCookieId, final CallContext context) throws InvoiceApiException {
+        return dao.createRefund(paymentId, amount, isInvoiceAdjusted, paymentCookieId, context);
     }
 }
diff --git a/invoice/src/main/java/com/ning/billing/invoice/api/user/DefaultInvoiceUserApi.java b/invoice/src/main/java/com/ning/billing/invoice/api/user/DefaultInvoiceUserApi.java
index 88d67fd..0a6a8f1 100644
--- a/invoice/src/main/java/com/ning/billing/invoice/api/user/DefaultInvoiceUserApi.java
+++ b/invoice/src/main/java/com/ning/billing/invoice/api/user/DefaultInvoiceUserApi.java
@@ -65,8 +65,8 @@ public class DefaultInvoiceUserApi implements InvoiceUserApi {
     }
 
     @Override
-    public void notifyOfPaymentAttempt(final InvoicePayment invoicePayment, final CallContext context) {
-        dao.notifyOfPaymentAttempt(invoicePayment, context);
+    public void notifyOfPayment(final InvoicePayment invoicePayment, final CallContext context) {
+        dao.notifyOfPayment(invoicePayment, context);
     }
 
     @Override
@@ -89,7 +89,7 @@ public class DefaultInvoiceUserApi implements InvoiceUserApi {
     public Invoice triggerInvoiceGeneration(final UUID accountId,
                                             final DateTime targetDate, final boolean dryRun,
                                             final CallContext context) throws InvoiceApiException {
-        Invoice result = dispatcher.processAccount(accountId, targetDate, dryRun, context);
+        final Invoice result = dispatcher.processAccount(accountId, targetDate, dryRun, context);
         if (result == null) {
             throw new InvoiceApiException(ErrorCode.INVOICE_NOTHING_TO_DO, accountId, targetDate);
         } else {
diff --git a/invoice/src/main/java/com/ning/billing/invoice/dao/DefaultInvoiceDao.java b/invoice/src/main/java/com/ning/billing/invoice/dao/DefaultInvoiceDao.java
index 7c344fe..08b359f 100644
--- a/invoice/src/main/java/com/ning/billing/invoice/dao/DefaultInvoiceDao.java
+++ b/invoice/src/main/java/com/ning/billing/invoice/dao/DefaultInvoiceDao.java
@@ -241,11 +241,11 @@ public class DefaultInvoiceDao implements InvoiceDao {
 
 
     @Override
-    public void notifyOfPaymentAttempt(final InvoicePayment invoicePayment, final CallContext context) {
+    public void notifyOfPayment(final InvoicePayment invoicePayment, final CallContext context) {
         invoicePaymentSqlDao.inTransaction(new Transaction<Void, InvoicePaymentSqlDao>() {
             @Override
             public Void inTransaction(final InvoicePaymentSqlDao transactional, final TransactionStatus status) throws Exception {
-                transactional.notifyOfPaymentAttempt(invoicePayment, context);
+                transactional.notifyOfPayment(invoicePayment, context);
 
                 final String invoicePaymentId = invoicePayment.getId().toString();
                 final Long recordId = transactional.getRecordId(invoicePaymentId);
@@ -263,10 +263,10 @@ public class DefaultInvoiceDao implements InvoiceDao {
             @Override
             public List<Invoice> inTransaction(final InvoiceSqlDao invoiceDao, final TransactionStatus status) throws Exception {
 
-                List<Invoice> invoices = getAllInvoicesByAccountFromTransaction(accountId, invoiceDao);
-                Collection<Invoice> unpaidInvoices = Collections2.filter(invoices, new Predicate<Invoice>() {
+                final List<Invoice> invoices = getAllInvoicesByAccountFromTransaction(accountId, invoiceDao);
+                final Collection<Invoice> unpaidInvoices = Collections2.filter(invoices, new Predicate<Invoice>() {
                     @Override
-                    public boolean apply(Invoice in) {
+                    public boolean apply(final Invoice in) {
                         return (in.getBalance().compareTo(BigDecimal.ZERO) >= 1) && !in.getTargetDate().isAfter(upToDate);
                     }
                 });
@@ -276,13 +276,13 @@ public class DefaultInvoiceDao implements InvoiceDao {
     }
 
     @Override
-    public UUID getInvoiceIdByPaymentAttemptId(final UUID paymentAttemptId) {
-        return invoiceSqlDao.getInvoiceIdByPaymentAttemptId(paymentAttemptId.toString());
+    public UUID getInvoiceIdByPaymentId(final UUID paymentId) {
+        return invoiceSqlDao.getInvoiceIdByPaymentId(paymentId.toString());
     }
 
     @Override
-    public InvoicePayment getInvoicePayment(final UUID paymentAttemptId) {
-        return invoicePaymentSqlDao.getInvoicePayment(paymentAttemptId.toString());
+    public InvoicePayment getInvoicePayment(final UUID paymentId) {
+        return invoicePaymentSqlDao.getInvoicePayment(paymentId.toString());
     }
 
     @Override
@@ -297,17 +297,16 @@ public class DefaultInvoiceDao implements InvoiceDao {
 
 
     @Override
-    public InvoicePayment createRefund(final UUID paymentAttemptId,
-            final BigDecimal amount, final boolean isInvoiceAdjusted, final UUID paymentCookieId,  final CallContext context)
+    public InvoicePayment createRefund(final UUID paymentId, final BigDecimal amount, final boolean isInvoiceAdjusted, final UUID paymentCookieId,  final CallContext context)
             throws InvoiceApiException {
 
         return invoicePaymentSqlDao.inTransaction(new Transaction<InvoicePayment, InvoicePaymentSqlDao>() {
             @Override
             public InvoicePayment inTransaction(final InvoicePaymentSqlDao transactional, final TransactionStatus status) throws Exception {
 
-                final InvoicePayment payment = transactional.getByPaymentAttemptId(paymentAttemptId.toString());
+                final InvoicePayment payment = transactional.getByPaymentId(paymentId.toString());
                 if (payment == null) {
-                    throw new InvoiceApiException(ErrorCode.INVOICE_PAYMENT_BY_ATTEMPT_NOT_FOUND, paymentAttemptId);
+                    throw new InvoiceApiException(ErrorCode.INVOICE_PAYMENT_BY_ATTEMPT_NOT_FOUND, paymentId);
                 }
                 final BigDecimal maxRefundAmount = payment.getAmount() == null ? BigDecimal.ZERO : payment.getAmount();
                 final BigDecimal requestedAmount = amount == null ? maxRefundAmount : amount;
@@ -327,7 +326,7 @@ public class DefaultInvoiceDao implements InvoiceDao {
                     return existingRefund;
                 }
 
-                final InvoicePayment refund = new DefaultInvoicePayment(UUID.randomUUID(), InvoicePaymentType.REFUND, paymentAttemptId,
+                final InvoicePayment refund = new DefaultInvoicePayment(UUID.randomUUID(), InvoicePaymentType.REFUND, paymentId,
                         payment.getInvoiceId(), context.getCreatedDate(), requestedPositiveAmount.negate(), payment.getCurrency(), paymentCookieId, payment.getId());
                 transactional.create(refund, context);
 
@@ -417,8 +416,8 @@ public class DefaultInvoiceDao implements InvoiceDao {
     }
 
     @Override
-    public List<InvoicePayment> getChargebacksByPaymentAttemptId(final UUID paymentAttemptId) {
-        return invoicePaymentSqlDao.getChargebacksByAttemptPaymentId(paymentAttemptId.toString());
+    public List<InvoicePayment> getChargebacksByPaymentId(final UUID paymentId) {
+        return invoicePaymentSqlDao.getChargebacksByPaymentId(paymentId.toString());
     }
 
     @Override
diff --git a/invoice/src/main/java/com/ning/billing/invoice/dao/InvoiceDao.java b/invoice/src/main/java/com/ning/billing/invoice/dao/InvoiceDao.java
index 443f07a..9c2403b 100644
--- a/invoice/src/main/java/com/ning/billing/invoice/dao/InvoiceDao.java
+++ b/invoice/src/main/java/com/ning/billing/invoice/dao/InvoiceDao.java
@@ -31,7 +31,6 @@ import com.ning.billing.util.api.TagApiException;
 import com.ning.billing.util.callcontext.CallContext;
 
 public interface InvoiceDao {
-
     void create(Invoice invoice, CallContext context);
 
     Invoice getById(final UUID id);
@@ -44,11 +43,11 @@ public interface InvoiceDao {
 
     List<Invoice> getInvoicesBySubscription(final UUID subscriptionId);
 
-    UUID getInvoiceIdByPaymentAttemptId(final UUID paymentAttemptId);
+    UUID getInvoiceIdByPaymentId(final UUID paymentId);
 
-    InvoicePayment getInvoicePayment(final UUID paymentAttemptId);
+    InvoicePayment getInvoicePayment(final UUID paymentId);
 
-    void notifyOfPaymentAttempt(final InvoicePayment invoicePayment, final CallContext context);
+    void notifyOfPayment(final InvoicePayment invoicePayment, final CallContext context);
 
     BigDecimal getAccountBalance(final UUID accountId);
 
@@ -66,8 +65,7 @@ public interface InvoiceDao {
 
     InvoicePayment postChargeback(final UUID invoicePaymentId, final BigDecimal amount, final CallContext context) throws InvoiceApiException;
 
-    InvoicePayment createRefund(UUID paymentAttemptId,
-            BigDecimal amount, boolean isInvoiceAdjusted, UUID paymentCookieId,  CallContext context) throws InvoiceApiException;
+    InvoicePayment createRefund(UUID paymentId, BigDecimal amount, boolean isInvoiceAdjusted, UUID paymentCookieId, CallContext context) throws InvoiceApiException;
 
     BigDecimal getRemainingAmountPaid(final UUID invoicePaymentId);
 
@@ -75,14 +73,13 @@ public interface InvoiceDao {
 
     List<InvoicePayment> getChargebacksByAccountId(final UUID accountId);
 
-    List<InvoicePayment> getChargebacksByPaymentAttemptId(final UUID paymentAttemptId);
+    List<InvoicePayment> getChargebacksByPaymentId(final UUID paymentId);
 
     InvoicePayment getChargebackById(final UUID chargebackId) throws InvoiceApiException;
 
     InvoiceItem getCreditById(final UUID creditId) throws InvoiceApiException;
 
     InvoiceItem insertCredit(final UUID accountId, final UUID invoiceId, final BigDecimal amount,
-                             final DateTime effectiveDate, final Currency currency,
-                             final CallContext context);
+                             final DateTime effectiveDate, final Currency currency, final CallContext context);
 
 }
diff --git a/invoice/src/main/java/com/ning/billing/invoice/dao/InvoicePaymentSqlDao.java b/invoice/src/main/java/com/ning/billing/invoice/dao/InvoicePaymentSqlDao.java
index 6bf0d10..4a9f143 100644
--- a/invoice/src/main/java/com/ning/billing/invoice/dao/InvoicePaymentSqlDao.java
+++ b/invoice/src/main/java/com/ning/billing/invoice/dao/InvoicePaymentSqlDao.java
@@ -62,7 +62,7 @@ public interface InvoicePaymentSqlDao extends EntitySqlDao<InvoicePayment>, Tran
     List<Long> getRecordIds(@Bind("invoiceId") final String invoiceId);
 
     @SqlQuery
-    public InvoicePayment getByPaymentAttemptId(@Bind("paymentAttemptId") final String paymentAttemptId);
+    public InvoicePayment getByPaymentId(@Bind("paymentId") final String paymentId);
 
     @Override
     @SqlQuery
@@ -70,26 +70,22 @@ public interface InvoicePaymentSqlDao extends EntitySqlDao<InvoicePayment>, Tran
 
     @Override
     @SqlUpdate
-    public void create(@InvoicePaymentBinder final InvoicePayment invoicePayment,
-                       @CallContextBinder final CallContext context);
+    public void create(@InvoicePaymentBinder final InvoicePayment invoicePayment, @CallContextBinder final CallContext context);
 
     @SqlBatch(transactional = false)
-    void batchCreateFromTransaction(@InvoicePaymentBinder final List<InvoicePayment> items,
-                                    @CallContextBinder final CallContext context);
+    void batchCreateFromTransaction(@InvoicePaymentBinder final List<InvoicePayment> items, @CallContextBinder final CallContext context);
 
     @SqlQuery
     public List<InvoicePayment> getPaymentsForInvoice(@Bind("invoiceId") final String invoiceId);
 
     @SqlQuery
-    InvoicePayment getInvoicePayment(@Bind("paymentAttemptId") final String paymentAttemptId);
+    InvoicePayment getInvoicePayment(@Bind("paymentId") final String paymentId);
 
     @SqlQuery
     InvoicePayment getPaymentsForCookieId(@Bind("paymentCookieId") final String paymentCookieId);
 
-
     @SqlUpdate
-    void notifyOfPaymentAttempt(@InvoicePaymentBinder final InvoicePayment invoicePayment,
-                                @CallContextBinder final CallContext context);
+    void notifyOfPayment(@InvoicePaymentBinder final InvoicePayment invoicePayment, @CallContextBinder final CallContext context);
 
     @SqlQuery
     BigDecimal getRemainingAmountPaid(@Bind("invoicePaymentId") final String invoicePaymentId);
@@ -102,23 +98,23 @@ public interface InvoicePaymentSqlDao extends EntitySqlDao<InvoicePayment>, Tran
     List<InvoicePayment> getChargeBacksByAccountId(@Bind("accountId") final String accountId);
 
     @SqlQuery
-    List<InvoicePayment> getChargebacksByAttemptPaymentId(@Bind("paymentAttemptId") final String paymentAttemptId);
+    List<InvoicePayment> getChargebacksByPaymentId(@Bind("paymentId") final String paymentId);
 
     public static class InvoicePaymentMapper extends MapperBase implements ResultSetMapper<InvoicePayment> {
         @Override
         public InvoicePayment map(final int index, final ResultSet result, final StatementContext context) throws SQLException {
             final UUID id = getUUID(result, "id");
             final InvoicePaymentType type = InvoicePaymentType.valueOf(result.getString("type"));
-            final UUID paymentAttemptId = getUUID(result, "payment_attempt_id");
+            final UUID paymentId = getUUID(result, "payment_id");
             final UUID invoiceId = getUUID(result, "invoice_id");
-            final DateTime paymentAttemptDate = getDate(result, "payment_attempt_date");
+            final DateTime paymentDate = getDate(result, "payment_date");
             final BigDecimal amount = result.getBigDecimal("amount");
             final String currencyString = result.getString("currency");
             final Currency currency = (currencyString == null) ? null : Currency.valueOf(currencyString);
             final UUID paymentCookieId = getUUID(result, "payment_cookie_id");
             final UUID linkedInvoicePaymentId = getUUID(result, "linked_invoice_payment_id");
 
-            return new DefaultInvoicePayment(id, type, paymentAttemptId, invoiceId, paymentAttemptDate,
+            return new DefaultInvoicePayment(id, type, paymentId, invoiceId, paymentDate,
                                              amount, currency, paymentCookieId, linkedInvoicePaymentId);
         }
     }
@@ -136,8 +132,8 @@ public interface InvoicePaymentSqlDao extends EntitySqlDao<InvoicePayment>, Tran
                         q.bind("id", payment.getId().toString());
                         q.bind("type", payment.getType().toString());
                         q.bind("invoiceId", payment.getInvoiceId().toString());
-                        q.bind("paymentAttemptId", uuidToString(payment.getPaymentAttemptId()));
-                        q.bind("paymentAttemptDate", payment.getPaymentAttemptDate().toDate());
+                        q.bind("paymentId", uuidToString(payment.getPaymentId()));
+                        q.bind("paymentDate", payment.getPaymentDate().toDate());
                         q.bind("amount", payment.getAmount());
                         final Currency currency = payment.getCurrency();
                         q.bind("currency", (currency == null) ? null : currency.toString());
diff --git a/invoice/src/main/java/com/ning/billing/invoice/dao/InvoiceSqlDao.java b/invoice/src/main/java/com/ning/billing/invoice/dao/InvoiceSqlDao.java
index 3de924b..845b7b9 100644
--- a/invoice/src/main/java/com/ning/billing/invoice/dao/InvoiceSqlDao.java
+++ b/invoice/src/main/java/com/ning/billing/invoice/dao/InvoiceSqlDao.java
@@ -75,7 +75,7 @@ public interface InvoiceSqlDao extends EntitySqlDao<Invoice>, AuditSqlDao, Trans
 
     @SqlQuery
     @RegisterMapper(UuidMapper.class)
-    UUID getInvoiceIdByPaymentAttemptId(@Bind("paymentAttemptId") final String paymentAttemptId);
+    UUID getInvoiceIdByPaymentId(@Bind("paymentId") final String paymentId);
 
 
     @BindingAnnotation(InvoiceBinder.InvoiceBinderFactory.class)
diff --git a/invoice/src/main/java/com/ning/billing/invoice/model/DefaultInvoice.java b/invoice/src/main/java/com/ning/billing/invoice/model/DefaultInvoice.java
index 797b228..41297fe 100644
--- a/invoice/src/main/java/com/ning/billing/invoice/model/DefaultInvoice.java
+++ b/invoice/src/main/java/com/ning/billing/invoice/model/DefaultInvoice.java
@@ -144,21 +144,21 @@ public class DefaultInvoice extends EntityBase implements Invoice {
     }
 
     @Override
-    public DateTime getLastPaymentAttempt() {
-        DateTime lastPaymentAttempt = null;
+    public DateTime getLastPaymentDate() {
+        DateTime lastPaymentDate = null;
 
         for (final InvoicePayment paymentAttempt : payments) {
-            final DateTime paymentAttemptDate = paymentAttempt.getPaymentAttemptDate();
-            if (lastPaymentAttempt == null) {
-                lastPaymentAttempt = paymentAttemptDate;
+            final DateTime paymentDate = paymentAttempt.getPaymentDate();
+            if (lastPaymentDate == null) {
+                lastPaymentDate = paymentDate;
             }
 
-            if (lastPaymentAttempt.isBefore(paymentAttemptDate)) {
-                lastPaymentAttempt = paymentAttemptDate;
+            if (lastPaymentDate.isBefore(paymentDate)) {
+                lastPaymentDate = paymentDate;
             }
         }
 
-        return lastPaymentAttempt;
+        return lastPaymentDate;
     }
 
     @Override
@@ -208,13 +208,13 @@ public class DefaultInvoice extends EntityBase implements Invoice {
             return false;
         }
 
-        final DateTime lastPaymentAttempt = getLastPaymentAttempt();
-        return (lastPaymentAttempt == null) || lastPaymentAttempt.plusDays(numberOfDays).isAfter(targetDate);
+        final DateTime lastPayment = getLastPaymentDate();
+        return (lastPayment == null) || lastPayment.plusDays(numberOfDays).isAfter(targetDate);
     }
 
     @Override
     public String toString() {
-        return "DefaultInvoice [items=" + invoiceItems + ", payments=" + payments + ", id=" + id + ", accountId=" + accountId + ", invoiceDate=" + invoiceDate + ", targetDate=" + targetDate + ", currency=" + currency + ", amountPaid=" + getPaidAmount() + ", lastPaymentAttempt=" + getLastPaymentAttempt() + "]";
+        return "DefaultInvoice [items=" + invoiceItems + ", payments=" + payments + ", id=" + id + ", accountId=" + accountId + ", invoiceDate=" + invoiceDate + ", targetDate=" + targetDate + ", currency=" + currency + ", amountPaid=" + getPaidAmount() + ", lastPaymentDate=" + getLastPaymentDate() + "]";
     }
 
 }
diff --git a/invoice/src/main/java/com/ning/billing/invoice/model/DefaultInvoicePayment.java b/invoice/src/main/java/com/ning/billing/invoice/model/DefaultInvoicePayment.java
index 6145f07..abd96b3 100644
--- a/invoice/src/main/java/com/ning/billing/invoice/model/DefaultInvoicePayment.java
+++ b/invoice/src/main/java/com/ning/billing/invoice/model/DefaultInvoicePayment.java
@@ -27,7 +27,7 @@ import com.ning.billing.invoice.api.InvoicePayment;
 import com.ning.billing.util.entity.EntityBase;
 
 public class DefaultInvoicePayment extends EntityBase implements InvoicePayment {
-    private final UUID paymentAttemptId;
+    private final UUID paymentId;
     private final InvoicePaymentType type;
     private final UUID invoiceId;
     private final DateTime paymentDate;
@@ -36,17 +36,17 @@ public class DefaultInvoicePayment extends EntityBase implements InvoicePayment 
     private final UUID paymentCookieId;
     private final UUID linkedInvoicePaymentId;
 
-    public DefaultInvoicePayment(final InvoicePaymentType type, final UUID paymentAttemptId, final UUID invoiceId, final DateTime paymentDate,
+    public DefaultInvoicePayment(final InvoicePaymentType type, final UUID paymentId, final UUID invoiceId, final DateTime paymentDate,
                                  final BigDecimal amount, final Currency currency) {
-        this(UUID.randomUUID(), type, paymentAttemptId, invoiceId, paymentDate, amount, currency, null, null);
+        this(UUID.randomUUID(), type, paymentId, invoiceId, paymentDate, amount, currency, null, null);
     }
 
-    public DefaultInvoicePayment(final UUID id, final InvoicePaymentType type, final UUID paymentAttemptId, final UUID invoiceId, final DateTime paymentDate,
-                                 @Nullable final BigDecimal amount, @Nullable final Currency currency, final UUID paymentCookieId,
+    public DefaultInvoicePayment(final UUID id, final InvoicePaymentType type, final UUID paymentId, final UUID invoiceId, final DateTime paymentDate,
+                                 @Nullable final BigDecimal amount, @Nullable final Currency currency, @Nullable final UUID paymentCookieId,
                                  @Nullable final UUID linkedInvoicePaymentId) {
         super(id);
         this.type = type;
-        this.paymentAttemptId = paymentAttemptId;
+        this.paymentId = paymentId;
         this.amount = amount;
         this.invoiceId = invoiceId;
         this.paymentDate = paymentDate;
@@ -61,8 +61,8 @@ public class DefaultInvoicePayment extends EntityBase implements InvoicePayment 
     }
 
     @Override
-    public UUID getPaymentAttemptId() {
-        return paymentAttemptId;
+    public UUID getPaymentId() {
+        return paymentId;
     }
 
     @Override
@@ -71,7 +71,7 @@ public class DefaultInvoicePayment extends EntityBase implements InvoicePayment 
     }
 
     @Override
-    public DateTime getPaymentAttemptDate() {
+    public DateTime getPaymentDate() {
         return paymentDate;
     }
 
diff --git a/invoice/src/main/java/com/ning/billing/invoice/template/formatters/DefaultInvoiceFormatter.java b/invoice/src/main/java/com/ning/billing/invoice/template/formatters/DefaultInvoiceFormatter.java
index 9499378..345fff6 100644
--- a/invoice/src/main/java/com/ning/billing/invoice/template/formatters/DefaultInvoiceFormatter.java
+++ b/invoice/src/main/java/com/ning/billing/invoice/template/formatters/DefaultInvoiceFormatter.java
@@ -168,8 +168,8 @@ public class DefaultInvoiceFormatter implements InvoiceFormatter {
     }
 
     @Override
-    public DateTime getLastPaymentAttempt() {
-        return invoice.getLastPaymentAttempt();
+    public DateTime getLastPaymentDate() {
+        return invoice.getLastPaymentDate();
     }
 
     @Override
diff --git a/invoice/src/main/java/com/ning/billing/invoice/template/translator/DefaultInvoiceTranslator.java b/invoice/src/main/java/com/ning/billing/invoice/template/translator/DefaultInvoiceTranslator.java
index bad6d1b..3e00120 100644
--- a/invoice/src/main/java/com/ning/billing/invoice/template/translator/DefaultInvoiceTranslator.java
+++ b/invoice/src/main/java/com/ning/billing/invoice/template/translator/DefaultInvoiceTranslator.java
@@ -36,7 +36,7 @@ public class DefaultInvoiceTranslator extends DefaultTranslatorBase implements I
 
     @Override
     protected String getBundlePath() {
-        return config.getBundlePath();
+        return config.getInvoiceTemplateBundlePath();
     }
 
     @Override
diff --git a/invoice/src/main/resources/com/ning/billing/invoice/dao/InvoicePaymentSqlDao.sql.stg b/invoice/src/main/resources/com/ning/billing/invoice/dao/InvoicePaymentSqlDao.sql.stg
index 02dffc5..baec2d4 100644
--- a/invoice/src/main/resources/com/ning/billing/invoice/dao/InvoicePaymentSqlDao.sql.stg
+++ b/invoice/src/main/resources/com/ning/billing/invoice/dao/InvoicePaymentSqlDao.sql.stg
@@ -4,8 +4,8 @@ invoicePaymentFields(prefix) ::= <<
   <prefix>id,
   <prefix>type,
   <prefix>invoice_id,
-  <prefix>payment_attempt_id,
-  <prefix>payment_attempt_date,
+  <prefix>payment_id,
+  <prefix>payment_date,
   <prefix>amount,
   <prefix>currency,
   <prefix>payment_cookie_id,
@@ -16,20 +16,20 @@ invoicePaymentFields(prefix) ::= <<
 
 create() ::= <<
   INSERT INTO invoice_payments(<invoicePaymentFields()>)
-  VALUES(:id, :type, :invoiceId, :paymentAttemptId, :paymentAttemptDate, :amount, :currency,
+  VALUES(:id, :type, :invoiceId, :paymentId, :paymentDate, :amount, :currency,
          :paymentCookieId, :linkedInvoicePaymentId, :userName, :createdDate);
 >>
 
 batchCreateFromTransaction() ::= <<
   INSERT INTO invoice_payments(<invoicePaymentFields()>)
-  VALUES(:id, :type, :invoiceId, :paymentAttemptId, :paymentAttemptDate, :amount, :currency,
+  VALUES(:id, :type, :invoiceId, :paymentId, :paymentDate, :amount, :currency,
         :paymentCookieId, :linkedInvoicePaymentId, :userName, :createdDate);
 >>
 
-getByPaymentAttemptId() ::= <<
+getByPaymentId() ::= <<
   SELECT <invoicePaymentFields()>
   FROM invoice_payments
-  WHERE payment_attempt_id = :paymentAttemptId;
+  WHERE payment_id = :paymentId;
 >>
 
 get() ::= <<
@@ -55,16 +55,16 @@ getPaymentsForInvoice() ::= <<
   WHERE invoice_id = :invoiceId;
 >>
 
-notifyOfPaymentAttempt() ::= <<
+notifyOfPayment() ::= <<
   INSERT INTO invoice_payments(<invoicePaymentFields()>)
-  VALUES(:id, :type, :invoiceId, :paymentAttemptId, :paymentAttemptDate, :amount, :currency,
+  VALUES(:id, :type, :invoiceId, :paymentId, :paymentDate, :amount, :currency,
         :paymentCookieId, :linkedInvoicePaymentId, :userName, :createdDate);
 >>
 
 getInvoicePayment() ::= <<
     SELECT <invoicePaymentFields()>
     FROM invoice_payments
-    WHERE payment_attempt_id = :paymentAttemptId;
+    WHERE payment_id = :paymentId;
 >>
 
 getRecordId() ::= <<
@@ -121,10 +121,10 @@ getChargeBacksByAccountId() ::= <<
     AND linked_invoice_payment_id IS NOT NULL;
 >>
 
-getChargebacksByAttemptPaymentId() ::= <<
+getChargebacksByPaymentId() ::= <<
     SELECT <invoicePaymentFields()>
     FROM invoice_payments
     WHERE linked_invoice_payment_id IN
-        (SELECT id FROM invoice_payments WHERE payment_attempt_id = :paymentAttemptId);
+        (SELECT id FROM invoice_payments WHERE payment_id = :paymentId);
 >>
 ;
diff --git a/invoice/src/main/resources/com/ning/billing/invoice/dao/InvoiceSqlDao.sql.stg b/invoice/src/main/resources/com/ning/billing/invoice/dao/InvoiceSqlDao.sql.stg
index 416fb5e..6ed45be 100644
--- a/invoice/src/main/resources/com/ning/billing/invoice/dao/InvoiceSqlDao.sql.stg
+++ b/invoice/src/main/resources/com/ning/billing/invoice/dao/InvoiceSqlDao.sql.stg
@@ -56,11 +56,11 @@ create() ::= <<
   VALUES (:id, :accountId, :invoiceDate, :targetDate, :currency, :migrated, :userName, :createdDate);
 >>
 
-getInvoiceIdByPaymentAttemptId() ::= <<
+getInvoiceIdByPaymentId() ::= <<
   SELECT i.id
     FROM invoices i, invoice_payments ip
    WHERE ip.invoice_id = i.id
-     AND ip.payment_attempt_id = :paymentAttemptId
+     AND ip.payment_id = :paymentId
 >>
 
 
diff --git a/invoice/src/main/resources/com/ning/billing/invoice/ddl.sql b/invoice/src/main/resources/com/ning/billing/invoice/ddl.sql
index b6bd51f..1af1116 100644
--- a/invoice/src/main/resources/com/ning/billing/invoice/ddl.sql
+++ b/invoice/src/main/resources/com/ning/billing/invoice/ddl.sql
@@ -48,8 +48,8 @@ CREATE TABLE invoice_payments (
     id char(36) NOT NULL,
     type varchar(24) NOT NULL,    
     invoice_id char(36) NOT NULL,
-    payment_attempt_id char(36) COLLATE utf8_bin,
-    payment_attempt_date datetime NOT NULL,
+    payment_id char(36) COLLATE utf8_bin,
+    payment_date datetime NOT NULL,
     amount numeric(10,4) NOT NULL,
     currency char(3) NOT NULL,
     payment_cookie_id char(36) DEFAULT NULL,    
@@ -59,5 +59,5 @@ CREATE TABLE invoice_payments (
     PRIMARY KEY(record_id)
 ) ENGINE=innodb;
 CREATE UNIQUE INDEX invoice_payments_id ON invoice_payments(id);
-CREATE INDEX invoice_payments_attempt ON invoice_payments(payment_attempt_id);
+CREATE INDEX invoice_payments ON invoice_payments(payment_id);
 CREATE INDEX invoice_payments_reversals ON invoice_payments(linked_invoice_payment_id);
diff --git a/invoice/src/test/java/com/ning/billing/invoice/api/MockInvoicePaymentApi.java b/invoice/src/test/java/com/ning/billing/invoice/api/MockInvoicePaymentApi.java
index a049bcf..dbd1f08 100644
--- a/invoice/src/test/java/com/ning/billing/invoice/api/MockInvoicePaymentApi.java
+++ b/invoice/src/test/java/com/ning/billing/invoice/api/MockInvoicePaymentApi.java
@@ -39,9 +39,9 @@ public class MockInvoicePaymentApi implements InvoicePaymentApi {
     }
 
     @Override
-    public void notifyOfPaymentAttempt(final InvoicePayment invoicePayment, final CallContext context) {
+    public void notifyOfPayment(final InvoicePayment invoicePayment, final CallContext context) {
         for (final InvoicePayment existingInvoicePayment : invoicePayments) {
-            if (existingInvoicePayment.getInvoiceId().equals(invoicePayment.getInvoiceId()) && existingInvoicePayment.getPaymentAttemptId().equals(invoicePayment.getPaymentAttemptId())) {
+            if (existingInvoicePayment.getInvoiceId().equals(invoicePayment.getInvoiceId()) && existingInvoicePayment.getPaymentId().equals(invoicePayment.getPaymentId())) {
                 invoicePayments.remove(existingInvoicePayment);
             }
         }
@@ -71,9 +71,9 @@ public class MockInvoicePaymentApi implements InvoicePaymentApi {
     }
 
     @Override
-    public Invoice getInvoiceForPaymentAttemptId(final UUID paymentAttemptId) {
+    public Invoice getInvoiceForPaymentId(final UUID paymentId) {
         for (final InvoicePayment invoicePayment : invoicePayments) {
-            if (invoicePayment.getPaymentAttemptId().equals(paymentAttemptId)) {
+            if (invoicePayment.getPaymentId().equals(paymentId)) {
                 return getInvoice(invoicePayment.getInvoiceId());
             }
         }
@@ -81,9 +81,9 @@ public class MockInvoicePaymentApi implements InvoicePaymentApi {
     }
 
     @Override
-    public InvoicePayment getInvoicePayment(final UUID paymentAttemptId) {
+    public InvoicePayment getInvoicePayment(final UUID paymentId) {
         for (final InvoicePayment invoicePayment : invoicePayments) {
-            if (paymentAttemptId.equals(invoicePayment.getPaymentAttemptId())) {
+            if (paymentId.equals(invoicePayment.getPaymentId())) {
                 return invoicePayment;
             }
         }
@@ -91,9 +91,9 @@ public class MockInvoicePaymentApi implements InvoicePaymentApi {
     }
 
     @Override
-    public void notifyOfPaymentAttempt(final UUID invoiceId, final BigDecimal amountOutstanding, final Currency currency, final UUID paymentAttemptId, final DateTime paymentAttemptDate, final CallContext context) {
-        final InvoicePayment invoicePayment = new DefaultInvoicePayment(InvoicePaymentType.ATTEMPT, paymentAttemptId, invoiceId, paymentAttemptDate, amountOutstanding, currency);
-        notifyOfPaymentAttempt(invoicePayment, context);
+    public void notifyOfPayment(final UUID invoiceId, final BigDecimal amountOutstanding, final Currency currency, final UUID paymentId, final DateTime paymentDate, final CallContext context) {
+        final InvoicePayment invoicePayment = new DefaultInvoicePayment(InvoicePaymentType.ATTEMPT, paymentId, invoiceId, paymentDate, amountOutstanding, currency);
+        notifyOfPayment(invoicePayment, context);
     }
 
     @Override
@@ -157,7 +157,7 @@ public class MockInvoicePaymentApi implements InvoicePaymentApi {
     }
 
     @Override
-    public List<InvoicePayment> getChargebacksByPaymentAttemptId(final UUID paymentAttemptId) {
+    public List<InvoicePayment> getChargebacksByPaymentId(final UUID paymentId) {
         throw new UnsupportedOperationException();
     }
 
@@ -167,7 +167,7 @@ public class MockInvoicePaymentApi implements InvoicePaymentApi {
     }
 
     @Override
-    public InvoicePayment createRefund(UUID paymentAttemptId,
+    public InvoicePayment createRefund(UUID paymentId,
             BigDecimal amount, boolean isInvoiceAdjusted, UUID paymentCookieId, CallContext context)
             throws InvoiceApiException {
         // TODO Auto-generated method stub
diff --git a/invoice/src/test/java/com/ning/billing/invoice/dao/MockInvoiceDao.java b/invoice/src/test/java/com/ning/billing/invoice/dao/MockInvoiceDao.java
index da91371..310b24b 100644
--- a/invoice/src/test/java/com/ning/billing/invoice/dao/MockInvoiceDao.java
+++ b/invoice/src/test/java/com/ning/billing/invoice/dao/MockInvoiceDao.java
@@ -124,11 +124,11 @@ public class MockInvoiceDao implements InvoiceDao {
     }
 
     @Override
-    public UUID getInvoiceIdByPaymentAttemptId(final UUID paymentAttemptId) {
+    public UUID getInvoiceIdByPaymentId(final UUID paymentId) {
         synchronized (monitor) {
             for (final Invoice invoice : invoices.values()) {
                 for (final InvoicePayment payment : invoice.getPayments()) {
-                    if (paymentAttemptId.equals(payment.getPaymentAttemptId())) {
+                    if (paymentId.equals(payment.getPaymentId())) {
                         return invoice.getId();
                     }
                 }
@@ -138,11 +138,11 @@ public class MockInvoiceDao implements InvoiceDao {
     }
 
     @Override
-    public InvoicePayment getInvoicePayment(final UUID paymentAttemptId) {
+    public InvoicePayment getInvoicePayment(final UUID paymentId) {
         synchronized (monitor) {
             for (final Invoice invoice : invoices.values()) {
                 for (final InvoicePayment payment : invoice.getPayments()) {
-                    if (paymentAttemptId.equals(payment.getPaymentAttemptId())) {
+                    if (paymentId.equals(payment.getPaymentId())) {
                         return payment;
                     }
                 }
@@ -153,7 +153,7 @@ public class MockInvoiceDao implements InvoiceDao {
     }
 
     @Override
-    public void notifyOfPaymentAttempt(final InvoicePayment invoicePayment, final CallContext context) {
+    public void notifyOfPayment(final InvoicePayment invoicePayment, final CallContext context) {
         synchronized (monitor) {
             final Invoice invoice = invoices.get(invoicePayment.getInvoiceId());
             if (invoice != null) {
@@ -233,7 +233,7 @@ public class MockInvoiceDao implements InvoiceDao {
     }
 
     @Override
-    public List<InvoicePayment> getChargebacksByPaymentAttemptId(final UUID paymentAttemptId) {
+    public List<InvoicePayment> getChargebacksByPaymentId(final UUID paymentId) {
         throw new UnsupportedOperationException();
     }
 
@@ -259,7 +259,7 @@ public class MockInvoiceDao implements InvoiceDao {
     }
 
     @Override
-    public InvoicePayment createRefund(UUID paymentAttemptId,
+    public InvoicePayment createRefund(UUID paymentId,
             BigDecimal amount, boolean isInvoiceAdjusted, UUID paymentCookieId, CallContext context)
             throws InvoiceApiException {
         // TODO Auto-generated method stub
diff --git a/invoice/src/test/java/com/ning/billing/invoice/dao/TestInvoiceDao.java b/invoice/src/test/java/com/ning/billing/invoice/dao/TestInvoiceDao.java
index ebeb7d0..626cb2f 100644
--- a/invoice/src/test/java/com/ning/billing/invoice/dao/TestInvoiceDao.java
+++ b/invoice/src/test/java/com/ning/billing/invoice/dao/TestInvoiceDao.java
@@ -111,9 +111,9 @@ public class TestInvoiceDao extends InvoiceDaoTestBase {
         assertEquals(savedInvoice.getInvoiceItems().size(), 1);
 
         final BigDecimal paymentAmount = new BigDecimal("11.00");
-        final UUID paymentAttemptId = UUID.randomUUID();
+        final UUID paymentId = UUID.randomUUID();
 
-        invoiceDao.notifyOfPaymentAttempt(new DefaultInvoicePayment(InvoicePaymentType.ATTEMPT,paymentAttemptId, invoiceId, clock.getUTCNow().plusDays(12), paymentAmount, Currency.USD), context);
+        invoiceDao.notifyOfPayment(new DefaultInvoicePayment(InvoicePaymentType.ATTEMPT,paymentId, invoiceId, clock.getUTCNow().plusDays(12), paymentAmount, Currency.USD), context);
 
         final Invoice retrievedInvoice = invoiceDao.getById(invoiceId);
         assertNotNull(retrievedInvoice);
@@ -130,36 +130,36 @@ public class TestInvoiceDao extends InvoiceDaoTestBase {
     }
 
     @Test(groups = {"slow"})
-    public void testAddPayment() {
+    public void testAddPayment1() {
         final UUID accountId = UUID.randomUUID();
         final DateTime targetDate = new DateTime(2011, 10, 6, 0, 0, 0, 0);
         Invoice invoice = new DefaultInvoice(accountId, clock.getUTCNow(), targetDate, Currency.USD);
 
-        final UUID paymentAttemptId = UUID.randomUUID();
-        final DateTime paymentAttemptDate = new DateTime(2011, 6, 24, 12, 14, 36, 0);
+        final UUID paymentId = UUID.randomUUID();
+        final DateTime paymentDate = new DateTime(2011, 6, 24, 12, 14, 36, 0);
         final BigDecimal paymentAmount = new BigDecimal("14.0");
 
         invoiceDao.create(invoice, context);
-        invoiceDao.notifyOfPaymentAttempt(new DefaultInvoicePayment(InvoicePaymentType.ATTEMPT, paymentAttemptId, invoice.getId(), paymentAttemptDate, paymentAmount, Currency.USD), context);
+        invoiceDao.notifyOfPayment(new DefaultInvoicePayment(InvoicePaymentType.ATTEMPT, paymentId, invoice.getId(), paymentDate, paymentAmount, Currency.USD), context);
 
         invoice = invoiceDao.getById(invoice.getId());
         assertEquals(invoice.getPaidAmount().compareTo(paymentAmount), 0);
-        assertEquals(invoice.getLastPaymentAttempt().compareTo(paymentAttemptDate), 0);
+        assertEquals(invoice.getLastPaymentDate().compareTo(paymentDate), 0);
         assertEquals(invoice.getNumberOfPayments(), 1);
     }
 
     @Test(groups = {"slow"})
-    public void testAddPaymentAttempt() {
+    public void testAddPayment2() {
         final UUID accountId = UUID.randomUUID();
         final DateTime targetDate = new DateTime(2011, 10, 6, 0, 0, 0, 0);
         Invoice invoice = new DefaultInvoice(accountId, clock.getUTCNow(), targetDate, Currency.USD);
 
-        final DateTime paymentAttemptDate = new DateTime(2011, 6, 24, 12, 14, 36, 0);
+        final DateTime paymentDate = new DateTime(2011, 6, 24, 12, 14, 36, 0);
 
         invoiceDao.create(invoice, context);
-        invoiceDao.notifyOfPaymentAttempt(new DefaultInvoicePayment(InvoicePaymentType.ATTEMPT, UUID.randomUUID(), invoice.getId(), paymentAttemptDate, invoice.getBalance(), Currency.USD), context);
+        invoiceDao.notifyOfPayment(new DefaultInvoicePayment(InvoicePaymentType.ATTEMPT, UUID.randomUUID(), invoice.getId(), paymentDate, invoice.getBalance(), Currency.USD), context);
         invoice = invoiceDao.getById(invoice.getId());
-        assertEquals(invoice.getLastPaymentAttempt().compareTo(paymentAttemptDate), 0);
+        assertEquals(invoice.getLastPaymentDate().compareTo(paymentDate), 0);
     }
 
     @Test(groups = {"slow"})
@@ -577,14 +577,14 @@ public class TestInvoiceDao extends InvoiceDaoTestBase {
         assertEquals(balance.compareTo(new BigDecimal("20.00")), 0);
 
         // Pay the whole thing
-        final UUID paymentAttemptId = UUID.randomUUID();
+        final UUID paymentId = UUID.randomUUID();
         final BigDecimal payment1 = rate1;
-        final InvoicePayment payment = new DefaultInvoicePayment(InvoicePaymentType.ATTEMPT, paymentAttemptId, invoice1.getId(), new DateTime(), payment1, Currency.USD);
+        final InvoicePayment payment = new DefaultInvoicePayment(InvoicePaymentType.ATTEMPT, paymentId, invoice1.getId(), new DateTime(), payment1, Currency.USD);
         invoicePaymentDao.create(payment, context);
         balance = invoiceDao.getAccountBalance(accountId);
         assertEquals(balance.compareTo(new BigDecimal("0.00")), 0);
 
-        invoiceDao.createRefund(paymentAttemptId, refund1, withAdjustment, UUID.randomUUID(), context);
+        invoiceDao.createRefund(paymentId, refund1, withAdjustment, UUID.randomUUID(), context);
         balance = invoiceDao.getAccountBalance(accountId);
         if (withAdjustment) {
             assertEquals(balance.compareTo(BigDecimal.ZERO), 0);
@@ -653,9 +653,9 @@ public class TestInvoiceDao extends InvoiceDaoTestBase {
         assertEquals(balance.compareTo(new BigDecimal("25.00")), 0);
 
         // Pay the whole thing
-        final UUID paymentAttemptId = UUID.randomUUID();
+        final UUID paymentId = UUID.randomUUID();
         final BigDecimal payment1 = amount1.add(rate1);
-        final InvoicePayment payment = new DefaultInvoicePayment(InvoicePaymentType.ATTEMPT, paymentAttemptId, invoice1.getId(), new DateTime(), payment1, Currency.USD);
+        final InvoicePayment payment = new DefaultInvoicePayment(InvoicePaymentType.ATTEMPT, paymentId, invoice1.getId(), new DateTime(), payment1, Currency.USD);
         invoicePaymentDao.create(payment, context);
         balance = invoiceDao.getAccountBalance(accountId);
         assertEquals(balance.compareTo(new BigDecimal("0.00")), 0);
@@ -678,7 +678,7 @@ public class TestInvoiceDao extends InvoiceDaoTestBase {
         assertEquals(cba.compareTo(new BigDecimal("10.00")), 0);
 
         // PARTIAL REFUND on the payment
-        invoiceDao.createRefund(paymentAttemptId, refundAmount, withAdjustment, UUID.randomUUID(), context);
+        invoiceDao.createRefund(paymentId, refundAmount, withAdjustment, UUID.randomUUID(), context);
 
         balance = invoiceDao.getAccountBalance(accountId);
         assertEquals(balance.compareTo(expectedFinalBalance), 0);
diff --git a/invoice/src/test/java/com/ning/billing/invoice/tests/TestChargeBacks.java b/invoice/src/test/java/com/ning/billing/invoice/tests/TestChargeBacks.java
index 114fa8d..23c31c2 100644
--- a/invoice/src/test/java/com/ning/billing/invoice/tests/TestChargeBacks.java
+++ b/invoice/src/test/java/com/ning/billing/invoice/tests/TestChargeBacks.java
@@ -202,8 +202,8 @@ public class TestChargeBacks  {
     }
 
     @Test(groups = {"slow"})
-    public void testGetChargeBacksByPaymentAttemptIdWithEmptyReturnSet() throws InvoiceApiException {
-        final List<InvoicePayment> chargebacks = invoicePaymentApi.getChargebacksByPaymentAttemptId(UUID.randomUUID());
+    public void testGetChargeBacksByPaymentIdWithEmptyReturnSet() throws InvoiceApiException {
+        final List<InvoicePayment> chargebacks = invoicePaymentApi.getChargebacksByPaymentId(UUID.randomUUID());
         assertNotNull(chargebacks);
         assertEquals(chargebacks.size(), 0);
     }
@@ -216,7 +216,7 @@ public class TestChargeBacks  {
         // create a partial charge back
         invoicePaymentApi.createChargeback(payment.getId(), FIFTEEN, context);
 
-        final List<InvoicePayment> chargebacks = invoicePaymentApi.getChargebacksByPaymentAttemptId(payment.getPaymentAttemptId());
+        final List<InvoicePayment> chargebacks = invoicePaymentApi.getChargebacksByPaymentId(payment.getPaymentId());
         assertNotNull(chargebacks);
         assertEquals(chargebacks.size(), 1);
         assertEquals(chargebacks.get(0).getLinkedInvoicePaymentId(), payment.getId());
@@ -254,13 +254,13 @@ public class TestChargeBacks  {
         zombie.addResult("getId", UUID.randomUUID());
         zombie.addResult("getType", InvoicePaymentType.ATTEMPT);
         zombie.addResult("getInvoiceId", invoiceId);
-        zombie.addResult("getPaymentAttemptId", UUID.randomUUID());
-        zombie.addResult("getPaymentAttemptDate", clock.getUTCNow());
+        zombie.addResult("getPaymentId", UUID.randomUUID());
+        zombie.addResult("getPaymentDate", clock.getUTCNow());
         zombie.addResult("getAmount", amount);
         zombie.addResult("getCurrency", CURRENCY);
         zombie.addResult("getLinkedInvoicePaymentId", BrainDeadProxyFactory.ZOMBIE_VOID);
         zombie.addResult("getPaymentCookieId", BrainDeadProxyFactory.ZOMBIE_VOID);
-        invoicePaymentApi.notifyOfPaymentAttempt(payment, context);
+        invoicePaymentApi.notifyOfPayment(payment, context);
 
         return payment;
     }
diff --git a/jaxrs/src/main/java/com/ning/billing/jaxrs/json/ChargebackJson.java b/jaxrs/src/main/java/com/ning/billing/jaxrs/json/ChargebackJson.java
index 70385a6..2cb35fc 100644
--- a/jaxrs/src/main/java/com/ning/billing/jaxrs/json/ChargebackJson.java
+++ b/jaxrs/src/main/java/com/ning/billing/jaxrs/json/ChargebackJson.java
@@ -47,7 +47,7 @@ public class ChargebackJson {
 
     public ChargebackJson(final InvoicePayment chargeback) {
         this.requestedDate = null;
-        this.effectiveDate = chargeback.getPaymentAttemptDate();
+        this.effectiveDate = chargeback.getPaymentDate();
         this.chargebackAmount = chargeback.getAmount().negate();
         this.paymentId = chargeback.getLinkedInvoicePaymentId().toString();
         this.reason = null;
diff --git a/jaxrs/src/main/java/com/ning/billing/jaxrs/resources/ChargebackResource.java b/jaxrs/src/main/java/com/ning/billing/jaxrs/resources/ChargebackResource.java
index c08c01a..5920cc2 100644
--- a/jaxrs/src/main/java/com/ning/billing/jaxrs/resources/ChargebackResource.java
+++ b/jaxrs/src/main/java/com/ning/billing/jaxrs/resources/ChargebackResource.java
@@ -59,7 +59,6 @@ public class ChargebackResource implements JaxrsResource {
 
     private final JaxrsUriBuilder uriBuilder;
     private final InvoicePaymentApi invoicePaymentApi;
-    private final PaymentApi paymentApi;
     private final Context context;
 
     @Inject
@@ -69,7 +68,6 @@ public class ChargebackResource implements JaxrsResource {
                               final Context context) {
         this.uriBuilder = uriBuilder;
         this.invoicePaymentApi = invoicePaymentApi;
-        this.paymentApi = paymentApi;
         this.context = context;
     }
 
@@ -106,20 +104,7 @@ public class ChargebackResource implements JaxrsResource {
     public Response getForPayment(@PathParam("paymentId") final String paymentId) {
 
         try {
-            final Payment payment = paymentApi.getPayment(UUID.fromString(paymentId));
-            final Collection<PaymentAttempt> attempts = Collections2.filter(payment.getAttempts(), new Predicate<PaymentAttempt>() {
-                @Override
-                public boolean apply(final PaymentAttempt input) {
-                    return input.getPaymentStatus() == PaymentStatus.SUCCESS;
-                }
-            });
-            if (attempts.size() == 0) {
-                final String error = String.format("Failed to locate successful payment attempts for paymentId %s", paymentId);
-                return Response.status(Response.Status.NO_CONTENT).entity(error).build();
-            }
-            final UUID paymentAttemptId = attempts.iterator().next().getId();
-
-            final List<InvoicePayment> chargebacks = invoicePaymentApi.getChargebacksByPaymentAttemptId(paymentAttemptId);
+            final List<InvoicePayment> chargebacks = invoicePaymentApi.getChargebacksByPaymentId(UUID.fromString(paymentId));
             if (chargebacks.size() == 0) {
                 return Response.status(Response.Status.NO_CONTENT).build();
             }
@@ -130,9 +115,6 @@ public class ChargebackResource implements JaxrsResource {
             final ChargebackCollectionJson json = new ChargebackCollectionJson(accountId, chargebacksJson);
 
             return Response.status(Response.Status.OK).entity(json).build();
-        } catch (PaymentApiException e) {
-            final String error = String.format("Failed to locate payment attempt for payment id %s", paymentId);
-            return Response.status(Response.Status.NO_CONTENT).entity(error).build();
         } catch (InvoiceApiException e) {
             final String error = String.format("Failed to locate account for payment id %s", paymentId);
             return Response.status(Response.Status.NO_CONTENT).entity(error).build();
@@ -147,24 +129,10 @@ public class ChargebackResource implements JaxrsResource {
                                      @HeaderParam(HDR_REASON) final String reason,
                                      @HeaderParam(HDR_COMMENT) final String comment) {
         try {
-            final Payment payment = paymentApi.getPayment(UUID.fromString(json.getPaymentId()));
-            final Collection<PaymentAttempt> attempts = Collections2.filter(payment.getAttempts(), new Predicate<PaymentAttempt>() {
-                @Override
-                public boolean apply(final PaymentAttempt input) {
-                    return input.getPaymentStatus() == PaymentStatus.SUCCESS;
-                }
-            });
-            if (attempts.size() == 0) {
-                final String error = String.format("Failed to locate successful payment attempts for paymentId %s", json.getPaymentId());
-                return Response.status(Response.Status.NO_CONTENT).entity(error).build();
-            }
-
-            // STEPH that does not seem to work, we need to find the correct attempt
-            final UUID paymentAttemptId = attempts.iterator().next().getId();
-            final InvoicePayment invoicePayment = invoicePaymentApi.getInvoicePayment(paymentAttemptId);
+            final InvoicePayment invoicePayment = invoicePaymentApi.getInvoicePayment(UUID.fromString(json.getPaymentId()));
             if (invoicePayment == null) {
-                final String error = String.format("Failed to locate invoice payment for paymentAttemptId %s", paymentAttemptId);
-                return Response.status(Response.Status.NO_CONTENT).entity(error).build();
+                final String error = String.format("Failed to locate invoice payment for paymentAttemptId %s", json.getPaymentId());
+                return Response.status(Response.Status.BAD_REQUEST).entity(error).build();
             }
 
             final InvoicePayment chargeBack = invoicePaymentApi.createChargeback(invoicePayment.getId(), json.getChargebackAmount(),
@@ -176,8 +144,6 @@ public class ChargebackResource implements JaxrsResource {
             return Response.status(Response.Status.BAD_REQUEST).entity(error).build();
         } catch (IllegalArgumentException e) {
             return Response.status(Response.Status.BAD_REQUEST).entity(e.getMessage()).build();
-        } catch (PaymentApiException e) {
-            return Response.status(Response.Status.BAD_REQUEST).entity(e.getMessage()).build();
         }
     }
 
diff --git a/payment/src/main/java/com/ning/billing/payment/core/PaymentProcessor.java b/payment/src/main/java/com/ning/billing/payment/core/PaymentProcessor.java
index 07c76c9..6c154fd 100644
--- a/payment/src/main/java/com/ning/billing/payment/core/PaymentProcessor.java
+++ b/payment/src/main/java/com/ning/billing/payment/core/PaymentProcessor.java
@@ -204,7 +204,6 @@ public class PaymentProcessor extends ProcessorBase {
 
     public Payment createPayment(final Account account, final UUID invoiceId, final BigDecimal inputAmount, final CallContext context, final boolean isInstantPayment)
     throws PaymentApiException {
-
         final PaymentPluginApi plugin = getPaymentProviderPlugin(account);
 
         try {
@@ -354,7 +353,7 @@ public class PaymentProcessor extends ProcessorBase {
 
     final PaymentStatus paymentStatus =  PaymentStatus.AUTO_PAY_OFF;
 
-    final PaymentModelDao paymentInfo = new PaymentModelDao(account.getId(), invoice.getId(), requestedAmount, invoice.getCurrency(), invoice.getTargetDate(), paymentStatus);
+    final PaymentModelDao paymentInfo = new PaymentModelDao(account.getId(), invoice.getId(), account.getPaymentMethodId(), requestedAmount, invoice.getCurrency(), invoice.getTargetDate(), paymentStatus);
     final PaymentAttemptModelDao attempt = new PaymentAttemptModelDao(account.getId(), invoice.getId(), paymentInfo.getId(), paymentStatus, clock.getUTCNow(), requestedAmount);
 
     paymentDao.insertPaymentWithAttempt(paymentInfo, attempt, context);
@@ -363,9 +362,10 @@ public class PaymentProcessor extends ProcessorBase {
 
 
     private Payment processNewPaymentWithAccountLocked(final PaymentPluginApi plugin, final Account account, final Invoice invoice,
-            final BigDecimal requestedAmount, final boolean isInstantPayment, final CallContext context) throws PaymentApiException {
+                                                       final BigDecimal requestedAmount, final boolean isInstantPayment, final CallContext context) throws PaymentApiException {
+
 
-        final PaymentModelDao payment = new PaymentModelDao(account.getId(), invoice.getId(), requestedAmount.setScale(2, RoundingMode.HALF_EVEN), invoice.getCurrency(), invoice.getTargetDate());
+        final PaymentModelDao payment = new PaymentModelDao(account.getId(), invoice.getId(), account.getPaymentMethodId(), requestedAmount.setScale(2, RoundingMode.HALF_EVEN), invoice.getCurrency(), invoice.getTargetDate());
         final PaymentAttemptModelDao attempt = new PaymentAttemptModelDao(account.getId(), invoice.getId(), payment.getId(), clock.getUTCNow(), requestedAmount);
 
         final PaymentModelDao savedPayment = paymentDao.insertPaymentWithAttempt(payment, attempt, context);
@@ -385,9 +385,8 @@ public class PaymentProcessor extends ProcessorBase {
 
         BusEvent event = null;
         List<PaymentAttemptModelDao> allAttempts = null;
-        PaymentAttemptModelDao lastAttempt = null;
         PaymentModelDao payment = null;
-        PaymentStatus paymentStatus = PaymentStatus.UNKNOWN;
+        PaymentStatus paymentStatus;
         try {
 
             final PaymentInfoPlugin paymentPluginInfo = plugin.processPayment(account.getExternalKey(), paymentInput.getId(), attemptInput.getRequestedAmount());
@@ -399,15 +398,14 @@ public class PaymentProcessor extends ProcessorBase {
 
                 // Fetch latest objects
                 allAttempts = paymentDao.getAttemptsForPayment(paymentInput.getId());
-                lastAttempt = allAttempts.get(allAttempts.size() - 1);
-                payment = paymentDao.getPayment(paymentInput.getId());
 
-                invoicePaymentApi.notifyOfPaymentAttempt(invoice.getId(),
-                        payment.getAmount(),
-                        paymentStatus == PaymentStatus.SUCCESS ? payment.getCurrency() : null,
-                                lastAttempt.getId(),
-                                lastAttempt.getEffectiveDate(),
-                                context);
+                payment = paymentDao.getPayment(paymentInput.getId());
+                invoicePaymentApi.notifyOfPayment(invoice.getId(),
+                                                  payment.getAmount(),
+                                                  paymentStatus == PaymentStatus.SUCCESS ? payment.getCurrency() : null,
+                                                  payment.getId(),
+                                                  payment.getEffectiveDate(),
+                                                  context);
 
                 // Create Bus event
                 event = new DefaultPaymentInfoEvent(account.getId(),
diff --git a/payment/src/main/java/com/ning/billing/payment/dao/PaymentModelDao.java b/payment/src/main/java/com/ning/billing/payment/dao/PaymentModelDao.java
index 5cb97c9..24a9f74 100644
--- a/payment/src/main/java/com/ning/billing/payment/dao/PaymentModelDao.java
+++ b/payment/src/main/java/com/ning/billing/payment/dao/PaymentModelDao.java
@@ -38,7 +38,6 @@ public class PaymentModelDao extends EntityBase {
     private final PaymentStatus paymentStatus;
     private final String extPaymentRefId;
 
-
     public PaymentModelDao(final UUID id, final UUID accountId, final UUID invoiceId, final UUID paymentMethodId,
                            final Integer paymentNumber, final BigDecimal amount, final Currency currency,
                            final PaymentStatus paymentStatus, final DateTime effectiveDate, final String extPaymentRefId) {
@@ -54,18 +53,18 @@ public class PaymentModelDao extends EntityBase {
         this.extPaymentRefId = extPaymentRefId;
     }
 
-    public PaymentModelDao(final UUID accountId, final UUID invoiceId,
+    public PaymentModelDao(final UUID accountId, final UUID invoiceId, final UUID paymentMethodId,
             final BigDecimal amount, final Currency currency, final DateTime effectiveDate, final PaymentStatus paymentStatus) {
-        this(UUID.randomUUID(), accountId, invoiceId, null, INVALID_PAYMENT_NUMBER, amount, currency, paymentStatus, effectiveDate, null);
+        this(UUID.randomUUID(), accountId, invoiceId, paymentMethodId, INVALID_PAYMENT_NUMBER, amount, currency, paymentStatus, effectiveDate, null);
     }
 
-    public PaymentModelDao(final UUID accountId, final UUID invoiceId,
+    public PaymentModelDao(final UUID accountId, final UUID invoiceId, final UUID paymentMethodId,
             final BigDecimal amount, final Currency currency, final DateTime effectiveDate) {
-        this(UUID.randomUUID(), accountId, invoiceId, null, INVALID_PAYMENT_NUMBER, amount, currency, PaymentStatus.UNKNOWN, effectiveDate, null);
+        this(UUID.randomUUID(), accountId, invoiceId, paymentMethodId, INVALID_PAYMENT_NUMBER, amount, currency, PaymentStatus.UNKNOWN, effectiveDate, null);
     }
 
     public PaymentModelDao(final PaymentModelDao src, final PaymentStatus newPaymentStatus) {
-        this(src.getId(), src.getAccountId(), src.getInvoiceId(), null, src.getPaymentNumber(), src.getAmount(), src.getCurrency(), newPaymentStatus, src.getEffectiveDate(), null);
+        this(src.getId(), src.getAccountId(), src.getInvoiceId(), src.getPaymentMethodId(), src.getPaymentNumber(), src.getAmount(), src.getCurrency(), newPaymentStatus, src.getEffectiveDate(), null);
     }
 
     public UUID getAccountId() {
diff --git a/payment/src/main/java/com/ning/billing/payment/dao/PaymentSqlDao.java b/payment/src/main/java/com/ning/billing/payment/dao/PaymentSqlDao.java
index 9d88b8f..7946673 100644
--- a/payment/src/main/java/com/ning/billing/payment/dao/PaymentSqlDao.java
+++ b/payment/src/main/java/com/ning/billing/payment/dao/PaymentSqlDao.java
@@ -82,7 +82,7 @@ public interface PaymentSqlDao extends Transactional<PaymentSqlDao>, UpdatableEn
             stmt.bind("id", payment.getId().toString());
             stmt.bind("accountId", payment.getAccountId().toString());
             stmt.bind("invoiceId", payment.getInvoiceId().toString());
-            stmt.bind("paymentMethodId", "");
+            stmt.bind("paymentMethodId", payment.getPaymentMethodId().toString());
             stmt.bind("amount", payment.getAmount());
             stmt.bind("currency", payment.getCurrency().toString());
             stmt.bind("effectiveDate", getDate(payment.getEffectiveDate()));
@@ -99,7 +99,7 @@ public interface PaymentSqlDao extends Transactional<PaymentSqlDao>, UpdatableEn
             final UUID id = getUUID(rs, "id");
             final UUID accountId = getUUID(rs, "account_id");
             final UUID invoiceId = getUUID(rs, "invoice_id");
-            final UUID paymentMethodId = null; //getUUID(rs, "payment_method_id"); // STEPH needs to be fixed!
+            final UUID paymentMethodId = getUUID(rs, "payment_method_id");
             final Integer paymentNumber = rs.getInt("payment_number");
             final BigDecimal amount = rs.getBigDecimal("amount");
             final DateTime effectiveDate = getDate(rs, "effective_date");
diff --git a/payment/src/test/java/com/ning/billing/payment/api/TestPaymentApi.java b/payment/src/test/java/com/ning/billing/payment/api/TestPaymentApi.java
index df8ef98..6e33f2d 100644
--- a/payment/src/test/java/com/ning/billing/payment/api/TestPaymentApi.java
+++ b/payment/src/test/java/com/ning/billing/payment/api/TestPaymentApi.java
@@ -64,7 +64,6 @@ import static org.testng.Assert.fail;
 @Guice(modules = {PaymentTestModuleWithMocks.class, MockClockModule.class, MockJunctionModule.class, CallContextModule.class})
 @Test(groups = "fast")
 public class TestPaymentApi {
-
     private static final Logger log = LoggerFactory.getLogger(TestPaymentApi.class);
 
     @Inject
@@ -82,7 +81,6 @@ public class TestPaymentApi {
 
     private Account account;
 
-
     @Inject
     public TestPaymentApi(final Clock clock) {
         context = new DefaultCallContext("Payment Tests", CallOrigin.INTERNAL, UserType.SYSTEM, clock);
@@ -103,8 +101,7 @@ public class TestPaymentApi {
         eventBus.stop();
     }
 
-
-    @Test(enabled = true)
+    @Test
     public void testSimplePaymentWithNoAmount() throws Exception {
         final BigDecimal invoiceAmount = new BigDecimal("10.0011");
         final BigDecimal requestedAmount = null;
@@ -113,7 +110,7 @@ public class TestPaymentApi {
         testSimplePayment(invoiceAmount, requestedAmount, expectedAmount);
     }
 
-    @Test(enabled = true)
+    @Test
     public void testSimplePaymentWithInvoiceAmount() throws Exception {
         final BigDecimal invoiceAmount = new BigDecimal("10.0011");
         final BigDecimal requestedAmount = invoiceAmount;
@@ -122,7 +119,7 @@ public class TestPaymentApi {
         testSimplePayment(invoiceAmount, requestedAmount, expectedAmount);
     }
 
-    @Test(enabled = true)
+    @Test
     public void testSimplePaymentWithLowerAmount() throws Exception {
         final BigDecimal invoiceAmount = new BigDecimal("10.0011");
         final BigDecimal requestedAmount = new BigDecimal("8.0091");
@@ -131,7 +128,7 @@ public class TestPaymentApi {
         testSimplePayment(invoiceAmount, requestedAmount, expectedAmount);
     }
 
-    @Test(enabled = true)
+    @Test
     public void testSimplePaymentWithInvalidAmount() throws Exception {
         final BigDecimal invoiceAmount = new BigDecimal("10.0011");
         final BigDecimal requestedAmount = new BigDecimal("80.0091");
@@ -140,10 +137,8 @@ public class TestPaymentApi {
         testSimplePayment(invoiceAmount, requestedAmount, expectedAmount);
     }
 
-
     private void testSimplePayment(final BigDecimal invoiceAmount, final BigDecimal requestedAmount, final BigDecimal expectedAmount) throws Exception {
-
-        ((ZombieControl) invoicePaymentApi).addResult("notifyOfPaymentAttempt", BrainDeadProxyFactory.ZOMBIE_VOID);
+        ((ZombieControl) invoicePaymentApi).addResult("notifyOfPayment", BrainDeadProxyFactory.ZOMBIE_VOID);
 
         final DateTime now = new DateTime(DateTimeZone.UTC);
         final Invoice invoice = testHelper.createTestInvoice(account, now, Currency.USD);
@@ -151,7 +146,6 @@ public class TestPaymentApi {
         final UUID subscriptionId = UUID.randomUUID();
         final UUID bundleId = UUID.randomUUID();
 
-
         invoice.addInvoiceItem(new MockRecurringInvoiceItem(invoice.getId(), account.getId(),
                                                             subscriptionId,
                                                             bundleId,
@@ -188,17 +182,14 @@ public class TestPaymentApi {
         }
     }
 
-    @Test(enabled = true)
+    @Test
     public void testPaymentMethods() throws Exception {
-
         List<PaymentMethod> methods = paymentApi.getPaymentMethods(account, false);
         assertEquals(methods.size(), 1);
 
         final PaymentMethod initDefaultMethod = methods.get(0);
         assertEquals(initDefaultMethod.getId(), account.getPaymentMethodId());
 
-
-        //((ZombieControl)accountApi).addResult("updateAccount", );
         final PaymentMethodPlugin newPaymenrMethod = new DefaultNoOpPaymentMethodPlugin(UUID.randomUUID().toString(), true, null);
         final UUID newPaymentMethodId = paymentApi.addPaymentMethod(PaymentTestModuleWithMocks.PLUGIN_TEST_NAME, account, true, newPaymenrMethod, context);
         ((ZombieControl) account).addResult("getPaymentMethodId", newPaymentMethodId);
@@ -220,6 +211,4 @@ public class TestPaymentApi {
         methods = paymentApi.getPaymentMethods(account, false);
         assertEquals(methods.size(), 1);
     }
-
-
 }
diff --git a/payment/src/test/java/com/ning/billing/payment/dao/TestPaymentDao.java b/payment/src/test/java/com/ning/billing/payment/dao/TestPaymentDao.java
index 6ac63c3..1af7d2c 100644
--- a/payment/src/test/java/com/ning/billing/payment/dao/TestPaymentDao.java
+++ b/payment/src/test/java/com/ning/billing/payment/dao/TestPaymentDao.java
@@ -144,16 +144,16 @@ public class TestPaymentDao {
     }
 
 
-    @Test(groups = {"slow"})
+    @Test(groups = "slow")
     public void testUpdateStatus() {
-
         final UUID accountId = UUID.randomUUID();
         final UUID invoiceId = UUID.randomUUID();
+        final UUID paymentMethodId = UUID.randomUUID();
         final BigDecimal amount = new BigDecimal(13);
         final Currency currency = Currency.USD;
         final DateTime effectiveDate = clock.getUTCNow();
 
-        final PaymentModelDao payment = new PaymentModelDao(accountId, invoiceId, amount, currency, effectiveDate);
+        final PaymentModelDao payment = new PaymentModelDao(accountId, invoiceId, paymentMethodId, amount, currency, effectiveDate);
         final PaymentAttemptModelDao attempt = new PaymentAttemptModelDao(accountId, invoiceId, payment.getId(), clock.getUTCNow(), amount);
         PaymentModelDao savedPayment = paymentDao.insertPaymentWithAttempt(payment, attempt, context);
 
@@ -168,7 +168,7 @@ public class TestPaymentDao {
         assertEquals(savedPayment.getId(), payment.getId());
         assertEquals(savedPayment.getAccountId(), accountId);
         assertEquals(savedPayment.getInvoiceId(), invoiceId);
-        assertEquals(savedPayment.getPaymentMethodId(), null);
+        assertEquals(savedPayment.getPaymentMethodId(), paymentMethodId);
         assertEquals(savedPayment.getAmount().compareTo(amount), 0);
         assertEquals(savedPayment.getCurrency(), currency);
         assertEquals(savedPayment.getEffectiveDate().compareTo(effectiveDate), 0);
@@ -186,23 +186,23 @@ public class TestPaymentDao {
         assertEquals(savedAttempt.getRequestedAmount().compareTo(amount), 0);
     }
 
-    @Test(groups = {"slow"})
+    @Test(groups = "slow")
     public void testPaymentWithAttempt() {
-
         final UUID accountId = UUID.randomUUID();
         final UUID invoiceId = UUID.randomUUID();
+        final UUID paymentMethodId = UUID.randomUUID();
         final BigDecimal amount = new BigDecimal(13);
         final Currency currency = Currency.USD;
         final DateTime effectiveDate = clock.getUTCNow();
 
-        final PaymentModelDao payment = new PaymentModelDao(accountId, invoiceId, amount, currency, effectiveDate);
+        final PaymentModelDao payment = new PaymentModelDao(accountId, invoiceId, paymentMethodId, amount, currency, effectiveDate);
         final PaymentAttemptModelDao attempt = new PaymentAttemptModelDao(accountId, invoiceId, payment.getId(), clock.getUTCNow(), amount);
 
         PaymentModelDao savedPayment = paymentDao.insertPaymentWithAttempt(payment, attempt, context);
         assertEquals(savedPayment.getId(), payment.getId());
         assertEquals(savedPayment.getAccountId(), accountId);
         assertEquals(savedPayment.getInvoiceId(), invoiceId);
-        assertEquals(savedPayment.getPaymentMethodId(), null);
+        assertEquals(savedPayment.getPaymentMethodId(), paymentMethodId);
         assertEquals(savedPayment.getAmount().compareTo(amount), 0);
         assertEquals(savedPayment.getCurrency(), currency);
         assertEquals(savedPayment.getEffectiveDate().compareTo(effectiveDate), 0);
@@ -222,7 +222,7 @@ public class TestPaymentDao {
         assertEquals(savedPayment.getId(), payment.getId());
         assertEquals(savedPayment.getAccountId(), accountId);
         assertEquals(savedPayment.getInvoiceId(), invoiceId);
-        assertEquals(savedPayment.getPaymentMethodId(), null);
+        assertEquals(savedPayment.getPaymentMethodId(), paymentMethodId);
         assertEquals(savedPayment.getAmount().compareTo(amount), 0);
         assertEquals(savedPayment.getCurrency(), currency);
         assertEquals(savedPayment.getEffectiveDate().compareTo(effectiveDate), 0);
@@ -243,11 +243,12 @@ public class TestPaymentDao {
     public void testNewAttempt() {
         final UUID accountId = UUID.randomUUID();
         final UUID invoiceId = UUID.randomUUID();
+        final UUID paymentMethodId = UUID.randomUUID();
         final BigDecimal amount = new BigDecimal(13);
         final Currency currency = Currency.USD;
         final DateTime effectiveDate = clock.getUTCNow();
 
-        final PaymentModelDao payment = new PaymentModelDao(accountId, invoiceId, amount, currency, effectiveDate);
+        final PaymentModelDao payment = new PaymentModelDao(accountId, invoiceId, paymentMethodId, amount, currency, effectiveDate);
         final PaymentAttemptModelDao firstAttempt = new PaymentAttemptModelDao(accountId, invoiceId, payment.getId(), clock.getUTCNow(), amount);
         PaymentModelDao savedPayment = paymentDao.insertPaymentWithAttempt(payment, firstAttempt, context);
 
@@ -261,7 +262,7 @@ public class TestPaymentDao {
         assertEquals(savedPayment.getId(), payment.getId());
         assertEquals(savedPayment.getAccountId(), accountId);
         assertEquals(savedPayment.getInvoiceId(), invoiceId);
-        assertEquals(savedPayment.getPaymentMethodId(), null);
+        assertEquals(savedPayment.getPaymentMethodId(), paymentMethodId);
         assertEquals(savedPayment.getAmount().compareTo(newAmount), 0);
         assertEquals(savedPayment.getCurrency(), currency);
         assertEquals(savedPayment.getEffectiveDate().compareTo(effectiveDate), 0);
diff --git a/payment/src/test/java/com/ning/billing/payment/MockInvoice.java b/payment/src/test/java/com/ning/billing/payment/MockInvoice.java
index d87dfb1..5443dcf 100644
--- a/payment/src/test/java/com/ning/billing/payment/MockInvoice.java
+++ b/payment/src/test/java/com/ning/billing/payment/MockInvoice.java
@@ -150,21 +150,21 @@ public class MockInvoice extends EntityBase implements Invoice {
     }
 
     @Override
-    public DateTime getLastPaymentAttempt() {
-        DateTime lastPaymentAttempt = null;
+    public DateTime getLastPaymentDate() {
+        DateTime lastPayment = null;
 
-        for (final InvoicePayment paymentAttempt : payments) {
-            final DateTime paymentAttemptDate = paymentAttempt.getPaymentAttemptDate();
-            if (lastPaymentAttempt == null) {
-                lastPaymentAttempt = paymentAttemptDate;
+        for (final InvoicePayment payment : payments) {
+            final DateTime paymentDate = payment.getPaymentDate();
+            if (lastPayment == null) {
+                lastPayment = paymentDate;
             }
 
-            if (lastPaymentAttempt.isBefore(paymentAttemptDate)) {
-                lastPaymentAttempt = paymentAttemptDate;
+            if (lastPayment.isBefore(paymentDate)) {
+                lastPayment = paymentDate;
             }
         }
 
-        return lastPaymentAttempt;
+        return lastPayment;
     }
 
     @Override
@@ -213,7 +213,7 @@ public class MockInvoice extends EntityBase implements Invoice {
             return false;
         }
 
-        final DateTime lastPaymentAttempt = getLastPaymentAttempt();
+        final DateTime lastPaymentAttempt = getLastPaymentDate();
         if (lastPaymentAttempt == null) {
             return true;
         }
@@ -223,24 +223,21 @@ public class MockInvoice extends EntityBase implements Invoice {
 
     @Override
     public String toString() {
-        return "DefaultInvoice [items=" + invoiceItems + ", payments=" + payments + ", id=" + id + ", accountId=" + accountId + ", invoiceDate=" + invoiceDate + ", targetDate=" + targetDate + ", currency=" + currency + ", amountPaid=" + getPaidAmount() + ", lastPaymentAttempt=" + getLastPaymentAttempt() + "]";
+        return "DefaultInvoice [items=" + invoiceItems + ", payments=" + payments + ", id=" + id + ", accountId=" + accountId + ", invoiceDate=" + invoiceDate + ", targetDate=" + targetDate + ", currency=" + currency + ", amountPaid=" + getPaidAmount() + ", lastPaymentDate=" + getLastPaymentDate() + "]";
     }
 
     @Override
     public BigDecimal getCBAAmount() {
-        // TODO Auto-generated method stub
         return null;
     }
 
     @Override
     public BigDecimal getTotalAdjAmount() {
-        // TODO Auto-generated method stub
         return null;
     }
 
     @Override
     public BigDecimal getRefundAdjAmount() {
-        // TODO Auto-generated method stub
         return null;
     }
 }
diff --git a/payment/src/test/java/com/ning/billing/payment/TestRetryService.java b/payment/src/test/java/com/ning/billing/payment/TestRetryService.java
index b9ab5d0..957ce75 100644
--- a/payment/src/test/java/com/ning/billing/payment/TestRetryService.java
+++ b/payment/src/test/java/com/ning/billing/payment/TestRetryService.java
@@ -104,7 +104,7 @@ public class TestRetryService {
         mockPaymentProviderPlugin.clear();
 
         context = new DefaultCallContext("RetryServiceTests", CallOrigin.INTERNAL, UserType.TEST, clock);
-        ((ZombieControl) invoicePaymentApi).addResult("notifyOfPaymentAttempt", BrainDeadProxyFactory.ZOMBIE_VOID);
+        ((ZombieControl) invoicePaymentApi).addResult("notifyOfPayment", BrainDeadProxyFactory.ZOMBIE_VOID);
     }
 
     @AfterMethod(groups = "fast")
diff --git a/util/src/main/java/com/ning/billing/util/template/translation/DefaultCatalogTranslator.java b/util/src/main/java/com/ning/billing/util/template/translation/DefaultCatalogTranslator.java
index a6027f5..f1b0ef7 100644
--- a/util/src/main/java/com/ning/billing/util/template/translation/DefaultCatalogTranslator.java
+++ b/util/src/main/java/com/ning/billing/util/template/translation/DefaultCatalogTranslator.java
@@ -26,7 +26,7 @@ public class DefaultCatalogTranslator extends DefaultTranslatorBase {
 
     @Override
     protected String getBundlePath() {
-        return "com/ning/billing/util/template/translation/CatalogTranslation";
+        return config.getCatalogBundlePath();
     }
 
     @Override
diff --git a/util/src/main/java/com/ning/billing/util/template/translation/DefaultTranslatorBase.java b/util/src/main/java/com/ning/billing/util/template/translation/DefaultTranslatorBase.java
index 2b3f62e..72d3d90 100644
--- a/util/src/main/java/com/ning/billing/util/template/translation/DefaultTranslatorBase.java
+++ b/util/src/main/java/com/ning/billing/util/template/translation/DefaultTranslatorBase.java
@@ -55,6 +55,11 @@ public abstract class DefaultTranslatorBase implements Translator {
         if ((bundle != null) && (bundle.containsKey(originalText))) {
             return bundle.getString(originalText);
         } else {
+            if (config.getDefaultLocale() == null) {
+                log.warn(String.format(ErrorCode.MISSING_DEFAULT_TRANSLATION_RESOURCE.toString(), getTranslationType()));
+                return originalText;
+            }
+
             final Locale defaultLocale = new Locale(config.getDefaultLocale());
             try {
                 bundle = getBundle(defaultLocale, bundlePath);
@@ -102,6 +107,8 @@ public abstract class DefaultTranslatorBase implements Translator {
             } else {
                 return new PropertyResourceBundle(inputStream);
             }
+        } catch (IllegalArgumentException iae) {
+            return null;
         } catch (MissingResourceException mrex) {
             return null;
         } catch (URISyntaxException e) {
diff --git a/util/src/test/java/com/ning/billing/mock/glue/MockInvoiceModule.java b/util/src/test/java/com/ning/billing/mock/glue/MockInvoiceModule.java
index 5c34b36..90e41c4 100644
--- a/util/src/test/java/com/ning/billing/mock/glue/MockInvoiceModule.java
+++ b/util/src/test/java/com/ning/billing/mock/glue/MockInvoiceModule.java
@@ -53,5 +53,4 @@ public class MockInvoiceModule extends AbstractModule implements InvoiceModule {
         installInvoiceMigrationApi();
         installInvoiceTestApi();
     }
-
 }
diff --git a/util/src/test/java/com/ning/billing/util/email/DefaultCatalogTranslationTest.java b/util/src/test/java/com/ning/billing/util/email/DefaultCatalogTranslationTest.java
index d092a5a..529616e 100644
--- a/util/src/test/java/com/ning/billing/util/email/DefaultCatalogTranslationTest.java
+++ b/util/src/test/java/com/ning/billing/util/email/DefaultCatalogTranslationTest.java
@@ -29,7 +29,6 @@ import com.ning.billing.util.template.translation.TranslatorConfig;
 
 import static org.testng.Assert.assertEquals;
 
-@Test(groups = {"fast", "email"})
 public class DefaultCatalogTranslationTest {
     private Translator translation;
 
@@ -49,49 +48,49 @@ public class DefaultCatalogTranslationTest {
         translation = new DefaultCatalogTranslator(config);
     }
 
-    @Test(groups = {"fast", "email"}, enabled = false)
+    @Test(groups = "fast")
     public void testInitialization() {
-        final String ningPlusText = "ning-plus";
-        final String ningProText = "ning-pro";
+        final String shotgunMonthly = "shotgun-monthly";
+        final String shotgunAnnual = "shotgun-annual";
         final String badText = "Bad text";
 
-        assertEquals(translation.getTranslation(Locale.US, ningPlusText), "Plus");
-        assertEquals(translation.getTranslation(Locale.US, ningProText), "Pro");
+        assertEquals(translation.getTranslation(Locale.US, shotgunMonthly), "Monthly shotgun plan");
+        assertEquals(translation.getTranslation(Locale.US, shotgunAnnual), "Annual shotgun plan");
         assertEquals(translation.getTranslation(Locale.US, badText), badText);
 
-        assertEquals(translation.getTranslation(Locale.CANADA_FRENCH, ningPlusText), "Plus en francais");
-        assertEquals(translation.getTranslation(Locale.CANADA_FRENCH, ningProText), "Pro");
+        assertEquals(translation.getTranslation(Locale.CANADA_FRENCH, shotgunMonthly), "Fusil de chasse mensuel");
+        assertEquals(translation.getTranslation(Locale.CANADA_FRENCH, shotgunAnnual), "Fusil de chasse annuel");
         assertEquals(translation.getTranslation(Locale.CANADA_FRENCH, badText), badText);
 
-        assertEquals(translation.getTranslation(Locale.CHINA, ningPlusText), "Plus");
-        assertEquals(translation.getTranslation(Locale.CHINA, ningProText), "Pro");
+        assertEquals(translation.getTranslation(Locale.CHINA, shotgunMonthly), "Monthly shotgun plan");
+        assertEquals(translation.getTranslation(Locale.CHINA, shotgunAnnual), "Annual shotgun plan");
         assertEquals(translation.getTranslation(Locale.CHINA, badText), badText);
     }
 
-    @Test(enabled = false)
+    @Test(groups = "fast")
     public void testExistingTranslation() {
-        // if the translation exists, return the translation
-        final String originalText = "ning-plus";
-        assertEquals(translation.getTranslation(Locale.US, originalText), "Plus");
+        // If the translation exists, return the translation
+        final String originalText = "shotgun-monthly";
+        assertEquals(translation.getTranslation(Locale.US, originalText), "Monthly shotgun plan");
     }
 
-    @Test
+    @Test(groups = "fast")
     public void testMissingTranslation() {
-        // if the translation is missing from the file, return the original text
+        // If the translation is missing from the file, return the original text
         final String originalText = "missing translation";
         assertEquals(translation.getTranslation(Locale.US, originalText), originalText);
     }
 
-    @Test(enabled = false)
+    @Test(groups = "fast")
     public void testMissingTranslationFileWithEnglishText() {
-        // if the translation file doesn't exist, return the "English" translation
-        final String originalText = "ning-plus";
-        assertEquals(translation.getTranslation(Locale.CHINA, originalText), "Plus");
+        // If the translation file doesn't exist, return the "English" translation
+        final String originalText = "shotgun-monthly";
+        assertEquals(translation.getTranslation(Locale.CHINA, originalText), "Monthly shotgun plan");
     }
 
-    @Test
+    @Test(groups = "fast")
     public void testMissingFileAndText() {
-        // if the file is missing, and the "English" translation is missing, return the original text
+        // If the file is missing, and the "English" translation is missing, return the original text
         final String originalText = "missing translation";
         assertEquals(translation.getTranslation(Locale.CHINA, originalText), originalText);
     }
diff --git a/util/src/test/java/com/ning/billing/util/template/translation/TestDefaultTranslatorBase.java b/util/src/test/java/com/ning/billing/util/template/translation/TestDefaultTranslatorBase.java
new file mode 100644
index 0000000..d379804
--- /dev/null
+++ b/util/src/test/java/com/ning/billing/util/template/translation/TestDefaultTranslatorBase.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2010-2012 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.util.template.translation;
+
+import java.util.Locale;
+import java.util.UUID;
+
+import org.mockito.Mockito;
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+public class TestDefaultTranslatorBase {
+    private final class TestTranslatorBase extends DefaultTranslatorBase {
+        public TestTranslatorBase(final TranslatorConfig config) {
+            super(config);
+        }
+
+        @Override
+        protected String getBundlePath() {
+            return UUID.randomUUID().toString();
+        }
+
+        @Override
+        protected String getTranslationType() {
+            return UUID.randomUUID().toString();
+        }
+    }
+
+    @Test(groups = "fast")
+    public void testResourceDoesNotExist() throws Exception {
+        final TestTranslatorBase translator = new TestTranslatorBase(Mockito.mock(TranslatorConfig.class));
+        final String originalText = UUID.randomUUID().toString();
+        Assert.assertEquals(translator.getTranslation(Locale.FRANCE, originalText), originalText);
+    }
+}
diff --git a/util/src/test/resources/com/ning/billing/util/template/translation/CatalogTranslation_en_US.properties b/util/src/test/resources/com/ning/billing/util/template/translation/CatalogTranslation_en_US.properties
new file mode 100644
index 0000000..0bde4ee
--- /dev/null
+++ b/util/src/test/resources/com/ning/billing/util/template/translation/CatalogTranslation_en_US.properties
@@ -0,0 +1,2 @@
+shotgun-monthly = Monthly shotgun plan
+shotgun-annual = Annual shotgun plan
\ No newline at end of file
diff --git a/util/src/test/resources/com/ning/billing/util/template/translation/CatalogTranslation_fr_CA.properties b/util/src/test/resources/com/ning/billing/util/template/translation/CatalogTranslation_fr_CA.properties
new file mode 100644
index 0000000..2415908
--- /dev/null
+++ b/util/src/test/resources/com/ning/billing/util/template/translation/CatalogTranslation_fr_CA.properties
@@ -0,0 +1,2 @@
+shotgun-monthly = Fusil de chasse mensuel
+shotgun-annual = Fusil de chasse annuel
\ No newline at end of file