encode<V> static method

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

Implementation

static V encode<V>(
  SetupAttemptPaymentMethodDetailsBancontact instance,
  Encoder<V> encoder,
) {
  final container = encoder.container<String>();
  if (instance.bankCode != null) {
    container.encodeString(
      'bank_code',
      instance.bankCode!,
    );
  }
  if (instance.bankName != null) {
    container.encodeString(
      'bank_name',
      instance.bankName!,
    );
  }
  if (instance.bic != null) {
    container.encodeString(
      'bic',
      instance.bic!,
    );
  }
  if (instance.generatedSepaDebit != null) {
    PaymentMethodOrId.encode(
      instance.generatedSepaDebit!,
      container.nestedSingleValueContainer('generated_sepa_debit').encoder,
    );
  }
  if (instance.generatedSepaDebitMandate != null) {
    MandateOrId.encode(
      instance.generatedSepaDebitMandate!,
      container
          .nestedSingleValueContainer('generated_sepa_debit_mandate')
          .encoder,
    );
  }
  if (instance.ibanLast4 != null) {
    container.encodeString(
      'iban_last4',
      instance.ibanLast4!,
    );
  }
  if (instance.preferredLanguage != null) {
    PaymentMethodDetailsBancontactPreferredLanguage.encode(
      instance.preferredLanguage!,
      container.nestedSingleValueContainer('preferred_language').encoder,
    );
  }
  if (instance.verifiedName != null) {
    container.encodeString(
      'verified_name',
      instance.verifiedName!,
    );
  }
  return container.value;
}