Manos Chorianopoulos

fix constructCcmsUrl

...@@ -1525,6 +1525,17 @@ public class swiftApi { ...@@ -1525,6 +1525,17 @@ public class swiftApi {
1525 if (item.loyaltyCampaignId == campaign._loyaltyCampaignId) { 1525 if (item.loyaltyCampaignId == campaign._loyaltyCampaignId) {
1526 print("CCMS_PRESSED" + " " + campaign._id + " " + campaign._offerName) 1526 print("CCMS_PRESSED" + " " + campaign._id + " " + campaign._offerName)
1527 1527
1528 + var assetsString = ""
1529 + if (campaign._eligibleAssets != nil && campaign._eligibleAssets.count > 0) {
1530 + for (index, item) in campaign._eligibleAssets.enumerated() {
1531 + if (index == (campaign._eligibleAssets.endIndex - 1)) {
1532 + assetsString += String(item)
1533 + } else {
1534 + assetsString += String(item) + ","
1535 + }
1536 + }
1537 + }
1538 +
1528 let instanceOfMyApi = MyApi() 1539 let instanceOfMyApi = MyApi()
1529 let campaignInfo = instanceOfMyApi.provideInfoForCampaign() 1540 let campaignInfo = instanceOfMyApi.provideInfoForCampaign()
1530 let finalUrl = (item.index_url ?? "") 1541 let finalUrl = (item.index_url ?? "")
...@@ -1555,7 +1566,8 @@ public class swiftApi { ...@@ -1555,7 +1566,8 @@ public class swiftApi {
1555 + "&WAVE=" + (campaign._wave) 1566 + "&WAVE=" + (campaign._wave)
1556 + "&VALIDITY=" + (campaign._validity) 1567 + "&VALIDITY=" + (campaign._validity)
1557 + "&TREATMENT_CODE=" + (campaign._treatmentCode) 1568 + "&TREATMENT_CODE=" + (campaign._treatmentCode)
1558 - + "&OfferAudienceLevel=" + (campaign._eligibleAssets != nil && campaign._eligibleAssets.count > 0 ? "MSISDN" : "GUID"); 1569 + + "&OfferAudienceLevel=" + (campaign._eligibleAssets != nil && campaign._eligibleAssets.count > 0 ? "MSISDN" : "GUID")
1570 + + "&ASSETS=" + (assetsString);
1559 1571
1560 print("constructCcmsUrl url: " + finalUrl) 1572 print("constructCcmsUrl url: " + finalUrl)
1561 return finalUrl 1573 return finalUrl
...@@ -1569,6 +1581,17 @@ public class swiftApi { ...@@ -1569,6 +1581,17 @@ public class swiftApi {
1569 public func constructCcmsUrl(_ campaign: CampaignItemModel, _ ccmsCampaign: LoyaltyContextualOfferModel) -> String { 1581 public func constructCcmsUrl(_ campaign: CampaignItemModel, _ ccmsCampaign: LoyaltyContextualOfferModel) -> String {
1570 print("CCMS_PRESSED" + " " + ccmsCampaign._id + " " + ccmsCampaign._offerName) 1582 print("CCMS_PRESSED" + " " + ccmsCampaign._id + " " + ccmsCampaign._offerName)
1571 1583
1584 + var assetsString = ""
1585 + if (ccmsCampaign._eligibleAssets != nil && ccmsCampaign._eligibleAssets.count > 0) {
1586 + for (index, item) in ccmsCampaign._eligibleAssets.enumerated() {
1587 + if (index == (ccmsCampaign._eligibleAssets.endIndex - 1)) {
1588 + assetsString += String(item)
1589 + } else {
1590 + assetsString += String(item) + ","
1591 + }
1592 + }
1593 + }
1594 +
1572 let instanceOfMyApi = MyApi() 1595 let instanceOfMyApi = MyApi()
1573 let campaignInfo = instanceOfMyApi.provideInfoForCampaign() 1596 let campaignInfo = instanceOfMyApi.provideInfoForCampaign()
1574 let finalUrl = (campaign.index_url ?? "") 1597 let finalUrl = (campaign.index_url ?? "")
...@@ -1599,7 +1622,8 @@ public class swiftApi { ...@@ -1599,7 +1622,8 @@ public class swiftApi {
1599 + "&WAVE=" + (ccmsCampaign._wave) 1622 + "&WAVE=" + (ccmsCampaign._wave)
1600 + "&VALIDITY=" + (ccmsCampaign._validity) 1623 + "&VALIDITY=" + (ccmsCampaign._validity)
1601 + "&TREATMENT_CODE=" + (ccmsCampaign._treatmentCode) 1624 + "&TREATMENT_CODE=" + (ccmsCampaign._treatmentCode)
1602 - + "&OfferAudienceLevel=" + (ccmsCampaign._eligibleAssets != nil && ccmsCampaign._eligibleAssets.count > 0 ? "MSISDN" : "GUID"); 1625 + + "&OfferAudienceLevel=" + (ccmsCampaign._eligibleAssets != nil && ccmsCampaign._eligibleAssets.count > 0 ? "MSISDN" : "GUID")
1626 + + "&ASSETS=" + (assetsString);
1603 1627
1604 print("constructCcmsUrl url: " + finalUrl) 1628 print("constructCcmsUrl url: " + finalUrl)
1605 return finalUrl 1629 return finalUrl
......