encode<V> static method

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

Implementation

static V encode<V>(
  InvoicePaymentSettings instance,
  Encoder<V> encoder,
) {
  final container = encoder.container<String>();
  if (instance.defaultMandate != null) {
    container.encodeString(
      'default_mandate',
      instance.defaultMandate!,
    );
  }
  if (instance.paymentMethodOptions != null) {
    InvoicePaymentMethodOptions.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,
              )),
    );
  }
  return container.value;
}