Manos Chorianopoulos

add failureCallbacks, sdk_session_expired events

......@@ -7,7 +7,7 @@
<key>Pods-SwiftWarplyFramework.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
<integer>1</integer>
</dict>
</dict>
</dict>
......
......@@ -7,7 +7,7 @@
<key>SwiftWarplyFramework.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>1</integer>
<integer>0</integer>
</dict>
</dict>
</dict>
......
......@@ -44,7 +44,7 @@ var timer2: DispatchSourceTimer?
dateFormatter.dateFormat = "yyyy-MM-dd HH:mm:ss"
let dateString = dateFormatter.string(from: currentDateTime)
swiftApi().setPacingDetailsAsync(persistedSteps, dateString, setPacingDetailsAsyncCallback)
swiftApi().setPacingDetailsAsync(persistedSteps, dateString, setPacingDetailsAsyncCallback, failureCallback: {errorCode in })
}
func setPacingDetailsAsyncCallback (_ responseData: swiftApi.GenericResponseModel?) -> Void {
......@@ -161,12 +161,12 @@ var timer2: DispatchSourceTimer?
} else if (eventArray[1] == "addUserTag") {
// SwiftEventBus.post("questionnaire", sender: questionnaireEvent)
swiftApi().getProfileAsync(getProfileCallback)
swiftApi().getProfileAsync(getProfileCallback, failureCallback: {errorCode in })
func getProfileCallback (_ profileData: swiftApi.ProfileModel?) -> Void {
if (profileData != nil) {
DispatchQueue.main.async {
swiftApi().getCampaignsAsyncNew(language: "en", filters: [String : Any](), getCampaignsCallback)
swiftApi().getCampaignsAsyncNew(language: "en", filters: [String : Any](), getCampaignsCallback, failureCallback: {errorCode in })
func getCampaignsCallback (_ campaignsData: Array<swiftApi.CampaignItemModel>?) -> Void {
if (campaignsData != nil) {
......@@ -197,8 +197,8 @@ var timer2: DispatchSourceTimer?
let couponEvent = swiftApi.CouponEventModel()
SwiftEventBus.post("coupon_retrieved", sender: couponEvent)
swiftApi().getCouponsAsync(getCouponsCallback)
swiftApi().getCampaignsAsyncNew(language: "en", filters: [String : Any](), getCampaignsCallback)
swiftApi().getCouponsAsync(getCouponsCallback, failureCallback: {errorCode in })
swiftApi().getCampaignsAsyncNew(language: "en", filters: [String : Any](), getCampaignsCallback, failureCallback: {errorCode in })
func getCouponsCallback (_ couponsData: Array<swiftApi.CouponItemModel>?) -> Void {
if (couponsData != nil) {
......
......@@ -158,7 +158,7 @@ import SwiftEventBus
// MARK: - API CALLS
func getProfileRequest() {
swiftApi().getProfileAsync(getProfileCallback)
swiftApi().getProfileAsync(getProfileCallback, failureCallback: {errorCode in })
}
func getProfileCallback (_ profileData: swiftApi.ProfileModel?) -> Void {
......@@ -173,7 +173,16 @@ import SwiftEventBus
func submitOrderRequest() {
swiftApi().submitOrderAsync(campaign_session_uuid: "", user_msisdn: self.selectedNumber, businessService: (ccms?._businessService ?? ""), offerName: (ccms?._offerName ?? ""), productType: (ccms?._productType ?? ""), provDuration: (ccms?._provDuration ?? ""), noOfRecurrance: (ccms?._noOfRecurrance ?? ""), price: (ccms?._price ?? ""), discount: (ccms?._discount ?? ""), voiceCategory: (ccms?._voiceCategory ?? ""), dataCategory: (ccms?._dataCategory ?? ""), minsValue: (ccms?._minsValue ?? ""), dataValue: (ccms?._dataValue ?? ""), provStepValueMins: (ccms?._provStepValueMins ?? ""),
OfferAudienceLevel: (ccms?._offerAudienceLevel ?? ""), UACIOfferTrackingCode: (ccms?._uaciOfferTrackingCode ?? ""), OFFERCODE1: (ccms?._offerCode1 ?? ""), SCORE: (ccms?._score ?? ""), ZONE: (ccms?._zone ?? ""), WAVE: (ccms?._wave ?? ""), VALIDITY: (ccms?._validity ?? ""), TREATMENT_CODE: (ccms?._treatmentCode ?? ""), ccms_session_id: (ccms?._sessionId ?? ""), notificationMessage: (ccms?._notificationMessage ?? ""),
submitOrderCallback)
submitOrderCallback, failureCallback: {errorCode in
let firebaseEvent = swiftApi.LoyaltySDKFirebaseEventModel()
firebaseEvent._eventName = "loyalty_offer_activated"
firebaseEvent.setParameter = ("name", (self.ccms?._title ?? ""))
firebaseEvent.setParameter = ("type", "gift")
firebaseEvent.setParameter = ("successful", "false")
SwiftEventBus.post("firebase", sender: firebaseEvent)
self.showDialog("Αποτυχία","Κάτι πήγε στραβά")
})
}
func submitOrderCallback (_ response: swiftApi.GenericResponseModel?) -> Void {
......
......@@ -181,10 +181,32 @@ import SwiftEventBus
showSpinner()
if (ccms == nil) {
swiftApi().redeemCouponSetAsync(uuid: uuid, communication_uuid: communication_uuid, redeemCouponSetCallback)
swiftApi().redeemCouponSetAsync(uuid: uuid, communication_uuid: communication_uuid, redeemCouponSetCallback, failureCallback: {errorCode in
self.hideSpinner()
let firebaseEvent = swiftApi.LoyaltySDKFirebaseEventModel()
firebaseEvent._eventName = "loyalty_offer_activated"
firebaseEvent.setParameter = ("name", (self.couponset?.name ?? ""))
firebaseEvent.setParameter = ("type", "coupon")
firebaseEvent.setParameter = ("successful", "false")
SwiftEventBus.post("firebase", sender: firebaseEvent)
self.showDialog("Αποτυχία","Κάτι πήγε στραβά")
})
} else {
// TODO: MAybe change user_msisdn: profile?._msisdn ?? ""
swiftApi().redeemCouponSetAsync(uuid: uuid, communication_uuid: communication_uuid, user_msisdn: profile?._msisdn ?? "", businessService: (ccms?._businessService ?? ""), offerName: (ccms?._offerName ?? ""), productType: (ccms?._productType ?? ""), provDuration: (ccms?._provDuration ?? ""), noOfRecurrance: (ccms?._noOfRecurrance ?? ""), price: (ccms?._price ?? ""), discount: (ccms?._discount ?? ""), voiceCategory: (ccms?._voiceCategory ?? ""), dataCategory: (ccms?._dataCategory ?? ""), minsValue: (ccms?._minsValue ?? ""), dataValue: (ccms?._dataValue ?? ""), provStepValueMins: (ccms?._provStepValueMins ?? ""), OfferAudienceLevel: (ccms?._offerAudienceLevel ?? ""), UACIOfferTrackingCode: (ccms?._uaciOfferTrackingCode ?? ""), OFFERCODE1: (ccms?._offerCode1 ?? ""), SCORE: (ccms?._score ?? ""), ZONE: (ccms?._zone ?? ""), WAVE: (ccms?._wave ?? ""), VALIDITY: (ccms?._validity ?? ""), TREATMENT_CODE: (ccms?._treatmentCode ?? ""), ccms_session_id: (ccms?._sessionId ?? ""), redeemCouponSetCallback)
swiftApi().redeemCouponSetAsync(uuid: uuid, communication_uuid: communication_uuid, user_msisdn: profile?._msisdn ?? "", businessService: (ccms?._businessService ?? ""), offerName: (ccms?._offerName ?? ""), productType: (ccms?._productType ?? ""), provDuration: (ccms?._provDuration ?? ""), noOfRecurrance: (ccms?._noOfRecurrance ?? ""), price: (ccms?._price ?? ""), discount: (ccms?._discount ?? ""), voiceCategory: (ccms?._voiceCategory ?? ""), dataCategory: (ccms?._dataCategory ?? ""), minsValue: (ccms?._minsValue ?? ""), dataValue: (ccms?._dataValue ?? ""), provStepValueMins: (ccms?._provStepValueMins ?? ""), OfferAudienceLevel: (ccms?._offerAudienceLevel ?? ""), UACIOfferTrackingCode: (ccms?._uaciOfferTrackingCode ?? ""), OFFERCODE1: (ccms?._offerCode1 ?? ""), SCORE: (ccms?._score ?? ""), ZONE: (ccms?._zone ?? ""), WAVE: (ccms?._wave ?? ""), VALIDITY: (ccms?._validity ?? ""), TREATMENT_CODE: (ccms?._treatmentCode ?? ""), ccms_session_id: (ccms?._sessionId ?? ""), redeemCouponSetCallback, failureCallback: {errorCode in
self.hideSpinner()
let firebaseEvent = swiftApi.LoyaltySDKFirebaseEventModel()
firebaseEvent._eventName = "loyalty_offer_activated"
firebaseEvent.setParameter = ("name", (self.couponset?.name ?? ""))
firebaseEvent.setParameter = ("type", "coupon")
firebaseEvent.setParameter = ("successful", "false")
SwiftEventBus.post("firebase", sender: firebaseEvent)
self.showDialog("Αποτυχία","Κάτι πήγε στραβά")
})
}
}
......@@ -209,8 +231,8 @@ import SwiftEventBus
self.showSuccessDialog("Επιτυχής ενεργοποίηση","Το κουπόνι σου έχει ενεργοποιηθεί στην ενότητα My Rewards.")
swiftApi().getCouponsAsync(getCouponsCallback)
swiftApi().getCampaignsAsyncNew(language: "en", filters: [String : Any](), getCampaignsCallback)
swiftApi().getCouponsAsync(getCouponsCallback, failureCallback: {errorCode in })
swiftApi().getCampaignsAsyncNew(language: "en", filters: [String : Any](), getCampaignsCallback, failureCallback: {errorCode in })
func getCouponsCallback (_ couponsData: Array<swiftApi.CouponItemModel>?) -> Void {
if (couponsData != nil) {
......
......@@ -49,7 +49,9 @@ import SwiftEventBus
// MARK: - API Functions
func getCouponsRequest() {
swiftApi().getCouponsAsync(getCouponsCallback)
swiftApi().getCouponsAsync(getCouponsCallback, failureCallback: {errorCode in
self.coupons = []
})
}
func getCouponsCallback (_ couponsData: Array<swiftApi.CouponItemModel>?) -> Void {
......
......@@ -254,7 +254,9 @@ import SwiftEventBus
// MARK: - API Calls
func getProfileRequest() {
swiftApi().getProfileAsync(getProfileCallback)
swiftApi().getProfileAsync(getProfileCallback, failureCallback: {errorCode in
print("========= getProfileRequest ERROR =========")
})
}
func getProfileCallback (_ profileData: swiftApi.ProfileModel?) -> Void {
......@@ -270,7 +272,9 @@ import SwiftEventBus
}
func cosmoteCouponSharingRequest() {
swiftApi().cosmoteCouponSharingAsync(coupon: coupon?.coupon ?? "", sender: selectedNumber, receiver: numberTextField.text ?? "", couponSharingCallback)
swiftApi().cosmoteCouponSharingAsync(coupon: coupon?.coupon ?? "", sender: selectedNumber, receiver: numberTextField.text ?? "", couponSharingCallback, failureCallback: {errorCode in
self.showDialog("Αποτυχία","Κάτι πήγε στραβά")
})
}
func couponSharingCallback (_ response: swiftApi.GenericResponseModel?) -> Void {
......@@ -278,7 +282,7 @@ import SwiftEventBus
DispatchQueue.main.async {
if (response?.getStatus == 1) {
swiftApi().getCouponsAsync(getCouponsCallback)
swiftApi().getCouponsAsync(getCouponsCallback, failureCallback: {errorCode in })
func getCouponsCallback (_ couponsData: Array<swiftApi.CouponItemModel>?) -> Void {
if (couponsData != nil) {
......
......@@ -40,7 +40,7 @@ class SharingHistoryViewController: AnalysisChildViewController {
showLoading()
swiftApi().getSharingHistoryAsync(responseCallback)
swiftApi().getSharingHistoryAsync(responseCallback, failureCallback: {errorCode in })
}
private func showLoading() {
......
......@@ -212,7 +212,7 @@ import SwiftEventBus
// MARK: - API CALLS
func getProfileRequest() {
swiftApi().getProfileAsync(getProfileCallback)
swiftApi().getProfileAsync(getProfileCallback, failureCallback: {errorCode in })
}
func getProfileCallback (_ profileData: swiftApi.ProfileModel?) -> Void {
......@@ -227,7 +227,16 @@ import SwiftEventBus
func submitOrderRequest() {
swiftApi().submitOrderAsync(campaign_session_uuid: (campaign?.session_uuid ?? ""), user_msisdn: self.selectedNumber, businessService: (ccms?._businessService ?? ""), offerName: (ccms?._offerName ?? ""), productType: (ccms?._productType ?? ""), provDuration: (ccms?._provDuration ?? ""), noOfRecurrance: (ccms?._noOfRecurrance ?? ""), price: (ccms?._price ?? ""), discount: (ccms?._discount ?? ""), voiceCategory: (ccms?._voiceCategory ?? ""), dataCategory: (ccms?._dataCategory ?? ""), minsValue: (ccms?._minsValue ?? ""), dataValue: (ccms?._dataValue ?? ""), provStepValueMins: (ccms?._provStepValueMins ?? ""),
OfferAudienceLevel: (ccms?._offerAudienceLevel ?? ""), UACIOfferTrackingCode: (ccms?._uaciOfferTrackingCode ?? ""), OFFERCODE1: (ccms?._offerCode1 ?? ""), SCORE: (ccms?._score ?? ""), ZONE: (ccms?._zone ?? ""), WAVE: (ccms?._wave ?? ""), VALIDITY: (ccms?._validity ?? ""), TREATMENT_CODE: (ccms?._treatmentCode ?? ""), ccms_session_id: (ccms?._sessionId ?? ""), notificationMessage: (ccms?._notificationMessage ?? ""),
submitOrderCallback)
submitOrderCallback, failureCallback: {errorCode in
let firebaseEvent = swiftApi.LoyaltySDKFirebaseEventModel()
firebaseEvent._eventName = "loyalty_offer_activated"
firebaseEvent.setParameter = ("name", (self.ccms?._title ?? ""))
firebaseEvent.setParameter = ("type", "gift")
firebaseEvent.setParameter = ("successful", "false")
SwiftEventBus.post("firebase", sender: firebaseEvent)
self.showDialog("Αποτυχία","Κάτι πήγε στραβά")
})
}
func submitOrderCallback (_ response: swiftApi.GenericResponseModel?) -> Void {
......
......@@ -672,25 +672,33 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION)
dict = [error userInfo];
NSString* errorCode = [dict objectForKey:@"NSLocalizedDescription"];
if ([errorCode isEqual:@"Request failed: unauthorized (401)"]) {
[self refreshToken:^(NSDictionary *response) {
[self sendContext8:jsonData successBlock:^(NSDictionary *contextResponse) {
if (success) {
success(contextResponse);
}
NSLog(@"**************** WARPLY Response *****************" );
NSLog(@"%@", contextResponse );
} failureBlock:^(NSError *error) {
if (failure) {
failure(error);
}
}];
} failureBlock:^(NSError *error) {
if (failure) {
// [_db executeUpdate:@"DROP TABLE requestVariables"];
failure(error);
}
NSLog(@"Error at token %@", error );
}];
NSString* errorDomain = [error domain];
NSError *errorToken = [NSError errorWithDomain:errorDomain code:401 userInfo:dict];
if (failure) {
failure(errorToken);
}
// [self refreshToken:^(NSDictionary *response) {
// [self sendContext8:jsonData successBlock:^(NSDictionary *contextResponse) {
// if (success) {
// success(contextResponse);
// }
// NSLog(@"**************** WARPLY Response *****************" );
// NSLog(@"%@", contextResponse );
// } failureBlock:^(NSError *error) {
// if (failure) {
// failure(error);
// }
// }];
// } failureBlock:^(NSError *error) {
// if (failure) {
// // [_db executeUpdate:@"DROP TABLE requestVariables"];
// failure(error);
// }
// NSLog(@"Error at token %@", error );
// }];
} else {
NSLog(@"Error at get Campaigns Personalized %@", error );
failure(error);
......@@ -1685,23 +1693,31 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION)
dict = [error userInfo];
NSString* errorCode = [dict objectForKey:@"NSLocalizedDescription"];
if ([errorCode isEqual:@"Request failed: unauthorized (401)"]) {
[self refreshToken:^(NSDictionary *response) {
[self sendContext8:jsonData successBlock:^(NSDictionary *contextResponse) {
if (success) {
success(contextResponse);
}
} failureBlock:^(NSError *error) {
if (failure) {
failure(error);
}
}];
} failureBlock:^(NSError *error) {
if (failure) {
// [_db executeUpdate:@"DROP TABLE requestVariables"];
failure(error);
}
NSLog(@"Error at token %@", error );
}];
NSString* errorDomain = [error domain];
NSError *errorToken = [NSError errorWithDomain:errorDomain code:401 userInfo:dict];
if (failure) {
failure(errorToken);
}
// [self refreshToken:^(NSDictionary *response) {
// [self sendContext8:jsonData successBlock:^(NSDictionary *contextResponse) {
// if (success) {
// success(contextResponse);
// }
// } failureBlock:^(NSError *error) {
// if (failure) {
// failure(error);
// }
// }];
// } failureBlock:^(NSError *error) {
// if (failure) {
// // [_db executeUpdate:@"DROP TABLE requestVariables"];
// failure(error);
// }
// NSLog(@"Error at token %@", error );
// }];
} else {
NSLog(@"Error at change password %@", error );
failure(error);
......@@ -1727,26 +1743,50 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION)
dict = [error userInfo];
NSString* errorCode = [dict objectForKey:@"NSLocalizedDescription"];
if ([errorCode isEqual:@"Request failed: unauthorized (401)"]) {
[self refreshToken:^(NSDictionary *response) {
[self sendContext8:jsonData successBlock:^(NSDictionary *contextResponse) {
if (success) {
success(contextResponse);
}
NSLog(@"**************** WARPLY Response *****************" );
NSLog(@"%@", contextResponse );
} failureBlock:^(NSError *error) {
if (failure) {
failure(error);
}
}];
} failureBlock:^(NSError *error) {
if (failure) {
// [_db executeUpdate:@"DROP TABLE requestVariables"];
failure(error);
}
NSLog(@"Error at token %@", error );
}];
// NSLog(@"=== error Dictionary: %@", dict );
// NSLog(@"=== errorCode: %@", errorCode );
//
// NSInteger errorCodeInt = [error code];
// NSLog(@"=== errorCodeInt: %ld", (long)errorCodeInt );
//
//
// NSString* errorUnderlyingError = [dict objectForKey:@"NSUnderlyingError"];
// NSLog(@"=== errorUnderlyingError: %@", errorUnderlyingError );
//
// NSString* errorUserInfo = [dict objectForKey:@"UserInfo"];
// NSLog(@"=== errorUserInfo: %@", errorUserInfo );
// NSString* errorCode = [dict objectForKey:@"UserInfo"];
// NSError *errorToken = [NSError errorWithDomain:WARP_ERROR_DOMAIN code:401 userInfo:@{NSLocalizedDescriptionKey: NSLocalizedString(@"Empty response", @"Warply")}];
NSString* errorDomain = [error domain];
NSError *errorToken = [NSError errorWithDomain:errorDomain code:401 userInfo:dict];
if (failure) {
failure(errorToken);
}
// [self refreshToken:^(NSDictionary *response) {
// [self sendContext8:jsonData successBlock:^(NSDictionary *contextResponse) {
// if (success) {
// success(contextResponse);
// }
// NSLog(@"**************** WARPLY Response *****************" );
// NSLog(@"%@", contextResponse );
// } failureBlock:^(NSError *error) {
//
// if (failure) {
// failure(error);
// }
// }];
// } failureBlock:^(NSError *error) {
// if (failure) {
// // [_db executeUpdate:@"DROP TABLE requestVariables"];
// failure(error);
// }
// NSLog(@"Error at token %@", error );
// }];
} else {
NSLog(@"Error at get profile %@", error );
failure(error);
......@@ -1791,25 +1831,33 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION)
dict = [error userInfo];
NSString* errorCode = [dict objectForKey:@"NSLocalizedDescription"];
if ([errorCode isEqual:@"Request failed: unauthorized (401)"]) {
[self refreshToken:^(NSDictionary *response) {
[self sendContext8:jsonData successBlock:^(NSDictionary *contextResponse) {
if (success) {
success(contextResponse);
}
NSLog(@"**************** WARPLY Response *****************" );
NSLog(@"%@", contextResponse );
} failureBlock:^(NSError *error) {
if (failure) {
failure(error);
}
}];
} failureBlock:^(NSError *error) {
if (failure) {
// [_db executeUpdate:@"DROP TABLE requestVariables"];
failure(error);
}
NSLog(@"Error at token %@", error );
}];
NSString* errorDomain = [error domain];
NSError *errorToken = [NSError errorWithDomain:errorDomain code:401 userInfo:dict];
if (failure) {
failure(errorToken);
}
// [self refreshToken:^(NSDictionary *response) {
// [self sendContext8:jsonData successBlock:^(NSDictionary *contextResponse) {
// if (success) {
// success(contextResponse);
// }
// NSLog(@"**************** WARPLY Response *****************" );
// NSLog(@"%@", contextResponse );
// } failureBlock:^(NSError *error) {
// if (failure) {
// failure(error);
// }
// }];
// } failureBlock:^(NSError *error) {
// if (failure) {
// // [_db executeUpdate:@"DROP TABLE requestVariables"];
// failure(error);
// }
// NSLog(@"Error at token %@", error );
// }];
} else {
NSLog(@"Error at post Event %@", error );
failure(error);
......@@ -1899,25 +1947,33 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION)
dict = [error userInfo];
NSString* errorCode = [dict objectForKey:@"NSLocalizedDescription"];
if ([errorCode isEqual:@"Request failed: unauthorized (401)"]) {
[self refreshToken:^(NSDictionary *response) {
[self sendContext8:jsonData successBlock:^(NSDictionary *contextResponse) {
if (success) {
success(contextResponse);
}
NSLog(@"**************** WARPLY Response *****************" );
NSLog(@"%@", contextResponse );
} failureBlock:^(NSError *error) {
if (failure) {
failure(error);
}
}];
} failureBlock:^(NSError *error) {
if (failure) {
// [_db executeUpdate:@"DROP TABLE requestVariables"];
failure(error);
}
NSLog(@"Error at token %@", error );
}];
NSString* errorDomain = [error domain];
NSError *errorToken = [NSError errorWithDomain:errorDomain code:401 userInfo:dict];
if (failure) {
failure(errorToken);
}
// [self refreshToken:^(NSDictionary *response) {
// [self sendContext8:jsonData successBlock:^(NSDictionary *contextResponse) {
// if (success) {
// success(contextResponse);
// }
// NSLog(@"**************** WARPLY Response *****************" );
// NSLog(@"%@", contextResponse );
// } failureBlock:^(NSError *error) {
// if (failure) {
// failure(error);
// }
// }];
// } failureBlock:^(NSError *error) {
// if (failure) {
// // [_db executeUpdate:@"DROP TABLE requestVariables"];
// failure(error);
// }
// NSLog(@"Error at token %@", error );
// }];
} else {
NSLog(@"Error at edit profile %@", error );
failure(error);
......@@ -1942,25 +1998,33 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION)
dict = [error userInfo];
NSString* errorCode = [dict objectForKey:@"NSLocalizedDescription"];
if ([errorCode isEqual:@"Request failed: unauthorized (401)"]) {
[self refreshToken:^(NSDictionary *response) {
[self sendContext8:jsonData successBlock:^(NSDictionary *contextResponse) {
if (success) {
success(contextResponse);
}
NSLog(@"**************** WARPLY Response *****************" );
NSLog(@"%@", contextResponse );
} failureBlock:^(NSError *error) {
if (failure) {
failure(error);
}
}];
} failureBlock:^(NSError *error) {
if (failure) {
// [_db executeUpdate:@"DROP TABLE requestVariables"];
failure(error);
}
NSLog(@"Error at token %@", error );
}];
NSString* errorDomain = [error domain];
NSError *errorToken = [NSError errorWithDomain:errorDomain code:401 userInfo:dict];
if (failure) {
failure(errorToken);
}
// [self refreshToken:^(NSDictionary *response) {
// [self sendContext8:jsonData successBlock:^(NSDictionary *contextResponse) {
// if (success) {
// success(contextResponse);
// }
// NSLog(@"**************** WARPLY Response *****************" );
// NSLog(@"%@", contextResponse );
// } failureBlock:^(NSError *error) {
// if (failure) {
// failure(error);
// }
// }];
// } failureBlock:^(NSError *error) {
// if (failure) {
// // [_db executeUpdate:@"DROP TABLE requestVariables"];
// failure(error);
// }
// NSLog(@"Error at token %@", error );
// }];
} else {
NSLog(@"Error at get pacing details %@", error );
failure(error);
......@@ -1985,25 +2049,33 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION)
dict = [error userInfo];
NSString* errorCode = [dict objectForKey:@"NSLocalizedDescription"];
if ([errorCode isEqual:@"Request failed: unauthorized (401)"]) {
[self refreshToken:^(NSDictionary *response) {
[self sendContext8:jsonData successBlock:^(NSDictionary *contextResponse) {
if (success) {
success(contextResponse);
}
NSLog(@"**************** WARPLY Response *****************" );
NSLog(@"%@", contextResponse );
} failureBlock:^(NSError *error) {
if (failure) {
failure(error);
}
}];
} failureBlock:^(NSError *error) {
if (failure) {
// [_db executeUpdate:@"DROP TABLE requestVariables"];
failure(error);
}
NSLog(@"Error at token %@", error );
}];
NSString* errorDomain = [error domain];
NSError *errorToken = [NSError errorWithDomain:errorDomain code:401 userInfo:dict];
if (failure) {
failure(errorToken);
}
// [self refreshToken:^(NSDictionary *response) {
// [self sendContext8:jsonData successBlock:^(NSDictionary *contextResponse) {
// if (success) {
// success(contextResponse);
// }
// NSLog(@"**************** WARPLY Response *****************" );
// NSLog(@"%@", contextResponse );
// } failureBlock:^(NSError *error) {
// if (failure) {
// failure(error);
// }
// }];
// } failureBlock:^(NSError *error) {
// if (failure) {
// // [_db executeUpdate:@"DROP TABLE requestVariables"];
// failure(error);
// }
// NSLog(@"Error at token %@", error );
// }];
} else {
NSLog(@"Error at set pacing details %@", error );
failure(error);
......@@ -2065,25 +2137,33 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION)
dict = [error userInfo];
NSString* errorCode = [dict objectForKey:@"NSLocalizedDescription"];
if ([errorCode isEqual:@"Request failed: unauthorized (401)"]) {
[self refreshToken:^(NSDictionary *response) {
[self sendContext8:jsonData successBlock:^(NSDictionary *contextResponse) {
if (success) {
success(contextResponse);
}
NSLog(@"**************** WARPLY Response *****************" );
NSLog(@"%@", contextResponse );
} failureBlock:^(NSError *error) {
if (failure) {
failure(error);
}
}];
} failureBlock:^(NSError *error) {
if (failure) {
// [_db executeUpdate:@"DROP TABLE requestVariables"];
failure(error);
}
NSLog(@"Error at token %@", error );
}];
NSString* errorDomain = [error domain];
NSError *errorToken = [NSError errorWithDomain:errorDomain code:401 userInfo:dict];
if (failure) {
failure(errorToken);
}
// [self refreshToken:^(NSDictionary *response) {
// [self sendContext8:jsonData successBlock:^(NSDictionary *contextResponse) {
// if (success) {
// success(contextResponse);
// }
// NSLog(@"**************** WARPLY Response *****************" );
// NSLog(@"%@", contextResponse );
// } failureBlock:^(NSError *error) {
// if (failure) {
// failure(error);
// }
// }];
// } failureBlock:^(NSError *error) {
// if (failure) {
// // [_db executeUpdate:@"DROP TABLE requestVariables"];
// failure(error);
// }
// NSLog(@"Error at token %@", error );
// }];
} else {
NSLog(@"Error at consumer Integration %@", error );
failure(error);
......@@ -2106,23 +2186,31 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION)
dict = [error userInfo];
NSString* errorCode = [dict objectForKey:@"NSLocalizedDescription"];
if ([errorCode isEqual:@"Request failed: unauthorized (401)"]) {
[self refreshToken:^(NSDictionary *response) {
[self sendContext8:jsonData successBlock:^(NSDictionary *contextResponse) {
if (success) {
success(contextResponse);
}
} failureBlock:^(NSError *error) {
if (failure) {
failure(error);
}
}];
} failureBlock:^(NSError *error) {
if (failure) {
// [_db executeUpdate:@"DROP TABLE requestVariables"];
failure(error);
}
NSLog(@"Error at token %@", error );
}];
NSString* errorDomain = [error domain];
NSError *errorToken = [NSError errorWithDomain:errorDomain code:401 userInfo:dict];
if (failure) {
failure(errorToken);
}
// [self refreshToken:^(NSDictionary *response) {
// [self sendContext8:jsonData successBlock:^(NSDictionary *contextResponse) {
// if (success) {
// success(contextResponse);
// }
// } failureBlock:^(NSError *error) {
// if (failure) {
// failure(error);
// }
// }];
// } failureBlock:^(NSError *error) {
// if (failure) {
// // [_db executeUpdate:@"DROP TABLE requestVariables"];
// failure(error);
// }
// NSLog(@"Error at token %@", error );
// }];
} else {
NSLog(@"Error at change profile image %@", error );
failure(error);
......@@ -2145,23 +2233,31 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION)
dict = [error userInfo];
NSString* errorCode = [dict objectForKey:@"NSLocalizedDescription"];
if ([errorCode isEqual:@"Request failed: unauthorized (401)"]) {
[self refreshToken:^(NSDictionary *response) {
[self sendContext8:jsonData successBlock:^(NSDictionary *contextResponse) {
if (success) {
success(contextResponse);
}
} failureBlock:^(NSError *error) {
if (failure) {
failure(error);
}
}];
} failureBlock:^(NSError *error) {
if (failure) {
// [_db executeUpdate:@"DROP TABLE requestVariables"];
failure(error);
}
NSLog(@"Error at token %@", error );
}];
NSString* errorDomain = [error domain];
NSError *errorToken = [NSError errorWithDomain:errorDomain code:401 userInfo:dict];
if (failure) {
failure(errorToken);
}
// [self refreshToken:^(NSDictionary *response) {
// [self sendContext8:jsonData successBlock:^(NSDictionary *contextResponse) {
// if (success) {
// success(contextResponse);
// }
// } failureBlock:^(NSError *error) {
// if (failure) {
// failure(error);
// }
// }];
// } failureBlock:^(NSError *error) {
// if (failure) {
// // [_db executeUpdate:@"DROP TABLE requestVariables"];
// failure(error);
// }
// NSLog(@"Error at token %@", error );
// }];
} else {
NSLog(@"Error at add card %@", error );
failure(error);
......@@ -2184,23 +2280,31 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION)
dict = [error userInfo];
NSString* errorCode = [dict objectForKey:@"NSLocalizedDescription"];
if ([errorCode isEqual:@"Request failed: unauthorized (401)"]) {
[self refreshToken:^(NSDictionary *response) {
[self sendContext8:jsonData successBlock:^(NSDictionary *contextResponse) {
if (success) {
success(contextResponse);
}
} failureBlock:^(NSError *error) {
if (failure) {
failure(error);
}
}];
} failureBlock:^(NSError *error) {
if (failure) {
// [_db executeUpdate:@"DROP TABLE requestVariables"];
failure(error);
}
NSLog(@"Error at token %@", error );
}];
NSString* errorDomain = [error domain];
NSError *errorToken = [NSError errorWithDomain:errorDomain code:401 userInfo:dict];
if (failure) {
failure(errorToken);
}
// [self refreshToken:^(NSDictionary *response) {
// [self sendContext8:jsonData successBlock:^(NSDictionary *contextResponse) {
// if (success) {
// success(contextResponse);
// }
// } failureBlock:^(NSError *error) {
// if (failure) {
// failure(error);
// }
// }];
// } failureBlock:^(NSError *error) {
// if (failure) {
// // [_db executeUpdate:@"DROP TABLE requestVariables"];
// failure(error);
// }
// NSLog(@"Error at token %@", error );
// }];
} else {
NSLog(@"Error at get cards %@", error );
failure(error);
......@@ -2223,23 +2327,31 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION)
dict = [error userInfo];
NSString* errorCode = [dict objectForKey:@"NSLocalizedDescription"];
if ([errorCode isEqual:@"Request failed: unauthorized (401)"]) {
[self refreshToken:^(NSDictionary *response) {
[self sendContext8:jsonData successBlock:^(NSDictionary *contextResponse) {
if (success) {
success(contextResponse);
}
} failureBlock:^(NSError *error) {
if (failure) {
failure(error);
}
}];
} failureBlock:^(NSError *error) {
if (failure) {
// [_db executeUpdate:@"DROP TABLE requestVariables"];
failure(error);
}
NSLog(@"Error at token %@", error );
}];
NSString* errorDomain = [error domain];
NSError *errorToken = [NSError errorWithDomain:errorDomain code:401 userInfo:dict];
if (failure) {
failure(errorToken);
}
// [self refreshToken:^(NSDictionary *response) {
// [self sendContext8:jsonData successBlock:^(NSDictionary *contextResponse) {
// if (success) {
// success(contextResponse);
// }
// } failureBlock:^(NSError *error) {
// if (failure) {
// failure(error);
// }
// }];
// } failureBlock:^(NSError *error) {
// if (failure) {
// // [_db executeUpdate:@"DROP TABLE requestVariables"];
// failure(error);
// }
// NSLog(@"Error at token %@", error );
// }];
} else {
NSLog(@"Error at get delete card %@", error );
failure(error);
......@@ -2366,25 +2478,33 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION)
dict = [error userInfo];
NSString* errorCode = [dict objectForKey:@"NSLocalizedDescription"];
if ([errorCode isEqual:@"Request failed: unauthorized (401)"]) {
[self refreshToken:^(NSDictionary *response) {
[self sendContext8:jsonData successBlock:^(NSDictionary *contextResponse) {
if (success) {
success(contextResponse);
}
NSLog(@"**************** WARPLY Response *****************" );
NSLog(@"%@", contextResponse );
} failureBlock:^(NSError *error) {
if (failure) {
failure(error);
}
}];
} failureBlock:^(NSError *error) {
if (failure) {
// [_db executeUpdate:@"DROP TABLE requestVariables"];
failure(error);
}
NSLog(@"Error at token %@", error );
}];
NSString* errorDomain = [error domain];
NSError *errorToken = [NSError errorWithDomain:errorDomain code:401 userInfo:dict];
if (failure) {
failure(errorToken);
}
// [self refreshToken:^(NSDictionary *response) {
// [self sendContext8:jsonData successBlock:^(NSDictionary *contextResponse) {
// if (success) {
// success(contextResponse);
// }
// NSLog(@"**************** WARPLY Response *****************" );
// NSLog(@"%@", contextResponse );
// } failureBlock:^(NSError *error) {
// if (failure) {
// failure(error);
// }
// }];
// } failureBlock:^(NSError *error) {
// if (failure) {
// // [_db executeUpdate:@"DROP TABLE requestVariables"];
// failure(error);
// }
// NSLog(@"Error at token %@", error );
// }];
} else {
NSLog(@"Error at get coupons %@", error );
failure(error);
......@@ -2407,23 +2527,31 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION)
dict = [error userInfo];
NSString* errorCode = [dict objectForKey:@"NSLocalizedDescription"];
if ([errorCode isEqual:@"Request failed: unauthorized (401)"]) {
[self refreshToken:^(NSDictionary *response) {
[self sendContext8:jsonData successBlock:^(NSDictionary *contextResponse) {
if (success) {
success(contextResponse);
}
} failureBlock:^(NSError *error) {
if (failure) {
failure(error);
}
}];
} failureBlock:^(NSError *error) {
if (failure) {
// [_db executeUpdate:@"DROP TABLE requestVariables"];
failure(error);
}
NSLog(@"Error at token %@", error );
}];
NSString* errorDomain = [error domain];
NSError *errorToken = [NSError errorWithDomain:errorDomain code:401 userInfo:dict];
if (failure) {
failure(errorToken);
}
// [self refreshToken:^(NSDictionary *response) {
// [self sendContext8:jsonData successBlock:^(NSDictionary *contextResponse) {
// if (success) {
// success(contextResponse);
// }
// } failureBlock:^(NSError *error) {
// if (failure) {
// failure(error);
// }
// }];
// } failureBlock:^(NSError *error) {
// if (failure) {
// // [_db executeUpdate:@"DROP TABLE requestVariables"];
// failure(error);
// }
// NSLog(@"Error at token %@", error );
// }];
} else {
NSLog(@"Error at get transaction history %@", error );
failure(error);
......@@ -2446,23 +2574,31 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION)
dict = [error userInfo];
NSString* errorCode = [dict objectForKey:@"NSLocalizedDescription"];
if ([errorCode isEqual:@"Request failed: unauthorized (401)"]) {
[self refreshToken:^(NSDictionary *response) {
[self sendContext8:jsonData successBlock:^(NSDictionary *contextResponse) {
if (success) {
success(contextResponse);
}
} failureBlock:^(NSError *error) {
if (failure) {
failure(error);
}
}];
} failureBlock:^(NSError *error) {
if (failure) {
// [_db executeUpdate:@"DROP TABLE requestVariables"];
failure(error);
}
NSLog(@"Error at token %@", error );
}];
NSString* errorDomain = [error domain];
NSError *errorToken = [NSError errorWithDomain:errorDomain code:401 userInfo:dict];
if (failure) {
failure(errorToken);
}
// [self refreshToken:^(NSDictionary *response) {
// [self sendContext8:jsonData successBlock:^(NSDictionary *contextResponse) {
// if (success) {
// success(contextResponse);
// }
// } failureBlock:^(NSError *error) {
// if (failure) {
// failure(error);
// }
// }];
// } failureBlock:^(NSError *error) {
// if (failure) {
// // [_db executeUpdate:@"DROP TABLE requestVariables"];
// failure(error);
// }
// NSLog(@"Error at token %@", error );
// }];
} else {
NSLog(@"Error at get points history %@", error );
failure(error);
......@@ -2487,25 +2623,33 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION)
dict = [error userInfo];
NSString* errorCode = [dict objectForKey:@"NSLocalizedDescription"];
if ([errorCode isEqual:@"Request failed: unauthorized (401)"]) {
[self refreshToken:^(NSDictionary *response) {
[self sendContext8:jsonData successBlock:^(NSDictionary *contextResponse) {
if (success) {
success(contextResponse);
}
NSLog(@"**************** WARPLY Response *****************" );
NSLog(@"%@", contextResponse );
} failureBlock:^(NSError *error) {
if (failure) {
failure(error);
}
}];
} failureBlock:^(NSError *error) {
if (failure) {
// [_db executeUpdate:@"DROP TABLE requestVariables"];
failure(error);
}
NSLog(@"Error at token %@", error );
}];
NSString* errorDomain = [error domain];
NSError *errorToken = [NSError errorWithDomain:errorDomain code:401 userInfo:dict];
if (failure) {
failure(errorToken);
}
// [self refreshToken:^(NSDictionary *response) {
// [self sendContext8:jsonData successBlock:^(NSDictionary *contextResponse) {
// if (success) {
// success(contextResponse);
// }
// NSLog(@"**************** WARPLY Response *****************" );
// NSLog(@"%@", contextResponse );
// } failureBlock:^(NSError *error) {
// if (failure) {
// failure(error);
// }
// }];
// } failureBlock:^(NSError *error) {
// if (failure) {
// // [_db executeUpdate:@"DROP TABLE requestVariables"];
// failure(error);
// }
// NSLog(@"Error at token %@", error );
// }];
} else {
NSLog(@"Error at get Sharing History %@", error );
failure(error);
......@@ -2528,23 +2672,31 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION)
dict = [error userInfo];
NSString* errorCode = [dict objectForKey:@"NSLocalizedDescription"];
if ([errorCode isEqual:@"Request failed: unauthorized (401)"]) {
[self refreshToken:^(NSDictionary *response) {
[self sendContext8:jsonData successBlock:^(NSDictionary *contextResponse) {
if (success) {
success(contextResponse);
}
} failureBlock:^(NSError *error) {
if (failure) {
failure(error);
}
}];
} failureBlock:^(NSError *error) {
if (failure) {
// [_db executeUpdate:@"DROP TABLE requestVariables"];
failure(error);
}
NSLog(@"Error at token %@", error );
}];
NSString* errorDomain = [error domain];
NSError *errorToken = [NSError errorWithDomain:errorDomain code:401 userInfo:dict];
if (failure) {
failure(errorToken);
}
// [self refreshToken:^(NSDictionary *response) {
// [self sendContext8:jsonData successBlock:^(NSDictionary *contextResponse) {
// if (success) {
// success(contextResponse);
// }
// } failureBlock:^(NSError *error) {
// if (failure) {
// failure(error);
// }
// }];
// } failureBlock:^(NSError *error) {
// if (failure) {
// // [_db executeUpdate:@"DROP TABLE requestVariables"];
// failure(error);
// }
// NSLog(@"Error at token %@", error );
// }];
} else {
NSLog(@"Error at add address %@", error );
failure(error);
......@@ -2567,23 +2719,31 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION)
dict = [error userInfo];
NSString* errorCode = [dict objectForKey:@"NSLocalizedDescription"];
if ([errorCode isEqual:@"Request failed: unauthorized (401)"]) {
[self refreshToken:^(NSDictionary *response) {
[self sendContext8:jsonData successBlock:^(NSDictionary *contextResponse) {
if (success) {
success(contextResponse);
}
} failureBlock:^(NSError *error) {
if (failure) {
failure(error);
}
}];
} failureBlock:^(NSError *error) {
if (failure) {
// [_db executeUpdate:@"DROP TABLE requestVariables"];
failure(error);
}
NSLog(@"Error at token %@", error );
}];
NSString* errorDomain = [error domain];
NSError *errorToken = [NSError errorWithDomain:errorDomain code:401 userInfo:dict];
if (failure) {
failure(errorToken);
}
// [self refreshToken:^(NSDictionary *response) {
// [self sendContext8:jsonData successBlock:^(NSDictionary *contextResponse) {
// if (success) {
// success(contextResponse);
// }
// } failureBlock:^(NSError *error) {
// if (failure) {
// failure(error);
// }
// }];
// } failureBlock:^(NSError *error) {
// if (failure) {
// // [_db executeUpdate:@"DROP TABLE requestVariables"];
// failure(error);
// }
// NSLog(@"Error at token %@", error );
// }];
} else {
NSLog(@"Error at get address %@", error );
failure(error);
......@@ -2651,23 +2811,31 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION)
dict = [error userInfo];
NSString* errorCode = [dict objectForKey:@"NSLocalizedDescription"];
if ([errorCode isEqual:@"Request failed: unauthorized (401)"]) {
[self refreshToken:^(NSDictionary *response) {
[self sendContext8:jsonData successBlock:^(NSDictionary *contextResponse) {
if (success) {
success(contextResponse);
}
} failureBlock:^(NSError *error) {
if (failure) {
failure(error);
}
}];
} failureBlock:^(NSError *error) {
if (failure) {
// [_db executeUpdate:@"DROP TABLE requestVariables"];
failure(error);
}
NSLog(@"Error at token %@", error );
}];
NSString* errorDomain = [error domain];
NSError *errorToken = [NSError errorWithDomain:errorDomain code:401 userInfo:dict];
if (failure) {
failure(errorToken);
}
// [self refreshToken:^(NSDictionary *response) {
// [self sendContext8:jsonData successBlock:^(NSDictionary *contextResponse) {
// if (success) {
// success(contextResponse);
// }
// } failureBlock:^(NSError *error) {
// if (failure) {
// failure(error);
// }
// }];
// } failureBlock:^(NSError *error) {
// if (failure) {
// // [_db executeUpdate:@"DROP TABLE requestVariables"];
// failure(error);
// }
// NSLog(@"Error at token %@", error );
// }];
} else {
NSLog(@"Error at edit address %@", error );
failure(error);
......@@ -2690,23 +2858,31 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION)
dict = [error userInfo];
NSString* errorCode = [dict objectForKey:@"NSLocalizedDescription"];
if ([errorCode isEqual:@"Request failed: unauthorized (401)"]) {
[self refreshToken:^(NSDictionary *response) {
[self sendContext8:jsonData successBlock:^(NSDictionary *contextResponse) {
if (success) {
success(contextResponse);
}
} failureBlock:^(NSError *error) {
if (failure) {
failure(error);
}
}];
} failureBlock:^(NSError *error) {
if (failure) {
// [_db executeUpdate:@"DROP TABLE requestVariables"];
failure(error);
}
NSLog(@"Error at token %@", error );
}];
NSString* errorDomain = [error domain];
NSError *errorToken = [NSError errorWithDomain:errorDomain code:401 userInfo:dict];
if (failure) {
failure(errorToken);
}
// [self refreshToken:^(NSDictionary *response) {
// [self sendContext8:jsonData successBlock:^(NSDictionary *contextResponse) {
// if (success) {
// success(contextResponse);
// }
// } failureBlock:^(NSError *error) {
// if (failure) {
// failure(error);
// }
// }];
// } failureBlock:^(NSError *error) {
// if (failure) {
// // [_db executeUpdate:@"DROP TABLE requestVariables"];
// failure(error);
// }
// NSLog(@"Error at token %@", error );
// }];
} else {
NSLog(@"Error at delete address %@", error );
failure(error);
......@@ -2729,23 +2905,31 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION)
dict = [error userInfo];
NSString* errorCode = [dict objectForKey:@"NSLocalizedDescription"];
if ([errorCode isEqual:@"Request failed: unauthorized (401)"]) {
[self refreshToken:^(NSDictionary *response) {
[self sendContext8:jsonData successBlock:^(NSDictionary *contextResponse) {
if (success) {
success(contextResponse);
}
} failureBlock:^(NSError *error) {
if (failure) {
failure(error);
}
}];
} failureBlock:^(NSError *error) {
if (failure) {
// [_db executeUpdate:@"DROP TABLE requestVariables"];
failure(error);
}
NSLog(@"Error at token %@", error );
}];
NSString* errorDomain = [error domain];
NSError *errorToken = [NSError errorWithDomain:errorDomain code:401 userInfo:dict];
if (failure) {
failure(errorToken);
}
// [self refreshToken:^(NSDictionary *response) {
// [self sendContext8:jsonData successBlock:^(NSDictionary *contextResponse) {
// if (success) {
// success(contextResponse);
// }
// } failureBlock:^(NSError *error) {
// if (failure) {
// failure(error);
// }
// }];
// } failureBlock:^(NSError *error) {
// if (failure) {
// // [_db executeUpdate:@"DROP TABLE requestVariables"];
// failure(error);
// }
// NSLog(@"Error at token %@", error );
// }];
} else {
NSLog(@"Error at redeem coupons %@", error );
failure(error);
......@@ -2989,25 +3173,33 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION)
dict = [error userInfo];
NSString* errorCode = [dict objectForKey:@"NSLocalizedDescription"];
if ([errorCode isEqual:@"Request failed: unauthorized (401)"]) {
[self refreshToken:^(NSDictionary *response) {
[self sendContext8:jsonData successBlock:^(NSDictionary *contextResponse) {
if (success) {
success(contextResponse);
}
NSLog(@"**************** WARPLY Response *****************" );
NSLog(@"%@", contextResponse );
} failureBlock:^(NSError *error) {
if (failure) {
failure(error);
}
}];
} failureBlock:^(NSError *error) {
if (failure) {
// [_db executeUpdate:@"DROP TABLE requestVariables"];
failure(error);
}
NSLog(@"Error at token %@", error );
}];
NSString* errorDomain = [error domain];
NSError *errorToken = [NSError errorWithDomain:errorDomain code:401 userInfo:dict];
if (failure) {
failure(errorToken);
}
// [self refreshToken:^(NSDictionary *response) {
// [self sendContext8:jsonData successBlock:^(NSDictionary *contextResponse) {
// if (success) {
// success(contextResponse);
// }
// NSLog(@"**************** WARPLY Response *****************" );
// NSLog(@"%@", contextResponse );
// } failureBlock:^(NSError *error) {
// if (failure) {
// failure(error);
// }
// }];
// } failureBlock:^(NSError *error) {
// if (failure) {
// // [_db executeUpdate:@"DROP TABLE requestVariables"];
// failure(error);
// }
// NSLog(@"Error at token %@", error );
// }];
} else {
NSLog(@"Error at redeem coupon sets %@", error );
failure(error);
......@@ -3051,25 +3243,33 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION)
dict = [error userInfo];
NSString* errorCode = [dict objectForKey:@"NSLocalizedDescription"];
if ([errorCode isEqual:@"Request failed: unauthorized (401)"]) {
[self refreshToken:^(NSDictionary *response) {
[self sendContext8:jsonData successBlock:^(NSDictionary *contextResponse) {
if (success) {
success(contextResponse);
}
NSLog(@"**************** WARPLY Response *****************" );
NSLog(@"%@", contextResponse );
} failureBlock:^(NSError *error) {
if (failure) {
failure(error);
}
}];
} failureBlock:^(NSError *error) {
if (failure) {
// [_db executeUpdate:@"DROP TABLE requestVariables"];
failure(error);
}
NSLog(@"Error at token %@", error );
}];
NSString* errorDomain = [error domain];
NSError *errorToken = [NSError errorWithDomain:errorDomain code:401 userInfo:dict];
if (failure) {
failure(errorToken);
}
// [self refreshToken:^(NSDictionary *response) {
// [self sendContext8:jsonData successBlock:^(NSDictionary *contextResponse) {
// if (success) {
// success(contextResponse);
// }
// NSLog(@"**************** WARPLY Response *****************" );
// NSLog(@"%@", contextResponse );
// } failureBlock:^(NSError *error) {
// if (failure) {
// failure(error);
// }
// }];
// } failureBlock:^(NSError *error) {
// if (failure) {
// // [_db executeUpdate:@"DROP TABLE requestVariables"];
// failure(error);
// }
// NSLog(@"Error at token %@", error );
// }];
} else {
NSLog(@"Error at redeem coupon sets %@", error );
failure(error);
......@@ -3094,25 +3294,33 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION)
dict = [error userInfo];
NSString* errorCode = [dict objectForKey:@"NSLocalizedDescription"];
if ([errorCode isEqual:@"Request failed: unauthorized (401)"]) {
[self refreshToken:^(NSDictionary *response) {
[self sendContext8:jsonData successBlock:^(NSDictionary *contextResponse) {
if (success) {
success(contextResponse);
}
NSLog(@"**************** WARPLY Response *****************" );
NSLog(@"%@", contextResponse );
} failureBlock:^(NSError *error) {
if (failure) {
failure(error);
}
}];
} failureBlock:^(NSError *error) {
if (failure) {
// [_db executeUpdate:@"DROP TABLE requestVariables"];
failure(error);
}
NSLog(@"Error at token %@", error );
}];
NSString* errorDomain = [error domain];
NSError *errorToken = [NSError errorWithDomain:errorDomain code:401 userInfo:dict];
if (failure) {
failure(errorToken);
}
// [self refreshToken:^(NSDictionary *response) {
// [self sendContext8:jsonData successBlock:^(NSDictionary *contextResponse) {
// if (success) {
// success(contextResponse);
// }
// NSLog(@"**************** WARPLY Response *****************" );
// NSLog(@"%@", contextResponse );
// } failureBlock:^(NSError *error) {
// if (failure) {
// failure(error);
// }
// }];
// } failureBlock:^(NSError *error) {
// if (failure) {
// // [_db executeUpdate:@"DROP TABLE requestVariables"];
// failure(error);
// }
// NSLog(@"Error at token %@", error );
// }];
} else {
NSLog(@"Error at cosmote Coupon Sharing %@", error );
failure(error);
......@@ -3137,25 +3345,33 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION)
dict = [error userInfo];
NSString* errorCode = [dict objectForKey:@"NSLocalizedDescription"];
if ([errorCode isEqual:@"Request failed: unauthorized (401)"]) {
[self refreshToken:^(NSDictionary *response) {
[self sendContext8:jsonData successBlock:^(NSDictionary *contextResponse) {
if (success) {
success(contextResponse);
}
NSLog(@"**************** WARPLY Response *****************" );
NSLog(@"%@", contextResponse );
} failureBlock:^(NSError *error) {
if (failure) {
failure(error);
}
}];
} failureBlock:^(NSError *error) {
if (failure) {
// [_db executeUpdate:@"DROP TABLE requestVariables"];
failure(error);
}
NSLog(@"Error at token %@", error );
}];
NSString* errorDomain = [error domain];
NSError *errorToken = [NSError errorWithDomain:errorDomain code:401 userInfo:dict];
if (failure) {
failure(errorToken);
}
// [self refreshToken:^(NSDictionary *response) {
// [self sendContext8:jsonData successBlock:^(NSDictionary *contextResponse) {
// if (success) {
// success(contextResponse);
// }
// NSLog(@"**************** WARPLY Response *****************" );
// NSLog(@"%@", contextResponse );
// } failureBlock:^(NSError *error) {
// if (failure) {
// failure(error);
// }
// }];
// } failureBlock:^(NSError *error) {
// if (failure) {
// // [_db executeUpdate:@"DROP TABLE requestVariables"];
// failure(error);
// }
// NSLog(@"Error at token %@", error );
// }];
} else {
NSLog(@"Error at get cosmote sharing %@", error );
failure(error);
......@@ -3180,25 +3396,33 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION)
dict = [error userInfo];
NSString* errorCode = [dict objectForKey:@"NSLocalizedDescription"];
if ([errorCode isEqual:@"Request failed: unauthorized (401)"]) {
[self refreshToken:^(NSDictionary *response) {
[self sendContext8:jsonData successBlock:^(NSDictionary *contextResponse) {
if (success) {
success(contextResponse);
}
NSLog(@"**************** WARPLY Response *****************" );
NSLog(@"%@", contextResponse );
} failureBlock:^(NSError *error) {
if (failure) {
failure(error);
}
}];
} failureBlock:^(NSError *error) {
if (failure) {
// [_db executeUpdate:@"DROP TABLE requestVariables"];
failure(error);
}
NSLog(@"Error at token %@", error );
}];
NSString* errorDomain = [error domain];
NSError *errorToken = [NSError errorWithDomain:errorDomain code:401 userInfo:dict];
if (failure) {
failure(errorToken);
}
// [self refreshToken:^(NSDictionary *response) {
// [self sendContext8:jsonData successBlock:^(NSDictionary *contextResponse) {
// if (success) {
// success(contextResponse);
// }
// NSLog(@"**************** WARPLY Response *****************" );
// NSLog(@"%@", contextResponse );
// } failureBlock:^(NSError *error) {
// if (failure) {
// failure(error);
// }
// }];
// } failureBlock:^(NSError *error) {
// if (failure) {
// // [_db executeUpdate:@"DROP TABLE requestVariables"];
// failure(error);
// }
// NSLog(@"Error at token %@", error );
// }];
} else {
NSLog(@"Error at cosmote retrieve sharing %@", error );
failure(error);
......@@ -3242,25 +3466,33 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION)
dict = [error userInfo];
NSString* errorCode = [dict objectForKey:@"NSLocalizedDescription"];
if ([errorCode isEqual:@"Request failed: unauthorized (401)"]) {
[self refreshToken:^(NSDictionary *response) {
[self sendContext8:jsonData successBlock:^(NSDictionary *contextResponse) {
if (success) {
success(contextResponse);
}
NSLog(@"**************** WARPLY Response *****************" );
NSLog(@"%@", contextResponse );
} failureBlock:^(NSError *error) {
if (failure) {
failure(error);
}
}];
} failureBlock:^(NSError *error) {
if (failure) {
// [_db executeUpdate:@"DROP TABLE requestVariables"];
failure(error);
}
NSLog(@"Error at token %@", error );
}];
NSString* errorDomain = [error domain];
NSError *errorToken = [NSError errorWithDomain:errorDomain code:401 userInfo:dict];
if (failure) {
failure(errorToken);
}
// [self refreshToken:^(NSDictionary *response) {
// [self sendContext8:jsonData successBlock:^(NSDictionary *contextResponse) {
// if (success) {
// success(contextResponse);
// }
// NSLog(@"**************** WARPLY Response *****************" );
// NSLog(@"%@", contextResponse );
// } failureBlock:^(NSError *error) {
// if (failure) {
// failure(error);
// }
// }];
// } failureBlock:^(NSError *error) {
// if (failure) {
// // [_db executeUpdate:@"DROP TABLE requestVariables"];
// failure(error);
// }
// NSLog(@"Error at token %@", error );
// }];
} else {
NSLog(@"Error at submit Order %@", error );
failure(error);
......@@ -3283,23 +3515,31 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION)
dict = [error userInfo];
NSString* errorCode = [dict objectForKey:@"NSLocalizedDescription"];
if ([errorCode isEqual:@"Request failed: unauthorized (401)"]) {
[self refreshToken:^(NSDictionary *response) {
[self sendContext8:jsonData successBlock:^(NSDictionary *contextResponse) {
if (success) {
success(contextResponse);
}
} failureBlock:^(NSError *error) {
if (failure) {
failure(error);
}
}];
} failureBlock:^(NSError *error) {
if (failure) {
// [_db executeUpdate:@"DROP TABLE requestVariables"];
failure(error);
}
NSLog(@"Error at token %@", error );
}];
NSString* errorDomain = [error domain];
NSError *errorToken = [NSError errorWithDomain:errorDomain code:401 userInfo:dict];
if (failure) {
failure(errorToken);
}
// [self refreshToken:^(NSDictionary *response) {
// [self sendContext8:jsonData successBlock:^(NSDictionary *contextResponse) {
// if (success) {
// success(contextResponse);
// }
// } failureBlock:^(NSError *error) {
// if (failure) {
// failure(error);
// }
// }];
// } failureBlock:^(NSError *error) {
// if (failure) {
// // [_db executeUpdate:@"DROP TABLE requestVariables"];
// failure(error);
// }
// NSLog(@"Error at token %@", error );
// }];
} else {
NSLog(@"Error at get coupon sets %@", error );
failure(error);
......
......@@ -146,7 +146,7 @@ public class swiftApi {
if (GlobalVariables.trackingStepsEnabled == false) {
// First get meters day value from database
swiftApi().getPacingDetailsAsync(getPacingCallback)
swiftApi().getPacingDetailsAsync(getPacingCallback, failureCallback: {errorCode in })
func getPacingCallback (_ pacingData: swiftApi.PacingDetails?) -> Void {
if (pacingData != nil) {
......@@ -168,7 +168,7 @@ public class swiftApi {
dateFormatter.dateFormat = "yyyy-MM-dd HH:mm:ss"
let dateString = dateFormatter.string(from: currentDateTime)
swiftApi().setPacingDetailsAsync(persistedSteps, dateString, setPacingDetailsAsyncCallback)
swiftApi().setPacingDetailsAsync(persistedSteps, dateString, setPacingDetailsAsyncCallback, failureCallback: {errorCode in })
}
func setPacingDetailsAsyncCallback (_ responseData: swiftApi.GenericResponseModel?) -> Void {
......@@ -256,7 +256,7 @@ public class swiftApi {
dateFormatter.dateFormat = "yyyy-MM-dd HH:mm:ss"
let dateString = dateFormatter.string(from: currentDateTime)
swiftApi().setPacingDetailsAsync(persistedSteps, dateString, setPacingDetailsAsyncCallback)
swiftApi().setPacingDetailsAsync(persistedSteps, dateString, setPacingDetailsAsyncCallback, failureCallback: {errorCode in })
}
func setPacingDetailsAsyncCallback (_ responseData: swiftApi.GenericResponseModel?) -> Void {
......@@ -289,7 +289,7 @@ public class swiftApi {
dateFormatter.dateFormat = "yyyy-MM-dd HH:mm:ss"
let dateString = dateFormatter.string(from: currentDateTime)
swiftApi().setPacingDetailsAsync(persistedSteps, dateString, setPacingDetailsAsyncCallback)
swiftApi().setPacingDetailsAsync(persistedSteps, dateString, setPacingDetailsAsyncCallback, failureCallback: {errorCode in })
}
DispatchQueue.main.async {
......@@ -691,7 +691,7 @@ public class swiftApi {
}
func getCouponsData(_ getCouponsCallback: @escaping (_ couponsData: Array<CouponItemModel>?) -> Void) -> Void {
func getCouponsData(_ getCouponsCallback: @escaping (_ couponsData: Array<CouponItemModel>?) -> Void, failureCallback: @escaping (_ errorCode: Int) -> Void) -> Void {
var coupons: [AnyHashable : Any]?
var couponSets: [AnyHashable : Any]?
......@@ -731,7 +731,17 @@ public class swiftApi {
dynatraceEvent._parameters = nil
SwiftEventBus.post("dynatrace", sender: dynatraceEvent)
getCouponsCallback(nil)
if let error = error as? NSError {
if (error.code == 401) {
let sessionEvent = swiftApi.LoyaltySDKSessionExpiredEventModel()
sessionEvent._sessionExpired = true
SwiftEventBus.post("sdk_session_expired", sender: sessionEvent)
}
failureCallback(error.code)
} else {
failureCallback(-1)
}
}
func couponSetsCallback(_ couponSetsData: [AnyHashable : Any]?) -> Void {
......@@ -858,8 +868,8 @@ public class swiftApi {
})
}
public func getCouponsAsync(_ getCouponsCallback: @escaping (_ couponsData: Array<CouponItemModel>?) -> Void) -> Void {
CouponsDataModel().getCouponsData(getCouponsCallback)
public func getCouponsAsync(_ getCouponsCallback: @escaping (_ couponsData: Array<CouponItemModel>?) -> Void, failureCallback: @escaping (_ errorCode: Int) -> Void) -> Void {
CouponsDataModel().getCouponsData(getCouponsCallback, failureCallback: failureCallback)
}
public class func getCoupons() -> Array<CouponItemModel> {
......@@ -1213,7 +1223,7 @@ public class swiftApi {
}
public func getCampaignsAsyncNew(language: String, filters: [String: Any], _ getCampaignsCallback: @escaping (_ campaignsData: Array<CampaignItemModel>?) -> Void) -> Void {
public func getCampaignsAsyncNew(language: String, filters: [String: Any], _ getCampaignsCallback: @escaping (_ campaignsData: Array<CampaignItemModel>?) -> Void, failureCallback: @escaping (_ errorCode: Int) -> Void) -> Void {
let instanceOfMyApi = MyApi()
instanceOfMyApi.getCampaignsAsyncNew(language, filters, campaignsCallback, failureBlock: campaignsFailureCallback)
......@@ -1277,6 +1287,9 @@ public class swiftApi {
getCampaignsCallback(sortedCampaigns);
// SwiftEventBus.post("campaigns_retrieved")
}, failureCallback: {errorCode in
failureCallback(errorCode)
})
} else {
......@@ -1313,7 +1326,7 @@ public class swiftApi {
}
public func getCampaignsPersonalizedAsync(language: String, filters: [String: Any], _ getCampaignsCallback: @escaping (_ campaignsData: Array<CampaignItemModel>?) -> Void) -> Void {
public func getCampaignsPersonalizedAsync(language: String, filters: [String: Any], _ getCampaignsCallback: @escaping (_ campaignsData: Array<CampaignItemModel>?) -> Void, failureCallback: @escaping (_ errorCode: Int) -> Void) -> Void {
let instanceOfMyApi = MyApi()
instanceOfMyApi.getCampaignsPersonalizedAsync(language, filters, campaignsCallback, failureBlock: campaignsFailureCallback)
......@@ -1386,7 +1399,17 @@ public class swiftApi {
dynatraceEvent._parameters = nil
SwiftEventBus.post("dynatrace", sender: dynatraceEvent)
getCampaignsCallback(nil)
if let error = error as? NSError {
if (error.code == 401) {
let sessionEvent = swiftApi.LoyaltySDKSessionExpiredEventModel()
sessionEvent._sessionExpired = true
SwiftEventBus.post("sdk_session_expired", sender: sessionEvent)
}
failureCallback(error.code)
} else {
failureCallback(-1)
}
}
}
......@@ -2374,7 +2397,7 @@ public class swiftApi {
init() {
}
func getProfileData(_ getProfileCallback: @escaping (_ profileData: ProfileModel?) -> Void) -> Void {
func getProfileData(_ getProfileCallback: @escaping (_ profileData: ProfileModel?) -> Void, failureCallback: @escaping (_ errorCode: Int) -> Void) -> Void {
let instanceOfMyApi = MyApi()
instanceOfMyApi.getProfileAsync(profileCallback, failureBlock: profileFailureCallback)
......@@ -2417,16 +2440,26 @@ public class swiftApi {
dynatraceEvent._eventName = "custom_error_profile_loyalty"
dynatraceEvent._parameters = nil
SwiftEventBus.post("dynatrace", sender: dynatraceEvent)
getProfileCallback(nil)
if let error = error as? NSError {
if (error.code == 401) {
let sessionEvent = swiftApi.LoyaltySDKSessionExpiredEventModel()
sessionEvent._sessionExpired = true
SwiftEventBus.post("sdk_session_expired", sender: sessionEvent)
}
failureCallback(error.code)
} else {
failureCallback(-1)
}
}
}
}
public func getProfileAsync(_ getProfileCallback: @escaping (_ profileData: ProfileModel?) -> Void) -> Void {
ProfileDataModel().getProfileData(getProfileCallback)
public func getProfileAsync(_ getProfileCallback: @escaping (_ profileData: ProfileModel?) -> Void, failureCallback: @escaping (_ errorCode: Int) -> Void) -> Void {
ProfileDataModel().getProfileData(getProfileCallback, failureCallback: failureCallback)
}
......@@ -2482,7 +2515,7 @@ public class swiftApi {
verifyTicketCallback(tempResponse);
swiftApi().getProfileAsync(getProfileCallback)
swiftApi().getProfileAsync(getProfileCallback, failureCallback: {errorCode in })
} else {
let dynatraceEvent = swiftApi.LoyaltySDKDynatraceEventModel()
......@@ -3289,7 +3322,9 @@ public class swiftApi {
print("SHARING_ID: " + sharingId)
self.cosmoteSharingAsync(sharingId: sharingId, sharingCallback)
self.cosmoteSharingAsync(sharingId: sharingId, sharingCallback, failureCallback: {errorCode in
self.errorSharingDialog(controller)
})
func sharingCallback (_ sharingData: SharingResponseModel?) -> Void {
if (sharingData != nil) {
......@@ -3341,7 +3376,9 @@ public class swiftApi {
alert.addAction(UIAlertAction(title: "Ενεργοποίηση", style: .default, handler: { action in
switch action.style{
case .default:
self.cosmoteRetrieveSharingAsync(sharingId: sharingId, accept: true, retrieveSharingCallback)
self.cosmoteRetrieveSharingAsync(sharingId: sharingId, accept: true, retrieveSharingCallback, failureCallback: {errorCode in
self.errorSharingDialog(controller)
})
case .cancel:
print("cancel")
......@@ -3362,7 +3399,7 @@ public class swiftApi {
if (sharingData?.getStatus == 1) {
self.acceptSharingDialog(controller)
swiftApi().getCouponsAsync(getCouponsCallback)
swiftApi().getCouponsAsync(getCouponsCallback, failureCallback: {errorCode in })
func getCouponsCallback (_ couponsData: Array<swiftApi.CouponItemModel>?) -> Void {
if (couponsData != nil) {
......@@ -3407,7 +3444,9 @@ public class swiftApi {
alert.addAction(UIAlertAction(title: "Ενεργοποίηση", style: .default, handler: { action in
switch action.style{
case .default:
self.cosmoteRetrieveSharingAsync(sharingId: sharingId, accept: true, retrieveSharingCallback)
self.cosmoteRetrieveSharingAsync(sharingId: sharingId, accept: true, retrieveSharingCallback, failureCallback: {errorCode in
self.errorSharingDialog(controller)
})
case .cancel:
print("cancel")
......@@ -3427,7 +3466,7 @@ public class swiftApi {
if (sharingData?.getStatus == 1) {
swiftApi().getCouponsAsync(getCouponsCallback)
swiftApi().getCouponsAsync(getCouponsCallback, failureCallback: {errorCode in })
func getCouponsCallback (_ couponsData: Array<swiftApi.CouponItemModel>?) -> Void {
if (couponsData != nil) {
......@@ -3491,7 +3530,9 @@ public class swiftApi {
alert.addAction(UIAlertAction(title: "Απόρριψη", style: .default, handler: { action in
switch action.style{
case .default:
self.cosmoteRetrieveSharingAsync(sharingId: sharingId, accept: false, retrieveSharingCallback)
self.cosmoteRetrieveSharingAsync(sharingId: sharingId, accept: false, retrieveSharingCallback, failureCallback: {errorCode in
self.errorSharingDialog(controller)
})
case .cancel:
print("cancel")
......@@ -3719,7 +3760,9 @@ public class swiftApi {
public func saveCustomerState(_ customer: CustomerStateModel) -> Void {
GlobalVariables.customerState = customer
swiftApi().consumerIntegrationAsync(nonTelco: customer._nonTelco, acceptedConsent: customer._acceptedConsent, msisdnList: customer._msisdnList, guid: customer._guid, consumerIntegrationCallback)
swiftApi().consumerIntegrationAsync(nonTelco: customer._nonTelco, acceptedConsent: customer._acceptedConsent, msisdnList: customer._msisdnList, guid: customer._guid, consumerIntegrationCallback, failureCallback: {errorCode in
print("CUSTOMER STATE ERROR")
})
func consumerIntegrationCallback (_ response: swiftApi.GenericResponseModel?) -> Void {
if (response != nil) {
......@@ -3993,7 +4036,7 @@ public class swiftApi {
}
public func consumerIntegrationAsync(nonTelco: Bool, acceptedConsent: Bool, msisdnList: Array<String>, guid: String, _ consumerIntegrationCallback: @escaping (_ responseData: GenericResponseModel?) -> Void) -> Void {
public func consumerIntegrationAsync(nonTelco: Bool, acceptedConsent: Bool, msisdnList: Array<String>, guid: String, _ consumerIntegrationCallback: @escaping (_ responseData: GenericResponseModel?) -> Void, failureCallback: @escaping (_ errorCode: Int) -> Void) -> Void {
let instanceOfMyApi = MyApi()
instanceOfMyApi.consumerIntegrationAsync(nonTelco as NSNumber, acceptedConsent as NSNumber, msisdnList, guid, requestCallback, failureBlock: requestFailureCallback)
......@@ -4016,11 +4059,22 @@ public class swiftApi {
print("consumerIntegration error: ")
print(error)
print("====================")
consumerIntegrationCallback(nil)
if let error = error as? NSError {
if (error.code == 401) {
let sessionEvent = swiftApi.LoyaltySDKSessionExpiredEventModel()
sessionEvent._sessionExpired = true
SwiftEventBus.post("sdk_session_expired", sender: sessionEvent)
}
failureCallback(error.code)
} else {
failureCallback(-1)
}
}
}
public func redeemCouponSetAsync(uuid: String, communication_uuid: String, _ redeemCouponSetCallback: @escaping (_ responseData: GenericResponseModel?) -> Void) -> Void {
public func redeemCouponSetAsync(uuid: String, communication_uuid: String, _ redeemCouponSetCallback: @escaping (_ responseData: GenericResponseModel?) -> Void, failureCallback: @escaping (_ errorCode: Int) -> Void) -> Void {
let instanceOfMyApi = MyApi()
instanceOfMyApi.redeemCouponSetAsync(uuid, communication_uuid, requestCallback, failureBlock: requestFailureCallback)
......@@ -4043,12 +4097,23 @@ public class swiftApi {
print("redeemCouponSet error: ")
print(error)
print("====================")
redeemCouponSetCallback(nil)
if let error = error as? NSError {
if (error.code == 401) {
let sessionEvent = swiftApi.LoyaltySDKSessionExpiredEventModel()
sessionEvent._sessionExpired = true
SwiftEventBus.post("sdk_session_expired", sender: sessionEvent)
}
failureCallback(error.code)
} else {
failureCallback(-1)
}
}
}
public func redeemCouponSetAsync(uuid: String, communication_uuid: String, user_msisdn: String, businessService: String, offerName: String, productType: String, provDuration: String, noOfRecurrance: String, price: String, discount: String, voiceCategory: String, dataCategory: String, minsValue: String, dataValue: String, provStepValueMins: String, OfferAudienceLevel: String, UACIOfferTrackingCode: String, OFFERCODE1: String, SCORE: String, ZONE: String, WAVE: String, VALIDITY: String, TREATMENT_CODE: String, ccms_session_id: String, _ redeemCouponSetCallback: @escaping (_ responseData: GenericResponseModel?) -> Void) -> Void {
public func redeemCouponSetAsync(uuid: String, communication_uuid: String, user_msisdn: String, businessService: String, offerName: String, productType: String, provDuration: String, noOfRecurrance: String, price: String, discount: String, voiceCategory: String, dataCategory: String, minsValue: String, dataValue: String, provStepValueMins: String, OfferAudienceLevel: String, UACIOfferTrackingCode: String, OFFERCODE1: String, SCORE: String, ZONE: String, WAVE: String, VALIDITY: String, TREATMENT_CODE: String, ccms_session_id: String, _ redeemCouponSetCallback: @escaping (_ responseData: GenericResponseModel?) -> Void, failureCallback: @escaping (_ errorCode: Int) -> Void) -> Void {
let instanceOfMyApi = MyApi()
instanceOfMyApi.redeemCouponSetAsync(uuid, communication_uuid, user_msisdn, businessService, offerName, productType, provDuration, noOfRecurrance, price, discount, voiceCategory, dataCategory, minsValue, dataValue, provStepValueMins, OfferAudienceLevel, UACIOfferTrackingCode, OFFERCODE1, SCORE, ZONE, WAVE, VALIDITY, TREATMENT_CODE, ccms_session_id, requestCallback, failureBlock: requestFailureCallback)
......@@ -4071,7 +4136,18 @@ public class swiftApi {
print("redeemCouponSet error: ")
print(error)
print("====================")
redeemCouponSetCallback(nil)
if let error = error as? NSError {
if (error.code == 401) {
let sessionEvent = swiftApi.LoyaltySDKSessionExpiredEventModel()
sessionEvent._sessionExpired = true
SwiftEventBus.post("sdk_session_expired", sender: sessionEvent)
}
failureCallback(error.code)
} else {
failureCallback(-1)
}
}
}
......@@ -4674,7 +4750,7 @@ public class swiftApi {
}
public func getPacingDetailsAsync(_ getPacingDetailsCallback: @escaping (_ pacingData: PacingDetails?) -> Void) -> Void {
public func getPacingDetailsAsync(_ getPacingDetailsCallback: @escaping (_ pacingData: PacingDetails?) -> Void, failureCallback: @escaping (_ errorCode: Int) -> Void) -> Void {
let instanceOfMyApi = MyApi()
instanceOfMyApi.getPacingDetailsAsync(pacingCallback, failureBlock: pacingFailureCallback)
......@@ -4704,7 +4780,18 @@ public class swiftApi {
func pacingFailureCallback(_ error: Error?) -> Void {
print("getPacingDetails error: ")
getPacingDetailsCallback(nil)
if let error = error as? NSError {
if (error.code == 401) {
let sessionEvent = swiftApi.LoyaltySDKSessionExpiredEventModel()
sessionEvent._sessionExpired = true
SwiftEventBus.post("sdk_session_expired", sender: sessionEvent)
}
failureCallback(error.code)
} else {
failureCallback(-1)
}
}
}
......@@ -4729,7 +4816,7 @@ public class swiftApi {
}
public func setPacingDetailsAsync(_ steps: Int, _ date: String, _ setPacingDetailsCallback: @escaping (_ responseData: GenericResponseModel?) -> Void) -> Void {
public func setPacingDetailsAsync(_ steps: Int, _ date: String, _ setPacingDetailsCallback: @escaping (_ responseData: GenericResponseModel?) -> Void, failureCallback: @escaping (_ errorCode: Int) -> Void) -> Void {
let instanceOfMyApi = MyApi()
instanceOfMyApi.setPacingDetailsAsync(steps as NSNumber, date, pacingCallback, failureBlock: pacingFailureCallback)
......@@ -4762,7 +4849,18 @@ public class swiftApi {
func pacingFailureCallback(_ error: Error?) -> Void {
print("setPacingDetails error: ")
setPacingDetailsCallback(nil)
if let error = error as? NSError {
if (error.code == 401) {
let sessionEvent = swiftApi.LoyaltySDKSessionExpiredEventModel()
sessionEvent._sessionExpired = true
SwiftEventBus.post("sdk_session_expired", sender: sessionEvent)
}
failureCallback(error.code)
} else {
failureCallback(-1)
}
}
}
......@@ -4827,7 +4925,7 @@ public class swiftApi {
}
public func cosmoteSharingAsync(sharingId: String, _ cosmoteSharingCallback: @escaping (_ responseData: SharingResponseModel?) -> Void) -> Void {
public func cosmoteSharingAsync(sharingId: String, _ cosmoteSharingCallback: @escaping (_ responseData: SharingResponseModel?) -> Void, failureCallback: @escaping (_ errorCode: Int) -> Void) -> Void {
let instanceOfMyApi = MyApi()
instanceOfMyApi.cosmoteSharingAsync(sharingId, requestCallback, failureBlock: requestFailureCallback)
......@@ -4876,12 +4974,22 @@ public class swiftApi {
dynatraceEvent._parameters = nil
SwiftEventBus.post("dynatrace", sender: dynatraceEvent)
cosmoteSharingCallback(nil)
if let error = error as? NSError {
if (error.code == 401) {
let sessionEvent = swiftApi.LoyaltySDKSessionExpiredEventModel()
sessionEvent._sessionExpired = true
SwiftEventBus.post("sdk_session_expired", sender: sessionEvent)
}
failureCallback(error.code)
} else {
failureCallback(-1)
}
}
}
public func cosmoteRetrieveSharingAsync(sharingId: String, accept: Bool, _ cosmoteSharingCallback: @escaping (_ responseData: GenericResponseModel?) -> Void) -> Void {
public func cosmoteRetrieveSharingAsync(sharingId: String, accept: Bool, _ cosmoteSharingCallback: @escaping (_ responseData: GenericResponseModel?) -> Void, failureCallback: @escaping (_ errorCode: Int) -> Void) -> Void {
let instanceOfMyApi = MyApi()
instanceOfMyApi.cosmoteRetrieveSharingAsync(sharingId, accept as NSNumber, requestCallback, failureBlock: requestFailureCallback)
......@@ -4935,7 +5043,17 @@ public class swiftApi {
dynatraceEvent._parameters = nil
SwiftEventBus.post("dynatrace", sender: dynatraceEvent)
cosmoteSharingCallback(nil)
if let error = error as? NSError {
if (error.code == 401) {
let sessionEvent = swiftApi.LoyaltySDKSessionExpiredEventModel()
sessionEvent._sessionExpired = true
SwiftEventBus.post("sdk_session_expired", sender: sessionEvent)
}
failureCallback(error.code)
} else {
failureCallback(-1)
}
}
}
......@@ -4981,7 +5099,7 @@ public class swiftApi {
}
public func cosmoteCouponSharingAsync(coupon: String, sender: String, receiver: String, _ couponSharingCallback: @escaping (_ responseData: GenericResponseModel?) -> Void) -> Void {
public func cosmoteCouponSharingAsync(coupon: String, sender: String, receiver: String, _ couponSharingCallback: @escaping (_ responseData: GenericResponseModel?) -> Void, failureCallback: @escaping (_ errorCode: Int) -> Void) -> Void {
let instanceOfMyApi = MyApi()
instanceOfMyApi.cosmoteCouponSharingAsync(coupon, sender, receiver, requestCallback, failureBlock: requestFailureCallback)
......@@ -5038,12 +5156,22 @@ public class swiftApi {
dynatraceEvent._parameters = nil
SwiftEventBus.post("dynatrace", sender: dynatraceEvent)
couponSharingCallback(nil)
if let error = error as? NSError {
if (error.code == 401) {
let sessionEvent = swiftApi.LoyaltySDKSessionExpiredEventModel()
sessionEvent._sessionExpired = true
SwiftEventBus.post("sdk_session_expired", sender: sessionEvent)
}
failureCallback(error.code)
} else {
failureCallback(-1)
}
}
}
public func submitOrderAsync(campaign_session_uuid: String, user_msisdn: String, businessService: String, offerName: String, productType: String, provDuration: String, noOfRecurrance: String, price: String, discount: String, voiceCategory: String, dataCategory: String, minsValue: String, dataValue: String, provStepValueMins: String, OfferAudienceLevel: String, UACIOfferTrackingCode: String, OFFERCODE1: String, SCORE: String, ZONE: String, WAVE: String, VALIDITY: String, TREATMENT_CODE: String, ccms_session_id: String, notificationMessage: String, _ submitOrderCallback: @escaping (_ responseData: GenericResponseModel?) -> Void) -> Void {
public func submitOrderAsync(campaign_session_uuid: String, user_msisdn: String, businessService: String, offerName: String, productType: String, provDuration: String, noOfRecurrance: String, price: String, discount: String, voiceCategory: String, dataCategory: String, minsValue: String, dataValue: String, provStepValueMins: String, OfferAudienceLevel: String, UACIOfferTrackingCode: String, OFFERCODE1: String, SCORE: String, ZONE: String, WAVE: String, VALIDITY: String, TREATMENT_CODE: String, ccms_session_id: String, notificationMessage: String, _ submitOrderCallback: @escaping (_ responseData: GenericResponseModel?) -> Void, failureCallback: @escaping (_ errorCode: Int) -> Void) -> Void {
let instanceOfMyApi = MyApi()
instanceOfMyApi.submitOrderAsync(campaign_session_uuid, user_msisdn, businessService, offerName, productType, provDuration, noOfRecurrance, price, discount, voiceCategory, dataCategory, minsValue, dataValue, provStepValueMins, OfferAudienceLevel, UACIOfferTrackingCode, OFFERCODE1, SCORE, ZONE, WAVE, VALIDITY, TREATMENT_CODE, ccms_session_id, notificationMessage, requestCallback, failureBlock: requestFailureCallback)
......@@ -5100,12 +5228,22 @@ public class swiftApi {
dynatraceEvent._parameters = nil
SwiftEventBus.post("dynatrace", sender: dynatraceEvent)
submitOrderCallback(nil)
if let error = error as? NSError {
if (error.code == 401) {
let sessionEvent = swiftApi.LoyaltySDKSessionExpiredEventModel()
sessionEvent._sessionExpired = true
SwiftEventBus.post("sdk_session_expired", sender: sessionEvent)
}
failureCallback(error.code)
} else {
failureCallback(-1)
}
}
}
public func postEventAsync(Session_ID: String, OfferAudienceLevel: String, msisdn: String, UACIOfferTrackingCode: String, OFFERCODE1: String, SCORE: String, ZONE: String, WAVE: String, VALIDITY: String, TREATMENT_CODE: String, _ postEventCallback: @escaping (_ responseData: GenericResponseModel?) -> Void) -> Void {
public func postEventAsync(Session_ID: String, OfferAudienceLevel: String, msisdn: String, UACIOfferTrackingCode: String, OFFERCODE1: String, SCORE: String, ZONE: String, WAVE: String, VALIDITY: String, TREATMENT_CODE: String, _ postEventCallback: @escaping (_ responseData: GenericResponseModel?) -> Void, failureCallback: @escaping (_ errorCode: Int) -> Void) -> Void {
let instanceOfMyApi = MyApi()
instanceOfMyApi.postEventAsync(Session_ID, OfferAudienceLevel, msisdn, UACIOfferTrackingCode, OFFERCODE1, SCORE, ZONE, WAVE, VALIDITY, TREATMENT_CODE, requestCallback, failureBlock: requestFailureCallback)
......@@ -5161,8 +5299,20 @@ public class swiftApi {
dynatraceEvent._eventName = "custom_error_post_event_loyalty"
dynatraceEvent._parameters = nil
SwiftEventBus.post("dynatrace", sender: dynatraceEvent)
if let error = error as? NSError {
if (error.code == 401) {
let sessionEvent = swiftApi.LoyaltySDKSessionExpiredEventModel()
sessionEvent._sessionExpired = true
SwiftEventBus.post("sdk_session_expired", sender: sessionEvent)
}
failureCallback(error.code)
} else {
failureCallback(-1)
}
postEventCallback(nil)
// postEventCallback(nil)
}
}
......@@ -5325,7 +5475,7 @@ public class swiftApi {
}
public func getSharingHistoryAsync(_ getSharingHistoryCallback: @escaping (_ sharingHistoryData: Array<SharingCouponModel>?) -> Void) -> Void {
public func getSharingHistoryAsync(_ getSharingHistoryCallback: @escaping (_ sharingHistoryData: Array<SharingCouponModel>?) -> Void, failureCallback: @escaping (_ errorCode: Int) -> Void) -> Void {
let instanceOfMyApi = MyApi()
instanceOfMyApi.getSharingHistoryAsync(requestCallback, failureBlock: requestFailureCallback)
......@@ -5394,7 +5544,17 @@ public class swiftApi {
dynatraceEvent._parameters = nil
SwiftEventBus.post("dynatrace", sender: dynatraceEvent)
getSharingHistoryCallback(nil)
if let error = error as? NSError {
if (error.code == 401) {
let sessionEvent = swiftApi.LoyaltySDKSessionExpiredEventModel()
sessionEvent._sessionExpired = true
SwiftEventBus.post("sdk_session_expired", sender: sessionEvent)
}
failureCallback(error.code)
} else {
failureCallback(-1)
}
}
}
......@@ -6331,7 +6491,7 @@ public class swiftApi {
}
public func editProfileAsync(firstname: String? = "", lastname: String? = "", email: String? = "", salutation: String? = "", msisdn: String? = "", nickname: String? = "", gender: String? = "", birthday: String? = "", nameday: String? = "", taxid: String? = "", profileMetadata: [String: Any]? = [String: Any](), optin: Bool? = false, newsletter: Bool? = false, sms: Bool? = false, segmentation: Bool? = false, smsSegmentation: Bool? = false, _ editProfileCallback: @escaping (_ editProfileData: VerifyTicketResponseModel?) -> Void) -> Void {
public func editProfileAsync(firstname: String? = "", lastname: String? = "", email: String? = "", salutation: String? = "", msisdn: String? = "", nickname: String? = "", gender: String? = "", birthday: String? = "", nameday: String? = "", taxid: String? = "", profileMetadata: [String: Any]? = [String: Any](), optin: Bool? = false, newsletter: Bool? = false, sms: Bool? = false, segmentation: Bool? = false, smsSegmentation: Bool? = false, _ editProfileCallback: @escaping (_ editProfileData: VerifyTicketResponseModel?) -> Void, failureCallback: @escaping (_ errorCode: Int) -> Void) -> Void {
let instanceOfMyApi = MyApi()
instanceOfMyApi.editProfileAsync(firstname, andLastname: lastname, andEmail: email, andSalutation: salutation, andMsisdn: msisdn, andNickname: nickname, andGender: gender, andBirthday: birthday, andNameDay: nameday, andTaxID: taxid, andProfileMetadata: profileMetadata, optin: optin as? NSNumber, newsLetter: newsletter as? NSNumber, andSMS: sms as? NSNumber, andSegmentation: segmentation as? NSNumber, andSMSSegmentation: smsSegmentation as? NSNumber, editProfileAsyncCallback, failureBlock: editProfileAsyncFailureCallback)
......@@ -6350,7 +6510,7 @@ public class swiftApi {
dynatraceEvent._parameters = nil
SwiftEventBus.post("dynatrace", sender: dynatraceEvent)
swiftApi().getProfileAsync(getProfileCallback)
swiftApi().getProfileAsync(getProfileCallback, failureCallback: {errorCode in })
}
} else {
......@@ -6373,8 +6533,19 @@ public class swiftApi {
dynatraceEvent._eventName = "custom_error_edit_profile_loyalty"
dynatraceEvent._parameters = nil
SwiftEventBus.post("dynatrace", sender: dynatraceEvent)
if let error = error as? NSError {
if (error.code == 401) {
let sessionEvent = swiftApi.LoyaltySDKSessionExpiredEventModel()
sessionEvent._sessionExpired = true
SwiftEventBus.post("sdk_session_expired", sender: sessionEvent)
}
failureCallback(error.code)
} else {
failureCallback(-1)
}
editProfileCallback(nil)
}
func getProfileCallback (_ profileData: swiftApi.ProfileModel?) -> Void {
......@@ -6428,7 +6599,7 @@ public class swiftApi {
func getSingleCampaignAsyncCallback(_ getSingleCampaignData: [AnyHashable: Any]?) -> Void {
swiftApi().getCampaignsAsyncNew(language: "en", filters: [String : Any](), getCampaignsCallback)
swiftApi().getCampaignsAsyncNew(language: "en", filters: [String : Any](), getCampaignsCallback, failureCallback: {errorCode in })
func getCampaignsCallback (_ campaignsData: Array<swiftApi.CampaignItemModel>?) -> Void {
if (campaignsData != nil) {
......@@ -6465,7 +6636,7 @@ public class swiftApi {
func getSingleCampaignFailureCallback(_ error: Error?) -> Void {
swiftApi().getCampaignsAsyncNew(language: "en", filters: [String : Any](), getCampaignsCallback)
swiftApi().getCampaignsAsyncNew(language: "en", filters: [String : Any](), getCampaignsCallback, failureCallback: {errorCode in })
func getCampaignsCallback (_ campaignsData: Array<swiftApi.CampaignItemModel>?) -> Void {
if (campaignsData != nil) {
......@@ -6517,7 +6688,7 @@ public class swiftApi {
swiftApi().setMerchantId("58763")
}
}
public class LoyaltySDKSessionExpiredEventModel {
private var sessionExpired: Bool
......