encode<V> static method
Implementation
static V encode<V>(
ConfirmationToken instance,
Encoder<V> encoder,
) {
final container = encoder.container<String>();
container.encodeDateTime(
'created',
instance.created,
);
if (instance.expiresAt != null) {
container.encodeDateTime(
'expires_at',
instance.expiresAt!,
);
}
container.encodeString(
'id',
instance.id,
);
container.encodeBool(
'livemode',
instance.livemode,
);
if (instance.mandateData != null) {
ConfirmationTokenMandateData.encode(
instance.mandateData!,
container.nestedSingleValueContainer('mandate_data').encoder,
);
}
container.encodeString(
'object',
'confirmation_token',
);
if (instance.paymentIntent != null) {
container.encodeString(
'payment_intent',
instance.paymentIntent!,
);
}
if (instance.paymentMethodPreview != null) {
ConfirmationTokenPaymentMethodPreview.encode(
instance.paymentMethodPreview!,
container.nestedSingleValueContainer('payment_method_preview').encoder,
);
}
if (instance.returnUrl != null) {
container.encodeString(
'return_url',
instance.returnUrl!,
);
}
if (instance.setupFutureUsage != null) {
container.encodeString(
'setup_future_usage',
instance.setupFutureUsage!,
);
}
if (instance.setupIntent != null) {
container.encodeString(
'setup_intent',
instance.setupIntent!,
);
}
if (instance.shipping != null) {
ConfirmationTokenShipping.encode(
instance.shipping!,
container.nestedSingleValueContainer('shipping').encoder,
);
}
container.encodeBool(
'use_stripe_sdk',
instance.useStripeSdk,
);
return container.value;
}