encode<V> static method

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

Implementation

static V encode<V>(
  CalculationCustomerDetails instance,
  Encoder<V> encoder,
) {
  final container = encoder.container<String>();
  if (instance.address != null) {
    CalculationAddress.encode(
      instance.address!,
      container.nestedSingleValueContainer('address').encoder,
    );
  }
  if (instance.addressSource != null) {
    container.encodeString(
      'address_source',
      instance.addressSource!,
    );
  }
  if (instance.ipAddress != null) {
    container.encodeString(
      'ip_address',
      instance.ipAddress!,
    );
  }
  if (instance.taxIds != null) {
    container.encodeList(
      'tax_ids',
      (container) =>
          instance.taxIds!.forEach((el) => CustomerTaxIdDataItem.encode(
                el,
                container.nestedSingleValueContainer().encoder,
              )),
    );
  }
  if (instance.taxabilityOverride != null) {
    TaxProductResourceCustomerDetailsTaxabilityOverride.encode(
      instance.taxabilityOverride!,
      container.nestedSingleValueContainer('taxability_override').encoder,
    );
  }
  return container.value;
}