Showing
2 changed files
with
91 additions
and
2 deletions
... | @@ -24,10 +24,15 @@ import ly.warp.sdk.io.callbacks.CallbackReceiver; | ... | @@ -24,10 +24,15 @@ import ly.warp.sdk.io.callbacks.CallbackReceiver; |
24 | import ly.warp.sdk.io.models.Campaign; | 24 | import ly.warp.sdk.io.models.Campaign; |
25 | import ly.warp.sdk.io.models.CampaignList; | 25 | import ly.warp.sdk.io.models.CampaignList; |
26 | import ly.warp.sdk.io.models.Consumer; | 26 | import ly.warp.sdk.io.models.Consumer; |
27 | +import ly.warp.sdk.io.models.Coupon; | ||
27 | import ly.warp.sdk.io.models.CouponList; | 28 | import ly.warp.sdk.io.models.CouponList; |
29 | +import ly.warp.sdk.io.models.Couponset; | ||
30 | +import ly.warp.sdk.io.models.CouponsetsList; | ||
28 | import ly.warp.sdk.io.request.WarplyConsumerRequest; | 31 | import ly.warp.sdk.io.request.WarplyConsumerRequest; |
32 | +import ly.warp.sdk.io.request.WarplyGetCouponsetsRequest; | ||
29 | import ly.warp.sdk.io.request.WarplyInboxRequest; | 33 | import ly.warp.sdk.io.request.WarplyInboxRequest; |
30 | import ly.warp.sdk.io.request.WarplyUserCouponsRequest; | 34 | import ly.warp.sdk.io.request.WarplyUserCouponsRequest; |
35 | +import ly.warp.sdk.utils.WarplyProperty; | ||
31 | import ly.warp.sdk.utils.managers.WarplyManager; | 36 | import ly.warp.sdk.utils.managers.WarplyManager; |
32 | import ly.warp.sdk.utils.managers.WarplySessionManager; | 37 | import ly.warp.sdk.utils.managers.WarplySessionManager; |
33 | 38 | ||
... | @@ -45,7 +50,8 @@ public class BaseFragmentActivity extends FragmentActivity implements Navigation | ... | @@ -45,7 +50,8 @@ public class BaseFragmentActivity extends FragmentActivity implements Navigation |
45 | private Fragment mFragmentToSet = null; | 50 | private Fragment mFragmentToSet = null; |
46 | private static Consumer mConsumer; | 51 | private static Consumer mConsumer; |
47 | private static HashMap mUniqueCampaignList = new HashMap<String, CampaignList>(); | 52 | private static HashMap mUniqueCampaignList = new HashMap<String, CampaignList>(); |
48 | - private static CouponList mCouponList; | 53 | + private static CouponList mCouponList = new CouponList(); |
54 | + private CouponsetsList mCouponsetsList; | ||
49 | 55 | ||
50 | // =========================================================== | 56 | // =========================================================== |
51 | // Methods for/from SuperClass/Interfaces | 57 | // Methods for/from SuperClass/Interfaces |
... | @@ -175,6 +181,22 @@ public class BaseFragmentActivity extends FragmentActivity implements Navigation | ... | @@ -175,6 +181,22 @@ public class BaseFragmentActivity extends FragmentActivity implements Navigation |
175 | } | 181 | } |
176 | 182 | ||
177 | // Thread.currentThread().interrupt(); | 183 | // Thread.currentThread().interrupt(); |
184 | + | ||
185 | + WarplyManager.getCouponsets(new WarplyGetCouponsetsRequest() | ||
186 | + .setLanguage(WarplyProperty.getLanguage(BaseFragmentActivity.this)), mCouponsetsReceiver); | ||
187 | + | ||
188 | + } | ||
189 | + | ||
190 | + @Override | ||
191 | + public void onFailure(int errorCode) { | ||
192 | + Thread.currentThread().interrupt(); | ||
193 | + } | ||
194 | + }; | ||
195 | + | ||
196 | + private CallbackReceiver<CouponsetsList> mCouponsetsReceiver = new CallbackReceiver<CouponsetsList>() { | ||
197 | + @Override | ||
198 | + public void onSuccess(CouponsetsList result) { | ||
199 | + mCouponsetsList = result; | ||
178 | WarplyManager.getUserCoupons(new WarplyUserCouponsRequest(), mUserCouponsReceiver); | 200 | WarplyManager.getUserCoupons(new WarplyUserCouponsRequest(), mUserCouponsReceiver); |
179 | } | 201 | } |
180 | 202 | ||
... | @@ -184,10 +206,21 @@ public class BaseFragmentActivity extends FragmentActivity implements Navigation | ... | @@ -184,10 +206,21 @@ public class BaseFragmentActivity extends FragmentActivity implements Navigation |
184 | } | 206 | } |
185 | }; | 207 | }; |
186 | 208 | ||
209 | + | ||
187 | private final CallbackReceiver<CouponList> mUserCouponsReceiver = new CallbackReceiver<CouponList>() { | 210 | private final CallbackReceiver<CouponList> mUserCouponsReceiver = new CallbackReceiver<CouponList>() { |
188 | @Override | 211 | @Override |
189 | public void onSuccess(CouponList result) { | 212 | public void onSuccess(CouponList result) { |
190 | - mCouponList = result; | 213 | + for (Coupon coupon : result) { |
214 | + for (Couponset couponset : mCouponsetsList) { | ||
215 | + if (coupon.getCouponsetUuid().equals(couponset.getUuid())) { | ||
216 | + coupon.setDescription(couponset.getShortDescription()); | ||
217 | + coupon.setImage(couponset.getImgPreview()); | ||
218 | + coupon.setName(couponset.getName()); | ||
219 | + mCouponList.add(coupon); | ||
220 | + } | ||
221 | + } | ||
222 | + } | ||
223 | + | ||
191 | Thread.currentThread().interrupt(); | 224 | Thread.currentThread().interrupt(); |
192 | new Handler(Looper.getMainLooper()).post(() -> { | 225 | new Handler(Looper.getMainLooper()).post(() -> { |
193 | initViews(); | 226 | initViews(); | ... | ... |
... | @@ -263,6 +263,62 @@ public class Coupon implements Parcelable, Serializable { | ... | @@ -263,6 +263,62 @@ public class Coupon implements Parcelable, Serializable { |
263 | return couponsetUuid; | 263 | return couponsetUuid; |
264 | } | 264 | } |
265 | 265 | ||
266 | + public void setBarcode(String barcode) { | ||
267 | + this.barcode = barcode; | ||
268 | + } | ||
269 | + | ||
270 | + public void setCategory(String category) { | ||
271 | + this.category = category; | ||
272 | + } | ||
273 | + | ||
274 | + public void setCoupon(String coupon) { | ||
275 | + this.coupon = coupon; | ||
276 | + } | ||
277 | + | ||
278 | + public void setCreated(String created) { | ||
279 | + this.created = created; | ||
280 | + } | ||
281 | + | ||
282 | + public void setDescription(String description) { | ||
283 | + this.description = description; | ||
284 | + } | ||
285 | + | ||
286 | + public void setDiscount(String discount) { | ||
287 | + this.discount = discount; | ||
288 | + } | ||
289 | + | ||
290 | + public void setExpiration(String expiration) { | ||
291 | + this.expiration = expiration; | ||
292 | + } | ||
293 | + | ||
294 | + public void setImage(String image) { | ||
295 | + this.image = image; | ||
296 | + } | ||
297 | + | ||
298 | + public void setName(String name) { | ||
299 | + this.name = name; | ||
300 | + } | ||
301 | + | ||
302 | + public void setStatus(int status) { | ||
303 | + this.status = status; | ||
304 | + } | ||
305 | + | ||
306 | + public void setTransactionDate(String transactionDate) { | ||
307 | + this.transactionDate = transactionDate; | ||
308 | + } | ||
309 | + | ||
310 | + public void setTransactionUuid(String transactionUuid) { | ||
311 | + this.transactionUuid = transactionUuid; | ||
312 | + } | ||
313 | + | ||
314 | + public void setChangesDates(JSONObject changesDates) { | ||
315 | + this.changesDates = changesDates; | ||
316 | + } | ||
317 | + | ||
318 | + public void setCouponsetUuid(String couponsetUuid) { | ||
319 | + this.couponsetUuid = couponsetUuid; | ||
320 | + } | ||
321 | + | ||
266 | @Override | 322 | @Override |
267 | public int describeContents() { | 323 | public int describeContents() { |
268 | return 0; | 324 | return 0; | ... | ... |
-
Please register or login to post a comment