Manos Chorianopoulos

add setCouponSetList at getcoupons request

...@@ -363,6 +363,7 @@ public class swiftApi { ...@@ -363,6 +363,7 @@ public class swiftApi {
363 363
364 var coupons: [AnyHashable : Any]? 364 var coupons: [AnyHashable : Any]?
365 var couponSets: [AnyHashable : Any]? 365 var couponSets: [AnyHashable : Any]?
366 + var couponSetsArray:Array<CouponSetItemModel> = []
366 let instanceOfMyApi = MyApi() 367 let instanceOfMyApi = MyApi()
367 368
368 instanceOfMyApi.getCouponsWithSuccessBlock(couponsCallback, failureBlock: (couponsFailureCallback)) 369 instanceOfMyApi.getCouponsWithSuccessBlock(couponsCallback, failureBlock: (couponsFailureCallback))
...@@ -382,6 +383,17 @@ public class swiftApi { ...@@ -382,6 +383,17 @@ public class swiftApi {
382 func couponSetsCallback(_ couponSetsData: [AnyHashable : Any]?) -> Void { 383 func couponSetsCallback(_ couponSetsData: [AnyHashable : Any]?) -> Void {
383 couponSets = couponSetsData ?? ["":""] 384 couponSets = couponSetsData ?? ["":""]
384 385
386 + if let myCouponsSetsDictionary = couponSets as? [String : AnyObject] {
387 + let couponSetsData = (myCouponsSetsDictionary["MAPP_COUPON"] as! NSArray)
388 +
389 + for couponset in couponSetsData {
390 + let tempCouponset = CouponSetItemModel(dictionary: couponset as! [String : Any])
391 + couponSetsArray.append(tempCouponset)
392 + }
393 +
394 + }
395 + swiftApi().setCouponSetList(couponSetsArray)
396 +
385 // On CouponSets request Success, match coupons with couponsets 397 // On CouponSets request Success, match coupons with couponsets
386 let tempCoupons = matchCoupons() 398 let tempCoupons = matchCoupons()
387 swiftApi().setCouponList(tempCoupons) 399 swiftApi().setCouponList(tempCoupons)
......