encode<V> static method

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

Implementation

static V encode<V>(
  MandatePaymentMethodDetails instance,
  Encoder<V> encoder,
) {
  final container = encoder.container<String>();
  if (instance.acssDebit != null) {
    MandateAcssDebit.encode(
      instance.acssDebit!,
      container.nestedSingleValueContainer('acss_debit').encoder,
    );
  }
  if (instance.auBecsDebit != null) {
    MandateAuBecsDebit.encode(
      instance.auBecsDebit!,
      container.nestedSingleValueContainer('au_becs_debit').encoder,
    );
  }
  if (instance.bacsDebit != null) {
    MandateBacsDebit.encode(
      instance.bacsDebit!,
      container.nestedSingleValueContainer('bacs_debit').encoder,
    );
  }
  if (instance.card != null) {
    CardMandatePaymentMethodDetails.encode(
      instance.card!,
      container.nestedSingleValueContainer('card').encoder,
    );
  }
  if (instance.cashapp != null) {
    MandateCashapp.encode(
      instance.cashapp!,
      container.nestedSingleValueContainer('cashapp').encoder,
    );
  }
  if (instance.link != null) {
    MandateLink.encode(
      instance.link!,
      container.nestedSingleValueContainer('link').encoder,
    );
  }
  if (instance.paypal != null) {
    MandatePaypal.encode(
      instance.paypal!,
      container.nestedSingleValueContainer('paypal').encoder,
    );
  }
  if (instance.sepaDebit != null) {
    MandateSepaDebit.encode(
      instance.sepaDebit!,
      container.nestedSingleValueContainer('sepa_debit').encoder,
    );
  }
  container.encodeString(
    'type',
    instance.type,
  );
  if (instance.usBankAccount != null) {
    MandateUsBankAccount.encode(
      instance.usBankAccount!,
      container.nestedSingleValueContainer('us_bank_account').encoder,
    );
  }
  return container.value;
}