couponApply
This commit is contained in:
File diff suppressed because it is too large
Load Diff
165
lib/src/data/coupon_model.dart
Normal file
165
lib/src/data/coupon_model.dart
Normal file
@@ -0,0 +1,165 @@
|
||||
// To parse this JSON data, do
|
||||
//
|
||||
// final couponData = couponDataFromJson(jsondynamic);
|
||||
|
||||
import 'dart:convert';
|
||||
|
||||
CouponDataModel couponDataFromJson(dynamic str) => CouponDataModel.fromJson(json.decode(str));
|
||||
|
||||
dynamic couponDataToJson(CouponDataModel data) => json.encode(data.toJson());
|
||||
|
||||
class CouponDataModel {
|
||||
List<CouponDatum>? data;
|
||||
int? total;
|
||||
int? page;
|
||||
int? limit;
|
||||
|
||||
CouponDataModel({
|
||||
this.data,
|
||||
this.total,
|
||||
this.page,
|
||||
this.limit,
|
||||
});
|
||||
|
||||
factory CouponDataModel.fromJson(Map<dynamic, dynamic> json) => CouponDataModel(
|
||||
data: List<CouponDatum>.from(json["data"].map((x) => CouponDatum.fromJson(x))),
|
||||
total: json["total"],
|
||||
page: json["page"],
|
||||
limit: json["limit"],
|
||||
);
|
||||
|
||||
Map<dynamic, dynamic> toJson() => {
|
||||
"data": List<dynamic>.from(data!.map((x) => x.toJson())),
|
||||
"total": total,
|
||||
"page": page,
|
||||
"limit": limit,
|
||||
};
|
||||
}
|
||||
|
||||
class CouponDatum {
|
||||
dynamic id;
|
||||
dynamic code;
|
||||
dynamic type;
|
||||
dynamic discountValue;
|
||||
dynamic maxDiscountAmount;
|
||||
dynamic minPurchaseAmount;
|
||||
DateTime? startDate;
|
||||
DateTime? endDate;
|
||||
int? totalUsageLimit;
|
||||
int? perUserUsageLimit;
|
||||
dynamic applicability;
|
||||
dynamic status;
|
||||
dynamic description;
|
||||
dynamic terms;
|
||||
int? buyQuantity;
|
||||
int? getQuantity;
|
||||
List<dynamic>? applicableUserRoles;
|
||||
int? totalUsageCount;
|
||||
bool? isActive;
|
||||
dynamic createdBy;
|
||||
DateTime? createdAt;
|
||||
DateTime? updatedAt;
|
||||
List<dynamic>? applicableStores;
|
||||
List<dynamic>? applicableCategories;
|
||||
List<dynamic>? applicableProducts;
|
||||
List<dynamic>? usages;
|
||||
List<dynamic>? applicableStoreIds;
|
||||
List<dynamic>? applicableCategoryIds;
|
||||
List<dynamic>? applicableProductIds;
|
||||
|
||||
CouponDatum({
|
||||
this.id,
|
||||
this.code,
|
||||
this.type,
|
||||
this.discountValue,
|
||||
this.maxDiscountAmount,
|
||||
this.minPurchaseAmount,
|
||||
this.startDate,
|
||||
this.endDate,
|
||||
this.totalUsageLimit,
|
||||
this.perUserUsageLimit,
|
||||
this.applicability,
|
||||
this.status,
|
||||
this.description,
|
||||
this.terms,
|
||||
this.buyQuantity,
|
||||
this.getQuantity,
|
||||
this.applicableUserRoles,
|
||||
this.totalUsageCount,
|
||||
this.isActive,
|
||||
this.createdBy,
|
||||
this.createdAt,
|
||||
this.updatedAt,
|
||||
this.applicableStores,
|
||||
this.applicableCategories,
|
||||
this.applicableProducts,
|
||||
this.usages,
|
||||
this.applicableStoreIds,
|
||||
this.applicableCategoryIds,
|
||||
this.applicableProductIds,
|
||||
});
|
||||
|
||||
factory CouponDatum.fromJson(Map<dynamic, dynamic> json) => CouponDatum(
|
||||
id: json["id"],
|
||||
code: json["code"],
|
||||
type: json["type"],
|
||||
discountValue: json["discountValue"],
|
||||
maxDiscountAmount: json["maxDiscountAmount"],
|
||||
minPurchaseAmount: json["minPurchaseAmount"],
|
||||
startDate: DateTime.parse(json["startDate"]),
|
||||
endDate: DateTime.parse(json["endDate"]),
|
||||
totalUsageLimit: json["totalUsageLimit"],
|
||||
perUserUsageLimit: json["perUserUsageLimit"],
|
||||
applicability: json["applicability"],
|
||||
status: json["status"],
|
||||
description: json["description"],
|
||||
terms: json["terms"],
|
||||
buyQuantity: json["buyQuantity"],
|
||||
getQuantity: json["getQuantity"],
|
||||
applicableUserRoles: List<dynamic>.from(json["applicableUserRoles"].map((x) => x)),
|
||||
totalUsageCount: json["totalUsageCount"],
|
||||
isActive: json["isActive"],
|
||||
createdBy: json["createdBy"],
|
||||
createdAt: DateTime.parse(json["createdAt"]),
|
||||
updatedAt: DateTime.parse(json["updatedAt"]),
|
||||
applicableStores: List<dynamic>.from(json["applicableStores"].map((x) => x)),
|
||||
applicableCategories: List<dynamic>.from(json["applicableCategories"].map((x) => x)),
|
||||
applicableProducts: List<dynamic>.from(json["applicableProducts"].map((x) => x)),
|
||||
usages: List<dynamic>.from(json["usages"].map((x) => x)),
|
||||
applicableStoreIds: List<dynamic>.from(json["applicableStoreIds"].map((x) => x)),
|
||||
applicableCategoryIds: List<dynamic>.from(json["applicableCategoryIds"].map((x) => x)),
|
||||
applicableProductIds: List<dynamic>.from(json["applicableProductIds"].map((x) => x)),
|
||||
);
|
||||
|
||||
Map<dynamic, dynamic> toJson() => {
|
||||
"id": id,
|
||||
"code": code,
|
||||
"type": type,
|
||||
"discountValue": discountValue,
|
||||
"maxDiscountAmount": maxDiscountAmount,
|
||||
"minPurchaseAmount": minPurchaseAmount,
|
||||
"startDate": startDate,
|
||||
"endDate": endDate,
|
||||
"totalUsageLimit": totalUsageLimit,
|
||||
"perUserUsageLimit": perUserUsageLimit,
|
||||
"applicability": applicability,
|
||||
"status": status,
|
||||
"description": description,
|
||||
"terms": terms,
|
||||
"buyQuantity": buyQuantity,
|
||||
"getQuantity": getQuantity,
|
||||
"applicableUserRoles": List<dynamic>.from(applicableUserRoles!.map((x) => x)),
|
||||
"totalUsageCount": totalUsageCount,
|
||||
"isActive": isActive,
|
||||
"createdBy": createdBy,
|
||||
"createdAt": createdAt,
|
||||
"updatedAt": updatedAt,
|
||||
"applicableStores": List<dynamic>.from(applicableStores!.map((x) => x)),
|
||||
"applicableCategories": List<dynamic>.from(applicableCategories!.map((x) => x)),
|
||||
"applicableProducts": List<dynamic>.from(applicableProducts!.map((x) => x)),
|
||||
"usages": List<dynamic>.from(usages!.map((x) => x)),
|
||||
"applicableStoreIds": List<dynamic>.from(applicableStoreIds!.map((x) => x)),
|
||||
"applicableCategoryIds": List<dynamic>.from(applicableCategoryIds!.map((x) => x)),
|
||||
"applicableProductIds": List<dynamic>.from(applicableProductIds!.map((x) => x)),
|
||||
};
|
||||
}
|
||||
69
lib/src/data/coupon_response.dart
Normal file
69
lib/src/data/coupon_response.dart
Normal file
@@ -0,0 +1,69 @@
|
||||
// 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,
|
||||
};
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user