encode<V> static method

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

Implementation

static V encode<V>(
  SubscriptionsResourcePaymentMethodOptions instance,
  Encoder<V> encoder,
) {
  final container = encoder.container<String>();
  if (instance.acssDebit != null) {
    InvoicePaymentMethodOptionsAcssDebit.encode(
      instance.acssDebit!,
      container.nestedSingleValueContainer('acss_debit').encoder,
    );
  }
  if (instance.bancontact != null) {
    InvoicePaymentMethodOptionsBancontact.encode(
      instance.bancontact!,
      container.nestedSingleValueContainer('bancontact').encoder,
    );
  }
  if (instance.card != null) {
    SubscriptionPaymentMethodOptionsCard.encode(
      instance.card!,
      container.nestedSingleValueContainer('card').encoder,
    );
  }
  if (instance.customerBalance != null) {
    InvoicePaymentMethodOptionsCustomerBalance.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) {
    InvoicePaymentMethodOptionsUsBankAccount.encode(
      instance.usBankAccount!,
      container.nestedSingleValueContainer('us_bank_account').encoder,
    );
  }
  return container.value;
}