encode<V> static method

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

Implementation

static V encode<V>(
  IssuingNetworkTokenWalletProvider instance,
  Encoder<V> encoder,
) {
  final container = encoder.container<String>();
  if (instance.accountId != null) {
    container.encodeString(
      'account_id',
      instance.accountId!,
    );
  }
  if (instance.accountTrustScore != null) {
    container.encodeInt(
      'account_trust_score',
      instance.accountTrustScore!,
    );
  }
  if (instance.cardNumberSource != null) {
    container.encodeString(
      'card_number_source',
      instance.cardNumberSource!,
    );
  }
  if (instance.cardholderAddress != null) {
    IssuingNetworkTokenAddress.encode(
      instance.cardholderAddress!,
      container.nestedSingleValueContainer('cardholder_address').encoder,
    );
  }
  if (instance.cardholderName != null) {
    container.encodeString(
      'cardholder_name',
      instance.cardholderName!,
    );
  }
  if (instance.deviceTrustScore != null) {
    container.encodeInt(
      'device_trust_score',
      instance.deviceTrustScore!,
    );
  }
  if (instance.hashedAccountEmailAddress != null) {
    container.encodeString(
      'hashed_account_email_address',
      instance.hashedAccountEmailAddress!,
    );
  }
  if (instance.reasonCodes != null) {
    container.encodeList(
      'reason_codes',
      (container) =>
          instance.reasonCodes!.forEach((el) => container.encodeString(el)),
    );
  }
  if (instance.suggestedDecision != null) {
    container.encodeString(
      'suggested_decision',
      instance.suggestedDecision!,
    );
  }
  if (instance.suggestedDecisionVersion != null) {
    container.encodeString(
      'suggested_decision_version',
      instance.suggestedDecisionVersion!,
    );
  }
  return container.value;
}