Panagiotis Triantafyllou

couponsets and merchants implementation

<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="AndroidProjectSystem">
<option name="providerId" value="com.android.tools.idea.GradleProjectSystem" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<bytecodeTargetLevel target="21" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="deploymentTargetSelector">
<selectionStates>
<SelectionState runConfigName="app">
<option name="selectionMode" value="DROPDOWN" />
</SelectionState>
</selectionStates>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleMigrationSettings" migrationVersion="1" />
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="testRunner" value="CHOOSE_PER_TEST" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="gradleJvm" value="#GRADLE_LOCAL_JAVA_HOME" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
<option value="$PROJECT_DIR$/app" />
<option value="$PROJECT_DIR$/warply_android_sdk" />
</set>
</option>
</GradleProjectSettings>
</option>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectMigrations">
<option name="MigrateToGradleLocalJavaHome">
<set>
<option value="$PROJECT_DIR$" />
</set>
</option>
</component>
</project>
\ No newline at end of file
<project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="ProjectRootManager" version="2" languageLevel="JDK_21" default="true" project-jdk-name="jbr-21" project-jdk-type="JavaSDK" />
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RunConfigurationProducerService">
<option name="ignoredProducers">
<set>
<option value="com.intellij.execution.junit.AbstractAllInDirectoryConfigurationProducer" />
<option value="com.intellij.execution.junit.AllInPackageConfigurationProducer" />
<option value="com.intellij.execution.junit.PatternConfigurationProducer" />
<option value="com.intellij.execution.junit.TestInClassConfigurationProducer" />
<option value="com.intellij.execution.junit.UniqueIdConfigurationProducer" />
<option value="com.intellij.execution.junit.testDiscovery.JUnitTestDiscoveryConfigurationProducer" />
<option value="org.jetbrains.kotlin.idea.junit.KotlinJUnitRunConfigurationProducer" />
<option value="org.jetbrains.kotlin.idea.junit.KotlinPatternConfigurationProducer" />
</set>
</option>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>
\ No newline at end of file
......@@ -26,6 +26,7 @@ import ly.warp.sdk.io.adapters.BannerAdapter;
import ly.warp.sdk.io.adapters.OfferAdapter;
import ly.warp.sdk.io.callbacks.CallbackReceiver;
import ly.warp.sdk.io.models.BannerItem;
import ly.warp.sdk.io.models.Couponset;
import ly.warp.sdk.io.models.DummyDataProvider;
import ly.warp.sdk.io.models.OfferCategory;
import ly.warp.sdk.io.models.OfferItem;
......@@ -100,6 +101,7 @@ public class HomeActivity extends Activity implements View.OnClickListener, Offe
initViews();
mPbLoading.setVisibility(View.VISIBLE);
WarplyManager.getCampaigns(mCampaignsCallback);
WarplyManager.getCouponsets(mCouponsetsCallback);
// Setup all category sections
// setupTopOffersSection();
......@@ -431,7 +433,6 @@ public class HomeActivity extends Activity implements View.OnClickListener, Offe
});
mBannerAdapter.setOnBannerContentClickListener(article -> {
//TODO: click article
String s = "";
});
// Set the number of pages to preload for adjacent items
......@@ -519,4 +520,16 @@ public class HomeActivity extends Activity implements View.OnClickListener, Offe
mViewPager.setVisibility(View.GONE);
}
};
private CallbackReceiver<ArrayList<Couponset>> mCouponsetsCallback = new CallbackReceiver<ArrayList<Couponset>>() {
@Override
public void onSuccess(ArrayList<Couponset> result) {
mPbLoading.setVisibility(View.GONE);
}
@Override
public void onFailure(int errorCode) {
mPbLoading.setVisibility(View.GONE);
}
};
}
......
......@@ -80,6 +80,12 @@ public class Couponset implements Parcelable, Serializable {
private static final String FINAL_PRICE = "final_price";
private static final String DISCOUNT_TYPE = "discount_type";
private static final String EXTRA_FIELDS = "extra_fields";
private static final String IS_NEW = "is_new";
private static final String PROMOTED = "promoted";
private static final String PERSONALIZED = "personalized";
private static final String LOCKED = "locked";
private static final String UNLOCK_ACTION = "unlock_action";
private static final String UNLOCK_MESSAGE = "unlock_message";
/* Member variables of the Campaign object */
......@@ -115,6 +121,12 @@ public class Couponset implements Parcelable, Serializable {
private Date endDate = new Date();
private String couponsetType = "";
private JSONObject extraFields = new JSONObject();
private boolean isNew = false;
private boolean promoted = false;
private boolean personalized = false;
private boolean locked = false;
private String unlockAction = "";
private String unlockMessage = "";
public Couponset() {
this.uuid = "";
......@@ -146,6 +158,12 @@ public class Couponset implements Parcelable, Serializable {
this.discount_type = "";
this.final_price = 0.0d;
this.extraFields = new JSONObject();
this.isNew = false;
this.promoted = false;
this.personalized = false;
this.locked = false;
this.unlockAction = "";
this.unlockMessage = "";
}
public Couponset(boolean isUniversal) {
......@@ -168,6 +186,12 @@ public class Couponset implements Parcelable, Serializable {
this.innerText = "";
this.final_price = 0.0d;
this.extraFields = new JSONObject();
this.isNew = false;
this.promoted = false;
this.personalized = false;
this.locked = false;
this.unlockAction = "";
this.unlockMessage = "";
}
/**
......@@ -204,6 +228,12 @@ public class Couponset implements Parcelable, Serializable {
this.active = json.optBoolean(ACTIVE);
this.visible = json.optBoolean(VISIBLE);
this.buyable = json.optBoolean(BUYABLE);
this.isNew = json.optBoolean(IS_NEW);
this.promoted = json.optBoolean(PROMOTED);
this.personalized = json.optBoolean(PERSONALIZED);
this.locked = json.optBoolean(LOCKED);
this.unlockAction = json.optString(UNLOCK_ACTION);
this.unlockMessage = json.optString(UNLOCK_MESSAGE);
this.user_generated = json.optBoolean(USER_GENERATED);
this.limits = json.optJSONObject(LIMITS);
this.points = json.optInt(POINTS);
......@@ -247,6 +277,12 @@ public class Couponset implements Parcelable, Serializable {
} catch (JSONException e) {
e.printStackTrace();
}
this.isNew = json.optBoolean(IS_NEW);
this.promoted = json.optBoolean(PROMOTED);
this.personalized = json.optBoolean(PERSONALIZED);
this.locked = json.optBoolean(LOCKED);
this.unlockAction = json.optString(UNLOCK_ACTION);
this.unlockMessage = json.optString(UNLOCK_MESSAGE);
this.active = json.optBoolean(ACTIVE);
this.buyable = json.optBoolean(BUYABLE);
this.name = json.optString(NAME);
......@@ -322,6 +358,12 @@ public class Couponset implements Parcelable, Serializable {
this.innerText = source.readString();
this.discount_type = source.readString();
this.final_price = source.readDouble();
this.isNew = source.readByte() != 0;
this.promoted = source.readByte() != 0;
this.personalized = source.readByte() != 0;
this.locked = source.readByte() != 0;
this.unlockAction = source.readString();
this.unlockMessage = source.readString();
}
@Override
......@@ -352,6 +394,12 @@ public class Couponset implements Parcelable, Serializable {
dest.writeString(this.innerText);
dest.writeString(this.discount_type);
dest.writeDouble(this.final_price);
dest.writeByte((byte) (this.isNew ? 1 : 0));
dest.writeByte((byte) (this.promoted ? 1 : 0));
dest.writeByte((byte) (this.personalized ? 1 : 0));
dest.writeByte((byte) (this.locked ? 1 : 0));
dest.writeString(this.unlockAction);
dest.writeString(this.unlockMessage);
}
/**
......@@ -391,6 +439,12 @@ public class Couponset implements Parcelable, Serializable {
jObj.putOpt(DISCOUNT_TYPE, this.discount_type);
jObj.putOpt(FINAL_PRICE, this.final_price);
jObj.putOpt(EXTRA_FIELDS, this.extraFields);
jObj.putOpt(IS_NEW, this.isNew);
jObj.putOpt(PROMOTED, this.promoted);
jObj.putOpt(PERSONALIZED, this.personalized);
jObj.putOpt(LOCKED, this.locked);
jObj.putOpt(UNLOCK_ACTION, this.unlockAction);
jObj.putOpt(UNLOCK_MESSAGE, this.unlockMessage);
} catch (JSONException e) {
if (WarpConstants.DEBUG) {
e.printStackTrace();
......@@ -682,6 +736,55 @@ public class Couponset implements Parcelable, Serializable {
return img_preview;
}
public boolean isNew() {
return isNew;
}
public void setNew(boolean aNew) {
isNew = aNew;
}
public boolean isPromoted() {
return promoted;
}
public void setPromoted(boolean promoted) {
this.promoted = promoted;
}
public boolean isPersonalized() {
return personalized;
}
public void setPersonalized(boolean personalized) {
this.personalized = personalized;
}
public boolean isLocked() {
return locked;
}
public void setLocked(boolean locked) {
this.locked = locked;
}
public String getUnlockAction() {
return unlockAction;
}
public void setUnlockAction(String unlockAction) {
this.unlockAction = unlockAction;
}
public String getUnlockMessage() {
return unlockMessage;
}
public void setUnlockMessage(String unlockMessage) {
this.unlockMessage = unlockMessage;
}
@Override
public int describeContents() {
return 0;
......
......@@ -66,7 +66,9 @@ public class NewCampaign implements Parcelable, Serializable {
private static final String SETTINGS = "settings";
private static final String AUDIENCE = "audience";
private static final String IS_NEW = "is_new";
private static final String BANNER_IMAGE = "Banner_img";
private static final String BANNER_IMAGE = "banner_img";
private static final String BANNER_IMAGE_MOBILE = "banner_img_mobile";
private static final String CAMPAIGN_URL = "campaign_url";
private static final String BANNER_TITLE = "Banner_title";
/* Member variables of the Campaign object */
......@@ -92,6 +94,8 @@ public class NewCampaign implements Parcelable, Serializable {
private final String communicationCategory;
private boolean isNew = false;
private String bannerImage = "";
private String bannerImageMobile = "";
private String campaignUrl = "";
private String bannerTitle = "";
private boolean showExpiration = false;
private String couponImg = "";
......@@ -139,6 +143,12 @@ public class NewCampaign implements Parcelable, Serializable {
if (this.extraFields.has(BANNER_IMAGE)) {
this.bannerImage = this.extraFields.optString(BANNER_IMAGE);
}
if (this.extraFields.has(BANNER_IMAGE_MOBILE)) {
this.bannerImageMobile = this.extraFields.optString(BANNER_IMAGE_MOBILE);
}
if (this.extraFields.has(CAMPAIGN_URL)) {
this.campaignUrl = this.extraFields.optString(CAMPAIGN_URL);
}
if (this.extraFields.has(BANNER_TITLE)) {
this.bannerTitle = this.extraFields.optString(BANNER_TITLE);
}
......@@ -183,6 +193,8 @@ public class NewCampaign implements Parcelable, Serializable {
this.category = source.readString();
this.campaignType = source.readString();
this.bannerImage = source.readString();
this.bannerImageMobile = source.readString();
this.campaignUrl = source.readString();
this.bannerTitle = source.readString();
}
......@@ -210,6 +222,8 @@ public class NewCampaign implements Parcelable, Serializable {
dest.writeString(this.campaignType);
dest.writeString(this.communicationUUID);
dest.writeString(this.bannerImage);
dest.writeString(this.bannerImageMobile);
dest.writeString(this.campaignUrl);
dest.writeString(this.bannerTitle);
}
......@@ -420,6 +434,22 @@ public class NewCampaign implements Parcelable, Serializable {
this.filter = filter;
}
public String getBannerImageMobile() {
return bannerImageMobile;
}
public void setBannerImageMobile(String bannerImageMobile) {
this.bannerImageMobile = bannerImageMobile;
}
public String getCampaignUrl() {
return campaignUrl;
}
public void setCampaignUrl(String campaignUrl) {
this.campaignUrl = campaignUrl;
}
@Override
public int describeContents() {
return 0;
......
......@@ -118,6 +118,28 @@ public interface ApiService {
@Header(WarpConstants.HEADER_SIGNATURE) String signature,
@Header(WarpConstants.HEADER_AUTHORIZATION) String bearer);
@Headers("Content-Type: application/json")
@POST("/api/mobile/v2/{appUuid}/context/")
Call<ResponseBody> getCouponsets(@Path("appUuid") String appUuid,
@Body RequestBody request,
@Header(WarpConstants.HEADER_DATE) String timeStamp,
@Header(WarpConstants.HEADER_LOYALTY_BUNDLE_ID) String bundleId,
@Header(WarpConstants.HEADER_UNIQUE_DEVICE_ID) String deviceId,
@Header(WarpConstants.HEADER_CHANNEL) String channel,
@Header(WarpConstants.HEADER_WEB_ID) String webId,
@Header(WarpConstants.HEADER_SIGNATURE) String signature);
@Headers("Content-Type: application/json")
@POST("/api/mobile/v2/{appUuid}/context/")
Call<ResponseBody> getMerchants(@Path("appUuid") String appUuid,
@Body RequestBody request,
@Header(WarpConstants.HEADER_DATE) String timeStamp,
@Header(WarpConstants.HEADER_LOYALTY_BUNDLE_ID) String bundleId,
@Header(WarpConstants.HEADER_UNIQUE_DEVICE_ID) String deviceId,
@Header(WarpConstants.HEADER_CHANNEL) String channel,
@Header(WarpConstants.HEADER_WEB_ID) String webId,
@Header(WarpConstants.HEADER_SIGNATURE) String signature);
// ===========================================================
// Getter & Setter
// ===========================================================
......
......@@ -60,6 +60,8 @@ import ly.warp.sdk.io.models.Campaign;
import ly.warp.sdk.io.models.Content;
import ly.warp.sdk.io.models.Coupon;
import ly.warp.sdk.io.models.CouponList;
import ly.warp.sdk.io.models.Couponset;
import ly.warp.sdk.io.models.Merchant;
import ly.warp.sdk.io.models.NewCampaign;
import ly.warp.sdk.io.models.RedeemedSMHistoryModel;
import ly.warp.sdk.io.request.WarplyRefreshTokenRequest;
......@@ -385,6 +387,192 @@ public class WarplyManager {
}, executorService);
}
public static void getCouponsets(final CallbackReceiver<ArrayList<Couponset>> receiver) {
WarpUtils.log("************* WARPLY Couponsets Request ********************");
WarpUtils.log("[WARP Trace] WARPLY Couponsets Request is active");
WarpUtils.log("**************************************************");
ApiService service = ApiClient.getRetrofitInstance().create(ApiService.class);
ListeningExecutorService executorService = MoreExecutors.listeningDecorator(Executors.newFixedThreadPool(2));
ListenableFuture<ArrayList<Couponset>> futureCouponsets = getCouponsetsRetro(service);
ListenableFuture<ArrayList<Merchant>> futureMerchants = getMerchantsRetro(service);
ListenableFuture<List<Object>> allResultsFuture = Futures.allAsList(futureCouponsets, futureMerchants);
ListenableFuture<ArrayList<Couponset>> mergedResultFuture = Futures.transformAsync(allResultsFuture, results -> {
ArrayList<Couponset> resultCoupons = (ArrayList<Couponset>) results.get(0);
return executorService.submit(() -> resultCoupons/*createCouponSetsSection(resultCoupons)*/);
}, executorService);
Futures.addCallback(mergedResultFuture, new FutureCallback<ArrayList<Couponset>>() {
@Override
public void onSuccess(ArrayList<Couponset> mergedResult) {
executorService.shutdownNow();
new Handler(Looper.getMainLooper()).post(() -> receiver.onSuccess(mergedResult));
}
@Override
public void onFailure(Throwable throwable) {
executorService.shutdownNow();
new Handler(Looper.getMainLooper()).post(() -> receiver.onFailure(2));
}
}, executorService);
}
private static ListenableFuture<ArrayList<Couponset>> getCouponsetsRetro(ApiService service/*, Callback<ResponseBody> callback*/) {
SettableFuture<ArrayList<Couponset>> future = SettableFuture.create();
String timeStamp = DateFormat.format("yyyy-MM-dd hh:mm:ss", System.currentTimeMillis()).toString();
String apiKey = WarpUtils.getApiKey(Warply.getWarplyContext());
String webId = WarpUtils.getWebId(Warply.getWarplyContext());
Map<String, Object> jsonParamsCouponsets = new ArrayMap<>();
Map<String, Object> jsonParams = new ArrayMap<>();
jsonParams.put("action", "retrieve_multilingual");
jsonParams.put("active", true);
jsonParams.put("visible", true);
jsonParams.put("language", WarplyProperty.getLanguage(Warply.getWarplyContext()));
jsonParamsCouponsets.put("coupon", jsonParams);
RequestBody couponsetsRequest = RequestBody.create(MediaType.get("application/json; charset=utf-8"), (new JSONObject(jsonParamsCouponsets)).toString());
Call<ResponseBody> couponsetsCall = service.getCouponsets(
WarplyProperty.getAppUuid(Warply.getWarplyContext()),
couponsetsRequest,
timeStamp,
"android:" + Warply.getWarplyContext().getPackageName(),
new WarplyDeviceInfoCollector(Warply.getWarplyContext()).getUniqueDeviceId(),
"mobile",
webId,
WarpUtils.produceSignature(apiKey + timeStamp)
);
couponsetsCall.enqueue(new Callback<ResponseBody>() {
@Override
public void onResponse(@NonNull Call<ResponseBody> call, @NonNull Response<ResponseBody> response) {
if (response.code() == 200 && response.body() != null) {
JSONObject jobjCouponsetsResponse = null;
try {
jobjCouponsetsResponse = new JSONObject(response.body().string());
} catch (Exception e) {
e.printStackTrace();
}
if (jobjCouponsetsResponse != null && jobjCouponsetsResponse.has("status") && jobjCouponsetsResponse.optString("status", "2").equals("1")) {
JSONArray jCouponsetsBody = null;
try {
jCouponsetsBody = jobjCouponsetsResponse.optJSONObject("context").optJSONArray("MAPP_COUPON");
} catch (Exception e) {
e.printStackTrace();
}
if (jCouponsetsBody != null) {
ArrayList<Couponset> mCouponsetList = new ArrayList<Couponset>();
final ExecutorService executorCouponsets = Executors.newFixedThreadPool(1);
JSONArray finalJCouponsetsBody = jCouponsetsBody;
executorCouponsets.submit(() -> {
for (int i = 0; i < finalJCouponsetsBody.length(); ++i) {
Couponset tempCouponset = new Couponset(finalJCouponsetsBody.optJSONObject(i));
mCouponsetList.add(tempCouponset);
}
executorCouponsets.shutdownNow();
future.set(mCouponsetList);
});
}
} else {
future.set(new ArrayList<Couponset>());
}
} else if (String.valueOf(response.code()).startsWith("5")) {
future.set(new ArrayList<Couponset>());
} else {
// future.set(new CouponsetsList());
future.setException(new Throwable());
}
}
@Override
public void onFailure(@NonNull Call<ResponseBody> call, @NonNull Throwable t) {
// future.set(new CouponsetsList());
future.setException(new Throwable());
}
});
return future;
}
private static ListenableFuture<ArrayList<Merchant>> getMerchantsRetro(ApiService service/*, Callback<ResponseBody> callback*/) {
SettableFuture<ArrayList<Merchant>> future = SettableFuture.create();
String timeStamp = DateFormat.format("yyyy-MM-dd hh:mm:ss", System.currentTimeMillis()).toString();
String apiKey = WarpUtils.getApiKey(Warply.getWarplyContext());
String webId = WarpUtils.getWebId(Warply.getWarplyContext());
Map<String, Object> jsonParamsMerchants = new ArrayMap<>();
Map<String, Object> jsonParams = new ArrayMap<>();
jsonParams.put("action", "retrieve_multilingual");
jsonParams.put("language", WarplyProperty.getLanguage(Warply.getWarplyContext()));
jsonParamsMerchants.put("shops", jsonParams);
RequestBody couponsetsRequest = RequestBody.create(MediaType.get("application/json; charset=utf-8"), (new JSONObject(jsonParamsMerchants)).toString());
Call<ResponseBody> merchantsCall = service.getMerchants(
WarplyProperty.getAppUuid(Warply.getWarplyContext()),
couponsetsRequest,
timeStamp,
"android:" + Warply.getWarplyContext().getPackageName(),
new WarplyDeviceInfoCollector(Warply.getWarplyContext()).getUniqueDeviceId(),
"mobile",
webId,
WarpUtils.produceSignature(apiKey + timeStamp)
);
merchantsCall.enqueue(new Callback<ResponseBody>() {
@Override
public void onResponse(@NonNull Call<ResponseBody> call, @NonNull Response<ResponseBody> response) {
if (response.code() == 200 && response.body() != null) {
JSONObject jobjMerchantsResponse = null;
try {
jobjMerchantsResponse = new JSONObject(response.body().string());
} catch (Exception e) {
e.printStackTrace();
}
if (jobjMerchantsResponse != null && jobjMerchantsResponse.has("status") && jobjMerchantsResponse.optString("status", "2").equals("1")) {
JSONArray jMerchantsBody = null;
try {
jMerchantsBody = jobjMerchantsResponse.optJSONObject("context").optJSONObject("MAPP_SHOPS").optJSONArray("result");
} catch (Exception e) {
e.printStackTrace();
}
if (jMerchantsBody != null) {
ArrayList<Merchant> mMerchantList = new ArrayList<Merchant>();
final ExecutorService executorCouponsets = Executors.newFixedThreadPool(1);
JSONArray finalJMerchantsBody = jMerchantsBody;
executorCouponsets.submit(() -> {
for (int i = 0; i < finalJMerchantsBody.length(); ++i) {
Merchant tempCouponset = new Merchant(finalJMerchantsBody.optJSONObject(i));
mMerchantList.add(tempCouponset);
}
executorCouponsets.shutdownNow();
future.set(mMerchantList);
});
}
} else {
future.set(new ArrayList<Merchant>());
}
} else if (String.valueOf(response.code()).startsWith("5")) {
future.set(new ArrayList<Merchant>());
} else {
// future.set(new CouponsetsList());
future.setException(new Throwable());
}
}
@Override
public void onFailure(@NonNull Call<ResponseBody> call, @NonNull Throwable t) {
// future.set(new CouponsetsList());
future.setException(new Throwable());
}
});
return future;
}
private static ArrayList<BannerItem> mergeCampaignResults(ArrayList<Campaign> resultCampaigns, ArrayList<Campaign> resultPersonalizedCampaigns, ArrayList<Content> resultArticles) {
ArrayList<BannerItem> allItems = new ArrayList<>();
......@@ -503,8 +691,8 @@ public class WarplyManager {
Campaign camp = new Campaign();
NewCampaign tempNewCampaign = new NewCampaign(finalCampaignsJBody.optJSONObject(i));
camp.setIndexUrl(tempNewCampaign.getIndexUrl());
camp.setLogoUrl(tempNewCampaign.getLogoUrl());
camp.setIndexUrl(tempNewCampaign.getCampaignUrl());
camp.setLogoUrl(tempNewCampaign.getBannerImageMobile());
camp.setMessage(tempNewCampaign.getMessage());
camp.setOfferCategory(tempNewCampaign.getCommunicationCategory());
camp.setSessionUUID(tempNewCampaign.getCommunicationUUID());
......@@ -598,8 +786,8 @@ public class WarplyManager {
Campaign camp = new Campaign();
NewCampaign tempNewCampaign = new NewCampaign(finalCampaignsJBody.optJSONObject(i));
camp.setIndexUrl(tempNewCampaign.getIndexUrl());
camp.setLogoUrl(tempNewCampaign.getLogoUrl());
camp.setIndexUrl(tempNewCampaign.getCampaignUrl());
camp.setLogoUrl(tempNewCampaign.getBannerImageMobile());
camp.setMessage(tempNewCampaign.getMessage());
camp.setOfferCategory(tempNewCampaign.getCommunicationCategory());
camp.setSessionUUID(tempNewCampaign.getCommunicationUUID());
......