encode<V> static method

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

Implementation

static V encode<V>(
  TaxProductResourceCustomerDetails instance,
  Encoder<V> encoder,
) {
  final container = encoder.container<String>();
  if (instance.address != null) {
    TaxProductResourceCustomerDetailsAddress.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!,
    );
  }
  container.encodeList(
    'tax_ids',
    (container) => instance.taxIds.forEach(
        (el) => TaxProductResourceCustomerDetailsResourceTaxId.encode(
              el,
              container.nestedSingleValueContainer().encoder,
            )),
  );
  container.encodeString(
    'taxability_override',
    instance.taxabilityOverride,
  );
  return container.value;
}