pay_models.dart
4.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
import 'package:json_annotation/json_annotation.dart';
part 'pay_models.g.dart';
@JsonSerializable()
class PayProductListResponse {
const PayProductListResponse({this.productList});
@JsonKey(name: 'product_list')
final List<PayProduct>? productList;
factory PayProductListResponse.fromJson(Map<String, dynamic> json) =>
_$PayProductListResponseFromJson(json);
Map<String, dynamic> toJson() => _$PayProductListResponseToJson(this);
}
@JsonSerializable()
class PayProduct {
const PayProduct({
this.id,
this.name,
this.profile,
this.content,
this.price,
this.servePeriod,
this.discountPrice,
this.discountStartTime,
this.discountEndTime,
});
final int? id;
final String? name;
final String? profile;
final PayProductContent? content;
final int? price;
@JsonKey(name: 'serve_period')
final int? servePeriod;
@JsonKey(name: 'discount_price')
final int? discountPrice;
@JsonKey(name: 'discount_start_time')
final int? discountStartTime;
@JsonKey(name: 'discount_end_time')
final int? discountEndTime;
factory PayProduct.fromJson(Map<String, dynamic> json) =>
_$PayProductFromJson(json);
Map<String, dynamic> toJson() => _$PayProductToJson(this);
}
@JsonSerializable()
class PayProductContent {
const PayProductContent({
this.type,
this.vipDays,
this.label,
this.description,
this.isForever,
this.share,
});
final int? type;
@JsonKey(name: 'vip_days')
final int? vipDays;
final String? label;
final String? description;
@JsonKey(name: 'is_forever')
final int? isForever;
final int? share;
factory PayProductContent.fromJson(Map<String, dynamic> json) =>
_$PayProductContentFromJson(json);
Map<String, dynamic> toJson() => _$PayProductContentToJson(this);
}
@JsonSerializable()
class CreatePayOrderRequest {
const CreatePayOrderRequest({
required this.productId,
this.productChannel = 1,
this.paymentChannel = 2,
});
@JsonKey(name: 'product_id')
final int productId;
@JsonKey(name: 'product_channel')
final int productChannel;
@JsonKey(name: 'payment_channel')
final int paymentChannel;
factory CreatePayOrderRequest.fromJson(Map<String, dynamic> json) =>
_$CreatePayOrderRequestFromJson(json);
Map<String, dynamic> toJson() => _$CreatePayOrderRequestToJson(this);
}
@JsonSerializable()
class CreatePayOrderResponse {
const CreatePayOrderResponse({this.prepayData});
@JsonKey(name: 'prepay_data')
final String? prepayData;
factory CreatePayOrderResponse.fromJson(Map<String, dynamic> json) =>
_$CreatePayOrderResponseFromJson(json);
Map<String, dynamic> toJson() => _$CreatePayOrderResponseToJson(this);
}
@JsonSerializable()
class SubscriptionProductListResponse {
const SubscriptionProductListResponse({this.productList});
@JsonKey(name: 'subscription_list')
final List<SubscriptionProduct>? productList;
factory SubscriptionProductListResponse.fromJson(
Map<String, dynamic> json,
) =>
_$SubscriptionProductListResponseFromJson(json);
Map<String, dynamic> toJson() =>
_$SubscriptionProductListResponseToJson(this);
}
@JsonSerializable()
class SubscriptionProduct {
const SubscriptionProduct({
this.agreementNo,
this.startTime,
this.endTime,
this.nextPayPrice,
this.productInfo,
});
@JsonKey(name: 'agreement_no')
final String? agreementNo;
@JsonKey(name: 'last_execute_timestamp')
final int? startTime;
@JsonKey(name: 'next_execute_timestamp')
final int? endTime;
@JsonKey(name: 'single_amount')
final int? nextPayPrice;
@JsonKey(name: 'product_info')
final SubscriptionProductInfo? productInfo;
factory SubscriptionProduct.fromJson(Map<String, dynamic> json) =>
_$SubscriptionProductFromJson(json);
Map<String, dynamic> toJson() => _$SubscriptionProductToJson(this);
}
@JsonSerializable()
class SubscriptionProductInfo {
const SubscriptionProductInfo({this.name});
final String? name;
factory SubscriptionProductInfo.fromJson(Map<String, dynamic> json) =>
_$SubscriptionProductInfoFromJson(json);
Map<String, dynamic> toJson() => _$SubscriptionProductInfoToJson(this);
}
@JsonSerializable()
class SubscriptionCancelRequest {
const SubscriptionCancelRequest({required this.agreementNo});
@JsonKey(name: 'agreement_no')
final String agreementNo;
factory SubscriptionCancelRequest.fromJson(Map<String, dynamic> json) =>
_$SubscriptionCancelRequestFromJson(json);
Map<String, dynamic> toJson() => _$SubscriptionCancelRequestToJson(this);
}