encode<V> static method

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

Implementation

static V encode<V>(
  TokenBankAccount instance,
  Encoder<V> encoder,
) {
  final container = encoder.container<String>();
  if (instance.accountHolderName != null) {
    container.encodeString(
      'account_holder_name',
      instance.accountHolderName!,
    );
  }
  if (instance.accountHolderType != null) {
    IssuingCardholderType.encode(
      instance.accountHolderType!,
      container.nestedSingleValueContainer('account_holder_type').encoder,
    );
  }
  container.encodeString(
    'account_number',
    instance.accountNumber,
  );
  if (instance.accountType != null) {
    ExternalAccountAccountType.encode(
      instance.accountType!,
      container.nestedSingleValueContainer('account_type').encoder,
    );
  }
  container.encodeString(
    'country',
    instance.country,
  );
  if (instance.currency != null) {
    container.encodeString(
      'currency',
      instance.currency!,
    );
  }
  if (instance.paymentMethod != null) {
    container.encodeString(
      'payment_method',
      instance.paymentMethod!,
    );
  }
  if (instance.routingNumber != null) {
    container.encodeString(
      'routing_number',
      instance.routingNumber!,
    );
  }
  return container.value;
}