encode<V> static method
Implementation
static V encode<V>(
TreasuryDebitReversal instance,
Encoder<V> encoder,
) {
final container = encoder.container<String>();
container.encodeInt(
'amount',
instance.amount,
);
container.encodeDateTime(
'created',
instance.created,
);
container.encodeString(
'currency',
instance.currency,
);
if (instance.financialAccount != null) {
container.encodeString(
'financial_account',
instance.financialAccount!,
);
}
if (instance.hostedRegulatoryReceiptUrl != null) {
container.encodeString(
'hosted_regulatory_receipt_url',
instance.hostedRegulatoryReceiptUrl!,
);
}
container.encodeString(
'id',
instance.id,
);
if (instance.linkedFlows != null) {
TreasuryDebitReversalLinkedFlows.encode(
instance.linkedFlows!,
container.nestedSingleValueContainer('linked_flows').encoder,
);
}
container.encodeBool(
'livemode',
instance.livemode,
);
container.encodeMap(
'metadata',
(container) => instance.metadata.forEach((
key,
value,
) =>
container.encodeString(
key,
value,
)),
);
container.encodeString(
'network',
instance.network,
);
container.encodeString(
'object',
'treasury.debit_reversal',
);
container.encodeString(
'received_debit',
instance.receivedDebit,
);
container.encodeString(
'status',
instance.status,
);
TreasuryReceivedDebitsResourceStatusTransitions.encode(
instance.statusTransitions,
container.nestedSingleValueContainer('status_transitions').encoder,
);
if (instance.transaction != null) {
TreasuryTransactionOrId.encode(
instance.transaction!,
container.nestedSingleValueContainer('transaction').encoder,
);
}
return container.value;
}