Showing
8 changed files
with
24 additions
and
13 deletions
| ... | @@ -27,6 +27,7 @@ import UIKit | ... | @@ -27,6 +27,7 @@ import UIKit |
| 27 | var termsVisible: Bool = false; | 27 | var termsVisible: Bool = false; |
| 28 | 28 | ||
| 29 | public var couponset: swiftApi.CouponSetItemModel? | 29 | public var couponset: swiftApi.CouponSetItemModel? |
| 30 | + public var campaign: swiftApi.CampaignItemModel? | ||
| 30 | 31 | ||
| 31 | public override func viewDidLoad() { | 32 | public override func viewDidLoad() { |
| 32 | super.viewDidLoad() | 33 | super.viewDidLoad() |
| ... | @@ -93,8 +94,8 @@ import UIKit | ... | @@ -93,8 +94,8 @@ import UIKit |
| 93 | } | 94 | } |
| 94 | } | 95 | } |
| 95 | 96 | ||
| 96 | - func redeemCouponSetRequest(uuid: String) { | 97 | + func redeemCouponSetRequest(uuid: String, communication_uuid: String) { |
| 97 | - swiftApi().redeemCouponSetAsync(uuid: uuid, redeemCouponSetCallback) | 98 | + swiftApi().redeemCouponSetAsync(uuid: uuid, communication_uuid: communication_uuid, redeemCouponSetCallback) |
| 98 | } | 99 | } |
| 99 | 100 | ||
| 100 | func redeemCouponSetCallback (_ response: swiftApi.GenericResponseModel?) -> Void { | 101 | func redeemCouponSetCallback (_ response: swiftApi.GenericResponseModel?) -> Void { |
| ... | @@ -104,15 +105,22 @@ import UIKit | ... | @@ -104,15 +105,22 @@ import UIKit |
| 104 | self.showSuccessDialog("Το κουπόνι σου ενεργοποιήθηκε","Μπορείς να το βρεις στην αρχική οθόνη της εφαρμογής και στην ενότητα ενεργά δώρα!") | 105 | self.showSuccessDialog("Το κουπόνι σου ενεργοποιήθηκε","Μπορείς να το βρεις στην αρχική οθόνη της εφαρμογής και στην ενότητα ενεργά δώρα!") |
| 105 | 106 | ||
| 106 | swiftApi().getCouponsAsync(getCouponsCallback) | 107 | swiftApi().getCouponsAsync(getCouponsCallback) |
| 108 | + swiftApi().getCampaignsAsyncNew(language: "en", filters: [String : Any](), getCampaignsCallback) | ||
| 107 | 109 | ||
| 108 | func getCouponsCallback (_ couponsData: Array<swiftApi.CouponItemModel>?) -> Void { | 110 | func getCouponsCallback (_ couponsData: Array<swiftApi.CouponItemModel>?) -> Void { |
| 109 | if (couponsData != nil) { | 111 | if (couponsData != nil) { |
| 110 | 112 | ||
| 111 | DispatchQueue.main.async { | 113 | DispatchQueue.main.async { |
| 112 | - print("========= getCouponsRequest SUCCESSSS CouponViewController =========") | ||
| 113 | } | 114 | } |
| 114 | } else { | 115 | } else { |
| 115 | - print("========= getCouponsRequest ERROR CouponViewController =========") | 116 | + } |
| 117 | + } | ||
| 118 | + | ||
| 119 | + func getCampaignsCallback (_ campaignsData: Array<swiftApi.CampaignItemModel>?) -> Void { | ||
| 120 | + if (campaignsData != nil) { | ||
| 121 | + DispatchQueue.main.async { | ||
| 122 | + } | ||
| 123 | + } else { | ||
| 116 | } | 124 | } |
| 117 | } | 125 | } |
| 118 | } else if (response?.getStatus == 3) { | 126 | } else if (response?.getStatus == 3) { |
| ... | @@ -171,7 +179,7 @@ import UIKit | ... | @@ -171,7 +179,7 @@ import UIKit |
| 171 | @IBAction func redeemButtomAction(_ sender: Any) { | 179 | @IBAction func redeemButtomAction(_ sender: Any) { |
| 172 | // SwiftEventBus.post("couponRedeem", sender: coupon) | 180 | // SwiftEventBus.post("couponRedeem", sender: coupon) |
| 173 | 181 | ||
| 174 | - redeemCouponSetRequest(uuid: couponset?.uuid ?? "") | 182 | + redeemCouponSetRequest(uuid: couponset?.uuid ?? "", communication_uuid: campaign?.session_uuid ?? "") |
| 175 | 183 | ||
| 176 | // let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self)) | 184 | // let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self)) |
| 177 | // let vc = storyboard.instantiateViewController(withIdentifier: "MakeItAPresentViewController") as! SwiftWarplyFramework.MakeItAPresentViewController | 185 | // let vc = storyboard.instantiateViewController(withIdentifier: "MakeItAPresentViewController") as! SwiftWarplyFramework.MakeItAPresentViewController | ... | ... |
| ... | @@ -112,6 +112,7 @@ extension GiftsViewController: UITableViewDelegate, UITableViewDataSource{ | ... | @@ -112,6 +112,7 @@ extension GiftsViewController: UITableViewDelegate, UITableViewDataSource{ |
| 112 | let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self)) | 112 | let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self)) |
| 113 | let vc = storyboard.instantiateViewController(withIdentifier: "CouponViewController") as! SwiftWarplyFramework.CouponViewController | 113 | let vc = storyboard.instantiateViewController(withIdentifier: "CouponViewController") as! SwiftWarplyFramework.CouponViewController |
| 114 | vc.couponset = item | 114 | vc.couponset = item |
| 115 | + vc.campaign = campaigns[indexPath.row] | ||
| 115 | self.navigationController?.pushViewController(vc, animated: true) | 116 | self.navigationController?.pushViewController(vc, animated: true) |
| 116 | 117 | ||
| 117 | break; | 118 | break; | ... | ... |
| ... | @@ -100,6 +100,7 @@ extension MFYViewController: UITableViewDelegate, UITableViewDataSource{ | ... | @@ -100,6 +100,7 @@ extension MFYViewController: UITableViewDelegate, UITableViewDataSource{ |
| 100 | let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self)) | 100 | let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self)) |
| 101 | let vc = storyboard.instantiateViewController(withIdentifier: "CouponViewController") as! SwiftWarplyFramework.CouponViewController | 101 | let vc = storyboard.instantiateViewController(withIdentifier: "CouponViewController") as! SwiftWarplyFramework.CouponViewController |
| 102 | vc.couponset = item | 102 | vc.couponset = item |
| 103 | + vc.campaign = campaigns[indexPath.row] | ||
| 103 | self.navigationController?.pushViewController(vc, animated: true) | 104 | self.navigationController?.pushViewController(vc, animated: true) |
| 104 | 105 | ||
| 105 | break; | 106 | break; | ... | ... |
| ... | @@ -82,7 +82,7 @@ | ... | @@ -82,7 +82,7 @@ |
| 82 | - (void)verifyTicketAsync:(NSString*)guid :(NSString*)ticket :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure; | 82 | - (void)verifyTicketAsync:(NSString*)guid :(NSString*)ticket :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure; |
| 83 | - (void)getProfileAsync:(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure; | 83 | - (void)getProfileAsync:(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure; |
| 84 | - (void)consumerIntegrationAsync:(NSNumber*)nonTelco :(NSNumber*)acceptedConsent :(NSArray*)msisdnList :(NSString*)guid :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure; | 84 | - (void)consumerIntegrationAsync:(NSNumber*)nonTelco :(NSNumber*)acceptedConsent :(NSArray*)msisdnList :(NSString*)guid :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure; |
| 85 | -- (void)redeemCouponSetAsync:(NSString*)uuid :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure; | 85 | +- (void)redeemCouponSetAsync:(NSString*)uuid :(NSString*)communication_uuid :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure; |
| 86 | - (void)getPacingDetailsAsync:(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure; | 86 | - (void)getPacingDetailsAsync:(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure; |
| 87 | - (void)cosmoteSharingAsync:(NSString*)sharingId :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure; | 87 | - (void)cosmoteSharingAsync:(NSString*)sharingId :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure; |
| 88 | - (void)cosmoteRetrieveSharingAsync:(NSString*)sharingId :(NSNumber*)accept :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure; | 88 | - (void)cosmoteRetrieveSharingAsync:(NSString*)sharingId :(NSNumber*)accept :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure; | ... | ... |
| ... | @@ -1368,9 +1368,9 @@ NSString *VERIFY_URL = @"/partners/cosmote/verify"; | ... | @@ -1368,9 +1368,9 @@ NSString *VERIFY_URL = @"/partners/cosmote/verify"; |
| 1368 | }]; | 1368 | }]; |
| 1369 | } | 1369 | } |
| 1370 | 1370 | ||
| 1371 | -- (void)redeemCouponSetAsync:(NSString*)uuid :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure | 1371 | +- (void)redeemCouponSetAsync:(NSString*)uuid :(NSString*)communication_uuid :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure |
| 1372 | { | 1372 | { |
| 1373 | - [[Warply sharedService] redeemCouponSetsWithSuccessBlock:uuid :^(NSDictionary *response) { | 1373 | + [[Warply sharedService] redeemCouponSetsWithSuccessBlock:uuid :communication_uuid :^(NSDictionary *response) { |
| 1374 | if (success) { | 1374 | if (success) { |
| 1375 | success(response); | 1375 | success(response); |
| 1376 | } | 1376 | } | ... | ... |
| ... | @@ -383,7 +383,7 @@ WL_VERSION_INTERFACE() | ... | @@ -383,7 +383,7 @@ WL_VERSION_INTERFACE() |
| 383 | 383 | ||
| 384 | - (void) getCouponSetsWithSuccessBlock:(NSNumber*) active andVisible:(NSNumber*) visible andUuids:(NSArray*) uuids :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure; | 384 | - (void) getCouponSetsWithSuccessBlock:(NSNumber*) active andVisible:(NSNumber*) visible andUuids:(NSArray*) uuids :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure; |
| 385 | 385 | ||
| 386 | -- (void) redeemCouponSetsWithSuccessBlock:(NSString*) uuid :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure; | 386 | +- (void) redeemCouponSetsWithSuccessBlock:(NSString*) uuid :(NSString*)communication_uuid :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure; |
| 387 | 387 | ||
| 388 | - (void) cosmoteCouponSharingWithSuccessBlock:(NSString*) coupon :(NSString*)sender :(NSString*)receiver :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure; | 388 | - (void) cosmoteCouponSharingWithSuccessBlock:(NSString*) coupon :(NSString*)sender :(NSString*)receiver :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure; |
| 389 | 389 | ... | ... |
| ... | @@ -2041,9 +2041,9 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) | ... | @@ -2041,9 +2041,9 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) |
| 2041 | }]; | 2041 | }]; |
| 2042 | } | 2042 | } |
| 2043 | 2043 | ||
| 2044 | -- (void) redeemCouponSetsWithSuccessBlock:(NSString*) uuid :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure | 2044 | +- (void) redeemCouponSetsWithSuccessBlock:(NSString*) uuid :(NSString*)communication_uuid :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure |
| 2045 | { | 2045 | { |
| 2046 | - NSDictionary *postDictionary = @{@"coupon": @{@"action": @"retrieve_coupon", @"coupon_set": uuid}}; | 2046 | + NSDictionary *postDictionary = @{@"coupon": @{@"action": @"retrieve_coupon", @"coupon_set": uuid, @"communication_uuid": communication_uuid}}; |
| 2047 | NSData *jsonData = [NSJSONSerialization dataWithJSONObject:postDictionary options:0 error:NULL]; | 2047 | NSData *jsonData = [NSJSONSerialization dataWithJSONObject:postDictionary options:0 error:NULL]; |
| 2048 | [self sendContext8:jsonData successBlock:^(NSDictionary *contextResponse) { | 2048 | [self sendContext8:jsonData successBlock:^(NSDictionary *contextResponse) { |
| 2049 | if (success) { | 2049 | if (success) { | ... | ... |
| ... | @@ -2440,6 +2440,7 @@ public class swiftApi { | ... | @@ -2440,6 +2440,7 @@ public class swiftApi { |
| 2440 | let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self)) | 2440 | let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self)) |
| 2441 | let vc = storyboard.instantiateViewController(withIdentifier: "CouponViewController") as! SwiftWarplyFramework.CouponViewController | 2441 | let vc = storyboard.instantiateViewController(withIdentifier: "CouponViewController") as! SwiftWarplyFramework.CouponViewController |
| 2442 | vc.couponset = item | 2442 | vc.couponset = item |
| 2443 | + vc.campaign = campaign | ||
| 2443 | controller.navigationController?.pushViewController(vc, animated: true) | 2444 | controller.navigationController?.pushViewController(vc, animated: true) |
| 2444 | 2445 | ||
| 2445 | break; | 2446 | break; |
| ... | @@ -2589,10 +2590,10 @@ public class swiftApi { | ... | @@ -2589,10 +2590,10 @@ public class swiftApi { |
| 2589 | } | 2590 | } |
| 2590 | } | 2591 | } |
| 2591 | 2592 | ||
| 2592 | - public func redeemCouponSetAsync(uuid: String, _ redeemCouponSetCallback: @escaping (_ responseData: GenericResponseModel?) -> Void) -> Void { | 2593 | + public func redeemCouponSetAsync(uuid: String, communication_uuid: String, _ redeemCouponSetCallback: @escaping (_ responseData: GenericResponseModel?) -> Void) -> Void { |
| 2593 | 2594 | ||
| 2594 | let instanceOfMyApi = MyApi() | 2595 | let instanceOfMyApi = MyApi() |
| 2595 | - instanceOfMyApi.redeemCouponSetAsync(uuid, requestCallback, failureBlock: requestFailureCallback) | 2596 | + instanceOfMyApi.redeemCouponSetAsync(uuid, communication_uuid, requestCallback, failureBlock: requestFailureCallback) |
| 2596 | 2597 | ||
| 2597 | func requestCallback(_ responseData: [AnyHashable: Any]?) -> Void { | 2598 | func requestCallback(_ responseData: [AnyHashable: Any]?) -> Void { |
| 2598 | 2599 | ... | ... |
-
Please register or login to post a comment