Manos Chorianopoulos

add failureCallbacks, sdk_session_expired events

......@@ -7,7 +7,7 @@
<key>Pods-SwiftWarplyFramework.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
<integer>1</integer>
</dict>
</dict>
</dict>
......
......@@ -7,7 +7,7 @@
<key>SwiftWarplyFramework.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>1</integer>
<integer>0</integer>
</dict>
</dict>
</dict>
......
......@@ -44,7 +44,7 @@ var timer2: DispatchSourceTimer?
dateFormatter.dateFormat = "yyyy-MM-dd HH:mm:ss"
let dateString = dateFormatter.string(from: currentDateTime)
swiftApi().setPacingDetailsAsync(persistedSteps, dateString, setPacingDetailsAsyncCallback)
swiftApi().setPacingDetailsAsync(persistedSteps, dateString, setPacingDetailsAsyncCallback, failureCallback: {errorCode in })
}
func setPacingDetailsAsyncCallback (_ responseData: swiftApi.GenericResponseModel?) -> Void {
......@@ -161,12 +161,12 @@ var timer2: DispatchSourceTimer?
} else if (eventArray[1] == "addUserTag") {
// SwiftEventBus.post("questionnaire", sender: questionnaireEvent)
swiftApi().getProfileAsync(getProfileCallback)
swiftApi().getProfileAsync(getProfileCallback, failureCallback: {errorCode in })
func getProfileCallback (_ profileData: swiftApi.ProfileModel?) -> Void {
if (profileData != nil) {
DispatchQueue.main.async {
swiftApi().getCampaignsAsyncNew(language: "en", filters: [String : Any](), getCampaignsCallback)
swiftApi().getCampaignsAsyncNew(language: "en", filters: [String : Any](), getCampaignsCallback, failureCallback: {errorCode in })
func getCampaignsCallback (_ campaignsData: Array<swiftApi.CampaignItemModel>?) -> Void {
if (campaignsData != nil) {
......@@ -197,8 +197,8 @@ var timer2: DispatchSourceTimer?
let couponEvent = swiftApi.CouponEventModel()
SwiftEventBus.post("coupon_retrieved", sender: couponEvent)
swiftApi().getCouponsAsync(getCouponsCallback)
swiftApi().getCampaignsAsyncNew(language: "en", filters: [String : Any](), getCampaignsCallback)
swiftApi().getCouponsAsync(getCouponsCallback, failureCallback: {errorCode in })
swiftApi().getCampaignsAsyncNew(language: "en", filters: [String : Any](), getCampaignsCallback, failureCallback: {errorCode in })
func getCouponsCallback (_ couponsData: Array<swiftApi.CouponItemModel>?) -> Void {
if (couponsData != nil) {
......
......@@ -158,7 +158,7 @@ import SwiftEventBus
// MARK: - API CALLS
func getProfileRequest() {
swiftApi().getProfileAsync(getProfileCallback)
swiftApi().getProfileAsync(getProfileCallback, failureCallback: {errorCode in })
}
func getProfileCallback (_ profileData: swiftApi.ProfileModel?) -> Void {
......@@ -173,7 +173,16 @@ import SwiftEventBus
func submitOrderRequest() {
swiftApi().submitOrderAsync(campaign_session_uuid: "", user_msisdn: self.selectedNumber, businessService: (ccms?._businessService ?? ""), offerName: (ccms?._offerName ?? ""), productType: (ccms?._productType ?? ""), provDuration: (ccms?._provDuration ?? ""), noOfRecurrance: (ccms?._noOfRecurrance ?? ""), price: (ccms?._price ?? ""), discount: (ccms?._discount ?? ""), voiceCategory: (ccms?._voiceCategory ?? ""), dataCategory: (ccms?._dataCategory ?? ""), minsValue: (ccms?._minsValue ?? ""), dataValue: (ccms?._dataValue ?? ""), provStepValueMins: (ccms?._provStepValueMins ?? ""),
OfferAudienceLevel: (ccms?._offerAudienceLevel ?? ""), UACIOfferTrackingCode: (ccms?._uaciOfferTrackingCode ?? ""), OFFERCODE1: (ccms?._offerCode1 ?? ""), SCORE: (ccms?._score ?? ""), ZONE: (ccms?._zone ?? ""), WAVE: (ccms?._wave ?? ""), VALIDITY: (ccms?._validity ?? ""), TREATMENT_CODE: (ccms?._treatmentCode ?? ""), ccms_session_id: (ccms?._sessionId ?? ""), notificationMessage: (ccms?._notificationMessage ?? ""),
submitOrderCallback)
submitOrderCallback, failureCallback: {errorCode in
let firebaseEvent = swiftApi.LoyaltySDKFirebaseEventModel()
firebaseEvent._eventName = "loyalty_offer_activated"
firebaseEvent.setParameter = ("name", (self.ccms?._title ?? ""))
firebaseEvent.setParameter = ("type", "gift")
firebaseEvent.setParameter = ("successful", "false")
SwiftEventBus.post("firebase", sender: firebaseEvent)
self.showDialog("Αποτυχία","Κάτι πήγε στραβά")
})
}
func submitOrderCallback (_ response: swiftApi.GenericResponseModel?) -> Void {
......
......@@ -181,10 +181,32 @@ import SwiftEventBus
showSpinner()
if (ccms == nil) {
swiftApi().redeemCouponSetAsync(uuid: uuid, communication_uuid: communication_uuid, redeemCouponSetCallback)
swiftApi().redeemCouponSetAsync(uuid: uuid, communication_uuid: communication_uuid, redeemCouponSetCallback, failureCallback: {errorCode in
self.hideSpinner()
let firebaseEvent = swiftApi.LoyaltySDKFirebaseEventModel()
firebaseEvent._eventName = "loyalty_offer_activated"
firebaseEvent.setParameter = ("name", (self.couponset?.name ?? ""))
firebaseEvent.setParameter = ("type", "coupon")
firebaseEvent.setParameter = ("successful", "false")
SwiftEventBus.post("firebase", sender: firebaseEvent)
self.showDialog("Αποτυχία","Κάτι πήγε στραβά")
})
} else {
// TODO: MAybe change user_msisdn: profile?._msisdn ?? ""
swiftApi().redeemCouponSetAsync(uuid: uuid, communication_uuid: communication_uuid, user_msisdn: profile?._msisdn ?? "", businessService: (ccms?._businessService ?? ""), offerName: (ccms?._offerName ?? ""), productType: (ccms?._productType ?? ""), provDuration: (ccms?._provDuration ?? ""), noOfRecurrance: (ccms?._noOfRecurrance ?? ""), price: (ccms?._price ?? ""), discount: (ccms?._discount ?? ""), voiceCategory: (ccms?._voiceCategory ?? ""), dataCategory: (ccms?._dataCategory ?? ""), minsValue: (ccms?._minsValue ?? ""), dataValue: (ccms?._dataValue ?? ""), provStepValueMins: (ccms?._provStepValueMins ?? ""), OfferAudienceLevel: (ccms?._offerAudienceLevel ?? ""), UACIOfferTrackingCode: (ccms?._uaciOfferTrackingCode ?? ""), OFFERCODE1: (ccms?._offerCode1 ?? ""), SCORE: (ccms?._score ?? ""), ZONE: (ccms?._zone ?? ""), WAVE: (ccms?._wave ?? ""), VALIDITY: (ccms?._validity ?? ""), TREATMENT_CODE: (ccms?._treatmentCode ?? ""), ccms_session_id: (ccms?._sessionId ?? ""), redeemCouponSetCallback)
swiftApi().redeemCouponSetAsync(uuid: uuid, communication_uuid: communication_uuid, user_msisdn: profile?._msisdn ?? "", businessService: (ccms?._businessService ?? ""), offerName: (ccms?._offerName ?? ""), productType: (ccms?._productType ?? ""), provDuration: (ccms?._provDuration ?? ""), noOfRecurrance: (ccms?._noOfRecurrance ?? ""), price: (ccms?._price ?? ""), discount: (ccms?._discount ?? ""), voiceCategory: (ccms?._voiceCategory ?? ""), dataCategory: (ccms?._dataCategory ?? ""), minsValue: (ccms?._minsValue ?? ""), dataValue: (ccms?._dataValue ?? ""), provStepValueMins: (ccms?._provStepValueMins ?? ""), OfferAudienceLevel: (ccms?._offerAudienceLevel ?? ""), UACIOfferTrackingCode: (ccms?._uaciOfferTrackingCode ?? ""), OFFERCODE1: (ccms?._offerCode1 ?? ""), SCORE: (ccms?._score ?? ""), ZONE: (ccms?._zone ?? ""), WAVE: (ccms?._wave ?? ""), VALIDITY: (ccms?._validity ?? ""), TREATMENT_CODE: (ccms?._treatmentCode ?? ""), ccms_session_id: (ccms?._sessionId ?? ""), redeemCouponSetCallback, failureCallback: {errorCode in
self.hideSpinner()
let firebaseEvent = swiftApi.LoyaltySDKFirebaseEventModel()
firebaseEvent._eventName = "loyalty_offer_activated"
firebaseEvent.setParameter = ("name", (self.couponset?.name ?? ""))
firebaseEvent.setParameter = ("type", "coupon")
firebaseEvent.setParameter = ("successful", "false")
SwiftEventBus.post("firebase", sender: firebaseEvent)
self.showDialog("Αποτυχία","Κάτι πήγε στραβά")
})
}
}
......@@ -209,8 +231,8 @@ import SwiftEventBus
self.showSuccessDialog("Επιτυχής ενεργοποίηση","Το κουπόνι σου έχει ενεργοποιηθεί στην ενότητα My Rewards.")
swiftApi().getCouponsAsync(getCouponsCallback)
swiftApi().getCampaignsAsyncNew(language: "en", filters: [String : Any](), getCampaignsCallback)
swiftApi().getCouponsAsync(getCouponsCallback, failureCallback: {errorCode in })
swiftApi().getCampaignsAsyncNew(language: "en", filters: [String : Any](), getCampaignsCallback, failureCallback: {errorCode in })
func getCouponsCallback (_ couponsData: Array<swiftApi.CouponItemModel>?) -> Void {
if (couponsData != nil) {
......
......@@ -49,7 +49,9 @@ import SwiftEventBus
// MARK: - API Functions
func getCouponsRequest() {
swiftApi().getCouponsAsync(getCouponsCallback)
swiftApi().getCouponsAsync(getCouponsCallback, failureCallback: {errorCode in
self.coupons = []
})
}
func getCouponsCallback (_ couponsData: Array<swiftApi.CouponItemModel>?) -> Void {
......
......@@ -254,7 +254,9 @@ import SwiftEventBus
// MARK: - API Calls
func getProfileRequest() {
swiftApi().getProfileAsync(getProfileCallback)
swiftApi().getProfileAsync(getProfileCallback, failureCallback: {errorCode in
print("========= getProfileRequest ERROR =========")
})
}
func getProfileCallback (_ profileData: swiftApi.ProfileModel?) -> Void {
......@@ -270,7 +272,9 @@ import SwiftEventBus
}
func cosmoteCouponSharingRequest() {
swiftApi().cosmoteCouponSharingAsync(coupon: coupon?.coupon ?? "", sender: selectedNumber, receiver: numberTextField.text ?? "", couponSharingCallback)
swiftApi().cosmoteCouponSharingAsync(coupon: coupon?.coupon ?? "", sender: selectedNumber, receiver: numberTextField.text ?? "", couponSharingCallback, failureCallback: {errorCode in
self.showDialog("Αποτυχία","Κάτι πήγε στραβά")
})
}
func couponSharingCallback (_ response: swiftApi.GenericResponseModel?) -> Void {
......@@ -278,7 +282,7 @@ import SwiftEventBus
DispatchQueue.main.async {
if (response?.getStatus == 1) {
swiftApi().getCouponsAsync(getCouponsCallback)
swiftApi().getCouponsAsync(getCouponsCallback, failureCallback: {errorCode in })
func getCouponsCallback (_ couponsData: Array<swiftApi.CouponItemModel>?) -> Void {
if (couponsData != nil) {
......
......@@ -40,7 +40,7 @@ class SharingHistoryViewController: AnalysisChildViewController {
showLoading()
swiftApi().getSharingHistoryAsync(responseCallback)
swiftApi().getSharingHistoryAsync(responseCallback, failureCallback: {errorCode in })
}
private func showLoading() {
......
......@@ -212,7 +212,7 @@ import SwiftEventBus
// MARK: - API CALLS
func getProfileRequest() {
swiftApi().getProfileAsync(getProfileCallback)
swiftApi().getProfileAsync(getProfileCallback, failureCallback: {errorCode in })
}
func getProfileCallback (_ profileData: swiftApi.ProfileModel?) -> Void {
......@@ -227,7 +227,16 @@ import SwiftEventBus
func submitOrderRequest() {
swiftApi().submitOrderAsync(campaign_session_uuid: (campaign?.session_uuid ?? ""), user_msisdn: self.selectedNumber, businessService: (ccms?._businessService ?? ""), offerName: (ccms?._offerName ?? ""), productType: (ccms?._productType ?? ""), provDuration: (ccms?._provDuration ?? ""), noOfRecurrance: (ccms?._noOfRecurrance ?? ""), price: (ccms?._price ?? ""), discount: (ccms?._discount ?? ""), voiceCategory: (ccms?._voiceCategory ?? ""), dataCategory: (ccms?._dataCategory ?? ""), minsValue: (ccms?._minsValue ?? ""), dataValue: (ccms?._dataValue ?? ""), provStepValueMins: (ccms?._provStepValueMins ?? ""),
OfferAudienceLevel: (ccms?._offerAudienceLevel ?? ""), UACIOfferTrackingCode: (ccms?._uaciOfferTrackingCode ?? ""), OFFERCODE1: (ccms?._offerCode1 ?? ""), SCORE: (ccms?._score ?? ""), ZONE: (ccms?._zone ?? ""), WAVE: (ccms?._wave ?? ""), VALIDITY: (ccms?._validity ?? ""), TREATMENT_CODE: (ccms?._treatmentCode ?? ""), ccms_session_id: (ccms?._sessionId ?? ""), notificationMessage: (ccms?._notificationMessage ?? ""),
submitOrderCallback)
submitOrderCallback, failureCallback: {errorCode in
let firebaseEvent = swiftApi.LoyaltySDKFirebaseEventModel()
firebaseEvent._eventName = "loyalty_offer_activated"
firebaseEvent.setParameter = ("name", (self.ccms?._title ?? ""))
firebaseEvent.setParameter = ("type", "gift")
firebaseEvent.setParameter = ("successful", "false")
SwiftEventBus.post("firebase", sender: firebaseEvent)
self.showDialog("Αποτυχία","Κάτι πήγε στραβά")
})
}
func submitOrderCallback (_ response: swiftApi.GenericResponseModel?) -> Void {
......