encode<V> static method

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

Implementation

static V encode<V>(
  PaymentMethodOptionsCustomerBalanceBankTransfer instance,
  Encoder<V> encoder,
) {
  final container = encoder.container<String>();
  if (instance.euBankTransfer != null) {
    PaymentMethodOptionsCustomerBalanceEuBankAccount.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,
          )),
    );
  }
  if (instance.type != null) {
    CheckoutCustomerBalanceBankTransferPaymentMethodOptionsType.encode(
      instance.type!,
      container.nestedSingleValueContainer('type').encoder,
    );
  }
  return container.value;
}