encode<V> static method

V encode<V>(
  1. ConfirmationTokenPaymentMethodPreview instance,
  2. Encoder<V> encoder
)

Implementation

static V encode<V>(
  ConfirmationTokenPaymentMethodPreview instance,
  Encoder<V> encoder,
) {
  final container = encoder.container<String>();
  if (instance.acssDebit != null) {
    PaymentMethodAcssDebit.encode(
      instance.acssDebit!,
      container.nestedSingleValueContainer('acss_debit').encoder,
    );
  }
  if (instance.affirm != null) {
    PaymentMethodAffirm.encode(
      instance.affirm!,
      container.nestedSingleValueContainer('affirm').encoder,
    );
  }
  if (instance.afterpayClearpay != null) {
    PaymentMethodAfterpayClearpay.encode(
      instance.afterpayClearpay!,
      container.nestedSingleValueContainer('afterpay_clearpay').encoder,
    );
  }
  if (instance.alipay != null) {
    PaymentFlowsPrivatePaymentMethodsAlipay.encode(
      instance.alipay!,
      container.nestedSingleValueContainer('alipay').encoder,
    );
  }
  if (instance.auBecsDebit != null) {
    PaymentMethodAuBecsDebit.encode(
      instance.auBecsDebit!,
      container.nestedSingleValueContainer('au_becs_debit').encoder,
    );
  }
  if (instance.bacsDebit != null) {
    PaymentMethodBacsDebit.encode(
      instance.bacsDebit!,
      container.nestedSingleValueContainer('bacs_debit').encoder,
    );
  }
  if (instance.bancontact != null) {
    PaymentMethodBancontact.encode(
      instance.bancontact!,
      container.nestedSingleValueContainer('bancontact').encoder,
    );
  }
  BillingDetails.encode(
    instance.billingDetails,
    container.nestedSingleValueContainer('billing_details').encoder,
  );
  if (instance.blik != null) {
    PaymentMethodBlik.encode(
      instance.blik!,
      container.nestedSingleValueContainer('blik').encoder,
    );
  }
  if (instance.boleto != null) {
    PaymentMethodBoleto.encode(
      instance.boleto!,
      container.nestedSingleValueContainer('boleto').encoder,
    );
  }
  if (instance.card != null) {
    PaymentMethodCard.encode(
      instance.card!,
      container.nestedSingleValueContainer('card').encoder,
    );
  }
  if (instance.cardPresent != null) {
    PaymentMethodCardPresent.encode(
      instance.cardPresent!,
      container.nestedSingleValueContainer('card_present').encoder,
    );
  }
  if (instance.cashapp != null) {
    PaymentMethodCashapp.encode(
      instance.cashapp!,
      container.nestedSingleValueContainer('cashapp').encoder,
    );
  }
  if (instance.customerBalance != null) {
    PaymentMethodCustomerBalance.encode(
      instance.customerBalance!,
      container.nestedSingleValueContainer('customer_balance').encoder,
    );
  }
  if (instance.eps != null) {
    PaymentMethodEps.encode(
      instance.eps!,
      container.nestedSingleValueContainer('eps').encoder,
    );
  }
  if (instance.fpx != null) {
    PaymentMethodFpx.encode(
      instance.fpx!,
      container.nestedSingleValueContainer('fpx').encoder,
    );
  }
  if (instance.giropay != null) {
    PaymentMethodGiropay.encode(
      instance.giropay!,
      container.nestedSingleValueContainer('giropay').encoder,
    );
  }
  if (instance.grabpay != null) {
    PaymentMethodGrabpay.encode(
      instance.grabpay!,
      container.nestedSingleValueContainer('grabpay').encoder,
    );
  }
  if (instance.ideal != null) {
    PaymentMethodIdeal.encode(
      instance.ideal!,
      container.nestedSingleValueContainer('ideal').encoder,
    );
  }
  if (instance.interacPresent != null) {
    PaymentMethodInteracPresent.encode(
      instance.interacPresent!,
      container.nestedSingleValueContainer('interac_present').encoder,
    );
  }
  if (instance.klarna != null) {
    PaymentMethodKlarna.encode(
      instance.klarna!,
      container.nestedSingleValueContainer('klarna').encoder,
    );
  }
  if (instance.konbini != null) {
    PaymentMethodKonbini.encode(
      instance.konbini!,
      container.nestedSingleValueContainer('konbini').encoder,
    );
  }
  if (instance.link != null) {
    PaymentMethodLink.encode(
      instance.link!,
      container.nestedSingleValueContainer('link').encoder,
    );
  }
  if (instance.mobilepay != null) {
    PaymentMethodMobilepay.encode(
      instance.mobilepay!,
      container.nestedSingleValueContainer('mobilepay').encoder,
    );
  }
  if (instance.oxxo != null) {
    PaymentMethodOxxo.encode(
      instance.oxxo!,
      container.nestedSingleValueContainer('oxxo').encoder,
    );
  }
  if (instance.p24 != null) {
    PaymentMethodP24.encode(
      instance.p24!,
      container.nestedSingleValueContainer('p24').encoder,
    );
  }
  if (instance.paynow != null) {
    PaymentMethodPaynow.encode(
      instance.paynow!,
      container.nestedSingleValueContainer('paynow').encoder,
    );
  }
  if (instance.paypal != null) {
    PaymentMethodPaypal.encode(
      instance.paypal!,
      container.nestedSingleValueContainer('paypal').encoder,
    );
  }
  if (instance.pix != null) {
    PaymentMethodPix.encode(
      instance.pix!,
      container.nestedSingleValueContainer('pix').encoder,
    );
  }
  if (instance.promptpay != null) {
    PaymentMethodPromptpay.encode(
      instance.promptpay!,
      container.nestedSingleValueContainer('promptpay').encoder,
    );
  }
  if (instance.revolutPay != null) {
    PaymentMethodRevolutPay.encode(
      instance.revolutPay!,
      container.nestedSingleValueContainer('revolut_pay').encoder,
    );
  }
  if (instance.sepaDebit != null) {
    PaymentMethodSepaDebit.encode(
      instance.sepaDebit!,
      container.nestedSingleValueContainer('sepa_debit').encoder,
    );
  }
  if (instance.sofort != null) {
    PaymentMethodSofort.encode(
      instance.sofort!,
      container.nestedSingleValueContainer('sofort').encoder,
    );
  }
  if (instance.swish != null) {
    PaymentMethodSwish.encode(
      instance.swish!,
      container.nestedSingleValueContainer('swish').encoder,
    );
  }
  container.encodeString(
    'type',
    instance.type,
  );
  if (instance.usBankAccount != null) {
    PaymentMethodUsBankAccount.encode(
      instance.usBankAccount!,
      container.nestedSingleValueContainer('us_bank_account').encoder,
    );
  }
  if (instance.wechatPay != null) {
    PaymentMethodWechatPay.encode(
      instance.wechatPay!,
      container.nestedSingleValueContainer('wechat_pay').encoder,
    );
  }
  if (instance.zip != null) {
    PaymentMethodZip.encode(
      instance.zip!,
      container.nestedSingleValueContainer('zip').encoder,
    );
  }
  return container.value;
}