new coupons request part3, fixes in active coupons, sm coupons, map
Showing
10 changed files
with
48 additions
and
27 deletions
| ... | @@ -116,7 +116,7 @@ public class ActiveCouponsActivity extends Activity implements View.OnClickListe | ... | @@ -116,7 +116,7 @@ public class ActiveCouponsActivity extends Activity implements View.OnClickListe |
| 116 | mCouponsPressed = true; | 116 | mCouponsPressed = true; |
| 117 | WarplyAnalyticsManager.logTrackersEvent(this, "click", ("Coupon").concat(":").concat(coupon.getName())); | 117 | WarplyAnalyticsManager.logTrackersEvent(this, "click", ("Coupon").concat(":").concat(coupon.getName())); |
| 118 | Intent intent = new Intent(ActiveCouponsActivity.this, CouponInfoActivity.class); | 118 | Intent intent = new Intent(ActiveCouponsActivity.this, CouponInfoActivity.class); |
| 119 | - intent.putExtra("coupon", (Serializable) coupon); | 119 | + intent.putExtra("coupon", coupon.getCoupon()); |
| 120 | startActivity(intent); | 120 | startActivity(intent); |
| 121 | } | 121 | } |
| 122 | }) | 122 | }) | ... | ... |
| ... | @@ -93,7 +93,7 @@ public class ActiveGiftsActivity extends Activity implements View.OnClickListene | ... | @@ -93,7 +93,7 @@ public class ActiveGiftsActivity extends Activity implements View.OnClickListene |
| 93 | startActivity(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCampaignUrl(dataItem.getCampaign()))); | 93 | startActivity(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCampaignUrl(dataItem.getCampaign()))); |
| 94 | } else if (dataItem.getDataType() == 2) { | 94 | } else if (dataItem.getDataType() == 2) { |
| 95 | Intent intent = new Intent(ActiveGiftsActivity.this, CouponInfoActivity.class); | 95 | Intent intent = new Intent(ActiveGiftsActivity.this, CouponInfoActivity.class); |
| 96 | - intent.putExtra("coupon", (Serializable) dataItem.getCoupon()); | 96 | + intent.putExtra("coupon", dataItem.getCoupon().getCoupon()); |
| 97 | startActivity(intent); | 97 | startActivity(intent); |
| 98 | } | 98 | } |
| 99 | }) | 99 | }) | ... | ... |
This diff is collapsed. Click to expand it.
| ... | @@ -39,7 +39,7 @@ import java.util.ArrayList; | ... | @@ -39,7 +39,7 @@ import java.util.ArrayList; |
| 39 | import io.github.inflationx.viewpump.ViewPumpContextWrapper; | 39 | import io.github.inflationx.viewpump.ViewPumpContextWrapper; |
| 40 | import ly.warp.sdk.R; | 40 | import ly.warp.sdk.R; |
| 41 | import ly.warp.sdk.io.callbacks.CallbackReceiver; | 41 | import ly.warp.sdk.io.callbacks.CallbackReceiver; |
| 42 | -import ly.warp.sdk.io.models.Couponset; | 42 | +import ly.warp.sdk.io.models.Coupon; |
| 43 | import ly.warp.sdk.io.models.Merchant; | 43 | import ly.warp.sdk.io.models.Merchant; |
| 44 | import ly.warp.sdk.io.models.MerchantList; | 44 | import ly.warp.sdk.io.models.MerchantList; |
| 45 | import ly.warp.sdk.utils.WarplyManagerHelper; | 45 | import ly.warp.sdk.utils.WarplyManagerHelper; |
| ... | @@ -64,7 +64,7 @@ public class ShopsActivity extends FragmentActivity implements View.OnClickListe | ... | @@ -64,7 +64,7 @@ public class ShopsActivity extends FragmentActivity implements View.OnClickListe |
| 64 | // =========================================================== | 64 | // =========================================================== |
| 65 | 65 | ||
| 66 | private ImageView mIvBack; | 66 | private ImageView mIvBack; |
| 67 | - private Couponset mCouponset; | 67 | + private Coupon mCoupon; |
| 68 | private GoogleMap mMap; | 68 | private GoogleMap mMap; |
| 69 | private ClusterManager<Merchant> mClusterManager; | 69 | private ClusterManager<Merchant> mClusterManager; |
| 70 | private SupportMapFragment mMapView; | 70 | private SupportMapFragment mMapView; |
| ... | @@ -82,13 +82,12 @@ public class ShopsActivity extends FragmentActivity implements View.OnClickListe | ... | @@ -82,13 +82,12 @@ public class ShopsActivity extends FragmentActivity implements View.OnClickListe |
| 82 | super.onCreate(savedInstanceState); | 82 | super.onCreate(savedInstanceState); |
| 83 | setContentView(R.layout.activity_shops); | 83 | setContentView(R.layout.activity_shops); |
| 84 | 84 | ||
| 85 | - mCouponset = (Couponset) getIntent().getSerializableExtra("couponset"); | 85 | + String couponCode = getIntent().getStringExtra("coupon"); |
| 86 | - if (mCouponset != null) { | 86 | + for (Coupon cpn : WarplyManagerHelper.getCouponList()) { |
| 87 | - for (Merchant merchant : WarplyManagerHelper.getMerchantList()) { | 87 | + if (cpn.getCoupon().equals(couponCode)) { |
| 88 | - if (merchant.getUuid().equals(mCouponset.getMerchantUuid())) { | 88 | + mCoupon = cpn; |
| 89 | - mMerchant = merchant; | 89 | + mMerchant = cpn.getMerchantDetails(); |
| 90 | - break; | 90 | + break; |
| 91 | - } | ||
| 92 | } | 91 | } |
| 93 | } | 92 | } |
| 94 | 93 | ||
| ... | @@ -178,9 +177,9 @@ public class ShopsActivity extends FragmentActivity implements View.OnClickListe | ... | @@ -178,9 +177,9 @@ public class ShopsActivity extends FragmentActivity implements View.OnClickListe |
| 178 | //// mMap.setOnMarkerClickListener(/*mClusterManager*/this); | 177 | //// mMap.setOnMarkerClickListener(/*mClusterManager*/this); |
| 179 | // } | 178 | // } |
| 180 | 179 | ||
| 181 | - if (mCouponset != null) { | 180 | + if (mCoupon != null) { |
| 182 | ArrayList<String> uuids = new ArrayList<>(); | 181 | ArrayList<String> uuids = new ArrayList<>(); |
| 183 | - uuids.add(mCouponset.getMerchantUuid()); | 182 | + uuids.add(mCoupon.getMerchantUuid()); |
| 184 | WarplyManager.getMerchantsMultilingual(true, uuids, mMerchantsCallback); | 183 | WarplyManager.getMerchantsMultilingual(true, uuids, mMerchantsCallback); |
| 185 | } else { | 184 | } else { |
| 186 | ArrayList<String> catuuids = new ArrayList<>(); | 185 | ArrayList<String> catuuids = new ArrayList<>(); | ... | ... |
| ... | @@ -38,7 +38,7 @@ import java.util.ArrayList; | ... | @@ -38,7 +38,7 @@ import java.util.ArrayList; |
| 38 | import io.github.inflationx.viewpump.ViewPumpContextWrapper; | 38 | import io.github.inflationx.viewpump.ViewPumpContextWrapper; |
| 39 | import ly.warp.sdk.R; | 39 | import ly.warp.sdk.R; |
| 40 | import ly.warp.sdk.io.callbacks.CallbackReceiver; | 40 | import ly.warp.sdk.io.callbacks.CallbackReceiver; |
| 41 | -import ly.warp.sdk.io.models.Couponset; | 41 | +import ly.warp.sdk.io.models.Coupon; |
| 42 | import ly.warp.sdk.io.models.Merchant; | 42 | import ly.warp.sdk.io.models.Merchant; |
| 43 | import ly.warp.sdk.io.models.MerchantList; | 43 | import ly.warp.sdk.io.models.MerchantList; |
| 44 | import ly.warp.sdk.utils.WarplyManagerHelper; | 44 | import ly.warp.sdk.utils.WarplyManagerHelper; |
| ... | @@ -62,7 +62,7 @@ public class ShopsHuaweiActivity extends FragmentActivity implements View.OnClic | ... | @@ -62,7 +62,7 @@ public class ShopsHuaweiActivity extends FragmentActivity implements View.OnClic |
| 62 | // =========================================================== | 62 | // =========================================================== |
| 63 | 63 | ||
| 64 | private ImageView mIvBack; | 64 | private ImageView mIvBack; |
| 65 | - private Couponset mCouponset; | 65 | + private Coupon mCoupon; |
| 66 | private HuaweiMap mMap; | 66 | private HuaweiMap mMap; |
| 67 | // private ClusterManager<Merchant> mClusterManager; | 67 | // private ClusterManager<Merchant> mClusterManager; |
| 68 | private SupportMapFragment mSupportMapFragment; | 68 | private SupportMapFragment mSupportMapFragment; |
| ... | @@ -81,13 +81,12 @@ public class ShopsHuaweiActivity extends FragmentActivity implements View.OnClic | ... | @@ -81,13 +81,12 @@ public class ShopsHuaweiActivity extends FragmentActivity implements View.OnClic |
| 81 | MapsInitializer.initialize(this); | 81 | MapsInitializer.initialize(this); |
| 82 | setContentView(R.layout.activity_shops_huawei); | 82 | setContentView(R.layout.activity_shops_huawei); |
| 83 | 83 | ||
| 84 | - mCouponset = (Couponset) getIntent().getSerializableExtra("couponset"); | 84 | + String couponCode = getIntent().getStringExtra("coupon"); |
| 85 | - if (mCouponset != null) { | 85 | + for (Coupon cpn : WarplyManagerHelper.getCouponList()) { |
| 86 | - for (Merchant merchant : WarplyManagerHelper.getMerchantList()) { | 86 | + if (cpn.getCoupon().equals(couponCode)) { |
| 87 | - if (merchant.getUuid().equals(mCouponset.getMerchantUuid())) { | 87 | + mCoupon = cpn; |
| 88 | - mMerchant = merchant; | 88 | + mMerchant = cpn.getMerchantDetails(); |
| 89 | - break; | 89 | + break; |
| 90 | - } | ||
| 91 | } | 90 | } |
| 92 | } | 91 | } |
| 93 | 92 | ||
| ... | @@ -179,9 +178,9 @@ public class ShopsHuaweiActivity extends FragmentActivity implements View.OnClic | ... | @@ -179,9 +178,9 @@ public class ShopsHuaweiActivity extends FragmentActivity implements View.OnClic |
| 179 | //// mMap.setOnMarkerClickListener(/*mClusterManager*/this); | 178 | //// mMap.setOnMarkerClickListener(/*mClusterManager*/this); |
| 180 | // } | 179 | // } |
| 181 | // | 180 | // |
| 182 | - if (mCouponset != null) { | 181 | + if (mCoupon != null) { |
| 183 | ArrayList<String> uuids = new ArrayList<>(); | 182 | ArrayList<String> uuids = new ArrayList<>(); |
| 184 | - uuids.add(mCouponset.getMerchantUuid()); | 183 | + uuids.add(mCoupon.getMerchantUuid()); |
| 185 | WarplyManager.getMerchantsMultilingual(true, uuids, mMerchantsCallback); | 184 | WarplyManager.getMerchantsMultilingual(true, uuids, mMerchantsCallback); |
| 186 | } else { | 185 | } else { |
| 187 | ArrayList<String> catuuids = new ArrayList<>(); | 186 | ArrayList<String> catuuids = new ArrayList<>(); | ... | ... |
| ... | @@ -235,9 +235,10 @@ public class UnifiedCouponInfoActivity extends Activity implements View.OnClickL | ... | @@ -235,9 +235,10 @@ public class UnifiedCouponInfoActivity extends Activity implements View.OnClickL |
| 235 | mCouponPressed = true; | 235 | mCouponPressed = true; |
| 236 | WarplyAnalyticsManager.logTrackersEvent(this, "click", ("MarketCoupon").concat(":").concat(coupon.getName())); | 236 | WarplyAnalyticsManager.logTrackersEvent(this, "click", ("MarketCoupon").concat(":").concat(coupon.getName())); |
| 237 | Intent intent = new Intent(UnifiedCouponInfoActivity.this, CouponInfoActivity.class); | 237 | Intent intent = new Intent(UnifiedCouponInfoActivity.this, CouponInfoActivity.class); |
| 238 | - intent.putExtra("coupon", (Serializable) coupon); | 238 | + intent.putExtra("coupon", coupon.getCoupon()); |
| 239 | intent.putExtra("isFromWallet", true); | 239 | intent.putExtra("isFromWallet", true); |
| 240 | intent.putExtra("isUnified", true); | 240 | intent.putExtra("isUnified", true); |
| 241 | + intent.putExtra("unifiedCoupon", mCoupon.getBarcode()); | ||
| 241 | startActivity(intent); | 242 | startActivity(intent); |
| 242 | } | 243 | } |
| 243 | }) | 244 | }) | ... | ... |
| ... | @@ -112,6 +112,7 @@ public class Couponset implements Parcelable, Serializable { | ... | @@ -112,6 +112,7 @@ public class Couponset implements Parcelable, Serializable { |
| 112 | private String discount_type = ""; | 112 | private String discount_type = ""; |
| 113 | private double final_price = 0.0d; | 113 | private double final_price = 0.0d; |
| 114 | private Date endDate = new Date(); | 114 | private Date endDate = new Date(); |
| 115 | + private String couponsetType = ""; | ||
| 115 | 116 | ||
| 116 | public Couponset() { | 117 | public Couponset() { |
| 117 | this.uuid = ""; | 118 | this.uuid = ""; |
| ... | @@ -159,6 +160,9 @@ public class Couponset implements Parcelable, Serializable { | ... | @@ -159,6 +160,9 @@ public class Couponset implements Parcelable, Serializable { |
| 159 | this.updated = ""; | 160 | this.updated = ""; |
| 160 | this.uuid = ""; | 161 | this.uuid = ""; |
| 161 | // this.endDate = new Date(); | 162 | // this.endDate = new Date(); |
| 163 | + this.couponsetType = ""; | ||
| 164 | + this.img_preview = ""; | ||
| 165 | + this.innerText = ""; | ||
| 162 | } | 166 | } |
| 163 | 167 | ||
| 164 | /** | 168 | /** |
| ... | @@ -232,6 +236,9 @@ public class Couponset implements Parcelable, Serializable { | ... | @@ -232,6 +236,9 @@ public class Couponset implements Parcelable, Serializable { |
| 232 | this.category = json.optString(CATEGORY); | 236 | this.category = json.optString(CATEGORY); |
| 233 | this.terms = json.optString(TERMS); | 237 | this.terms = json.optString(TERMS); |
| 234 | this.discount_type = json.isNull(DISCOUNT_TYPE) ? "" : json.optString(DISCOUNT_TYPE); | 238 | this.discount_type = json.isNull(DISCOUNT_TYPE) ? "" : json.optString(DISCOUNT_TYPE); |
| 239 | + this.couponsetType = json.optString("couponset_type"); | ||
| 240 | + this.img_preview = json.optString(IMG_PREVIEW); | ||
| 241 | + this.innerText = json.optString(INNER_TEXT); | ||
| 235 | // SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm"); | 242 | // SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm"); |
| 236 | // Date newDate = new Date(); | 243 | // Date newDate = new Date(); |
| 237 | // String tempRedeemDate = json.optString("end_date"); | 244 | // String tempRedeemDate = json.optString("end_date"); |
| ... | @@ -625,6 +632,14 @@ public class Couponset implements Parcelable, Serializable { | ... | @@ -625,6 +632,14 @@ public class Couponset implements Parcelable, Serializable { |
| 625 | this.final_price = final_price; | 632 | this.final_price = final_price; |
| 626 | } | 633 | } |
| 627 | 634 | ||
| 635 | + public String getCouponsetType() { | ||
| 636 | + return couponsetType; | ||
| 637 | + } | ||
| 638 | + | ||
| 639 | + public void setCouponsetType(String couponsetType) { | ||
| 640 | + this.couponsetType = couponsetType; | ||
| 641 | + } | ||
| 642 | + | ||
| 628 | @Override | 643 | @Override |
| 629 | public int describeContents() { | 644 | public int describeContents() { |
| 630 | return 0; | 645 | return 0; | ... | ... |
| ... | @@ -191,6 +191,9 @@ public class Merchant implements Parcelable, Serializable, ClusterItem { | ... | @@ -191,6 +191,9 @@ public class Merchant implements Parcelable, Serializable, ClusterItem { |
| 191 | this.region = ""; | 191 | this.region = ""; |
| 192 | this.telephone = ""; | 192 | this.telephone = ""; |
| 193 | this.merchant_metadata = new JSONObject(); | 193 | this.merchant_metadata = new JSONObject(); |
| 194 | + this.admin_name = ""; | ||
| 195 | + this.img_preview = ""; | ||
| 196 | + this.website = ""; | ||
| 194 | } | 197 | } |
| 195 | 198 | ||
| 196 | /** | 199 | /** |
| ... | @@ -267,6 +270,9 @@ public class Merchant implements Parcelable, Serializable, ClusterItem { | ... | @@ -267,6 +270,9 @@ public class Merchant implements Parcelable, Serializable, ClusterItem { |
| 267 | this.region = json.optString(REGION); | 270 | this.region = json.optString(REGION); |
| 268 | this.telephone = json.isNull(TELEPHONE) ? "" : json.optString(TELEPHONE); | 271 | this.telephone = json.isNull(TELEPHONE) ? "" : json.optString(TELEPHONE); |
| 269 | this.merchant_metadata = json.optJSONObject(MERCHANT_METADATA); | 272 | this.merchant_metadata = json.optJSONObject(MERCHANT_METADATA); |
| 273 | + this.admin_name = json.optString(ADMIN_NAME); | ||
| 274 | + this.img_preview = json.optString(IMG_PREVIEW); | ||
| 275 | + this.website = json.optString(WEBSITE); | ||
| 270 | 276 | ||
| 271 | // this.id = json.optString(ID); | 277 | // this.id = json.optString(ID); |
| 272 | // this.store_id = json.optString(STORE_ID); | 278 | // this.store_id = json.optString(STORE_ID); | ... | ... |
| ... | @@ -4352,11 +4352,12 @@ public class WarplyManager { | ... | @@ -4352,11 +4352,12 @@ public class WarplyManager { |
| 4352 | executorCoupons.submit(() -> { | 4352 | executorCoupons.submit(() -> { |
| 4353 | for (int i = 0; i < finalJCouponsBody.length(); ++i) { | 4353 | for (int i = 0; i < finalJCouponsBody.length(); ++i) { |
| 4354 | Coupon tempCoupon = new Coupon(finalJCouponsBody.optJSONObject(i), true); | 4354 | Coupon tempCoupon = new Coupon(finalJCouponsBody.optJSONObject(i), true); |
| 4355 | - mCouponsList.add(tempCoupon); | 4355 | + if (TextUtils.isEmpty(tempCoupon.getCouponsetDetails().getCouponsetType()) || !tempCoupon.getCouponsetDetails().getCouponsetType().equals("supermarket")) |
| 4356 | + mCouponsList.add(tempCoupon); | ||
| 4356 | 4357 | ||
| 4357 | if (tempCoupon.getStatus() == 0) { | 4358 | if (tempCoupon.getStatus() == 0) { |
| 4358 | mCouponRedeemedList.add(tempCoupon); | 4359 | mCouponRedeemedList.add(tempCoupon); |
| 4359 | - } else if (tempCoupon.getStatus() == 1) { | 4360 | + } else if (tempCoupon.getStatus() == 1 && (TextUtils.isEmpty(tempCoupon.getCouponsetDetails().getCouponsetType()) || !tempCoupon.getCouponsetDetails().getCouponsetType().equals("supermarket"))) { |
| 4360 | SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm"); | 4361 | SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm"); |
| 4361 | Date newDate = new Date(); | 4362 | Date newDate = new Date(); |
| 4362 | try { | 4363 | try { | ... | ... |
This diff is collapsed. Click to expand it.
-
Please register or login to post a comment