encode<V> static method

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

Implementation

static V encode<V>(
  IssuingAuthorizationCreateOptions instance,
  Encoder<V> encoder,
) {
  final container = encoder.container<String>();
  container.encodeInt(
    'amount',
    instance.amount,
  );
  if (instance.amountDetails != null) {
    AuthorizationAmountDetails.encode(
      instance.amountDetails!,
      container.nestedSingleValueContainer('amount_details').encoder,
    );
  }
  if (instance.authorizationMethod != null) {
    IssuingAuthorizationAuthorizationMethod.encode(
      instance.authorizationMethod!,
      container.nestedSingleValueContainer('authorization_method').encoder,
    );
  }
  container.encodeString(
    'card',
    instance.card,
  );
  if (instance.currency != null) {
    container.encodeString(
      'currency',
      instance.currency!,
    );
  }
  if (instance.expand != null) {
    container.encodeList(
      'expand',
      (container) =>
          instance.expand!.forEach((el) => container.encodeString(el)),
    );
  }
  if (instance.isAmountControllable != null) {
    container.encodeBool(
      'is_amount_controllable',
      instance.isAmountControllable!,
    );
  }
  if (instance.merchantData != null) {
    AuthorizationMerchantData.encode(
      instance.merchantData!,
      container.nestedSingleValueContainer('merchant_data').encoder,
    );
  }
  if (instance.networkData != null) {
    AuthorizationNetworkData.encode(
      instance.networkData!,
      container.nestedSingleValueContainer('network_data').encoder,
    );
  }
  if (instance.verificationData != null) {
    AuthorizationVerificationData.encode(
      instance.verificationData!,
      container.nestedSingleValueContainer('verification_data').encoder,
    );
  }
  if (instance.wallet != null) {
    IssuingTokenWalletProvider.encode(
      instance.wallet!,
      container.nestedSingleValueContainer('wallet').encoder,
    );
  }
  return container.value;
}