encode<V> static method
Implementation
static V encode<V>(
TerminalReaderRefundPaymentOptions instance,
Encoder<V> encoder,
) {
final container = encoder.container<String>();
if (instance.amount != null) {
container.encodeInt(
'amount',
instance.amount!,
);
}
if (instance.charge != null) {
container.encodeString(
'charge',
instance.charge!,
);
}
if (instance.expand != null) {
container.encodeList(
'expand',
(container) =>
instance.expand!.forEach((el) => container.encodeString(el)),
);
}
if (instance.metadata != null) {
container.encodeMap(
'metadata',
(container) => instance.metadata!.forEach((
key,
value,
) =>
container.encodeString(
key,
value,
)),
);
}
if (instance.paymentIntent != null) {
container.encodeString(
'payment_intent',
instance.paymentIntent!,
);
}
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;
}