Manos Chorianopoulos

CouponViewController disable button when pressed once

......@@ -211,10 +211,12 @@ import SwiftEventBus
func redeemCouponSetRequest(uuid: String, communication_uuid: String) {
showSpinner()
redeemButton.isEnabled = false
if (ccms == nil) {
swiftApi().redeemCouponSetAsync(uuid: uuid, communication_uuid: communication_uuid, redeemCouponSetCallback, failureCallback: {errorCode in
self.hideSpinner()
self.redeemButton.isEnabled = true
let firebaseEvent = swiftApi.LoyaltySDKFirebaseEventModel()
firebaseEvent._eventName = "loyalty_offer_activated"
......@@ -229,6 +231,7 @@ import SwiftEventBus
// 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, failureCallback: {errorCode in
self.hideSpinner()
self.redeemButton.isEnabled = true
let firebaseEvent = swiftApi.LoyaltySDKFirebaseEventModel()
firebaseEvent._eventName = "loyalty_offer_activated"
......@@ -244,6 +247,7 @@ import SwiftEventBus
func redeemCouponSetCallback (_ response: swiftApi.GenericResponseModel?) -> Void {
hideSpinner()
self.redeemButton.isEnabled = true
if (response != nil) {
DispatchQueue.main.async {
......