encode<V> static method
Implementation
static V encode<V>(
SetupIntentUpdateOptions instance,
Encoder<V> encoder,
) {
final container = encoder.container<String>();
if (instance.attachToSelf != null) {
container.encodeBool(
'attach_to_self',
instance.attachToSelf!,
);
}
if (instance.customer != null) {
container.encodeString(
'customer',
instance.customer!,
);
}
if (instance.description != null) {
container.encodeString(
'description',
instance.description!,
);
}
if (instance.expand != null) {
container.encodeList(
'expand',
(container) =>
instance.expand!.forEach((el) => container.encodeString(el)),
);
}
if (instance.flowDirections != null) {
container.encodeList(
'flow_directions',
(container) => instance.flowDirections!
.forEach((el) => SetupAttemptFlowDirectionsItem.encode(
el,
container.nestedSingleValueContainer().encoder,
)),
);
}
if (instance.metadata != null) {
container.encodeMap(
'metadata',
(container) => instance.metadata!.forEach((
key,
value,
) =>
container.encodeString(
key,
value,
)),
);
}
if (instance.paymentMethod != null) {
container.encodeString(
'payment_method',
instance.paymentMethod!,
);
}
if (instance.paymentMethodConfiguration != null) {
container.encodeString(
'payment_method_configuration',
instance.paymentMethodConfiguration!,
);
}
if (instance.paymentMethodData != null) {
PaymentIntentPaymentMethodData.encode(
instance.paymentMethodData!,
container.nestedSingleValueContainer('payment_method_data').encoder,
);
}
if (instance.paymentMethodOptions != null) {
SetupIntentCreateOptionsPaymentMethodOptions.encode(
instance.paymentMethodOptions!,
container.nestedSingleValueContainer('payment_method_options').encoder,
);
}
if (instance.paymentMethodTypes != null) {
container.encodeList(
'payment_method_types',
(container) => instance.paymentMethodTypes!
.forEach((el) => container.encodeString(el)),
);
}
return container.value;
}