killbill-aplcache

Changes

Details

diff --git a/api/src/main/java/com/ning/billing/ErrorCode.java b/api/src/main/java/com/ning/billing/ErrorCode.java
index 3189e64..10d4d2a 100644
--- a/api/src/main/java/com/ning/billing/ErrorCode.java
+++ b/api/src/main/java/com/ning/billing/ErrorCode.java
@@ -227,7 +227,8 @@ public enum ErrorCode {
     PAYMENT_CREATE_PAYMENT_FOR_ATTEMPT_BAD(7011, "Failed to create payment for attempts %s "),                    
     PAYMENT_CREATE_PAYMENT_PROVIDER_ACCOUNT(7012, "Failed to create payment provider account for account %s : %s"),                
     PAYMENT_UPD_PAYMENT_PROVIDER_ACCOUNT(7013, "Failed to update payment provider account for account %s : %s"),                    
-    PAYMENT_CREATE_REFUND(7014, "Failed to create refund for account %s : %s"),                
+    PAYMENT_CREATE_REFUND(7014, "Failed to create refund for account %s : %s"),
+    PAYMENT_ATTEMPT_NOT_FOUND_FOR_PAYMENT_ID(7015, "Failed to find payment attempt for payment id %s."),
     
     /*
     *
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 bd9b94a..debc1d6 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
@@ -52,7 +52,7 @@ public interface InvoicePaymentApi {
 
     public List<InvoicePayment> getChargebacksByAccountId(UUID accountId);
 
-    public List<InvoicePayment> getChargebacksByInvoicePaymentId(UUID paymentId);
+    public UUID getAccountIdFromInvoicePaymentId(UUID uuid) throws InvoiceApiException;
 
-    UUID getAccountIdFromInvoicePaymentId(UUID uuid) throws InvoiceApiException;
+    public List<InvoicePayment> getChargebacksByPaymentAttemptId(UUID paymentAttemptId);
 }
diff --git a/api/src/main/java/com/ning/billing/payment/api/PaymentApi.java b/api/src/main/java/com/ning/billing/payment/api/PaymentApi.java
index dd70874..f352b89 100644
--- a/api/src/main/java/com/ning/billing/payment/api/PaymentApi.java
+++ b/api/src/main/java/com/ning/billing/payment/api/PaymentApi.java
@@ -62,7 +62,7 @@ public interface PaymentApi {
     public String createPaymentProviderAccount(final Account account, final CallContext context)
         throws PaymentApiException;
 
-    public void updatePaymentProviderAccountContact(String accountKey, CallContext context)
+    public void updatePaymentProviderAccountContact(final String accountKey, final CallContext context)
         throws PaymentApiException;
 
     public PaymentAttempt getPaymentAttemptForPaymentId(final UUID id)
@@ -79,4 +79,6 @@ public interface PaymentApi {
 
     public PaymentInfoEvent getPaymentInfoForPaymentAttemptId(final UUID paymentAttemptId)
         throws PaymentApiException;
+
+    public UUID getPaymentAttemptIdFromPaymentId(final UUID paymentId) throws PaymentApiException;
 }
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 c0f04e3..4fec185 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
@@ -103,8 +103,8 @@ public class DefaultInvoicePaymentApi implements InvoicePaymentApi {
     }
 
     @Override
-    public List<InvoicePayment> getChargebacksByInvoicePaymentId(UUID paymentId) {
-        return dao.getChargebacksByPaymentId(paymentId);
+    public List<InvoicePayment> getChargebacksByPaymentAttemptId(UUID paymentAttemptId) {
+        return dao.getChargebacksByPaymentAttemptId(paymentAttemptId);
     }
 
     @Override
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 ac53c7b..b567533 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
@@ -302,8 +302,8 @@ public class DefaultInvoiceDao implements InvoiceDao {
     }
 
     @Override
-    public List<InvoicePayment> getChargebacksByPaymentId(final UUID paymentId) {
-        return invoicePaymentSqlDao.getChargebacksByPaymentId(paymentId.toString());
+    public List<InvoicePayment> getChargebacksByPaymentAttemptId(final UUID paymentAttemptId) {
+        return invoicePaymentSqlDao.getChargebacksByAttemptPaymentId(paymentAttemptId.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 9a5e58b..1c7fbc8 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
@@ -65,5 +65,5 @@ public interface InvoiceDao {
 
     List<InvoicePayment> getChargebacksByAccountId(final UUID accountId);
 
-    List<InvoicePayment> getChargebacksByPaymentId(final UUID paymentId);
+    List<InvoicePayment> getChargebacksByPaymentAttemptId(final UUID paymentAttemptId);
 }
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 9fe5c2b..69c4c2a 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
@@ -95,7 +95,7 @@ public interface InvoicePaymentSqlDao extends EntitySqlDao<InvoicePayment>, Tran
     List<InvoicePayment> getChargeBacksByAccountId(@Bind("accountId") final String accountId);
 
     @SqlQuery
-    List<InvoicePayment> getChargebacksByPaymentId(@Bind("invoicePaymentId") final String paymentId);
+    List<InvoicePayment> getChargebacksByAttemptPaymentId(@Bind("paymentAttemptId") final String paymentAttemptId);
 
     public static class InvoicePaymentMapper extends MapperBase implements ResultSetMapper<InvoicePayment> {
         @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 349d462..3773a1c 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
@@ -113,9 +113,10 @@ getChargeBacksByAccountId() ::= <<
     AND reversed_invoice_payment_id IS NOT NULL;
 >>
 
-getChargebacksByPaymentId() ::= <<
+getChargebacksByAttemptPaymentId() ::= <<
     SELECT <invoicePaymentFields()>
     FROM invoice_payments
-    WHERE reversed_invoice_payment_id = :invoicePaymentId;
+    WHERE reversed_invoice_payment_id IN
+        (SELECT id FROM invoice_payments WHERE payment_attempt_id = :paymentAttemptId);
 >>
 ;
\ No newline at end of file
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 76e1bf3..274976d 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
@@ -152,12 +152,12 @@ public class MockInvoicePaymentApi implements InvoicePaymentApi
     }
 
     @Override
-    public List<InvoicePayment> getChargebacksByInvoicePaymentId(UUID paymentId) {
+    public UUID getAccountIdFromInvoicePaymentId(UUID uuid) throws InvoiceApiException {
         throw new UnsupportedOperationException();
     }
 
     @Override
-    public UUID getAccountIdFromInvoicePaymentId(UUID uuid) throws InvoiceApiException {
+    public List<InvoicePayment> getChargebacksByPaymentAttemptId(UUID paymentAttemptId) {
         throw new UnsupportedOperationException();
     }
 }
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 f6681fb..17a28ab 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
@@ -233,7 +233,7 @@ public class MockInvoiceDao implements InvoiceDao {
     }
 
     @Override
-    public List<InvoicePayment> getChargebacksByPaymentId(UUID paymentId) {
+    public List<InvoicePayment> getChargebacksByPaymentAttemptId(UUID paymentAttemptId) {
         throw new UnsupportedOperationException();
     }
 }
diff --git a/invoice/src/test/java/com/ning/billing/invoice/tests/ChargeBackTests.java b/invoice/src/test/java/com/ning/billing/invoice/tests/ChargeBackTests.java
index 3b60b5b..6eac0dc 100644
--- a/invoice/src/test/java/com/ning/billing/invoice/tests/ChargeBackTests.java
+++ b/invoice/src/test/java/com/ning/billing/invoice/tests/ChargeBackTests.java
@@ -157,8 +157,8 @@ public class ChargeBackTests {
     }
 
     @Test
-    public void testGetChargeBacksByInvoicePaymentIdWithEmptyReturnSet() throws InvoiceApiException {
-        List<InvoicePayment> chargebacks = invoicePaymentApi.getChargebacksByInvoicePaymentId(UUID.randomUUID());
+    public void testGetChargeBacksByPaymentAttemptIdWithEmptyReturnSet() throws InvoiceApiException {
+        List<InvoicePayment> chargebacks = invoicePaymentApi.getChargebacksByPaymentAttemptId(UUID.randomUUID());
         assertNotNull(chargebacks);
         assertEquals(chargebacks.size(), 0);
     }
@@ -171,7 +171,7 @@ public class ChargeBackTests {
         // create a partial charge back
         invoicePaymentApi.processChargeback(payment.getId(), FIFTEEN, context);
 
-        List<InvoicePayment> chargebacks = invoicePaymentApi.getChargebacksByInvoicePaymentId(payment.getId());
+        List<InvoicePayment> chargebacks = invoicePaymentApi.getChargebacksByPaymentAttemptId(payment.getPaymentAttemptId());
         assertNotNull(chargebacks);
         assertEquals(chargebacks.size(), 1);
         assertEquals(chargebacks.get(0).getReversedInvoicePaymentId(), payment.getId());
diff --git a/jaxrs/src/main/java/com/ning/billing/jaxrs/json/ChargeBackCollectionJson.java b/jaxrs/src/main/java/com/ning/billing/jaxrs/json/ChargeBackCollectionJson.java
new file mode 100644
index 0000000..3da8e81
--- /dev/null
+++ b/jaxrs/src/main/java/com/ning/billing/jaxrs/json/ChargeBackCollectionJson.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2010-2011 Ning, Inc.
+ *
+ * Ning licenses this file to you under the Apache License, version 2.0
+ * (the "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at:
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ */
+
+package com.ning.billing.jaxrs.json;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+import java.util.List;
+
+public class ChargebackCollectionJson {
+    private final String accountId;
+    private final List<ChargebackJson> chargebacks;
+
+    @JsonCreator
+    public ChargebackCollectionJson(@JsonProperty("accountId") final String accountId,
+                                    @JsonProperty("chargebacks") final List<ChargebackJson> chargebacks) {
+        this.accountId = accountId;
+        this.chargebacks = chargebacks;
+    }
+
+    public String getAccountId() {
+        return accountId;
+    }
+
+    public List<ChargebackJson> getChargebacks() {
+        return chargebacks;
+    }
+}
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
new file mode 100644
index 0000000..071f971
--- /dev/null
+++ b/jaxrs/src/main/java/com/ning/billing/jaxrs/json/ChargeBackJson.java
@@ -0,0 +1,75 @@
+/*
+ * Copyright 2010-2011 Ning, Inc.
+ *
+ * Ning licenses this file to you under the Apache License, version 2.0
+ * (the "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at:
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ */
+
+package com.ning.billing.jaxrs.json;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.ning.billing.invoice.api.InvoicePayment;
+import org.joda.time.DateTime;
+
+import java.math.BigDecimal;
+
+// TODO: populate reason code, requested date from audit log
+public class ChargebackJson {
+    private final DateTime requestedDate;
+    private final DateTime effectiveDate;
+    private final BigDecimal chargebackAmount;
+    private final String paymentId;
+    private final String reason;
+
+    @JsonCreator
+    public ChargebackJson(@JsonProperty("requestedDate") DateTime requestedDate,
+                          @JsonProperty("effectiveDate") DateTime effectiveDate,
+                          @JsonProperty("chargebackAmount") BigDecimal chargebackAmount,
+                          @JsonProperty("paymentId") String paymentId,
+                          @JsonProperty("reason") String reason) {
+        this.requestedDate = requestedDate;
+        this.effectiveDate = effectiveDate;
+        this.chargebackAmount = chargebackAmount;
+        this.paymentId = paymentId;
+        this.reason = reason;
+    }
+
+    public ChargebackJson(InvoicePayment chargeback) {
+        this.requestedDate = null;
+        this.effectiveDate = chargeback.getPaymentAttemptDate();
+        this.chargebackAmount = chargeback.getAmount().negate();
+        this.paymentId = chargeback.getReversedInvoicePaymentId().toString();
+        this.reason = null;
+
+    }
+
+    public DateTime getRequestedDate() {
+        return requestedDate;
+    }
+
+    public DateTime getEffectiveDate() {
+        return effectiveDate;
+    }
+
+    public BigDecimal getChargebackAmount() {
+        return chargebackAmount;
+    }
+
+    public String getPaymentId() {
+        return paymentId;
+    }
+
+    public String getReason() {
+        return reason;
+    }
+}
diff --git a/payment/src/main/java/com/ning/billing/payment/api/DefaultPaymentApi.java b/payment/src/main/java/com/ning/billing/payment/api/DefaultPaymentApi.java
index 8bb7692..10ed08f 100644
--- a/payment/src/main/java/com/ning/billing/payment/api/DefaultPaymentApi.java
+++ b/payment/src/main/java/com/ning/billing/payment/api/DefaultPaymentApi.java
@@ -445,7 +445,10 @@ public class DefaultPaymentApi implements PaymentApi {
         return paymentDao.getPaymentInfoForPaymentAttemptId(paymentAttemptId);
     }
 
-    
+    @Override
+    public UUID getPaymentAttemptIdFromPaymentId(UUID paymentId) throws PaymentApiException {
+        return paymentDao.getPaymentAttemptIdFromPaymentId(paymentId);
+    }
 
     private PaymentProviderPlugin getPaymentProviderPlugin(String accountKey) {
 
diff --git a/payment/src/main/java/com/ning/billing/payment/dao/AuditedPaymentDao.java b/payment/src/main/java/com/ning/billing/payment/dao/AuditedPaymentDao.java
index 27f5ba1..07acbf6 100644
--- a/payment/src/main/java/com/ning/billing/payment/dao/AuditedPaymentDao.java
+++ b/payment/src/main/java/com/ning/billing/payment/dao/AuditedPaymentDao.java
@@ -20,7 +20,9 @@ import java.util.ArrayList;
 import java.util.List;
 import java.util.UUID;
 
+import com.ning.billing.ErrorCode;
 import com.ning.billing.payment.api.DefaultPaymentAttempt;
+import com.ning.billing.payment.api.PaymentApiException;
 import com.ning.billing.util.ChangeType;
 import com.ning.billing.util.callcontext.CallContext;
 import com.ning.billing.util.dao.EntityAudit;
@@ -202,6 +204,16 @@ public class AuditedPaymentDao implements PaymentDao {
     public PaymentInfoEvent getPaymentInfoForPaymentAttemptId(UUID paymentAttemptIdStr) {
         return paymentSqlDao.getPaymentInfoForPaymentAttemptId(paymentAttemptIdStr.toString());
     }
+
+    @Override
+    public UUID getPaymentAttemptIdFromPaymentId(UUID paymentId) throws PaymentApiException {
+        UUID paymentAttemptId = paymentAttemptSqlDao.getPaymentAttemptIdFromPaymentId(paymentId.toString());
+        if (paymentAttemptId == null) {
+            throw new PaymentApiException(ErrorCode.PAYMENT_ATTEMPT_NOT_FOUND_FOR_PAYMENT_ID, paymentId);
+        } else {
+            return paymentAttemptId;
+        }
+    }
     
     private static List<String> toUUIDList(List<UUID> input) {
         return new ArrayList<String>(Collections2.transform(input, new Function<UUID, String>() {
diff --git a/payment/src/main/java/com/ning/billing/payment/dao/PaymentAttemptSqlDao.java b/payment/src/main/java/com/ning/billing/payment/dao/PaymentAttemptSqlDao.java
index 987d9eb..3b84597 100644
--- a/payment/src/main/java/com/ning/billing/payment/dao/PaymentAttemptSqlDao.java
+++ b/payment/src/main/java/com/ning/billing/payment/dao/PaymentAttemptSqlDao.java
@@ -25,6 +25,7 @@ import com.ning.billing.util.callcontext.CallContextBinder;
 import com.ning.billing.util.dao.BinderBase;
 import com.ning.billing.util.dao.EntityHistory;
 import com.ning.billing.util.dao.MapperBase;
+import com.ning.billing.util.dao.UuidMapper;
 import com.ning.billing.util.entity.dao.UpdatableEntitySqlDao;
 import org.joda.time.DateTime;
 import org.skife.jdbi.v2.SQLStatement;
@@ -81,6 +82,10 @@ public interface PaymentAttemptSqlDao extends Transactional<PaymentAttemptSqlDao
     public void insertHistoryFromTransaction(@PaymentAttemptHistoryBinder final EntityHistory<PaymentAttempt> account,
                                             @CallContextBinder final CallContext context);
 
+    @SqlQuery
+    @RegisterMapper(UuidMapper.class)
+    UUID getPaymentAttemptIdFromPaymentId(@Bind("paymentId") final String paymentId);
+
     public static class PaymentAttemptMapper extends MapperBase implements ResultSetMapper<PaymentAttempt> {
         @Override
         public PaymentAttempt map(int index, ResultSet rs, StatementContext ctx) throws SQLException {
diff --git a/payment/src/main/java/com/ning/billing/payment/dao/PaymentDao.java b/payment/src/main/java/com/ning/billing/payment/dao/PaymentDao.java
index 21abc8e..93e93eb 100644
--- a/payment/src/main/java/com/ning/billing/payment/dao/PaymentDao.java
+++ b/payment/src/main/java/com/ning/billing/payment/dao/PaymentDao.java
@@ -20,6 +20,7 @@ import java.util.List;
 import java.util.UUID;
 
 import com.ning.billing.invoice.api.Invoice;
+import com.ning.billing.payment.api.PaymentApiException;
 import com.ning.billing.payment.api.PaymentAttempt;
 import com.ning.billing.payment.api.PaymentInfoEvent;
 import com.ning.billing.payment.api.PaymentAttempt.PaymentAttemptStatus;
@@ -47,4 +48,6 @@ public interface PaymentDao {
 
     PaymentAttempt getPaymentAttemptById(UUID paymentAttemptId);
     PaymentInfoEvent getPaymentInfoForPaymentAttemptId(UUID paymentAttemptId);
+
+    UUID getPaymentAttemptIdFromPaymentId(UUID paymentId) throws PaymentApiException;
 }
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 7cda209..61c7874 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
@@ -78,6 +78,8 @@ public interface PaymentSqlDao extends Transactional<PaymentSqlDao>, UpdatableEn
                                             @CallContextBinder final CallContext context);
 
 
+
+
     public static final class PaymentInfoBinder extends BinderBase implements Binder<Bind, PaymentInfoEvent> {
         @Override
         public void bind(@SuppressWarnings("rawtypes") SQLStatement stmt, Bind bind, PaymentInfoEvent paymentInfo) {
@@ -143,4 +145,4 @@ public interface PaymentSqlDao extends Transactional<PaymentSqlDao>, UpdatableEn
         }
     }
 
-}
+}
\ No newline at end of file
diff --git a/payment/src/main/resources/com/ning/billing/payment/dao/PaymentAttemptSqlDao.sql.stg b/payment/src/main/resources/com/ning/billing/payment/dao/PaymentAttemptSqlDao.sql.stg
index 331f1db..894ddd9 100644
--- a/payment/src/main/resources/com/ning/billing/payment/dao/PaymentAttemptSqlDao.sql.stg
+++ b/payment/src/main/resources/com/ning/billing/payment/dao/PaymentAttemptSqlDao.sql.stg
@@ -55,6 +55,12 @@ updatePaymentAttemptWithPaymentId() ::= <<
      WHERE id = :id;
 >>
 
+getPaymentAttemptIdFromPaymentId() ::= <<
+    SELECT id
+    FROM payment_attempts
+    WHERE payment_id = :paymentId;
+>>
+
 historyFields(prefix) ::= <<
     record_id,
     id,
diff --git a/payment/src/test/java/com/ning/billing/payment/dao/MockPaymentDao.java b/payment/src/test/java/com/ning/billing/payment/dao/MockPaymentDao.java
index ca341bd..3c10939 100644
--- a/payment/src/test/java/com/ning/billing/payment/dao/MockPaymentDao.java
+++ b/payment/src/test/java/com/ning/billing/payment/dao/MockPaymentDao.java
@@ -24,6 +24,7 @@ import java.util.UUID;
 import java.util.concurrent.ConcurrentHashMap;
 
 import com.ning.billing.payment.api.DefaultPaymentAttempt;
+import com.ning.billing.payment.api.PaymentApiException;
 import com.ning.billing.util.callcontext.CallContext;
 import org.apache.commons.collections.CollectionUtils;
 
@@ -165,4 +166,9 @@ public class MockPaymentDao implements PaymentDao {
         return null;
     }
 
+    @Override
+    public UUID getPaymentAttemptIdFromPaymentId(UUID paymentId) throws PaymentApiException {
+        throw new UnsupportedOperationException();
+    }
+
 }