Manos Chorianopoulos

update redeemCouponSetAsync request

......@@ -27,6 +27,7 @@ import UIKit
var termsVisible: Bool = false;
public var couponset: swiftApi.CouponSetItemModel?
public var campaign: swiftApi.CampaignItemModel?
public override func viewDidLoad() {
super.viewDidLoad()
......@@ -93,8 +94,8 @@ import UIKit
}
}
func redeemCouponSetRequest(uuid: String) {
swiftApi().redeemCouponSetAsync(uuid: uuid, redeemCouponSetCallback)
func redeemCouponSetRequest(uuid: String, communication_uuid: String) {
swiftApi().redeemCouponSetAsync(uuid: uuid, communication_uuid: communication_uuid, redeemCouponSetCallback)
}
func redeemCouponSetCallback (_ response: swiftApi.GenericResponseModel?) -> Void {
......@@ -104,15 +105,22 @@ import UIKit
self.showSuccessDialog("Το κουπόνι σου ενεργοποιήθηκε","Μπορείς να το βρεις στην αρχική οθόνη της εφαρμογής και στην ενότητα ενεργά δώρα!")
swiftApi().getCouponsAsync(getCouponsCallback)
swiftApi().getCampaignsAsyncNew(language: "en", filters: [String : Any](), getCampaignsCallback)
func getCouponsCallback (_ couponsData: Array<swiftApi.CouponItemModel>?) -> Void {
if (couponsData != nil) {
DispatchQueue.main.async {
print("========= getCouponsRequest SUCCESSSS CouponViewController =========")
}
} else {
print("========= getCouponsRequest ERROR CouponViewController =========")
}
}
func getCampaignsCallback (_ campaignsData: Array<swiftApi.CampaignItemModel>?) -> Void {
if (campaignsData != nil) {
DispatchQueue.main.async {
}
} else {
}
}
} else if (response?.getStatus == 3) {
......@@ -171,7 +179,7 @@ import UIKit
@IBAction func redeemButtomAction(_ sender: Any) {
// SwiftEventBus.post("couponRedeem", sender: coupon)
redeemCouponSetRequest(uuid: couponset?.uuid ?? "")
redeemCouponSetRequest(uuid: couponset?.uuid ?? "", communication_uuid: campaign?.session_uuid ?? "")
// let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self))
// let vc = storyboard.instantiateViewController(withIdentifier: "MakeItAPresentViewController") as! SwiftWarplyFramework.MakeItAPresentViewController
......
......@@ -112,6 +112,7 @@ extension GiftsViewController: UITableViewDelegate, UITableViewDataSource{
let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self))
let vc = storyboard.instantiateViewController(withIdentifier: "CouponViewController") as! SwiftWarplyFramework.CouponViewController
vc.couponset = item
vc.campaign = campaigns[indexPath.row]
self.navigationController?.pushViewController(vc, animated: true)
break;
......
......@@ -100,6 +100,7 @@ extension MFYViewController: UITableViewDelegate, UITableViewDataSource{
let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self))
let vc = storyboard.instantiateViewController(withIdentifier: "CouponViewController") as! SwiftWarplyFramework.CouponViewController
vc.couponset = item
vc.campaign = campaigns[indexPath.row]
self.navigationController?.pushViewController(vc, animated: true)
break;
......
......@@ -82,7 +82,7 @@
- (void)verifyTicketAsync:(NSString*)guid :(NSString*)ticket :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure;
- (void)getProfileAsync:(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure;
- (void)consumerIntegrationAsync:(NSNumber*)nonTelco :(NSNumber*)acceptedConsent :(NSArray*)msisdnList :(NSString*)guid :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure;
- (void)redeemCouponSetAsync:(NSString*)uuid :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure;
- (void)redeemCouponSetAsync:(NSString*)uuid :(NSString*)communication_uuid :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure;
- (void)getPacingDetailsAsync:(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure;
- (void)cosmoteSharingAsync:(NSString*)sharingId :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure;
- (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";
}];
}
- (void)redeemCouponSetAsync:(NSString*)uuid :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure
- (void)redeemCouponSetAsync:(NSString*)uuid :(NSString*)communication_uuid :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure
{
[[Warply sharedService] redeemCouponSetsWithSuccessBlock:uuid :^(NSDictionary *response) {
[[Warply sharedService] redeemCouponSetsWithSuccessBlock:uuid :communication_uuid :^(NSDictionary *response) {
if (success) {
success(response);
}
......
......@@ -383,7 +383,7 @@ WL_VERSION_INTERFACE()
- (void) getCouponSetsWithSuccessBlock:(NSNumber*) active andVisible:(NSNumber*) visible andUuids:(NSArray*) uuids :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure;
- (void) redeemCouponSetsWithSuccessBlock:(NSString*) uuid :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure;
- (void) redeemCouponSetsWithSuccessBlock:(NSString*) uuid :(NSString*)communication_uuid :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure;
- (void) cosmoteCouponSharingWithSuccessBlock:(NSString*) coupon :(NSString*)sender :(NSString*)receiver :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure;
......
......@@ -2041,9 +2041,9 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION)
}];
}
- (void) redeemCouponSetsWithSuccessBlock:(NSString*) uuid :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure
- (void) redeemCouponSetsWithSuccessBlock:(NSString*) uuid :(NSString*)communication_uuid :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure
{
NSDictionary *postDictionary = @{@"coupon": @{@"action": @"retrieve_coupon", @"coupon_set": uuid}};
NSDictionary *postDictionary = @{@"coupon": @{@"action": @"retrieve_coupon", @"coupon_set": uuid, @"communication_uuid": communication_uuid}};
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:postDictionary options:0 error:NULL];
[self sendContext8:jsonData successBlock:^(NSDictionary *contextResponse) {
if (success) {
......
......@@ -2440,6 +2440,7 @@ public class swiftApi {
let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self))
let vc = storyboard.instantiateViewController(withIdentifier: "CouponViewController") as! SwiftWarplyFramework.CouponViewController
vc.couponset = item
vc.campaign = campaign
controller.navigationController?.pushViewController(vc, animated: true)
break;
......@@ -2589,10 +2590,10 @@ public class swiftApi {
}
}
public func redeemCouponSetAsync(uuid: String, _ redeemCouponSetCallback: @escaping (_ responseData: GenericResponseModel?) -> Void) -> Void {
public func redeemCouponSetAsync(uuid: String, communication_uuid: String, _ redeemCouponSetCallback: @escaping (_ responseData: GenericResponseModel?) -> Void) -> Void {
let instanceOfMyApi = MyApi()
instanceOfMyApi.redeemCouponSetAsync(uuid, requestCallback, failureBlock: requestFailureCallback)
instanceOfMyApi.redeemCouponSetAsync(uuid, communication_uuid, requestCallback, failureBlock: requestFailureCallback)
func requestCallback(_ responseData: [AnyHashable: Any]?) -> Void {
......