Skip to content

Commit 0a28793

Browse files
Merge pull request #329 from deriv-com/dev
v1.1.0
2 parents 6241e18 + 3e684d3 commit 0a28793

8 files changed

+284
-15
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// ignore_for_file: prefer_single_quotes, unnecessary_import, unused_import
2+
3+
import 'package:deriv_dependency_injector/dependency_injector.dart';
4+
import 'package:equatable/equatable.dart';
5+
import 'package:flutter_deriv_api/api/exceptions/base_api_exception.dart';
6+
import 'package:flutter_deriv_api/api/models/base_exception_model.dart';
7+
import 'package:flutter_deriv_api/api/response/cashier_withdrawal_cancel_response_result.dart';
8+
import 'package:flutter_deriv_api/basic_api/generated/cashier_withdrawal_cancel_receive.dart';
9+
import 'package:flutter_deriv_api/basic_api/generated/cashier_withdrawal_cancel_send.dart';
10+
11+
import 'package:flutter_deriv_api/helpers/helpers.dart';
12+
import 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';
13+
14+
/// The extended version of the [CashierWithdrawalCancelResponseExtended] class to implement
15+
/// the API call methods.
16+
class CashierWithdrawalCancelResponseExtended
17+
extends CashierWithdrawalCancelResponseModel {
18+
static final BaseAPI _api = Injector()<BaseAPI>();
19+
20+
/// Fetches the cashier payments.
21+
static Future<CashierWithdrawalCancelResponse> cancelCasWithdrawl({
22+
required CashierWithdrawalCancelRequest request,
23+
}) async {
24+
final CashierWithdrawalCancelReceive response =
25+
await _api.call(request: request);
26+
27+
checkException(
28+
response: response,
29+
exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>
30+
BaseAPIException(baseExceptionModel: baseExceptionModel),
31+
);
32+
33+
return CashierWithdrawalCancelResponse.fromJson(
34+
response.cashierWithdrawalCancel);
35+
}
36+
}

lib/api/response/get_account_status_response_result.dart

+155
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,7 @@ abstract class GetAccountStatusModel {
330330
/// - `mt5_additional_kyc_required`: client tax information, place of birth and account opening reason is missing.
331331
/// - `poi_expiring_soon`: the POI documents of the client will get expired soon, allow them to reupload POI documents.
332332
/// - `poa_expiring_soon`: the POA documents of the client will get outdated soon, allow them to reupload POA documents.
333+
/// - `tin_manually_approved`: the client's tax_identification_number has been manually approved as client is not applicable for tax_identification_number
333334
final List<String> status;
334335

335336
/// Client risk classification: `low`, `standard`, `high`.
@@ -825,6 +826,7 @@ abstract class DocumentModel {
825826
this.authenticatedWithIdv,
826827
this.expiryDate,
827828
this.status,
829+
this.verifiedJurisdiction,
828830
});
829831

830832
/// This represents the current status of idv authentication for each mt5 jurisdiction.
@@ -835,6 +837,9 @@ abstract class DocumentModel {
835837

836838
/// This represents the current status of the proof of address document submitted for authentication.
837839
final DocumentStatusEnum? status;
840+
841+
/// This represents the current status of authentication for each mt5 jurisdiction.
842+
final VerifiedJurisdiction? verifiedJurisdiction;
838843
}
839844

840845
/// Document class.
@@ -844,6 +849,7 @@ class Document extends DocumentModel {
844849
super.authenticatedWithIdv,
845850
super.expiryDate,
846851
super.status,
852+
super.verifiedJurisdiction,
847853
});
848854

849855
/// Creates an instance from JSON.
@@ -855,6 +861,9 @@ class Document extends DocumentModel {
855861
status: json['status'] == null
856862
? null
857863
: documentStatusEnumMapper[json['status']],
864+
verifiedJurisdiction: json['verified_jurisdiction'] == null
865+
? null
866+
: VerifiedJurisdiction.fromJson(json['verified_jurisdiction']),
858867
);
859868

