encode<V> static method

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

Implementation

static V encode<V>(
  SetupAttemptPaymentMethodDetailsCard instance,
  Encoder<V> encoder,
) {
  final container = encoder.container<String>();
  if (instance.brand != null) {
    container.encodeString(
      'brand',
      instance.brand!,
    );
  }
  if (instance.checks != null) {
    PaymentMethodDetailsCardChecks.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.expMonth != null) {
    container.encodeInt(
      'exp_month',
      instance.expMonth!,
    );
  }
  if (instance.expYear != null) {
    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.network != null) {
    container.encodeString(
      'network',
      instance.network!,
    );
  }
  if (instance.threeDSecure != null) {
    SetupAttemptPaymentMethodDetailsCardThreeDSecure.encode(
      instance.threeDSecure!,
      container.nestedSingleValueContainer('three_d_secure').encoder,
    );
  }
  if (instance.wallet != null) {
    SetupAttemptPaymentMethodDetailsCardWallet.encode(
      instance.wallet!,
      container.nestedSingleValueContainer('wallet').encoder,
    );
  }
  return container.value;
}