list static method

List<PaymentOption> list({
  1. required String currency,
})

Implementation

static List<PaymentOption> list({required String currency}) {
  final cardOption = PaymentOption(
    name: "Card",
    iconData: Icons.credit_card,
    slug: "card",
    isCard: true,
  );

  final bankOption = PaymentOption(
    name: "Bank",
    iconData: MaterialCommunityIcons.bank,
    slug: "bank",
    isBank: true,
  );

  final mobileMoneyOption = PaymentOption(
    name: "Mobile Money",
    iconData: Icons.smartphone,
    slug: "momo",
    isMomo: true,
  );

  List<PaymentOption> paymentOptions = [];

  //add the card
  paymentOptions.add(cardOption);

  //only add mobile money if the currency is ghanian (GHS)
  if (currency.toUpperCase() == "NGN") {
    paymentOptions.add(bankOption);
  }

  //only add mobile money if the currency is ghanian (GHS)
  if (currency.toUpperCase() == "GHS") {
    paymentOptions.add(mobileMoneyOption);
  }

  return paymentOptions;
}