encode<V> static method

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

Implementation

static V encode<V>(
  CustomerInvoiceSettings instance,
  Encoder<V> encoder,
) {
  final container = encoder.container<String>();
  if (instance.customFields != null) {
    container.encodeList(
      'custom_fields',
      (container) => instance.customFields!
          .forEach((el) => InvoiceSettingCustomField.encode(
                el,
                container.nestedSingleValueContainer().encoder,
              )),
    );
  }
  if (instance.defaultPaymentMethod != null) {
    container.encodeString(
      'default_payment_method',
      instance.defaultPaymentMethod!,
    );
  }
  if (instance.footer != null) {
    container.encodeString(
      'footer',
      instance.footer!,
    );
  }
  if (instance.renderingOptions != null) {
    SessionRenderingOptions.encode(
      instance.renderingOptions!,
      container.nestedSingleValueContainer('rendering_options').encoder,
    );
  }
  return container.value;
}