Toggle navigation
Toggle navigation
This project
Loading...
Sign in
open-source
/
warply_sdk_framework
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Network
Create a new issue
Commits
Issue Boards
Authored by
Manos Chorianopoulos
2024-11-01 10:48:43 +0200
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
1378ca00594e11b6a78c03cf263fe7e7b065cc26
1378ca00
1 parent
d8f3bffa
redeemCouponSet optimizations
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
57 additions
and
17 deletions
SwiftWarplyFramework/SwiftWarplyFramework/CouponViewController.swift
SwiftWarplyFramework/SwiftWarplyFramework/swiftApi.swift
SwiftWarplyFramework/SwiftWarplyFramework/CouponViewController.swift
View file @
1378ca0
...
...
@@ -33,6 +33,8 @@ import SwiftEventBus
public
var
couponset
:
swiftApi
.
CouponSetItemModel
?
public
var
campaign
:
swiftApi
.
CampaignItemModel
?
let
merchantList
:
Array
<
swiftApi
.
MerchantModel
>
=
swiftApi
()
.
getMerchantList
()
let
spinner
=
SpinnerViewController
()
...
...
@@ -214,7 +216,8 @@ import SwiftEventBus
redeemButton
.
isEnabled
=
false
if
(
ccms
==
nil
)
{
swiftApi
()
.
redeemCouponSetAsync
(
uuid
:
uuid
,
communication_uuid
:
communication_uuid
,
redeemCouponSetCallback
,
failureCallback
:
{
errorCode
in
// swiftApi().redeemCouponSetAsync(uuid: uuid, communication_uuid: communication_uuid, redeemCouponSetCallback, failureCallback: {errorCode in
swiftApi
()
.
redeemCouponSetAsyncInternal
(
uuid
:
uuid
,
communication_uuid
:
communication_uuid
,
redeemCouponSetCallback
,
failureCallback
:
{
errorCode
in
self
.
hideSpinner
()
self
.
redeemButton
.
isEnabled
=
true
...
...
@@ -229,7 +232,8 @@ import SwiftEventBus
})
}
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
,
failureCallback
:
{
errorCode
in
// 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
swiftApi
()
.
redeemCouponSetAsyncInternal
(
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
...
...
@@ -245,7 +249,8 @@ import SwiftEventBus
}
}
func
redeemCouponSetCallback
(
_
response
:
swiftApi
.
GenericResponseModel
?)
->
Void
{
// func redeemCouponSetCallback (_ response: swiftApi.GenericResponseModel?) -> Void {
func
redeemCouponSetCallback
(
_
response
:
swiftApi
.
RedeemCouponSetResponseModel
?)
->
Void
{
hideSpinner
()
self
.
redeemButton
.
isEnabled
=
true
...
...
@@ -267,27 +272,62 @@ import SwiftEventBus
self
.
showSuccessDialog
(
"Επιτυχής ενεργοποίηση"
,
"Το κουπόνι σου έχει ενεργοποιηθεί και βρίσκεται στην ενότητα My Rewards."
)
swiftApi
()
.
getCouponsAsync
(
getCouponsCallback
,
failureCallback
:
{
errorCode
in
})
swiftApi
()
.
getCampaignsAsyncNew
(
language
:
"en"
,
filters
:
[
String
:
Any
](),
getCampaignsCallback
,
failureCallback
:
{
errorCode
in
})
/* OLD Addition start */
// 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) {
//
// DispatchQueue.main.async {
// SwiftEventBus.post("coupons_fetched")
// }
// } else {
// }
// }
//
// func getCampaignsCallback (_ campaignsData: Array<swiftApi.CampaignItemModel>?) -> Void {
// if (campaignsData != nil) {
// DispatchQueue.main.async {
// SwiftEventBus.post("campaigns_retrieved")
// }
// } else {
// }
// }
/* OLD Addition end */
func
getCouponsCallback
(
_
couponsData
:
Array
<
swiftApi
.
CouponItemModel
>
?)
->
Void
{
if
(
couponsData
!=
nil
)
{
/* New Addition start */
if
let
newCoupon
=
response
?
.
getCoupon
{
newCoupon
.
status
=
1
if
let
couponsetData
=
self
.
couponset
{
newCoupon
.
setCouponSetData
(
couponsetData
)
DispatchQueue
.
main
.
async
{
SwiftEventBus
.
post
(
"coupons_fetched"
)
for
merchant
in
self
.
merchantList
{
if
(
merchant
.
_uuid
==
couponsetData
.
merchant_uuid
)
{
newCoupon
.
merchant_details
=
merchant
break
;
}
}
}
else
{
}
}
func
getCampaignsCallback
(
_
campaignsData
:
Array
<
swiftApi
.
CampaignItemModel
>
?)
->
Void
{
if
(
campaignsData
!=
nil
)
{
DispatchQueue
.
main
.
async
{
SwiftEventBus
.
post
(
"campaigns_retrieved"
)
swiftApi
()
.
addCouponItem
(
newCoupon
:
newCoupon
)
SwiftEventBus
.
post
(
"coupons_fetched"
)
if
let
tempCampaign
=
self
.
campaign
{
swiftApi
()
.
removeCampaignItem
(
campaignArg
:
tempCampaign
)
swiftApi
()
.
getCampaignsAsyncNewInternal
(
getCampaignsCallback
,
failureCallback
:
{
errorCode
in
})
}
func
getCampaignsCallback
(
_
campaignsData
:
Array
<
swiftApi
.
CampaignItemModel
>
?)
->
Void
{
if
(
campaignsData
!=
nil
)
{
DispatchQueue
.
main
.
async
{
SwiftEventBus
.
post
(
"campaigns_retrieved"
)
}
}
}
else
{
}
}
/* New Addition end */
}
else
if
(
response
?
.
getStatus
==
3
)
{
let
firebaseEvent
=
swiftApi
.
LoyaltySDKFirebaseEventModel
()
...
...
SwiftWarplyFramework/SwiftWarplyFramework/swiftApi.swift
View file @
1378ca0
This diff is collapsed. Click to expand it.
Please
register
or
login
to post a comment