encode<V> static method

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

Implementation

static V encode<V>(
  SubscriptionPaymentSettings instance,
  Encoder<V> encoder,
) {
  final container = encoder.container<String>();
  if (instance.paymentMethodOptions != null) {
    SubscriptionPaymentSettingsPaymentMethodOptions.encode(
      instance.paymentMethodOptions!,
      container.nestedSingleValueContainer('payment_method_options').encoder,
    );
  }
  if (instance.paymentMethodTypes != null) {
    container.encodeList(
      'payment_method_types',
      (container) => instance.paymentMethodTypes!.forEach(
          (el) => InvoicesPaymentSettingsPaymentMethodTypesItem.encode(
                el,
                container.nestedSingleValueContainer().encoder,
              )),
    );
  }
  if (instance.saveDefaultPaymentMethod != null) {
    container.encodeString(
      'save_default_payment_method',
      instance.saveDefaultPaymentMethod!,
    );
  }
  return container.value;
}