Skip to content

Commit 080d5cf

Browse files
authored
added p2p business hour api changes (#331)
1 parent 3e684d3 commit 080d5cf

14 files changed

+569
-47
lines changed

binary-websocket-api

Submodule binary-websocket-api deleted from 1f42c92

lib/api/response/p2p_advert_create_response_result.dart

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

33
import 'package:equatable/equatable.dart';
4-
import 'package:flutter_deriv_api/api/exceptions/base_api_exception.dart';
54

5+
import 'package:flutter_deriv_api/api/exceptions/p2p_advert_exception.dart';
66
import 'package:flutter_deriv_api/api/models/base_exception_model.dart';
77
import 'package:flutter_deriv_api/basic_api/generated/p2p_advert_create_receive.dart';
88
import 'package:flutter_deriv_api/basic_api/generated/p2p_advert_create_send.dart';
@@ -176,21 +176,33 @@ enum P2pAdvertCreateTypeEnum {
176176
/// VisibilityStatusItemEnum mapper.
177177
final Map<String, VisibilityStatusItemEnum> visibilityStatusItemEnumMapper =
178178
<String, VisibilityStatusItemEnum>{
179+
"advert_fixed_rate_disabled":
180+
VisibilityStatusItemEnum.advertFixedRateDisabled,
181+
"advert_float_rate_disabled":
182+
VisibilityStatusItemEnum.advertFloatRateDisabled,
179183
"advert_inactive": VisibilityStatusItemEnum.advertInactive,
180184
"advert_max_limit": VisibilityStatusItemEnum.advertMaxLimit,
181185
"advert_min_limit": VisibilityStatusItemEnum.advertMinLimit,
182186
"advert_remaining": VisibilityStatusItemEnum.advertRemaining,
187+
"advert_no_payment_methods": VisibilityStatusItemEnum.advertNoPaymentMethods,
183188
"advertiser_ads_paused": VisibilityStatusItemEnum.advertiserAdsPaused,
184189
"advertiser_approval": VisibilityStatusItemEnum.advertiserApproval,
185190
"advertiser_balance": VisibilityStatusItemEnum.advertiserBalance,
186191
"advertiser_block_trade_ineligible":
187192
VisibilityStatusItemEnum.advertiserBlockTradeIneligible,
188193
"advertiser_daily_limit": VisibilityStatusItemEnum.advertiserDailyLimit,
194+
"advertiser_schedule": VisibilityStatusItemEnum.advertiserSchedule,
189195
"advertiser_temp_ban": VisibilityStatusItemEnum.advertiserTempBan,
190196
};
191197

192198
/// VisibilityStatusItem Enum.
193199
enum VisibilityStatusItemEnum {
200+
/// advert_fixed_rate_disabled.
201+
advertFixedRateDisabled,
202+
203+
/// advert_float_rate_disabled.
204+
advertFloatRateDisabled,
205+
194206
/// advert_inactive.
195207
advertInactive,
196208

@@ -203,6 +215,9 @@ enum VisibilityStatusItemEnum {
203215
/// advert_remaining.
204216
advertRemaining,
205217

218+
/// advert_no_payment_methods.
219+
advertNoPaymentMethods,
220+
206221
/// advertiser_ads_paused.
207222
advertiserAdsPaused,
208223

@@ -218,10 +233,12 @@ enum VisibilityStatusItemEnum {
218233
/// advertiser_daily_limit.
219234
advertiserDailyLimit,
220235

236+
/// advertiser_schedule.
237+
advertiserSchedule,
238+
221239
/// advertiser_temp_ban.
222240
advertiserTempBan,
223241
}
224-
225242
/// P2p advert create model class.
226243
abstract class P2pAdvertCreateModel {
227244
/// Initializes P2p advert create model class .
@@ -398,13 +415,17 @@ abstract class P2pAdvertCreateModel {
398415
final String? priceDisplay;
399416

400417
/// Reasons why an advert is not visible. Possible values:
418+
/// - `advert_fixed_rate_disabled`: fixed rate adverts are no longer available in the advert's country.
419+
/// - `advert_float_rate_disabled`: floating rate adverts are no longer available in the advert's country.
401420
/// - `advert_inactive`: the advert is set inactive.
402421
/// - `advert_max_limit`: the minimum order amount exceeds the system maximum order.
403422
/// - `advert_min_limit`: the maximum order amount is too small to be shown on the advert list.
404423
/// - `advert_remaining`: the remaining amount of the advert is below the minimum order.
424+
/// - `advert_no_payment_methods`: the advert has no valid payment methods.
405425
/// - `advertiser_ads_paused`: the advertiser has paused all adverts.
406426
/// - `advertiser_approval`: the advertiser's proof of identity is not verified.
407427
/// - `advertiser_balance`: the advertiser's P2P balance is less than the minimum order.
428+
/// - `advertiser_schedule`: the advertiser's schedule does not have availability between now and now + order_expiry_period.
408429
/// - `advertiser_block_trade_ineligible`: the advertiser is not currently eligible for block trading.
409430
/// - `advertiser_daily_limit`: the advertiser's remaining daily limit is less than the minimum order.
410431
/// - `advertiser_temp_ban`: the advertiser is temporarily banned from P2P.
@@ -721,13 +742,13 @@ class P2pAdvertCreate extends P2pAdvertCreateModel {
721742
visibilityStatus: visibilityStatus ?? this.visibilityStatus,
722743
);
723744
}
724-
725745
/// Advertiser details model class.
726746
abstract class AdvertiserDetailsModel {
727747
/// Initializes Advertiser details model class .
728748
const AdvertiserDetailsModel({
729749
required this.ratingCount,
730750
required this.name,
751+
required this.isScheduleAvailable,
731752
required this.isOnline,
732753
required this.id,
733754
required this.completedOrdersCount,
@@ -746,6 +767,9 @@ abstract class AdvertiserDetailsModel {
746767
/// The advertiser's displayed name.
747768
final String name;
748769

770+
/// Inidcates whether the advertiser's schedule has availability between now and now + order_expiry_period.
771+
final bool isScheduleAvailable;
772+
749773
/// Indicates if the advertiser is currently online.
750774
final bool isOnline;
751775

@@ -784,6 +808,7 @@ class AdvertiserDetails extends AdvertiserDetailsModel {
784808
required super.completedOrdersCount,
785809
required super.id,
786810
required super.isOnline,
811+
required super.isScheduleAvailable,
787812
required super.name,
788813
required super.ratingCount,
789814
super.firstName,
@@ -801,6 +826,7 @@ class AdvertiserDetails extends AdvertiserDetailsModel {
801826
completedOrdersCount: json['completed_orders_count'],
802827
id: json['id'],
803828
isOnline: getBool(json['is_online'])!,
829+
isScheduleAvailable: getBool(json['is_schedule_available'])!,
804830
name: json['name'],
805831
ratingCount: json['rating_count'],
806832
firstName: json['first_name'],
@@ -819,6 +845,7 @@ class AdvertiserDetails extends AdvertiserDetailsModel {
819845
resultMap['completed_orders_count'] = completedOrdersCount;
820846
resultMap['id'] = id;
821847
resultMap['is_online'] = isOnline;
848+
resultMap['is_schedule_available'] = isScheduleAvailable;
822849
resultMap['name'] = name;
823850
resultMap['rating_count'] = ratingCount;
824851
resultMap['first_name'] = firstName;
@@ -838,6 +865,7 @@ class AdvertiserDetails extends AdvertiserDetailsModel {
838865
int? completedOrdersCount,
839866
String? id,
840867
bool? isOnline,
868+
bool? isScheduleAvailable,
841869
String? name,
842870
int? ratingCount,
843871
String? firstName,
@@ -852,6 +880,7 @@ class AdvertiserDetails extends AdvertiserDetailsModel {
852880
completedOrdersCount: completedOrdersCount ?? this.completedOrdersCount,
853881
id: id ?? this.id,
854882
isOnline: isOnline ?? this.isOnline,
883+
isScheduleAvailable: isScheduleAvailable ?? this.isScheduleAvailable,
855884
name: name ?? this.name,
856885
ratingCount: ratingCount ?? this.ratingCount,
857886
firstName: firstName ?? this.firstName,
@@ -863,7 +892,6 @@ class AdvertiserDetails extends AdvertiserDetailsModel {
863892
totalCompletionRate: totalCompletionRate ?? this.totalCompletionRate,
864893
);
865894
}
866-
867895
/// Payment method details property model class.
868896
abstract class PaymentMethodDetailsPropertyModel {
869897
/// Initializes Payment method details property model class .
@@ -992,7 +1020,6 @@ class PaymentMethodDetailsProperty extends PaymentMethodDetailsPropertyModel {
9921020
usedByOrders: usedByOrders ?? this.usedByOrders,
9931021
);
9941022
}
995-
9961023
/// Fields property model class.
9971024
abstract class FieldsPropertyModel {
9981025
/// Initializes Fields property model class .

0 commit comments

Comments
 (0)