encode<V> static method
V
encode<
V>( - Account instance,
- Encoder<V> encoder
)
override
Implementation
static V encode<V>(
Account instance,
Encoder<V> encoder,
) {
final container = encoder.container<String>();
if (instance.businessProfile != null) {
AccountBusinessProfile.encode(
instance.businessProfile!,
container.nestedSingleValueContainer('business_profile').encoder,
);
}
if (instance.businessType != null) {
container.encodeString(
'business_type',
instance.businessType!,
);
}
if (instance.capabilities != null) {
AccountCapabilities.encode(
instance.capabilities!,
container.nestedSingleValueContainer('capabilities').encoder,
);
}
if (instance.chargesEnabled != null) {
container.encodeBool(
'charges_enabled',
instance.chargesEnabled!,
);
}
if (instance.company != null) {
LegalEntityCompany.encode(
instance.company!,
container.nestedSingleValueContainer('company').encoder,
);
}
if (instance.controller != null) {
AccountUnificationAccountController.encode(
instance.controller!,
container.nestedSingleValueContainer('controller').encoder,
);
}
if (instance.country != null) {
container.encodeString(
'country',
instance.country!,
);
}
if (instance.created != null) {
container.encodeDateTime(
'created',
instance.created!,
);
}
if (instance.defaultCurrency != null) {
container.encodeString(
'default_currency',
instance.defaultCurrency!,
);
}
if (instance.detailsSubmitted != null) {
container.encodeBool(
'details_submitted',
instance.detailsSubmitted!,
);
}
if (instance.email != null) {
container.encodeString(
'email',
instance.email!,
);
}
if (instance.externalAccounts != null) {
AccountExternalAccounts.encode(
instance.externalAccounts!,
container.nestedSingleValueContainer('external_accounts').encoder,
);
}
if (instance.futureRequirements != null) {
AccountFutureRequirements.encode(
instance.futureRequirements!,
container.nestedSingleValueContainer('future_requirements').encoder,
);
}
container.encodeString(
'id',
instance.id,
);
if (instance.individual != null) {
Person.encode(
instance.individual!,
container.nestedSingleValueContainer('individual').encoder,
);
}
if (instance.metadata != null) {
container.encodeMap(
'metadata',
(container) => instance.metadata!.forEach((
key,
value,
) =>
container.encodeString(
key,
value,
)),
);
}
container.encodeString(
'object',
'account',
);
if (instance.payoutsEnabled != null) {
container.encodeBool(
'payouts_enabled',
instance.payoutsEnabled!,
);
}
if (instance.requirements != null) {
AccountRequirements.encode(
instance.requirements!,
container.nestedSingleValueContainer('requirements').encoder,
);
}
if (instance.settings != null) {
AccountSettings.encode(
instance.settings!,
container.nestedSingleValueContainer('settings').encoder,
);
}
if (instance.tosAcceptance != null) {
AccountTosAcceptance.encode(
instance.tosAcceptance!,
container.nestedSingleValueContainer('tos_acceptance').encoder,
);
}
if (instance.type != null) {
container.encodeString(
'type',
instance.type!,
);
}
return container.value;
}