encode<V> static method

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

Implementation

static V encode<V>(
  SetupAttemptPaymentMethodDetails instance,
  Encoder<V> encoder,
) {
  final container = encoder.container<String>();
  if (instance.acssDebit != null) {
    SetupAttemptPaymentMethodDetailsAcssDebit.encode(
      instance.acssDebit!,
      container.nestedSingleValueContainer('acss_debit').encoder,
    );
  }
  if (instance.auBecsDebit != null) {
    SetupAttemptPaymentMethodDetailsAuBecsDebit.encode(
      instance.auBecsDebit!,
      container.nestedSingleValueContainer('au_becs_debit').encoder,
    );
  }
  if (instance.bacsDebit != null) {
    SetupAttemptPaymentMethodDetailsBacsDebit.encode(
      instance.bacsDebit!,
      container.nestedSingleValueContainer('bacs_debit').encoder,
    );
  }
  if (instance.bancontact != null) {
    SetupAttemptPaymentMethodDetailsBancontact.encode(
      instance.bancontact!,
      container.nestedSingleValueContainer('bancontact').encoder,
    );
  }
  if (instance.boleto != null) {
    SetupAttemptPaymentMethodDetailsBoleto.encode(
      instance.boleto!,
      container.nestedSingleValueContainer('boleto').encoder,
    );
  }
  if (instance.card != null) {
    SetupAttemptPaymentMethodDetailsCard.encode(
      instance.card!,
      container.nestedSingleValueContainer('card').encoder,
    );
  }
  if (instance.cardPresent != null) {
    SetupAttemptPaymentMethodDetailsCardPresent.encode(
      instance.cardPresent!,
      container.nestedSingleValueContainer('card_present').encoder,
    );
  }
  if (instance.cashapp != null) {
    SetupAttemptPaymentMethodDetailsCashapp.encode(
      instance.cashapp!,
      container.nestedSingleValueContainer('cashapp').encoder,
    );
  }
  if (instance.ideal != null) {
    SetupAttemptPaymentMethodDetailsIdeal.encode(
      instance.ideal!,
      container.nestedSingleValueContainer('ideal').encoder,
    );
  }
  if (instance.klarna != null) {
    SetupAttemptPaymentMethodDetailsKlarna.encode(
      instance.klarna!,
      container.nestedSingleValueContainer('klarna').encoder,
    );
  }
  if (instance.link != null) {
    SetupAttemptPaymentMethodDetailsLink.encode(
      instance.link!,
      container.nestedSingleValueContainer('link').encoder,
    );
  }
  if (instance.paypal != null) {
    SetupAttemptPaymentMethodDetailsPaypal.encode(
      instance.paypal!,
      container.nestedSingleValueContainer('paypal').encoder,
    );
  }
  if (instance.sepaDebit != null) {
    SetupAttemptPaymentMethodDetailsSepaDebit.encode(
      instance.sepaDebit!,
      container.nestedSingleValueContainer('sepa_debit').encoder,
    );
  }
  if (instance.sofort != null) {
    SetupAttemptPaymentMethodDetailsSofort.encode(
      instance.sofort!,
      container.nestedSingleValueContainer('sofort').encoder,
    );
  }
  container.encodeString(
    'type',
    instance.type,
  );
  if (instance.usBankAccount != null) {
    SetupAttemptPaymentMethodDetailsUsBankAccount.encode(
      instance.usBankAccount!,
      container.nestedSingleValueContainer('us_bank_account').encoder,
    );
  }
  return container.value;
}