encode<V> static method
Implementation
static V encode<V>(
CustomerBalanceTransaction instance,
Encoder<V> encoder,
) {
final container = encoder.container<String>();
container.encodeInt(
'amount',
instance.amount,
);
container.encodeDateTime(
'created',
instance.created,
);
if (instance.creditNote != null) {
CreditNoteOrId.encode(
instance.creditNote!,
container.nestedSingleValueContainer('credit_note').encoder,
);
}
container.encodeString(
'currency',
instance.currency,
);
CustomerOrId.encode(
instance.customer,
container.nestedSingleValueContainer('customer').encoder,
);
if (instance.description != null) {
container.encodeString(
'description',
instance.description!,
);
}
container.encodeInt(
'ending_balance',
instance.endingBalance,
);
container.encodeString(
'id',
instance.id,
);
if (instance.invoice != null) {
InvoiceOrId.encode(
instance.invoice!,
container.nestedSingleValueContainer('invoice').encoder,
);
}
container.encodeBool(
'livemode',
instance.livemode,
);
if (instance.metadata != null) {
container.encodeMap(
'metadata',
(container) => instance.metadata!.forEach((
key,
value,
) =>
container.encodeString(
key,
value,
)),
);
}
container.encodeString(
'object',
'customer_balance_transaction',
);
container.encodeString(
'type',
instance.type,
);
return container.value;
}