Sfoglia il codice sorgente

fix setting preferred plan when adding payment method

tags/v0.15.5
Jonathan Cobb 4 anni fa
parent
commit
0b7b4077fa
2 ha cambiato i file con 10 aggiunte e 4 eliminazioni
  1. +4
    -2
      bubble-server/src/main/java/bubble/model/account/Account.java
  2. +6
    -2
      bubble-server/src/main/java/bubble/model/bill/AccountPaymentMethod.java

+ 4
- 2
bubble-server/src/main/java/bubble/model/account/Account.java Vedi File

@@ -79,10 +79,12 @@ import static org.cobbzilla.wizard.resources.ResourceUtil.invalidEx;
@Entity @NoArgsConstructor @Accessors(chain=true) @Slf4j
public class Account extends IdentifiableBaseParentEntity implements TokenPrincipal, SqlViewSearchResult {

public static final String[] UPDATE_FIELDS = {"url", "description", "autoUpdatePolicy", "syncPassword"};
public static final String[] UPDATE_FIELDS = {
"url", "description", "autoUpdatePolicy", "syncPassword", "preferredPlan"
};
public static final String[] ADMIN_UPDATE_FIELDS = ArrayUtil.append(UPDATE_FIELDS, "suspended", "admin");
public static final String[] CREATE_FIELDS = ArrayUtil.append(ADMIN_UPDATE_FIELDS,
"name", "termsAgreed", "preferredPlan");
"name", "termsAgreed");

public static final String ROOT_USERNAME = "root";
public static final String ROOT_EMAIL = "root@local.local";


+ 6
- 2
bubble-server/src/main/java/bubble/model/bill/AccountPaymentMethod.java Vedi File

@@ -49,7 +49,7 @@ public class AccountPaymentMethod extends IdentifiableBase implements HasAccount

@Override public ScrubbableField[] fieldsToScrub() { return SCRUB_FIELDS; }

public static final String[] CREATE_FIELDS = {"paymentMethodType", "paymentInfo", "maskedPaymentInfo", "cloud"};
public static final String[] CREATE_FIELDS = {"paymentMethodType", "paymentInfo", "maskedPaymentInfo", "cloud", "preferredPlan"};
public static final String[] VALIDATION_SET_FIELDS = {"paymentInfo", "maskedPaymentInfo"};

public AccountPaymentMethod(AccountPaymentMethod other) { copy(this, other, CREATE_FIELDS); }
@@ -160,7 +160,11 @@ public class AccountPaymentMethod extends IdentifiableBase implements HasAccount
if (hasPreferredPlan()) {
final BubblePlanDAO planDAO = configuration.getBean(BubblePlanDAO.class);
final BubblePlan plan = planDAO.findById(preferredPlan);
if (plan == null) result.addViolation("err.plan.notFound");
if (plan == null) {
result.addViolation("err.plan.notFound");
} else {
setPreferredPlan(plan.getUuid());
}
}
return result;
}


Caricamento…
Annulla
Salva