encode<V> static method

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

Implementation

static V encode<V>(
  CardShipping instance,
  Encoder<V> encoder,
) {
  final container = encoder.container<String>();
  CardholderAddress.encode(
    instance.address,
    container.nestedSingleValueContainer('address').encoder,
  );
  if (instance.customs != null) {
    CardCustoms.encode(
      instance.customs!,
      container.nestedSingleValueContainer('customs').encoder,
    );
  }
  container.encodeString(
    'name',
    instance.name,
  );
  if (instance.phoneNumber != null) {
    container.encodeString(
      'phone_number',
      instance.phoneNumber!,
    );
  }
  if (instance.requireSignature != null) {
    container.encodeBool(
      'require_signature',
      instance.requireSignature!,
    );
  }
  if (instance.service != null) {
    IssuingCardShippingService.encode(
      instance.service!,
      container.nestedSingleValueContainer('service').encoder,
    );
  }
  if (instance.type != null) {
    IssuingCardShippingType.encode(
      instance.type!,
      container.nestedSingleValueContainer('type').encoder,
    );
  }
  return container.value;
}