encode<V> static method
Implementation
static V encode<V>(
IssuingCardCreateOptions instance,
Encoder<V> encoder,
) {
final container = encoder.container<String>();
if (instance.cardholder != null) {
container.encodeString(
'cardholder',
instance.cardholder!,
);
}
container.encodeString(
'currency',
instance.currency,
);
if (instance.expand != null) {
container.encodeList(
'expand',
(container) =>
instance.expand!.forEach((el) => container.encodeString(el)),
);
}
if (instance.financialAccount != null) {
container.encodeString(
'financial_account',
instance.financialAccount!,
);
}
if (instance.metadata != null) {
container.encodeMap(
'metadata',
(container) => instance.metadata!.forEach((
key,
value,
) =>
container.encodeString(
key,
value,
)),
);
}
if (instance.personalizationDesign != null) {
container.encodeString(
'personalization_design',
instance.personalizationDesign!,
);
}
if (instance.pin != null) {
CardPin.encode(
instance.pin!,
container.nestedSingleValueContainer('pin').encoder,
);
}
if (instance.replacementFor != null) {
container.encodeString(
'replacement_for',
instance.replacementFor!,
);
}
if (instance.replacementReason != null) {
container.encodeString(
'replacement_reason',
instance.replacementReason!,
);
}
if (instance.secondLine != null) {
container.encodeString(
'second_line',
instance.secondLine!,
);
}
if (instance.shipping != null) {
CardShipping.encode(
instance.shipping!,
container.nestedSingleValueContainer('shipping').encoder,
);
}
if (instance.spendingControls != null) {
CardSpendingControls.encode(
instance.spendingControls!,
container.nestedSingleValueContainer('spending_controls').encoder,
);
}
if (instance.status != null) {
BillingMeterStatus.encode(
instance.status!,
container.nestedSingleValueContainer('status').encoder,
);
}
IssuingCardType.encode(
instance.type,
container.nestedSingleValueContainer('type').encoder,
);
return container.value;
}