encode<V> static method

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

Implementation

static V encode<V>(
  IssuingAuthorizationRequest instance,
  Encoder<V> encoder,
) {
  final container = encoder.container<String>();
  container.encodeInt(
    'amount',
    instance.amount,
  );
  if (instance.amountDetails != null) {
    IssuingAuthorizationAmountDetails.encode(
      instance.amountDetails!,
      container.nestedSingleValueContainer('amount_details').encoder,
    );
  }
  container.encodeBool(
    'approved',
    instance.approved,
  );
  if (instance.authorizationCode != null) {
    container.encodeString(
      'authorization_code',
      instance.authorizationCode!,
    );
  }
  container.encodeDateTime(
    'created',
    instance.created,
  );
  container.encodeString(
    'currency',
    instance.currency,
  );
  container.encodeInt(
    'merchant_amount',
    instance.merchantAmount,
  );
  container.encodeString(
    'merchant_currency',
    instance.merchantCurrency,
  );
  if (instance.networkRiskScore != null) {
    container.encodeInt(
      'network_risk_score',
      instance.networkRiskScore!,
    );
  }
  container.encodeString(
    'reason',
    instance.reason,
  );
  if (instance.reasonMessage != null) {
    container.encodeString(
      'reason_message',
      instance.reasonMessage!,
    );
  }
  if (instance.requestedAt != null) {
    container.encodeDateTime(
      'requested_at',
      instance.requestedAt!,
    );
  }
  return container.value;
}