encode<V> static method
Implementation
static V encode<V>(
QuoteUpdateOptions instance,
Encoder<V> encoder,
) {
final container = encoder.container<String>();
if (instance.applicationFeeAmount != null) {
container.encodeInt(
'application_fee_amount',
instance.applicationFeeAmount!,
);
}
if (instance.applicationFeePercent != null) {
container.encodeDouble(
'application_fee_percent',
instance.applicationFeePercent!,
);
}
if (instance.automaticTax != null) {
SessionAutomaticTax.encode(
instance.automaticTax!,
container.nestedSingleValueContainer('automatic_tax').encoder,
);
}
if (instance.collectionMethod != null) {
InvoiceCollectionMethod.encode(
instance.collectionMethod!,
container.nestedSingleValueContainer('collection_method').encoder,
);
}
if (instance.customer != null) {
container.encodeString(
'customer',
instance.customer!,
);
}
if (instance.defaultTaxRates != null) {
container.encodeList(
'default_tax_rates',
(container) => instance.defaultTaxRates!
.forEach((el) => container.encodeString(el)),
);
}
if (instance.description != null) {
container.encodeString(
'description',
instance.description!,
);
}
if (instance.discounts != null) {
container.encodeList(
'discounts',
(container) =>
instance.discounts!.forEach((el) => InvoiceItemDiscountsItem.encode(
el,
container.nestedSingleValueContainer().encoder,
)),
);
}
if (instance.expand != null) {
container.encodeList(
'expand',
(container) =>
instance.expand!.forEach((el) => container.encodeString(el)),
);
}
if (instance.expiresAt != null) {
container.encodeDateTime(
'expires_at',
instance.expiresAt!,
);
}
if (instance.footer != null) {
container.encodeString(
'footer',
instance.footer!,
);
}
if (instance.header != null) {
container.encodeString(
'header',
instance.header!,
);
}
if (instance.invoiceSettings != null) {
QuoteInvoiceSettings.encode(
instance.invoiceSettings!,
container.nestedSingleValueContainer('invoice_settings').encoder,
);
}
if (instance.lineItems != null) {
container.encodeList(
'line_items',
(container) => instance.lineItems!
.forEach((el) => QuoteUpdateOptionsLineItemsItem.encode(
el,
container.nestedSingleValueContainer().encoder,
)),
);
}
if (instance.metadata != null) {
container.encodeMap(
'metadata',
(container) => instance.metadata!.forEach((
key,
value,
) =>
container.encodeString(
key,
value,
)),
);
}
if (instance.onBehalfOf != null) {
container.encodeString(
'on_behalf_of',
instance.onBehalfOf!,
);
}
if (instance.subscriptionData != null) {
QuoteUpdateOptionsSubscriptionData.encode(
instance.subscriptionData!,
container.nestedSingleValueContainer('subscription_data').encoder,
);
}
if (instance.transferData != null) {
QuoteCreateOptionsTransferData.encode(
instance.transferData!,
container.nestedSingleValueContainer('transfer_data').encoder,
);
}
return container.value;
}