encode<V> static method

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

Implementation

static V encode<V>(
  TokenCardCreditCardSpecs instance,
  Encoder<V> encoder,
) {
  final container = encoder.container<String>();
  if (instance.addressCity != null) {
    container.encodeString(
      'address_city',
      instance.addressCity!,
    );
  }
  if (instance.addressCountry != null) {
    container.encodeString(
      'address_country',
      instance.addressCountry!,
    );
  }
  if (instance.addressLine1 != null) {
    container.encodeString(
      'address_line1',
      instance.addressLine1!,
    );
  }
  if (instance.addressLine2 != null) {
    container.encodeString(
      'address_line2',
      instance.addressLine2!,
    );
  }
  if (instance.addressState != null) {
    container.encodeString(
      'address_state',
      instance.addressState!,
    );
  }
  if (instance.addressZip != null) {
    container.encodeString(
      'address_zip',
      instance.addressZip!,
    );
  }
  if (instance.currency != null) {
    container.encodeString(
      'currency',
      instance.currency!,
    );
  }
  if (instance.cvc != null) {
    container.encodeString(
      'cvc',
      instance.cvc!,
    );
  }
  container.encodeString(
    'exp_month',
    instance.expMonth,
  );
  container.encodeString(
    'exp_year',
    instance.expYear,
  );
  if (instance.name != null) {
    container.encodeString(
      'name',
      instance.name!,
    );
  }
  if (instance.networks != null) {
    PaymentMethodNetworks.encode(
      instance.networks!,
      container.nestedSingleValueContainer('networks').encoder,
    );
  }
  container.encodeString(
    'number',
    instance.number,
  );
  return container.value;
}