encode<V> static method

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

Implementation

static V encode<V>(
  InvoiceSettingCustomerSetting 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) {
    PaymentMethodOrId.encode(
      instance.defaultPaymentMethod!,
      container.nestedSingleValueContainer('default_payment_method').encoder,
    );
  }
  if (instance.footer != null) {
    container.encodeString(
      'footer',
      instance.footer!,
    );
  }
  if (instance.renderingOptions != null) {
    InvoiceRenderingOptions.encode(
      instance.renderingOptions!,
      container.nestedSingleValueContainer('rendering_options').encoder,
    );
  }
  return container.value;
}