Manos Chorianopoulos

add setOldCouponList, getOldCouponList functions

...@@ -15,6 +15,7 @@ public struct GlobalVariables { ...@@ -15,6 +15,7 @@ public struct GlobalVariables {
15 static var userTag: String = "" 15 static var userTag: String = ""
16 static var dfyCoupons: Array<swiftApi.ActiveDFYCouponModel> = [] 16 static var dfyCoupons: Array<swiftApi.ActiveDFYCouponModel> = []
17 static var couponList: Array<swiftApi.CouponItemModel> = [] 17 static var couponList: Array<swiftApi.CouponItemModel> = []
18 + static var oldCouponList: Array<swiftApi.CouponItemModel> = []
18 static var couponSetList: Array<swiftApi.CouponSetItemModel> = [] 19 static var couponSetList: Array<swiftApi.CouponSetItemModel> = []
19 static var loyaltyBadge: swiftApi.LoyaltyBadgeModel = swiftApi.LoyaltyBadgeModel() 20 static var loyaltyBadge: swiftApi.LoyaltyBadgeModel = swiftApi.LoyaltyBadgeModel()
20 static var consumer: swiftApi.ProfileModel? 21 static var consumer: swiftApi.ProfileModel?
...@@ -397,6 +398,7 @@ public class swiftApi { ...@@ -397,6 +398,7 @@ public class swiftApi {
397 // On CouponSets request Success, match coupons with couponsets 398 // On CouponSets request Success, match coupons with couponsets
398 let tempCoupons = matchCoupons() 399 let tempCoupons = matchCoupons()
399 swiftApi().setCouponList(tempCoupons) 400 swiftApi().setCouponList(tempCoupons)
401 + swiftApi().setOldCouponList(tempCoupons)
400 402
401 let activeCoupons = tempCoupons.filter({ return $0.status == 1 }) 403 let activeCoupons = tempCoupons.filter({ return $0.status == 1 })
402 getCouponsCallback(activeCoupons) 404 getCouponsCallback(activeCoupons)
...@@ -2892,6 +2894,19 @@ public class swiftApi { ...@@ -2892,6 +2894,19 @@ public class swiftApi {
2892 return GlobalVariables.couponList 2894 return GlobalVariables.couponList
2893 } 2895 }
2894 2896
2897 +
2898 + public func setOldCouponList(_ coupons: Array<CouponItemModel>) {
2899 + // let filteredCoupons = coupons.filter { CharacterSet.decimalDigits.isSuperset(of: CharacterSet(charactersIn: $0.discount ?? "")) }
2900 + let oldCoupons = coupons.filter({ return $0.status == 0 })
2901 +
2902 + GlobalVariables.oldCouponList = oldCoupons
2903 + }
2904 +
2905 +
2906 + public func getOldCouponList() -> Array<CouponItemModel> {
2907 + return GlobalVariables.oldCouponList
2908 + }
2909 +
2895 2910
2896 public func setCouponSetList(_ couponSets: Array<CouponSetItemModel>) { 2911 public func setCouponSetList(_ couponSets: Array<CouponSetItemModel>) {
2897 GlobalVariables.couponSetList = couponSets 2912 GlobalVariables.couponSetList = couponSets
......