encode<V> static method

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

Implementation

static V encode<V>(
  SubscriptionPaymentMethodOptions instance,
  Encoder<V> encoder,
) {
  final container = encoder.container<String>();
  if (instance.acssDebit != null) {
    InvoiceAcssDebit.encode(
      instance.acssDebit!,
      container.nestedSingleValueContainer('acss_debit').encoder,
    );
  }
  if (instance.bancontact != null) {
    InvoiceBancontact.encode(
      instance.bancontact!,
      container.nestedSingleValueContainer('bancontact').encoder,
    );
  }
  if (instance.card != null) {
    SubscriptionCard.encode(
      instance.card!,
      container.nestedSingleValueContainer('card').encoder,
    );
  }
  if (instance.customerBalance != null) {
    InvoiceCustomerBalance.encode(
      instance.customerBalance!,
      container.nestedSingleValueContainer('customer_balance').encoder,
    );
  }
  if (instance.konbini != null) {
    container.encodePrimitive(
      'konbini',
      instance.konbini!,
    );
  }
  if (instance.sepaDebit != null) {
    container.encodePrimitive(
      'sepa_debit',
      instance.sepaDebit!,
    );
  }
  if (instance.usBankAccount != null) {
    InvoiceUsBankAccount.encode(
      instance.usBankAccount!,
      container.nestedSingleValueContainer('us_bank_account').encoder,
    );
  }
  return container.value;
}