encode<V> static method
Implementation
static V encode<V>(
TerminalReaderReaderResourceRefundPaymentAction instance,
Encoder<V> encoder,
) {
final container = encoder.container<String>();
if (instance.amount != null) {
container.encodeInt(
'amount',
instance.amount!,
);
}
if (instance.charge != null) {
ChargeOrId.encode(
instance.charge!,
container.nestedSingleValueContainer('charge').encoder,
);
}
if (instance.metadata != null) {
container.encodeMap(
'metadata',
(container) => instance.metadata!.forEach((
key,
value,
) =>
container.encodeString(
key,
value,
)),
);
}
if (instance.paymentIntent != null) {
PaymentIntentOrId.encode(
instance.paymentIntent!,
container.nestedSingleValueContainer('payment_intent').encoder,
);
}
if (instance.reason != null) {
container.encodeString(
'reason',
instance.reason!,
);
}
if (instance.refund != null) {
RefundOrId.encode(
instance.refund!,
container.nestedSingleValueContainer('refund').encoder,
);
}
if (instance.refundApplicationFee != null) {
container.encodeBool(
'refund_application_fee',
instance.refundApplicationFee!,
);
}
if (instance.refundPaymentConfig != null) {
TerminalReaderReaderResourceRefundPaymentConfig.encode(
instance.refundPaymentConfig!,
container.nestedSingleValueContainer('refund_payment_config').encoder,
);
}
if (instance.reverseTransfer != null) {
container.encodeBool(
'reverse_transfer',
instance.reverseTransfer!,
);
}
return container.value;
}