encode<V> static method
Implementation
static V encode<V>(
SessionPaymentIntentData instance,
Encoder<V> encoder,
) {
final container = encoder.container<String>();
if (instance.applicationFeeAmount != null) {
container.encodeInt(
'application_fee_amount',
instance.applicationFeeAmount!,
);
}
if (instance.captureMethod != null) {
PaymentIntentCaptureMethod.encode(
instance.captureMethod!,
container.nestedSingleValueContainer('capture_method').encoder,
);
}
if (instance.description != null) {
container.encodeString(
'description',
instance.description!,
);
}
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.receiptEmail != null) {
container.encodeString(
'receipt_email',
instance.receiptEmail!,
);
}
if (instance.setupFutureUsage != null) {
container.encodeString(
'setup_future_usage',
instance.setupFutureUsage!,
);
}
if (instance.shipping != null) {
SessionShipping.encode(
instance.shipping!,
container.nestedSingleValueContainer('shipping').encoder,
);
}
if (instance.statementDescriptor != null) {
container.encodeString(
'statement_descriptor',
instance.statementDescriptor!,
);
}
if (instance.statementDescriptorSuffix != null) {
container.encodeString(
'statement_descriptor_suffix',
instance.statementDescriptorSuffix!,
);
}
if (instance.transferData != null) {
ChargeCreateOptionsTransferData.encode(
instance.transferData!,
container.nestedSingleValueContainer('transfer_data').encoder,
);
}
if (instance.transferGroup != null) {
container.encodeString(
'transfer_group',
instance.transferGroup!,
);
}
return container.value;
}