Procházet zdrojové kódy

allow first month free to be applied anytime

tags/v0.9.18
Jonathan Cobb před 4 roky
rodič
revize
20a7075eca
1 změnil soubory, kde provedl 15 přidání a 15 odebrání
  1. +15
    -15
      bubble-server/src/main/java/bubble/cloud/payment/promo/firstMonthFree/FirstMonthFreePaymentDriver.java

+ 15
- 15
bubble-server/src/main/java/bubble/cloud/payment/promo/firstMonthFree/FirstMonthFreePaymentDriver.java Zobrazit soubor

@@ -21,11 +21,11 @@ public class FirstMonthFreePaymentDriver extends PromotionalPaymentDriverBase<Pr

@Override public boolean addPromoToAccount(Promotion promo, Account caller) {
// caller must not have any bills
final int billCount = billDAO.countByAccount(caller.getUuid());
if (billCount != 0) {
log.warn("applyPromo: promo="+promo.getName()+", account="+caller.getName()+", account must have no Bills, found "+billCount+" bills");
return false;
}
// final int billCount = billDAO.countByAccount(caller.getUuid());
// if (billCount != 0) {
// log.warn("applyPromo: promo="+promo.getName()+", account="+caller.getName()+", account must have no Bills, found "+billCount+" bills");
// return false;
// }
// does the caller already have one of these?
final List<AccountPaymentMethod> existingCreditPaymentMethods = paymentMethodDAO.findByAccountAndCloud(caller.getUuid(), promo.getCloud());
if (!empty(existingCreditPaymentMethods)) {
@@ -50,16 +50,16 @@ public class FirstMonthFreePaymentDriver extends PromotionalPaymentDriverBase<Pr
AccountPlan accountPlan,
AccountPaymentMethod paymentMethod) {
// must have exactly one bill, this bill
final List<Bill> bills = billDAO.findByAccount(accountPlan.getAccount());
if (bills.size() != 1 || !bills.get(0).getUuid().equals(bill.getUuid())) {
return false;
}
// must not have used this promotion before
final List<AccountPaymentMethod> existingFirstMonthFree = paymentMethodDAO.findByAccountAndCloud(accountPlan.getAccount(), promo.getCloud());
if (existingFirstMonthFree.size() != 1 || !existingFirstMonthFree.get(0).getPromotion().equals(promo.getUuid())) {
return false;
}
// final List<Bill> bills = billDAO.findByAccount(accountPlan.getAccount());
// if (bills.size() != 1 || !bills.get(0).getUuid().equals(bill.getUuid())) {
// return false;
// }
//
// // must not have used this promotion before
// final List<AccountPaymentMethod> existingFirstMonthFree = paymentMethodDAO.findByAccountAndCloud(accountPlan.getAccount(), promo.getCloud());
// if (existingFirstMonthFree.size() != 1 || !existingFirstMonthFree.get(0).getPromotion().equals(promo.getUuid())) {
// return false;
// }

return super.canUseNow(bill, promo, promoDriver, promos, usable, accountPlan, paymentMethod);
}


Načítá se…
Zrušit
Uložit