Manos Chorianopoulos

add setCouponSetList at getcoupons request

......@@ -363,6 +363,7 @@ public class swiftApi {
var coupons: [AnyHashable : Any]?
var couponSets: [AnyHashable : Any]?
var couponSetsArray:Array<CouponSetItemModel> = []
let instanceOfMyApi = MyApi()
instanceOfMyApi.getCouponsWithSuccessBlock(couponsCallback, failureBlock: (couponsFailureCallback))
......@@ -382,6 +383,17 @@ public class swiftApi {
func couponSetsCallback(_ couponSetsData: [AnyHashable : Any]?) -> Void {
couponSets = couponSetsData ?? ["":""]
if let myCouponsSetsDictionary = couponSets as? [String : AnyObject] {
let couponSetsData = (myCouponsSetsDictionary["MAPP_COUPON"] as! NSArray)
for couponset in couponSetsData {
let tempCouponset = CouponSetItemModel(dictionary: couponset as! [String : Any])
couponSetsArray.append(tempCouponset)
}
}
swiftApi().setCouponSetList(couponSetsArray)
// On CouponSets request Success, match coupons with couponsets
let tempCoupons = matchCoupons()
swiftApi().setCouponList(tempCoupons)
......