Panagiotis Triantafyllou

new coupons request part3, fixes in active coupons, sm coupons, map

......@@ -116,7 +116,7 @@ public class ActiveCouponsActivity extends Activity implements View.OnClickListe
mCouponsPressed = true;
WarplyAnalyticsManager.logTrackersEvent(this, "click", ("Coupon").concat(":").concat(coupon.getName()));
Intent intent = new Intent(ActiveCouponsActivity.this, CouponInfoActivity.class);
intent.putExtra("coupon", (Serializable) coupon);
intent.putExtra("coupon", coupon.getCoupon());
startActivity(intent);
}
})
......
......@@ -93,7 +93,7 @@ public class ActiveGiftsActivity extends Activity implements View.OnClickListene
startActivity(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCampaignUrl(dataItem.getCampaign())));
} else if (dataItem.getDataType() == 2) {
Intent intent = new Intent(ActiveGiftsActivity.this, CouponInfoActivity.class);
intent.putExtra("coupon", (Serializable) dataItem.getCoupon());
intent.putExtra("coupon", dataItem.getCoupon().getCoupon());
startActivity(intent);
}
})
......
......@@ -39,7 +39,7 @@ import java.util.ArrayList;
import io.github.inflationx.viewpump.ViewPumpContextWrapper;
import ly.warp.sdk.R;
import ly.warp.sdk.io.callbacks.CallbackReceiver;
import ly.warp.sdk.io.models.Couponset;
import ly.warp.sdk.io.models.Coupon;
import ly.warp.sdk.io.models.Merchant;
import ly.warp.sdk.io.models.MerchantList;
import ly.warp.sdk.utils.WarplyManagerHelper;
......@@ -64,7 +64,7 @@ public class ShopsActivity extends FragmentActivity implements View.OnClickListe
// ===========================================================
private ImageView mIvBack;
private Couponset mCouponset;
private Coupon mCoupon;
private GoogleMap mMap;
private ClusterManager<Merchant> mClusterManager;
private SupportMapFragment mMapView;
......@@ -82,13 +82,12 @@ public class ShopsActivity extends FragmentActivity implements View.OnClickListe
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_shops);
mCouponset = (Couponset) getIntent().getSerializableExtra("couponset");
if (mCouponset != null) {
for (Merchant merchant : WarplyManagerHelper.getMerchantList()) {
if (merchant.getUuid().equals(mCouponset.getMerchantUuid())) {
mMerchant = merchant;
break;
}
String couponCode = getIntent().getStringExtra("coupon");
for (Coupon cpn : WarplyManagerHelper.getCouponList()) {
if (cpn.getCoupon().equals(couponCode)) {
mCoupon = cpn;
mMerchant = cpn.getMerchantDetails();
break;
}
}
......@@ -178,9 +177,9 @@ public class ShopsActivity extends FragmentActivity implements View.OnClickListe
//// mMap.setOnMarkerClickListener(/*mClusterManager*/this);
// }
if (mCouponset != null) {
if (mCoupon != null) {
ArrayList<String> uuids = new ArrayList<>();
uuids.add(mCouponset.getMerchantUuid());
uuids.add(mCoupon.getMerchantUuid());
WarplyManager.getMerchantsMultilingual(true, uuids, mMerchantsCallback);
} else {
ArrayList<String> catuuids = new ArrayList<>();
......
......@@ -38,7 +38,7 @@ import java.util.ArrayList;
import io.github.inflationx.viewpump.ViewPumpContextWrapper;
import ly.warp.sdk.R;
import ly.warp.sdk.io.callbacks.CallbackReceiver;
import ly.warp.sdk.io.models.Couponset;
import ly.warp.sdk.io.models.Coupon;
import ly.warp.sdk.io.models.Merchant;
import ly.warp.sdk.io.models.MerchantList;
import ly.warp.sdk.utils.WarplyManagerHelper;
......@@ -62,7 +62,7 @@ public class ShopsHuaweiActivity extends FragmentActivity implements View.OnClic
// ===========================================================
private ImageView mIvBack;
private Couponset mCouponset;
private Coupon mCoupon;
private HuaweiMap mMap;
// private ClusterManager<Merchant> mClusterManager;
private SupportMapFragment mSupportMapFragment;
......@@ -81,13 +81,12 @@ public class ShopsHuaweiActivity extends FragmentActivity implements View.OnClic
MapsInitializer.initialize(this);
setContentView(R.layout.activity_shops_huawei);
mCouponset = (Couponset) getIntent().getSerializableExtra("couponset");
if (mCouponset != null) {
for (Merchant merchant : WarplyManagerHelper.getMerchantList()) {
if (merchant.getUuid().equals(mCouponset.getMerchantUuid())) {
mMerchant = merchant;
break;
}
String couponCode = getIntent().getStringExtra("coupon");
for (Coupon cpn : WarplyManagerHelper.getCouponList()) {
if (cpn.getCoupon().equals(couponCode)) {
mCoupon = cpn;
mMerchant = cpn.getMerchantDetails();
break;
}
}
......@@ -179,9 +178,9 @@ public class ShopsHuaweiActivity extends FragmentActivity implements View.OnClic
//// mMap.setOnMarkerClickListener(/*mClusterManager*/this);
// }
//
if (mCouponset != null) {
if (mCoupon != null) {
ArrayList<String> uuids = new ArrayList<>();
uuids.add(mCouponset.getMerchantUuid());
uuids.add(mCoupon.getMerchantUuid());
WarplyManager.getMerchantsMultilingual(true, uuids, mMerchantsCallback);
} else {
ArrayList<String> catuuids = new ArrayList<>();
......
......@@ -235,9 +235,10 @@ public class UnifiedCouponInfoActivity extends Activity implements View.OnClickL
mCouponPressed = true;
WarplyAnalyticsManager.logTrackersEvent(this, "click", ("MarketCoupon").concat(":").concat(coupon.getName()));
Intent intent = new Intent(UnifiedCouponInfoActivity.this, CouponInfoActivity.class);
intent.putExtra("coupon", (Serializable) coupon);
intent.putExtra("coupon", coupon.getCoupon());
intent.putExtra("isFromWallet", true);
intent.putExtra("isUnified", true);
intent.putExtra("unifiedCoupon", mCoupon.getBarcode());
startActivity(intent);
}
})
......
......@@ -112,6 +112,7 @@ public class Couponset implements Parcelable, Serializable {
private String discount_type = "";
private double final_price = 0.0d;
private Date endDate = new Date();
private String couponsetType = "";
public Couponset() {
this.uuid = "";
......@@ -159,6 +160,9 @@ public class Couponset implements Parcelable, Serializable {
this.updated = "";
this.uuid = "";
// this.endDate = new Date();
this.couponsetType = "";
this.img_preview = "";
this.innerText = "";
}
/**
......@@ -232,6 +236,9 @@ public class Couponset implements Parcelable, Serializable {
this.category = json.optString(CATEGORY);
this.terms = json.optString(TERMS);
this.discount_type = json.isNull(DISCOUNT_TYPE) ? "" : json.optString(DISCOUNT_TYPE);
this.couponsetType = json.optString("couponset_type");
this.img_preview = json.optString(IMG_PREVIEW);
this.innerText = json.optString(INNER_TEXT);
// SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm");
// Date newDate = new Date();
// String tempRedeemDate = json.optString("end_date");
......@@ -625,6 +632,14 @@ public class Couponset implements Parcelable, Serializable {
this.final_price = final_price;
}
public String getCouponsetType() {
return couponsetType;
}
public void setCouponsetType(String couponsetType) {
this.couponsetType = couponsetType;
}
@Override
public int describeContents() {
return 0;
......
......@@ -191,6 +191,9 @@ public class Merchant implements Parcelable, Serializable, ClusterItem {
this.region = "";
this.telephone = "";
this.merchant_metadata = new JSONObject();
this.admin_name = "";
this.img_preview = "";
this.website = "";
}
/**
......@@ -267,6 +270,9 @@ public class Merchant implements Parcelable, Serializable, ClusterItem {
this.region = json.optString(REGION);
this.telephone = json.isNull(TELEPHONE) ? "" : json.optString(TELEPHONE);
this.merchant_metadata = json.optJSONObject(MERCHANT_METADATA);
this.admin_name = json.optString(ADMIN_NAME);
this.img_preview = json.optString(IMG_PREVIEW);
this.website = json.optString(WEBSITE);
// this.id = json.optString(ID);
// this.store_id = json.optString(STORE_ID);
......
......@@ -4352,11 +4352,12 @@ public class WarplyManager {
executorCoupons.submit(() -> {
for (int i = 0; i < finalJCouponsBody.length(); ++i) {
Coupon tempCoupon = new Coupon(finalJCouponsBody.optJSONObject(i), true);
mCouponsList.add(tempCoupon);
if (TextUtils.isEmpty(tempCoupon.getCouponsetDetails().getCouponsetType()) || !tempCoupon.getCouponsetDetails().getCouponsetType().equals("supermarket"))
mCouponsList.add(tempCoupon);
if (tempCoupon.getStatus() == 0) {
mCouponRedeemedList.add(tempCoupon);
} else if (tempCoupon.getStatus() == 1) {
} else if (tempCoupon.getStatus() == 1 && (TextUtils.isEmpty(tempCoupon.getCouponsetDetails().getCouponsetType()) || !tempCoupon.getCouponsetDetails().getCouponsetType().equals("supermarket"))) {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm");
Date newDate = new Date();
try {
......