860869
/// Converts an instance to JSON.
@@ -869,6 +878,9 @@ class Document extends DocumentModel {
869878
.firstWhere((MapEntry<String, DocumentStatusEnum> entry) =>
870879
entry.value == status)
871880
.key;
881+
if (verifiedJurisdiction != null) {
882+
resultMap['verified_jurisdiction'] = verifiedJurisdiction!.toJson();
883+
}
872884

873885
return resultMap;
874886
}
@@ -878,11 +890,13 @@ class Document extends DocumentModel {
878890
AuthenticatedWithIdv? authenticatedWithIdv,
879891
DateTime? expiryDate,
880892
DocumentStatusEnum? status,
893+
VerifiedJurisdiction? verifiedJurisdiction,
881894
}) =>
882895
Document(
883896
authenticatedWithIdv: authenticatedWithIdv ?? this.authenticatedWithIdv,
884897
expiryDate: expiryDate ?? this.expiryDate,
885898
status: status ?? this.status,
899+
verifiedJurisdiction: verifiedJurisdiction ?? this.verifiedJurisdiction,
886900
);
887901
}
888902

@@ -1018,6 +1032,138 @@ class AuthenticatedWithIdv extends AuthenticatedWithIdvModel {
10181032
);
10191033
}
10201034

1035+
/// Verified jurisdiction model class.
1036+
abstract class VerifiedJurisdictionModel {
1037+
/// Initializes Verified jurisdiction model class .
1038+
const VerifiedJurisdictionModel({
1039+
this.bvi,
1040+
this.dsl,
1041+
this.iom,
1042+
this.labuan,
1043+
this.malta,
1044+
this.maltainvest,
1045+
this.samoa,
1046+
this.samoaVirtual,
1047+
this.svg,
1048+
this.vanuatu,
1049+
this.virtual,
1050+
});
1051+
1052+
/// This represents whether the client is allowed or not to create an account under this jurisdiction
1053+
final bool? bvi;
1054+
1055+
/// This represents whether the client is allowed or not to create an account under this jurisdiction
1056+
final bool? dsl;
1057+
1058+
/// This represents whether the client is allowed or not to create an account under this jurisdiction
1059+
final bool? iom;
1060+
1061+
/// This represents whether the client is allowed or not to create an account under this jurisdiction
1062+
final bool? labuan;
1063+
1064+
/// This represents whether the client is allowed or not to create an account under this jurisdiction
1065+
final bool? malta;
1066+
1067+
/// This represents whether the client is allowed or not to create an account under this jurisdiction
1068+
final bool? maltainvest;
1069+
1070+
/// This represents whether the client is allowed or not to create an account under this jurisdiction
1071+
final bool? samoa;
1072+
1073+
/// This represents whether the client is allowed or not to create an account under this jurisdiction
1074+
final bool? samoaVirtual;
1075+
1076+
/// This represents whether the client is allowed or not to create an account under this jurisdiction
1077+
final bool? svg;
1078+
1079+
/// This represents whether the client is allowed or not to create an account under this jurisdiction
1080+
final bool? vanuatu;
1081+
1082+
/// This represents whether the client is allowed or not to create an account under this jurisdiction
1083+
final bool? virtual;
1084+
}
1085+
1086+
/// Verified jurisdiction class.
1087+
class VerifiedJurisdiction extends VerifiedJurisdictionModel {
1088+
/// Initializes Verified jurisdiction class.
1089+
const VerifiedJurisdiction({
1090+
super.bvi,
1091+
super.dsl,
1092+
super.iom,
1093+
super.labuan,
1094+
super.malta,
1095+
super.maltainvest,
1096+
super.samoa,
1097+
super.samoaVirtual,
1098+
super.svg,
1099+
super.vanuatu,
1100+
super.virtual,
1101+
});
1102+
1103+
/// Creates an instance from JSON.
1104+
factory VerifiedJurisdiction.fromJson(Map<String, dynamic> json) =>
1105+
VerifiedJurisdiction(
1106+
bvi: getBool(json['bvi']),
1107+
dsl: getBool(json['dsl']),
1108+
iom: getBool(json['iom']),
1109+
labuan: getBool(json['labuan']),
1110+
malta: getBool(json['malta']),
1111+
maltainvest: getBool(json['maltainvest']),
1112+
samoa: getBool(json['samoa']),
1113+
samoaVirtual: getBool(json['samoa-virtual']),
1114+
svg: getBool(json['svg']),
1115+
vanuatu: getBool(json['vanuatu']),
1116+
virtual: getBool(json['virtual']),
1117+
);
1118+
1119+
/// Converts an instance to JSON.
1120+
Map<String, dynamic> toJson() {
1121+
final Map<String, dynamic> resultMap = <String, dynamic>{};
1122+
1123+
resultMap['bvi'] = bvi;
1124+
resultMap['dsl'] = dsl;
1125+
resultMap['iom'] = iom;
1126+
resultMap['labuan'] = labuan;
1127+
resultMap['malta'] = malta;
1128+
resultMap['maltainvest'] = maltainvest;
1129+
resultMap['samoa'] = samoa;
1130+
resultMap['samoa-virtual'] = samoaVirtual;
1131+
resultMap['svg'] = svg;
1132+
resultMap['vanuatu'] = vanuatu;
1133+
resultMap['virtual'] = virtual;
1134+
1135+
return resultMap;
1136+
}
1137+
1138+
/// Creates a copy of instance with given parameters.
1139+
VerifiedJurisdiction copyWith({
1140+
bool? bvi,
1141+
bool? dsl,
1142+
bool? iom,
1143+
bool? labuan,
1144+
bool? malta,
1145+
bool? maltainvest,
1146+
bool? samoa,
1147+
bool? samoaVirtual,
1148+
bool? svg,
1149+
bool? vanuatu,
1150+
bool? virtual,
1151+
}) =>
1152+
VerifiedJurisdiction(
1153+
bvi: bvi ?? this.bvi,
1154+
dsl: dsl ?? this.dsl,
1155+
iom: iom ?? this.iom,
1156+
labuan: labuan ?? this.labuan,
1157+
malta: malta ?? this.malta,
1158+
maltainvest: maltainvest ?? this.maltainvest,
1159+
samoa: samoa ?? this.samoa,
1160+
samoaVirtual: samoaVirtual ?? this.samoaVirtual,
1161+
svg: svg ?? this.svg,
1162+
vanuatu: vanuatu ?? this.vanuatu,
1163+
virtual: virtual ?? this.virtual,
1164+
);
1165+
}
1166+
10211167
/// Identity model class.
10221168
abstract class IdentityModel {
10231169
/// Initializes Identity model class .
@@ -1157,6 +1303,7 @@ abstract class IdvModel {
11571303
const IdvModel({
11581304
this.expiryDate,
11591305
this.lastRejected,
1306+
this.reportAvailable,
11601307
this.reportedProperties,
11611308
this.status,
11621309
this.submissionsLeft,
@@ -1168,6 +1315,9 @@ abstract class IdvModel {
11681315
/// Show the last IDV reported reasons for the rejected cases
11691316
final List<String>? lastRejected;
11701317

1318+
/// Indicate if the verification report was returned by the provider
1319+
final bool? reportAvailable;
1320+
11711321
/// Shows the latest document properties detected and reported by IDVS
11721322
final Map<String, dynamic>? reportedProperties;
11731323

@@ -1184,6 +1334,7 @@ class Idv extends IdvModel {
11841334
const Idv({
11851335
super.expiryDate,
11861336
super.lastRejected,
1337+
super.reportAvailable,
11871338
super.reportedProperties,
11881339
super.status,
11891340
super.submissionsLeft,
@@ -1199,6 +1350,7 @@ class Idv extends IdvModel {
11991350
(dynamic item) => item,
12001351
),
12011352
),
1353+
reportAvailable: getBool(json['report_available']),
12021354
reportedProperties: json['reported_properties'],
12031355
status:
12041356
json['status'] == null ? null : idvStatusEnumMapper[json['status']],
@@ -1217,6 +1369,7 @@ class Idv extends IdvModel {
12171369
)
12181370
.toList();
12191371
}
1372+
resultMap['report_available'] = reportAvailable;
12201373
resultMap['reported_properties'] = reportedProperties;
12211374
resultMap['status'] = idvStatusEnumMapper.entries
12221375
.firstWhere(
@@ -1231,13 +1384,15 @@ class Idv extends IdvModel {
12311384
Idv copyWith({
12321385
DateTime? expiryDate,
12331386
List<String>? lastRejected,
1387+
bool? reportAvailable,
12341388
Map<String, dynamic>? reportedProperties,
12351389
IdvStatusEnum? status,
12361390
int? submissionsLeft,
12371391
}) =>
12381392
Idv(
12391393
expiryDate: expiryDate ?? this.expiryDate,
12401394
lastRejected: lastRejected ?? this.lastRejected,
1395+
reportAvailable: reportAvailable ?? this.reportAvailable,
12411396
reportedProperties: reportedProperties ?? this.reportedProperties,
12421397
status: status ?? this.status,
12431398
submissionsLeft: submissionsLeft ?? this.submissionsLeft,

lib/api/response/proposal_open_contract_response_result.dart

+11-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
// ignore_for_file: prefer_single_quotes, unnecessary_import, unused_import
2-
32
import 'package:equatable/equatable.dart';
4-
53
import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';
64
import 'package:flutter_deriv_api/api/models/base_exception_model.dart';
75
import 'package:flutter_deriv_api/api/models/enums.dart';
@@ -163,14 +161,21 @@ class ProposalOpenContractResponse extends ProposalOpenContractResponseModel {
163161
/// Default be 0 for 'sell at market'.
164162
/// Throws a [BaseAPIException] if API response contains an error
165163
static Future<SellResponse> sell(
166-
{required int contractId, double price = 0}) =>
167-
SellResponse.sellContract(SellRequest(sell: contractId, price: price));
164+
{required int contractId, double price = 0, String? loginId}) =>
165+
SellResponse.sellContract(SellRequest(
166+
sell: contractId,
167+
price: price,
168+
loginid: loginId,
169+
));
168170

169171
/// Cancels this contract
170172
///
171173
/// Throws a [BaseAPIException] if API response contains an error
172-
static Future<CancelResponse> cancel(int contractId) =>
173-
CancelResponse.cancelContract(CancelRequest(cancel: contractId));
174+
static Future<CancelResponse> cancel(int contractId, {String? loginId}) =>
175+
CancelResponse.cancelContract(CancelRequest(
176+
cancel: contractId,
177+
loginid: loginId,
178+
));
174179

175180
/// Creates a copy of instance with given parameters.
176181
ProposalOpenContractResponse copyWith({

lib/api/response/topup_virtual_response_result.dart

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// ignore_for_file: prefer_single_quotes, unnecessary_import, unused_import
22

3+
import 'package:build/build.dart';
34
import 'package:equatable/equatable.dart';
45

56
import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';
@@ -55,11 +56,13 @@ class TopupVirtualResponse extends TopupVirtualResponseModel {
5556
///
5657
/// For parameters information refer to [TopupVirtualRequest].
5758
/// Throws a [BaseAPIException] if API response contains an error
58-
static Future<TopupVirtualResponse> topUp([
59+
static Future<TopupVirtualResponse> topUp({
5960
TopupVirtualRequest? request,
60-
]) async {
61+
String? loginId,
62+
}) async {
6163
final TopupVirtualReceive response = await _api.call(
62-
request: request ?? const TopupVirtualRequest(),
64+
request: request?.copyWith(loginid: loginId) ??
65+
TopupVirtualRequest(loginid: loginId),
6366
);
6467

6568
checkException(
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
2-
"methods": "static final BaseAPI _api = Injector()<BaseAPI>();\n\n /// Topes up the virtual-money's account balance becomes when it becomes low.\n ///\n /// For parameters information refer to [TopupVirtualRequest].\n /// Throws a [BaseAPIException] if API response contains an error\n static Future<TopupVirtualResponse> topUp([\n TopupVirtualRequest? request,\n ]) async {\n final TopupVirtualReceive response = await _api.call(\n request: request ?? const TopupVirtualRequest(),\n );\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return TopupVirtualResponse.fromJson(response.topupVirtual);\n }",
2+
"methods": "static final BaseAPI _api = Injector()<BaseAPI>();\n\n /// Topes up the virtual-money's account balance becomes when it becomes low.\n ///\n /// For parameters information refer to [TopupVirtualRequest].\n /// Throws a [BaseAPIException] if API response contains an error\n static Future<TopupVirtualResponse> topUp({\n TopupVirtualRequest? request,\n String? loginId, \n}) async {\n final TopupVirtualReceive response = await _api.call(\n request: request?.copyWith(loginid: loginId) ?? TopupVirtualRequest(loginid: loginId),\n );\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return TopupVirtualResponse.fromJson(response.topupVirtual);\n }",
33
"imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/topup_virtual_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/topup_virtual_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n"
44
}

0 commit comments

Comments
 (0)