encode<V> static method

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

Implementation

static V encode<V>(
  UpcomingCustomerDetails instance,
  Encoder<V> encoder,
) {
  final container = encoder.container<String>();
  if (instance.address != null) {
    AccountSupportAddress.encode(
      instance.address!,
      container.nestedSingleValueContainer('address').encoder,
    );
  }
  if (instance.shipping != null) {
    CustomerShipping.encode(
      instance.shipping!,
      container.nestedSingleValueContainer('shipping').encoder,
    );
  }
  if (instance.tax != null) {
    UpcomingCustomerDetailsTax.encode(
      instance.tax!,
      container.nestedSingleValueContainer('tax').encoder,
    );
  }
  if (instance.taxExempt != null) {
    CustomerTaxExempt.encode(
      instance.taxExempt!,
      container.nestedSingleValueContainer('tax_exempt').encoder,
    );
  }
  if (instance.taxIds != null) {
    container.encodeList(
      'tax_ids',
      (container) =>
          instance.taxIds!.forEach((el) => CustomerTaxIdDataItem.encode(
                el,
                container.nestedSingleValueContainer().encoder,
              )),
    );
  }
  return container.value;
}