encode<V> static method

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

Implementation

static V encode<V>(
  ChargePaymentMethodDetails instance,
  Encoder<V> encoder,
) {
  final container = encoder.container<String>();
  if (instance.achCreditTransfer != null) {
    PaymentMethodDetailsAchCreditTransfer.encode(
      instance.achCreditTransfer!,
      container.nestedSingleValueContainer('ach_credit_transfer').encoder,
    );
  }
  if (instance.achDebit != null) {
    PaymentMethodDetailsAchDebit.encode(
      instance.achDebit!,
      container.nestedSingleValueContainer('ach_debit').encoder,
    );
  }
  if (instance.acssDebit != null) {
    PaymentMethodDetailsAcssDebit.encode(
      instance.acssDebit!,
      container.nestedSingleValueContainer('acss_debit').encoder,
    );
  }
  if (instance.affirm != null) {
    PaymentMethodDetailsAffirm.encode(
      instance.affirm!,
      container.nestedSingleValueContainer('affirm').encoder,
    );
  }
  if (instance.afterpayClearpay != null) {
    PaymentMethodDetailsAfterpayClearpay.encode(
      instance.afterpayClearpay!,
      container.nestedSingleValueContainer('afterpay_clearpay').encoder,
    );
  }
  if (instance.alipay != null) {
    PaymentFlowsPrivatePaymentMethodsAlipayDetails.encode(
      instance.alipay!,
      container.nestedSingleValueContainer('alipay').encoder,
    );
  }
  if (instance.auBecsDebit != null) {
    PaymentMethodDetailsAuBecsDebit.encode(
      instance.auBecsDebit!,
      container.nestedSingleValueContainer('au_becs_debit').encoder,
    );
  }
  if (instance.bacsDebit != null) {
    PaymentMethodDetailsBacsDebit.encode(
      instance.bacsDebit!,
      container.nestedSingleValueContainer('bacs_debit').encoder,
    );
  }
  if (instance.bancontact != null) {
    PaymentMethodDetailsBancontact.encode(
      instance.bancontact!,
      container.nestedSingleValueContainer('bancontact').encoder,
    );
  }
  if (instance.blik != null) {
    PaymentMethodDetailsBlik.encode(
      instance.blik!,
      container.nestedSingleValueContainer('blik').encoder,
    );
  }
  if (instance.boleto != null) {
    PaymentMethodDetailsBoleto.encode(
      instance.boleto!,
      container.nestedSingleValueContainer('boleto').encoder,
    );
  }
  if (instance.card != null) {
    PaymentMethodDetailsCard.encode(
      instance.card!,
      container.nestedSingleValueContainer('card').encoder,
    );
  }
  if (instance.cardPresent != null) {
    PaymentMethodDetailsCardPresent.encode(
      instance.cardPresent!,
      container.nestedSingleValueContainer('card_present').encoder,
    );
  }
  if (instance.cashapp != null) {
    PaymentMethodDetailsCashapp.encode(
      instance.cashapp!,
      container.nestedSingleValueContainer('cashapp').encoder,
    );
  }
  if (instance.customerBalance != null) {
    PaymentMethodDetailsCustomerBalance.encode(
      instance.customerBalance!,
      container.nestedSingleValueContainer('customer_balance').encoder,
    );
  }
  if (instance.eps != null) {
    PaymentMethodDetailsEps.encode(
      instance.eps!,
      container.nestedSingleValueContainer('eps').encoder,
    );
  }
  if (instance.fpx != null) {
    PaymentMethodDetailsFpx.encode(
      instance.fpx!,
      container.nestedSingleValueContainer('fpx').encoder,
    );
  }
  if (instance.giropay != null) {
    PaymentMethodDetailsGiropay.encode(
      instance.giropay!,
      container.nestedSingleValueContainer('giropay').encoder,
    );
  }
  if (instance.grabpay != null) {
    PaymentMethodDetailsGrabpay.encode(
      instance.grabpay!,
      container.nestedSingleValueContainer('grabpay').encoder,
    );
  }
  if (instance.ideal != null) {
    PaymentMethodDetailsIdeal.encode(
      instance.ideal!,
      container.nestedSingleValueContainer('ideal').encoder,
    );
  }
  if (instance.interacPresent != null) {
    PaymentMethodDetailsInteracPresent.encode(
      instance.interacPresent!,
      container.nestedSingleValueContainer('interac_present').encoder,
    );
  }
  if (instance.klarna != null) {
    PaymentMethodDetailsKlarna.encode(
      instance.klarna!,
      container.nestedSingleValueContainer('klarna').encoder,
    );
  }
  if (instance.konbini != null) {
    PaymentMethodDetailsKonbini.encode(
      instance.konbini!,
      container.nestedSingleValueContainer('konbini').encoder,
    );
  }
  if (instance.link != null) {
    PaymentMethodDetailsLink.encode(
      instance.link!,
      container.nestedSingleValueContainer('link').encoder,
    );
  }
  if (instance.mobilepay != null) {
    PaymentMethodDetailsMobilepay.encode(
      instance.mobilepay!,
      container.nestedSingleValueContainer('mobilepay').encoder,
    );
  }
  if (instance.multibanco != null) {
    PaymentMethodDetailsMultibanco.encode(
      instance.multibanco!,
      container.nestedSingleValueContainer('multibanco').encoder,
    );
  }
  if (instance.oxxo != null) {
    PaymentMethodDetailsOxxo.encode(
      instance.oxxo!,
      container.nestedSingleValueContainer('oxxo').encoder,
    );
  }
  if (instance.p24 != null) {
    PaymentMethodDetailsP24.encode(
      instance.p24!,
      container.nestedSingleValueContainer('p24').encoder,
    );
  }
  if (instance.paynow != null) {
    PaymentMethodDetailsPaynow.encode(
      instance.paynow!,
      container.nestedSingleValueContainer('paynow').encoder,
    );
  }
  if (instance.paypal != null) {
    PaymentMethodDetailsPaypal.encode(
      instance.paypal!,
      container.nestedSingleValueContainer('paypal').encoder,
    );
  }
  if (instance.pix != null) {
    PaymentMethodDetailsPix.encode(
      instance.pix!,
      container.nestedSingleValueContainer('pix').encoder,
    );
  }
  if (instance.promptpay != null) {
    PaymentMethodDetailsPromptpay.encode(
      instance.promptpay!,
      container.nestedSingleValueContainer('promptpay').encoder,
    );
  }
  if (instance.revolutPay != null) {
    PaymentMethodDetailsRevolutPay.encode(
      instance.revolutPay!,
      container.nestedSingleValueContainer('revolut_pay').encoder,
    );
  }
  if (instance.sepaCreditTransfer != null) {
    PaymentMethodDetailsSepaCreditTransfer.encode(
      instance.sepaCreditTransfer!,
      container.nestedSingleValueContainer('sepa_credit_transfer').encoder,
    );
  }
  if (instance.sepaDebit != null) {
    PaymentMethodDetailsSepaDebit.encode(
      instance.sepaDebit!,
      container.nestedSingleValueContainer('sepa_debit').encoder,
    );
  }
  if (instance.sofort != null) {
    PaymentMethodDetailsSofort.encode(
      instance.sofort!,
      container.nestedSingleValueContainer('sofort').encoder,
    );
  }
  if (instance.stripeAccount != null) {
    PaymentMethodDetailsStripeAccount.encode(
      instance.stripeAccount!,
      container.nestedSingleValueContainer('stripe_account').encoder,
    );
  }
  if (instance.swish != null) {
    PaymentMethodDetailsSwish.encode(
      instance.swish!,
      container.nestedSingleValueContainer('swish').encoder,
    );
  }
  container.encodeString(
    'type',
    instance.type,
  );
  if (instance.usBankAccount != null) {
    PaymentMethodDetailsUsBankAccount.encode(
      instance.usBankAccount!,
      container.nestedSingleValueContainer('us_bank_account').encoder,
    );
  }
  if (instance.wechat != null) {
    PaymentMethodDetailsWechat.encode(
      instance.wechat!,
      container.nestedSingleValueContainer('wechat').encoder,
    );
  }
  if (instance.wechatPay != null) {
    PaymentMethodDetailsWechatPay.encode(
      instance.wechatPay!,
      container.nestedSingleValueContainer('wechat_pay').encoder,
    );
  }
  if (instance.zip != null) {
    PaymentMethodDetailsZip.encode(
      instance.zip!,
      container.nestedSingleValueContainer('zip').encoder,
    );
  }
  return container.value;
}