Manos Chorianopoulos

add setOldCouponList, getOldCouponList functions

......@@ -15,6 +15,7 @@ public struct GlobalVariables {
static var userTag: String = ""
static var dfyCoupons: Array<swiftApi.ActiveDFYCouponModel> = []
static var couponList: Array<swiftApi.CouponItemModel> = []
static var oldCouponList: Array<swiftApi.CouponItemModel> = []
static var couponSetList: Array<swiftApi.CouponSetItemModel> = []
static var loyaltyBadge: swiftApi.LoyaltyBadgeModel = swiftApi.LoyaltyBadgeModel()
static var consumer: swiftApi.ProfileModel?
......@@ -397,6 +398,7 @@ public class swiftApi {
// On CouponSets request Success, match coupons with couponsets
let tempCoupons = matchCoupons()
swiftApi().setCouponList(tempCoupons)
swiftApi().setOldCouponList(tempCoupons)
let activeCoupons = tempCoupons.filter({ return $0.status == 1 })
getCouponsCallback(activeCoupons)
......@@ -2893,6 +2895,19 @@ public class swiftApi {
}
public func setOldCouponList(_ coupons: Array<CouponItemModel>) {
// let filteredCoupons = coupons.filter { CharacterSet.decimalDigits.isSuperset(of: CharacterSet(charactersIn: $0.discount ?? "")) }
let oldCoupons = coupons.filter({ return $0.status == 0 })
GlobalVariables.oldCouponList = oldCoupons
}
public func getOldCouponList() -> Array<CouponItemModel> {
return GlobalVariables.oldCouponList
}
public func setCouponSetList(_ couponSets: Array<CouponSetItemModel>) {
GlobalVariables.couponSetList = couponSets
}
......