encode<V> static method

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

Implementation

static V encode<V>(
  PaymentMethodDetailsInteracPresent 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!,
    );
  }
  if (instance.emvAuthData != null) {
    container.encodeString(
      'emv_auth_data',
      instance.emvAuthData!,
    );
  }
  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.generatedCard != null) {
    container.encodeString(
      'generated_card',
      instance.generatedCard!,
    );
  }
  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.preferredLocales != null) {
    container.encodeList(
      'preferred_locales',
      (container) => instance.preferredLocales!
          .forEach((el) => container.encodeString(el)),
    );
  }
  if (instance.readMethod != null) {
    PaymentMethodCardPresentReadMethod.encode(
      instance.readMethod!,
      container.nestedSingleValueContainer('read_method').encoder,
    );
  }
  if (instance.receipt != null) {
    PaymentMethodDetailsInteracPresentReceipt.encode(
      instance.receipt!,
      container.nestedSingleValueContainer('receipt').encoder,
    );
  }
  return container.value;
}