Panagiotis Triantafyllou

fixes

......@@ -2,7 +2,7 @@ apply plugin: 'com.android.library'
ext {
PUBLISH_GROUP_ID = 'ly.warp'
PUBLISH_VERSION = '4.5.4-cosbeta19'
PUBLISH_VERSION = '4.5.4-cosbeta20'
PUBLISH_ARTIFACT_ID = 'warply-android-sdk'
}
......
......@@ -110,14 +110,18 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene
try {
String key = WarpJSONParser.getJSONFromString(dataItem.getCampaign().getExtraFields()).keys().next();
if (!TextUtils.isEmpty(key) && key.equals("loyaltyCampaignId")) {
String value = WarpJSONParser.getJSONFromString(dataItem.getCampaign().getExtraFields()).optString("loyaltyCampaignId");
if (!TextUtils.isEmpty(key) && key.equals("ccms_offer")) {
String value = WarpJSONParser.getJSONFromString(dataItem.getCampaign().getExtraFields()).optString(key);
if (!TextUtils.isEmpty(value) && value.equals("true")) {
for (LoyaltyContextualOfferModel ccms : WarplyManagerHelper.getCCMSLoyaltyCampaigns()) {
if (ccms.getLoyaltyCampaignId().equals(value)) {
if (ccms.getLoyaltyCampaignId().equals(dataItem.getCampaign().getSessionUUID())) {
startActivity(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCcmsUrl(dataItem.getCampaign(), ccms)));
return;
}
}
} else {
startActivity(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCampaignUrl(dataItem.getCampaign())));
}
}
startActivity(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCampaignUrl(dataItem.getCampaign())));
} catch (Exception exception) {
......
......@@ -26,6 +26,14 @@ public class LoyaltyContextualOfferModel {
private String postpayProduct;
private String notificationMessage;
private String loyaltyCampaignId;
private String businessService;
private String UACIOfferTrackingCode;
private String offerCode1;
private String score;
private String zone;
private String wave;
private String validity;
private String offerAudienceLevel;
public LoyaltyContextualOfferModel() {
......@@ -48,6 +56,14 @@ public class LoyaltyContextualOfferModel {
this.postpayProduct = "";
this.notificationMessage = "";
this.loyaltyCampaignId = "";
this.businessService = "";
this.UACIOfferTrackingCode = "";
this.offerCode1 = "";
this.score = "";
this.zone = "";
this.wave = "";
this.validity = "";
this.offerAudienceLevel = "";
}
public String getSessionId() {
......@@ -201,4 +217,68 @@ public class LoyaltyContextualOfferModel {
public void setLoyaltyCampaignId(String loyaltyCampaignId) {
this.loyaltyCampaignId = loyaltyCampaignId;
}
public String getBusinessService() {
return businessService;
}
public void setBusinessService(String businessService) {
this.businessService = businessService;
}
public String getUACIOfferTrackingCode() {
return UACIOfferTrackingCode;
}
public void setUACIOfferTrackingCode(String UACIOfferTrackingCode) {
this.UACIOfferTrackingCode = UACIOfferTrackingCode;
}
public String getOfferCode1() {
return offerCode1;
}
public void setOfferCode1(String offerCode1) {
this.offerCode1 = offerCode1;
}
public String getScore() {
return score;
}
public void setScore(String score) {
this.score = score;
}
public String getZone() {
return zone;
}
public void setZone(String zone) {
this.zone = zone;
}
public String getWave() {
return wave;
}
public void setWave(String wave) {
this.wave = wave;
}
public String getValidity() {
return validity;
}
public void setValidity(String validity) {
this.validity = validity;
}
public String getOfferAudienceLevel() {
return offerAudienceLevel;
}
public void setOfferAudienceLevel(String offerAudienceLevel) {
this.offerAudienceLevel = offerAudienceLevel;
}
}
......
......@@ -255,6 +255,7 @@ public class WarplyManagerHelper {
public static String constructCcmsUrl(Campaign item, LoyaltyContextualOfferModel ccmsItem) {
Log.v("CCMS_PRESSED", ccmsItem.getId() + " " + ccmsItem.getOfferName());
item.setNew(false);
String tempAudienceLevel = ccmsItem.getEligibleAssets() != null && ccmsItem.getEligibleAssets().size() > 0 ? "MSISDN" : "GUID";
String url = item.getIndexUrl()
+ "?web_id=" + WarpUtils.getWebId(Warply.getWarplyContext())
+ "&app_uuid=" + WarplyProperty.getAppUuid(Warply.getWarplyContext())
......@@ -265,7 +266,7 @@ public class WarplyManagerHelper {
+ "&client_id=" + WarplyDBHelper.getInstance(Warply.getWarplyContext()).getClientValue("client_id")
+ "&client_secret=" + WarplyDBHelper.getInstance(Warply.getWarplyContext()).getClientValue("client_secret")
+ "&Session_ID=" + ccmsItem.getSessionId()
+ "&businessService="
+ "&businessService=" + ccmsItem.getBusinessService()
+ "&offerName=" + ccmsItem.getOfferName()
+ "&productType=" + ccmsItem.getProductType()
+ "&provDuration=" + ccmsItem.getProvDuration()
......@@ -277,16 +278,13 @@ public class WarplyManagerHelper {
+ "&minsValue=" + ccmsItem.getMinsValue()
+ "&dataValue=" + ccmsItem.getDataValue()
+ "&provStepValueMins=" + ccmsItem.getProvStepValueMins()
+ "&UACIOfferTrackingCode="
+ "&MSISDN="
+ "&OFFERCODE1="
+ "&SCORE="
+ "&ZONE="
+ "&WAVE="
+ "&VALIDITY="
+ "&TREATMENT_CODE="
+ "&GUID="
+ "&OfferAudienceLevel=";
+ "&UACIOfferTrackingCode=" + ccmsItem.getUACIOfferTrackingCode()
+ "&OFFERCODE1=" + ccmsItem.getOfferCode1()
+ "&SCORE=" + ccmsItem.getScore()
+ "&WAVE=" + ccmsItem.getWave()
+ "&VALIDITY=" + ccmsItem.getValidity()
+ "&TREATMENT_CODE=" + ccmsItem.getTreatmentCode()
+ "&OfferAudienceLevel=" + tempAudienceLevel;
// if (mConsumer != null)
......@@ -307,10 +305,12 @@ public class WarplyManagerHelper {
for (Campaign camp : mUniqueCampaignList.get("gifts_for_you")) {
try {
String key = WarpJSONParser.getJSONFromString(camp.getExtraFields()).keys().next();
if (!TextUtils.isEmpty(key) && key.equals("loyaltyCampaignId")) {
if (!TextUtils.isEmpty(key) && key.equals("ccms_offer")) {
String keyValue = WarpJSONParser.getJSONFromString(camp.getExtraFields()).optString(key);
if (keyValue.equals(item.getLoyaltyCampaignId())) {
if (!TextUtils.isEmpty(keyValue) && keyValue.equals("true")) {
if (camp.getSessionUUID().equals(item.getLoyaltyCampaignId())) {
Log.v("CCMS_PRESSED", item.getId() + " " + item.getOfferName());
String tempAudienceLevel = item.getEligibleAssets() != null && item.getEligibleAssets().size() > 0 ? "MSISDN" : "GUID";
url = camp.getIndexUrl()
+ "?web_id=" + WarpUtils.getWebId(Warply.getWarplyContext())
+ "&app_uuid=" + WarplyProperty.getAppUuid(Warply.getWarplyContext())
......@@ -321,7 +321,7 @@ public class WarplyManagerHelper {
+ "&client_id=" + WarplyDBHelper.getInstance(Warply.getWarplyContext()).getClientValue("client_id")
+ "&client_secret=" + WarplyDBHelper.getInstance(Warply.getWarplyContext()).getClientValue("client_secret")
+ "&Session_ID=" + sessionId //item.getSessionId()
+ "&businessService="
+ "&businessService=" + item.getBusinessService()
+ "&offerName=" + item.getOfferName()
+ "&productType=" + item.getProductType()
+ "&provDuration=" + item.getProvDuration()
......@@ -333,19 +333,17 @@ public class WarplyManagerHelper {
+ "&minsValue=" + item.getMinsValue()
+ "&dataValue=" + item.getDataValue()
+ "&provStepValueMins=" + item.getProvStepValueMins()
+ "&UACIOfferTrackingCode="
+ "&MSISDN="
+ "&OFFERCODE1="
+ "&SCORE="
+ "&ZONE="
+ "&WAVE="
+ "&VALIDITY="
+ "&TREATMENT_CODE="
+ "&GUID="
+ "&OfferAudienceLevel=";
+ "&UACIOfferTrackingCode=" + item.getUACIOfferTrackingCode()
+ "&OFFERCODE1=" + item.getOfferCode1()
+ "&SCORE=" + item.getScore()
+ "&WAVE=" + item.getWave()
+ "&VALIDITY=" + item.getValidity()
+ "&TREATMENT_CODE=" + item.getTreatmentCode()
+ "&OfferAudienceLevel=" + tempAudienceLevel;
break;
}
}
}
} catch (Exception exception) {
Log.v("WarplyManagerHelper_CCMS_Error", exception.toString());
}
......@@ -367,20 +365,28 @@ public class WarplyManagerHelper {
public static void setCCMSLoyaltyCampaigns(ArrayList<LoyaltyContextualOfferModel> list) {
mCCMSList = list;
if (list != null && list.size() == 0) {
if (list == null || list.size() == 0) {
CampaignList tempGifts = new CampaignList();
if (mUniqueCampaignList != null && mUniqueCampaignList.get("gifts_for_you") != null && mUniqueCampaignList.get("gifts_for_you").size() > 0) {
for (Campaign camp : mUniqueCampaignList.get("gifts_for_you")) {
try {
String key = WarpJSONParser.getJSONFromString(camp.getExtraFields()).keys().next();
if (!TextUtils.isEmpty(key) && key.equals("loyaltyCampaignId")) {
if (!TextUtils.isEmpty(key)) {
String value = WarpJSONParser.getJSONFromString(camp.getExtraFields()).optString(key);
if (!(key.equals("ccms_offer") && value.equals("true"))) {
tempGifts.add(camp);
}
}
} catch (Exception exception) {
Log.v("WarplyManagerHelper_CCMS_Upper", exception.toString());
tempGifts.add(camp);
}
}
Log.v("Got L:{" + String.valueOf(tempGifts.size()) + "}", " LOYALTY campaigns");
Log.v("Got C:{0}", " CCMS campaigns");
Log.v("Matched M:{0}", " CCMS campaigns");
Log.v("=====================================", "");
Log.v("TOTAL: Campaigns Sum=" + String.valueOf(tempGifts.size()), " campaigns to display");
mUniqueCampaignList.get("gifts_for_you").removeAll(tempGifts);
}
return;
......@@ -388,24 +394,40 @@ public class WarplyManagerHelper {
CampaignList tempGifts = new CampaignList();
if (mUniqueCampaignList != null && mUniqueCampaignList.get("gifts_for_you") != null && mUniqueCampaignList.get("gifts_for_you").size() > 0) {
int ccmsCount = 0;
int loyaltyCount = 0;
for (Campaign camp : mUniqueCampaignList.get("gifts_for_you")) {
try {
String key = WarpJSONParser.getJSONFromString(camp.getExtraFields()).keys().next();
if (!TextUtils.isEmpty(key) && key.equals("loyaltyCampaignId")) {
String value = WarpJSONParser.getJSONFromString(camp.getExtraFields()).optString("loyaltyCampaignId");
if (!TextUtils.isEmpty(key) && key.equals("ccms_offer")) {
String value = WarpJSONParser.getJSONFromString(camp.getExtraFields()).optString(key);
if (!TextUtils.isEmpty(value) && value.equals("true")) {
for (LoyaltyContextualOfferModel ccms : list) {
if (ccms.getLoyaltyCampaignId().equals(value)) {
if (ccms.getLoyaltyCampaignId().equals(camp.getSessionUUID())) {
tempGifts.add(camp);
ccmsCount++;
break;
}
}
} else {
tempGifts.add(camp);
loyaltyCount++;
}
} else {
tempGifts.add(camp);
loyaltyCount++;
}
} catch (Exception exception) {
Log.v("WarplyManagerHelper_CCMS", exception.toString());
tempGifts.add(camp);
loyaltyCount++;
}
}
Log.v("Got L:{" + String.valueOf(loyaltyCount) + "}", " LOYALTY campaigns");
Log.v("Got C:{" + String.valueOf(list.size()) + "}", " CCMS campaigns");
Log.v("Matched M:{" + String.valueOf(ccmsCount) + "}", " CCMS campaigns");
Log.v("=====================================", "");
Log.v("TOTAL: Campaigns Sum=" + String.valueOf(loyaltyCount + ccmsCount), " campaigns to display");
mUniqueCampaignList.get("gifts_for_you").retainAll(tempGifts);
}
}
......