Panagiotis Triantafyllou

new coupons request part5, crash fixes

...@@ -150,7 +150,7 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener ...@@ -150,7 +150,7 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener
150 .concat(mCoupon.getName())); 150 .concat(mCoupon.getName()));
151 151
152 Intent intent = new Intent(CouponInfoActivity.this, CouponShareActivity.class); 152 Intent intent = new Intent(CouponInfoActivity.this, CouponShareActivity.class);
153 - intent.putExtra("coupon", (Serializable) mCoupon); 153 + intent.putExtra("coupon", mCoupon.getCoupon());
154 intent.putExtra("isFromWallet", mIsFromWallet); 154 intent.putExtra("isFromWallet", mIsFromWallet);
155 if (!mIsFromWallet) 155 if (!mIsFromWallet)
156 startActivity(intent); 156 startActivity(intent);
......
...@@ -38,6 +38,7 @@ import ly.warp.sdk.io.models.WarplyCouponsChangedEventModel; ...@@ -38,6 +38,7 @@ import ly.warp.sdk.io.models.WarplyCouponsChangedEventModel;
38 import ly.warp.sdk.io.request.CosmoteCouponSharingRequest; 38 import ly.warp.sdk.io.request.CosmoteCouponSharingRequest;
39 import ly.warp.sdk.io.request.WarplyConsumerRequest; 39 import ly.warp.sdk.io.request.WarplyConsumerRequest;
40 import ly.warp.sdk.io.request.WarplyUserCouponsRequest; 40 import ly.warp.sdk.io.request.WarplyUserCouponsRequest;
41 +import ly.warp.sdk.utils.WarplyManagerHelper;
41 import ly.warp.sdk.utils.managers.WarplyAnalyticsManager; 42 import ly.warp.sdk.utils.managers.WarplyAnalyticsManager;
42 import ly.warp.sdk.utils.managers.WarplyEventBusManager; 43 import ly.warp.sdk.utils.managers.WarplyEventBusManager;
43 import ly.warp.sdk.utils.managers.WarplyManager; 44 import ly.warp.sdk.utils.managers.WarplyManager;
...@@ -76,9 +77,16 @@ public class CouponShareActivity extends Activity implements View.OnClickListene ...@@ -76,9 +77,16 @@ public class CouponShareActivity extends Activity implements View.OnClickListene
76 super.onCreate(savedInstanceState); 77 super.onCreate(savedInstanceState);
77 setContentView(R.layout.activity_coupon_share); 78 setContentView(R.layout.activity_coupon_share);
78 79
79 - mCoupon = (Coupon) getIntent().getSerializableExtra("coupon"); 80 + String couponCode = getIntent().getStringExtra("coupon");
80 mIsFromWallet = getIntent().getBooleanExtra("isFromWallet", false); 81 mIsFromWallet = getIntent().getBooleanExtra("isFromWallet", false);
81 82
83 + for (Coupon cpn : WarplyManagerHelper.getCouponList()) {
84 + if (cpn.getCoupon().equals(couponCode)) {
85 + mCoupon = cpn;
86 + break;
87 + }
88 + }
89 +
82 mIvBack = findViewById(R.id.iv_coupon_share_back); 90 mIvBack = findViewById(R.id.iv_coupon_share_back);
83 mTvCouponTitle = findViewById(R.id.textView13); 91 mTvCouponTitle = findViewById(R.id.textView13);
84 mIvCouponPhoto = findViewById(R.id.imageView6); 92 mIvCouponPhoto = findViewById(R.id.imageView6);
...@@ -154,15 +162,15 @@ public class CouponShareActivity extends Activity implements View.OnClickListene ...@@ -154,15 +162,15 @@ public class CouponShareActivity extends Activity implements View.OnClickListene
154 // =========================================================== 162 // ===========================================================
155 163
156 private void initViews() { 164 private void initViews() {
157 - mTvCouponTitle.setText(mCoupon.getName()); 165 + mTvCouponTitle.setText(mCoupon.getCouponsetDetails().getName());
158 166
159 - if (!TextUtils.isEmpty(mCoupon.getImage())) { 167 + if (!TextUtils.isEmpty(mCoupon.getCouponsetDetails().getImgPreview())) {
160 Glide.with(this) 168 Glide.with(this)
161 // .setDefaultRequestOptions( 169 // .setDefaultRequestOptions(
162 // RequestOptions 170 // RequestOptions
163 // .placeholderOf(R.drawable.ic_default_contact_photo) 171 // .placeholderOf(R.drawable.ic_default_contact_photo)
164 // .error(R.drawable.ic_default_contact_photo)) 172 // .error(R.drawable.ic_default_contact_photo))
165 - .load(mCoupon.getImage()) 173 + .load(mCoupon.getCouponsetDetails().getImgPreview())
166 .diskCacheStrategy(DiskCacheStrategy.DATA) 174 .diskCacheStrategy(DiskCacheStrategy.DATA)
167 .into(mIvCouponPhoto); 175 .into(mIvCouponPhoto);
168 } else { 176 } else {
...@@ -288,7 +296,7 @@ public class CouponShareActivity extends Activity implements View.OnClickListene ...@@ -288,7 +296,7 @@ public class CouponShareActivity extends Activity implements View.OnClickListene
288 .setPositiveButton(R.string.cos_dlg_negative_button3, (dialogPositive, whichPositive) -> { 296 .setPositiveButton(R.string.cos_dlg_negative_button3, (dialogPositive, whichPositive) -> {
289 WarplyAnalyticsManager.logTrackersEvent(this, "click", ("ShareCoupon") 297 WarplyAnalyticsManager.logTrackersEvent(this, "click", ("ShareCoupon")
290 .concat(":") 298 .concat(":")
291 - .concat(mCoupon.getName())); 299 + .concat(mCoupon.getCouponsetDetails().getName()));
292 300
293 new Thread(() -> { 301 new Thread(() -> {
294 if (!Thread.currentThread().isInterrupted()) { 302 if (!Thread.currentThread().isInterrupted()) {
......
...@@ -76,10 +76,24 @@ public class CouponsetInfoActivity extends Activity implements View.OnClickListe ...@@ -76,10 +76,24 @@ public class CouponsetInfoActivity extends Activity implements View.OnClickListe
76 super.onCreate(savedInstanceState); 76 super.onCreate(savedInstanceState);
77 setContentView(R.layout.activity_couponset_info); 77 setContentView(R.layout.activity_couponset_info);
78 78
79 - mCouponset = (Couponset) getIntent().getSerializableExtra("couponset"); 79 + String couponsetCode = getIntent().getStringExtra("couponset");
80 - mLoyalty = (Campaign) getIntent().getSerializableExtra("loyalty"); 80 + String campaignCode = getIntent().getStringExtra("loyalty");
81 mCcms = (LoyaltyContextualOfferModel) getIntent().getSerializableExtra("ccms"); 81 mCcms = (LoyaltyContextualOfferModel) getIntent().getSerializableExtra("ccms");
82 82
83 + for (Couponset cpnst : WarplyManagerHelper.getCouponsets()) {
84 + if (cpnst.getUuid().equals(couponsetCode)) {
85 + mCouponset = cpnst;
86 + break;
87 + }
88 + }
89 +
90 + for (Campaign cmp : WarplyManagerHelper.getCampaignList()) {
91 + if (cmp.getSessionUUID().equals(campaignCode)) {
92 + mLoyalty = cmp;
93 + break;
94 + }
95 + }
96 +
83 mIvBack = findViewById(R.id.iv_couponset_info_back); 97 mIvBack = findViewById(R.id.iv_couponset_info_back);
84 mTvTerms = findViewById(R.id.tv_terms); 98 mTvTerms = findViewById(R.id.tv_terms);
85 mTvCouponsetTitle = findViewById(R.id.textView13); 99 mTvCouponsetTitle = findViewById(R.id.textView13);
......
...@@ -25,7 +25,6 @@ import java.io.Serializable; ...@@ -25,7 +25,6 @@ import java.io.Serializable;
25 import java.util.ArrayList; 25 import java.util.ArrayList;
26 import java.util.HashSet; 26 import java.util.HashSet;
27 import java.util.LinkedHashSet; 27 import java.util.LinkedHashSet;
28 -import java.util.Objects;
29 import java.util.Set; 28 import java.util.Set;
30 29
31 import io.github.inflationx.viewpump.ViewPumpContextWrapper; 30 import io.github.inflationx.viewpump.ViewPumpContextWrapper;
...@@ -254,8 +253,8 @@ public class GiftsForYouActivity extends AppCompatActivity implements View.OnCli ...@@ -254,8 +253,8 @@ public class GiftsForYouActivity extends AppCompatActivity implements View.OnCli
254 WarplyAnalyticsManager.logTrackersEvent(this, "click", ("Loyalty").concat(":").concat(dataItem.getCampaign().getSessionUUID())); 253 WarplyAnalyticsManager.logTrackersEvent(this, "click", ("Loyalty").concat(":").concat(dataItem.getCampaign().getSessionUUID()));
255 WarplyManager.getSingleCampaign(dataItem.getCampaign().getSessionUUID()); 254 WarplyManager.getSingleCampaign(dataItem.getCampaign().getSessionUUID());
256 Intent intent = new Intent(GiftsForYouActivity.this, CouponsetInfoActivity.class); 255 Intent intent = new Intent(GiftsForYouActivity.this, CouponsetInfoActivity.class);
257 - intent.putExtra("couponset", (Serializable) cpns); 256 + intent.putExtra("couponset", cpns.getUuid());
258 - intent.putExtra("loyalty", (Serializable) dataItem.getCampaign()); 257 + intent.putExtra("loyalty", dataItem.getCampaign().getSessionUUID());
259 intent.putExtra("ccms", ccmsItem); 258 intent.putExtra("ccms", ccmsItem);
260 startActivityForResult(intent, 1004); 259 startActivityForResult(intent, 1004);
261 break; 260 break;
...@@ -294,8 +293,8 @@ public class GiftsForYouActivity extends AppCompatActivity implements View.OnCli ...@@ -294,8 +293,8 @@ public class GiftsForYouActivity extends AppCompatActivity implements View.OnCli
294 WarplyAnalyticsManager.logTrackersEvent(this, "click", ("Loyalty").concat(":").concat(dataItem.getCampaign().getSessionUUID())); 293 WarplyAnalyticsManager.logTrackersEvent(this, "click", ("Loyalty").concat(":").concat(dataItem.getCampaign().getSessionUUID()));
295 WarplyManager.getSingleCampaign(dataItem.getCampaign().getSessionUUID()); 294 WarplyManager.getSingleCampaign(dataItem.getCampaign().getSessionUUID());
296 Intent intent = new Intent(GiftsForYouActivity.this, CouponsetInfoActivity.class); 295 Intent intent = new Intent(GiftsForYouActivity.this, CouponsetInfoActivity.class);
297 - intent.putExtra("couponset", (Serializable) cpns); 296 + intent.putExtra("couponset", cpns.getUuid());
298 - intent.putExtra("loyalty", (Serializable) dataItem.getCampaign()); 297 + intent.putExtra("loyalty", dataItem.getCampaign().getSessionUUID());
299 startActivityForResult(intent, 1004); 298 startActivityForResult(intent, 1004);
300 break; 299 break;
301 } 300 }
...@@ -332,7 +331,7 @@ public class GiftsForYouActivity extends AppCompatActivity implements View.OnCli ...@@ -332,7 +331,7 @@ public class GiftsForYouActivity extends AppCompatActivity implements View.OnCli
332 WarplyManager.getSingleCampaign(dataItem.getCampaign().getSessionUUID()); 331 WarplyManager.getSingleCampaign(dataItem.getCampaign().getSessionUUID());
333 Intent intent = new Intent(GiftsForYouActivity.this, TelcoActivity.class); 332 Intent intent = new Intent(GiftsForYouActivity.this, TelcoActivity.class);
334 intent.putExtra("ccms", ccms); 333 intent.putExtra("ccms", ccms);
335 - intent.putExtra("loyalty", (Serializable) dataItem.getCampaign()); 334 + intent.putExtra("loyalty", dataItem.getCampaign().getSessionUUID());
336 startActivityForResult(intent, 1004); 335 startActivityForResult(intent, 1004);
337 break; 336 break;
338 } 337 }
......
...@@ -23,6 +23,7 @@ import org.json.JSONArray; ...@@ -23,6 +23,7 @@ import org.json.JSONArray;
23 import org.json.JSONObject; 23 import org.json.JSONObject;
24 24
25 import java.util.ArrayList; 25 import java.util.ArrayList;
26 +import java.util.Collections;
26 import java.util.concurrent.ExecutorService; 27 import java.util.concurrent.ExecutorService;
27 import java.util.concurrent.Executors; 28 import java.util.concurrent.Executors;
28 29
...@@ -115,6 +116,7 @@ public class LoyaltyMarketAnalysisActivity extends Activity implements View.OnCl ...@@ -115,6 +116,7 @@ public class LoyaltyMarketAnalysisActivity extends Activity implements View.OnCl
115 } 116 }
116 } 117 }
117 } 118 }
119 + Collections.sort(mExpiredMarketCoupons, (coupon1, coupon2) -> coupon2.getChangesDates().optString("redeemed").compareTo(coupon1.getChangesDates().optString("redeemed")));
118 new Handler(Looper.getMainLooper()).post(this::initViews); 120 new Handler(Looper.getMainLooper()).post(this::initViews);
119 executor.shutdownNow(); 121 executor.shutdownNow();
120 }); 122 });
......
...@@ -23,7 +23,6 @@ import org.json.JSONObject; ...@@ -23,7 +23,6 @@ import org.json.JSONObject;
23 import java.io.Serializable; 23 import java.io.Serializable;
24 import java.util.ArrayList; 24 import java.util.ArrayList;
25 import java.util.HashMap; 25 import java.util.HashMap;
26 -import java.util.Iterator;
27 import java.util.Map; 26 import java.util.Map;
28 import java.util.TreeMap; 27 import java.util.TreeMap;
29 28
...@@ -420,7 +419,7 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener ...@@ -420,7 +419,7 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener
420 WarplyManager.getSingleCampaign(moreItem.getSessionUUID()); 419 WarplyManager.getSingleCampaign(moreItem.getSessionUUID());
421 Intent intent = new Intent(MoreForYouActivity.this, TelcoActivity.class); 420 Intent intent = new Intent(MoreForYouActivity.this, TelcoActivity.class);
422 intent.putExtra("ccms", ccms); 421 intent.putExtra("ccms", ccms);
423 - intent.putExtra("loyalty", (Serializable) moreItem); 422 + intent.putExtra("loyalty", moreItem.getSessionUUID());
424 startActivityForResult(intent, 1003); 423 startActivityForResult(intent, 1003);
425 break; 424 break;
426 } 425 }
......
...@@ -34,6 +34,7 @@ import ly.warp.sdk.io.models.LoyaltySDKFirebaseEventModel; ...@@ -34,6 +34,7 @@ import ly.warp.sdk.io.models.LoyaltySDKFirebaseEventModel;
34 import ly.warp.sdk.io.models.WarplyCCMSEnabledModel; 34 import ly.warp.sdk.io.models.WarplyCCMSEnabledModel;
35 import ly.warp.sdk.io.request.CosmoteSubmitOrderRequest; 35 import ly.warp.sdk.io.request.CosmoteSubmitOrderRequest;
36 import ly.warp.sdk.io.request.WarplyConsumerRequest; 36 import ly.warp.sdk.io.request.WarplyConsumerRequest;
37 +import ly.warp.sdk.utils.WarplyManagerHelper;
37 import ly.warp.sdk.utils.managers.WarplyAnalyticsManager; 38 import ly.warp.sdk.utils.managers.WarplyAnalyticsManager;
38 import ly.warp.sdk.utils.managers.WarplyEventBusManager; 39 import ly.warp.sdk.utils.managers.WarplyEventBusManager;
39 import ly.warp.sdk.utils.managers.WarplyManager; 40 import ly.warp.sdk.utils.managers.WarplyManager;
...@@ -73,7 +74,14 @@ public class TelcoActivity extends Activity implements View.OnClickListener { ...@@ -73,7 +74,14 @@ public class TelcoActivity extends Activity implements View.OnClickListener {
73 setContentView(R.layout.activity_telco); 74 setContentView(R.layout.activity_telco);
74 75
75 mCCMS = (LoyaltyContextualOfferModel) getIntent().getSerializableExtra("ccms"); 76 mCCMS = (LoyaltyContextualOfferModel) getIntent().getSerializableExtra("ccms");
76 - mLoyalty = (Campaign) getIntent().getSerializableExtra("loyalty"); 77 + String campaignCode = getIntent().getStringExtra("loyalty");
78 +
79 + for (Campaign cmp : WarplyManagerHelper.getCampaignList()) {
80 + if (cmp.getSessionUUID().equals(campaignCode)) {
81 + mLoyalty = cmp;
82 + break;
83 + }
84 + }
77 85
78 mIvBack = findViewById(R.id.iv_telco_back); 86 mIvBack = findViewById(R.id.iv_telco_back);
79 mTvCampaignTitle = findViewById(R.id.textView13); 87 mTvCampaignTitle = findViewById(R.id.textView13);
......
...@@ -107,6 +107,7 @@ public class Campaign implements Parcelable, Serializable { ...@@ -107,6 +107,7 @@ public class Campaign implements Parcelable, Serializable {
107 private String bannerTitle; 107 private String bannerTitle;
108 private String categoryId; 108 private String categoryId;
109 private Integer couponAvailability; 109 private Integer couponAvailability;
110 + private String endDate, startDate;
110 111
111 /** 112 /**
112 * Basic constructor used to create an object from a String, representing a 113 * Basic constructor used to create an object from a String, representing a
...@@ -148,6 +149,8 @@ public class Campaign implements Parcelable, Serializable { ...@@ -148,6 +149,8 @@ public class Campaign implements Parcelable, Serializable {
148 this.bannerTitle = ""; 149 this.bannerTitle = "";
149 this.couponAvailability = null; 150 this.couponAvailability = null;
150 this.categoryId = ""; 151 this.categoryId = "";
152 + this.endDate = "";
153 + this.startDate = "";
151 } 154 }
152 155
153 /** 156 /**
...@@ -659,6 +662,22 @@ public class Campaign implements Parcelable, Serializable { ...@@ -659,6 +662,22 @@ public class Campaign implements Parcelable, Serializable {
659 this.bannerTitle = bannerTitle; 662 this.bannerTitle = bannerTitle;
660 } 663 }
661 664
665 + public String getEndDate() {
666 + return endDate;
667 + }
668 +
669 + public void setEndDate(String endDate) {
670 + this.endDate = endDate;
671 + }
672 +
673 + public String getStartDate() {
674 + return startDate;
675 + }
676 +
677 + public void setStartDate(String startDate) {
678 + this.startDate = startDate;
679 + }
680 +
662 @Override 681 @Override
663 public int describeContents() { 682 public int describeContents() {
664 return 0; 683 return 0;
......
...@@ -163,6 +163,7 @@ public class Couponset implements Parcelable, Serializable { ...@@ -163,6 +163,7 @@ public class Couponset implements Parcelable, Serializable {
163 this.couponsetType = ""; 163 this.couponsetType = "";
164 this.img_preview = ""; 164 this.img_preview = "";
165 this.innerText = ""; 165 this.innerText = "";
166 + this.final_price = 0.0d;
166 } 167 }
167 168
168 /** 169 /**
...@@ -239,6 +240,7 @@ public class Couponset implements Parcelable, Serializable { ...@@ -239,6 +240,7 @@ public class Couponset implements Parcelable, Serializable {
239 this.couponsetType = json.optString("couponset_type"); 240 this.couponsetType = json.optString("couponset_type");
240 this.img_preview = json.optString(IMG_PREVIEW); 241 this.img_preview = json.optString(IMG_PREVIEW);
241 this.innerText = json.optString(INNER_TEXT); 242 this.innerText = json.optString(INNER_TEXT);
243 + this.final_price = json.isNull(FINAL_PRICE) ? 0.0d : json.optDouble(FINAL_PRICE);
242 // SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm"); 244 // SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm");
243 // Date newDate = new Date(); 245 // Date newDate = new Date();
244 // String tempRedeemDate = json.optString("end_date"); 246 // String tempRedeemDate = json.optString("end_date");
......
...@@ -863,7 +863,7 @@ public class WarplyManagerHelper { ...@@ -863,7 +863,7 @@ public class WarplyManagerHelper {
863 WarplyManager.getSingleCampaign(camp.getSessionUUID()); 863 WarplyManager.getSingleCampaign(camp.getSessionUUID());
864 Intent intent = new Intent(context, TelcoActivity.class); 864 Intent intent = new Intent(context, TelcoActivity.class);
865 intent.putExtra("ccms", item); 865 intent.putExtra("ccms", item);
866 - intent.putExtra("loyalty", (Serializable) camp); 866 + intent.putExtra("loyalty", camp.getSessionUUID());
867 context.startActivity(intent); 867 context.startActivity(intent);
868 break; 868 break;
869 } 869 }
...@@ -906,8 +906,8 @@ public class WarplyManagerHelper { ...@@ -906,8 +906,8 @@ public class WarplyManagerHelper {
906 WarplyAnalyticsManager.logTrackersEvent(context, "click", ("Loyalty").concat(":").concat(item.getSessionUUID())); 906 WarplyAnalyticsManager.logTrackersEvent(context, "click", ("Loyalty").concat(":").concat(item.getSessionUUID()));
907 WarplyManager.getSingleCampaign(item.getSessionUUID()); 907 WarplyManager.getSingleCampaign(item.getSessionUUID());
908 Intent intent = new Intent(context, CouponsetInfoActivity.class); 908 Intent intent = new Intent(context, CouponsetInfoActivity.class);
909 - intent.putExtra("couponset", (Serializable) cpns); 909 + intent.putExtra("couponset", cpns.getUuid());
910 - intent.putExtra("loyalty", (Serializable) item); 910 + intent.putExtra("loyalty", item.getSessionUUID());
911 intent.putExtra("ccms", ccmsItem); 911 intent.putExtra("ccms", ccmsItem);
912 context.startActivity(intent); 912 context.startActivity(intent);
913 break; 913 break;
...@@ -946,8 +946,8 @@ public class WarplyManagerHelper { ...@@ -946,8 +946,8 @@ public class WarplyManagerHelper {
946 WarplyAnalyticsManager.logTrackersEvent(context, "click", ("Loyalty").concat(":").concat(item.getSessionUUID())); 946 WarplyAnalyticsManager.logTrackersEvent(context, "click", ("Loyalty").concat(":").concat(item.getSessionUUID()));
947 WarplyManager.getSingleCampaign(item.getSessionUUID()); 947 WarplyManager.getSingleCampaign(item.getSessionUUID());
948 Intent intent = new Intent(context, CouponsetInfoActivity.class); 948 Intent intent = new Intent(context, CouponsetInfoActivity.class);
949 - intent.putExtra("couponset", (Serializable) cpns); 949 + intent.putExtra("couponset", cpns.getUuid());
950 - intent.putExtra("loyalty", (Serializable) item); 950 + intent.putExtra("loyalty", item.getSessionUUID());
951 context.startActivity(intent); 951 context.startActivity(intent);
952 break; 952 break;
953 } 953 }
...@@ -1081,8 +1081,8 @@ public class WarplyManagerHelper { ...@@ -1081,8 +1081,8 @@ public class WarplyManagerHelper {
1081 for (Couponset cpns : mCouponsetsList) { 1081 for (Couponset cpns : mCouponsetsList) {
1082 if (cpns.getUuid().equals(cpnUuid)) { 1082 if (cpns.getUuid().equals(cpnUuid)) {
1083 Intent intent = new Intent(context, CouponsetInfoActivity.class); 1083 Intent intent = new Intent(context, CouponsetInfoActivity.class);
1084 - intent.putExtra("couponset", (Serializable) cpns); 1084 + intent.putExtra("couponset", cpns.getUuid());
1085 - intent.putExtra("loyalty", (Serializable) item); 1085 + intent.putExtra("loyalty", item.getSessionUUID());
1086 context.startActivity(intent); 1086 context.startActivity(intent);
1087 break; 1087 break;
1088 } 1088 }
...@@ -1099,7 +1099,7 @@ public class WarplyManagerHelper { ...@@ -1099,7 +1099,7 @@ public class WarplyManagerHelper {
1099 if (ccms.getLoyaltyCampaignId().equals(item.getSessionUUID())) { 1099 if (ccms.getLoyaltyCampaignId().equals(item.getSessionUUID())) {
1100 Intent intent = new Intent(context, TelcoActivity.class); 1100 Intent intent = new Intent(context, TelcoActivity.class);
1101 intent.putExtra("ccms", ccms); 1101 intent.putExtra("ccms", ccms);
1102 - intent.putExtra("loyalty", (Serializable) item); 1102 + intent.putExtra("loyalty", item.getSessionUUID());
1103 context.startActivity(intent); 1103 context.startActivity(intent);
1104 break; 1104 break;
1105 } 1105 }
...@@ -1336,7 +1336,7 @@ public class WarplyManagerHelper { ...@@ -1336,7 +1336,7 @@ public class WarplyManagerHelper {
1336 try { 1336 try {
1337 couponCount += 1; 1337 couponCount += 1;
1338 // couponValue += Float.parseFloat(coupon.getDiscount()); 1338 // couponValue += Float.parseFloat(coupon.getDiscount());
1339 - couponValue += (float) coupon.getFinal_price(); 1339 + couponValue += (float) coupon.getCouponsetDetails().getFinal_price();
1340 } catch (NumberFormatException e) { 1340 } catch (NumberFormatException e) {
1341 couponCount -= 1; 1341 couponCount -= 1;
1342 } 1342 }
......
...@@ -1764,6 +1764,8 @@ public class WarplyManager { ...@@ -1764,6 +1764,8 @@ public class WarplyManager {
1764 camp.setSorting(newCamp.getSorting()); 1764 camp.setSorting(newCamp.getSorting());
1765 camp.setNew(newCamp.getIsNew()); 1765 camp.setNew(newCamp.getIsNew());
1766 camp.setType(newCamp.getCampaignType()); 1766 camp.setType(newCamp.getCampaignType());
1767 + camp.setEndDate(newCamp.getEndDate());
1768 + camp.setStartDate(newCamp.getStartDate());
1767 try { 1769 try {
1768 camp.setExtraFields(newCamp.getExtraFields().toString()); 1770 camp.setExtraFields(newCamp.getExtraFields().toString());
1769 if (!TextUtils.isEmpty(newCamp.getExtraFields().toString())) { 1771 if (!TextUtils.isEmpty(newCamp.getExtraFields().toString())) {
...@@ -1906,6 +1908,8 @@ public class WarplyManager { ...@@ -1906,6 +1908,8 @@ public class WarplyManager {
1906 camp.setSorting(newCamp.getSorting()); 1908 camp.setSorting(newCamp.getSorting());
1907 camp.setNew(newCamp.getIsNew()); 1909 camp.setNew(newCamp.getIsNew());
1908 camp.setType(newCamp.getCampaignType()); 1910 camp.setType(newCamp.getCampaignType());
1911 + camp.setEndDate(newCamp.getEndDate());
1912 + camp.setStartDate(newCamp.getStartDate());
1909 try { 1913 try {
1910 camp.setExtraFields(newCamp.getExtraFields().toString()); 1914 camp.setExtraFields(newCamp.getExtraFields().toString());
1911 if (!TextUtils.isEmpty(newCamp.getExtraFields().toString())) { 1915 if (!TextUtils.isEmpty(newCamp.getExtraFields().toString())) {
......
...@@ -24,8 +24,6 @@ import io.reactivex.subjects.PublishSubject; ...@@ -24,8 +24,6 @@ import io.reactivex.subjects.PublishSubject;
24 import ly.warp.sdk.R; 24 import ly.warp.sdk.R;
25 import ly.warp.sdk.io.models.Coupon; 25 import ly.warp.sdk.io.models.Coupon;
26 import ly.warp.sdk.io.models.CouponList; 26 import ly.warp.sdk.io.models.CouponList;
27 -import ly.warp.sdk.io.models.Merchant;
28 -import ly.warp.sdk.utils.WarplyManagerHelper;
29 27
30 public class ExpiredCouponAdapter extends RecyclerView.Adapter<ExpiredCouponAdapter.ExpiredCouponViewHolder> { 28 public class ExpiredCouponAdapter extends RecyclerView.Adapter<ExpiredCouponAdapter.ExpiredCouponViewHolder> {
31 29
...@@ -93,43 +91,19 @@ public class ExpiredCouponAdapter extends RecyclerView.Adapter<ExpiredCouponAdap ...@@ -93,43 +91,19 @@ public class ExpiredCouponAdapter extends RecyclerView.Adapter<ExpiredCouponAdap
93 @Override 91 @Override
94 public void onBindViewHolder(final ExpiredCouponViewHolder holder, int position) { 92 public void onBindViewHolder(final ExpiredCouponViewHolder holder, int position) {
95 Coupon couponItem = mCoupons.get(position); 93 Coupon couponItem = mCoupons.get(position);
96 - Merchant merchant = new Merchant();
97 94
98 if (couponItem != null) { 95 if (couponItem != null) {
99 if (mIsCustom) { 96 if (mIsCustom) {
100 - if (WarplyManagerHelper.getMerchantList() != null && WarplyManagerHelper.getMerchantList().size() > 0) { 97 + holder.tvCouponTitle.setText(couponItem.getMerchantDetails().getAdminName());
101 - for (Merchant mer : WarplyManagerHelper.getMerchantList()) { 98 + if (!TextUtils.isEmpty(couponItem.getMerchantDetails().getImgPreview())) {
102 - if (mer.getUuid().equals(couponItem.getMerchantUuid())) { 99 + Glide.with(mContext)
103 - merchant = mer;
104 - break;
105 - }
106 - }
107 - }
108 -
109 - if (merchant == null) {
110 - holder.tvCouponTitle.setText(couponItem.getName());
111 - if (!TextUtils.isEmpty(couponItem.getImage())) {
112 - Glide.with(mContext)
113 -// .setDefaultRequestOptions(
114 -// RequestOptions
115 -// .placeholderOf(R.drawable.ic_default_contact_photo)
116 -// .error(R.drawable.ic_default_contact_photo))
117 - .load(couponItem.getImage())
118 - .diskCacheStrategy(DiskCacheStrategy.DATA)
119 - .into(holder.ivCouponLogo);
120 - }
121 - } else {
122 - holder.tvCouponTitle.setText(merchant.getAdminName());
123 - if (!TextUtils.isEmpty(merchant.getImgPreview())) {
124 - Glide.with(mContext)
125 // .setDefaultRequestOptions( 100 // .setDefaultRequestOptions(
126 // RequestOptions 101 // RequestOptions
127 // .placeholderOf(R.drawable.ic_default_contact_photo) 102 // .placeholderOf(R.drawable.ic_default_contact_photo)
128 // .error(R.drawable.ic_default_contact_photo)) 103 // .error(R.drawable.ic_default_contact_photo))
129 - .load(merchant.getImgPreview()) 104 + .load(couponItem.getMerchantDetails().getImgPreview())
130 - .diskCacheStrategy(DiskCacheStrategy.DATA) 105 + .diskCacheStrategy(DiskCacheStrategy.DATA)
131 - .into(holder.ivCouponLogo); 106 + .into(holder.ivCouponLogo);
132 - }
133 } 107 }
134 108
135 SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm"); 109 SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm");
...@@ -149,29 +123,16 @@ public class ExpiredCouponAdapter extends RecyclerView.Adapter<ExpiredCouponAdap ...@@ -149,29 +123,16 @@ public class ExpiredCouponAdapter extends RecyclerView.Adapter<ExpiredCouponAdap
149 return; 123 return;
150 } 124 }
151 125
152 - if (WarplyManagerHelper.getMerchantList() != null && WarplyManagerHelper.getMerchantList().size() > 0) { 126 + holder.tvCouponTitle.setText(couponItem.getMerchantDetails().getAdminName());
153 - for (Merchant mer : WarplyManagerHelper.getMerchantList()) { 127 + if (!TextUtils.isEmpty(couponItem.getMerchantDetails().getImgPreview())) {
154 - if (mer.getUuid().equals(couponItem.getMerchantUuid())) { 128 + Glide.with(mContext)
155 - merchant = mer;
156 - break;
157 - }
158 - }
159 - }
160 -
161 - if (merchant == null) {
162 - holder.tvCouponTitle.setText(couponItem.getName());
163 - } else {
164 - holder.tvCouponTitle.setText(merchant.getAdminName());
165 - if (!TextUtils.isEmpty(merchant.getImgPreview())) {
166 - Glide.with(mContext)
167 // .setDefaultRequestOptions( 129 // .setDefaultRequestOptions(
168 // RequestOptions 130 // RequestOptions
169 // .placeholderOf(R.drawable.ic_default_contact_photo) 131 // .placeholderOf(R.drawable.ic_default_contact_photo)
170 // .error(R.drawable.ic_default_contact_photo)) 132 // .error(R.drawable.ic_default_contact_photo))
171 - .load(merchant.getImgPreview()) 133 + .load(couponItem.getMerchantDetails().getImgPreview())
172 - .diskCacheStrategy(DiskCacheStrategy.DATA) 134 + .diskCacheStrategy(DiskCacheStrategy.DATA)
173 - .into(holder.ivCouponLogo); 135 + .into(holder.ivCouponLogo);
174 - }
175 } 136 }
176 137
177 SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm"); 138 SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm");
...@@ -185,7 +146,7 @@ public class ExpiredCouponAdapter extends RecyclerView.Adapter<ExpiredCouponAdap ...@@ -185,7 +146,7 @@ public class ExpiredCouponAdapter extends RecyclerView.Adapter<ExpiredCouponAdap
185 holder.tvCouponDate.setVisibility(View.GONE); 146 holder.tvCouponDate.setVisibility(View.GONE);
186 } 147 }
187 148
188 - String itemValue = String.format("%.02f", couponItem.getFinal_price()); 149 + String itemValue = String.format("%.02f", couponItem.getCouponsetDetails().getFinal_price());
189 holder.tvCouponValue.setText(itemValue + mContext.getResources().getString(R.string.euro)); 150 holder.tvCouponValue.setText(itemValue + mContext.getResources().getString(R.string.euro));
190 holder.itemView.setOnClickListener(v -> onClickSubject.onNext(couponItem)); 151 holder.itemView.setOnClickListener(v -> onClickSubject.onNext(couponItem));
191 } 152 }
......