encode<V> static method

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

Implementation

static V encode<V>(
  CheckoutSessionCustomerDetails instance,
  Encoder<V> encoder,
) {
  final container = encoder.container<String>();
  if (instance.address != null) {
    Address.encode(
      instance.address!,
      container.nestedSingleValueContainer('address').encoder,
    );
  }
  if (instance.email != null) {
    container.encodeString(
      'email',
      instance.email!,
    );
  }
  if (instance.name != null) {
    container.encodeString(
      'name',
      instance.name!,
    );
  }
  if (instance.phone != null) {
    container.encodeString(
      'phone',
      instance.phone!,
    );
  }
  if (instance.taxExempt != null) {
    container.encodeString(
      'tax_exempt',
      instance.taxExempt!,
    );
  }
  if (instance.taxIds != null) {
    container.encodeList(
      'tax_ids',
      (container) => instance.taxIds!
          .forEach((el) => PaymentPagesCheckoutSessionTaxId.encode(
                el,
                container.nestedSingleValueContainer().encoder,
              )),
    );
  }
  return container.value;
}