From 8503b1f39fb854647d756adb2c0100cfe9223590 Mon Sep 17 00:00:00 2001 From: WAQAS YOUNAS <78855520+waqas-younas-deriv@users.noreply.github.com> Date: Thu, 26 Sep 2024 15:54:17 +0400 Subject: [PATCH] Akhil/1396/multi user level authentication poc (#344) * added loginId for account status * fixed the test case for account status * reverted previous changes * updated topup functionality * updated contract details API calls * removed unnecessary import * added loginId for account status * added formatting for loginid * added loginid account status receive methods * added trailing comma * fixed two error exception errors --------- Co-authored-by: akhil-deriv --- .../get_account_status_response_result.dart | 13 +++++++++---- .../response/p2p_advert_create_response_result.dart | 7 +++++-- .../response/p2p_advert_list_response_result.dart | 6 ++++-- .../methods/get_account_status_receive_methods.json | 2 +- 4 files changed, 19 insertions(+), 9 deletions(-) diff --git a/lib/api/response/get_account_status_response_result.dart b/lib/api/response/get_account_status_response_result.dart index d6b31c9dbc..9d3e59b8f3 100644 --- a/lib/api/response/get_account_status_response_result.dart +++ b/lib/api/response/get_account_status_response_result.dart @@ -55,9 +55,11 @@ class GetAccountStatusResponse extends GetAccountStatusResponseModel { /// /// For parameters information refer to [GetAccountStatusRequest]. /// Throws an [BaseAPIException] if API response contains an error. - static Future fetchAccountStatusRaw() async { + static Future fetchAccountStatusRaw({ + String? loginId, + }) async { final GetAccountStatusReceive response = await _api.call( - request: const GetAccountStatusRequest(), + request: GetAccountStatusRequest(loginid: loginId), ); checkException( @@ -73,8 +75,11 @@ class GetAccountStatusResponse extends GetAccountStatusResponseModel { /// /// For parameters information refer to [GetAccountStatusRequest]. /// Throws an [BaseAPIException] if API response contains an error. - static Future fetchAccountStatus() async { - final GetAccountStatusReceive response = await fetchAccountStatusRaw(); + static Future fetchAccountStatus({ + String? loginId, + }) async { + final GetAccountStatusReceive response = + await fetchAccountStatusRaw(loginId: loginId); return GetAccountStatusResponse.fromJson(response.getAccountStatus); } diff --git a/lib/api/response/p2p_advert_create_response_result.dart b/lib/api/response/p2p_advert_create_response_result.dart index c9aa066cdd..84fc17d7af 100644 --- a/lib/api/response/p2p_advert_create_response_result.dart +++ b/lib/api/response/p2p_advert_create_response_result.dart @@ -1,8 +1,7 @@ // ignore_for_file: prefer_single_quotes, unnecessary_import, unused_import import 'package:equatable/equatable.dart'; - -import 'package:flutter_deriv_api/api/exceptions/p2p_advert_exception.dart'; +import 'package:flutter_deriv_api/api/exceptions/base_api_exception.dart'; import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; import 'package:flutter_deriv_api/basic_api/generated/p2p_advert_create_receive.dart'; import 'package:flutter_deriv_api/basic_api/generated/p2p_advert_create_send.dart'; @@ -239,6 +238,7 @@ enum VisibilityStatusItemEnum { /// advertiser_temp_ban. advertiserTempBan, } + /// P2p advert create model class. abstract class P2pAdvertCreateModel { /// Initializes P2p advert create model class . @@ -742,6 +742,7 @@ class P2pAdvertCreate extends P2pAdvertCreateModel { visibilityStatus: visibilityStatus ?? this.visibilityStatus, ); } + /// Advertiser details model class. abstract class AdvertiserDetailsModel { /// Initializes Advertiser details model class . @@ -892,6 +893,7 @@ class AdvertiserDetails extends AdvertiserDetailsModel { totalCompletionRate: totalCompletionRate ?? this.totalCompletionRate, ); } + /// Payment method details property model class. abstract class PaymentMethodDetailsPropertyModel { /// Initializes Payment method details property model class . @@ -1020,6 +1022,7 @@ class PaymentMethodDetailsProperty extends PaymentMethodDetailsPropertyModel { usedByOrders: usedByOrders ?? this.usedByOrders, ); } + /// Fields property model class. abstract class FieldsPropertyModel { /// Initializes Fields property model class . diff --git a/lib/api/response/p2p_advert_list_response_result.dart b/lib/api/response/p2p_advert_list_response_result.dart index 6d63631006..af9e4b5688 100644 --- a/lib/api/response/p2p_advert_list_response_result.dart +++ b/lib/api/response/p2p_advert_list_response_result.dart @@ -1,8 +1,7 @@ // ignore_for_file: prefer_single_quotes, unnecessary_import, unused_import import 'package:equatable/equatable.dart'; - -import 'package:flutter_deriv_api/api/exceptions/p2p_advert_exception.dart'; +import 'package:flutter_deriv_api/api/exceptions/base_api_exception.dart'; import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; import 'package:flutter_deriv_api/basic_api/generated/p2p_advert_list_receive.dart'; import 'package:flutter_deriv_api/basic_api/generated/p2p_advert_list_send.dart'; @@ -226,6 +225,7 @@ enum VisibilityStatusItemEnum { /// advertiser_temp_ban. advertiserTempBan, } + /// P2p advert list model class. abstract class P2pAdvertListModel { /// Initializes P2p advert list model class . @@ -274,6 +274,7 @@ class P2pAdvertList extends P2pAdvertListModel { list: list ?? this.list, ); } + /// List item model class. abstract class ListItemModel { /// Initializes List item model class . @@ -817,6 +818,7 @@ class ListItem extends ListItemModel { visibilityStatus: visibilityStatus ?? this.visibilityStatus, ); } + /// Advertiser details model class. abstract class AdvertiserDetailsModel { /// Initializes Advertiser details model class . diff --git a/lib/basic_api/generated/methods/get_account_status_receive_methods.json b/lib/basic_api/generated/methods/get_account_status_receive_methods.json index 712a34feba..dfab51945d 100644 --- a/lib/basic_api/generated/methods/get_account_status_receive_methods.json +++ b/lib/basic_api/generated/methods/get_account_status_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()(); \n \n /// Gets the account's status. \n /// \n /// For parameters information refer to [GetAccountStatusRequest]. \n /// Throws an [BaseAPIException] if API response contains an error. \n static Future fetchAccountStatusRaw() async { \n final GetAccountStatusReceive response = await _api.call( \n request: const GetAccountStatusRequest(), \n ); \n \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n BaseAPIException(baseExceptionModel: baseExceptionModel), \n ); \n \n return response; \n } \n \n /// Gets the account's status. \n /// \n /// For parameters information refer to [GetAccountStatusRequest]. \n /// Throws an [BaseAPIException] if API response contains an error. \n static Future fetchAccountStatus() async { \n final GetAccountStatusReceive response = await fetchAccountStatusRaw(); \n \n return GetAccountStatusResponse.fromJson(response.getAccountStatus); \n }", + "methods": "static final BaseAPI _api = Injector()(); \n \n /// Gets the account's status. \n /// \n /// For parameters information refer to [GetAccountStatusRequest]. \n /// Throws an [BaseAPIException] if API response contains an error. \n static Future fetchAccountStatusRaw({String? loginId,}) async { \n final GetAccountStatusReceive response = await _api.call( \n request: GetAccountStatusRequest(loginid: loginId), \n ); \n \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n BaseAPIException(baseExceptionModel: baseExceptionModel), \n ); \n \n return response; \n } \n \n /// Gets the account's status. \n /// \n /// For parameters information refer to [GetAccountStatusRequest]. \n /// Throws an [BaseAPIException] if API response contains an error. \n static Future fetchAccountStatus({String? loginId,}) async { \n final GetAccountStatusReceive response = await fetchAccountStatusRaw(loginId: loginId); \n \n return GetAccountStatusResponse.fromJson(response.getAccountStatus); \n }", "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/get_account_status_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/get_account_status_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" }