Showing
2 changed files
with
8 additions
and
16 deletions
... | @@ -272,18 +272,10 @@ public class Coupon implements Parcelable, Serializable { | ... | @@ -272,18 +272,10 @@ public class Coupon implements Parcelable, Serializable { |
272 | 272 | ||
273 | public RedeemMerchantDetails(JSONObject json) { | 273 | public RedeemMerchantDetails(JSONObject json) { |
274 | if (json != null) { | 274 | if (json != null) { |
275 | - if (json.optJSONObject(IMG_PREVIEW) != null) { | 275 | + this.imgPreview = json.isNull(IMG_PREVIEW) ? "" : json.optString(IMG_PREVIEW); |
276 | - this.imgPreview = json.optString(IMG_PREVIEW); | 276 | + this.name = json.isNull(NAME) ? "" : json.optString(NAME); |
277 | - } | 277 | + this.uuid = json.isNull(UUID) ? "" : json.optString(UUID); |
278 | - if (json.optJSONObject(NAME) != null) { | 278 | + this.redeemedDate = json.isNull(REDEEMED_DATE) ? "" : json.optString(REDEEMED_DATE); |
279 | - this.name = json.optString(NAME); | ||
280 | - } | ||
281 | - if (json.optJSONObject(UUID) != null) { | ||
282 | - this.uuid = json.optString(UUID); | ||
283 | - } | ||
284 | - if (json.optJSONObject(REDEEMED_DATE) != null) { | ||
285 | - this.redeemedDate = json.optString(REDEEMED_DATE); | ||
286 | - } | ||
287 | } | 279 | } |
288 | } | 280 | } |
289 | 281 | ... | ... |
... | @@ -82,7 +82,7 @@ public class MarketPassDetailsModel { | ... | @@ -82,7 +82,7 @@ public class MarketPassDetailsModel { |
82 | } | 82 | } |
83 | } | 83 | } |
84 | } | 84 | } |
85 | - this.barcode = json.optString(BARCODE); | 85 | + this.barcode = json.isNull(BARCODE) ? "" : json.optString(BARCODE); |
86 | this.totalDiscount = json.optDouble(TOTAL_DISCOUNT); | 86 | this.totalDiscount = json.optDouble(TOTAL_DISCOUNT); |
87 | this.newOffers = json.optInt(NEW_OFFERS); | 87 | this.newOffers = json.optInt(NEW_OFFERS); |
88 | } | 88 | } |
... | @@ -153,9 +153,9 @@ public class MarketPassDetailsModel { | ... | @@ -153,9 +153,9 @@ public class MarketPassDetailsModel { |
153 | 153 | ||
154 | public Supermarkets(JSONObject json) { | 154 | public Supermarkets(JSONObject json) { |
155 | if (json != null) { | 155 | if (json != null) { |
156 | - this.logo = json.optString(LOGO); | 156 | + this.logo = json.isNull(LOGO) ? "" : json.optString(LOGO); |
157 | - this.name = json.optString(NAME); | 157 | + this.name = json.isNull(NAME) ? "" : json.optString(NAME); |
158 | - this.uuid = json.optString(UUID); | 158 | + this.uuid = json.isNull(UUID) ? "" : json.optString(UUID); |
159 | } | 159 | } |
160 | } | 160 | } |
161 | 161 | ... | ... |
-
Please register or login to post a comment