encode<V> static method
Implementation
static V encode<V>(
TreasuryOutboundPayment instance,
Encoder<V> encoder,
) {
final container = encoder.container<String>();
container.encodeInt(
'amount',
instance.amount,
);
container.encodeBool(
'cancelable',
instance.cancelable,
);
container.encodeDateTime(
'created',
instance.created,
);
container.encodeString(
'currency',
instance.currency,
);
if (instance.customer != null) {
container.encodeString(
'customer',
instance.customer!,
);
}
if (instance.description != null) {
container.encodeString(
'description',
instance.description!,
);
}
if (instance.destinationPaymentMethod != null) {
container.encodeString(
'destination_payment_method',
instance.destinationPaymentMethod!,
);
}
if (instance.destinationPaymentMethodDetails != null) {
OutboundPaymentsPaymentMethodDetails.encode(
instance.destinationPaymentMethodDetails!,
container
.nestedSingleValueContainer('destination_payment_method_details')
.encoder,
);
}
if (instance.endUserDetails != null) {
TreasuryOutboundPaymentEndUserDetails.encode(
instance.endUserDetails!,
container.nestedSingleValueContainer('end_user_details').encoder,
);
}
container.encodeDateTime(
'expected_arrival_date',
instance.expectedArrivalDate,
);
container.encodeString(
'financial_account',
instance.financialAccount,
);
if (instance.hostedRegulatoryReceiptUrl != null) {
container.encodeString(
'hosted_regulatory_receipt_url',
instance.hostedRegulatoryReceiptUrl!,
);
}
container.encodeString(
'id',
instance.id,
);
container.encodeBool(
'livemode',
instance.livemode,
);
container.encodeMap(
'metadata',
(container) => instance.metadata.forEach((
key,
value,
) =>
container.encodeString(
key,
value,
)),
);
container.encodeString(
'object',
'treasury.outbound_payment',
);
if (instance.returnedDetails != null) {
TreasuryOutboundPaymentReturnedDetails.encode(
instance.returnedDetails!,
container.nestedSingleValueContainer('returned_details').encoder,
);
}
container.encodeString(
'statement_descriptor',
instance.statementDescriptor,
);
container.encodeString(
'status',
instance.status,
);
TreasuryOutboundPaymentsResourceOutboundPaymentResourceStatusTransitions
.encode(
instance.statusTransitions,
container.nestedSingleValueContainer('status_transitions').encoder,
);
TreasuryTransactionOrId.encode(
instance.transaction,
container.nestedSingleValueContainer('transaction').encoder,
);
return container.value;
}