encode<V> static method
V
encode<
V>( - Payout instance,
- Encoder<V> encoder
)
override
Implementation
static V encode<V>(
Payout instance,
Encoder<V> encoder,
) {
final container = encoder.container<String>();
container.encodeInt(
'amount',
instance.amount,
);
container.encodeDateTime(
'arrival_date',
instance.arrivalDate,
);
container.encodeBool(
'automatic',
instance.automatic,
);
if (instance.balanceTransaction != null) {
BalanceTransactionOrId.encode(
instance.balanceTransaction!,
container.nestedSingleValueContainer('balance_transaction').encoder,
);
}
container.encodeDateTime(
'created',
instance.created,
);
container.encodeString(
'currency',
instance.currency,
);
if (instance.description != null) {
container.encodeString(
'description',
instance.description!,
);
}
if (instance.destination != null) {
PayoutDestinationOrId.encode(
instance.destination!,
container.nestedSingleValueContainer('destination').encoder,
);
}
if (instance.failureBalanceTransaction != null) {
BalanceTransactionOrId.encode(
instance.failureBalanceTransaction!,
container
.nestedSingleValueContainer('failure_balance_transaction')
.encoder,
);
}
if (instance.failureCode != null) {
container.encodeString(
'failure_code',
instance.failureCode!,
);
}
if (instance.failureMessage != null) {
container.encodeString(
'failure_message',
instance.failureMessage!,
);
}
container.encodeString(
'id',
instance.id,
);
container.encodeBool(
'livemode',
instance.livemode,
);
if (instance.metadata != null) {
container.encodeMap(
'metadata',
(container) => instance.metadata!.forEach((
key,
value,
) =>
container.encodeString(
key,
value,
)),
);
}
container.encodeString(
'method',
instance.method,
);
container.encodeString(
'object',
'payout',
);
if (instance.originalPayout != null) {
PayoutOrId.encode(
instance.originalPayout!,
container.nestedSingleValueContainer('original_payout').encoder,
);
}
container.encodeString(
'reconciliation_status',
instance.reconciliationStatus,
);
if (instance.reversedBy != null) {
PayoutOrId.encode(
instance.reversedBy!,
container.nestedSingleValueContainer('reversed_by').encoder,
);
}
container.encodeString(
'source_type',
instance.sourceType,
);
if (instance.statementDescriptor != null) {
container.encodeString(
'statement_descriptor',
instance.statementDescriptor!,
);
}
container.encodeString(
'status',
instance.status,
);
container.encodeString(
'type',
instance.type,
);
return container.value;
}