encode<V> static method

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

Implementation

static V encode<V>(
  TreasuryOutboundTransferCreateOptions instance,
  Encoder<V> encoder,
) {
  final container = encoder.container<String>();
  container.encodeInt(
    'amount',
    instance.amount,
  );
  container.encodeString(
    'currency',
    instance.currency,
  );
  if (instance.description != null) {
    container.encodeString(
      'description',
      instance.description!,
    );
  }
  if (instance.destinationPaymentMethod != null) {
    container.encodeString(
      'destination_payment_method',
      instance.destinationPaymentMethod!,
    );
  }
  if (instance.destinationPaymentMethodOptions != null) {
    OutboundPaymentDestinationPaymentMethodOptions.encode(
      instance.destinationPaymentMethodOptions!,
      container
          .nestedSingleValueContainer('destination_payment_method_options')
          .encoder,
    );
  }
  if (instance.expand != null) {
    container.encodeList(
      'expand',
      (container) =>
          instance.expand!.forEach((el) => container.encodeString(el)),
    );
  }
  container.encodeString(
    'financial_account',
    instance.financialAccount,
  );
  if (instance.metadata != null) {
    container.encodeMap(
      'metadata',
      (container) => instance.metadata!.forEach((
        key,
        value,
      ) =>
          container.encodeString(
            key,
            value,
          )),
    );
  }
  if (instance.statementDescriptor != null) {
    container.encodeString(
      'statement_descriptor',
      instance.statementDescriptor!,
    );
  }
  return container.value;
}