Browse Source

add more details to payment errors

tags/v1.2.7
Jonathan Cobb 4 years ago
parent
commit
47f7912f55
1 changed files with 4 additions and 4 deletions
  1. +4
    -4
      bubble-server/src/main/java/bubble/cloud/payment/PaymentDriverBase.java

+ 4
- 4
bubble-server/src/main/java/bubble/cloud/payment/PaymentDriverBase.java View File

@@ -68,10 +68,10 @@ public abstract class PaymentDriverBase<T> extends CloudServiceDriverBase<T> imp

public Bill getBill(String billUuid, long purchaseAmount, String currency, AccountPlan accountPlan) {
final Bill bill = billDAO.findByUuid(billUuid);
if (bill == null) throw invalidEx("err.purchase.billNotFound");
if (!bill.getAccount().equals(accountPlan.getAccount())) throw invalidEx("err.purchase.accountMismatch");
if (bill.getTotal() != purchaseAmount) throw invalidEx("err.purchase.amountMismatch");
if (!bill.getCurrency().equals(currency)) throw invalidEx("err.purchase.currencyMismatch");
if (bill == null) throw invalidEx("err.purchase.billNotFound", "bill not found: "+billUuid);
if (!bill.getAccount().equals(accountPlan.getAccount())) throw invalidEx("err.purchase.accountMismatch", "bill.account ("+bill.getAccount()+") != accountPlan.account ("+accountPlan.getAccount()+")");
if (bill.getTotal() != purchaseAmount) throw invalidEx("err.purchase.amountMismatch", "bill.total ("+bill.getTotal()+") != purchaseAmount ("+purchaseAmount+")");
if (!bill.getCurrency().equals(currency)) throw invalidEx("err.purchase.currencyMismatch", "bill.currency ("+bill.getCurrency()+") != currency ("+currency+")");
return bill;
}



Loading…
Cancel
Save