encode<V> static method

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

Implementation

static V encode<V>(
  InvoicesPaymentSettings instance,
  Encoder<V> encoder,
) {
  final container = encoder.container<String>();
  if (instance.defaultMandate != null) {
    container.encodeString(
      'default_mandate',
      instance.defaultMandate!,
    );
  }
  if (instance.paymentMethodOptions != null) {
    InvoicesPaymentMethodOptions.encode(
      instance.paymentMethodOptions!,
      container.nestedSingleValueContainer('payment_method_options').encoder,
    );
  }
  if (instance.paymentMethodTypes != null) {
    container.encodeList(
      'payment_method_types',
      (container) => instance.paymentMethodTypes!
          .forEach((el) => container.encodeString(el)),
    );
  }
  return container.value;
}