Showing
12 changed files
with
977 additions
and
520 deletions
... | @@ -7,7 +7,7 @@ | ... | @@ -7,7 +7,7 @@ |
7 | <key>Pods-SwiftWarplyFramework.xcscheme_^#shared#^_</key> | 7 | <key>Pods-SwiftWarplyFramework.xcscheme_^#shared#^_</key> |
8 | <dict> | 8 | <dict> |
9 | <key>orderHint</key> | 9 | <key>orderHint</key> |
10 | - <integer>0</integer> | 10 | + <integer>1</integer> |
11 | </dict> | 11 | </dict> |
12 | </dict> | 12 | </dict> |
13 | </dict> | 13 | </dict> | ... | ... |
... | @@ -7,7 +7,7 @@ | ... | @@ -7,7 +7,7 @@ |
7 | <key>SwiftWarplyFramework.xcscheme_^#shared#^_</key> | 7 | <key>SwiftWarplyFramework.xcscheme_^#shared#^_</key> |
8 | <dict> | 8 | <dict> |
9 | <key>orderHint</key> | 9 | <key>orderHint</key> |
10 | - <integer>1</integer> | 10 | + <integer>0</integer> |
11 | </dict> | 11 | </dict> |
12 | </dict> | 12 | </dict> |
13 | </dict> | 13 | </dict> | ... | ... |
No preview for this file type
... | @@ -44,7 +44,7 @@ var timer2: DispatchSourceTimer? | ... | @@ -44,7 +44,7 @@ var timer2: DispatchSourceTimer? |
44 | dateFormatter.dateFormat = "yyyy-MM-dd HH:mm:ss" | 44 | dateFormatter.dateFormat = "yyyy-MM-dd HH:mm:ss" |
45 | let dateString = dateFormatter.string(from: currentDateTime) | 45 | let dateString = dateFormatter.string(from: currentDateTime) |
46 | 46 | ||
47 | - swiftApi().setPacingDetailsAsync(persistedSteps, dateString, setPacingDetailsAsyncCallback) | 47 | + swiftApi().setPacingDetailsAsync(persistedSteps, dateString, setPacingDetailsAsyncCallback, failureCallback: {errorCode in }) |
48 | } | 48 | } |
49 | 49 | ||
50 | func setPacingDetailsAsyncCallback (_ responseData: swiftApi.GenericResponseModel?) -> Void { | 50 | func setPacingDetailsAsyncCallback (_ responseData: swiftApi.GenericResponseModel?) -> Void { |
... | @@ -161,12 +161,12 @@ var timer2: DispatchSourceTimer? | ... | @@ -161,12 +161,12 @@ var timer2: DispatchSourceTimer? |
161 | } else if (eventArray[1] == "addUserTag") { | 161 | } else if (eventArray[1] == "addUserTag") { |
162 | // SwiftEventBus.post("questionnaire", sender: questionnaireEvent) | 162 | // SwiftEventBus.post("questionnaire", sender: questionnaireEvent) |
163 | 163 | ||
164 | - swiftApi().getProfileAsync(getProfileCallback) | 164 | + swiftApi().getProfileAsync(getProfileCallback, failureCallback: {errorCode in }) |
165 | 165 | ||
166 | func getProfileCallback (_ profileData: swiftApi.ProfileModel?) -> Void { | 166 | func getProfileCallback (_ profileData: swiftApi.ProfileModel?) -> Void { |
167 | if (profileData != nil) { | 167 | if (profileData != nil) { |
168 | DispatchQueue.main.async { | 168 | DispatchQueue.main.async { |
169 | - swiftApi().getCampaignsAsyncNew(language: "en", filters: [String : Any](), getCampaignsCallback) | 169 | + swiftApi().getCampaignsAsyncNew(language: "en", filters: [String : Any](), getCampaignsCallback, failureCallback: {errorCode in }) |
170 | 170 | ||
171 | func getCampaignsCallback (_ campaignsData: Array<swiftApi.CampaignItemModel>?) -> Void { | 171 | func getCampaignsCallback (_ campaignsData: Array<swiftApi.CampaignItemModel>?) -> Void { |
172 | if (campaignsData != nil) { | 172 | if (campaignsData != nil) { |
... | @@ -197,8 +197,8 @@ var timer2: DispatchSourceTimer? | ... | @@ -197,8 +197,8 @@ var timer2: DispatchSourceTimer? |
197 | let couponEvent = swiftApi.CouponEventModel() | 197 | let couponEvent = swiftApi.CouponEventModel() |
198 | SwiftEventBus.post("coupon_retrieved", sender: couponEvent) | 198 | SwiftEventBus.post("coupon_retrieved", sender: couponEvent) |
199 | 199 | ||
200 | - swiftApi().getCouponsAsync(getCouponsCallback) | 200 | + swiftApi().getCouponsAsync(getCouponsCallback, failureCallback: {errorCode in }) |
201 | - swiftApi().getCampaignsAsyncNew(language: "en", filters: [String : Any](), getCampaignsCallback) | 201 | + swiftApi().getCampaignsAsyncNew(language: "en", filters: [String : Any](), getCampaignsCallback, failureCallback: {errorCode in }) |
202 | 202 | ||
203 | func getCouponsCallback (_ couponsData: Array<swiftApi.CouponItemModel>?) -> Void { | 203 | func getCouponsCallback (_ couponsData: Array<swiftApi.CouponItemModel>?) -> Void { |
204 | if (couponsData != nil) { | 204 | if (couponsData != nil) { | ... | ... |
... | @@ -158,7 +158,7 @@ import SwiftEventBus | ... | @@ -158,7 +158,7 @@ import SwiftEventBus |
158 | 158 | ||
159 | // MARK: - API CALLS | 159 | // MARK: - API CALLS |
160 | func getProfileRequest() { | 160 | func getProfileRequest() { |
161 | - swiftApi().getProfileAsync(getProfileCallback) | 161 | + swiftApi().getProfileAsync(getProfileCallback, failureCallback: {errorCode in }) |
162 | } | 162 | } |
163 | 163 | ||
164 | func getProfileCallback (_ profileData: swiftApi.ProfileModel?) -> Void { | 164 | func getProfileCallback (_ profileData: swiftApi.ProfileModel?) -> Void { |
... | @@ -173,7 +173,16 @@ import SwiftEventBus | ... | @@ -173,7 +173,16 @@ import SwiftEventBus |
173 | func submitOrderRequest() { | 173 | func submitOrderRequest() { |
174 | 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 ?? ""), | 174 | 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 ?? ""), |
175 | 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 ?? ""), | 175 | 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 ?? ""), |
176 | - submitOrderCallback) | 176 | + submitOrderCallback, failureCallback: {errorCode in |
177 | + let firebaseEvent = swiftApi.LoyaltySDKFirebaseEventModel() | ||
178 | + firebaseEvent._eventName = "loyalty_offer_activated" | ||
179 | + firebaseEvent.setParameter = ("name", (self.ccms?._title ?? "")) | ||
180 | + firebaseEvent.setParameter = ("type", "gift") | ||
181 | + firebaseEvent.setParameter = ("successful", "false") | ||
182 | + SwiftEventBus.post("firebase", sender: firebaseEvent) | ||
183 | + | ||
184 | + self.showDialog("Αποτυχία","Κάτι πήγε στραβά") | ||
185 | + }) | ||
177 | } | 186 | } |
178 | 187 | ||
179 | func submitOrderCallback (_ response: swiftApi.GenericResponseModel?) -> Void { | 188 | func submitOrderCallback (_ response: swiftApi.GenericResponseModel?) -> Void { | ... | ... |
... | @@ -181,10 +181,32 @@ import SwiftEventBus | ... | @@ -181,10 +181,32 @@ import SwiftEventBus |
181 | showSpinner() | 181 | showSpinner() |
182 | 182 | ||
183 | if (ccms == nil) { | 183 | if (ccms == nil) { |
184 | - swiftApi().redeemCouponSetAsync(uuid: uuid, communication_uuid: communication_uuid, redeemCouponSetCallback) | 184 | + swiftApi().redeemCouponSetAsync(uuid: uuid, communication_uuid: communication_uuid, redeemCouponSetCallback, failureCallback: {errorCode in |
185 | + self.hideSpinner() | ||
186 | + | ||
187 | + let firebaseEvent = swiftApi.LoyaltySDKFirebaseEventModel() | ||
188 | + firebaseEvent._eventName = "loyalty_offer_activated" | ||
189 | + firebaseEvent.setParameter = ("name", (self.couponset?.name ?? "")) | ||
190 | + firebaseEvent.setParameter = ("type", "coupon") | ||
191 | + firebaseEvent.setParameter = ("successful", "false") | ||
192 | + SwiftEventBus.post("firebase", sender: firebaseEvent) | ||
193 | + | ||
194 | + self.showDialog("Αποτυχία","Κάτι πήγε στραβά") | ||
195 | + }) | ||
185 | } else { | 196 | } else { |
186 | // TODO: MAybe change user_msisdn: profile?._msisdn ?? "" | 197 | // TODO: MAybe change user_msisdn: profile?._msisdn ?? "" |
187 | - 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) | 198 | + 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 |
199 | + self.hideSpinner() | ||
200 | + | ||
201 | + let firebaseEvent = swiftApi.LoyaltySDKFirebaseEventModel() | ||
202 | + firebaseEvent._eventName = "loyalty_offer_activated" | ||
203 | + firebaseEvent.setParameter = ("name", (self.couponset?.name ?? "")) | ||
204 | + firebaseEvent.setParameter = ("type", "coupon") | ||
205 | + firebaseEvent.setParameter = ("successful", "false") | ||
206 | + SwiftEventBus.post("firebase", sender: firebaseEvent) | ||
207 | + | ||
208 | + self.showDialog("Αποτυχία","Κάτι πήγε στραβά") | ||
209 | + }) | ||
188 | } | 210 | } |
189 | } | 211 | } |
190 | 212 | ||
... | @@ -209,8 +231,8 @@ import SwiftEventBus | ... | @@ -209,8 +231,8 @@ import SwiftEventBus |
209 | 231 | ||
210 | self.showSuccessDialog("Επιτυχής ενεργοποίηση","Το κουπόνι σου έχει ενεργοποιηθεί στην ενότητα My Rewards.") | 232 | self.showSuccessDialog("Επιτυχής ενεργοποίηση","Το κουπόνι σου έχει ενεργοποιηθεί στην ενότητα My Rewards.") |
211 | 233 | ||
212 | - swiftApi().getCouponsAsync(getCouponsCallback) | 234 | + swiftApi().getCouponsAsync(getCouponsCallback, failureCallback: {errorCode in }) |
213 | - swiftApi().getCampaignsAsyncNew(language: "en", filters: [String : Any](), getCampaignsCallback) | 235 | + swiftApi().getCampaignsAsyncNew(language: "en", filters: [String : Any](), getCampaignsCallback, failureCallback: {errorCode in }) |
214 | 236 | ||
215 | func getCouponsCallback (_ couponsData: Array<swiftApi.CouponItemModel>?) -> Void { | 237 | func getCouponsCallback (_ couponsData: Array<swiftApi.CouponItemModel>?) -> Void { |
216 | if (couponsData != nil) { | 238 | if (couponsData != nil) { | ... | ... |
... | @@ -49,7 +49,9 @@ import SwiftEventBus | ... | @@ -49,7 +49,9 @@ import SwiftEventBus |
49 | 49 | ||
50 | // MARK: - API Functions | 50 | // MARK: - API Functions |
51 | func getCouponsRequest() { | 51 | func getCouponsRequest() { |
52 | - swiftApi().getCouponsAsync(getCouponsCallback) | 52 | + swiftApi().getCouponsAsync(getCouponsCallback, failureCallback: {errorCode in |
53 | + self.coupons = [] | ||
54 | + }) | ||
53 | } | 55 | } |
54 | 56 | ||
55 | func getCouponsCallback (_ couponsData: Array<swiftApi.CouponItemModel>?) -> Void { | 57 | func getCouponsCallback (_ couponsData: Array<swiftApi.CouponItemModel>?) -> Void { | ... | ... |
... | @@ -254,7 +254,9 @@ import SwiftEventBus | ... | @@ -254,7 +254,9 @@ import SwiftEventBus |
254 | 254 | ||
255 | // MARK: - API Calls | 255 | // MARK: - API Calls |
256 | func getProfileRequest() { | 256 | func getProfileRequest() { |
257 | - swiftApi().getProfileAsync(getProfileCallback) | 257 | + swiftApi().getProfileAsync(getProfileCallback, failureCallback: {errorCode in |
258 | + print("========= getProfileRequest ERROR =========") | ||
259 | + }) | ||
258 | } | 260 | } |
259 | 261 | ||
260 | func getProfileCallback (_ profileData: swiftApi.ProfileModel?) -> Void { | 262 | func getProfileCallback (_ profileData: swiftApi.ProfileModel?) -> Void { |
... | @@ -270,7 +272,9 @@ import SwiftEventBus | ... | @@ -270,7 +272,9 @@ import SwiftEventBus |
270 | } | 272 | } |
271 | 273 | ||
272 | func cosmoteCouponSharingRequest() { | 274 | func cosmoteCouponSharingRequest() { |
273 | - swiftApi().cosmoteCouponSharingAsync(coupon: coupon?.coupon ?? "", sender: selectedNumber, receiver: numberTextField.text ?? "", couponSharingCallback) | 275 | + swiftApi().cosmoteCouponSharingAsync(coupon: coupon?.coupon ?? "", sender: selectedNumber, receiver: numberTextField.text ?? "", couponSharingCallback, failureCallback: {errorCode in |
276 | + self.showDialog("Αποτυχία","Κάτι πήγε στραβά") | ||
277 | + }) | ||
274 | } | 278 | } |
275 | 279 | ||
276 | func couponSharingCallback (_ response: swiftApi.GenericResponseModel?) -> Void { | 280 | func couponSharingCallback (_ response: swiftApi.GenericResponseModel?) -> Void { |
... | @@ -278,7 +282,7 @@ import SwiftEventBus | ... | @@ -278,7 +282,7 @@ import SwiftEventBus |
278 | DispatchQueue.main.async { | 282 | DispatchQueue.main.async { |
279 | if (response?.getStatus == 1) { | 283 | if (response?.getStatus == 1) { |
280 | 284 | ||
281 | - swiftApi().getCouponsAsync(getCouponsCallback) | 285 | + swiftApi().getCouponsAsync(getCouponsCallback, failureCallback: {errorCode in }) |
282 | 286 | ||
283 | func getCouponsCallback (_ couponsData: Array<swiftApi.CouponItemModel>?) -> Void { | 287 | func getCouponsCallback (_ couponsData: Array<swiftApi.CouponItemModel>?) -> Void { |
284 | if (couponsData != nil) { | 288 | if (couponsData != nil) { | ... | ... |
... | @@ -40,7 +40,7 @@ class SharingHistoryViewController: AnalysisChildViewController { | ... | @@ -40,7 +40,7 @@ class SharingHistoryViewController: AnalysisChildViewController { |
40 | 40 | ||
41 | showLoading() | 41 | showLoading() |
42 | 42 | ||
43 | - swiftApi().getSharingHistoryAsync(responseCallback) | 43 | + swiftApi().getSharingHistoryAsync(responseCallback, failureCallback: {errorCode in }) |
44 | } | 44 | } |
45 | 45 | ||
46 | private func showLoading() { | 46 | private func showLoading() { | ... | ... |
... | @@ -212,7 +212,7 @@ import SwiftEventBus | ... | @@ -212,7 +212,7 @@ import SwiftEventBus |
212 | 212 | ||
213 | // MARK: - API CALLS | 213 | // MARK: - API CALLS |
214 | func getProfileRequest() { | 214 | func getProfileRequest() { |
215 | - swiftApi().getProfileAsync(getProfileCallback) | 215 | + swiftApi().getProfileAsync(getProfileCallback, failureCallback: {errorCode in }) |
216 | } | 216 | } |
217 | 217 | ||
218 | func getProfileCallback (_ profileData: swiftApi.ProfileModel?) -> Void { | 218 | func getProfileCallback (_ profileData: swiftApi.ProfileModel?) -> Void { |
... | @@ -227,7 +227,16 @@ import SwiftEventBus | ... | @@ -227,7 +227,16 @@ import SwiftEventBus |
227 | func submitOrderRequest() { | 227 | func submitOrderRequest() { |
228 | 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 ?? ""), | 228 | 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 ?? ""), |
229 | 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 ?? ""), | 229 | 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 ?? ""), |
230 | - submitOrderCallback) | 230 | + submitOrderCallback, failureCallback: {errorCode in |
231 | + let firebaseEvent = swiftApi.LoyaltySDKFirebaseEventModel() | ||
232 | + firebaseEvent._eventName = "loyalty_offer_activated" | ||
233 | + firebaseEvent.setParameter = ("name", (self.ccms?._title ?? "")) | ||
234 | + firebaseEvent.setParameter = ("type", "gift") | ||
235 | + firebaseEvent.setParameter = ("successful", "false") | ||
236 | + SwiftEventBus.post("firebase", sender: firebaseEvent) | ||
237 | + | ||
238 | + self.showDialog("Αποτυχία","Κάτι πήγε στραβά") | ||
239 | + }) | ||
231 | } | 240 | } |
232 | 241 | ||
233 | func submitOrderCallback (_ response: swiftApi.GenericResponseModel?) -> Void { | 242 | func submitOrderCallback (_ response: swiftApi.GenericResponseModel?) -> Void { | ... | ... |
... | @@ -672,25 +672,33 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) | ... | @@ -672,25 +672,33 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) |
672 | dict = [error userInfo]; | 672 | dict = [error userInfo]; |
673 | NSString* errorCode = [dict objectForKey:@"NSLocalizedDescription"]; | 673 | NSString* errorCode = [dict objectForKey:@"NSLocalizedDescription"]; |
674 | if ([errorCode isEqual:@"Request failed: unauthorized (401)"]) { | 674 | if ([errorCode isEqual:@"Request failed: unauthorized (401)"]) { |
675 | - [self refreshToken:^(NSDictionary *response) { | 675 | + |
676 | - [self sendContext8:jsonData successBlock:^(NSDictionary *contextResponse) { | 676 | + NSString* errorDomain = [error domain]; |
677 | - if (success) { | 677 | + NSError *errorToken = [NSError errorWithDomain:errorDomain code:401 userInfo:dict]; |
678 | - success(contextResponse); | 678 | + |
679 | - } | ||
680 | - NSLog(@"**************** WARPLY Response *****************" ); | ||
681 | - NSLog(@"%@", contextResponse ); | ||
682 | - } failureBlock:^(NSError *error) { | ||
683 | - if (failure) { | ||
684 | - failure(error); | ||
685 | - } | ||
686 | - }]; | ||
687 | - } failureBlock:^(NSError *error) { | ||
688 | if (failure) { | 679 | if (failure) { |
689 | - // [_db executeUpdate:@"DROP TABLE requestVariables"]; | 680 | + failure(errorToken); |
690 | - failure(error); | ||
691 | } | 681 | } |
692 | - NSLog(@"Error at token %@", error ); | 682 | + |
693 | - }]; | 683 | +// [self refreshToken:^(NSDictionary *response) { |
684 | +// [self sendContext8:jsonData successBlock:^(NSDictionary *contextResponse) { | ||
685 | +// if (success) { | ||
686 | +// success(contextResponse); | ||
687 | +// } | ||
688 | +// NSLog(@"**************** WARPLY Response *****************" ); | ||
689 | +// NSLog(@"%@", contextResponse ); | ||
690 | +// } failureBlock:^(NSError *error) { | ||
691 | +// if (failure) { | ||
692 | +// failure(error); | ||
693 | +// } | ||
694 | +// }]; | ||
695 | +// } failureBlock:^(NSError *error) { | ||
696 | +// if (failure) { | ||
697 | +// // [_db executeUpdate:@"DROP TABLE requestVariables"]; | ||
698 | +// failure(error); | ||
699 | +// } | ||
700 | +// NSLog(@"Error at token %@", error ); | ||
701 | +// }]; | ||
694 | } else { | 702 | } else { |
695 | NSLog(@"Error at get Campaigns Personalized %@", error ); | 703 | NSLog(@"Error at get Campaigns Personalized %@", error ); |
696 | failure(error); | 704 | failure(error); |
... | @@ -1685,23 +1693,31 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) | ... | @@ -1685,23 +1693,31 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) |
1685 | dict = [error userInfo]; | 1693 | dict = [error userInfo]; |
1686 | NSString* errorCode = [dict objectForKey:@"NSLocalizedDescription"]; | 1694 | NSString* errorCode = [dict objectForKey:@"NSLocalizedDescription"]; |
1687 | if ([errorCode isEqual:@"Request failed: unauthorized (401)"]) { | 1695 | if ([errorCode isEqual:@"Request failed: unauthorized (401)"]) { |
1688 | - [self refreshToken:^(NSDictionary *response) { | 1696 | + |
1689 | - [self sendContext8:jsonData successBlock:^(NSDictionary *contextResponse) { | 1697 | + NSString* errorDomain = [error domain]; |
1690 | - if (success) { | 1698 | + NSError *errorToken = [NSError errorWithDomain:errorDomain code:401 userInfo:dict]; |
1691 | - success(contextResponse); | 1699 | + |
1692 | - } | ||
1693 | - } failureBlock:^(NSError *error) { | ||
1694 | - if (failure) { | ||
1695 | - failure(error); | ||
1696 | - } | ||
1697 | - }]; | ||
1698 | - } failureBlock:^(NSError *error) { | ||
1699 | if (failure) { | 1700 | if (failure) { |
1700 | - // [_db executeUpdate:@"DROP TABLE requestVariables"]; | 1701 | + failure(errorToken); |
1701 | - failure(error); | ||
1702 | } | 1702 | } |
1703 | - NSLog(@"Error at token %@", error ); | 1703 | + |
1704 | - }]; | 1704 | +// [self refreshToken:^(NSDictionary *response) { |
1705 | +// [self sendContext8:jsonData successBlock:^(NSDictionary *contextResponse) { | ||
1706 | +// if (success) { | ||
1707 | +// success(contextResponse); | ||
1708 | +// } | ||
1709 | +// } failureBlock:^(NSError *error) { | ||
1710 | +// if (failure) { | ||
1711 | +// failure(error); | ||
1712 | +// } | ||
1713 | +// }]; | ||
1714 | +// } failureBlock:^(NSError *error) { | ||
1715 | +// if (failure) { | ||
1716 | +// // [_db executeUpdate:@"DROP TABLE requestVariables"]; | ||
1717 | +// failure(error); | ||
1718 | +// } | ||
1719 | +// NSLog(@"Error at token %@", error ); | ||
1720 | +// }]; | ||
1705 | } else { | 1721 | } else { |
1706 | NSLog(@"Error at change password %@", error ); | 1722 | NSLog(@"Error at change password %@", error ); |
1707 | failure(error); | 1723 | failure(error); |
... | @@ -1727,26 +1743,50 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) | ... | @@ -1727,26 +1743,50 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) |
1727 | dict = [error userInfo]; | 1743 | dict = [error userInfo]; |
1728 | NSString* errorCode = [dict objectForKey:@"NSLocalizedDescription"]; | 1744 | NSString* errorCode = [dict objectForKey:@"NSLocalizedDescription"]; |
1729 | if ([errorCode isEqual:@"Request failed: unauthorized (401)"]) { | 1745 | if ([errorCode isEqual:@"Request failed: unauthorized (401)"]) { |
1730 | - [self refreshToken:^(NSDictionary *response) { | 1746 | +// NSLog(@"=== error Dictionary: %@", dict ); |
1731 | - [self sendContext8:jsonData successBlock:^(NSDictionary *contextResponse) { | 1747 | +// NSLog(@"=== errorCode: %@", errorCode ); |
1732 | - if (success) { | 1748 | +// |
1733 | - success(contextResponse); | 1749 | +// NSInteger errorCodeInt = [error code]; |
1734 | - } | 1750 | +// NSLog(@"=== errorCodeInt: %ld", (long)errorCodeInt ); |
1735 | - NSLog(@"**************** WARPLY Response *****************" ); | 1751 | +// |
1736 | - NSLog(@"%@", contextResponse ); | 1752 | +// |
1737 | - } failureBlock:^(NSError *error) { | 1753 | +// NSString* errorUnderlyingError = [dict objectForKey:@"NSUnderlyingError"]; |
1754 | +// NSLog(@"=== errorUnderlyingError: %@", errorUnderlyingError ); | ||
1755 | +// | ||
1756 | +// NSString* errorUserInfo = [dict objectForKey:@"UserInfo"]; | ||
1757 | +// NSLog(@"=== errorUserInfo: %@", errorUserInfo ); | ||
1758 | + | ||
1759 | +// NSString* errorCode = [dict objectForKey:@"UserInfo"]; | ||
1760 | + | ||
1761 | +// NSError *errorToken = [NSError errorWithDomain:WARP_ERROR_DOMAIN code:401 userInfo:@{NSLocalizedDescriptionKey: NSLocalizedString(@"Empty response", @"Warply")}]; | ||
1762 | + | ||
1763 | + NSString* errorDomain = [error domain]; | ||
1764 | + NSError *errorToken = [NSError errorWithDomain:errorDomain code:401 userInfo:dict]; | ||
1738 | 1765 | ||
1739 | if (failure) { | 1766 | if (failure) { |
1740 | - failure(error); | 1767 | + failure(errorToken); |
1741 | - } | ||
1742 | - }]; | ||
1743 | - } failureBlock:^(NSError *error) { | ||
1744 | - if (failure) { | ||
1745 | - // [_db executeUpdate:@"DROP TABLE requestVariables"]; | ||
1746 | - failure(error); | ||
1747 | } | 1768 | } |
1748 | - NSLog(@"Error at token %@", error ); | 1769 | + |
1749 | - }]; | 1770 | +// [self refreshToken:^(NSDictionary *response) { |
1771 | +// [self sendContext8:jsonData successBlock:^(NSDictionary *contextResponse) { | ||
1772 | +// if (success) { | ||
1773 | +// success(contextResponse); | ||
1774 | +// } | ||
1775 | +// NSLog(@"**************** WARPLY Response *****************" ); | ||
1776 | +// NSLog(@"%@", contextResponse ); | ||
1777 | +// } failureBlock:^(NSError *error) { | ||
1778 | +// | ||
1779 | +// if (failure) { | ||
1780 | +// failure(error); | ||
1781 | +// } | ||
1782 | +// }]; | ||
1783 | +// } failureBlock:^(NSError *error) { | ||
1784 | +// if (failure) { | ||
1785 | +// // [_db executeUpdate:@"DROP TABLE requestVariables"]; | ||
1786 | +// failure(error); | ||
1787 | +// } | ||
1788 | +// NSLog(@"Error at token %@", error ); | ||
1789 | +// }]; | ||
1750 | } else { | 1790 | } else { |
1751 | NSLog(@"Error at get profile %@", error ); | 1791 | NSLog(@"Error at get profile %@", error ); |
1752 | failure(error); | 1792 | failure(error); |
... | @@ -1791,25 +1831,33 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) | ... | @@ -1791,25 +1831,33 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) |
1791 | dict = [error userInfo]; | 1831 | dict = [error userInfo]; |
1792 | NSString* errorCode = [dict objectForKey:@"NSLocalizedDescription"]; | 1832 | NSString* errorCode = [dict objectForKey:@"NSLocalizedDescription"]; |
1793 | if ([errorCode isEqual:@"Request failed: unauthorized (401)"]) { | 1833 | if ([errorCode isEqual:@"Request failed: unauthorized (401)"]) { |
1794 | - [self refreshToken:^(NSDictionary *response) { | 1834 | + |
1795 | - [self sendContext8:jsonData successBlock:^(NSDictionary *contextResponse) { | 1835 | + NSString* errorDomain = [error domain]; |
1796 | - if (success) { | 1836 | + NSError *errorToken = [NSError errorWithDomain:errorDomain code:401 userInfo:dict]; |
1797 | - success(contextResponse); | 1837 | + |
1798 | - } | ||
1799 | - NSLog(@"**************** WARPLY Response *****************" ); | ||
1800 | - NSLog(@"%@", contextResponse ); | ||
1801 | - } failureBlock:^(NSError *error) { | ||
1802 | - if (failure) { | ||
1803 | - failure(error); | ||
1804 | - } | ||
1805 | - }]; | ||
1806 | - } failureBlock:^(NSError *error) { | ||
1807 | if (failure) { | 1838 | if (failure) { |
1808 | - // [_db executeUpdate:@"DROP TABLE requestVariables"]; | 1839 | + failure(errorToken); |
1809 | - failure(error); | ||
1810 | } | 1840 | } |
1811 | - NSLog(@"Error at token %@", error ); | 1841 | + |
1812 | - }]; | 1842 | +// [self refreshToken:^(NSDictionary *response) { |
1843 | +// [self sendContext8:jsonData successBlock:^(NSDictionary *contextResponse) { | ||
1844 | +// if (success) { | ||
1845 | +// success(contextResponse); | ||
1846 | +// } | ||
1847 | +// NSLog(@"**************** WARPLY Response *****************" ); | ||
1848 | +// NSLog(@"%@", contextResponse ); | ||
1849 | +// } failureBlock:^(NSError *error) { | ||
1850 | +// if (failure) { | ||
1851 | +// failure(error); | ||
1852 | +// } | ||
1853 | +// }]; | ||
1854 | +// } failureBlock:^(NSError *error) { | ||
1855 | +// if (failure) { | ||
1856 | +// // [_db executeUpdate:@"DROP TABLE requestVariables"]; | ||
1857 | +// failure(error); | ||
1858 | +// } | ||
1859 | +// NSLog(@"Error at token %@", error ); | ||
1860 | +// }]; | ||
1813 | } else { | 1861 | } else { |
1814 | NSLog(@"Error at post Event %@", error ); | 1862 | NSLog(@"Error at post Event %@", error ); |
1815 | failure(error); | 1863 | failure(error); |
... | @@ -1899,25 +1947,33 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) | ... | @@ -1899,25 +1947,33 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) |
1899 | dict = [error userInfo]; | 1947 | dict = [error userInfo]; |
1900 | NSString* errorCode = [dict objectForKey:@"NSLocalizedDescription"]; | 1948 | NSString* errorCode = [dict objectForKey:@"NSLocalizedDescription"]; |
1901 | if ([errorCode isEqual:@"Request failed: unauthorized (401)"]) { | 1949 | if ([errorCode isEqual:@"Request failed: unauthorized (401)"]) { |
1902 | - [self refreshToken:^(NSDictionary *response) { | 1950 | + |
1903 | - [self sendContext8:jsonData successBlock:^(NSDictionary *contextResponse) { | 1951 | + NSString* errorDomain = [error domain]; |
1904 | - if (success) { | 1952 | + NSError *errorToken = [NSError errorWithDomain:errorDomain code:401 userInfo:dict]; |
1905 | - success(contextResponse); | 1953 | + |
1906 | - } | ||
1907 | - NSLog(@"**************** WARPLY Response *****************" ); | ||
1908 | - NSLog(@"%@", contextResponse ); | ||
1909 | - } failureBlock:^(NSError *error) { | ||
1910 | - if (failure) { | ||
1911 | - failure(error); | ||
1912 | - } | ||
1913 | - }]; | ||
1914 | - } failureBlock:^(NSError *error) { | ||
1915 | if (failure) { | 1954 | if (failure) { |
1916 | - // [_db executeUpdate:@"DROP TABLE requestVariables"]; | 1955 | + failure(errorToken); |
1917 | - failure(error); | ||
1918 | } | 1956 | } |
1919 | - NSLog(@"Error at token %@", error ); | 1957 | + |
1920 | - }]; | 1958 | +// [self refreshToken:^(NSDictionary *response) { |
1959 | +// [self sendContext8:jsonData successBlock:^(NSDictionary *contextResponse) { | ||
1960 | +// if (success) { | ||
1961 | +// success(contextResponse); | ||
1962 | +// } | ||
1963 | +// NSLog(@"**************** WARPLY Response *****************" ); | ||
1964 | +// NSLog(@"%@", contextResponse ); | ||
1965 | +// } failureBlock:^(NSError *error) { | ||
1966 | +// if (failure) { | ||
1967 | +// failure(error); | ||
1968 | +// } | ||
1969 | +// }]; | ||
1970 | +// } failureBlock:^(NSError *error) { | ||
1971 | +// if (failure) { | ||
1972 | +// // [_db executeUpdate:@"DROP TABLE requestVariables"]; | ||
1973 | +// failure(error); | ||
1974 | +// } | ||
1975 | +// NSLog(@"Error at token %@", error ); | ||
1976 | +// }]; | ||
1921 | } else { | 1977 | } else { |
1922 | NSLog(@"Error at edit profile %@", error ); | 1978 | NSLog(@"Error at edit profile %@", error ); |
1923 | failure(error); | 1979 | failure(error); |
... | @@ -1942,25 +1998,33 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) | ... | @@ -1942,25 +1998,33 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) |
1942 | dict = [error userInfo]; | 1998 | dict = [error userInfo]; |
1943 | NSString* errorCode = [dict objectForKey:@"NSLocalizedDescription"]; | 1999 | NSString* errorCode = [dict objectForKey:@"NSLocalizedDescription"]; |
1944 | if ([errorCode isEqual:@"Request failed: unauthorized (401)"]) { | 2000 | if ([errorCode isEqual:@"Request failed: unauthorized (401)"]) { |
1945 | - [self refreshToken:^(NSDictionary *response) { | 2001 | + |
1946 | - [self sendContext8:jsonData successBlock:^(NSDictionary *contextResponse) { | 2002 | + NSString* errorDomain = [error domain]; |
1947 | - if (success) { | 2003 | + NSError *errorToken = [NSError errorWithDomain:errorDomain code:401 userInfo:dict]; |
1948 | - success(contextResponse); | 2004 | + |
1949 | - } | ||
1950 | - NSLog(@"**************** WARPLY Response *****************" ); | ||
1951 | - NSLog(@"%@", contextResponse ); | ||
1952 | - } failureBlock:^(NSError *error) { | ||
1953 | - if (failure) { | ||
1954 | - failure(error); | ||
1955 | - } | ||
1956 | - }]; | ||
1957 | - } failureBlock:^(NSError *error) { | ||
1958 | if (failure) { | 2005 | if (failure) { |
1959 | - // [_db executeUpdate:@"DROP TABLE requestVariables"]; | 2006 | + failure(errorToken); |
1960 | - failure(error); | ||
1961 | } | 2007 | } |
1962 | - NSLog(@"Error at token %@", error ); | 2008 | + |
1963 | - }]; | 2009 | +// [self refreshToken:^(NSDictionary *response) { |
2010 | +// [self sendContext8:jsonData successBlock:^(NSDictionary *contextResponse) { | ||
2011 | +// if (success) { | ||
2012 | +// success(contextResponse); | ||
2013 | +// } | ||
2014 | +// NSLog(@"**************** WARPLY Response *****************" ); | ||
2015 | +// NSLog(@"%@", contextResponse ); | ||
2016 | +// } failureBlock:^(NSError *error) { | ||
2017 | +// if (failure) { | ||
2018 | +// failure(error); | ||
2019 | +// } | ||
2020 | +// }]; | ||
2021 | +// } failureBlock:^(NSError *error) { | ||
2022 | +// if (failure) { | ||
2023 | +// // [_db executeUpdate:@"DROP TABLE requestVariables"]; | ||
2024 | +// failure(error); | ||
2025 | +// } | ||
2026 | +// NSLog(@"Error at token %@", error ); | ||
2027 | +// }]; | ||
1964 | } else { | 2028 | } else { |
1965 | NSLog(@"Error at get pacing details %@", error ); | 2029 | NSLog(@"Error at get pacing details %@", error ); |
1966 | failure(error); | 2030 | failure(error); |
... | @@ -1985,25 +2049,33 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) | ... | @@ -1985,25 +2049,33 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) |
1985 | dict = [error userInfo]; | 2049 | dict = [error userInfo]; |
1986 | NSString* errorCode = [dict objectForKey:@"NSLocalizedDescription"]; | 2050 | NSString* errorCode = [dict objectForKey:@"NSLocalizedDescription"]; |
1987 | if ([errorCode isEqual:@"Request failed: unauthorized (401)"]) { | 2051 | if ([errorCode isEqual:@"Request failed: unauthorized (401)"]) { |
1988 | - [self refreshToken:^(NSDictionary *response) { | 2052 | + |
1989 | - [self sendContext8:jsonData successBlock:^(NSDictionary *contextResponse) { | 2053 | + NSString* errorDomain = [error domain]; |
1990 | - if (success) { | 2054 | + NSError *errorToken = [NSError errorWithDomain:errorDomain code:401 userInfo:dict]; |
1991 | - success(contextResponse); | 2055 | + |
1992 | - } | ||
1993 | - NSLog(@"**************** WARPLY Response *****************" ); | ||
1994 | - NSLog(@"%@", contextResponse ); | ||
1995 | - } failureBlock:^(NSError *error) { | ||
1996 | - if (failure) { | ||
1997 | - failure(error); | ||
1998 | - } | ||
1999 | - }]; | ||
2000 | - } failureBlock:^(NSError *error) { | ||
2001 | if (failure) { | 2056 | if (failure) { |
2002 | - // [_db executeUpdate:@"DROP TABLE requestVariables"]; | 2057 | + failure(errorToken); |
2003 | - failure(error); | ||
2004 | } | 2058 | } |
2005 | - NSLog(@"Error at token %@", error ); | 2059 | + |
2006 | - }]; | 2060 | +// [self refreshToken:^(NSDictionary *response) { |
2061 | +// [self sendContext8:jsonData successBlock:^(NSDictionary *contextResponse) { | ||
2062 | +// if (success) { | ||
2063 | +// success(contextResponse); | ||
2064 | +// } | ||
2065 | +// NSLog(@"**************** WARPLY Response *****************" ); | ||
2066 | +// NSLog(@"%@", contextResponse ); | ||
2067 | +// } failureBlock:^(NSError *error) { | ||
2068 | +// if (failure) { | ||
2069 | +// failure(error); | ||
2070 | +// } | ||
2071 | +// }]; | ||
2072 | +// } failureBlock:^(NSError *error) { | ||
2073 | +// if (failure) { | ||
2074 | +// // [_db executeUpdate:@"DROP TABLE requestVariables"]; | ||
2075 | +// failure(error); | ||
2076 | +// } | ||
2077 | +// NSLog(@"Error at token %@", error ); | ||
2078 | +// }]; | ||
2007 | } else { | 2079 | } else { |
2008 | NSLog(@"Error at set pacing details %@", error ); | 2080 | NSLog(@"Error at set pacing details %@", error ); |
2009 | failure(error); | 2081 | failure(error); |
... | @@ -2065,25 +2137,33 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) | ... | @@ -2065,25 +2137,33 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) |
2065 | dict = [error userInfo]; | 2137 | dict = [error userInfo]; |
2066 | NSString* errorCode = [dict objectForKey:@"NSLocalizedDescription"]; | 2138 | NSString* errorCode = [dict objectForKey:@"NSLocalizedDescription"]; |
2067 | if ([errorCode isEqual:@"Request failed: unauthorized (401)"]) { | 2139 | if ([errorCode isEqual:@"Request failed: unauthorized (401)"]) { |
2068 | - [self refreshToken:^(NSDictionary *response) { | 2140 | + |
2069 | - [self sendContext8:jsonData successBlock:^(NSDictionary *contextResponse) { | 2141 | + NSString* errorDomain = [error domain]; |
2070 | - if (success) { | 2142 | + NSError *errorToken = [NSError errorWithDomain:errorDomain code:401 userInfo:dict]; |
2071 | - success(contextResponse); | 2143 | + |
2072 | - } | ||
2073 | - NSLog(@"**************** WARPLY Response *****************" ); | ||
2074 | - NSLog(@"%@", contextResponse ); | ||
2075 | - } failureBlock:^(NSError *error) { | ||
2076 | - if (failure) { | ||
2077 | - failure(error); | ||
2078 | - } | ||
2079 | - }]; | ||
2080 | - } failureBlock:^(NSError *error) { | ||
2081 | if (failure) { | 2144 | if (failure) { |
2082 | - // [_db executeUpdate:@"DROP TABLE requestVariables"]; | 2145 | + failure(errorToken); |
2083 | - failure(error); | ||
2084 | } | 2146 | } |
2085 | - NSLog(@"Error at token %@", error ); | 2147 | + |
2086 | - }]; | 2148 | +// [self refreshToken:^(NSDictionary *response) { |
2149 | +// [self sendContext8:jsonData successBlock:^(NSDictionary *contextResponse) { | ||
2150 | +// if (success) { | ||
2151 | +// success(contextResponse); | ||
2152 | +// } | ||
2153 | +// NSLog(@"**************** WARPLY Response *****************" ); | ||
2154 | +// NSLog(@"%@", contextResponse ); | ||
2155 | +// } failureBlock:^(NSError *error) { | ||
2156 | +// if (failure) { | ||
2157 | +// failure(error); | ||
2158 | +// } | ||
2159 | +// }]; | ||
2160 | +// } failureBlock:^(NSError *error) { | ||
2161 | +// if (failure) { | ||
2162 | +// // [_db executeUpdate:@"DROP TABLE requestVariables"]; | ||
2163 | +// failure(error); | ||
2164 | +// } | ||
2165 | +// NSLog(@"Error at token %@", error ); | ||
2166 | +// }]; | ||
2087 | } else { | 2167 | } else { |
2088 | NSLog(@"Error at consumer Integration %@", error ); | 2168 | NSLog(@"Error at consumer Integration %@", error ); |
2089 | failure(error); | 2169 | failure(error); |
... | @@ -2106,23 +2186,31 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) | ... | @@ -2106,23 +2186,31 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) |
2106 | dict = [error userInfo]; | 2186 | dict = [error userInfo]; |
2107 | NSString* errorCode = [dict objectForKey:@"NSLocalizedDescription"]; | 2187 | NSString* errorCode = [dict objectForKey:@"NSLocalizedDescription"]; |
2108 | if ([errorCode isEqual:@"Request failed: unauthorized (401)"]) { | 2188 | if ([errorCode isEqual:@"Request failed: unauthorized (401)"]) { |
2109 | - [self refreshToken:^(NSDictionary *response) { | 2189 | + |
2110 | - [self sendContext8:jsonData successBlock:^(NSDictionary *contextResponse) { | 2190 | + NSString* errorDomain = [error domain]; |
2111 | - if (success) { | 2191 | + NSError *errorToken = [NSError errorWithDomain:errorDomain code:401 userInfo:dict]; |
2112 | - success(contextResponse); | 2192 | + |
2113 | - } | ||
2114 | - } failureBlock:^(NSError *error) { | ||
2115 | - if (failure) { | ||
2116 | - failure(error); | ||
2117 | - } | ||
2118 | - }]; | ||
2119 | - } failureBlock:^(NSError *error) { | ||
2120 | if (failure) { | 2193 | if (failure) { |
2121 | - // [_db executeUpdate:@"DROP TABLE requestVariables"]; | 2194 | + failure(errorToken); |
2122 | - failure(error); | ||
2123 | } | 2195 | } |
2124 | - NSLog(@"Error at token %@", error ); | 2196 | + |
2125 | - }]; | 2197 | +// [self refreshToken:^(NSDictionary *response) { |
2198 | +// [self sendContext8:jsonData successBlock:^(NSDictionary *contextResponse) { | ||
2199 | +// if (success) { | ||
2200 | +// success(contextResponse); | ||
2201 | +// } | ||
2202 | +// } failureBlock:^(NSError *error) { | ||
2203 | +// if (failure) { | ||
2204 | +// failure(error); | ||
2205 | +// } | ||
2206 | +// }]; | ||
2207 | +// } failureBlock:^(NSError *error) { | ||
2208 | +// if (failure) { | ||
2209 | +// // [_db executeUpdate:@"DROP TABLE requestVariables"]; | ||
2210 | +// failure(error); | ||
2211 | +// } | ||
2212 | +// NSLog(@"Error at token %@", error ); | ||
2213 | +// }]; | ||
2126 | } else { | 2214 | } else { |
2127 | NSLog(@"Error at change profile image %@", error ); | 2215 | NSLog(@"Error at change profile image %@", error ); |
2128 | failure(error); | 2216 | failure(error); |
... | @@ -2145,23 +2233,31 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) | ... | @@ -2145,23 +2233,31 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) |
2145 | dict = [error userInfo]; | 2233 | dict = [error userInfo]; |
2146 | NSString* errorCode = [dict objectForKey:@"NSLocalizedDescription"]; | 2234 | NSString* errorCode = [dict objectForKey:@"NSLocalizedDescription"]; |
2147 | if ([errorCode isEqual:@"Request failed: unauthorized (401)"]) { | 2235 | if ([errorCode isEqual:@"Request failed: unauthorized (401)"]) { |
2148 | - [self refreshToken:^(NSDictionary *response) { | 2236 | + |
2149 | - [self sendContext8:jsonData successBlock:^(NSDictionary *contextResponse) { | 2237 | + NSString* errorDomain = [error domain]; |
2150 | - if (success) { | 2238 | + NSError *errorToken = [NSError errorWithDomain:errorDomain code:401 userInfo:dict]; |
2151 | - success(contextResponse); | 2239 | + |
2152 | - } | ||
2153 | - } failureBlock:^(NSError *error) { | ||
2154 | - if (failure) { | ||
2155 | - failure(error); | ||
2156 | - } | ||
2157 | - }]; | ||
2158 | - } failureBlock:^(NSError *error) { | ||
2159 | if (failure) { | 2240 | if (failure) { |
2160 | - // [_db executeUpdate:@"DROP TABLE requestVariables"]; | 2241 | + failure(errorToken); |
2161 | - failure(error); | ||
2162 | } | 2242 | } |
2163 | - NSLog(@"Error at token %@", error ); | 2243 | + |
2164 | - }]; | 2244 | +// [self refreshToken:^(NSDictionary *response) { |
2245 | +// [self sendContext8:jsonData successBlock:^(NSDictionary *contextResponse) { | ||
2246 | +// if (success) { | ||
2247 | +// success(contextResponse); | ||
2248 | +// } | ||
2249 | +// } failureBlock:^(NSError *error) { | ||
2250 | +// if (failure) { | ||
2251 | +// failure(error); | ||
2252 | +// } | ||
2253 | +// }]; | ||
2254 | +// } failureBlock:^(NSError *error) { | ||
2255 | +// if (failure) { | ||
2256 | +// // [_db executeUpdate:@"DROP TABLE requestVariables"]; | ||
2257 | +// failure(error); | ||
2258 | +// } | ||
2259 | +// NSLog(@"Error at token %@", error ); | ||
2260 | +// }]; | ||
2165 | } else { | 2261 | } else { |
2166 | NSLog(@"Error at add card %@", error ); | 2262 | NSLog(@"Error at add card %@", error ); |
2167 | failure(error); | 2263 | failure(error); |
... | @@ -2184,23 +2280,31 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) | ... | @@ -2184,23 +2280,31 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) |
2184 | dict = [error userInfo]; | 2280 | dict = [error userInfo]; |
2185 | NSString* errorCode = [dict objectForKey:@"NSLocalizedDescription"]; | 2281 | NSString* errorCode = [dict objectForKey:@"NSLocalizedDescription"]; |
2186 | if ([errorCode isEqual:@"Request failed: unauthorized (401)"]) { | 2282 | if ([errorCode isEqual:@"Request failed: unauthorized (401)"]) { |
2187 | - [self refreshToken:^(NSDictionary *response) { | 2283 | + |
2188 | - [self sendContext8:jsonData successBlock:^(NSDictionary *contextResponse) { | 2284 | + NSString* errorDomain = [error domain]; |
2189 | - if (success) { | 2285 | + NSError *errorToken = [NSError errorWithDomain:errorDomain code:401 userInfo:dict]; |
2190 | - success(contextResponse); | 2286 | + |
2191 | - } | ||
2192 | - } failureBlock:^(NSError *error) { | ||
2193 | - if (failure) { | ||
2194 | - failure(error); | ||
2195 | - } | ||
2196 | - }]; | ||
2197 | - } failureBlock:^(NSError *error) { | ||
2198 | if (failure) { | 2287 | if (failure) { |
2199 | - // [_db executeUpdate:@"DROP TABLE requestVariables"]; | 2288 | + failure(errorToken); |
2200 | - failure(error); | ||
2201 | } | 2289 | } |
2202 | - NSLog(@"Error at token %@", error ); | 2290 | + |
2203 | - }]; | 2291 | +// [self refreshToken:^(NSDictionary *response) { |
2292 | +// [self sendContext8:jsonData successBlock:^(NSDictionary *contextResponse) { | ||
2293 | +// if (success) { | ||
2294 | +// success(contextResponse); | ||
2295 | +// } | ||
2296 | +// } failureBlock:^(NSError *error) { | ||
2297 | +// if (failure) { | ||
2298 | +// failure(error); | ||
2299 | +// } | ||
2300 | +// }]; | ||
2301 | +// } failureBlock:^(NSError *error) { | ||
2302 | +// if (failure) { | ||
2303 | +// // [_db executeUpdate:@"DROP TABLE requestVariables"]; | ||
2304 | +// failure(error); | ||
2305 | +// } | ||
2306 | +// NSLog(@"Error at token %@", error ); | ||
2307 | +// }]; | ||
2204 | } else { | 2308 | } else { |
2205 | NSLog(@"Error at get cards %@", error ); | 2309 | NSLog(@"Error at get cards %@", error ); |
2206 | failure(error); | 2310 | failure(error); |
... | @@ -2223,23 +2327,31 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) | ... | @@ -2223,23 +2327,31 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) |
2223 | dict = [error userInfo]; | 2327 | dict = [error userInfo]; |
2224 | NSString* errorCode = [dict objectForKey:@"NSLocalizedDescription"]; | 2328 | NSString* errorCode = [dict objectForKey:@"NSLocalizedDescription"]; |
2225 | if ([errorCode isEqual:@"Request failed: unauthorized (401)"]) { | 2329 | if ([errorCode isEqual:@"Request failed: unauthorized (401)"]) { |
2226 | - [self refreshToken:^(NSDictionary *response) { | 2330 | + |
2227 | - [self sendContext8:jsonData successBlock:^(NSDictionary *contextResponse) { | 2331 | + NSString* errorDomain = [error domain]; |
2228 | - if (success) { | 2332 | + NSError *errorToken = [NSError errorWithDomain:errorDomain code:401 userInfo:dict]; |
2229 | - success(contextResponse); | 2333 | + |
2230 | - } | ||
2231 | - } failureBlock:^(NSError *error) { | ||
2232 | - if (failure) { | ||
2233 | - failure(error); | ||
2234 | - } | ||
2235 | - }]; | ||
2236 | - } failureBlock:^(NSError *error) { | ||
2237 | if (failure) { | 2334 | if (failure) { |
2238 | - // [_db executeUpdate:@"DROP TABLE requestVariables"]; | 2335 | + failure(errorToken); |
2239 | - failure(error); | ||
2240 | } | 2336 | } |
2241 | - NSLog(@"Error at token %@", error ); | 2337 | + |
2242 | - }]; | 2338 | +// [self refreshToken:^(NSDictionary *response) { |
2339 | +// [self sendContext8:jsonData successBlock:^(NSDictionary *contextResponse) { | ||
2340 | +// if (success) { | ||
2341 | +// success(contextResponse); | ||
2342 | +// } | ||
2343 | +// } failureBlock:^(NSError *error) { | ||
2344 | +// if (failure) { | ||
2345 | +// failure(error); | ||
2346 | +// } | ||
2347 | +// }]; | ||
2348 | +// } failureBlock:^(NSError *error) { | ||
2349 | +// if (failure) { | ||
2350 | +// // [_db executeUpdate:@"DROP TABLE requestVariables"]; | ||
2351 | +// failure(error); | ||
2352 | +// } | ||
2353 | +// NSLog(@"Error at token %@", error ); | ||
2354 | +// }]; | ||
2243 | } else { | 2355 | } else { |
2244 | NSLog(@"Error at get delete card %@", error ); | 2356 | NSLog(@"Error at get delete card %@", error ); |
2245 | failure(error); | 2357 | failure(error); |
... | @@ -2366,25 +2478,33 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) | ... | @@ -2366,25 +2478,33 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) |
2366 | dict = [error userInfo]; | 2478 | dict = [error userInfo]; |
2367 | NSString* errorCode = [dict objectForKey:@"NSLocalizedDescription"]; | 2479 | NSString* errorCode = [dict objectForKey:@"NSLocalizedDescription"]; |
2368 | if ([errorCode isEqual:@"Request failed: unauthorized (401)"]) { | 2480 | if ([errorCode isEqual:@"Request failed: unauthorized (401)"]) { |
2369 | - [self refreshToken:^(NSDictionary *response) { | 2481 | + |
2370 | - [self sendContext8:jsonData successBlock:^(NSDictionary *contextResponse) { | 2482 | + NSString* errorDomain = [error domain]; |
2371 | - if (success) { | 2483 | + NSError *errorToken = [NSError errorWithDomain:errorDomain code:401 userInfo:dict]; |
2372 | - success(contextResponse); | 2484 | + |
2373 | - } | ||
2374 | - NSLog(@"**************** WARPLY Response *****************" ); | ||
2375 | - NSLog(@"%@", contextResponse ); | ||
2376 | - } failureBlock:^(NSError *error) { | ||
2377 | - if (failure) { | ||
2378 | - failure(error); | ||
2379 | - } | ||
2380 | - }]; | ||
2381 | - } failureBlock:^(NSError *error) { | ||
2382 | if (failure) { | 2485 | if (failure) { |
2383 | - // [_db executeUpdate:@"DROP TABLE requestVariables"]; | 2486 | + failure(errorToken); |
2384 | - failure(error); | ||
2385 | } | 2487 | } |
2386 | - NSLog(@"Error at token %@", error ); | 2488 | + |
2387 | - }]; | 2489 | +// [self refreshToken:^(NSDictionary *response) { |
2490 | +// [self sendContext8:jsonData successBlock:^(NSDictionary *contextResponse) { | ||
2491 | +// if (success) { | ||
2492 | +// success(contextResponse); | ||
2493 | +// } | ||
2494 | +// NSLog(@"**************** WARPLY Response *****************" ); | ||
2495 | +// NSLog(@"%@", contextResponse ); | ||
2496 | +// } failureBlock:^(NSError *error) { | ||
2497 | +// if (failure) { | ||
2498 | +// failure(error); | ||
2499 | +// } | ||
2500 | +// }]; | ||
2501 | +// } failureBlock:^(NSError *error) { | ||
2502 | +// if (failure) { | ||
2503 | +// // [_db executeUpdate:@"DROP TABLE requestVariables"]; | ||
2504 | +// failure(error); | ||
2505 | +// } | ||
2506 | +// NSLog(@"Error at token %@", error ); | ||
2507 | +// }]; | ||
2388 | } else { | 2508 | } else { |
2389 | NSLog(@"Error at get coupons %@", error ); | 2509 | NSLog(@"Error at get coupons %@", error ); |
2390 | failure(error); | 2510 | failure(error); |
... | @@ -2407,23 +2527,31 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) | ... | @@ -2407,23 +2527,31 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) |
2407 | dict = [error userInfo]; | 2527 | dict = [error userInfo]; |
2408 | NSString* errorCode = [dict objectForKey:@"NSLocalizedDescription"]; | 2528 | NSString* errorCode = [dict objectForKey:@"NSLocalizedDescription"]; |
2409 | if ([errorCode isEqual:@"Request failed: unauthorized (401)"]) { | 2529 | if ([errorCode isEqual:@"Request failed: unauthorized (401)"]) { |
2410 | - [self refreshToken:^(NSDictionary *response) { | 2530 | + |
2411 | - [self sendContext8:jsonData successBlock:^(NSDictionary *contextResponse) { | 2531 | + NSString* errorDomain = [error domain]; |
2412 | - if (success) { | 2532 | + NSError *errorToken = [NSError errorWithDomain:errorDomain code:401 userInfo:dict]; |
2413 | - success(contextResponse); | 2533 | + |
2414 | - } | ||
2415 | - } failureBlock:^(NSError *error) { | ||
2416 | - if (failure) { | ||
2417 | - failure(error); | ||
2418 | - } | ||
2419 | - }]; | ||
2420 | - } failureBlock:^(NSError *error) { | ||
2421 | if (failure) { | 2534 | if (failure) { |
2422 | - // [_db executeUpdate:@"DROP TABLE requestVariables"]; | 2535 | + failure(errorToken); |
2423 | - failure(error); | ||
2424 | } | 2536 | } |
2425 | - NSLog(@"Error at token %@", error ); | 2537 | + |
2426 | - }]; | 2538 | +// [self refreshToken:^(NSDictionary *response) { |
2539 | +// [self sendContext8:jsonData successBlock:^(NSDictionary *contextResponse) { | ||
2540 | +// if (success) { | ||
2541 | +// success(contextResponse); | ||
2542 | +// } | ||
2543 | +// } failureBlock:^(NSError *error) { | ||
2544 | +// if (failure) { | ||
2545 | +// failure(error); | ||
2546 | +// } | ||
2547 | +// }]; | ||
2548 | +// } failureBlock:^(NSError *error) { | ||
2549 | +// if (failure) { | ||
2550 | +// // [_db executeUpdate:@"DROP TABLE requestVariables"]; | ||
2551 | +// failure(error); | ||
2552 | +// } | ||
2553 | +// NSLog(@"Error at token %@", error ); | ||
2554 | +// }]; | ||
2427 | } else { | 2555 | } else { |
2428 | NSLog(@"Error at get transaction history %@", error ); | 2556 | NSLog(@"Error at get transaction history %@", error ); |
2429 | failure(error); | 2557 | failure(error); |
... | @@ -2446,23 +2574,31 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) | ... | @@ -2446,23 +2574,31 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) |
2446 | dict = [error userInfo]; | 2574 | dict = [error userInfo]; |
2447 | NSString* errorCode = [dict objectForKey:@"NSLocalizedDescription"]; | 2575 | NSString* errorCode = [dict objectForKey:@"NSLocalizedDescription"]; |
2448 | if ([errorCode isEqual:@"Request failed: unauthorized (401)"]) { | 2576 | if ([errorCode isEqual:@"Request failed: unauthorized (401)"]) { |
2449 | - [self refreshToken:^(NSDictionary *response) { | 2577 | + |
2450 | - [self sendContext8:jsonData successBlock:^(NSDictionary *contextResponse) { | 2578 | + NSString* errorDomain = [error domain]; |
2451 | - if (success) { | 2579 | + NSError *errorToken = [NSError errorWithDomain:errorDomain code:401 userInfo:dict]; |
2452 | - success(contextResponse); | 2580 | + |
2453 | - } | ||
2454 | - } failureBlock:^(NSError *error) { | ||
2455 | - if (failure) { | ||
2456 | - failure(error); | ||
2457 | - } | ||
2458 | - }]; | ||
2459 | - } failureBlock:^(NSError *error) { | ||
2460 | if (failure) { | 2581 | if (failure) { |
2461 | - // [_db executeUpdate:@"DROP TABLE requestVariables"]; | 2582 | + failure(errorToken); |
2462 | - failure(error); | ||
2463 | } | 2583 | } |
2464 | - NSLog(@"Error at token %@", error ); | 2584 | + |
2465 | - }]; | 2585 | +// [self refreshToken:^(NSDictionary *response) { |
2586 | +// [self sendContext8:jsonData successBlock:^(NSDictionary *contextResponse) { | ||
2587 | +// if (success) { | ||
2588 | +// success(contextResponse); | ||
2589 | +// } | ||
2590 | +// } failureBlock:^(NSError *error) { | ||
2591 | +// if (failure) { | ||
2592 | +// failure(error); | ||
2593 | +// } | ||
2594 | +// }]; | ||
2595 | +// } failureBlock:^(NSError *error) { | ||
2596 | +// if (failure) { | ||
2597 | +// // [_db executeUpdate:@"DROP TABLE requestVariables"]; | ||
2598 | +// failure(error); | ||
2599 | +// } | ||
2600 | +// NSLog(@"Error at token %@", error ); | ||
2601 | +// }]; | ||
2466 | } else { | 2602 | } else { |
2467 | NSLog(@"Error at get points history %@", error ); | 2603 | NSLog(@"Error at get points history %@", error ); |
2468 | failure(error); | 2604 | failure(error); |
... | @@ -2487,25 +2623,33 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) | ... | @@ -2487,25 +2623,33 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) |
2487 | dict = [error userInfo]; | 2623 | dict = [error userInfo]; |
2488 | NSString* errorCode = [dict objectForKey:@"NSLocalizedDescription"]; | 2624 | NSString* errorCode = [dict objectForKey:@"NSLocalizedDescription"]; |
2489 | if ([errorCode isEqual:@"Request failed: unauthorized (401)"]) { | 2625 | if ([errorCode isEqual:@"Request failed: unauthorized (401)"]) { |
2490 | - [self refreshToken:^(NSDictionary *response) { | 2626 | + |
2491 | - [self sendContext8:jsonData successBlock:^(NSDictionary *contextResponse) { | 2627 | + NSString* errorDomain = [error domain]; |
2492 | - if (success) { | 2628 | + NSError *errorToken = [NSError errorWithDomain:errorDomain code:401 userInfo:dict]; |
2493 | - success(contextResponse); | 2629 | + |
2494 | - } | ||
2495 | - NSLog(@"**************** WARPLY Response *****************" ); | ||
2496 | - NSLog(@"%@", contextResponse ); | ||
2497 | - } failureBlock:^(NSError *error) { | ||
2498 | - if (failure) { | ||
2499 | - failure(error); | ||
2500 | - } | ||
2501 | - }]; | ||
2502 | - } failureBlock:^(NSError *error) { | ||
2503 | if (failure) { | 2630 | if (failure) { |
2504 | - // [_db executeUpdate:@"DROP TABLE requestVariables"]; | 2631 | + failure(errorToken); |
2505 | - failure(error); | ||
2506 | } | 2632 | } |
2507 | - NSLog(@"Error at token %@", error ); | 2633 | + |
2508 | - }]; | 2634 | +// [self refreshToken:^(NSDictionary *response) { |
2635 | +// [self sendContext8:jsonData successBlock:^(NSDictionary *contextResponse) { | ||
2636 | +// if (success) { | ||
2637 | +// success(contextResponse); | ||
2638 | +// } | ||
2639 | +// NSLog(@"**************** WARPLY Response *****************" ); | ||
2640 | +// NSLog(@"%@", contextResponse ); | ||
2641 | +// } failureBlock:^(NSError *error) { | ||
2642 | +// if (failure) { | ||
2643 | +// failure(error); | ||
2644 | +// } | ||
2645 | +// }]; | ||
2646 | +// } failureBlock:^(NSError *error) { | ||
2647 | +// if (failure) { | ||
2648 | +// // [_db executeUpdate:@"DROP TABLE requestVariables"]; | ||
2649 | +// failure(error); | ||
2650 | +// } | ||
2651 | +// NSLog(@"Error at token %@", error ); | ||
2652 | +// }]; | ||
2509 | } else { | 2653 | } else { |
2510 | NSLog(@"Error at get Sharing History %@", error ); | 2654 | NSLog(@"Error at get Sharing History %@", error ); |
2511 | failure(error); | 2655 | failure(error); |
... | @@ -2528,23 +2672,31 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) | ... | @@ -2528,23 +2672,31 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) |
2528 | dict = [error userInfo]; | 2672 | dict = [error userInfo]; |
2529 | NSString* errorCode = [dict objectForKey:@"NSLocalizedDescription"]; | 2673 | NSString* errorCode = [dict objectForKey:@"NSLocalizedDescription"]; |
2530 | if ([errorCode isEqual:@"Request failed: unauthorized (401)"]) { | 2674 | if ([errorCode isEqual:@"Request failed: unauthorized (401)"]) { |
2531 | - [self refreshToken:^(NSDictionary *response) { | 2675 | + |
2532 | - [self sendContext8:jsonData successBlock:^(NSDictionary *contextResponse) { | 2676 | + NSString* errorDomain = [error domain]; |
2533 | - if (success) { | 2677 | + NSError *errorToken = [NSError errorWithDomain:errorDomain code:401 userInfo:dict]; |
2534 | - success(contextResponse); | 2678 | + |
2535 | - } | ||
2536 | - } failureBlock:^(NSError *error) { | ||
2537 | - if (failure) { | ||
2538 | - failure(error); | ||
2539 | - } | ||
2540 | - }]; | ||
2541 | - } failureBlock:^(NSError *error) { | ||
2542 | if (failure) { | 2679 | if (failure) { |
2543 | - // [_db executeUpdate:@"DROP TABLE requestVariables"]; | 2680 | + failure(errorToken); |
2544 | - failure(error); | ||
2545 | } | 2681 | } |
2546 | - NSLog(@"Error at token %@", error ); | 2682 | + |
2547 | - }]; | 2683 | +// [self refreshToken:^(NSDictionary *response) { |
2684 | +// [self sendContext8:jsonData successBlock:^(NSDictionary *contextResponse) { | ||
2685 | +// if (success) { | ||
2686 | +// success(contextResponse); | ||
2687 | +// } | ||
2688 | +// } failureBlock:^(NSError *error) { | ||
2689 | +// if (failure) { | ||
2690 | +// failure(error); | ||
2691 | +// } | ||
2692 | +// }]; | ||
2693 | +// } failureBlock:^(NSError *error) { | ||
2694 | +// if (failure) { | ||
2695 | +// // [_db executeUpdate:@"DROP TABLE requestVariables"]; | ||
2696 | +// failure(error); | ||
2697 | +// } | ||
2698 | +// NSLog(@"Error at token %@", error ); | ||
2699 | +// }]; | ||
2548 | } else { | 2700 | } else { |
2549 | NSLog(@"Error at add address %@", error ); | 2701 | NSLog(@"Error at add address %@", error ); |
2550 | failure(error); | 2702 | failure(error); |
... | @@ -2567,23 +2719,31 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) | ... | @@ -2567,23 +2719,31 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) |
2567 | dict = [error userInfo]; | 2719 | dict = [error userInfo]; |
2568 | NSString* errorCode = [dict objectForKey:@"NSLocalizedDescription"]; | 2720 | NSString* errorCode = [dict objectForKey:@"NSLocalizedDescription"]; |
2569 | if ([errorCode isEqual:@"Request failed: unauthorized (401)"]) { | 2721 | if ([errorCode isEqual:@"Request failed: unauthorized (401)"]) { |
2570 | - [self refreshToken:^(NSDictionary *response) { | 2722 | + |
2571 | - [self sendContext8:jsonData successBlock:^(NSDictionary *contextResponse) { | 2723 | + NSString* errorDomain = [error domain]; |
2572 | - if (success) { | 2724 | + NSError *errorToken = [NSError errorWithDomain:errorDomain code:401 userInfo:dict]; |
2573 | - success(contextResponse); | 2725 | + |
2574 | - } | ||
2575 | - } failureBlock:^(NSError *error) { | ||
2576 | - if (failure) { | ||
2577 | - failure(error); | ||
2578 | - } | ||
2579 | - }]; | ||
2580 | - } failureBlock:^(NSError *error) { | ||
2581 | if (failure) { | 2726 | if (failure) { |
2582 | - // [_db executeUpdate:@"DROP TABLE requestVariables"]; | 2727 | + failure(errorToken); |
2583 | - failure(error); | ||
2584 | } | 2728 | } |
2585 | - NSLog(@"Error at token %@", error ); | 2729 | + |
2586 | - }]; | 2730 | +// [self refreshToken:^(NSDictionary *response) { |
2731 | +// [self sendContext8:jsonData successBlock:^(NSDictionary *contextResponse) { | ||
2732 | +// if (success) { | ||
2733 | +// success(contextResponse); | ||
2734 | +// } | ||
2735 | +// } failureBlock:^(NSError *error) { | ||
2736 | +// if (failure) { | ||
2737 | +// failure(error); | ||
2738 | +// } | ||
2739 | +// }]; | ||
2740 | +// } failureBlock:^(NSError *error) { | ||
2741 | +// if (failure) { | ||
2742 | +// // [_db executeUpdate:@"DROP TABLE requestVariables"]; | ||
2743 | +// failure(error); | ||
2744 | +// } | ||
2745 | +// NSLog(@"Error at token %@", error ); | ||
2746 | +// }]; | ||
2587 | } else { | 2747 | } else { |
2588 | NSLog(@"Error at get address %@", error ); | 2748 | NSLog(@"Error at get address %@", error ); |
2589 | failure(error); | 2749 | failure(error); |
... | @@ -2651,23 +2811,31 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) | ... | @@ -2651,23 +2811,31 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) |
2651 | dict = [error userInfo]; | 2811 | dict = [error userInfo]; |
2652 | NSString* errorCode = [dict objectForKey:@"NSLocalizedDescription"]; | 2812 | NSString* errorCode = [dict objectForKey:@"NSLocalizedDescription"]; |
2653 | if ([errorCode isEqual:@"Request failed: unauthorized (401)"]) { | 2813 | if ([errorCode isEqual:@"Request failed: unauthorized (401)"]) { |
2654 | - [self refreshToken:^(NSDictionary *response) { | 2814 | + |
2655 | - [self sendContext8:jsonData successBlock:^(NSDictionary *contextResponse) { | 2815 | + NSString* errorDomain = [error domain]; |
2656 | - if (success) { | 2816 | + NSError *errorToken = [NSError errorWithDomain:errorDomain code:401 userInfo:dict]; |
2657 | - success(contextResponse); | 2817 | + |
2658 | - } | ||
2659 | - } failureBlock:^(NSError *error) { | ||
2660 | - if (failure) { | ||
2661 | - failure(error); | ||
2662 | - } | ||
2663 | - }]; | ||
2664 | - } failureBlock:^(NSError *error) { | ||
2665 | if (failure) { | 2818 | if (failure) { |
2666 | - // [_db executeUpdate:@"DROP TABLE requestVariables"]; | 2819 | + failure(errorToken); |
2667 | - failure(error); | ||
2668 | } | 2820 | } |
2669 | - NSLog(@"Error at token %@", error ); | 2821 | + |
2670 | - }]; | 2822 | +// [self refreshToken:^(NSDictionary *response) { |
2823 | +// [self sendContext8:jsonData successBlock:^(NSDictionary *contextResponse) { | ||
2824 | +// if (success) { | ||
2825 | +// success(contextResponse); | ||
2826 | +// } | ||
2827 | +// } failureBlock:^(NSError *error) { | ||
2828 | +// if (failure) { | ||
2829 | +// failure(error); | ||
2830 | +// } | ||
2831 | +// }]; | ||
2832 | +// } failureBlock:^(NSError *error) { | ||
2833 | +// if (failure) { | ||
2834 | +// // [_db executeUpdate:@"DROP TABLE requestVariables"]; | ||
2835 | +// failure(error); | ||
2836 | +// } | ||
2837 | +// NSLog(@"Error at token %@", error ); | ||
2838 | +// }]; | ||
2671 | } else { | 2839 | } else { |
2672 | NSLog(@"Error at edit address %@", error ); | 2840 | NSLog(@"Error at edit address %@", error ); |
2673 | failure(error); | 2841 | failure(error); |
... | @@ -2690,23 +2858,31 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) | ... | @@ -2690,23 +2858,31 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) |
2690 | dict = [error userInfo]; | 2858 | dict = [error userInfo]; |
2691 | NSString* errorCode = [dict objectForKey:@"NSLocalizedDescription"]; | 2859 | NSString* errorCode = [dict objectForKey:@"NSLocalizedDescription"]; |
2692 | if ([errorCode isEqual:@"Request failed: unauthorized (401)"]) { | 2860 | if ([errorCode isEqual:@"Request failed: unauthorized (401)"]) { |
2693 | - [self refreshToken:^(NSDictionary *response) { | 2861 | + |
2694 | - [self sendContext8:jsonData successBlock:^(NSDictionary *contextResponse) { | 2862 | + NSString* errorDomain = [error domain]; |
2695 | - if (success) { | 2863 | + NSError *errorToken = [NSError errorWithDomain:errorDomain code:401 userInfo:dict]; |
2696 | - success(contextResponse); | 2864 | + |
2697 | - } | ||
2698 | - } failureBlock:^(NSError *error) { | ||
2699 | - if (failure) { | ||
2700 | - failure(error); | ||
2701 | - } | ||
2702 | - }]; | ||
2703 | - } failureBlock:^(NSError *error) { | ||
2704 | if (failure) { | 2865 | if (failure) { |
2705 | - // [_db executeUpdate:@"DROP TABLE requestVariables"]; | 2866 | + failure(errorToken); |
2706 | - failure(error); | ||
2707 | } | 2867 | } |
2708 | - NSLog(@"Error at token %@", error ); | 2868 | + |
2709 | - }]; | 2869 | +// [self refreshToken:^(NSDictionary *response) { |
2870 | +// [self sendContext8:jsonData successBlock:^(NSDictionary *contextResponse) { | ||
2871 | +// if (success) { | ||
2872 | +// success(contextResponse); | ||
2873 | +// } | ||
2874 | +// } failureBlock:^(NSError *error) { | ||
2875 | +// if (failure) { | ||
2876 | +// failure(error); | ||
2877 | +// } | ||
2878 | +// }]; | ||
2879 | +// } failureBlock:^(NSError *error) { | ||
2880 | +// if (failure) { | ||
2881 | +// // [_db executeUpdate:@"DROP TABLE requestVariables"]; | ||
2882 | +// failure(error); | ||
2883 | +// } | ||
2884 | +// NSLog(@"Error at token %@", error ); | ||
2885 | +// }]; | ||
2710 | } else { | 2886 | } else { |
2711 | NSLog(@"Error at delete address %@", error ); | 2887 | NSLog(@"Error at delete address %@", error ); |
2712 | failure(error); | 2888 | failure(error); |
... | @@ -2729,23 +2905,31 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) | ... | @@ -2729,23 +2905,31 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) |
2729 | dict = [error userInfo]; | 2905 | dict = [error userInfo]; |
2730 | NSString* errorCode = [dict objectForKey:@"NSLocalizedDescription"]; | 2906 | NSString* errorCode = [dict objectForKey:@"NSLocalizedDescription"]; |
2731 | if ([errorCode isEqual:@"Request failed: unauthorized (401)"]) { | 2907 | if ([errorCode isEqual:@"Request failed: unauthorized (401)"]) { |
2732 | - [self refreshToken:^(NSDictionary *response) { | 2908 | + |
2733 | - [self sendContext8:jsonData successBlock:^(NSDictionary *contextResponse) { | 2909 | + NSString* errorDomain = [error domain]; |
2734 | - if (success) { | 2910 | + NSError *errorToken = [NSError errorWithDomain:errorDomain code:401 userInfo:dict]; |
2735 | - success(contextResponse); | 2911 | + |
2736 | - } | ||
2737 | - } failureBlock:^(NSError *error) { | ||
2738 | - if (failure) { | ||
2739 | - failure(error); | ||
2740 | - } | ||
2741 | - }]; | ||
2742 | - } failureBlock:^(NSError *error) { | ||
2743 | if (failure) { | 2912 | if (failure) { |
2744 | - // [_db executeUpdate:@"DROP TABLE requestVariables"]; | 2913 | + failure(errorToken); |
2745 | - failure(error); | ||
2746 | } | 2914 | } |
2747 | - NSLog(@"Error at token %@", error ); | 2915 | + |
2748 | - }]; | 2916 | +// [self refreshToken:^(NSDictionary *response) { |
2917 | +// [self sendContext8:jsonData successBlock:^(NSDictionary *contextResponse) { | ||
2918 | +// if (success) { | ||
2919 | +// success(contextResponse); | ||
2920 | +// } | ||
2921 | +// } failureBlock:^(NSError *error) { | ||
2922 | +// if (failure) { | ||
2923 | +// failure(error); | ||
2924 | +// } | ||
2925 | +// }]; | ||
2926 | +// } failureBlock:^(NSError *error) { | ||
2927 | +// if (failure) { | ||
2928 | +// // [_db executeUpdate:@"DROP TABLE requestVariables"]; | ||
2929 | +// failure(error); | ||
2930 | +// } | ||
2931 | +// NSLog(@"Error at token %@", error ); | ||
2932 | +// }]; | ||
2749 | } else { | 2933 | } else { |
2750 | NSLog(@"Error at redeem coupons %@", error ); | 2934 | NSLog(@"Error at redeem coupons %@", error ); |
2751 | failure(error); | 2935 | failure(error); |
... | @@ -2989,25 +3173,33 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) | ... | @@ -2989,25 +3173,33 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) |
2989 | dict = [error userInfo]; | 3173 | dict = [error userInfo]; |
2990 | NSString* errorCode = [dict objectForKey:@"NSLocalizedDescription"]; | 3174 | NSString* errorCode = [dict objectForKey:@"NSLocalizedDescription"]; |
2991 | if ([errorCode isEqual:@"Request failed: unauthorized (401)"]) { | 3175 | if ([errorCode isEqual:@"Request failed: unauthorized (401)"]) { |
2992 | - [self refreshToken:^(NSDictionary *response) { | 3176 | + |
2993 | - [self sendContext8:jsonData successBlock:^(NSDictionary *contextResponse) { | 3177 | + NSString* errorDomain = [error domain]; |
2994 | - if (success) { | 3178 | + NSError *errorToken = [NSError errorWithDomain:errorDomain code:401 userInfo:dict]; |
2995 | - success(contextResponse); | 3179 | + |
2996 | - } | ||
2997 | - NSLog(@"**************** WARPLY Response *****************" ); | ||
2998 | - NSLog(@"%@", contextResponse ); | ||
2999 | - } failureBlock:^(NSError *error) { | ||
3000 | - if (failure) { | ||
3001 | - failure(error); | ||
3002 | - } | ||
3003 | - }]; | ||
3004 | - } failureBlock:^(NSError *error) { | ||
3005 | if (failure) { | 3180 | if (failure) { |
3006 | - // [_db executeUpdate:@"DROP TABLE requestVariables"]; | 3181 | + failure(errorToken); |
3007 | - failure(error); | ||
3008 | } | 3182 | } |
3009 | - NSLog(@"Error at token %@", error ); | 3183 | + |
3010 | - }]; | 3184 | +// [self refreshToken:^(NSDictionary *response) { |
3185 | +// [self sendContext8:jsonData successBlock:^(NSDictionary *contextResponse) { | ||
3186 | +// if (success) { | ||
3187 | +// success(contextResponse); | ||
3188 | +// } | ||
3189 | +// NSLog(@"**************** WARPLY Response *****************" ); | ||
3190 | +// NSLog(@"%@", contextResponse ); | ||
3191 | +// } failureBlock:^(NSError *error) { | ||
3192 | +// if (failure) { | ||
3193 | +// failure(error); | ||
3194 | +// } | ||
3195 | +// }]; | ||
3196 | +// } failureBlock:^(NSError *error) { | ||
3197 | +// if (failure) { | ||
3198 | +// // [_db executeUpdate:@"DROP TABLE requestVariables"]; | ||
3199 | +// failure(error); | ||
3200 | +// } | ||
3201 | +// NSLog(@"Error at token %@", error ); | ||
3202 | +// }]; | ||
3011 | } else { | 3203 | } else { |
3012 | NSLog(@"Error at redeem coupon sets %@", error ); | 3204 | NSLog(@"Error at redeem coupon sets %@", error ); |
3013 | failure(error); | 3205 | failure(error); |
... | @@ -3051,25 +3243,33 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) | ... | @@ -3051,25 +3243,33 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) |
3051 | dict = [error userInfo]; | 3243 | dict = [error userInfo]; |
3052 | NSString* errorCode = [dict objectForKey:@"NSLocalizedDescription"]; | 3244 | NSString* errorCode = [dict objectForKey:@"NSLocalizedDescription"]; |
3053 | if ([errorCode isEqual:@"Request failed: unauthorized (401)"]) { | 3245 | if ([errorCode isEqual:@"Request failed: unauthorized (401)"]) { |
3054 | - [self refreshToken:^(NSDictionary *response) { | 3246 | + |
3055 | - [self sendContext8:jsonData successBlock:^(NSDictionary *contextResponse) { | 3247 | + NSString* errorDomain = [error domain]; |
3056 | - if (success) { | 3248 | + NSError *errorToken = [NSError errorWithDomain:errorDomain code:401 userInfo:dict]; |
3057 | - success(contextResponse); | 3249 | + |
3058 | - } | ||
3059 | - NSLog(@"**************** WARPLY Response *****************" ); | ||
3060 | - NSLog(@"%@", contextResponse ); | ||
3061 | - } failureBlock:^(NSError *error) { | ||
3062 | - if (failure) { | ||
3063 | - failure(error); | ||
3064 | - } | ||
3065 | - }]; | ||
3066 | - } failureBlock:^(NSError *error) { | ||
3067 | if (failure) { | 3250 | if (failure) { |
3068 | - // [_db executeUpdate:@"DROP TABLE requestVariables"]; | 3251 | + failure(errorToken); |
3069 | - failure(error); | ||
3070 | } | 3252 | } |
3071 | - NSLog(@"Error at token %@", error ); | 3253 | + |
3072 | - }]; | 3254 | +// [self refreshToken:^(NSDictionary *response) { |
3255 | +// [self sendContext8:jsonData successBlock:^(NSDictionary *contextResponse) { | ||
3256 | +// if (success) { | ||
3257 | +// success(contextResponse); | ||
3258 | +// } | ||
3259 | +// NSLog(@"**************** WARPLY Response *****************" ); | ||
3260 | +// NSLog(@"%@", contextResponse ); | ||
3261 | +// } failureBlock:^(NSError *error) { | ||
3262 | +// if (failure) { | ||
3263 | +// failure(error); | ||
3264 | +// } | ||
3265 | +// }]; | ||
3266 | +// } failureBlock:^(NSError *error) { | ||
3267 | +// if (failure) { | ||
3268 | +// // [_db executeUpdate:@"DROP TABLE requestVariables"]; | ||
3269 | +// failure(error); | ||
3270 | +// } | ||
3271 | +// NSLog(@"Error at token %@", error ); | ||
3272 | +// }]; | ||
3073 | } else { | 3273 | } else { |
3074 | NSLog(@"Error at redeem coupon sets %@", error ); | 3274 | NSLog(@"Error at redeem coupon sets %@", error ); |
3075 | failure(error); | 3275 | failure(error); |
... | @@ -3094,25 +3294,33 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) | ... | @@ -3094,25 +3294,33 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) |
3094 | dict = [error userInfo]; | 3294 | dict = [error userInfo]; |
3095 | NSString* errorCode = [dict objectForKey:@"NSLocalizedDescription"]; | 3295 | NSString* errorCode = [dict objectForKey:@"NSLocalizedDescription"]; |
3096 | if ([errorCode isEqual:@"Request failed: unauthorized (401)"]) { | 3296 | if ([errorCode isEqual:@"Request failed: unauthorized (401)"]) { |
3097 | - [self refreshToken:^(NSDictionary *response) { | 3297 | + |
3098 | - [self sendContext8:jsonData successBlock:^(NSDictionary *contextResponse) { | 3298 | + NSString* errorDomain = [error domain]; |
3099 | - if (success) { | 3299 | + NSError *errorToken = [NSError errorWithDomain:errorDomain code:401 userInfo:dict]; |
3100 | - success(contextResponse); | 3300 | + |
3101 | - } | ||
3102 | - NSLog(@"**************** WARPLY Response *****************" ); | ||
3103 | - NSLog(@"%@", contextResponse ); | ||
3104 | - } failureBlock:^(NSError *error) { | ||
3105 | - if (failure) { | ||
3106 | - failure(error); | ||
3107 | - } | ||
3108 | - }]; | ||
3109 | - } failureBlock:^(NSError *error) { | ||
3110 | if (failure) { | 3301 | if (failure) { |
3111 | - // [_db executeUpdate:@"DROP TABLE requestVariables"]; | 3302 | + failure(errorToken); |
3112 | - failure(error); | ||
3113 | } | 3303 | } |
3114 | - NSLog(@"Error at token %@", error ); | 3304 | + |
3115 | - }]; | 3305 | +// [self refreshToken:^(NSDictionary *response) { |
3306 | +// [self sendContext8:jsonData successBlock:^(NSDictionary *contextResponse) { | ||
3307 | +// if (success) { | ||
3308 | +// success(contextResponse); | ||
3309 | +// } | ||
3310 | +// NSLog(@"**************** WARPLY Response *****************" ); | ||
3311 | +// NSLog(@"%@", contextResponse ); | ||
3312 | +// } failureBlock:^(NSError *error) { | ||
3313 | +// if (failure) { | ||
3314 | +// failure(error); | ||
3315 | +// } | ||
3316 | +// }]; | ||
3317 | +// } failureBlock:^(NSError *error) { | ||
3318 | +// if (failure) { | ||
3319 | +// // [_db executeUpdate:@"DROP TABLE requestVariables"]; | ||
3320 | +// failure(error); | ||
3321 | +// } | ||
3322 | +// NSLog(@"Error at token %@", error ); | ||
3323 | +// }]; | ||
3116 | } else { | 3324 | } else { |
3117 | NSLog(@"Error at cosmote Coupon Sharing %@", error ); | 3325 | NSLog(@"Error at cosmote Coupon Sharing %@", error ); |
3118 | failure(error); | 3326 | failure(error); |
... | @@ -3137,25 +3345,33 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) | ... | @@ -3137,25 +3345,33 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) |
3137 | dict = [error userInfo]; | 3345 | dict = [error userInfo]; |
3138 | NSString* errorCode = [dict objectForKey:@"NSLocalizedDescription"]; | 3346 | NSString* errorCode = [dict objectForKey:@"NSLocalizedDescription"]; |
3139 | if ([errorCode isEqual:@"Request failed: unauthorized (401)"]) { | 3347 | if ([errorCode isEqual:@"Request failed: unauthorized (401)"]) { |
3140 | - [self refreshToken:^(NSDictionary *response) { | 3348 | + |
3141 | - [self sendContext8:jsonData successBlock:^(NSDictionary *contextResponse) { | 3349 | + NSString* errorDomain = [error domain]; |
3142 | - if (success) { | 3350 | + NSError *errorToken = [NSError errorWithDomain:errorDomain code:401 userInfo:dict]; |
3143 | - success(contextResponse); | 3351 | + |
3144 | - } | ||
3145 | - NSLog(@"**************** WARPLY Response *****************" ); | ||
3146 | - NSLog(@"%@", contextResponse ); | ||
3147 | - } failureBlock:^(NSError *error) { | ||
3148 | - if (failure) { | ||
3149 | - failure(error); | ||
3150 | - } | ||
3151 | - }]; | ||
3152 | - } failureBlock:^(NSError *error) { | ||
3153 | if (failure) { | 3352 | if (failure) { |
3154 | - // [_db executeUpdate:@"DROP TABLE requestVariables"]; | 3353 | + failure(errorToken); |
3155 | - failure(error); | ||
3156 | } | 3354 | } |
3157 | - NSLog(@"Error at token %@", error ); | 3355 | + |
3158 | - }]; | 3356 | +// [self refreshToken:^(NSDictionary *response) { |
3357 | +// [self sendContext8:jsonData successBlock:^(NSDictionary *contextResponse) { | ||
3358 | +// if (success) { | ||
3359 | +// success(contextResponse); | ||
3360 | +// } | ||
3361 | +// NSLog(@"**************** WARPLY Response *****************" ); | ||
3362 | +// NSLog(@"%@", contextResponse ); | ||
3363 | +// } failureBlock:^(NSError *error) { | ||
3364 | +// if (failure) { | ||
3365 | +// failure(error); | ||
3366 | +// } | ||
3367 | +// }]; | ||
3368 | +// } failureBlock:^(NSError *error) { | ||
3369 | +// if (failure) { | ||
3370 | +// // [_db executeUpdate:@"DROP TABLE requestVariables"]; | ||
3371 | +// failure(error); | ||
3372 | +// } | ||
3373 | +// NSLog(@"Error at token %@", error ); | ||
3374 | +// }]; | ||
3159 | } else { | 3375 | } else { |
3160 | NSLog(@"Error at get cosmote sharing %@", error ); | 3376 | NSLog(@"Error at get cosmote sharing %@", error ); |
3161 | failure(error); | 3377 | failure(error); |
... | @@ -3180,25 +3396,33 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) | ... | @@ -3180,25 +3396,33 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) |
3180 | dict = [error userInfo]; | 3396 | dict = [error userInfo]; |
3181 | NSString* errorCode = [dict objectForKey:@"NSLocalizedDescription"]; | 3397 | NSString* errorCode = [dict objectForKey:@"NSLocalizedDescription"]; |
3182 | if ([errorCode isEqual:@"Request failed: unauthorized (401)"]) { | 3398 | if ([errorCode isEqual:@"Request failed: unauthorized (401)"]) { |
3183 | - [self refreshToken:^(NSDictionary *response) { | 3399 | + |
3184 | - [self sendContext8:jsonData successBlock:^(NSDictionary *contextResponse) { | 3400 | + NSString* errorDomain = [error domain]; |
3185 | - if (success) { | 3401 | + NSError *errorToken = [NSError errorWithDomain:errorDomain code:401 userInfo:dict]; |
3186 | - success(contextResponse); | 3402 | + |
3187 | - } | ||
3188 | - NSLog(@"**************** WARPLY Response *****************" ); | ||
3189 | - NSLog(@"%@", contextResponse ); | ||
3190 | - } failureBlock:^(NSError *error) { | ||
3191 | - if (failure) { | ||
3192 | - failure(error); | ||
3193 | - } | ||
3194 | - }]; | ||
3195 | - } failureBlock:^(NSError *error) { | ||
3196 | if (failure) { | 3403 | if (failure) { |
3197 | - // [_db executeUpdate:@"DROP TABLE requestVariables"]; | 3404 | + failure(errorToken); |
3198 | - failure(error); | ||
3199 | } | 3405 | } |
3200 | - NSLog(@"Error at token %@", error ); | 3406 | + |
3201 | - }]; | 3407 | +// [self refreshToken:^(NSDictionary *response) { |
3408 | +// [self sendContext8:jsonData successBlock:^(NSDictionary *contextResponse) { | ||
3409 | +// if (success) { | ||
3410 | +// success(contextResponse); | ||
3411 | +// } | ||
3412 | +// NSLog(@"**************** WARPLY Response *****************" ); | ||
3413 | +// NSLog(@"%@", contextResponse ); | ||
3414 | +// } failureBlock:^(NSError *error) { | ||
3415 | +// if (failure) { | ||
3416 | +// failure(error); | ||
3417 | +// } | ||
3418 | +// }]; | ||
3419 | +// } failureBlock:^(NSError *error) { | ||
3420 | +// if (failure) { | ||
3421 | +// // [_db executeUpdate:@"DROP TABLE requestVariables"]; | ||
3422 | +// failure(error); | ||
3423 | +// } | ||
3424 | +// NSLog(@"Error at token %@", error ); | ||
3425 | +// }]; | ||
3202 | } else { | 3426 | } else { |
3203 | NSLog(@"Error at cosmote retrieve sharing %@", error ); | 3427 | NSLog(@"Error at cosmote retrieve sharing %@", error ); |
3204 | failure(error); | 3428 | failure(error); |
... | @@ -3242,25 +3466,33 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) | ... | @@ -3242,25 +3466,33 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) |
3242 | dict = [error userInfo]; | 3466 | dict = [error userInfo]; |
3243 | NSString* errorCode = [dict objectForKey:@"NSLocalizedDescription"]; | 3467 | NSString* errorCode = [dict objectForKey:@"NSLocalizedDescription"]; |
3244 | if ([errorCode isEqual:@"Request failed: unauthorized (401)"]) { | 3468 | if ([errorCode isEqual:@"Request failed: unauthorized (401)"]) { |
3245 | - [self refreshToken:^(NSDictionary *response) { | 3469 | + |
3246 | - [self sendContext8:jsonData successBlock:^(NSDictionary *contextResponse) { | 3470 | + NSString* errorDomain = [error domain]; |
3247 | - if (success) { | 3471 | + NSError *errorToken = [NSError errorWithDomain:errorDomain code:401 userInfo:dict]; |
3248 | - success(contextResponse); | 3472 | + |
3249 | - } | ||
3250 | - NSLog(@"**************** WARPLY Response *****************" ); | ||
3251 | - NSLog(@"%@", contextResponse ); | ||
3252 | - } failureBlock:^(NSError *error) { | ||
3253 | - if (failure) { | ||
3254 | - failure(error); | ||
3255 | - } | ||
3256 | - }]; | ||
3257 | - } failureBlock:^(NSError *error) { | ||
3258 | if (failure) { | 3473 | if (failure) { |
3259 | - // [_db executeUpdate:@"DROP TABLE requestVariables"]; | 3474 | + failure(errorToken); |
3260 | - failure(error); | ||
3261 | } | 3475 | } |
3262 | - NSLog(@"Error at token %@", error ); | 3476 | + |
3263 | - }]; | 3477 | +// [self refreshToken:^(NSDictionary *response) { |
3478 | +// [self sendContext8:jsonData successBlock:^(NSDictionary *contextResponse) { | ||
3479 | +// if (success) { | ||
3480 | +// success(contextResponse); | ||
3481 | +// } | ||
3482 | +// NSLog(@"**************** WARPLY Response *****************" ); | ||
3483 | +// NSLog(@"%@", contextResponse ); | ||
3484 | +// } failureBlock:^(NSError *error) { | ||
3485 | +// if (failure) { | ||
3486 | +// failure(error); | ||
3487 | +// } | ||
3488 | +// }]; | ||
3489 | +// } failureBlock:^(NSError *error) { | ||
3490 | +// if (failure) { | ||
3491 | +// // [_db executeUpdate:@"DROP TABLE requestVariables"]; | ||
3492 | +// failure(error); | ||
3493 | +// } | ||
3494 | +// NSLog(@"Error at token %@", error ); | ||
3495 | +// }]; | ||
3264 | } else { | 3496 | } else { |
3265 | NSLog(@"Error at submit Order %@", error ); | 3497 | NSLog(@"Error at submit Order %@", error ); |
3266 | failure(error); | 3498 | failure(error); |
... | @@ -3283,23 +3515,31 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) | ... | @@ -3283,23 +3515,31 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) |
3283 | dict = [error userInfo]; | 3515 | dict = [error userInfo]; |
3284 | NSString* errorCode = [dict objectForKey:@"NSLocalizedDescription"]; | 3516 | NSString* errorCode = [dict objectForKey:@"NSLocalizedDescription"]; |
3285 | if ([errorCode isEqual:@"Request failed: unauthorized (401)"]) { | 3517 | if ([errorCode isEqual:@"Request failed: unauthorized (401)"]) { |
3286 | - [self refreshToken:^(NSDictionary *response) { | 3518 | + |
3287 | - [self sendContext8:jsonData successBlock:^(NSDictionary *contextResponse) { | 3519 | + NSString* errorDomain = [error domain]; |
3288 | - if (success) { | 3520 | + NSError *errorToken = [NSError errorWithDomain:errorDomain code:401 userInfo:dict]; |
3289 | - success(contextResponse); | 3521 | + |
3290 | - } | ||
3291 | - } failureBlock:^(NSError *error) { | ||
3292 | - if (failure) { | ||
3293 | - failure(error); | ||
3294 | - } | ||
3295 | - }]; | ||
3296 | - } failureBlock:^(NSError *error) { | ||
3297 | if (failure) { | 3522 | if (failure) { |
3298 | - // [_db executeUpdate:@"DROP TABLE requestVariables"]; | 3523 | + failure(errorToken); |
3299 | - failure(error); | ||
3300 | } | 3524 | } |
3301 | - NSLog(@"Error at token %@", error ); | 3525 | + |
3302 | - }]; | 3526 | +// [self refreshToken:^(NSDictionary *response) { |
3527 | +// [self sendContext8:jsonData successBlock:^(NSDictionary *contextResponse) { | ||
3528 | +// if (success) { | ||
3529 | +// success(contextResponse); | ||
3530 | +// } | ||
3531 | +// } failureBlock:^(NSError *error) { | ||
3532 | +// if (failure) { | ||
3533 | +// failure(error); | ||
3534 | +// } | ||
3535 | +// }]; | ||
3536 | +// } failureBlock:^(NSError *error) { | ||
3537 | +// if (failure) { | ||
3538 | +// // [_db executeUpdate:@"DROP TABLE requestVariables"]; | ||
3539 | +// failure(error); | ||
3540 | +// } | ||
3541 | +// NSLog(@"Error at token %@", error ); | ||
3542 | +// }]; | ||
3303 | } else { | 3543 | } else { |
3304 | NSLog(@"Error at get coupon sets %@", error ); | 3544 | NSLog(@"Error at get coupon sets %@", error ); |
3305 | failure(error); | 3545 | failure(error); | ... | ... |
... | @@ -146,7 +146,7 @@ public class swiftApi { | ... | @@ -146,7 +146,7 @@ public class swiftApi { |
146 | 146 | ||
147 | if (GlobalVariables.trackingStepsEnabled == false) { | 147 | if (GlobalVariables.trackingStepsEnabled == false) { |
148 | // First get meters day value from database | 148 | // First get meters day value from database |
149 | - swiftApi().getPacingDetailsAsync(getPacingCallback) | 149 | + swiftApi().getPacingDetailsAsync(getPacingCallback, failureCallback: {errorCode in }) |
150 | 150 | ||
151 | func getPacingCallback (_ pacingData: swiftApi.PacingDetails?) -> Void { | 151 | func getPacingCallback (_ pacingData: swiftApi.PacingDetails?) -> Void { |
152 | if (pacingData != nil) { | 152 | if (pacingData != nil) { |
... | @@ -168,7 +168,7 @@ public class swiftApi { | ... | @@ -168,7 +168,7 @@ public class swiftApi { |
168 | dateFormatter.dateFormat = "yyyy-MM-dd HH:mm:ss" | 168 | dateFormatter.dateFormat = "yyyy-MM-dd HH:mm:ss" |
169 | let dateString = dateFormatter.string(from: currentDateTime) | 169 | let dateString = dateFormatter.string(from: currentDateTime) |
170 | 170 | ||
171 | - swiftApi().setPacingDetailsAsync(persistedSteps, dateString, setPacingDetailsAsyncCallback) | 171 | + swiftApi().setPacingDetailsAsync(persistedSteps, dateString, setPacingDetailsAsyncCallback, failureCallback: {errorCode in }) |
172 | } | 172 | } |
173 | 173 | ||
174 | func setPacingDetailsAsyncCallback (_ responseData: swiftApi.GenericResponseModel?) -> Void { | 174 | func setPacingDetailsAsyncCallback (_ responseData: swiftApi.GenericResponseModel?) -> Void { |
... | @@ -256,7 +256,7 @@ public class swiftApi { | ... | @@ -256,7 +256,7 @@ public class swiftApi { |
256 | dateFormatter.dateFormat = "yyyy-MM-dd HH:mm:ss" | 256 | dateFormatter.dateFormat = "yyyy-MM-dd HH:mm:ss" |
257 | let dateString = dateFormatter.string(from: currentDateTime) | 257 | let dateString = dateFormatter.string(from: currentDateTime) |
258 | 258 | ||
259 | - swiftApi().setPacingDetailsAsync(persistedSteps, dateString, setPacingDetailsAsyncCallback) | 259 | + swiftApi().setPacingDetailsAsync(persistedSteps, dateString, setPacingDetailsAsyncCallback, failureCallback: {errorCode in }) |
260 | } | 260 | } |
261 | 261 | ||
262 | func setPacingDetailsAsyncCallback (_ responseData: swiftApi.GenericResponseModel?) -> Void { | 262 | func setPacingDetailsAsyncCallback (_ responseData: swiftApi.GenericResponseModel?) -> Void { |
... | @@ -289,7 +289,7 @@ public class swiftApi { | ... | @@ -289,7 +289,7 @@ public class swiftApi { |
289 | dateFormatter.dateFormat = "yyyy-MM-dd HH:mm:ss" | 289 | dateFormatter.dateFormat = "yyyy-MM-dd HH:mm:ss" |
290 | let dateString = dateFormatter.string(from: currentDateTime) | 290 | let dateString = dateFormatter.string(from: currentDateTime) |
291 | 291 | ||
292 | - swiftApi().setPacingDetailsAsync(persistedSteps, dateString, setPacingDetailsAsyncCallback) | 292 | + swiftApi().setPacingDetailsAsync(persistedSteps, dateString, setPacingDetailsAsyncCallback, failureCallback: {errorCode in }) |
293 | } | 293 | } |
294 | 294 | ||
295 | DispatchQueue.main.async { | 295 | DispatchQueue.main.async { |
... | @@ -691,7 +691,7 @@ public class swiftApi { | ... | @@ -691,7 +691,7 @@ public class swiftApi { |
691 | } | 691 | } |
692 | 692 | ||
693 | 693 | ||
694 | - func getCouponsData(_ getCouponsCallback: @escaping (_ couponsData: Array<CouponItemModel>?) -> Void) -> Void { | 694 | + func getCouponsData(_ getCouponsCallback: @escaping (_ couponsData: Array<CouponItemModel>?) -> Void, failureCallback: @escaping (_ errorCode: Int) -> Void) -> Void { |
695 | 695 | ||
696 | var coupons: [AnyHashable : Any]? | 696 | var coupons: [AnyHashable : Any]? |
697 | var couponSets: [AnyHashable : Any]? | 697 | var couponSets: [AnyHashable : Any]? |
... | @@ -731,7 +731,17 @@ public class swiftApi { | ... | @@ -731,7 +731,17 @@ public class swiftApi { |
731 | dynatraceEvent._parameters = nil | 731 | dynatraceEvent._parameters = nil |
732 | SwiftEventBus.post("dynatrace", sender: dynatraceEvent) | 732 | SwiftEventBus.post("dynatrace", sender: dynatraceEvent) |
733 | 733 | ||
734 | - getCouponsCallback(nil) | 734 | + if let error = error as? NSError { |
735 | + if (error.code == 401) { | ||
736 | + let sessionEvent = swiftApi.LoyaltySDKSessionExpiredEventModel() | ||
737 | + sessionEvent._sessionExpired = true | ||
738 | + SwiftEventBus.post("sdk_session_expired", sender: sessionEvent) | ||
739 | + } | ||
740 | + | ||
741 | + failureCallback(error.code) | ||
742 | + } else { | ||
743 | + failureCallback(-1) | ||
744 | + } | ||
735 | } | 745 | } |
736 | 746 | ||
737 | func couponSetsCallback(_ couponSetsData: [AnyHashable : Any]?) -> Void { | 747 | func couponSetsCallback(_ couponSetsData: [AnyHashable : Any]?) -> Void { |
... | @@ -858,8 +868,8 @@ public class swiftApi { | ... | @@ -858,8 +868,8 @@ public class swiftApi { |
858 | }) | 868 | }) |
859 | } | 869 | } |
860 | 870 | ||
861 | - public func getCouponsAsync(_ getCouponsCallback: @escaping (_ couponsData: Array<CouponItemModel>?) -> Void) -> Void { | 871 | + public func getCouponsAsync(_ getCouponsCallback: @escaping (_ couponsData: Array<CouponItemModel>?) -> Void, failureCallback: @escaping (_ errorCode: Int) -> Void) -> Void { |
862 | - CouponsDataModel().getCouponsData(getCouponsCallback) | 872 | + CouponsDataModel().getCouponsData(getCouponsCallback, failureCallback: failureCallback) |
863 | } | 873 | } |
864 | 874 | ||
865 | public class func getCoupons() -> Array<CouponItemModel> { | 875 | public class func getCoupons() -> Array<CouponItemModel> { |
... | @@ -1213,7 +1223,7 @@ public class swiftApi { | ... | @@ -1213,7 +1223,7 @@ public class swiftApi { |
1213 | } | 1223 | } |
1214 | 1224 | ||
1215 | 1225 | ||
1216 | - public func getCampaignsAsyncNew(language: String, filters: [String: Any], _ getCampaignsCallback: @escaping (_ campaignsData: Array<CampaignItemModel>?) -> Void) -> Void { | 1226 | + public func getCampaignsAsyncNew(language: String, filters: [String: Any], _ getCampaignsCallback: @escaping (_ campaignsData: Array<CampaignItemModel>?) -> Void, failureCallback: @escaping (_ errorCode: Int) -> Void) -> Void { |
1217 | let instanceOfMyApi = MyApi() | 1227 | let instanceOfMyApi = MyApi() |
1218 | instanceOfMyApi.getCampaignsAsyncNew(language, filters, campaignsCallback, failureBlock: campaignsFailureCallback) | 1228 | instanceOfMyApi.getCampaignsAsyncNew(language, filters, campaignsCallback, failureBlock: campaignsFailureCallback) |
1219 | 1229 | ||
... | @@ -1277,6 +1287,9 @@ public class swiftApi { | ... | @@ -1277,6 +1287,9 @@ public class swiftApi { |
1277 | getCampaignsCallback(sortedCampaigns); | 1287 | getCampaignsCallback(sortedCampaigns); |
1278 | 1288 | ||
1279 | // SwiftEventBus.post("campaigns_retrieved") | 1289 | // SwiftEventBus.post("campaigns_retrieved") |
1290 | + }, failureCallback: {errorCode in | ||
1291 | + | ||
1292 | + failureCallback(errorCode) | ||
1280 | }) | 1293 | }) |
1281 | 1294 | ||
1282 | } else { | 1295 | } else { |
... | @@ -1313,7 +1326,7 @@ public class swiftApi { | ... | @@ -1313,7 +1326,7 @@ public class swiftApi { |
1313 | } | 1326 | } |
1314 | 1327 | ||
1315 | 1328 | ||
1316 | - public func getCampaignsPersonalizedAsync(language: String, filters: [String: Any], _ getCampaignsCallback: @escaping (_ campaignsData: Array<CampaignItemModel>?) -> Void) -> Void { | 1329 | + public func getCampaignsPersonalizedAsync(language: String, filters: [String: Any], _ getCampaignsCallback: @escaping (_ campaignsData: Array<CampaignItemModel>?) -> Void, failureCallback: @escaping (_ errorCode: Int) -> Void) -> Void { |
1317 | let instanceOfMyApi = MyApi() | 1330 | let instanceOfMyApi = MyApi() |
1318 | instanceOfMyApi.getCampaignsPersonalizedAsync(language, filters, campaignsCallback, failureBlock: campaignsFailureCallback) | 1331 | instanceOfMyApi.getCampaignsPersonalizedAsync(language, filters, campaignsCallback, failureBlock: campaignsFailureCallback) |
1319 | 1332 | ||
... | @@ -1386,7 +1399,17 @@ public class swiftApi { | ... | @@ -1386,7 +1399,17 @@ public class swiftApi { |
1386 | dynatraceEvent._parameters = nil | 1399 | dynatraceEvent._parameters = nil |
1387 | SwiftEventBus.post("dynatrace", sender: dynatraceEvent) | 1400 | SwiftEventBus.post("dynatrace", sender: dynatraceEvent) |
1388 | 1401 | ||
1389 | - getCampaignsCallback(nil) | 1402 | + if let error = error as? NSError { |
1403 | + if (error.code == 401) { | ||
1404 | + let sessionEvent = swiftApi.LoyaltySDKSessionExpiredEventModel() | ||
1405 | + sessionEvent._sessionExpired = true | ||
1406 | + SwiftEventBus.post("sdk_session_expired", sender: sessionEvent) | ||
1407 | + } | ||
1408 | + | ||
1409 | + failureCallback(error.code) | ||
1410 | + } else { | ||
1411 | + failureCallback(-1) | ||
1412 | + } | ||
1390 | } | 1413 | } |
1391 | } | 1414 | } |
1392 | 1415 | ||
... | @@ -2374,7 +2397,7 @@ public class swiftApi { | ... | @@ -2374,7 +2397,7 @@ public class swiftApi { |
2374 | init() { | 2397 | init() { |
2375 | } | 2398 | } |
2376 | 2399 | ||
2377 | - func getProfileData(_ getProfileCallback: @escaping (_ profileData: ProfileModel?) -> Void) -> Void { | 2400 | + func getProfileData(_ getProfileCallback: @escaping (_ profileData: ProfileModel?) -> Void, failureCallback: @escaping (_ errorCode: Int) -> Void) -> Void { |
2378 | 2401 | ||
2379 | let instanceOfMyApi = MyApi() | 2402 | let instanceOfMyApi = MyApi() |
2380 | instanceOfMyApi.getProfileAsync(profileCallback, failureBlock: profileFailureCallback) | 2403 | instanceOfMyApi.getProfileAsync(profileCallback, failureBlock: profileFailureCallback) |
... | @@ -2418,15 +2441,25 @@ public class swiftApi { | ... | @@ -2418,15 +2441,25 @@ public class swiftApi { |
2418 | dynatraceEvent._parameters = nil | 2441 | dynatraceEvent._parameters = nil |
2419 | SwiftEventBus.post("dynatrace", sender: dynatraceEvent) | 2442 | SwiftEventBus.post("dynatrace", sender: dynatraceEvent) |
2420 | 2443 | ||
2421 | - getProfileCallback(nil) | 2444 | + if let error = error as? NSError { |
2445 | + if (error.code == 401) { | ||
2446 | + let sessionEvent = swiftApi.LoyaltySDKSessionExpiredEventModel() | ||
2447 | + sessionEvent._sessionExpired = true | ||
2448 | + SwiftEventBus.post("sdk_session_expired", sender: sessionEvent) | ||
2449 | + } | ||
2450 | + | ||
2451 | + failureCallback(error.code) | ||
2452 | + } else { | ||
2453 | + failureCallback(-1) | ||
2454 | + } | ||
2422 | } | 2455 | } |
2423 | 2456 | ||
2424 | } | 2457 | } |
2425 | } | 2458 | } |
2426 | 2459 | ||
2427 | 2460 | ||
2428 | - public func getProfileAsync(_ getProfileCallback: @escaping (_ profileData: ProfileModel?) -> Void) -> Void { | 2461 | + public func getProfileAsync(_ getProfileCallback: @escaping (_ profileData: ProfileModel?) -> Void, failureCallback: @escaping (_ errorCode: Int) -> Void) -> Void { |
2429 | - ProfileDataModel().getProfileData(getProfileCallback) | 2462 | + ProfileDataModel().getProfileData(getProfileCallback, failureCallback: failureCallback) |
2430 | } | 2463 | } |
2431 | 2464 | ||
2432 | 2465 | ||
... | @@ -2482,7 +2515,7 @@ public class swiftApi { | ... | @@ -2482,7 +2515,7 @@ public class swiftApi { |
2482 | 2515 | ||
2483 | verifyTicketCallback(tempResponse); | 2516 | verifyTicketCallback(tempResponse); |
2484 | 2517 | ||
2485 | - swiftApi().getProfileAsync(getProfileCallback) | 2518 | + swiftApi().getProfileAsync(getProfileCallback, failureCallback: {errorCode in }) |
2486 | 2519 | ||
2487 | } else { | 2520 | } else { |
2488 | let dynatraceEvent = swiftApi.LoyaltySDKDynatraceEventModel() | 2521 | let dynatraceEvent = swiftApi.LoyaltySDKDynatraceEventModel() |
... | @@ -3289,7 +3322,9 @@ public class swiftApi { | ... | @@ -3289,7 +3322,9 @@ public class swiftApi { |
3289 | 3322 | ||
3290 | print("SHARING_ID: " + sharingId) | 3323 | print("SHARING_ID: " + sharingId) |
3291 | 3324 | ||
3292 | - self.cosmoteSharingAsync(sharingId: sharingId, sharingCallback) | 3325 | + self.cosmoteSharingAsync(sharingId: sharingId, sharingCallback, failureCallback: {errorCode in |
3326 | + self.errorSharingDialog(controller) | ||
3327 | + }) | ||
3293 | 3328 | ||
3294 | func sharingCallback (_ sharingData: SharingResponseModel?) -> Void { | 3329 | func sharingCallback (_ sharingData: SharingResponseModel?) -> Void { |
3295 | if (sharingData != nil) { | 3330 | if (sharingData != nil) { |
... | @@ -3341,7 +3376,9 @@ public class swiftApi { | ... | @@ -3341,7 +3376,9 @@ public class swiftApi { |
3341 | alert.addAction(UIAlertAction(title: "Ενεργοποίηση", style: .default, handler: { action in | 3376 | alert.addAction(UIAlertAction(title: "Ενεργοποίηση", style: .default, handler: { action in |
3342 | switch action.style{ | 3377 | switch action.style{ |
3343 | case .default: | 3378 | case .default: |
3344 | - self.cosmoteRetrieveSharingAsync(sharingId: sharingId, accept: true, retrieveSharingCallback) | 3379 | + self.cosmoteRetrieveSharingAsync(sharingId: sharingId, accept: true, retrieveSharingCallback, failureCallback: {errorCode in |
3380 | + self.errorSharingDialog(controller) | ||
3381 | + }) | ||
3345 | 3382 | ||
3346 | case .cancel: | 3383 | case .cancel: |
3347 | print("cancel") | 3384 | print("cancel") |
... | @@ -3362,7 +3399,7 @@ public class swiftApi { | ... | @@ -3362,7 +3399,7 @@ public class swiftApi { |
3362 | if (sharingData?.getStatus == 1) { | 3399 | if (sharingData?.getStatus == 1) { |
3363 | self.acceptSharingDialog(controller) | 3400 | self.acceptSharingDialog(controller) |
3364 | 3401 | ||
3365 | - swiftApi().getCouponsAsync(getCouponsCallback) | 3402 | + swiftApi().getCouponsAsync(getCouponsCallback, failureCallback: {errorCode in }) |
3366 | 3403 | ||
3367 | func getCouponsCallback (_ couponsData: Array<swiftApi.CouponItemModel>?) -> Void { | 3404 | func getCouponsCallback (_ couponsData: Array<swiftApi.CouponItemModel>?) -> Void { |
3368 | if (couponsData != nil) { | 3405 | if (couponsData != nil) { |
... | @@ -3407,7 +3444,9 @@ public class swiftApi { | ... | @@ -3407,7 +3444,9 @@ public class swiftApi { |
3407 | alert.addAction(UIAlertAction(title: "Ενεργοποίηση", style: .default, handler: { action in | 3444 | alert.addAction(UIAlertAction(title: "Ενεργοποίηση", style: .default, handler: { action in |
3408 | switch action.style{ | 3445 | switch action.style{ |
3409 | case .default: | 3446 | case .default: |
3410 | - self.cosmoteRetrieveSharingAsync(sharingId: sharingId, accept: true, retrieveSharingCallback) | 3447 | + self.cosmoteRetrieveSharingAsync(sharingId: sharingId, accept: true, retrieveSharingCallback, failureCallback: {errorCode in |
3448 | + self.errorSharingDialog(controller) | ||
3449 | + }) | ||
3411 | 3450 | ||
3412 | case .cancel: | 3451 | case .cancel: |
3413 | print("cancel") | 3452 | print("cancel") |
... | @@ -3427,7 +3466,7 @@ public class swiftApi { | ... | @@ -3427,7 +3466,7 @@ public class swiftApi { |
3427 | 3466 | ||
3428 | if (sharingData?.getStatus == 1) { | 3467 | if (sharingData?.getStatus == 1) { |
3429 | 3468 | ||
3430 | - swiftApi().getCouponsAsync(getCouponsCallback) | 3469 | + swiftApi().getCouponsAsync(getCouponsCallback, failureCallback: {errorCode in }) |
3431 | 3470 | ||
3432 | func getCouponsCallback (_ couponsData: Array<swiftApi.CouponItemModel>?) -> Void { | 3471 | func getCouponsCallback (_ couponsData: Array<swiftApi.CouponItemModel>?) -> Void { |
3433 | if (couponsData != nil) { | 3472 | if (couponsData != nil) { |
... | @@ -3491,7 +3530,9 @@ public class swiftApi { | ... | @@ -3491,7 +3530,9 @@ public class swiftApi { |
3491 | alert.addAction(UIAlertAction(title: "Απόρριψη", style: .default, handler: { action in | 3530 | alert.addAction(UIAlertAction(title: "Απόρριψη", style: .default, handler: { action in |
3492 | switch action.style{ | 3531 | switch action.style{ |
3493 | case .default: | 3532 | case .default: |
3494 | - self.cosmoteRetrieveSharingAsync(sharingId: sharingId, accept: false, retrieveSharingCallback) | 3533 | + self.cosmoteRetrieveSharingAsync(sharingId: sharingId, accept: false, retrieveSharingCallback, failureCallback: {errorCode in |
3534 | + self.errorSharingDialog(controller) | ||
3535 | + }) | ||
3495 | 3536 | ||
3496 | case .cancel: | 3537 | case .cancel: |
3497 | print("cancel") | 3538 | print("cancel") |
... | @@ -3719,7 +3760,9 @@ public class swiftApi { | ... | @@ -3719,7 +3760,9 @@ public class swiftApi { |
3719 | public func saveCustomerState(_ customer: CustomerStateModel) -> Void { | 3760 | public func saveCustomerState(_ customer: CustomerStateModel) -> Void { |
3720 | GlobalVariables.customerState = customer | 3761 | GlobalVariables.customerState = customer |
3721 | 3762 | ||
3722 | - swiftApi().consumerIntegrationAsync(nonTelco: customer._nonTelco, acceptedConsent: customer._acceptedConsent, msisdnList: customer._msisdnList, guid: customer._guid, consumerIntegrationCallback) | 3763 | + swiftApi().consumerIntegrationAsync(nonTelco: customer._nonTelco, acceptedConsent: customer._acceptedConsent, msisdnList: customer._msisdnList, guid: customer._guid, consumerIntegrationCallback, failureCallback: {errorCode in |
3764 | + print("CUSTOMER STATE ERROR") | ||
3765 | + }) | ||
3723 | 3766 | ||
3724 | func consumerIntegrationCallback (_ response: swiftApi.GenericResponseModel?) -> Void { | 3767 | func consumerIntegrationCallback (_ response: swiftApi.GenericResponseModel?) -> Void { |
3725 | if (response != nil) { | 3768 | if (response != nil) { |
... | @@ -3993,7 +4036,7 @@ public class swiftApi { | ... | @@ -3993,7 +4036,7 @@ public class swiftApi { |
3993 | } | 4036 | } |
3994 | 4037 | ||
3995 | 4038 | ||
3996 | - public func consumerIntegrationAsync(nonTelco: Bool, acceptedConsent: Bool, msisdnList: Array<String>, guid: String, _ consumerIntegrationCallback: @escaping (_ responseData: GenericResponseModel?) -> Void) -> Void { | 4039 | + public func consumerIntegrationAsync(nonTelco: Bool, acceptedConsent: Bool, msisdnList: Array<String>, guid: String, _ consumerIntegrationCallback: @escaping (_ responseData: GenericResponseModel?) -> Void, failureCallback: @escaping (_ errorCode: Int) -> Void) -> Void { |
3997 | 4040 | ||
3998 | let instanceOfMyApi = MyApi() | 4041 | let instanceOfMyApi = MyApi() |
3999 | instanceOfMyApi.consumerIntegrationAsync(nonTelco as NSNumber, acceptedConsent as NSNumber, msisdnList, guid, requestCallback, failureBlock: requestFailureCallback) | 4042 | instanceOfMyApi.consumerIntegrationAsync(nonTelco as NSNumber, acceptedConsent as NSNumber, msisdnList, guid, requestCallback, failureBlock: requestFailureCallback) |
... | @@ -4016,11 +4059,22 @@ public class swiftApi { | ... | @@ -4016,11 +4059,22 @@ public class swiftApi { |
4016 | print("consumerIntegration error: ") | 4059 | print("consumerIntegration error: ") |
4017 | print(error) | 4060 | print(error) |
4018 | print("====================") | 4061 | print("====================") |
4019 | - consumerIntegrationCallback(nil) | 4062 | + |
4063 | + if let error = error as? NSError { | ||
4064 | + if (error.code == 401) { | ||
4065 | + let sessionEvent = swiftApi.LoyaltySDKSessionExpiredEventModel() | ||
4066 | + sessionEvent._sessionExpired = true | ||
4067 | + SwiftEventBus.post("sdk_session_expired", sender: sessionEvent) | ||
4068 | + } | ||
4069 | + | ||
4070 | + failureCallback(error.code) | ||
4071 | + } else { | ||
4072 | + failureCallback(-1) | ||
4073 | + } | ||
4020 | } | 4074 | } |
4021 | } | 4075 | } |
4022 | 4076 | ||
4023 | - public func redeemCouponSetAsync(uuid: String, communication_uuid: String, _ redeemCouponSetCallback: @escaping (_ responseData: GenericResponseModel?) -> Void) -> Void { | 4077 | + public func redeemCouponSetAsync(uuid: String, communication_uuid: String, _ redeemCouponSetCallback: @escaping (_ responseData: GenericResponseModel?) -> Void, failureCallback: @escaping (_ errorCode: Int) -> Void) -> Void { |
4024 | 4078 | ||
4025 | let instanceOfMyApi = MyApi() | 4079 | let instanceOfMyApi = MyApi() |
4026 | instanceOfMyApi.redeemCouponSetAsync(uuid, communication_uuid, requestCallback, failureBlock: requestFailureCallback) | 4080 | instanceOfMyApi.redeemCouponSetAsync(uuid, communication_uuid, requestCallback, failureBlock: requestFailureCallback) |
... | @@ -4043,12 +4097,23 @@ public class swiftApi { | ... | @@ -4043,12 +4097,23 @@ public class swiftApi { |
4043 | print("redeemCouponSet error: ") | 4097 | print("redeemCouponSet error: ") |
4044 | print(error) | 4098 | print(error) |
4045 | print("====================") | 4099 | print("====================") |
4046 | - redeemCouponSetCallback(nil) | 4100 | + |
4101 | + if let error = error as? NSError { | ||
4102 | + if (error.code == 401) { | ||
4103 | + let sessionEvent = swiftApi.LoyaltySDKSessionExpiredEventModel() | ||
4104 | + sessionEvent._sessionExpired = true | ||
4105 | + SwiftEventBus.post("sdk_session_expired", sender: sessionEvent) | ||
4106 | + } | ||
4107 | + | ||
4108 | + failureCallback(error.code) | ||
4109 | + } else { | ||
4110 | + failureCallback(-1) | ||
4111 | + } | ||
4047 | } | 4112 | } |
4048 | } | 4113 | } |
4049 | 4114 | ||
4050 | 4115 | ||
4051 | - 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 { | 4116 | + 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 { |
4052 | 4117 | ||
4053 | let instanceOfMyApi = MyApi() | 4118 | let instanceOfMyApi = MyApi() |
4054 | 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) | 4119 | 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 { | ... | @@ -4071,7 +4136,18 @@ public class swiftApi { |
4071 | print("redeemCouponSet error: ") | 4136 | print("redeemCouponSet error: ") |
4072 | print(error) | 4137 | print(error) |
4073 | print("====================") | 4138 | print("====================") |
4074 | - redeemCouponSetCallback(nil) | 4139 | + |
4140 | + if let error = error as? NSError { | ||
4141 | + if (error.code == 401) { | ||
4142 | + let sessionEvent = swiftApi.LoyaltySDKSessionExpiredEventModel() | ||
4143 | + sessionEvent._sessionExpired = true | ||
4144 | + SwiftEventBus.post("sdk_session_expired", sender: sessionEvent) | ||
4145 | + } | ||
4146 | + | ||
4147 | + failureCallback(error.code) | ||
4148 | + } else { | ||
4149 | + failureCallback(-1) | ||
4150 | + } | ||
4075 | } | 4151 | } |
4076 | } | 4152 | } |
4077 | 4153 | ||
... | @@ -4674,7 +4750,7 @@ public class swiftApi { | ... | @@ -4674,7 +4750,7 @@ public class swiftApi { |
4674 | } | 4750 | } |
4675 | 4751 | ||
4676 | 4752 | ||
4677 | - public func getPacingDetailsAsync(_ getPacingDetailsCallback: @escaping (_ pacingData: PacingDetails?) -> Void) -> Void { | 4753 | + public func getPacingDetailsAsync(_ getPacingDetailsCallback: @escaping (_ pacingData: PacingDetails?) -> Void, failureCallback: @escaping (_ errorCode: Int) -> Void) -> Void { |
4678 | 4754 | ||
4679 | let instanceOfMyApi = MyApi() | 4755 | let instanceOfMyApi = MyApi() |
4680 | instanceOfMyApi.getPacingDetailsAsync(pacingCallback, failureBlock: pacingFailureCallback) | 4756 | instanceOfMyApi.getPacingDetailsAsync(pacingCallback, failureBlock: pacingFailureCallback) |
... | @@ -4704,7 +4780,18 @@ public class swiftApi { | ... | @@ -4704,7 +4780,18 @@ public class swiftApi { |
4704 | 4780 | ||
4705 | func pacingFailureCallback(_ error: Error?) -> Void { | 4781 | func pacingFailureCallback(_ error: Error?) -> Void { |
4706 | print("getPacingDetails error: ") | 4782 | print("getPacingDetails error: ") |
4707 | - getPacingDetailsCallback(nil) | 4783 | + |
4784 | + if let error = error as? NSError { | ||
4785 | + if (error.code == 401) { | ||
4786 | + let sessionEvent = swiftApi.LoyaltySDKSessionExpiredEventModel() | ||
4787 | + sessionEvent._sessionExpired = true | ||
4788 | + SwiftEventBus.post("sdk_session_expired", sender: sessionEvent) | ||
4789 | + } | ||
4790 | + | ||
4791 | + failureCallback(error.code) | ||
4792 | + } else { | ||
4793 | + failureCallback(-1) | ||
4794 | + } | ||
4708 | } | 4795 | } |
4709 | } | 4796 | } |
4710 | 4797 | ||
... | @@ -4729,7 +4816,7 @@ public class swiftApi { | ... | @@ -4729,7 +4816,7 @@ public class swiftApi { |
4729 | } | 4816 | } |
4730 | 4817 | ||
4731 | 4818 | ||
4732 | - public func setPacingDetailsAsync(_ steps: Int, _ date: String, _ setPacingDetailsCallback: @escaping (_ responseData: GenericResponseModel?) -> Void) -> Void { | 4819 | + public func setPacingDetailsAsync(_ steps: Int, _ date: String, _ setPacingDetailsCallback: @escaping (_ responseData: GenericResponseModel?) -> Void, failureCallback: @escaping (_ errorCode: Int) -> Void) -> Void { |
4733 | 4820 | ||
4734 | let instanceOfMyApi = MyApi() | 4821 | let instanceOfMyApi = MyApi() |
4735 | instanceOfMyApi.setPacingDetailsAsync(steps as NSNumber, date, pacingCallback, failureBlock: pacingFailureCallback) | 4822 | instanceOfMyApi.setPacingDetailsAsync(steps as NSNumber, date, pacingCallback, failureBlock: pacingFailureCallback) |
... | @@ -4762,7 +4849,18 @@ public class swiftApi { | ... | @@ -4762,7 +4849,18 @@ public class swiftApi { |
4762 | 4849 | ||
4763 | func pacingFailureCallback(_ error: Error?) -> Void { | 4850 | func pacingFailureCallback(_ error: Error?) -> Void { |
4764 | print("setPacingDetails error: ") | 4851 | print("setPacingDetails error: ") |
4765 | - setPacingDetailsCallback(nil) | 4852 | + |
4853 | + if let error = error as? NSError { | ||
4854 | + if (error.code == 401) { | ||
4855 | + let sessionEvent = swiftApi.LoyaltySDKSessionExpiredEventModel() | ||
4856 | + sessionEvent._sessionExpired = true | ||
4857 | + SwiftEventBus.post("sdk_session_expired", sender: sessionEvent) | ||
4858 | + } | ||
4859 | + | ||
4860 | + failureCallback(error.code) | ||
4861 | + } else { | ||
4862 | + failureCallback(-1) | ||
4863 | + } | ||
4766 | } | 4864 | } |
4767 | } | 4865 | } |
4768 | 4866 | ||
... | @@ -4827,7 +4925,7 @@ public class swiftApi { | ... | @@ -4827,7 +4925,7 @@ public class swiftApi { |
4827 | } | 4925 | } |
4828 | 4926 | ||
4829 | 4927 | ||
4830 | - public func cosmoteSharingAsync(sharingId: String, _ cosmoteSharingCallback: @escaping (_ responseData: SharingResponseModel?) -> Void) -> Void { | 4928 | + public func cosmoteSharingAsync(sharingId: String, _ cosmoteSharingCallback: @escaping (_ responseData: SharingResponseModel?) -> Void, failureCallback: @escaping (_ errorCode: Int) -> Void) -> Void { |
4831 | 4929 | ||
4832 | let instanceOfMyApi = MyApi() | 4930 | let instanceOfMyApi = MyApi() |
4833 | instanceOfMyApi.cosmoteSharingAsync(sharingId, requestCallback, failureBlock: requestFailureCallback) | 4931 | instanceOfMyApi.cosmoteSharingAsync(sharingId, requestCallback, failureBlock: requestFailureCallback) |
... | @@ -4876,12 +4974,22 @@ public class swiftApi { | ... | @@ -4876,12 +4974,22 @@ public class swiftApi { |
4876 | dynatraceEvent._parameters = nil | 4974 | dynatraceEvent._parameters = nil |
4877 | SwiftEventBus.post("dynatrace", sender: dynatraceEvent) | 4975 | SwiftEventBus.post("dynatrace", sender: dynatraceEvent) |
4878 | 4976 | ||
4879 | - cosmoteSharingCallback(nil) | 4977 | + if let error = error as? NSError { |
4978 | + if (error.code == 401) { | ||
4979 | + let sessionEvent = swiftApi.LoyaltySDKSessionExpiredEventModel() | ||
4980 | + sessionEvent._sessionExpired = true | ||
4981 | + SwiftEventBus.post("sdk_session_expired", sender: sessionEvent) | ||
4982 | + } | ||
4983 | + | ||
4984 | + failureCallback(error.code) | ||
4985 | + } else { | ||
4986 | + failureCallback(-1) | ||
4987 | + } | ||
4880 | } | 4988 | } |
4881 | } | 4989 | } |
4882 | 4990 | ||
4883 | 4991 | ||
4884 | - public func cosmoteRetrieveSharingAsync(sharingId: String, accept: Bool, _ cosmoteSharingCallback: @escaping (_ responseData: GenericResponseModel?) -> Void) -> Void { | 4992 | + public func cosmoteRetrieveSharingAsync(sharingId: String, accept: Bool, _ cosmoteSharingCallback: @escaping (_ responseData: GenericResponseModel?) -> Void, failureCallback: @escaping (_ errorCode: Int) -> Void) -> Void { |
4885 | 4993 | ||
4886 | let instanceOfMyApi = MyApi() | 4994 | let instanceOfMyApi = MyApi() |
4887 | instanceOfMyApi.cosmoteRetrieveSharingAsync(sharingId, accept as NSNumber, requestCallback, failureBlock: requestFailureCallback) | 4995 | instanceOfMyApi.cosmoteRetrieveSharingAsync(sharingId, accept as NSNumber, requestCallback, failureBlock: requestFailureCallback) |
... | @@ -4935,7 +5043,17 @@ public class swiftApi { | ... | @@ -4935,7 +5043,17 @@ public class swiftApi { |
4935 | dynatraceEvent._parameters = nil | 5043 | dynatraceEvent._parameters = nil |
4936 | SwiftEventBus.post("dynatrace", sender: dynatraceEvent) | 5044 | SwiftEventBus.post("dynatrace", sender: dynatraceEvent) |
4937 | 5045 | ||
4938 | - cosmoteSharingCallback(nil) | 5046 | + if let error = error as? NSError { |
5047 | + if (error.code == 401) { | ||
5048 | + let sessionEvent = swiftApi.LoyaltySDKSessionExpiredEventModel() | ||
5049 | + sessionEvent._sessionExpired = true | ||
5050 | + SwiftEventBus.post("sdk_session_expired", sender: sessionEvent) | ||
5051 | + } | ||
5052 | + | ||
5053 | + failureCallback(error.code) | ||
5054 | + } else { | ||
5055 | + failureCallback(-1) | ||
5056 | + } | ||
4939 | } | 5057 | } |
4940 | } | 5058 | } |
4941 | 5059 | ||
... | @@ -4981,7 +5099,7 @@ public class swiftApi { | ... | @@ -4981,7 +5099,7 @@ public class swiftApi { |
4981 | } | 5099 | } |
4982 | 5100 | ||
4983 | 5101 | ||
4984 | - public func cosmoteCouponSharingAsync(coupon: String, sender: String, receiver: String, _ couponSharingCallback: @escaping (_ responseData: GenericResponseModel?) -> Void) -> Void { | 5102 | + public func cosmoteCouponSharingAsync(coupon: String, sender: String, receiver: String, _ couponSharingCallback: @escaping (_ responseData: GenericResponseModel?) -> Void, failureCallback: @escaping (_ errorCode: Int) -> Void) -> Void { |
4985 | 5103 | ||
4986 | let instanceOfMyApi = MyApi() | 5104 | let instanceOfMyApi = MyApi() |
4987 | instanceOfMyApi.cosmoteCouponSharingAsync(coupon, sender, receiver, requestCallback, failureBlock: requestFailureCallback) | 5105 | instanceOfMyApi.cosmoteCouponSharingAsync(coupon, sender, receiver, requestCallback, failureBlock: requestFailureCallback) |
... | @@ -5038,12 +5156,22 @@ public class swiftApi { | ... | @@ -5038,12 +5156,22 @@ public class swiftApi { |
5038 | dynatraceEvent._parameters = nil | 5156 | dynatraceEvent._parameters = nil |
5039 | SwiftEventBus.post("dynatrace", sender: dynatraceEvent) | 5157 | SwiftEventBus.post("dynatrace", sender: dynatraceEvent) |
5040 | 5158 | ||
5041 | - couponSharingCallback(nil) | 5159 | + if let error = error as? NSError { |
5160 | + if (error.code == 401) { | ||
5161 | + let sessionEvent = swiftApi.LoyaltySDKSessionExpiredEventModel() | ||
5162 | + sessionEvent._sessionExpired = true | ||
5163 | + SwiftEventBus.post("sdk_session_expired", sender: sessionEvent) | ||
5164 | + } | ||
5165 | + | ||
5166 | + failureCallback(error.code) | ||
5167 | + } else { | ||
5168 | + failureCallback(-1) | ||
5169 | + } | ||
5042 | } | 5170 | } |
5043 | } | 5171 | } |
5044 | 5172 | ||
5045 | 5173 | ||
5046 | - 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 { | 5174 | + 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 { |
5047 | 5175 | ||
5048 | let instanceOfMyApi = MyApi() | 5176 | let instanceOfMyApi = MyApi() |
5049 | 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) | 5177 | 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 { | ... | @@ -5100,12 +5228,22 @@ public class swiftApi { |
5100 | dynatraceEvent._parameters = nil | 5228 | dynatraceEvent._parameters = nil |
5101 | SwiftEventBus.post("dynatrace", sender: dynatraceEvent) | 5229 | SwiftEventBus.post("dynatrace", sender: dynatraceEvent) |
5102 | 5230 | ||
5103 | - submitOrderCallback(nil) | 5231 | + if let error = error as? NSError { |
5232 | + if (error.code == 401) { | ||
5233 | + let sessionEvent = swiftApi.LoyaltySDKSessionExpiredEventModel() | ||
5234 | + sessionEvent._sessionExpired = true | ||
5235 | + SwiftEventBus.post("sdk_session_expired", sender: sessionEvent) | ||
5236 | + } | ||
5237 | + | ||
5238 | + failureCallback(error.code) | ||
5239 | + } else { | ||
5240 | + failureCallback(-1) | ||
5241 | + } | ||
5104 | } | 5242 | } |
5105 | } | 5243 | } |
5106 | 5244 | ||
5107 | 5245 | ||
5108 | - 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 { | 5246 | + 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 { |
5109 | 5247 | ||
5110 | let instanceOfMyApi = MyApi() | 5248 | let instanceOfMyApi = MyApi() |
5111 | instanceOfMyApi.postEventAsync(Session_ID, OfferAudienceLevel, msisdn, UACIOfferTrackingCode, OFFERCODE1, SCORE, ZONE, WAVE, VALIDITY, TREATMENT_CODE, requestCallback, failureBlock: requestFailureCallback) | 5249 | instanceOfMyApi.postEventAsync(Session_ID, OfferAudienceLevel, msisdn, UACIOfferTrackingCode, OFFERCODE1, SCORE, ZONE, WAVE, VALIDITY, TREATMENT_CODE, requestCallback, failureBlock: requestFailureCallback) |
... | @@ -5162,7 +5300,19 @@ public class swiftApi { | ... | @@ -5162,7 +5300,19 @@ public class swiftApi { |
5162 | dynatraceEvent._parameters = nil | 5300 | dynatraceEvent._parameters = nil |
5163 | SwiftEventBus.post("dynatrace", sender: dynatraceEvent) | 5301 | SwiftEventBus.post("dynatrace", sender: dynatraceEvent) |
5164 | 5302 | ||
5165 | - postEventCallback(nil) | 5303 | + if let error = error as? NSError { |
5304 | + if (error.code == 401) { | ||
5305 | + let sessionEvent = swiftApi.LoyaltySDKSessionExpiredEventModel() | ||
5306 | + sessionEvent._sessionExpired = true | ||
5307 | + SwiftEventBus.post("sdk_session_expired", sender: sessionEvent) | ||
5308 | + } | ||
5309 | + | ||
5310 | + failureCallback(error.code) | ||
5311 | + } else { | ||
5312 | + failureCallback(-1) | ||
5313 | + } | ||
5314 | + | ||
5315 | +// postEventCallback(nil) | ||
5166 | } | 5316 | } |
5167 | } | 5317 | } |
5168 | 5318 | ||
... | @@ -5325,7 +5475,7 @@ public class swiftApi { | ... | @@ -5325,7 +5475,7 @@ public class swiftApi { |
5325 | } | 5475 | } |
5326 | 5476 | ||
5327 | 5477 | ||
5328 | - public func getSharingHistoryAsync(_ getSharingHistoryCallback: @escaping (_ sharingHistoryData: Array<SharingCouponModel>?) -> Void) -> Void { | 5478 | + public func getSharingHistoryAsync(_ getSharingHistoryCallback: @escaping (_ sharingHistoryData: Array<SharingCouponModel>?) -> Void, failureCallback: @escaping (_ errorCode: Int) -> Void) -> Void { |
5329 | let instanceOfMyApi = MyApi() | 5479 | let instanceOfMyApi = MyApi() |
5330 | instanceOfMyApi.getSharingHistoryAsync(requestCallback, failureBlock: requestFailureCallback) | 5480 | instanceOfMyApi.getSharingHistoryAsync(requestCallback, failureBlock: requestFailureCallback) |
5331 | 5481 | ||
... | @@ -5394,7 +5544,17 @@ public class swiftApi { | ... | @@ -5394,7 +5544,17 @@ public class swiftApi { |
5394 | dynatraceEvent._parameters = nil | 5544 | dynatraceEvent._parameters = nil |
5395 | SwiftEventBus.post("dynatrace", sender: dynatraceEvent) | 5545 | SwiftEventBus.post("dynatrace", sender: dynatraceEvent) |
5396 | 5546 | ||
5397 | - getSharingHistoryCallback(nil) | 5547 | + if let error = error as? NSError { |
5548 | + if (error.code == 401) { | ||
5549 | + let sessionEvent = swiftApi.LoyaltySDKSessionExpiredEventModel() | ||
5550 | + sessionEvent._sessionExpired = true | ||
5551 | + SwiftEventBus.post("sdk_session_expired", sender: sessionEvent) | ||
5552 | + } | ||
5553 | + | ||
5554 | + failureCallback(error.code) | ||
5555 | + } else { | ||
5556 | + failureCallback(-1) | ||
5557 | + } | ||
5398 | } | 5558 | } |
5399 | } | 5559 | } |
5400 | 5560 | ||
... | @@ -6331,7 +6491,7 @@ public class swiftApi { | ... | @@ -6331,7 +6491,7 @@ public class swiftApi { |
6331 | } | 6491 | } |
6332 | 6492 | ||
6333 | 6493 | ||
6334 | - 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 { | 6494 | + 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 { |
6335 | 6495 | ||
6336 | let instanceOfMyApi = MyApi() | 6496 | let instanceOfMyApi = MyApi() |
6337 | 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) | 6497 | 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 { | ... | @@ -6350,7 +6510,7 @@ public class swiftApi { |
6350 | dynatraceEvent._parameters = nil | 6510 | dynatraceEvent._parameters = nil |
6351 | SwiftEventBus.post("dynatrace", sender: dynatraceEvent) | 6511 | SwiftEventBus.post("dynatrace", sender: dynatraceEvent) |
6352 | 6512 | ||
6353 | - swiftApi().getProfileAsync(getProfileCallback) | 6513 | + swiftApi().getProfileAsync(getProfileCallback, failureCallback: {errorCode in }) |
6354 | } | 6514 | } |
6355 | 6515 | ||
6356 | } else { | 6516 | } else { |
... | @@ -6374,7 +6534,18 @@ public class swiftApi { | ... | @@ -6374,7 +6534,18 @@ public class swiftApi { |
6374 | dynatraceEvent._parameters = nil | 6534 | dynatraceEvent._parameters = nil |
6375 | SwiftEventBus.post("dynatrace", sender: dynatraceEvent) | 6535 | SwiftEventBus.post("dynatrace", sender: dynatraceEvent) |
6376 | 6536 | ||
6377 | - editProfileCallback(nil) | 6537 | + if let error = error as? NSError { |
6538 | + if (error.code == 401) { | ||
6539 | + let sessionEvent = swiftApi.LoyaltySDKSessionExpiredEventModel() | ||
6540 | + sessionEvent._sessionExpired = true | ||
6541 | + SwiftEventBus.post("sdk_session_expired", sender: sessionEvent) | ||
6542 | + } | ||
6543 | + | ||
6544 | + failureCallback(error.code) | ||
6545 | + } else { | ||
6546 | + failureCallback(-1) | ||
6547 | + } | ||
6548 | + | ||
6378 | } | 6549 | } |
6379 | 6550 | ||
6380 | func getProfileCallback (_ profileData: swiftApi.ProfileModel?) -> Void { | 6551 | func getProfileCallback (_ profileData: swiftApi.ProfileModel?) -> Void { |
... | @@ -6428,7 +6599,7 @@ public class swiftApi { | ... | @@ -6428,7 +6599,7 @@ public class swiftApi { |
6428 | 6599 | ||
6429 | func getSingleCampaignAsyncCallback(_ getSingleCampaignData: [AnyHashable: Any]?) -> Void { | 6600 | func getSingleCampaignAsyncCallback(_ getSingleCampaignData: [AnyHashable: Any]?) -> Void { |
6430 | 6601 | ||
6431 | - swiftApi().getCampaignsAsyncNew(language: "en", filters: [String : Any](), getCampaignsCallback) | 6602 | + swiftApi().getCampaignsAsyncNew(language: "en", filters: [String : Any](), getCampaignsCallback, failureCallback: {errorCode in }) |
6432 | 6603 | ||
6433 | func getCampaignsCallback (_ campaignsData: Array<swiftApi.CampaignItemModel>?) -> Void { | 6604 | func getCampaignsCallback (_ campaignsData: Array<swiftApi.CampaignItemModel>?) -> Void { |
6434 | if (campaignsData != nil) { | 6605 | if (campaignsData != nil) { |
... | @@ -6465,7 +6636,7 @@ public class swiftApi { | ... | @@ -6465,7 +6636,7 @@ public class swiftApi { |
6465 | 6636 | ||
6466 | func getSingleCampaignFailureCallback(_ error: Error?) -> Void { | 6637 | func getSingleCampaignFailureCallback(_ error: Error?) -> Void { |
6467 | 6638 | ||
6468 | - swiftApi().getCampaignsAsyncNew(language: "en", filters: [String : Any](), getCampaignsCallback) | 6639 | + swiftApi().getCampaignsAsyncNew(language: "en", filters: [String : Any](), getCampaignsCallback, failureCallback: {errorCode in }) |
6469 | 6640 | ||
6470 | func getCampaignsCallback (_ campaignsData: Array<swiftApi.CampaignItemModel>?) -> Void { | 6641 | func getCampaignsCallback (_ campaignsData: Array<swiftApi.CampaignItemModel>?) -> Void { |
6471 | if (campaignsData != nil) { | 6642 | if (campaignsData != nil) { | ... | ... |
-
Please register or login to post a comment