encode<V> static method

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

Implementation

static V encode<V>(
  PaymentMethodCard instance,
  Encoder<V> encoder,
) {
  final container = encoder.container<String>();
  container.encodeString(
    'brand',
    instance.brand,
  );
  if (instance.checks != null) {
    PaymentMethodCardChecks.encode(
      instance.checks!,
      container.nestedSingleValueContainer('checks').encoder,
    );
  }
  if (instance.country != null) {
    container.encodeString(
      'country',
      instance.country!,
    );
  }
  if (instance.description != null) {
    container.encodeString(
      'description',
      instance.description!,
    );
  }
  if (instance.displayBrand != null) {
    container.encodeString(
      'display_brand',
      instance.displayBrand!,
    );
  }
  container.encodeInt(
    'exp_month',
    instance.expMonth,
  );
  container.encodeInt(
    'exp_year',
    instance.expYear,
  );
  if (instance.fingerprint != null) {
    container.encodeString(
      'fingerprint',
      instance.fingerprint!,
    );
  }
  container.encodeString(
    'funding',
    instance.funding,
  );
  if (instance.iin != null) {
    container.encodeString(
      'iin',
      instance.iin!,
    );
  }
  if (instance.issuer != null) {
    container.encodeString(
      'issuer',
      instance.issuer!,
    );
  }
  container.encodeString(
    'last4',
    instance.last4,
  );
  if (instance.networks != null) {
    Networks.encode(
      instance.networks!,
      container.nestedSingleValueContainer('networks').encoder,
    );
  }
  if (instance.threeDSecureUsage != null) {
    PaymentMethodCardThreeDSecureUsage.encode(
      instance.threeDSecureUsage!,
      container.nestedSingleValueContainer('three_d_secure_usage').encoder,
    );
  }
  if (instance.wallet != null) {
    PaymentMethodCardWallet.encode(
      instance.wallet!,
      container.nestedSingleValueContainer('wallet').encoder,
    );
  }
  return container.value;
}