encode<V> static method
Implementation
static V encode<V>(
PersonCreateOptions instance,
Encoder<V> encoder,
) {
final container = encoder.container<String>();
if (instance.additionalTosAcceptances != null) {
PersonAdditionalTosAcceptances.encode(
instance.additionalTosAcceptances!,
container
.nestedSingleValueContainer('additional_tos_acceptances')
.encoder,
);
}
if (instance.address != null) {
AccountSupportAddress.encode(
instance.address!,
container.nestedSingleValueContainer('address').encoder,
);
}
if (instance.addressKana != null) {
AccountAddressKana.encode(
instance.addressKana!,
container.nestedSingleValueContainer('address_kana').encoder,
);
}
if (instance.addressKanji != null) {
AccountAddressKana.encode(
instance.addressKanji!,
container.nestedSingleValueContainer('address_kanji').encoder,
);
}
if (instance.dob != null) {
AccountDob.encode(
instance.dob!,
container.nestedSingleValueContainer('dob').encoder,
);
}
if (instance.documents != null) {
PersonDocuments.encode(
instance.documents!,
container.nestedSingleValueContainer('documents').encoder,
);
}
if (instance.email != null) {
container.encodeString(
'email',
instance.email!,
);
}
if (instance.expand != null) {
container.encodeList(
'expand',
(container) =>
instance.expand!.forEach((el) => container.encodeString(el)),
);
}
if (instance.firstName != null) {
container.encodeString(
'first_name',
instance.firstName!,
);
}
if (instance.firstNameKana != null) {
container.encodeString(
'first_name_kana',
instance.firstNameKana!,
);
}
if (instance.firstNameKanji != null) {
container.encodeString(
'first_name_kanji',
instance.firstNameKanji!,
);
}
if (instance.fullNameAliases != null) {
container.encodeList(
'full_name_aliases',
(container) => instance.fullNameAliases!
.forEach((el) => container.encodeString(el)),
);
}
if (instance.gender != null) {
container.encodeString(
'gender',
instance.gender!,
);
}
if (instance.idNumber != null) {
container.encodeString(
'id_number',
instance.idNumber!,
);
}
if (instance.idNumberSecondary != null) {
container.encodeString(
'id_number_secondary',
instance.idNumberSecondary!,
);
}
if (instance.lastName != null) {
container.encodeString(
'last_name',
instance.lastName!,
);
}
if (instance.lastNameKana != null) {
container.encodeString(
'last_name_kana',
instance.lastNameKana!,
);
}
if (instance.lastNameKanji != null) {
container.encodeString(
'last_name_kanji',
instance.lastNameKanji!,
);
}
if (instance.maidenName != null) {
container.encodeString(
'maiden_name',
instance.maidenName!,
);
}
if (instance.metadata != null) {
container.encodeMap(
'metadata',
(container) => instance.metadata!.forEach((
key,
value,
) =>
container.encodeString(
key,
value,
)),
);
}
if (instance.nationality != null) {
container.encodeString(
'nationality',
instance.nationality!,
);
}
if (instance.personToken != null) {
container.encodeString(
'person_token',
instance.personToken!,
);
}
if (instance.phone != null) {
container.encodeString(
'phone',
instance.phone!,
);
}
if (instance.politicalExposure != null) {
container.encodeString(
'political_exposure',
instance.politicalExposure!,
);
}
if (instance.registeredAddress != null) {
AccountSupportAddress.encode(
instance.registeredAddress!,
container.nestedSingleValueContainer('registered_address').encoder,
);
}
if (instance.relationship != null) {
PersonRelationship.encode(
instance.relationship!,
container.nestedSingleValueContainer('relationship').encoder,
);
}
if (instance.ssnLast4 != null) {
container.encodeString(
'ssn_last_4',
instance.ssnLast4!,
);
}
if (instance.verification != null) {
AccountIndividualVerification.encode(
instance.verification!,
container.nestedSingleValueContainer('verification').encoder,
);
}
return container.value;
}