Skip to content

Commit

Permalink
update and extend sep-009 kyc fields
Browse files Browse the repository at this point in the history
  • Loading branch information
christian-rogobete committed Jan 20, 2024
1 parent 321e896 commit e48f3ed
Show file tree
Hide file tree
Showing 7 changed files with 105 additions and 27 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## [1.7.3] - 18.Jan.2024.
- update and extend SEP-09 KYC fields

## [1.7.2] - 18.Jan.2024.
- extend soroban send transaction response
- improve SEP-006 support
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ The Soneso open source Stellar SDK for Flutter is build with Dart and provides A
1. Add the dependency to your pubspec.yaml file:
```
dependencies:
stellar_flutter_sdk: ^1.7.2
stellar_flutter_sdk: ^1.7.3
```
2. Install it (command line or IDE):
```
Expand Down
112 changes: 88 additions & 24 deletions lib/src/sep/0009/standard_kyc_fields.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import 'dart:typed_data';
class StandardKYCFields {
NaturalPersonKYCFields? naturalPersonKYCFields;
OrganizationKYCFields? organizationKYCFields;
FinancialAccountKYCFields? financialAccountKYCFields;
}

class NaturalPersonKYCFields {
Expand Down Expand Up @@ -49,18 +50,6 @@ class NaturalPersonKYCFields {
/// ISO Code of country of birth ISO 3166-1 alpha-3
String? birthCountryCode;

/// Number identifying bank account
String? bankAccountNumber;

/// Number identifying bank in national banking system (routing number in US)
String? bankNumber;

/// Phone number with country code for bank
String? bankPhoneNumber;

/// Number identifying bank branch
String? bankBranchNumber;

/// Tax identifier of user in their country (social security number in US)
String? taxId;

Expand Down Expand Up @@ -112,9 +101,15 @@ class NaturalPersonKYCFields {
/// male, female, or other
String? sex;

/// Image of user's proof of income document
Uint8List? proofOfIncome;

/// Video or image file of user as a liveness proof
Uint8List? proofOfLiveness;

/// User's origin (such as an id in another application) or a referral code
String? referralId;

Map<String, String> fields() {
final fields = <String, String>{};
if (lastName != null) {
Expand Down Expand Up @@ -156,18 +151,6 @@ class NaturalPersonKYCFields {
if (birthCountryCode != null) {
fields['birth_country_code'] = birthCountryCode!;
}
if (bankAccountNumber != null) {
fields['bank_account_number'] = bankAccountNumber!;
}
if (bankNumber != null) {
fields['bank_number'] = bankNumber!;
}
if (bankPhoneNumber != null) {
fields['bank_phone_number'] = bankPhoneNumber!;
}
if (bankBranchNumber != null) {
fields['bank_branch_number'] = bankBranchNumber!;
}
if (taxId != null) {
fields['tax_id'] = taxId!;
}
Expand Down Expand Up @@ -207,6 +190,9 @@ class NaturalPersonKYCFields {
if (sex != null) {
fields['sex'] = sex!;
}
if (referralId != null) {
fields['referral_id'] = referralId!;
}
return fields;
}

Expand All @@ -224,13 +210,85 @@ class NaturalPersonKYCFields {
if (photoProofResidence != null) {
files['photo_proof_residence'] = photoProofResidence!;
}
if (proofOfIncome != null) {
files['proof_of_income'] = proofOfIncome!;
}
if (proofOfLiveness != null) {
files['proof_of_liveness'] = proofOfLiveness!;
}
return files;
}
}

class FinancialAccountKYCFields {

/// ISO Code of country of birth ISO 3166-1 alpha-3
String? bankAccountType;

/// Number identifying bank account
String? bankAccountNumber;

/// Number identifying bank in national banking system (routing number in US)
String? bankNumber;

/// Phone number with country code for bank
String? bankPhoneNumber;

/// Number identifying bank branch
String? bankBranchNumber;

/// Bank account number for Mexico
String? clabeNumber;

/// Clave Bancaria Uniforme (CBU) or Clave Virtual Uniforme (CVU).
String? cbuNumber;

/// The alias for a Clave Bancaria Uniforme (CBU) or Clave Virtual Uniforme (CVU).
String? cbuAlias;

/// Address for a cryptocurrency account
String? cryptoAddress;

/// A destination tag/memo used to identify a transaction
String? cryptoMemo;

Map<String, String> fields() {
final fields = <String, String>{};

if (bankAccountType != null) {
fields['bank_account_type'] = bankAccountType!;
}
if (bankAccountNumber != null) {
fields['bank_account_number'] = bankAccountNumber!;
}
if (bankNumber != null) {
fields['bank_number'] = bankNumber!;
}
if (bankPhoneNumber != null) {
fields['bank_phone_number'] = bankPhoneNumber!;
}
if (bankBranchNumber != null) {
fields['bank_branch_number'] = bankBranchNumber!;
}
if (clabeNumber != null) {
fields['clabe_number'] = clabeNumber!;
}
if (cbuNumber != null) {
fields['cbu_number'] = cbuNumber!;
}
if (cbuAlias != null) {
fields['cbu_alias'] = cbuAlias!;
}
if (cryptoAddress != null) {
fields['crypto_address'] = cryptoAddress!;
}
if (cryptoMemo != null) {
fields['crypto_memo'] = cryptoMemo!;
}
return fields;
}
}

class OrganizationKYCFields {
/// Full organization name as on the incorporation papers
String? name;
Expand All @@ -241,6 +299,9 @@ class OrganizationKYCFields {
/// Organization registration number
String? registrationNumber;

/// Date the organization was registered
String? registrationDate;

/// Organization registered address
String? registeredAddress;

Expand Down Expand Up @@ -291,6 +352,9 @@ class OrganizationKYCFields {
if (registrationNumber != null) {
fields['organization.registration_number'] = registrationNumber!;
}
if (registrationDate != null) {
fields['organization.registration_date'] = registrationDate!;
}
if (registeredAddress != null) {
fields['organization.registered_address'] = registeredAddress!;
}
Expand Down
3 changes: 3 additions & 0 deletions lib/src/sep/0012/kyc_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,9 @@ class KYCService {
if (request.kycFields != null && request.kycFields?.organizationKYCFields != null) {
fields.addAll(request.kycFields!.organizationKYCFields!.fields());
}
if (request.kycFields != null && request.kycFields?.financialAccountKYCFields != null) {
fields.addAll(request.kycFields!.financialAccountKYCFields!.fields());
}
if (request.customFields != null) {
fields.addAll(request.customFields!);
}
Expand Down
8 changes: 8 additions & 0 deletions lib/src/sep/0024/sep24_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,10 @@ class TransferServerSEP24Service {
request.kycFields?.organizationKYCFields != null) {
fields.addAll(request.kycFields!.organizationKYCFields!.fields());
}
if (request.kycFields != null &&
request.kycFields?.financialAccountKYCFields != null) {
fields.addAll(request.kycFields!.financialAccountKYCFields!.fields());
}
if (request.customFields != null) {
fields.addAll(request.customFields!);
}
Expand Down Expand Up @@ -285,6 +289,10 @@ class TransferServerSEP24Service {
request.kycFields?.organizationKYCFields != null) {
fields.addAll(request.kycFields!.organizationKYCFields!.fields());
}
if (request.kycFields != null &&
request.kycFields?.financialAccountKYCFields != null) {
fields.addAll(request.kycFields!.financialAccountKYCFields!.fields());
}
if (request.customFields != null) {
fields.addAll(request.customFields!);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/src/stellar_sdk.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import 'requests/liquidity_pools_request_builder.dart';

/// Main class of the flutter stellar sdk.
class StellarSDK {
static const versionNumber = "1.7.2";
static const versionNumber = "1.7.3";

static final StellarSDK PUBLIC = StellarSDK("https://horizon.stellar.org");
static final StellarSDK TESTNET = StellarSDK("https://horizon-testnet.stellar.org");
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: stellar_flutter_sdk
description: A stellar blockchain sdk that query's horizon, build, signs and submits transactions to the stellar network.
version: 1.7.2
version: 1.7.3
homepage: https://github.com/Soneso/stellar_flutter_sdk

environment:
Expand Down

0 comments on commit e48f3ed

Please sign in to comment.