encode<V> static method
V
encode<
V>( - Card instance,
- Encoder<V> encoder
)
override
Implementation
static V encode<V>(
Card instance,
Encoder<V> encoder,
) {
final container = encoder.container<String>();
if (instance.account != null) {
AccountOrId.encode(
instance.account!,
container.nestedSingleValueContainer('account').encoder,
);
}
if (instance.addressCity != null) {
container.encodeString(
'address_city',
instance.addressCity!,
);
}
if (instance.addressCountry != null) {
container.encodeString(
'address_country',
instance.addressCountry!,
);
}
if (instance.addressLine1 != null) {
container.encodeString(
'address_line1',
instance.addressLine1!,
);
}
if (instance.addressLine1Check != null) {
container.encodeString(
'address_line1_check',
instance.addressLine1Check!,
);
}
if (instance.addressLine2 != null) {
container.encodeString(
'address_line2',
instance.addressLine2!,
);
}
if (instance.addressState != null) {
container.encodeString(
'address_state',
instance.addressState!,
);
}
if (instance.addressZip != null) {
container.encodeString(
'address_zip',
instance.addressZip!,
);
}
if (instance.addressZipCheck != null) {
container.encodeString(
'address_zip_check',
instance.addressZipCheck!,
);
}
if (instance.availablePayoutMethods != null) {
container.encodeList(
'available_payout_methods',
(container) => instance.availablePayoutMethods!
.forEach((el) => BankAccountAvailablePayoutMethodsItem.encode(
el,
container.nestedSingleValueContainer().encoder,
)),
);
}
container.encodeString(
'brand',
instance.brand,
);
if (instance.country != null) {
container.encodeString(
'country',
instance.country!,
);
}
if (instance.currency != null) {
container.encodeString(
'currency',
instance.currency!,
);
}
if (instance.customer != null) {
BankAccountCustomerOrId.encode(
instance.customer!,
container.nestedSingleValueContainer('customer').encoder,
);
}
if (instance.cvcCheck != null) {
container.encodeString(
'cvc_check',
instance.cvcCheck!,
);
}
if (instance.defaultForCurrency != null) {
container.encodeBool(
'default_for_currency',
instance.defaultForCurrency!,
);
}
if (instance.description != null) {
container.encodeString(
'description',
instance.description!,
);
}
if (instance.dynamicLast4 != null) {
container.encodeString(
'dynamic_last4',
instance.dynamicLast4!,
);
}
container.encodeInt(
'exp_month',
instance.expMonth,
);
container.encodeInt(
'exp_year',
instance.expYear,
);
if (instance.fingerprint != null) {
container.encodeString(
'fingerprint',
instance.fingerprint!,
);
}
container.encodeString(
'funding',
instance.funding,
);
container.encodeString(
'id',
instance.id,
);
if (instance.iin != null) {
container.encodeString(
'iin',
instance.iin!,
);
}
if (instance.issuer != null) {
container.encodeString(
'issuer',
instance.issuer!,
);
}
container.encodeString(
'last4',
instance.last4,
);
if (instance.metadata != null) {
container.encodeMap(
'metadata',
(container) => instance.metadata!.forEach((
key,
value,
) =>
container.encodeString(
key,
value,
)),
);
}
if (instance.name != null) {
container.encodeString(
'name',
instance.name!,
);
}
if (instance.networks != null) {
TokenCardNetworks.encode(
instance.networks!,
container.nestedSingleValueContainer('networks').encoder,
);
}
container.encodeString(
'object',
'card',
);
if (instance.status != null) {
container.encodeString(
'status',
instance.status!,
);
}
if (instance.tokenizationMethod != null) {
container.encodeString(
'tokenization_method',
instance.tokenizationMethod!,
);
}
return container.value;
}