Showing
4 changed files
with
84 additions
and
2 deletions
| ... | @@ -50,8 +50,8 @@ public class BaseFragmentActivity extends FragmentActivity implements Navigation | ... | @@ -50,8 +50,8 @@ public class BaseFragmentActivity extends FragmentActivity implements Navigation |
| 50 | mBottomNavigationView = findViewById(R.id.bt_tabs); | 50 | mBottomNavigationView = findViewById(R.id.bt_tabs); |
| 51 | 51 | ||
| 52 | WarplyManager.getUserCouponsWithCouponsets(mUserCouponsReceiver); | 52 | WarplyManager.getUserCouponsWithCouponsets(mUserCouponsReceiver); |
| 53 | -// WarplyManager.getCampaigns(mCampaignsCallback); | 53 | + WarplyManager.getCampaigns(mCampaignsCallback); |
| 54 | -// WarplyManager.getUnifiedCouponsDeals(mUnifiedCallback); | 54 | + WarplyManager.getUnifiedCouponsDeals(mUnifiedCallback); |
| 55 | } | 55 | } |
| 56 | 56 | ||
| 57 | @Override | 57 | @Override | ... | ... |
| ... | @@ -96,6 +96,7 @@ public class Coupon implements Parcelable, Serializable { | ... | @@ -96,6 +96,7 @@ public class Coupon implements Parcelable, Serializable { |
| 96 | private String short_description = ""; | 96 | private String short_description = ""; |
| 97 | private String terms = ""; | 97 | private String terms = ""; |
| 98 | private Couponset couponsetDetails = new Couponset(true); | 98 | private Couponset couponsetDetails = new Couponset(true); |
| 99 | + private Merchant merchantDetails = new Merchant(true); | ||
| 99 | 100 | ||
| 100 | public Coupon() { | 101 | public Coupon() { |
| 101 | this.barcode = ""; | 102 | this.barcode = ""; |
| ... | @@ -133,6 +134,7 @@ public class Coupon implements Parcelable, Serializable { | ... | @@ -133,6 +134,7 @@ public class Coupon implements Parcelable, Serializable { |
| 133 | this.merchantUuid = ""; | 134 | this.merchantUuid = ""; |
| 134 | this.redeemDate = new Date(); | 135 | this.redeemDate = new Date(); |
| 135 | this.couponsetDetails = new Couponset(isUniversal); | 136 | this.couponsetDetails = new Couponset(isUniversal); |
| 137 | + this.merchantDetails = new Merchant(isUniversal); | ||
| 136 | } | 138 | } |
| 137 | 139 | ||
| 138 | /** | 140 | /** |
| ... | @@ -218,6 +220,10 @@ public class Coupon implements Parcelable, Serializable { | ... | @@ -218,6 +220,10 @@ public class Coupon implements Parcelable, Serializable { |
| 218 | if (tempCouponsetDetails != null) { | 220 | if (tempCouponsetDetails != null) { |
| 219 | this.couponsetDetails = new Couponset(tempCouponsetDetails, isUniversal); | 221 | this.couponsetDetails = new Couponset(tempCouponsetDetails, isUniversal); |
| 220 | } | 222 | } |
| 223 | + JSONObject tempMerchantDetails = json.optJSONObject("merchant_details"); | ||
| 224 | + if (tempMerchantDetails != null) { | ||
| 225 | + this.merchantDetails = new Merchant(tempMerchantDetails, isUniversal); | ||
| 226 | + } | ||
| 221 | 227 | ||
| 222 | // this.category = json.optString(CATEGORY); | 228 | // this.category = json.optString(CATEGORY); |
| 223 | // this.created = json.optString(CREATED); | 229 | // this.created = json.optString(CREATED); |
| ... | @@ -522,6 +528,22 @@ public class Coupon implements Parcelable, Serializable { | ... | @@ -522,6 +528,22 @@ public class Coupon implements Parcelable, Serializable { |
| 522 | this.terms = terms; | 528 | this.terms = terms; |
| 523 | } | 529 | } |
| 524 | 530 | ||
| 531 | + public Couponset getCouponsetDetails() { | ||
| 532 | + return couponsetDetails; | ||
| 533 | + } | ||
| 534 | + | ||
| 535 | + public void setCouponsetDetails(Couponset couponsetDetails) { | ||
| 536 | + this.couponsetDetails = couponsetDetails; | ||
| 537 | + } | ||
| 538 | + | ||
| 539 | + public Merchant getMerchantDetails() { | ||
| 540 | + return merchantDetails; | ||
| 541 | + } | ||
| 542 | + | ||
| 543 | + public void setMerchantDetails(Merchant merchantDetails) { | ||
| 544 | + this.merchantDetails = merchantDetails; | ||
| 545 | + } | ||
| 546 | + | ||
| 525 | @Override | 547 | @Override |
| 526 | public int describeContents() { | 548 | public int describeContents() { |
| 527 | return 0; | 549 | return 0; | ... | ... |
| ... | @@ -180,6 +180,19 @@ public class Merchant implements Parcelable, Serializable, ClusterItem { | ... | @@ -180,6 +180,19 @@ public class Merchant implements Parcelable, Serializable, ClusterItem { |
| 180 | coordinates = new LatLng(this.latitude, this.longitude); | 180 | coordinates = new LatLng(this.latitude, this.longitude); |
| 181 | } | 181 | } |
| 182 | 182 | ||
| 183 | + public Merchant(boolean isUniversal) { | ||
| 184 | + this.address = ""; | ||
| 185 | + this.city = ""; | ||
| 186 | + this.body = ""; | ||
| 187 | + this.logo = ""; | ||
| 188 | + this.country = ""; | ||
| 189 | + this.name = ""; | ||
| 190 | + this.postal_code = ""; | ||
| 191 | + this.region = ""; | ||
| 192 | + this.telephone = ""; | ||
| 193 | + this.merchant_metadata = new JSONObject(); | ||
| 194 | + } | ||
| 195 | + | ||
| 183 | /** | 196 | /** |
| 184 | * Basic constructor used to create an object from a String, representing a | 197 | * Basic constructor used to create an object from a String, representing a |
| 185 | * JSON Object | 198 | * JSON Object |
| ... | @@ -242,6 +255,53 @@ public class Merchant implements Parcelable, Serializable, ClusterItem { | ... | @@ -242,6 +255,53 @@ public class Merchant implements Parcelable, Serializable, ClusterItem { |
| 242 | } | 255 | } |
| 243 | } | 256 | } |
| 244 | 257 | ||
| 258 | + public Merchant(JSONObject json, boolean isUniversal) { | ||
| 259 | + if (json != null) { | ||
| 260 | + this.address = json.isNull(ADDRESS) ? "" : json.optString(ADDRESS); | ||
| 261 | + this.body = json.optString(BODY); | ||
| 262 | + this.city = json.optString(CITY); | ||
| 263 | + this.logo = json.optString(LOGO); | ||
| 264 | + this.country = json.optString(COUNTRY); | ||
| 265 | + this.name = json.isNull(NAME) ? "" : json.optString(NAME); | ||
| 266 | + this.postal_code = json.optString(POSTAL_CODE); | ||
| 267 | + this.region = json.optString(REGION); | ||
| 268 | + this.telephone = json.isNull(TELEPHONE) ? "" : json.optString(TELEPHONE); | ||
| 269 | + this.merchant_metadata = json.optJSONObject(MERCHANT_METADATA); | ||
| 270 | + | ||
| 271 | +// this.id = json.optString(ID); | ||
| 272 | +// this.store_id = json.optString(STORE_ID); | ||
| 273 | +// this.website = json.optString(WEBSITE); | ||
| 274 | +// this.email = json.optString(EMAIL); | ||
| 275 | +// this.category = json.optString(CATEGORY); | ||
| 276 | +// this.description = json.optString(DESCRIPTION); | ||
| 277 | +// this.short_description = json.optString(SHORT_DESCRIPTION); | ||
| 278 | +// this.latitude = json.isNull(LAT) ? 0.0 : json.optDouble(LAT); | ||
| 279 | +// this.longitude = json.isNull(LON) ? 0.0 : json.optDouble(LON); | ||
| 280 | +// this.image = json.optString(IMAGE); | ||
| 281 | +// this.extra_fields = json.optJSONObject(EXTRA_FIELDS); | ||
| 282 | +// this.active = json.optBoolean(ACTIVE); | ||
| 283 | +// this.vat = json.optString(VAT); | ||
| 284 | +// this.uuid = json.optString(UUID); | ||
| 285 | +// this.category_uuid = json.optString(CATEGORY_UUID); | ||
| 286 | +// this.created = json.optString(CREATED); | ||
| 287 | +// this.parent = json.optString(PARENT); | ||
| 288 | +// this.img = json.optJSONArray(IMG); | ||
| 289 | +// this.img_preview = json.optString(IMG_PREVIEW); | ||
| 290 | +// this.admin_name = json.optString(ADMIN_NAME); | ||
| 291 | +// this.sorting = json.optInt(SORTING); | ||
| 292 | +// this.owner_name = json.optString(OWNER_NAME); | ||
| 293 | +// this.preview = json.optString(PREVIEW); | ||
| 294 | +// this.promoted = json.optBoolean(PROMOTED); | ||
| 295 | +// this.distance = json.optInt(DISTANCE); | ||
| 296 | +// this.default_shown = json.optBoolean(DEFAULT_SHOWN); | ||
| 297 | +// this.hidden = json.optBoolean(HIDDEN); | ||
| 298 | +// this.working_hours = json.optJSONObject(WORKING_HOURS); | ||
| 299 | +// this.tags = json.optJSONArray(TAGS); | ||
| 300 | +// this.product = json.optJSONObject(PRODUCT); | ||
| 301 | +// coordinates = new LatLng(this.latitude, this.longitude); | ||
| 302 | + } | ||
| 303 | + } | ||
| 304 | + | ||
| 245 | public Merchant(Parcel source) { | 305 | public Merchant(Parcel source) { |
| 246 | this.address = source.readString(); | 306 | this.address = source.readString(); |
| 247 | this.id = source.readString(); | 307 | this.id = source.readString(); | ... | ... |
This diff is collapsed. Click to expand it.
-
Please register or login to post a comment