encode<V> static method

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

Implementation

static V encode<V>(
  PaymentMethodCardPresent instance,
  Encoder<V> encoder,
) {
  final container = encoder.container<String>();
  if (instance.brand != null) {
    container.encodeString(
      'brand',
      instance.brand!,
    );
  }
  if (instance.cardholderName != null) {
    container.encodeString(
      'cardholder_name',
      instance.cardholderName!,
    );
  }
  if (instance.country != null) {
    container.encodeString(
      'country',
      instance.country!,
    );
  }
  if (instance.description != null) {
    container.encodeString(
      'description',
      instance.description!,
    );
  }
  container.encodeInt(
    'exp_month',
    instance.expMonth,
  );
  container.encodeInt(
    'exp_year',
    instance.expYear,
  );
  if (instance.fingerprint != null) {
    container.encodeString(
      'fingerprint',
      instance.fingerprint!,
    );
  }
  if (instance.funding != null) {
    container.encodeString(
      'funding',
      instance.funding!,
    );
  }
  if (instance.iin != null) {
    container.encodeString(
      'iin',
      instance.iin!,
    );
  }
  if (instance.issuer != null) {
    container.encodeString(
      'issuer',
      instance.issuer!,
    );
  }
  if (instance.last4 != null) {
    container.encodeString(
      'last4',
      instance.last4!,
    );
  }
  if (instance.networks != null) {
    Networks.encode(
      instance.networks!,
      container.nestedSingleValueContainer('networks').encoder,
    );
  }
  if (instance.readMethod != null) {
    container.encodeString(
      'read_method',
      instance.readMethod!,
    );
  }
  return container.value;
}