initCreditCardWithTemplate method

Future<void> initCreditCardWithTemplate (
  1. CreditCardCreationRequest req
)

Implementation

Future<void> initCreditCardWithTemplate(CreditCardCreationRequest req) async {
  try {
    status = DataBackendStatus.LOADING;
    notifyListeners();

    /// TODO: add this to child classes
    /*
    await initCreditCard(CreditCardInitRequest(req.card), silent: true);
    for (CashbackPromo promo in req.card.promos) {
      await addPromotion(PromotionAdditionRequest(req.card.id, promo),
          silent: true);
    }
    */
    await initCreditCardWithTemplateInDatabase(req);
    creditCardsDirty = true;
    status = DataBackendStatus.OUTDATED;
    notifyListeners();
  } catch (err) {
    print(err.toString());
    status = DataBackendStatus.ERROR;
    notifyListeners();
  }
}