encode<V> static method

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

Implementation

static V encode<V>(
  PaymentMethodDetailsCardPresent instance,
  Encoder<V> encoder,
) {
  final container = encoder.container<String>();
  if (instance.amountAuthorized != null) {
    container.encodeInt(
      'amount_authorized',
      instance.amountAuthorized!,
    );
  }
  if (instance.brand != null) {
    container.encodeString(
      'brand',
      instance.brand!,
    );
  }
  if (instance.captureBefore != null) {
    container.encodeDateTime(
      'capture_before',
      instance.captureBefore!,
    );
  }
  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!,
    );
  }
  container.encodeBool(
    'incremental_authorization_supported',
    instance.incrementalAuthorizationSupported,
  );
  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.offline != null) {
    PaymentMethodDetailsCardPresentOffline.encode(
      instance.offline!,
      container.nestedSingleValueContainer('offline').encoder,
    );
  }
  container.encodeBool(
    'overcapture_supported',
    instance.overcaptureSupported,
  );
  if (instance.readMethod != null) {
    PaymentMethodCardPresentReadMethod.encode(
      instance.readMethod!,
      container.nestedSingleValueContainer('read_method').encoder,
    );
  }
  if (instance.receipt != null) {
    PaymentMethodDetailsCardPresentReceipt.encode(
      instance.receipt!,
      container.nestedSingleValueContainer('receipt').encoder,
    );
  }
  return container.value;
}