encode<V> static method

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

Implementation

static V encode<V>(
  PaymentIntentNextActionDisplayBankTransferInstructions instance,
  Encoder<V> encoder,
) {
  final container = encoder.container<String>();
  if (instance.amountRemaining != null) {
    container.encodeInt(
      'amount_remaining',
      instance.amountRemaining!,
    );
  }
  if (instance.currency != null) {
    container.encodeString(
      'currency',
      instance.currency!,
    );
  }
  if (instance.financialAddresses != null) {
    container.encodeList(
      'financial_addresses',
      (container) => instance.financialAddresses!.forEach(
          (el) => FundingInstructionsBankTransferFinancialAddress.encode(
                el,
                container.nestedSingleValueContainer().encoder,
              )),
    );
  }
  if (instance.hostedInstructionsUrl != null) {
    container.encodeString(
      'hosted_instructions_url',
      instance.hostedInstructionsUrl!,
    );
  }
  if (instance.reference != null) {
    container.encodeString(
      'reference',
      instance.reference!,
    );
  }
  CustomerBalanceResourceCashBalanceTransactionResourceFundedTransactionResourceBankTransferType
      .encode(
    instance.type,
    container.nestedSingleValueContainer('type').encoder,
  );
  return container.value;
}