Manos Chorianopoulos

fix getCouponsAsync, getCampaignsAsync callbacks

...@@ -397,7 +397,9 @@ public class swiftApi { ...@@ -397,7 +397,9 @@ public class swiftApi {
397 // On CouponSets request Success, match coupons with couponsets 397 // On CouponSets request Success, match coupons with couponsets
398 let tempCoupons = matchCoupons() 398 let tempCoupons = matchCoupons()
399 swiftApi().setCouponList(tempCoupons) 399 swiftApi().setCouponList(tempCoupons)
400 - getCouponsCallback(tempCoupons) 400 +
401 + let activeCoupons = coupons.filter({ return $0.status == 1 })
402 + getCouponsCallback(activeCoupons)
401 } 403 }
402 404
403 func couponSetsFailureCallback(_ error: Error?) -> Void { 405 func couponSetsFailureCallback(_ error: Error?) -> Void {
...@@ -700,7 +702,14 @@ public class swiftApi { ...@@ -700,7 +702,14 @@ public class swiftApi {
700 } 702 }
701 703
702 swiftApi().setUniqueCampaignList(campaignsArray) 704 swiftApi().setUniqueCampaignList(campaignsArray)
703 - getCampaignsCallback(campaignsArray); 705 +
706 + let filteredCampaigns = campaignsArray.filter {
707 + let tempCampaign = $0
708 + let isCcmsOffer = (tempCampaign.ccms_offer != nil) && (tempCampaign.ccms_offer != "") && (tempCampaign.ccms_offer == "true")
709 +
710 + return (!isCcmsOffer)
711 + }
712 + getCampaignsCallback(filteredCampaigns);
704 } 713 }
705 714
706 func campaignsFailureCallback(_ error: Error?) -> Void { 715 func campaignsFailureCallback(_ error: Error?) -> Void {
......