encode<V> static method
V
encode<
V>( - Dispute instance,
- Encoder<V> encoder
)
override
Implementation
static V encode<V>(
Dispute instance,
Encoder<V> encoder,
) {
final container = encoder.container<String>();
container.encodeInt(
'amount',
instance.amount,
);
container.encodeList(
'balance_transactions',
(container) => instance.balanceTransactions
.forEach((el) => BalanceTransaction.encode(
el,
container.nestedSingleValueContainer().encoder,
)),
);
ChargeOrId.encode(
instance.charge,
container.nestedSingleValueContainer('charge').encoder,
);
container.encodeDateTime(
'created',
instance.created,
);
container.encodeString(
'currency',
instance.currency,
);
DisputeEvidence.encode(
instance.evidence,
container.nestedSingleValueContainer('evidence').encoder,
);
DisputeEvidenceDetails.encode(
instance.evidenceDetails,
container.nestedSingleValueContainer('evidence_details').encoder,
);
container.encodeString(
'id',
instance.id,
);
container.encodeBool(
'is_charge_refundable',
instance.isChargeRefundable,
);
container.encodeBool(
'livemode',
instance.livemode,
);
container.encodeMap(
'metadata',
(container) => instance.metadata.forEach((
key,
value,
) =>
container.encodeString(
key,
value,
)),
);
if (instance.networkReasonCode != null) {
container.encodeString(
'network_reason_code',
instance.networkReasonCode!,
);
}
container.encodeString(
'object',
'dispute',
);
if (instance.paymentIntent != null) {
PaymentIntentOrId.encode(
instance.paymentIntent!,
container.nestedSingleValueContainer('payment_intent').encoder,
);
}
if (instance.paymentMethodDetails != null) {
DisputePaymentMethodDetails.encode(
instance.paymentMethodDetails!,
container.nestedSingleValueContainer('payment_method_details').encoder,
);
}
container.encodeString(
'reason',
instance.reason,
);
container.encodeString(
'status',
instance.status,
);
return container.value;
}