encode<V> static method
Implementation
static V encode<V>(
TaxCalculationCreateOptions instance,
Encoder<V> encoder,
) {
final container = encoder.container<String>();
container.encodeString(
'currency',
instance.currency,
);
if (instance.customer != null) {
container.encodeString(
'customer',
instance.customer!,
);
}
if (instance.customerDetails != null) {
CalculationCustomerDetails.encode(
instance.customerDetails!,
container.nestedSingleValueContainer('customer_details').encoder,
);
}
if (instance.expand != null) {
container.encodeList(
'expand',
(container) =>
instance.expand!.forEach((el) => container.encodeString(el)),
);
}
container.encodeList(
'line_items',
(container) =>
instance.lineItems.forEach((el) => CalculationLineItemsItem.encode(
el,
container.nestedSingleValueContainer().encoder,
)),
);
if (instance.shippingCost != null) {
CalculationShippingCost.encode(
instance.shippingCost!,
container.nestedSingleValueContainer('shipping_cost').encoder,
);
}
if (instance.taxDate != null) {
container.encodeInt(
'tax_date',
instance.taxDate!,
);
}
return container.value;
}