149 lines
3.9 KiB
Dart
149 lines
3.9 KiB
Dart
// // To parse this JSON data, do
|
|
// //
|
|
// // final couponResponse = couponResponseFromJson(jsonString);
|
|
|
|
// import 'dart:convert';
|
|
|
|
// CouponResponse couponResponseFromJson(String str) => CouponResponse.fromJson(json.decode(str));
|
|
|
|
// String couponResponseToJson(CouponResponse data) => json.encode(data.toJson());
|
|
|
|
// class CouponResponse {
|
|
// bool? isValid;
|
|
// String? originalPrice;
|
|
// int? discountAmount;
|
|
// int? finalPrice;
|
|
// String? message;
|
|
// CouponDetails? couponDetails;
|
|
|
|
// CouponResponse({
|
|
// this.isValid,
|
|
// this.originalPrice,
|
|
// this.discountAmount,
|
|
// this.finalPrice,
|
|
// this.message,
|
|
// this.couponDetails,
|
|
// });
|
|
|
|
// factory CouponResponse.fromJson(Map<String, dynamic> json) => CouponResponse(
|
|
// isValid: json["isValid"],
|
|
// originalPrice: json["originalPrice"],
|
|
// discountAmount: json["discountAmount"],
|
|
// finalPrice: json["finalPrice"],
|
|
// message: json["message"],
|
|
// couponDetails: CouponDetails.fromJson(json["couponDetails"]),
|
|
// );
|
|
|
|
// Map<String, dynamic> toJson() => {
|
|
// "isValid": isValid,
|
|
// "originalPrice": originalPrice,
|
|
// "discountAmount": discountAmount,
|
|
// "finalPrice": finalPrice,
|
|
// "message": message,
|
|
// "couponDetails": couponDetails!.toJson(),
|
|
// };
|
|
// }
|
|
|
|
// class CouponDetails {
|
|
// String? code;
|
|
// String? type;
|
|
// String? discountValue;
|
|
|
|
// CouponDetails({
|
|
// this.code,
|
|
// this.type,
|
|
// this.discountValue,
|
|
// });
|
|
|
|
// factory CouponDetails.fromJson(Map<String, dynamic> json) => CouponDetails(
|
|
// code: json["code"],
|
|
// type: json["type"],
|
|
// discountValue: json["discountValue"],
|
|
// );
|
|
|
|
// Map<String, dynamic> toJson() => {
|
|
// "code": code,
|
|
// "type": type,
|
|
// "discountValue": discountValue,
|
|
// };
|
|
// }
|
|
|
|
// To parse this JSON data, do
|
|
//
|
|
// final couponResponse = couponResponseFromJson(jsonString);
|
|
|
|
// To parse this JSON data, do
|
|
//
|
|
// final couponResponse = couponResponseFromJson(jsonString);
|
|
|
|
import 'dart:convert';
|
|
|
|
CouponResponse couponResponseFromJson(String str) =>
|
|
CouponResponse.fromJson(json.decode(str));
|
|
|
|
String couponResponseToJson(CouponResponse data) => json.encode(data.toJson());
|
|
|
|
class CouponResponse {
|
|
bool? isValid;
|
|
double? originalPrice;
|
|
double? eligibleSubtotal;
|
|
dynamic? discountAmount;
|
|
double? finalPrice;
|
|
String? message;
|
|
CouponDetails? couponDetails;
|
|
|
|
CouponResponse({
|
|
this.isValid,
|
|
this.originalPrice,
|
|
this.eligibleSubtotal,
|
|
this.discountAmount,
|
|
this.finalPrice,
|
|
this.message,
|
|
this.couponDetails,
|
|
});
|
|
|
|
factory CouponResponse.fromJson(Map<String, dynamic> json) => CouponResponse(
|
|
isValid: json["isValid"],
|
|
originalPrice: json["originalPrice"].toDouble(),
|
|
eligibleSubtotal: json["eligibleSubtotal"].toDouble(),
|
|
discountAmount: json["discountAmount"],
|
|
finalPrice: json["finalPrice"].toDouble(),
|
|
message: json["message"],
|
|
couponDetails: CouponDetails.fromJson(json["couponDetails"]),
|
|
);
|
|
|
|
Map<String, dynamic> toJson() => {
|
|
"isValid": isValid,
|
|
"originalPrice": originalPrice,
|
|
"eligibleSubtotal": eligibleSubtotal,
|
|
"discountAmount": discountAmount,
|
|
"finalPrice": finalPrice,
|
|
"message": message,
|
|
"couponDetails": couponDetails!.toJson(),
|
|
};
|
|
}
|
|
|
|
class CouponDetails {
|
|
String? code;
|
|
String? type;
|
|
String? discountValue;
|
|
|
|
CouponDetails({
|
|
this.code,
|
|
this.type,
|
|
this.discountValue,
|
|
});
|
|
|
|
factory CouponDetails.fromJson(Map<String, dynamic> json) => CouponDetails(
|
|
code: json["code"],
|
|
type: json["type"],
|
|
discountValue: json["discountValue"],
|
|
);
|
|
|
|
Map<String, dynamic> toJson() => {
|
|
"code": code,
|
|
"type": type,
|
|
"discountValue": discountValue,
|
|
};
|
|
}
|