encode<V> static method

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

Implementation

static V encode<V>(
  SessionBankTransfer instance,
  Encoder<V> encoder,
) {
  final container = encoder.container<String>();
  if (instance.euBankTransfer != null) {
    SessionEuBankTransfer.encode(
      instance.euBankTransfer!,
      container.nestedSingleValueContainer('eu_bank_transfer').encoder,
    );
  }
  if (instance.requestedAddressTypes != null) {
    container.encodeList(
      'requested_address_types',
      (container) => instance.requestedAddressTypes!.forEach((el) =>
          CheckoutCustomerBalanceBankTransferPaymentMethodOptionsRequestedAddressTypesItem
              .encode(
            el,
            container.nestedSingleValueContainer().encoder,
          )),
    );
  }
  CustomerBalanceResourceCashBalanceTransactionResourceFundedTransactionResourceBankTransferType
      .encode(
    instance.type,
    container.nestedSingleValueContainer('type').encoder,
  );
  return container.value;
}