Submit customer identity proofs and show reviewed limits
This commit is contained in:
1 parent
7bf8b8087a
commit
1354551ae8
50 files changed
+1777
-67
No files matched your search
@@ -0,0 +1,74 @@
|
||||
import 'dart:convert';
|
||||
|
||||
class ProfileDTO {
|
||||
const ProfileDTO(this.fullName, this.dateOfBirth, this.residenceCountry);
|
||||
factory ProfileDTO.fromJson(Map<String, dynamic> data) => ProfileDTO(
|
||||
data['fullName'] as String? ?? '',
|
||||
data['dateOfBirth'] as String? ?? '',
|
||||
data['residenceCountry'] as String? ?? '',
|
||||
);
|
||||
final String fullName, dateOfBirth, residenceCountry;
|
||||
Map<String, String> toJson() => {
|
||||
'fullName': fullName,
|
||||
'dateOfBirth': dateOfBirth,
|
||||
'residenceCountry': residenceCountry,
|
||||
};
|
||||
}
|
||||
|
||||
class VerificationDTO {
|
||||
const VerificationDTO(
|
||||
this.status,
|
||||
this.reason,
|
||||
this.id,
|
||||
this.profile, {
|
||||
this.upgradePending = false,
|
||||
});
|
||||
factory VerificationDTO.decode(String body) {
|
||||
final envelope = jsonDecode(body) as Map<String, dynamic>;
|
||||
if (envelope['status'] != 'success')
|
||||
throw const FormatException('Unaccepted verification');
|
||||
final data = envelope['data'] as Map<String, dynamic>;
|
||||
return VerificationDTO(
|
||||
data['status'] as String,
|
||||
data['reason'] as String?,
|
||||
data['submissionId'] as String?,
|
||||
ProfileDTO.fromJson(data['profile'] as Map<String, dynamic>),
|
||||
upgradePending: data['upgradePending'] as bool? ?? false,
|
||||
);
|
||||
}
|
||||
final String status;
|
||||
final String? reason, id;
|
||||
final ProfileDTO profile;
|
||||
final bool upgradePending;
|
||||
}
|
||||
|
||||
class PolicyDTO {
|
||||
const PolicyDTO(this.tier, this.profileRef, this.entries);
|
||||
factory PolicyDTO.decode(String body) {
|
||||
final envelope = jsonDecode(body) as Map<String, dynamic>;
|
||||
if (envelope['status'] != 'success')
|
||||
throw const FormatException('Unaccepted limits');
|
||||
final data = envelope['data'] as Map<String, dynamic>;
|
||||
return PolicyDTO(
|
||||
data['tier'] as String,
|
||||
data['profileRef'] as String,
|
||||
(data['entries'] as List)
|
||||
.map((v) => LimitDTO.fromJson(v as Map<String, dynamic>))
|
||||
.toList(),
|
||||
);
|
||||
}
|
||||
final String tier, profileRef;
|
||||
final List<LimitDTO> entries;
|
||||
}
|
||||
|
||||
class LimitDTO {
|
||||
LimitDTO.fromJson(Map<String, dynamic> d)
|
||||
: operation = d['operation'] as String,
|
||||
period = d['period'] as String,
|
||||
currency = d['currency'] as String,
|
||||
cap = d['cap'] as String,
|
||||
remaining = d['remaining'] as String,
|
||||
used = d['used'] as String,
|
||||
reserved = d['reserved'] as String;
|
||||
final String operation, period, currency, cap, remaining, used, reserved;
|
||||
}
|
||||
Reference in new issue
Block a user