Showing
1 changed file
with
12 additions
and
0 deletions
... | @@ -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)) |
... | @@ -381,6 +382,17 @@ public class swiftApi { | ... | @@ -381,6 +382,17 @@ public class swiftApi { |
381 | 382 | ||
382 | func couponSetsCallback(_ couponSetsData: [AnyHashable : Any]?) -> Void { | 383 | func couponSetsCallback(_ couponSetsData: [AnyHashable : Any]?) -> Void { |
383 | couponSets = couponSetsData ?? ["":""] | 384 | couponSets = couponSetsData ?? ["":""] |
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) | ||
384 | 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() | ... | ... |
-
Please register or login to post a comment