encode<V> static method
Implementation
static V encode<V>(
CustomerCashBalanceTransaction instance,
Encoder<V> encoder,
) {
final container = encoder.container<String>();
if (instance.adjustedForOverdraft != null) {
CustomerBalanceResourceCashBalanceTransactionResourceAdjustedForOverdraft
.encode(
instance.adjustedForOverdraft!,
container.nestedSingleValueContainer('adjusted_for_overdraft').encoder,
);
}
if (instance.appliedToPayment != null) {
CustomerBalanceResourceCashBalanceTransactionResourceAppliedToPaymentTransaction
.encode(
instance.appliedToPayment!,
container.nestedSingleValueContainer('applied_to_payment').encoder,
);
}
container.encodeDateTime(
'created',
instance.created,
);
container.encodeString(
'currency',
instance.currency,
);
CustomerOrId.encode(
instance.customer,
container.nestedSingleValueContainer('customer').encoder,
);
container.encodeInt(
'ending_balance',
instance.endingBalance,
);
if (instance.funded != null) {
CustomerBalanceResourceCashBalanceTransactionResourceFundedTransaction
.encode(
instance.funded!,
container.nestedSingleValueContainer('funded').encoder,
);
}
container.encodeString(
'id',
instance.id,
);
container.encodeBool(
'livemode',
instance.livemode,
);
container.encodeInt(
'net_amount',
instance.netAmount,
);
container.encodeString(
'object',
'customer_cash_balance_transaction',
);
if (instance.refundedFromPayment != null) {
CustomerBalanceResourceCashBalanceTransactionResourceRefundedFromPaymentTransaction
.encode(
instance.refundedFromPayment!,
container.nestedSingleValueContainer('refunded_from_payment').encoder,
);
}
if (instance.transferredToBalance != null) {
CustomerBalanceResourceCashBalanceTransactionResourceTransferredToBalance
.encode(
instance.transferredToBalance!,
container.nestedSingleValueContainer('transferred_to_balance').encoder,
);
}
container.encodeString(
'type',
instance.type,
);
if (instance.unappliedFromPayment != null) {
CustomerBalanceResourceCashBalanceTransactionResourceUnappliedFromPaymentTransaction
.encode(
instance.unappliedFromPayment!,
container.nestedSingleValueContainer('unapplied_from_payment').encoder,
);
}
return container.value;
}