encode<V> static method
Implementation
static V encode<V>(
SessionSubscriptionData instance,
Encoder<V> encoder,
) {
final container = encoder.container<String>();
if (instance.applicationFeePercent != null) {
container.encodeDouble(
'application_fee_percent',
instance.applicationFeePercent!,
);
}
if (instance.billingCycleAnchor != null) {
container.encodeDateTime(
'billing_cycle_anchor',
instance.billingCycleAnchor!,
);
}
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.invoiceSettings != null) {
SessionInvoiceSettings.encode(
instance.invoiceSettings!,
container.nestedSingleValueContainer('invoice_settings').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.prorationBehavior != null) {
container.encodeString(
'proration_behavior',
instance.prorationBehavior!,
);
}
if (instance.transferData != null) {
SessionTransferData.encode(
instance.transferData!,
container.nestedSingleValueContainer('transfer_data').encoder,
);
}
if (instance.trialEnd != null) {
container.encodeDateTime(
'trial_end',
instance.trialEnd!,
);
}
if (instance.trialPeriodDays != null) {
container.encodeInt(
'trial_period_days',
instance.trialPeriodDays!,
);
}
if (instance.trialSettings != null) {
SessionTrialSettings.encode(
instance.trialSettings!,
container.nestedSingleValueContainer('trial_settings').encoder,
);
}
return container.value;
}