Manos Chorianopoulos

fix constructCcmsUrl

......@@ -1525,6 +1525,17 @@ public class swiftApi {
if (item.loyaltyCampaignId == campaign._loyaltyCampaignId) {
print("CCMS_PRESSED" + " " + campaign._id + " " + campaign._offerName)
var assetsString = ""
if (campaign._eligibleAssets != nil && campaign._eligibleAssets.count > 0) {
for (index, item) in campaign._eligibleAssets.enumerated() {
if (index == (campaign._eligibleAssets.endIndex - 1)) {
assetsString += String(item)
} else {
assetsString += String(item) + ","
}
}
}
let instanceOfMyApi = MyApi()
let campaignInfo = instanceOfMyApi.provideInfoForCampaign()
let finalUrl = (item.index_url ?? "")
......@@ -1555,7 +1566,8 @@ public class swiftApi {
+ "&WAVE=" + (campaign._wave)
+ "&VALIDITY=" + (campaign._validity)
+ "&TREATMENT_CODE=" + (campaign._treatmentCode)
+ "&OfferAudienceLevel=" + (campaign._eligibleAssets != nil && campaign._eligibleAssets.count > 0 ? "MSISDN" : "GUID");
+ "&OfferAudienceLevel=" + (campaign._eligibleAssets != nil && campaign._eligibleAssets.count > 0 ? "MSISDN" : "GUID")
+ "&ASSETS=" + (assetsString);
print("constructCcmsUrl url: " + finalUrl)
return finalUrl
......@@ -1569,6 +1581,17 @@ public class swiftApi {
public func constructCcmsUrl(_ campaign: CampaignItemModel, _ ccmsCampaign: LoyaltyContextualOfferModel) -> String {
print("CCMS_PRESSED" + " " + ccmsCampaign._id + " " + ccmsCampaign._offerName)
var assetsString = ""
if (ccmsCampaign._eligibleAssets != nil && ccmsCampaign._eligibleAssets.count > 0) {
for (index, item) in ccmsCampaign._eligibleAssets.enumerated() {
if (index == (ccmsCampaign._eligibleAssets.endIndex - 1)) {
assetsString += String(item)
} else {
assetsString += String(item) + ","
}
}
}
let instanceOfMyApi = MyApi()
let campaignInfo = instanceOfMyApi.provideInfoForCampaign()
let finalUrl = (campaign.index_url ?? "")
......@@ -1599,7 +1622,8 @@ public class swiftApi {
+ "&WAVE=" + (ccmsCampaign._wave)
+ "&VALIDITY=" + (ccmsCampaign._validity)
+ "&TREATMENT_CODE=" + (ccmsCampaign._treatmentCode)
+ "&OfferAudienceLevel=" + (ccmsCampaign._eligibleAssets != nil && ccmsCampaign._eligibleAssets.count > 0 ? "MSISDN" : "GUID");
+ "&OfferAudienceLevel=" + (ccmsCampaign._eligibleAssets != nil && ccmsCampaign._eligibleAssets.count > 0 ? "MSISDN" : "GUID")
+ "&ASSETS=" + (assetsString);
print("constructCcmsUrl url: " + finalUrl)
return finalUrl
......