diff --git a/example/lib/blocs/active_symbols/active_symbols_bloc.dart b/example/lib/blocs/active_symbols/active_symbols_bloc.dart index 0d28ae0db2..3b784534c7 100644 --- a/example/lib/blocs/active_symbols/active_symbols_bloc.dart +++ b/example/lib/blocs/active_symbols/active_symbols_bloc.dart @@ -51,6 +51,6 @@ class ActiveSymbolsBloc extends Bloc { Future _fetchActiveSymbols() async => ActiveSymbolsResponse.fetchActiveSymbols(const ActiveSymbolsRequest( activeSymbols: 'brief', - productType: 'basic', + productType: 'basic', landingCompany: '', )); } diff --git a/example/lib/blocs/available_contracts/available_contracts_bloc.dart b/example/lib/blocs/available_contracts/available_contracts_bloc.dart index 47e631784a..3a4ef898d0 100644 --- a/example/lib/blocs/available_contracts/available_contracts_bloc.dart +++ b/example/lib/blocs/available_contracts/available_contracts_bloc.dart @@ -9,6 +9,7 @@ import 'package:flutter_deriv_api/basic_api/generated/api.dart'; import '../active_symbols/active_symbols_bloc.dart'; part 'available_contracts_event.dart'; + part 'available_contracts_state.dart'; /// AvailableContractsBloc @@ -75,5 +76,6 @@ class AvailableContractsBloc ) async => ContractsForResponse.fetchContractsForSymbol(ContractsForRequest( contractsFor: selectedSymbol?.symbol, + landingCompany: '', )); } diff --git a/lib/api/response/p2p_advert_create_response_result.dart b/lib/api/response/p2p_advert_create_response_result.dart index cae00b3e42..1467f21aac 100644 --- a/lib/api/response/p2p_advert_create_response_result.dart +++ b/lib/api/response/p2p_advert_create_response_result.dart @@ -1,8 +1,8 @@ // ignore_for_file: prefer_single_quotes, unnecessary_import, unused_import import 'package:equatable/equatable.dart'; +import 'package:flutter_deriv_api/api/exceptions/base_api_exception.dart'; -import 'package:flutter_deriv_api/api/exceptions/p2p_advert_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'; @@ -221,6 +221,7 @@ enum VisibilityStatusItemEnum { /// advertiser_temp_ban. advertiserTempBan, } + /// P2p advert create model class. abstract class P2pAdvertCreateModel { /// Initializes P2p advert create model class . @@ -720,6 +721,7 @@ class P2pAdvertCreate extends P2pAdvertCreateModel { visibilityStatus: visibilityStatus ?? this.visibilityStatus, ); } + /// Advertiser details model class. abstract class AdvertiserDetailsModel { /// Initializes Advertiser details model class . @@ -861,6 +863,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 . @@ -989,6 +992,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 d3dc565671..e5aec1c717 100644 --- a/lib/api/response/p2p_advert_list_response_result.dart +++ b/lib/api/response/p2p_advert_list_response_result.dart @@ -1,8 +1,8 @@ // ignore_for_file: prefer_single_quotes, unnecessary_import, unused_import import 'package:equatable/equatable.dart'; +import 'package:flutter_deriv_api/api/exceptions/base_api_exception.dart'; -import 'package:flutter_deriv_api/api/exceptions/p2p_advert_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'; diff --git a/lib/services/connection/api_manager/base_api.dart b/lib/services/connection/api_manager/base_api.dart index 8cc480351a..e20df3928a 100644 --- a/lib/services/connection/api_manager/base_api.dart +++ b/lib/services/connection/api_manager/base_api.dart @@ -33,7 +33,10 @@ abstract class BaseAPI { void addToChannel(Map request); /// Calls a API method by [request]. - Future call({required Request request}); + Future call({ + required Request request, + List nullableKeys = const [], + }); /// Subscribe to a [request]. /// [comparePredicate] indicates compare condition for current [request] and [pendingRequest]s diff --git a/lib/services/connection/api_manager/binary_api.dart b/lib/services/connection/api_manager/binary_api.dart index 43b58c060c..b3203760f2 100644 --- a/lib/services/connection/api_manager/binary_api.dart +++ b/lib/services/connection/api_manager/binary_api.dart @@ -139,9 +139,11 @@ class BinaryAPI extends BaseAPI { } @override - Future call({required Request request}) async { + Future call( + {required Request request, List nullableKeys = const [],}) async { final Response response = await (_callManager ??= CallManager(this))( request: request, + nullableKeys: nullableKeys, ); if (response is T) { diff --git a/lib/services/connection/api_manager/mock_api.dart b/lib/services/connection/api_manager/mock_api.dart index 15e702553a..a2b0ea308f 100644 --- a/lib/services/connection/api_manager/mock_api.dart +++ b/lib/services/connection/api_manager/mock_api.dart @@ -130,7 +130,10 @@ class MockAPI extends BaseAPI { void addToChannel(Map request) {} @override - Future call({required Request request}) => + Future call({ + required Request request, + List nullableKeys = const [], + }) => _getFutureResponse(request); @override diff --git a/lib/services/connection/call_manager/base_call_manager.dart b/lib/services/connection/call_manager/base_call_manager.dart index b813ae87e5..2e5dfb04ea 100644 --- a/lib/services/connection/call_manager/base_call_manager.dart +++ b/lib/services/connection/call_manager/base_call_manager.dart @@ -43,7 +43,10 @@ abstract class BaseCallManager { bool contains(int? requestId) => _pendingRequests.containsKey(requestId); /// Calls a API method by [request] - T call({required Request request}); + T call({ + required Request request, + List nullableKeys = const [], + }); /// Handle call [response] that comes from server void handleResponse({ @@ -62,12 +65,14 @@ abstract class BaseCallManager { Future addToChannel({ required Request request, SubscriptionStream? subscriptionStream, + List nullableKeys = const [], }) { final Completer responseCompleter = Completer(); final Request requestWithId = request.copyWith(reqId: _getRequestId()); final Map prepareRequest = _prepareRequest( request: requestWithId, isSubscription: subscriptionStream != null, + nullableKeys: nullableKeys, ); _addPendingRequest( @@ -104,9 +109,11 @@ abstract class BaseCallManager { Map _prepareRequest({ required Request request, required bool isSubscription, + List nullableKeys = const [], }) { final Map result = request.toJson() - ..removeWhere((String key, dynamic value) => value == null); + ..removeWhere((String key, dynamic value) => + value == null && !(nullableKeys.contains(key))); if (isSubscription) { result.putIfAbsent('subscribe', () => 1); diff --git a/lib/services/connection/call_manager/call_manager.dart b/lib/services/connection/call_manager/call_manager.dart index 99d1400bf1..d2f72044e1 100644 --- a/lib/services/connection/call_manager/call_manager.dart +++ b/lib/services/connection/call_manager/call_manager.dart @@ -29,6 +29,9 @@ class CallManager extends BaseCallManager> { } @override - Future call({required Request request}) async => - addToChannel(request: request); + Future call({ + required Request request, + List nullableKeys = const [], + }) async => + addToChannel(request: request, nullableKeys: nullableKeys); } diff --git a/lib/services/connection/call_manager/subscription_manager.dart b/lib/services/connection/call_manager/subscription_manager.dart index 913b8f9214..040630ae9d 100644 --- a/lib/services/connection/call_manager/subscription_manager.dart +++ b/lib/services/connection/call_manager/subscription_manager.dart @@ -55,6 +55,7 @@ class SubscriptionManager extends BaseCallManager> { required Request request, int cacheSize = 0, RequestCompareFunction? comparePredicate, + List nullableKeys = const [], }) { assert(cacheSize >= 0); @@ -78,6 +79,7 @@ class SubscriptionManager extends BaseCallManager> { addToChannel( request: request, subscriptionStream: subscriptionStream, + nullableKeys: nullableKeys, ); return subscriptionStream.stream; diff --git a/test/api/account/authorize/authorize_test.dart b/test/api/account/authorize/authorize_test.dart index 4a384c446f..20ef537d00 100644 --- a/test/api/account/authorize/authorize_test.dart +++ b/test/api/account/authorize/authorize_test.dart @@ -20,6 +20,7 @@ void main() { const AuthorizeRequest( authorize: 'sample_token_334da73d', addToLoginHistory: true, + tokens: [], ), ); diff --git a/test/api/account/new_account_wallet/new_account_wallet_test.dart b/test/api/account/new_account_wallet/new_account_wallet_test.dart index e3a990eea8..a4fa152a3e 100644 --- a/test/api/account/new_account_wallet/new_account_wallet_test.dart +++ b/test/api/account/new_account_wallet/new_account_wallet_test.dart @@ -17,6 +17,11 @@ void main() { request: const NewAccountWalletRequest( accountType: 'crypto', currency: 'BTC', + acceptRisk: null, + financialAssessment: {}, + salutation: '', + taxIdentificationNumber: '', + taxResidence: '', ), ); diff --git a/test/api/common/active_symbols/active_symbols_test.dart b/test/api/common/active_symbols/active_symbols_test.dart index bfde84029a..fecbca988c 100644 --- a/test/api/common/active_symbols/active_symbols_test.dart +++ b/test/api/common/active_symbols/active_symbols_test.dart @@ -16,6 +16,7 @@ void main() { const ActiveSymbolsRequest( activeSymbols: 'brief', productType: 'basic', + landingCompany: '', ), ); diff --git a/test/services/call_manager/base_call_manager_test.dart b/test/services/call_manager/base_call_manager_test.dart index 5ba12de77b..b8c2935823 100644 --- a/test/services/call_manager/base_call_manager_test.dart +++ b/test/services/call_manager/base_call_manager_test.dart @@ -50,7 +50,10 @@ class MockCallManager extends BaseCallManager { MockCallManager(BaseAPI api) : super(api); @override - MockResponse call({required Request request}) { + MockResponse call({ + required Request request, + List nullableKeys = const [], + }) { throw UnimplementedError(); } } @@ -60,7 +63,11 @@ class MockAPI implements BaseAPI { void addToChannel(Map request) {} @override - Future call({required Request request}) => throw UnimplementedError(); + Future call({ + required Request request, + List nullableKeys = const [], + }) => + throw UnimplementedError(); @override Future connect(