Showing
14 changed files
with
1592 additions
and
57 deletions
| ... | @@ -2,7 +2,7 @@ apply plugin: 'com.android.library' | ... | @@ -2,7 +2,7 @@ apply plugin: 'com.android.library' |
| 2 | 2 | ||
| 3 | ext { | 3 | ext { |
| 4 | PUBLISH_GROUP_ID = 'ly.warp' | 4 | PUBLISH_GROUP_ID = 'ly.warp' |
| 5 | - PUBLISH_VERSION = '4.5.4.6rc12' | 5 | + PUBLISH_VERSION = '4.5.4.6rc20' |
| 6 | PUBLISH_ARTIFACT_ID = 'warply-android-sdk' | 6 | PUBLISH_ARTIFACT_ID = 'warply-android-sdk' |
| 7 | } | 7 | } |
| 8 | 8 | ||
| ... | @@ -90,6 +90,10 @@ dependencies { | ... | @@ -90,6 +90,10 @@ dependencies { |
| 90 | //------------------------------ Calligraphy -----------------------------// | 90 | //------------------------------ Calligraphy -----------------------------// |
| 91 | api 'io.github.inflationx:calligraphy3:3.1.1' | 91 | api 'io.github.inflationx:calligraphy3:3.1.1' |
| 92 | api 'io.github.inflationx:viewpump:2.0.3' | 92 | api 'io.github.inflationx:viewpump:2.0.3' |
| 93 | + | ||
| 94 | + //------------------------------ Retrofit -----------------------------// | ||
| 95 | + implementation 'com.squareup.retrofit2:retrofit:2.9.0' | ||
| 96 | + implementation 'com.squareup.retrofit2:converter-gson:2.9.0' | ||
| 93 | } | 97 | } |
| 94 | 98 | ||
| 95 | // In every export please update the version number | 99 | // In every export please update the version number | ... | ... |
| ... | @@ -58,13 +58,9 @@ public class BaseFragmentActivity extends FragmentActivity implements Navigation | ... | @@ -58,13 +58,9 @@ public class BaseFragmentActivity extends FragmentActivity implements Navigation |
| 58 | 58 | ||
| 59 | mBottomNavigationView = findViewById(R.id.bt_tabs); | 59 | mBottomNavigationView = findViewById(R.id.bt_tabs); |
| 60 | 60 | ||
| 61 | - new Thread(() -> { | 61 | +// WarplyManager.getUserCouponsWithCouponsets(new WarplyUserCouponsRequest(), mUserCouponsReceiver); |
| 62 | - if (!Thread.currentThread().isInterrupted()) { | 62 | + WarplyManager.getUserCouponsWithCouponsets(mUserCouponsReceiver); |
| 63 | -// WarplyManager.getConsumer(new WarplyConsumerRequest(), mConsumerReceiver); | 63 | + WarplyManager.getCampaigns(new WarplyGetCampaignsRequest().setLanguage("en"), mCampaignsCallback); |
| 64 | -// Warply.getInbox(new WarplyInboxRequest().setUseCache(false), mInboxReceiver); | ||
| 65 | - WarplyManager.getCampaigns(new WarplyGetCampaignsRequest().setLanguage("en"), mCampaignsCallback); | ||
| 66 | - } | ||
| 67 | - }).start(); | ||
| 68 | } | 64 | } |
| 69 | 65 | ||
| 70 | @Override | 66 | @Override |
| ... | @@ -80,6 +76,7 @@ public class BaseFragmentActivity extends FragmentActivity implements Navigation | ... | @@ -80,6 +76,7 @@ public class BaseFragmentActivity extends FragmentActivity implements Navigation |
| 80 | @Override | 76 | @Override |
| 81 | protected void onResume() { | 77 | protected void onResume() { |
| 82 | super.onResume(); | 78 | super.onResume(); |
| 79 | + initViews(); | ||
| 83 | } | 80 | } |
| 84 | 81 | ||
| 85 | @Override | 82 | @Override |
| ... | @@ -139,57 +136,15 @@ public class BaseFragmentActivity extends FragmentActivity implements Navigation | ... | @@ -139,57 +136,15 @@ public class BaseFragmentActivity extends FragmentActivity implements Navigation |
| 139 | // Inner and Anonymous Classes | 136 | // Inner and Anonymous Classes |
| 140 | // =========================================================== | 137 | // =========================================================== |
| 141 | 138 | ||
| 142 | -// private final CallbackReceiver<Consumer> mConsumerReceiver = new CallbackReceiver<Consumer>() { | ||
| 143 | -// @Override | ||
| 144 | -// public void onSuccess(Consumer result) { | ||
| 145 | -// mConsumer = result; | ||
| 146 | -//// WarplyManagerHelper.setConsumer(result); | ||
| 147 | -//// Thread.currentThread().interrupt(); | ||
| 148 | -// Warply.getInbox(new WarplyInboxRequest().setUseCache(false), mInboxReceiver); | ||
| 149 | -// } | ||
| 150 | -// | ||
| 151 | -// @Override | ||
| 152 | -// public void onFailure(int errorCode) { | ||
| 153 | -// Thread.currentThread().interrupt(); | ||
| 154 | -// } | ||
| 155 | -// }; | ||
| 156 | - | ||
| 157 | - private final CallbackReceiver<CampaignList> mInboxReceiver = new CallbackReceiver<CampaignList>() { | ||
| 158 | - @Override | ||
| 159 | - public void onSuccess(CampaignList result) { | ||
| 160 | - for (Campaign campaign : result) { | ||
| 161 | - if (mUniqueCampaignList.containsKey(campaign.getOfferCategory().trim())) { | ||
| 162 | - CampaignList tempCampaignList = (CampaignList) mUniqueCampaignList.get(campaign.getOfferCategory().trim()); | ||
| 163 | - tempCampaignList.add(campaign); | ||
| 164 | - mUniqueCampaignList.put(campaign.getOfferCategory().trim(), tempCampaignList); | ||
| 165 | - } else { | ||
| 166 | - CampaignList tempCampaignList = new CampaignList(); | ||
| 167 | - tempCampaignList.add(campaign); | ||
| 168 | - mUniqueCampaignList.put(campaign.getOfferCategory().trim(), tempCampaignList); | ||
| 169 | - } | ||
| 170 | - } | ||
| 171 | - | ||
| 172 | -// Thread.currentThread().interrupt(); | ||
| 173 | - | ||
| 174 | - WarplyManager.getUserCouponsWithCouponsets(new WarplyUserCouponsRequest(), mUserCouponsReceiver); | ||
| 175 | - | ||
| 176 | - } | ||
| 177 | - | ||
| 178 | - @Override | ||
| 179 | - public void onFailure(int errorCode) { | ||
| 180 | - Thread.currentThread().interrupt(); | ||
| 181 | - } | ||
| 182 | - }; | ||
| 183 | - | ||
| 184 | private CallbackReceiver<ArrayList<Campaign>> mCampaignsCallback = new CallbackReceiver<ArrayList<Campaign>>() { | 139 | private CallbackReceiver<ArrayList<Campaign>> mCampaignsCallback = new CallbackReceiver<ArrayList<Campaign>>() { |
| 185 | @Override | 140 | @Override |
| 186 | public void onSuccess(ArrayList<Campaign> result) { | 141 | public void onSuccess(ArrayList<Campaign> result) { |
| 187 | - WarplyManager.getUserCouponsWithCouponsets(new WarplyUserCouponsRequest(), mUserCouponsReceiver); | 142 | + |
| 188 | } | 143 | } |
| 189 | 144 | ||
| 190 | @Override | 145 | @Override |
| 191 | public void onFailure(int errorCode) { | 146 | public void onFailure(int errorCode) { |
| 192 | - Thread.currentThread().interrupt(); | 147 | + |
| 193 | } | 148 | } |
| 194 | }; | 149 | }; |
| 195 | 150 | ||
| ... | @@ -197,15 +152,12 @@ public class BaseFragmentActivity extends FragmentActivity implements Navigation | ... | @@ -197,15 +152,12 @@ public class BaseFragmentActivity extends FragmentActivity implements Navigation |
| 197 | private final CallbackReceiver<CouponList> mUserCouponsReceiver = new CallbackReceiver<CouponList>() { | 152 | private final CallbackReceiver<CouponList> mUserCouponsReceiver = new CallbackReceiver<CouponList>() { |
| 198 | @Override | 153 | @Override |
| 199 | public void onSuccess(CouponList result) { | 154 | public void onSuccess(CouponList result) { |
| 200 | - Thread.currentThread().interrupt(); | 155 | + |
| 201 | - new Handler(Looper.getMainLooper()).post(() -> { | ||
| 202 | - initViews(); | ||
| 203 | - }); | ||
| 204 | } | 156 | } |
| 205 | 157 | ||
| 206 | @Override | 158 | @Override |
| 207 | public void onFailure(int errorCode) { | 159 | public void onFailure(int errorCode) { |
| 208 | - Thread.currentThread().interrupt(); | 160 | + |
| 209 | } | 161 | } |
| 210 | }; | 162 | }; |
| 211 | 163 | ... | ... |
| ... | @@ -88,6 +88,28 @@ public class Coupon implements Parcelable, Serializable { | ... | @@ -88,6 +88,28 @@ public class Coupon implements Parcelable, Serializable { |
| 88 | private String discount_type = ""; | 88 | private String discount_type = ""; |
| 89 | private double final_price = 0.0d; | 89 | private double final_price = 0.0d; |
| 90 | 90 | ||
| 91 | + public Coupon() { | ||
| 92 | + this.barcode = ""; | ||
| 93 | + this.category = ""; | ||
| 94 | + this.coupon = ""; | ||
| 95 | + this.created = ""; | ||
| 96 | + this.description = ""; | ||
| 97 | + this.discount = ""; | ||
| 98 | + this.expiration = ""; | ||
| 99 | + this.image = ""; | ||
| 100 | + this.name = ""; | ||
| 101 | + this.status = 0; | ||
| 102 | + this.transactionDate = ""; | ||
| 103 | + this.transactionUuid = ""; | ||
| 104 | + this.changesDates = new JSONObject(); | ||
| 105 | + this.couponsetUuid = ""; | ||
| 106 | + this.merchantUuid = ""; | ||
| 107 | + this.innerText = ""; | ||
| 108 | + this.expirationDate = new Date(); | ||
| 109 | + this.discount_type = ""; | ||
| 110 | + this.final_price = 0.0d; | ||
| 111 | + } | ||
| 112 | + | ||
| 91 | /** | 113 | /** |
| 92 | * Basic constructor used to create an object from a String, representing a | 114 | * Basic constructor used to create an object from a String, representing a |
| 93 | * JSON Object | 115 | * JSON Object | ... | ... |
| 1 | +package ly.warp.sdk.io.models; | ||
| 2 | + | ||
| 3 | +import com.google.gson.annotations.Expose; | ||
| 4 | +import com.google.gson.annotations.SerializedName; | ||
| 5 | + | ||
| 6 | +import java.util.ArrayList; | ||
| 7 | +import java.util.Date; | ||
| 8 | + | ||
| 9 | +/** | ||
| 10 | + * Created by Panagiotis Triantafyllou on 24/Νοε/2022. | ||
| 11 | + */ | ||
| 12 | + | ||
| 13 | +public class CouponModel { | ||
| 14 | + @SerializedName("msg") | ||
| 15 | + @Expose | ||
| 16 | + private String msg; | ||
| 17 | + @SerializedName("result") | ||
| 18 | + @Expose | ||
| 19 | + private ArrayList<CouponResult> result = null; | ||
| 20 | + @SerializedName("status") | ||
| 21 | + @Expose | ||
| 22 | + private Integer status; | ||
| 23 | + | ||
| 24 | + public String getMsg() { | ||
| 25 | + return msg; | ||
| 26 | + } | ||
| 27 | + | ||
| 28 | + public void setMsg(String msg) { | ||
| 29 | + this.msg = msg; | ||
| 30 | + } | ||
| 31 | + | ||
| 32 | + public Integer getStatus() { | ||
| 33 | + return status; | ||
| 34 | + } | ||
| 35 | + | ||
| 36 | + public void setStatus(Integer status) { | ||
| 37 | + this.status = status; | ||
| 38 | + } | ||
| 39 | + | ||
| 40 | + public ArrayList<CouponResult> getResult() { | ||
| 41 | + return result; | ||
| 42 | + } | ||
| 43 | + | ||
| 44 | + public void setResult(ArrayList<CouponResult> result) { | ||
| 45 | + this.result = result; | ||
| 46 | + } | ||
| 47 | + | ||
| 48 | + public class CouponResult { | ||
| 49 | + @SerializedName("changes_dates") | ||
| 50 | + @Expose | ||
| 51 | + private ChangesDates changesDates; | ||
| 52 | + @SerializedName("communication_uuid") | ||
| 53 | + @Expose | ||
| 54 | + private String communicationUuid; | ||
| 55 | + @SerializedName("coupon") | ||
| 56 | + @Expose | ||
| 57 | + private String coupon; | ||
| 58 | + @SerializedName("couponset_uuid") | ||
| 59 | + @Expose | ||
| 60 | + private String couponsetUuid; | ||
| 61 | + @SerializedName("description") | ||
| 62 | + @Expose | ||
| 63 | + private String description; | ||
| 64 | + @SerializedName("discount") | ||
| 65 | + @Expose | ||
| 66 | + private String discount; | ||
| 67 | + @SerializedName("expiration") | ||
| 68 | + @Expose | ||
| 69 | + private String expiration; | ||
| 70 | + @SerializedName("image") | ||
| 71 | + @Expose | ||
| 72 | + private String image; | ||
| 73 | + @SerializedName("name") | ||
| 74 | + @Expose | ||
| 75 | + private String name; | ||
| 76 | + @SerializedName("status") | ||
| 77 | + @Expose | ||
| 78 | + private Integer status; | ||
| 79 | + private String merchantUuid = ""; | ||
| 80 | + private String innerText = ""; | ||
| 81 | + private Date expirationDate = new Date(); | ||
| 82 | + private String discount_type = ""; | ||
| 83 | + private double final_price = 0.0d; | ||
| 84 | + | ||
| 85 | + public ChangesDates getChangesDates() { | ||
| 86 | + return changesDates; | ||
| 87 | + } | ||
| 88 | + | ||
| 89 | + public void setChangesDates(ChangesDates changesDates) { | ||
| 90 | + this.changesDates = changesDates; | ||
| 91 | + } | ||
| 92 | + | ||
| 93 | + public String getCommunicationUuid() { | ||
| 94 | + return communicationUuid; | ||
| 95 | + } | ||
| 96 | + | ||
| 97 | + public void setCommunicationUuid(String communicationUuid) { | ||
| 98 | + this.communicationUuid = communicationUuid; | ||
| 99 | + } | ||
| 100 | + | ||
| 101 | + public String getCoupon() { | ||
| 102 | + return coupon; | ||
| 103 | + } | ||
| 104 | + | ||
| 105 | + public void setCoupon(String coupon) { | ||
| 106 | + this.coupon = coupon; | ||
| 107 | + } | ||
| 108 | + | ||
| 109 | + public String getCouponsetUuid() { | ||
| 110 | + return couponsetUuid; | ||
| 111 | + } | ||
| 112 | + | ||
| 113 | + public void setCouponsetUuid(String couponsetUuid) { | ||
| 114 | + this.couponsetUuid = couponsetUuid; | ||
| 115 | + } | ||
| 116 | + | ||
| 117 | + public String getDescription() { | ||
| 118 | + return description; | ||
| 119 | + } | ||
| 120 | + | ||
| 121 | + public void setDescription(String description) { | ||
| 122 | + this.description = description; | ||
| 123 | + } | ||
| 124 | + | ||
| 125 | + public String getDiscount() { | ||
| 126 | + return discount; | ||
| 127 | + } | ||
| 128 | + | ||
| 129 | + public void setDiscount(String discount) { | ||
| 130 | + this.discount = discount; | ||
| 131 | + } | ||
| 132 | + | ||
| 133 | + public String getExpiration() { | ||
| 134 | + return expiration; | ||
| 135 | + } | ||
| 136 | + | ||
| 137 | + public void setExpiration(String expiration) { | ||
| 138 | + this.expiration = expiration; | ||
| 139 | + } | ||
| 140 | + | ||
| 141 | + public String getImage() { | ||
| 142 | + return image; | ||
| 143 | + } | ||
| 144 | + | ||
| 145 | + public void setImage(String image) { | ||
| 146 | + this.image = image; | ||
| 147 | + } | ||
| 148 | + | ||
| 149 | + public String getName() { | ||
| 150 | + return name; | ||
| 151 | + } | ||
| 152 | + | ||
| 153 | + public void setName(String name) { | ||
| 154 | + this.name = name; | ||
| 155 | + } | ||
| 156 | + | ||
| 157 | + public Integer getStatus() { | ||
| 158 | + return status; | ||
| 159 | + } | ||
| 160 | + | ||
| 161 | + public void setStatus(Integer status) { | ||
| 162 | + this.status = status; | ||
| 163 | + } | ||
| 164 | + | ||
| 165 | + public String getMerchantUuid() { | ||
| 166 | + return merchantUuid; | ||
| 167 | + } | ||
| 168 | + | ||
| 169 | + public void setMerchantUuid(String merchantUuid) { | ||
| 170 | + this.merchantUuid = merchantUuid; | ||
| 171 | + } | ||
| 172 | + | ||
| 173 | + public String getInnerText() { | ||
| 174 | + return innerText; | ||
| 175 | + } | ||
| 176 | + | ||
| 177 | + public void setInnerText(String innerText) { | ||
| 178 | + this.innerText = innerText; | ||
| 179 | + } | ||
| 180 | + | ||
| 181 | + public Date getExpirationDate() { | ||
| 182 | + return expirationDate; | ||
| 183 | + } | ||
| 184 | + | ||
| 185 | + public void setExpirationDate(Date expirationDate) { | ||
| 186 | + this.expirationDate = expirationDate; | ||
| 187 | + } | ||
| 188 | + | ||
| 189 | + public String getDiscount_type() { | ||
| 190 | + return discount_type; | ||
| 191 | + } | ||
| 192 | + | ||
| 193 | + public void setDiscount_type(String discount_type) { | ||
| 194 | + this.discount_type = discount_type; | ||
| 195 | + } | ||
| 196 | + | ||
| 197 | + public double getFinal_price() { | ||
| 198 | + return final_price; | ||
| 199 | + } | ||
| 200 | + | ||
| 201 | + public void setFinal_price(double final_price) { | ||
| 202 | + this.final_price = final_price; | ||
| 203 | + } | ||
| 204 | + } | ||
| 205 | + | ||
| 206 | + public class ChangesDates { | ||
| 207 | + @SerializedName("assigned") | ||
| 208 | + @Expose | ||
| 209 | + private String assigned; | ||
| 210 | + @SerializedName("created") | ||
| 211 | + @Expose | ||
| 212 | + private String created; | ||
| 213 | + | ||
| 214 | + public String getAssigned() { | ||
| 215 | + return assigned; | ||
| 216 | + } | ||
| 217 | + | ||
| 218 | + public void setAssigned(String assigned) { | ||
| 219 | + this.assigned = assigned; | ||
| 220 | + } | ||
| 221 | + | ||
| 222 | + public String getCreated() { | ||
| 223 | + return created; | ||
| 224 | + } | ||
| 225 | + | ||
| 226 | + public void setCreated(String created) { | ||
| 227 | + this.created = created; | ||
| 228 | + } | ||
| 229 | + } | ||
| 230 | +} |
| 1 | +package ly.warp.sdk.io.models; | ||
| 2 | + | ||
| 3 | +import org.json.JSONArray; | ||
| 4 | + | ||
| 5 | +import ly.warp.sdk.Warply; | ||
| 6 | +import ly.warp.sdk.utils.WarplyProperty; | ||
| 7 | + | ||
| 8 | +/** | ||
| 9 | + * Created by Panagiotis Triantafyllou on 24/Νοε/2022. | ||
| 10 | + */ | ||
| 11 | +public class CouponRequestModel { | ||
| 12 | + private CouponsetRequestInnerModel coupon; | ||
| 13 | + | ||
| 14 | + public CouponRequestModel() { | ||
| 15 | + this.coupon = new CouponsetRequestInnerModel(); | ||
| 16 | + } | ||
| 17 | + | ||
| 18 | + private class CouponsetRequestInnerModel { | ||
| 19 | + private String action; | ||
| 20 | + private JSONArray fetch_data; | ||
| 21 | + | ||
| 22 | + public CouponsetRequestInnerModel() { | ||
| 23 | + this.action = "get_user_coupons"; | ||
| 24 | + JSONArray fetch = new JSONArray(); | ||
| 25 | + fetch.put("transaction"); | ||
| 26 | + fetch.put("communication"); | ||
| 27 | + this.fetch_data = fetch; | ||
| 28 | + } | ||
| 29 | + } | ||
| 30 | +} |
| ... | @@ -109,6 +109,37 @@ public class Couponset implements Parcelable, Serializable { | ... | @@ -109,6 +109,37 @@ public class Couponset implements Parcelable, Serializable { |
| 109 | private String discount_type = ""; | 109 | private String discount_type = ""; |
| 110 | private double final_price = 0.0d; | 110 | private double final_price = 0.0d; |
| 111 | 111 | ||
| 112 | + public Couponset() { | ||
| 113 | + this.uuid = ""; | ||
| 114 | + this.admin_name = ""; | ||
| 115 | + this.created = ""; | ||
| 116 | + this.updated = ""; | ||
| 117 | + this.app_uuid = ""; | ||
| 118 | + this.img = new JSONArray(); | ||
| 119 | + this.img_preview = ""; | ||
| 120 | + this.sorting = 0; | ||
| 121 | + this.active = false; | ||
| 122 | + this.visible = false; | ||
| 123 | + this.buyable = false; | ||
| 124 | + this.user_generated = false; | ||
| 125 | + this.limits = new JSONObject(); | ||
| 126 | + this.points = 0; | ||
| 127 | + this.points_cause = ""; | ||
| 128 | + this.expiration = ""; | ||
| 129 | + this.third_party_service = false; | ||
| 130 | + this.name = ""; | ||
| 131 | + this.description = ""; | ||
| 132 | + this.short_description = ""; | ||
| 133 | + this.discount = ""; | ||
| 134 | + this.category = ""; | ||
| 135 | + this.terms = ""; | ||
| 136 | + this.availability = 0; | ||
| 137 | + this.merchantUuid = ""; | ||
| 138 | + this.innerText = ""; | ||
| 139 | + this.discount_type = ""; | ||
| 140 | + this.final_price = 0.0d; | ||
| 141 | + } | ||
| 142 | + | ||
| 112 | /** | 143 | /** |
| 113 | * Basic constructor used to create an object from a String, representing a | 144 | * Basic constructor used to create an object from a String, representing a |
| 114 | * JSON Object | 145 | * JSON Object |
| ... | @@ -411,6 +442,118 @@ public class Couponset implements Parcelable, Serializable { | ... | @@ -411,6 +442,118 @@ public class Couponset implements Parcelable, Serializable { |
| 411 | return final_price; | 442 | return final_price; |
| 412 | } | 443 | } |
| 413 | 444 | ||
| 445 | + public void setUuid(String uuid) { | ||
| 446 | + this.uuid = uuid; | ||
| 447 | + } | ||
| 448 | + | ||
| 449 | + public void setAdmin_name(String admin_name) { | ||
| 450 | + this.admin_name = admin_name; | ||
| 451 | + } | ||
| 452 | + | ||
| 453 | + public void setCreated(String created) { | ||
| 454 | + this.created = created; | ||
| 455 | + } | ||
| 456 | + | ||
| 457 | + public void setUpdated(String updated) { | ||
| 458 | + this.updated = updated; | ||
| 459 | + } | ||
| 460 | + | ||
| 461 | + public void setApp_uuid(String app_uuid) { | ||
| 462 | + this.app_uuid = app_uuid; | ||
| 463 | + } | ||
| 464 | + | ||
| 465 | + public void setImg(JSONArray img) { | ||
| 466 | + this.img = img; | ||
| 467 | + } | ||
| 468 | + | ||
| 469 | + public void setImg_preview(String img_preview) { | ||
| 470 | + this.img_preview = img_preview; | ||
| 471 | + } | ||
| 472 | + | ||
| 473 | + public void setSorting(int sorting) { | ||
| 474 | + this.sorting = sorting; | ||
| 475 | + } | ||
| 476 | + | ||
| 477 | + public void setActive(boolean active) { | ||
| 478 | + this.active = active; | ||
| 479 | + } | ||
| 480 | + | ||
| 481 | + public void setVisible(boolean visible) { | ||
| 482 | + this.visible = visible; | ||
| 483 | + } | ||
| 484 | + | ||
| 485 | + public void setBuyable(boolean buyable) { | ||
| 486 | + this.buyable = buyable; | ||
| 487 | + } | ||
| 488 | + | ||
| 489 | + public void setUser_generated(boolean user_generated) { | ||
| 490 | + this.user_generated = user_generated; | ||
| 491 | + } | ||
| 492 | + | ||
| 493 | + public void setLimits(JSONObject limits) { | ||
| 494 | + this.limits = limits; | ||
| 495 | + } | ||
| 496 | + | ||
| 497 | + public void setPoints(int points) { | ||
| 498 | + this.points = points; | ||
| 499 | + } | ||
| 500 | + | ||
| 501 | + public void setPoints_cause(String points_cause) { | ||
| 502 | + this.points_cause = points_cause; | ||
| 503 | + } | ||
| 504 | + | ||
| 505 | + public void setExpiration(String expiration) { | ||
| 506 | + this.expiration = expiration; | ||
| 507 | + } | ||
| 508 | + | ||
| 509 | + public void setThird_party_service(boolean third_party_service) { | ||
| 510 | + this.third_party_service = third_party_service; | ||
| 511 | + } | ||
| 512 | + | ||
| 513 | + public void setName(String name) { | ||
| 514 | + this.name = name; | ||
| 515 | + } | ||
| 516 | + | ||
| 517 | + public void setDescription(String description) { | ||
| 518 | + this.description = description; | ||
| 519 | + } | ||
| 520 | + | ||
| 521 | + public void setShort_description(String short_description) { | ||
| 522 | + this.short_description = short_description; | ||
| 523 | + } | ||
| 524 | + | ||
| 525 | + public void setDiscount(String discount) { | ||
| 526 | + this.discount = discount; | ||
| 527 | + } | ||
| 528 | + | ||
| 529 | + public void setCategory(String category) { | ||
| 530 | + this.category = category; | ||
| 531 | + } | ||
| 532 | + | ||
| 533 | + public void setTerms(String terms) { | ||
| 534 | + this.terms = terms; | ||
| 535 | + } | ||
| 536 | + | ||
| 537 | + public void setAvailability(int availability) { | ||
| 538 | + this.availability = availability; | ||
| 539 | + } | ||
| 540 | + | ||
| 541 | + public void setMerchantUuid(String merchantUuid) { | ||
| 542 | + this.merchantUuid = merchantUuid; | ||
| 543 | + } | ||
| 544 | + | ||
| 545 | + public void setInnerText(String innerText) { | ||
| 546 | + this.innerText = innerText; | ||
| 547 | + } | ||
| 548 | + | ||
| 549 | + public void setDiscount_type(String discount_type) { | ||
| 550 | + this.discount_type = discount_type; | ||
| 551 | + } | ||
| 552 | + | ||
| 553 | + public void setFinal_price(double final_price) { | ||
| 554 | + this.final_price = final_price; | ||
| 555 | + } | ||
| 556 | + | ||
| 414 | @Override | 557 | @Override |
| 415 | public int describeContents() { | 558 | public int describeContents() { |
| 416 | return 0; | 559 | return 0; | ... | ... |
| 1 | +package ly.warp.sdk.io.models; | ||
| 2 | + | ||
| 3 | +import com.google.gson.annotations.Expose; | ||
| 4 | +import com.google.gson.annotations.SerializedName; | ||
| 5 | + | ||
| 6 | +import java.util.ArrayList; | ||
| 7 | + | ||
| 8 | +/** | ||
| 9 | + * Created by Panagiotis Triantafyllou on 24/Νοε/2022. | ||
| 10 | + */ | ||
| 11 | + | ||
| 12 | +public class CouponsetModel { | ||
| 13 | + @SerializedName("status") | ||
| 14 | + @Expose | ||
| 15 | + private String status; | ||
| 16 | + @SerializedName("context") | ||
| 17 | + @Expose | ||
| 18 | + private CouponsetContext context; | ||
| 19 | + | ||
| 20 | + public String getStatus() { | ||
| 21 | + return status; | ||
| 22 | + } | ||
| 23 | + | ||
| 24 | + public void setStatus(String status) { | ||
| 25 | + this.status = status; | ||
| 26 | + } | ||
| 27 | + | ||
| 28 | + public CouponsetContext getContext() { | ||
| 29 | + return context; | ||
| 30 | + } | ||
| 31 | + | ||
| 32 | + public void setContext(CouponsetContext context) { | ||
| 33 | + this.context = context; | ||
| 34 | + } | ||
| 35 | + | ||
| 36 | + public class CouponsetContext { | ||
| 37 | + @SerializedName("MAPP_COUPON-status") | ||
| 38 | + @Expose | ||
| 39 | + private Integer mAPPCOUPONStatus; | ||
| 40 | + @SerializedName("events_processed") | ||
| 41 | + @Expose | ||
| 42 | + private Integer eventsProcessed; | ||
| 43 | + @SerializedName("MAPP_COUPON") | ||
| 44 | + @Expose | ||
| 45 | + private ArrayList<MappCoupon> mappCoupon = null; | ||
| 46 | + | ||
| 47 | + public ArrayList<MappCoupon> getMappCoupon() { | ||
| 48 | + return mappCoupon; | ||
| 49 | + } | ||
| 50 | + | ||
| 51 | + public void setMappCoupon(ArrayList<MappCoupon> mappCoupon) { | ||
| 52 | + this.mappCoupon = mappCoupon; | ||
| 53 | + } | ||
| 54 | + | ||
| 55 | + public Integer getMAPPCOUPONStatus() { | ||
| 56 | + return mAPPCOUPONStatus; | ||
| 57 | + } | ||
| 58 | + | ||
| 59 | + public void setMAPPCOUPONStatus(Integer mAPPCOUPONStatus) { | ||
| 60 | + this.mAPPCOUPONStatus = mAPPCOUPONStatus; | ||
| 61 | + } | ||
| 62 | + | ||
| 63 | + public Integer getEventsProcessed() { | ||
| 64 | + return eventsProcessed; | ||
| 65 | + } | ||
| 66 | + | ||
| 67 | + public void setEventsProcessed(Integer eventsProcessed) { | ||
| 68 | + this.eventsProcessed = eventsProcessed; | ||
| 69 | + } | ||
| 70 | + } | ||
| 71 | + | ||
| 72 | + public class MappCoupon { | ||
| 73 | + @SerializedName("uuid") | ||
| 74 | + @Expose | ||
| 75 | + private String uuid; | ||
| 76 | + @SerializedName("img_preview") | ||
| 77 | + @Expose | ||
| 78 | + private String imgPreview; | ||
| 79 | + @SerializedName("final_price") | ||
| 80 | + @Expose | ||
| 81 | + private Integer finalPrice; | ||
| 82 | + @SerializedName("start_date") | ||
| 83 | + @Expose | ||
| 84 | + private String startDate; | ||
| 85 | + @SerializedName("end_date") | ||
| 86 | + @Expose | ||
| 87 | + private String endDate; | ||
| 88 | + @SerializedName("discount_type") | ||
| 89 | + @Expose | ||
| 90 | + private String discountType; | ||
| 91 | + @SerializedName("promoted") | ||
| 92 | + @Expose | ||
| 93 | + private Boolean promoted; | ||
| 94 | + @SerializedName("expiration") | ||
| 95 | + @Expose | ||
| 96 | + private CouponsetExpiration expiration; | ||
| 97 | + @SerializedName("name") | ||
| 98 | + @Expose | ||
| 99 | + private String name; | ||
| 100 | + @SerializedName("description") | ||
| 101 | + @Expose | ||
| 102 | + private String description; | ||
| 103 | + @SerializedName("short_description") | ||
| 104 | + @Expose | ||
| 105 | + private String shortDescription; | ||
| 106 | + @SerializedName("discount") | ||
| 107 | + @Expose | ||
| 108 | + private String discount; | ||
| 109 | + @SerializedName("terms") | ||
| 110 | + @Expose | ||
| 111 | + private String terms; | ||
| 112 | + @SerializedName("inner_text") | ||
| 113 | + @Expose | ||
| 114 | + private String innerText; | ||
| 115 | + @SerializedName("merchant_uuid") | ||
| 116 | + @Expose | ||
| 117 | + private String merchantUuid; | ||
| 118 | + | ||
| 119 | + public String getUuid() { | ||
| 120 | + return uuid; | ||
| 121 | + } | ||
| 122 | + | ||
| 123 | + public void setUuid(String uuid) { | ||
| 124 | + this.uuid = uuid; | ||
| 125 | + } | ||
| 126 | + | ||
| 127 | + public String getImgPreview() { | ||
| 128 | + return imgPreview; | ||
| 129 | + } | ||
| 130 | + | ||
| 131 | + public void setImgPreview(String imgPreview) { | ||
| 132 | + this.imgPreview = imgPreview; | ||
| 133 | + } | ||
| 134 | + | ||
| 135 | + public Integer getFinalPrice() { | ||
| 136 | + return finalPrice; | ||
| 137 | + } | ||
| 138 | + | ||
| 139 | + public void setFinalPrice(Integer finalPrice) { | ||
| 140 | + this.finalPrice = finalPrice; | ||
| 141 | + } | ||
| 142 | + | ||
| 143 | + public String getStartDate() { | ||
| 144 | + return startDate; | ||
| 145 | + } | ||
| 146 | + | ||
| 147 | + public void setStartDate(String startDate) { | ||
| 148 | + this.startDate = startDate; | ||
| 149 | + } | ||
| 150 | + | ||
| 151 | + public String getEndDate() { | ||
| 152 | + return endDate; | ||
| 153 | + } | ||
| 154 | + | ||
| 155 | + public void setEndDate(String endDate) { | ||
| 156 | + this.endDate = endDate; | ||
| 157 | + } | ||
| 158 | + | ||
| 159 | + public String getDiscountType() { | ||
| 160 | + return discountType; | ||
| 161 | + } | ||
| 162 | + | ||
| 163 | + public void setDiscountType(String discountType) { | ||
| 164 | + this.discountType = discountType; | ||
| 165 | + } | ||
| 166 | + | ||
| 167 | + public Boolean getPromoted() { | ||
| 168 | + return promoted; | ||
| 169 | + } | ||
| 170 | + | ||
| 171 | + public void setPromoted(Boolean promoted) { | ||
| 172 | + this.promoted = promoted; | ||
| 173 | + } | ||
| 174 | + | ||
| 175 | + public CouponsetExpiration getExpiration() { | ||
| 176 | + return expiration; | ||
| 177 | + } | ||
| 178 | + | ||
| 179 | + public void setExpiration(CouponsetExpiration expiration) { | ||
| 180 | + this.expiration = expiration; | ||
| 181 | + } | ||
| 182 | + | ||
| 183 | + public String getName() { | ||
| 184 | + return name; | ||
| 185 | + } | ||
| 186 | + | ||
| 187 | + public void setName(String name) { | ||
| 188 | + this.name = name; | ||
| 189 | + } | ||
| 190 | + | ||
| 191 | + public String getDescription() { | ||
| 192 | + return description; | ||
| 193 | + } | ||
| 194 | + | ||
| 195 | + public void setDescription(String description) { | ||
| 196 | + this.description = description; | ||
| 197 | + } | ||
| 198 | + | ||
| 199 | + public String getShortDescription() { | ||
| 200 | + return shortDescription; | ||
| 201 | + } | ||
| 202 | + | ||
| 203 | + public void setShortDescription(String shortDescription) { | ||
| 204 | + this.shortDescription = shortDescription; | ||
| 205 | + } | ||
| 206 | + | ||
| 207 | + public String getDiscount() { | ||
| 208 | + return discount; | ||
| 209 | + } | ||
| 210 | + | ||
| 211 | + public void setDiscount(String discount) { | ||
| 212 | + this.discount = discount; | ||
| 213 | + } | ||
| 214 | + | ||
| 215 | + public String getTerms() { | ||
| 216 | + return terms; | ||
| 217 | + } | ||
| 218 | + | ||
| 219 | + public void setTerms(String terms) { | ||
| 220 | + this.terms = terms; | ||
| 221 | + } | ||
| 222 | + | ||
| 223 | + public String getInnerText() { | ||
| 224 | + return innerText; | ||
| 225 | + } | ||
| 226 | + | ||
| 227 | + public void setInnerText(String innerText) { | ||
| 228 | + this.innerText = innerText; | ||
| 229 | + } | ||
| 230 | + | ||
| 231 | + public String getMerchantUuid() { | ||
| 232 | + return merchantUuid; | ||
| 233 | + } | ||
| 234 | + | ||
| 235 | + public void setMerchantUuid(String merchantUuid) { | ||
| 236 | + this.merchantUuid = merchantUuid; | ||
| 237 | + } | ||
| 238 | + } | ||
| 239 | + | ||
| 240 | + public class CouponsetExpiration { | ||
| 241 | + @SerializedName("type") | ||
| 242 | + @Expose | ||
| 243 | + private String type; | ||
| 244 | + @SerializedName("value") | ||
| 245 | + @Expose | ||
| 246 | + private String value; | ||
| 247 | + | ||
| 248 | + public String getType() { | ||
| 249 | + return type; | ||
| 250 | + } | ||
| 251 | + | ||
| 252 | + public void setType(String type) { | ||
| 253 | + this.type = type; | ||
| 254 | + } | ||
| 255 | + | ||
| 256 | + public String getValue() { | ||
| 257 | + return value; | ||
| 258 | + } | ||
| 259 | + | ||
| 260 | + public void setValue(String value) { | ||
| 261 | + this.value = value; | ||
| 262 | + } | ||
| 263 | + } | ||
| 264 | +} |
| 1 | +package ly.warp.sdk.io.models; | ||
| 2 | + | ||
| 3 | +import org.json.JSONArray; | ||
| 4 | +import org.json.JSONObject; | ||
| 5 | + | ||
| 6 | +import java.util.ArrayList; | ||
| 7 | + | ||
| 8 | +import ly.warp.sdk.Warply; | ||
| 9 | +import ly.warp.sdk.utils.WarplyProperty; | ||
| 10 | + | ||
| 11 | +/** | ||
| 12 | + * Created by Panagiotis Triantafyllou on 24/Νοε/2022. | ||
| 13 | + */ | ||
| 14 | +public class CouponsetRequestModel { | ||
| 15 | + private CouponsetRequestInnerModel coupon; | ||
| 16 | + | ||
| 17 | + public CouponsetRequestModel() { | ||
| 18 | + this.coupon = new CouponsetRequestInnerModel(); | ||
| 19 | + } | ||
| 20 | + | ||
| 21 | + private class CouponsetRequestInnerModel { | ||
| 22 | + private String action; | ||
| 23 | + private boolean active; | ||
| 24 | + private boolean visible; | ||
| 25 | + private String language; | ||
| 26 | + | ||
| 27 | + public CouponsetRequestInnerModel() { | ||
| 28 | + this.action = "retrieve_multilingual"; | ||
| 29 | + this.active = true; | ||
| 30 | + this.visible = true; | ||
| 31 | + this.language = WarplyProperty.getLanguage(Warply.getWarplyContext()); | ||
| 32 | + } | ||
| 33 | + } | ||
| 34 | +} |
| ... | @@ -565,6 +565,170 @@ public class Merchant implements Parcelable, Serializable, ClusterItem { | ... | @@ -565,6 +565,170 @@ public class Merchant implements Parcelable, Serializable, ClusterItem { |
| 565 | return product; | 565 | return product; |
| 566 | } | 566 | } |
| 567 | 567 | ||
| 568 | + public void setAddress(String address) { | ||
| 569 | + this.address = address; | ||
| 570 | + } | ||
| 571 | + | ||
| 572 | + public void setId(String id) { | ||
| 573 | + this.id = id; | ||
| 574 | + } | ||
| 575 | + | ||
| 576 | + public void setStore_id(String store_id) { | ||
| 577 | + this.store_id = store_id; | ||
| 578 | + } | ||
| 579 | + | ||
| 580 | + public void setName(String name) { | ||
| 581 | + this.name = name; | ||
| 582 | + } | ||
| 583 | + | ||
| 584 | + public void setLogo(String logo) { | ||
| 585 | + this.logo = logo; | ||
| 586 | + } | ||
| 587 | + | ||
| 588 | + public void setWebsite(String website) { | ||
| 589 | + this.website = website; | ||
| 590 | + } | ||
| 591 | + | ||
| 592 | + public void setEmail(String email) { | ||
| 593 | + this.email = email; | ||
| 594 | + } | ||
| 595 | + | ||
| 596 | + public void setTelephone(String telephone) { | ||
| 597 | + this.telephone = telephone; | ||
| 598 | + } | ||
| 599 | + | ||
| 600 | + public void setCategory(String category) { | ||
| 601 | + this.category = category; | ||
| 602 | + } | ||
| 603 | + | ||
| 604 | + public void setDescription(String description) { | ||
| 605 | + this.description = description; | ||
| 606 | + } | ||
| 607 | + | ||
| 608 | + public void setShort_description(String short_description) { | ||
| 609 | + this.short_description = short_description; | ||
| 610 | + } | ||
| 611 | + | ||
| 612 | + public void setRegion(String region) { | ||
| 613 | + this.region = region; | ||
| 614 | + } | ||
| 615 | + | ||
| 616 | + public void setLatitude(double latitude) { | ||
| 617 | + this.latitude = latitude; | ||
| 618 | + } | ||
| 619 | + | ||
| 620 | + public void setLongitude(double longitude) { | ||
| 621 | + this.longitude = longitude; | ||
| 622 | + } | ||
| 623 | + | ||
| 624 | + public void setImage(String image) { | ||
| 625 | + this.image = image; | ||
| 626 | + } | ||
| 627 | + | ||
| 628 | + public void setExtra_fields(JSONObject extra_fields) { | ||
| 629 | + this.extra_fields = extra_fields; | ||
| 630 | + } | ||
| 631 | + | ||
| 632 | + public void setActive(boolean active) { | ||
| 633 | + this.active = active; | ||
| 634 | + } | ||
| 635 | + | ||
| 636 | + public void setCity(String city) { | ||
| 637 | + this.city = city; | ||
| 638 | + } | ||
| 639 | + | ||
| 640 | + public void setCountry(String country) { | ||
| 641 | + this.country = country; | ||
| 642 | + } | ||
| 643 | + | ||
| 644 | + public void setPostal_code(String postal_code) { | ||
| 645 | + this.postal_code = postal_code; | ||
| 646 | + } | ||
| 647 | + | ||
| 648 | + public void setVat(String vat) { | ||
| 649 | + this.vat = vat; | ||
| 650 | + } | ||
| 651 | + | ||
| 652 | + public void setUuid(String uuid) { | ||
| 653 | + this.uuid = uuid; | ||
| 654 | + } | ||
| 655 | + | ||
| 656 | + public void setCategory_uuid(String category_uuid) { | ||
| 657 | + this.category_uuid = category_uuid; | ||
| 658 | + } | ||
| 659 | + | ||
| 660 | + public void setCreated(String created) { | ||
| 661 | + this.created = created; | ||
| 662 | + } | ||
| 663 | + | ||
| 664 | + public void setParent(String parent) { | ||
| 665 | + this.parent = parent; | ||
| 666 | + } | ||
| 667 | + | ||
| 668 | + public void setImg(JSONArray img) { | ||
| 669 | + this.img = img; | ||
| 670 | + } | ||
| 671 | + | ||
| 672 | + public void setImg_preview(String img_preview) { | ||
| 673 | + this.img_preview = img_preview; | ||
| 674 | + } | ||
| 675 | + | ||
| 676 | + public void setAdmin_name(String admin_name) { | ||
| 677 | + this.admin_name = admin_name; | ||
| 678 | + } | ||
| 679 | + | ||
| 680 | + public void setSorting(int sorting) { | ||
| 681 | + this.sorting = sorting; | ||
| 682 | + } | ||
| 683 | + | ||
| 684 | + public void setBody(String body) { | ||
| 685 | + this.body = body; | ||
| 686 | + } | ||
| 687 | + | ||
| 688 | + public void setOwner_name(String owner_name) { | ||
| 689 | + this.owner_name = owner_name; | ||
| 690 | + } | ||
| 691 | + | ||
| 692 | + public void setPreview(String preview) { | ||
| 693 | + this.preview = preview; | ||
| 694 | + } | ||
| 695 | + | ||
| 696 | + public void setMerchant_metadata(JSONObject merchant_metadata) { | ||
| 697 | + this.merchant_metadata = merchant_metadata; | ||
| 698 | + } | ||
| 699 | + | ||
| 700 | + public void setPromoted(boolean promoted) { | ||
| 701 | + this.promoted = promoted; | ||
| 702 | + } | ||
| 703 | + | ||
| 704 | + public void setDistance(int distance) { | ||
| 705 | + this.distance = distance; | ||
| 706 | + } | ||
| 707 | + | ||
| 708 | + public void setDefault_shown(boolean default_shown) { | ||
| 709 | + this.default_shown = default_shown; | ||
| 710 | + } | ||
| 711 | + | ||
| 712 | + public void setHidden(boolean hidden) { | ||
| 713 | + this.hidden = hidden; | ||
| 714 | + } | ||
| 715 | + | ||
| 716 | + public void setWorking_hours(JSONObject working_hours) { | ||
| 717 | + this.working_hours = working_hours; | ||
| 718 | + } | ||
| 719 | + | ||
| 720 | + public void setTags(JSONArray tags) { | ||
| 721 | + this.tags = tags; | ||
| 722 | + } | ||
| 723 | + | ||
| 724 | + public void setProduct(JSONObject product) { | ||
| 725 | + this.product = product; | ||
| 726 | + } | ||
| 727 | + | ||
| 728 | + public void setCoordinates(LatLng coordinates) { | ||
| 729 | + this.coordinates = coordinates; | ||
| 730 | + } | ||
| 731 | + | ||
| 568 | @Override | 732 | @Override |
| 569 | public int describeContents() { | 733 | public int describeContents() { |
| 570 | return 0; | 734 | return 0; | ... | ... |
| 1 | +package ly.warp.sdk.io.models; | ||
| 2 | + | ||
| 3 | +import com.google.gson.annotations.Expose; | ||
| 4 | +import com.google.gson.annotations.SerializedName; | ||
| 5 | + | ||
| 6 | +import java.util.ArrayList; | ||
| 7 | +import java.util.Date; | ||
| 8 | + | ||
| 9 | +/** | ||
| 10 | + * Created by Panagiotis Triantafyllou on 24/Νοε/2022. | ||
| 11 | + */ | ||
| 12 | + | ||
| 13 | +public class MerchantModel { | ||
| 14 | + @SerializedName("status") | ||
| 15 | + @Expose | ||
| 16 | + private String status; | ||
| 17 | + @SerializedName("context") | ||
| 18 | + @Expose | ||
| 19 | + private MerchantContext context; | ||
| 20 | + | ||
| 21 | + public String getStatus() { | ||
| 22 | + return status; | ||
| 23 | + } | ||
| 24 | + | ||
| 25 | + public void setStatus(String status) { | ||
| 26 | + this.status = status; | ||
| 27 | + } | ||
| 28 | + | ||
| 29 | + public MerchantContext getContext() { | ||
| 30 | + return context; | ||
| 31 | + } | ||
| 32 | + | ||
| 33 | + public void setContext(MerchantContext context) { | ||
| 34 | + this.context = context; | ||
| 35 | + } | ||
| 36 | + | ||
| 37 | + public class MerchantContext { | ||
| 38 | + @SerializedName("MAPP_SHOPS") | ||
| 39 | + @Expose | ||
| 40 | + private MappShops mappShops; | ||
| 41 | + @SerializedName("MAPP_SHOPS-status") | ||
| 42 | + @Expose | ||
| 43 | + private Integer mAPPSHOPSStatus; | ||
| 44 | + @SerializedName("events_processed") | ||
| 45 | + @Expose | ||
| 46 | + private Integer eventsProcessed; | ||
| 47 | + | ||
| 48 | + public MappShops getMappShops() { | ||
| 49 | + return mappShops; | ||
| 50 | + } | ||
| 51 | + | ||
| 52 | + public void setMappShops(MappShops mappShops) { | ||
| 53 | + this.mappShops = mappShops; | ||
| 54 | + } | ||
| 55 | + | ||
| 56 | + public Integer getMAPPSHOPSStatus() { | ||
| 57 | + return mAPPSHOPSStatus; | ||
| 58 | + } | ||
| 59 | + | ||
| 60 | + public void setMAPPSHOPSStatus(Integer mAPPSHOPSStatus) { | ||
| 61 | + this.mAPPSHOPSStatus = mAPPSHOPSStatus; | ||
| 62 | + } | ||
| 63 | + | ||
| 64 | + public Integer getEventsProcessed() { | ||
| 65 | + return eventsProcessed; | ||
| 66 | + } | ||
| 67 | + | ||
| 68 | + public void setEventsProcessed(Integer eventsProcessed) { | ||
| 69 | + this.eventsProcessed = eventsProcessed; | ||
| 70 | + } | ||
| 71 | + } | ||
| 72 | + | ||
| 73 | + public class MappShops { | ||
| 74 | + @SerializedName("msg") | ||
| 75 | + @Expose | ||
| 76 | + private String msg; | ||
| 77 | + @SerializedName("result") | ||
| 78 | + @Expose | ||
| 79 | + private ArrayList<MerchantResult> result = null; | ||
| 80 | + | ||
| 81 | + public String getMsg() { | ||
| 82 | + return msg; | ||
| 83 | + } | ||
| 84 | + | ||
| 85 | + public void setMsg(String msg) { | ||
| 86 | + this.msg = msg; | ||
| 87 | + } | ||
| 88 | + | ||
| 89 | + public ArrayList<MerchantResult> getResult() { | ||
| 90 | + return result; | ||
| 91 | + } | ||
| 92 | + | ||
| 93 | + public void setResult(ArrayList<MerchantResult> result) { | ||
| 94 | + this.result = result; | ||
| 95 | + } | ||
| 96 | + } | ||
| 97 | + | ||
| 98 | + public class MerchantResult { | ||
| 99 | + @SerializedName("uuid") | ||
| 100 | + @Expose | ||
| 101 | + private String uuid; | ||
| 102 | + @SerializedName("img_preview") | ||
| 103 | + @Expose | ||
| 104 | + private String imgPreview; | ||
| 105 | + @SerializedName("admin_name") | ||
| 106 | + @Expose | ||
| 107 | + private String adminName; | ||
| 108 | + @SerializedName("address") | ||
| 109 | + @Expose | ||
| 110 | + private String address; | ||
| 111 | + @SerializedName("name") | ||
| 112 | + @Expose | ||
| 113 | + private String name; | ||
| 114 | + @SerializedName("latitude") | ||
| 115 | + @Expose | ||
| 116 | + private double latitude; | ||
| 117 | + @SerializedName("longitude") | ||
| 118 | + @Expose | ||
| 119 | + private double longitude; | ||
| 120 | + @SerializedName("telephone") | ||
| 121 | + @Expose | ||
| 122 | + private String telephone; | ||
| 123 | + @SerializedName("website") | ||
| 124 | + @Expose | ||
| 125 | + private String website; | ||
| 126 | + | ||
| 127 | + public String getUuid() { | ||
| 128 | + return uuid; | ||
| 129 | + } | ||
| 130 | + | ||
| 131 | + public void setUuid(String uuid) { | ||
| 132 | + this.uuid = uuid; | ||
| 133 | + } | ||
| 134 | + | ||
| 135 | + public String getImgPreview() { | ||
| 136 | + return imgPreview; | ||
| 137 | + } | ||
| 138 | + | ||
| 139 | + public void setImgPreview(String imgPreview) { | ||
| 140 | + this.imgPreview = imgPreview; | ||
| 141 | + } | ||
| 142 | + | ||
| 143 | + public String getAdminName() { | ||
| 144 | + return adminName; | ||
| 145 | + } | ||
| 146 | + | ||
| 147 | + public void setAdminName(String adminName) { | ||
| 148 | + this.adminName = adminName; | ||
| 149 | + } | ||
| 150 | + | ||
| 151 | + public String getAddress() { | ||
| 152 | + return address; | ||
| 153 | + } | ||
| 154 | + | ||
| 155 | + public void setAddress(String address) { | ||
| 156 | + this.address = address; | ||
| 157 | + } | ||
| 158 | + | ||
| 159 | + public String getName() { | ||
| 160 | + return name; | ||
| 161 | + } | ||
| 162 | + | ||
| 163 | + public void setName(String name) { | ||
| 164 | + this.name = name; | ||
| 165 | + } | ||
| 166 | + | ||
| 167 | + public double getLatitude() { | ||
| 168 | + return latitude; | ||
| 169 | + } | ||
| 170 | + | ||
| 171 | + public void setLatitude(double latitude) { | ||
| 172 | + this.latitude = latitude; | ||
| 173 | + } | ||
| 174 | + | ||
| 175 | + public double getLongitude() { | ||
| 176 | + return longitude; | ||
| 177 | + } | ||
| 178 | + | ||
| 179 | + public void setLongitude(double longitude) { | ||
| 180 | + this.longitude = longitude; | ||
| 181 | + } | ||
| 182 | + | ||
| 183 | + public String getTelephone() { | ||
| 184 | + return telephone; | ||
| 185 | + } | ||
| 186 | + | ||
| 187 | + public void setTelephone(String telephone) { | ||
| 188 | + this.telephone = telephone; | ||
| 189 | + } | ||
| 190 | + | ||
| 191 | + public String getWebsite() { | ||
| 192 | + return website; | ||
| 193 | + } | ||
| 194 | + | ||
| 195 | + public void setWebsite(String website) { | ||
| 196 | + this.website = website; | ||
| 197 | + } | ||
| 198 | + } | ||
| 199 | +} |
| 1 | +package ly.warp.sdk.io.models; | ||
| 2 | + | ||
| 3 | +import org.json.JSONArray; | ||
| 4 | +import org.json.JSONObject; | ||
| 5 | + | ||
| 6 | +import ly.warp.sdk.Warply; | ||
| 7 | +import ly.warp.sdk.utils.WarplyProperty; | ||
| 8 | + | ||
| 9 | +/** | ||
| 10 | + * Created by Panagiotis Triantafyllou on 24/Νοε/2022. | ||
| 11 | + */ | ||
| 12 | +public class MerchantsRequestModel { | ||
| 13 | + private MerchantsRequestInnerModel shops; | ||
| 14 | + | ||
| 15 | + public MerchantsRequestModel() { | ||
| 16 | + this.shops = new MerchantsRequestInnerModel(); | ||
| 17 | + } | ||
| 18 | + | ||
| 19 | + private class MerchantsRequestInnerModel { | ||
| 20 | + private String action; | ||
| 21 | + private JSONArray categories; | ||
| 22 | + private boolean active; | ||
| 23 | + private JSONObject location; | ||
| 24 | + private JSONArray parent_uuids; | ||
| 25 | + private String language; | ||
| 26 | + | ||
| 27 | + public MerchantsRequestInnerModel() { | ||
| 28 | + this.action = "retrieve_multilingual"; | ||
| 29 | + this.categories = new JSONArray(); | ||
| 30 | + this.active = true; | ||
| 31 | + this.location = null; | ||
| 32 | + this.parent_uuids = null; | ||
| 33 | + this.language = WarplyProperty.getLanguage(Warply.getWarplyContext()); | ||
| 34 | + } | ||
| 35 | + } | ||
| 36 | +} |
| 1 | +package ly.warp.sdk.io.volley; | ||
| 2 | + | ||
| 3 | +import java.util.concurrent.TimeUnit; | ||
| 4 | + | ||
| 5 | +import ly.warp.sdk.Warply; | ||
| 6 | +import ly.warp.sdk.utils.WarplyProperty; | ||
| 7 | +import okhttp3.OkHttpClient; | ||
| 8 | +import retrofit2.Retrofit; | ||
| 9 | +import retrofit2.converter.gson.GsonConverterFactory; | ||
| 10 | + | ||
| 11 | +/** | ||
| 12 | + * Created by Panagiotis Triantafyllou on 24/Νοε/2022. | ||
| 13 | + */ | ||
| 14 | + | ||
| 15 | +public class ApiClient { | ||
| 16 | + // =========================================================== | ||
| 17 | + // Constants | ||
| 18 | + // =========================================================== | ||
| 19 | + | ||
| 20 | + // =========================================================== | ||
| 21 | + // Fields | ||
| 22 | + // =========================================================== | ||
| 23 | + | ||
| 24 | + private static Retrofit retrofit; | ||
| 25 | + | ||
| 26 | + // =========================================================== | ||
| 27 | + // Methods for/from SuperClass/Interfaces | ||
| 28 | + // =========================================================== | ||
| 29 | + | ||
| 30 | + // =========================================================== | ||
| 31 | + // Methods | ||
| 32 | + // =========================================================== | ||
| 33 | + | ||
| 34 | + public static Retrofit getRetrofitInstance() { | ||
| 35 | +// Gson gson = new GsonBuilder() | ||
| 36 | +// .setLenient() | ||
| 37 | +// .create(); | ||
| 38 | + | ||
| 39 | + if (retrofit == null) { | ||
| 40 | + retrofit = new Retrofit.Builder() | ||
| 41 | + .baseUrl(WarplyProperty.getBaseUrl(Warply.getWarplyContext())) | ||
| 42 | + .client(getClient()) | ||
| 43 | + .addConverterFactory(GsonConverterFactory.create(/*gson*/)) | ||
| 44 | + .build(); | ||
| 45 | + } | ||
| 46 | + return retrofit; | ||
| 47 | + } | ||
| 48 | + | ||
| 49 | + private static OkHttpClient getClient() { | ||
| 50 | + return new OkHttpClient.Builder() | ||
| 51 | + .connectTimeout(30, TimeUnit.SECONDS) | ||
| 52 | + .writeTimeout(30, TimeUnit.SECONDS) | ||
| 53 | + .readTimeout(30, TimeUnit.SECONDS) | ||
| 54 | + .build(); | ||
| 55 | + } | ||
| 56 | + | ||
| 57 | + // =========================================================== | ||
| 58 | + // Getter & Setter | ||
| 59 | + // =========================================================== | ||
| 60 | + | ||
| 61 | + // =========================================================== | ||
| 62 | + // Inner and Anonymous Classes | ||
| 63 | + // =========================================================== | ||
| 64 | +} |
| 1 | +package ly.warp.sdk.io.volley; | ||
| 2 | + | ||
| 3 | +import ly.warp.sdk.io.models.CouponModel; | ||
| 4 | +import ly.warp.sdk.io.models.CouponRequestModel; | ||
| 5 | +import ly.warp.sdk.io.models.CouponsetModel; | ||
| 6 | +import ly.warp.sdk.io.models.CouponsetRequestModel; | ||
| 7 | +import ly.warp.sdk.io.models.MerchantModel; | ||
| 8 | +import ly.warp.sdk.io.models.MerchantsRequestModel; | ||
| 9 | +import ly.warp.sdk.utils.constants.WarpConstants; | ||
| 10 | +import retrofit2.Call; | ||
| 11 | +import retrofit2.http.Body; | ||
| 12 | +import retrofit2.http.Header; | ||
| 13 | +import retrofit2.http.POST; | ||
| 14 | +import retrofit2.http.Path; | ||
| 15 | + | ||
| 16 | +/** | ||
| 17 | + * Created by Panagiotis Triantafyllou on 24/Νοε/2022. | ||
| 18 | + */ | ||
| 19 | +public interface ApiService { | ||
| 20 | + // =========================================================== | ||
| 21 | + // Constants | ||
| 22 | + // =========================================================== | ||
| 23 | + | ||
| 24 | + // =========================================================== | ||
| 25 | + // Fields | ||
| 26 | + // =========================================================== | ||
| 27 | + | ||
| 28 | + // =========================================================== | ||
| 29 | + // Methods for/from SuperClass/Interfaces | ||
| 30 | + // =========================================================== | ||
| 31 | + | ||
| 32 | + // =========================================================== | ||
| 33 | + // Methods | ||
| 34 | + // =========================================================== | ||
| 35 | + | ||
| 36 | + @POST("/api/mobile/v2/{appUuid}/context/") | ||
| 37 | + Call<CouponsetModel> getCouponsets(@Path("appUuid") String appUuid, | ||
| 38 | + @Body CouponsetRequestModel request, | ||
| 39 | + @Header(WarpConstants.HEADER_DATE) String timeStamp, | ||
| 40 | + @Header(WarpConstants.HEADER_LOYALTY_BUNDLE_ID) String bundleId, | ||
| 41 | + @Header(WarpConstants.HEADER_UNIQUE_DEVICE_ID) String deviceId, | ||
| 42 | + @Header(WarpConstants.HEADER_CHANNEL) String channel, | ||
| 43 | + @Header(WarpConstants.HEADER_WEB_ID) String webId, | ||
| 44 | + @Header(WarpConstants.HEADER_SIGNATURE) String signature); | ||
| 45 | + | ||
| 46 | + @POST("/oauth/{appUuid}/context") | ||
| 47 | + Call<CouponModel> getUserCoupons(@Path("appUuid") String appUuid, | ||
| 48 | + @Body CouponRequestModel request, | ||
| 49 | + @Header(WarpConstants.HEADER_DATE) String timeStamp, | ||
| 50 | + @Header(WarpConstants.HEADER_LOYALTY_BUNDLE_ID) String bundleId, | ||
| 51 | + @Header(WarpConstants.HEADER_UNIQUE_DEVICE_ID) String deviceId, | ||
| 52 | + @Header(WarpConstants.HEADER_CHANNEL) String channel, | ||
| 53 | + @Header(WarpConstants.HEADER_WEB_ID) String webId, | ||
| 54 | + @Header(WarpConstants.HEADER_SIGNATURE) String signature, | ||
| 55 | + @Header(WarpConstants.HEADER_AUTHORIZATION) String bearer); | ||
| 56 | + | ||
| 57 | + @POST("/api/mobile/v2/{appUuid}/context/") | ||
| 58 | + Call<MerchantModel> getMerchants(@Path("appUuid") String appUuid, | ||
| 59 | + @Body MerchantsRequestModel request, | ||
| 60 | + @Header(WarpConstants.HEADER_DATE) String timeStamp, | ||
| 61 | + @Header(WarpConstants.HEADER_LOYALTY_BUNDLE_ID) String bundleId, | ||
| 62 | + @Header(WarpConstants.HEADER_UNIQUE_DEVICE_ID) String deviceId, | ||
| 63 | + @Header(WarpConstants.HEADER_CHANNEL) String channel, | ||
| 64 | + @Header(WarpConstants.HEADER_WEB_ID) String webId, | ||
| 65 | + @Header(WarpConstants.HEADER_SIGNATURE) String signature); | ||
| 66 | + | ||
| 67 | + // =========================================================== | ||
| 68 | + // Getter & Setter | ||
| 69 | + // =========================================================== | ||
| 70 | + | ||
| 71 | + // =========================================================== | ||
| 72 | + // Inner and Anonymous Classes | ||
| 73 | + // =========================================================== | ||
| 74 | +} |
| ... | @@ -33,7 +33,10 @@ import android.app.PendingIntent; | ... | @@ -33,7 +33,10 @@ import android.app.PendingIntent; |
| 33 | import android.content.Context; | 33 | import android.content.Context; |
| 34 | import android.content.Intent; | 34 | import android.content.Intent; |
| 35 | import android.os.Build; | 35 | import android.os.Build; |
| 36 | +import android.os.Handler; | ||
| 37 | +import android.os.Looper; | ||
| 36 | import android.os.SystemClock; | 38 | import android.os.SystemClock; |
| 39 | +import android.text.format.DateFormat; | ||
| 37 | 40 | ||
| 38 | import androidx.work.OneTimeWorkRequest; | 41 | import androidx.work.OneTimeWorkRequest; |
| 39 | import androidx.work.WorkManager; | 42 | import androidx.work.WorkManager; |
| ... | @@ -50,6 +53,8 @@ import java.util.Collections; | ... | @@ -50,6 +53,8 @@ import java.util.Collections; |
| 50 | import java.util.Date; | 53 | import java.util.Date; |
| 51 | import java.util.LinkedHashSet; | 54 | import java.util.LinkedHashSet; |
| 52 | import java.util.Set; | 55 | import java.util.Set; |
| 56 | +import java.util.concurrent.ExecutorService; | ||
| 57 | +import java.util.concurrent.Executors; | ||
| 53 | 58 | ||
| 54 | import ly.warp.sdk.Warply; | 59 | import ly.warp.sdk.Warply; |
| 55 | import ly.warp.sdk.db.WarplyDBHelper; | 60 | import ly.warp.sdk.db.WarplyDBHelper; |
| ... | @@ -79,12 +84,19 @@ import ly.warp.sdk.io.models.Consumer; | ... | @@ -79,12 +84,19 @@ import ly.warp.sdk.io.models.Consumer; |
| 79 | import ly.warp.sdk.io.models.ContentList; | 84 | import ly.warp.sdk.io.models.ContentList; |
| 80 | import ly.warp.sdk.io.models.Coupon; | 85 | import ly.warp.sdk.io.models.Coupon; |
| 81 | import ly.warp.sdk.io.models.CouponList; | 86 | import ly.warp.sdk.io.models.CouponList; |
| 87 | +import ly.warp.sdk.io.models.CouponModel; | ||
| 88 | +import ly.warp.sdk.io.models.CouponRequestModel; | ||
| 82 | import ly.warp.sdk.io.models.Couponset; | 89 | import ly.warp.sdk.io.models.Couponset; |
| 90 | +import ly.warp.sdk.io.models.CouponsetModel; | ||
| 91 | +import ly.warp.sdk.io.models.CouponsetRequestModel; | ||
| 83 | import ly.warp.sdk.io.models.CouponsetsList; | 92 | import ly.warp.sdk.io.models.CouponsetsList; |
| 84 | import ly.warp.sdk.io.models.LoyaltyContextualOfferModel; | 93 | import ly.warp.sdk.io.models.LoyaltyContextualOfferModel; |
| 85 | import ly.warp.sdk.io.models.LoyaltySDKDynatraceEventModel; | 94 | import ly.warp.sdk.io.models.LoyaltySDKDynatraceEventModel; |
| 95 | +import ly.warp.sdk.io.models.Merchant; | ||
| 86 | import ly.warp.sdk.io.models.MerchantCategoriesList; | 96 | import ly.warp.sdk.io.models.MerchantCategoriesList; |
| 87 | import ly.warp.sdk.io.models.MerchantList; | 97 | import ly.warp.sdk.io.models.MerchantList; |
| 98 | +import ly.warp.sdk.io.models.MerchantModel; | ||
| 99 | +import ly.warp.sdk.io.models.MerchantsRequestModel; | ||
| 88 | import ly.warp.sdk.io.models.PacingDetails; | 100 | import ly.warp.sdk.io.models.PacingDetails; |
| 89 | import ly.warp.sdk.io.models.PointsList; | 101 | import ly.warp.sdk.io.models.PointsList; |
| 90 | import ly.warp.sdk.io.models.ProductList; | 102 | import ly.warp.sdk.io.models.ProductList; |
| ... | @@ -139,13 +151,19 @@ import ly.warp.sdk.io.request.WarplyUserCouponsRequest; | ... | @@ -139,13 +151,19 @@ import ly.warp.sdk.io.request.WarplyUserCouponsRequest; |
| 139 | import ly.warp.sdk.io.request.WarplyValidateCouponRequest; | 151 | import ly.warp.sdk.io.request.WarplyValidateCouponRequest; |
| 140 | import ly.warp.sdk.io.request.WarplyVerifyOTPRequest; | 152 | import ly.warp.sdk.io.request.WarplyVerifyOTPRequest; |
| 141 | import ly.warp.sdk.io.request.WarplyVerifyTicketRequest; | 153 | import ly.warp.sdk.io.request.WarplyVerifyTicketRequest; |
| 154 | +import ly.warp.sdk.io.volley.ApiClient; | ||
| 155 | +import ly.warp.sdk.io.volley.ApiService; | ||
| 142 | import ly.warp.sdk.services.EventCampaignService; | 156 | import ly.warp.sdk.services.EventCampaignService; |
| 143 | import ly.warp.sdk.services.WarplyHealthService; | 157 | import ly.warp.sdk.services.WarplyHealthService; |
| 144 | import ly.warp.sdk.utils.WarpJSONParser; | 158 | import ly.warp.sdk.utils.WarpJSONParser; |
| 145 | import ly.warp.sdk.utils.WarpUtils; | 159 | import ly.warp.sdk.utils.WarpUtils; |
| 160 | +import ly.warp.sdk.utils.WarplyDeviceInfoCollector; | ||
| 146 | import ly.warp.sdk.utils.WarplyManagerHelper; | 161 | import ly.warp.sdk.utils.WarplyManagerHelper; |
| 147 | import ly.warp.sdk.utils.WarplyProperty; | 162 | import ly.warp.sdk.utils.WarplyProperty; |
| 148 | import ly.warp.sdk.utils.constants.WarpConstants; | 163 | import ly.warp.sdk.utils.constants.WarpConstants; |
| 164 | +import retrofit2.Call; | ||
| 165 | +import retrofit2.Callback; | ||
| 166 | +import retrofit2.Response; | ||
| 149 | 167 | ||
| 150 | /** | 168 | /** |
| 151 | * Created by Panagiotis Triantafyllou on 15-Dec-21. | 169 | * Created by Panagiotis Triantafyllou on 15-Dec-21. |
| ... | @@ -2531,6 +2549,307 @@ public class WarplyManager { | ... | @@ -2531,6 +2549,307 @@ public class WarplyManager { |
| 2531 | }); | 2549 | }); |
| 2532 | } | 2550 | } |
| 2533 | 2551 | ||
| 2552 | + public static void getUserCouponsWithCouponsets(final CallbackReceiver<CouponList> receiver) { | ||
| 2553 | + WarpUtils.log("************* WARPLY User Coupons Request ********************"); | ||
| 2554 | + WarpUtils.log("[WARP Trace] WARPLY User Coupons Request is active"); | ||
| 2555 | + WarpUtils.log("**************************************************"); | ||
| 2556 | + | ||
| 2557 | + getMerchantsRetro(new Callback<MerchantModel>() { | ||
| 2558 | + @Override | ||
| 2559 | + public void onResponse(Call<MerchantModel> call, Response<MerchantModel> response) { | ||
| 2560 | + if (response.code() == 200) { | ||
| 2561 | + if (response.body() != null && response.body().getStatus().equals("1")) { | ||
| 2562 | + MerchantList mMerchantList = new MerchantList(); | ||
| 2563 | + final ExecutorService executorShops = Executors.newFixedThreadPool(2); | ||
| 2564 | + executorShops.submit(() -> { | ||
| 2565 | + for (MerchantModel.MerchantResult shop : response.body().getContext().getMappShops().getResult()) { | ||
| 2566 | + Merchant merchant = new Merchant(); | ||
| 2567 | + merchant.setAddress(shop.getAddress()); | ||
| 2568 | + merchant.setName(shop.getName()); | ||
| 2569 | + merchant.setWebsite(shop.getWebsite()); | ||
| 2570 | + merchant.setTelephone(shop.getTelephone()); | ||
| 2571 | + merchant.setLatitude(shop.getLatitude()); | ||
| 2572 | + merchant.setLongitude(shop.getLongitude()); | ||
| 2573 | + merchant.setUuid(shop.getUuid()); | ||
| 2574 | + merchant.setImg_preview(shop.getImgPreview()); | ||
| 2575 | + merchant.setAdmin_name(shop.getAdminName()); | ||
| 2576 | + mMerchantList.add(merchant); | ||
| 2577 | + } | ||
| 2578 | + WarplyManagerHelper.setMerchantList(mMerchantList); | ||
| 2579 | + }); | ||
| 2580 | + executorShops.shutdownNow(); | ||
| 2581 | + | ||
| 2582 | + getCouponsetsRetro(new Callback<CouponsetModel>() { | ||
| 2583 | + @Override | ||
| 2584 | + public void onResponse(Call<CouponsetModel> call, Response<CouponsetModel> response) { | ||
| 2585 | + if (response.code() == 200) { | ||
| 2586 | + if (response.body() != null && response.body().getStatus().equals("1")) { | ||
| 2587 | + getUserCouponsRetro(new Callback<CouponModel>() { | ||
| 2588 | + @Override | ||
| 2589 | + public void onResponse(Call<CouponModel> call, Response<CouponModel> responseCoupons) { | ||
| 2590 | + if (responseCoupons.code() == 200) { | ||
| 2591 | + if (responseCoupons.body() != null && responseCoupons.body().getStatus() == 1) { | ||
| 2592 | + LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel(); | ||
| 2593 | + dynatraceEvent.setEventName("custom_success_user_coupons_loyalty"); | ||
| 2594 | + EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent)); | ||
| 2595 | + | ||
| 2596 | + CouponList mActiveCouponList = new CouponList(); | ||
| 2597 | + final ExecutorService executor = Executors.newFixedThreadPool(2); | ||
| 2598 | + executor.submit(() -> { | ||
| 2599 | + CouponList mCouponList = new CouponList(); | ||
| 2600 | + for (CouponModel.CouponResult coupon : responseCoupons.body().getResult()) { | ||
| 2601 | + for (CouponsetModel.MappCoupon couponset : response.body().getContext().getMappCoupon()) { | ||
| 2602 | + if (coupon.getCouponsetUuid().equals(couponset.getUuid())) { | ||
| 2603 | + Coupon newCoupon = new Coupon(); | ||
| 2604 | + newCoupon.setStatus(coupon.getStatus()); | ||
| 2605 | + | ||
| 2606 | + JSONObject obj = new JSONObject(); | ||
| 2607 | + try { | ||
| 2608 | + obj.putOpt("assigned", coupon.getChangesDates().getAssigned()); | ||
| 2609 | + obj.putOpt("created", coupon.getChangesDates().getCreated()); | ||
| 2610 | + newCoupon.setChangesDates(obj); | ||
| 2611 | + } catch (JSONException e) { | ||
| 2612 | + e.printStackTrace(); | ||
| 2613 | + } | ||
| 2614 | + newCoupon.setImage(coupon.getImage()); | ||
| 2615 | + newCoupon.setMerchantUuid(coupon.getMerchantUuid()); | ||
| 2616 | + newCoupon.setCoupon(coupon.getCoupon()); | ||
| 2617 | + newCoupon.setCouponsetUuid(coupon.getCouponsetUuid()); | ||
| 2618 | + newCoupon.setDiscount(coupon.getDiscount()); | ||
| 2619 | + newCoupon.setExpiration(coupon.getExpiration()); | ||
| 2620 | + newCoupon.setDescription(couponset.getShortDescription()); | ||
| 2621 | + newCoupon.setName(couponset.getName()); | ||
| 2622 | + newCoupon.setMerchantUuid(couponset.getMerchantUuid()); | ||
| 2623 | + newCoupon.setInnerText(couponset.getInnerText()); | ||
| 2624 | + newCoupon.setDiscount_type(couponset.getDiscountType()); | ||
| 2625 | + newCoupon.setFinal_price(couponset.getFinalPrice()); | ||
| 2626 | + mCouponList.add(newCoupon); | ||
| 2627 | + } | ||
| 2628 | + } | ||
| 2629 | + } | ||
| 2630 | + WarplyManagerHelper.setCouponList(mCouponList); | ||
| 2631 | + | ||
| 2632 | + for (Coupon coupon : mCouponList) { | ||
| 2633 | + if (coupon.getStatus() == 1) { | ||
| 2634 | + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm"); | ||
| 2635 | + Date newDate = new Date(); | ||
| 2636 | + try { | ||
| 2637 | + newDate = simpleDateFormat.parse(coupon.getExpiration()); | ||
| 2638 | + } catch (ParseException e) { | ||
| 2639 | + e.printStackTrace(); | ||
| 2640 | + } | ||
| 2641 | + coupon.setExpirationDate(newDate); | ||
| 2642 | + mActiveCouponList.add(coupon); | ||
| 2643 | + } | ||
| 2644 | + } | ||
| 2645 | + | ||
| 2646 | + Collections.sort(mActiveCouponList, (coupon1, coupon2) -> coupon1.getExpirationDate().compareTo(coupon2.getExpirationDate())); | ||
| 2647 | + | ||
| 2648 | + CouponsetsList newCouponstList = new CouponsetsList(); | ||
| 2649 | + for (CouponsetModel.MappCoupon couponsetOld : response.body().getContext().getMappCoupon()) { | ||
| 2650 | + Couponset newCouponset = new Couponset(); | ||
| 2651 | + newCouponset.setUuid(couponsetOld.getUuid()); | ||
| 2652 | + newCouponset.setImg_preview(couponsetOld.getImgPreview()); | ||
| 2653 | + newCouponset.setExpiration(couponsetOld.getExpiration().getValue()); | ||
| 2654 | + newCouponset.setName(couponsetOld.getName()); | ||
| 2655 | + newCouponset.setDescription(couponsetOld.getDescription()); | ||
| 2656 | + newCouponset.setShort_description(couponsetOld.getShortDescription()); | ||
| 2657 | + newCouponset.setDiscount(couponsetOld.getDiscount()); | ||
| 2658 | + newCouponset.setTerms(couponsetOld.getTerms()); | ||
| 2659 | + newCouponset.setMerchantUuid(couponsetOld.getMerchantUuid()); | ||
| 2660 | + newCouponset.setInnerText(couponsetOld.getInnerText()); | ||
| 2661 | + newCouponset.setDiscount_type(couponsetOld.getDiscountType()); | ||
| 2662 | + newCouponset.setFinal_price(couponsetOld.getFinalPrice()); | ||
| 2663 | + newCouponstList.add(newCouponset); | ||
| 2664 | + } | ||
| 2665 | + WarplyManagerHelper.setCouponsets(newCouponstList); | ||
| 2666 | + }); | ||
| 2667 | + executor.shutdownNow(); | ||
| 2668 | + | ||
| 2669 | + new Handler(Looper.getMainLooper()).post(() -> receiver.onSuccess(mActiveCouponList)); | ||
| 2670 | + } else { | ||
| 2671 | + LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel(); | ||
| 2672 | + dynatraceEvent.setEventName("custom_error_user_coupons_loyalty"); | ||
| 2673 | + EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent)); | ||
| 2674 | + receiver.onFailure(2); | ||
| 2675 | + } | ||
| 2676 | + } else { | ||
| 2677 | + LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel(); | ||
| 2678 | + dynatraceEvent.setEventName("custom_error_user_coupons_loyalty"); | ||
| 2679 | + EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent)); | ||
| 2680 | + receiver.onFailure(responseCoupons.code()); | ||
| 2681 | + } | ||
| 2682 | + } | ||
| 2683 | + | ||
| 2684 | + @Override | ||
| 2685 | + public void onFailure(Call<CouponModel> call, Throwable t) { | ||
| 2686 | + LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel(); | ||
| 2687 | + dynatraceEvent.setEventName("custom_error_user_coupons_loyalty"); | ||
| 2688 | + EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent)); | ||
| 2689 | + receiver.onFailure(2); | ||
| 2690 | + } | ||
| 2691 | + }); | ||
| 2692 | + } else { | ||
| 2693 | + LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel(); | ||
| 2694 | + dynatraceEvent.setEventName("custom_error_couponsets_loyalty"); | ||
| 2695 | + EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent)); | ||
| 2696 | + receiver.onFailure(2); | ||
| 2697 | + } | ||
| 2698 | + } else { | ||
| 2699 | + LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel(); | ||
| 2700 | + dynatraceEvent.setEventName("custom_error_couponsets_loyalty"); | ||
| 2701 | + EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent)); | ||
| 2702 | + receiver.onFailure(2); | ||
| 2703 | + } | ||
| 2704 | + } | ||
| 2705 | + | ||
| 2706 | + @Override | ||
| 2707 | + public void onFailure(Call<CouponsetModel> call, Throwable t) { | ||
| 2708 | + LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel(); | ||
| 2709 | + dynatraceEvent.setEventName("custom_error_couponsets_loyalty"); | ||
| 2710 | + EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent)); | ||
| 2711 | + receiver.onFailure(2); | ||
| 2712 | + } | ||
| 2713 | + }); | ||
| 2714 | + } else { | ||
| 2715 | + LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel(); | ||
| 2716 | + dynatraceEvent.setEventName("custom_error_shops_loyalty"); | ||
| 2717 | + EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent)); | ||
| 2718 | + | ||
| 2719 | + receiver.onFailure(2); | ||
| 2720 | + } | ||
| 2721 | + } else { | ||
| 2722 | + LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel(); | ||
| 2723 | + dynatraceEvent.setEventName("custom_error_shops_loyalty"); | ||
| 2724 | + EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent)); | ||
| 2725 | + | ||
| 2726 | + receiver.onFailure(2); | ||
| 2727 | + } | ||
| 2728 | + } | ||
| 2729 | + | ||
| 2730 | + @Override | ||
| 2731 | + public void onFailure(Call<MerchantModel> call, Throwable t) { | ||
| 2732 | + LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel(); | ||
| 2733 | + dynatraceEvent.setEventName("custom_error_shops_loyalty"); | ||
| 2734 | + EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent)); | ||
| 2735 | + | ||
| 2736 | + receiver.onFailure(2); | ||
| 2737 | + } | ||
| 2738 | + }); | ||
| 2739 | + } | ||
| 2740 | + | ||
| 2741 | + private static void getCouponsetsRetro(Callback<CouponsetModel> callback) { | ||
| 2742 | + String timeStamp = DateFormat.format("yyyy-MM-dd hh:mm:ss", System.currentTimeMillis()).toString(); | ||
| 2743 | + String apiKey = WarpUtils.getApiKey(Warply.getWarplyContext()); | ||
| 2744 | + String webId = WarpUtils.getWebId(Warply.getWarplyContext()); | ||
| 2745 | + ApiService service = ApiClient.getRetrofitInstance().create(ApiService.class); | ||
| 2746 | + | ||
| 2747 | + CouponsetRequestModel couponsetRequest = new CouponsetRequestModel(); | ||
| 2748 | + Call<CouponsetModel> couponsetCall = service.getCouponsets( | ||
| 2749 | + WarplyProperty.getAppUuid(Warply.getWarplyContext()), | ||
| 2750 | + couponsetRequest, | ||
| 2751 | + timeStamp, | ||
| 2752 | + "android:" + Warply.getWarplyContext().getPackageName(), | ||
| 2753 | + new WarplyDeviceInfoCollector(Warply.getWarplyContext()).getUniqueDeviceId(), | ||
| 2754 | + "mobile", | ||
| 2755 | + webId, | ||
| 2756 | + WarpUtils.produceSignature(apiKey + timeStamp) | ||
| 2757 | + ); | ||
| 2758 | + | ||
| 2759 | + couponsetCall.enqueue(new Callback<CouponsetModel>() { /* =================================== Couponsets Start =================================== */ | ||
| 2760 | + @Override | ||
| 2761 | + public void onResponse(Call<CouponsetModel> call, Response<CouponsetModel> response) { | ||
| 2762 | + callback.onResponse(call, response); | ||
| 2763 | + } | ||
| 2764 | + | ||
| 2765 | + @Override | ||
| 2766 | + public void onFailure(Call<CouponsetModel> call, Throwable t) { | ||
| 2767 | + callback.onFailure(call, t); | ||
| 2768 | + } | ||
| 2769 | + }); /* ====================================================================================== Couponsets nd =========================================== */ | ||
| 2770 | + } | ||
| 2771 | + | ||
| 2772 | + private static void getMerchantsRetro(Callback<MerchantModel> callback) { | ||
| 2773 | + String timeStamp = DateFormat.format("yyyy-MM-dd hh:mm:ss", System.currentTimeMillis()).toString(); | ||
| 2774 | + String apiKey = WarpUtils.getApiKey(Warply.getWarplyContext()); | ||
| 2775 | + String webId = WarpUtils.getWebId(Warply.getWarplyContext()); | ||
| 2776 | + ApiService service = ApiClient.getRetrofitInstance().create(ApiService.class); | ||
| 2777 | + | ||
| 2778 | + MerchantsRequestModel merchantsRequest = new MerchantsRequestModel(); | ||
| 2779 | + Call<MerchantModel> merchantsCall = service.getMerchants( | ||
| 2780 | + WarplyProperty.getAppUuid(Warply.getWarplyContext()), | ||
| 2781 | + merchantsRequest, | ||
| 2782 | + timeStamp, | ||
| 2783 | + "android:" + Warply.getWarplyContext().getPackageName(), | ||
| 2784 | + new WarplyDeviceInfoCollector(Warply.getWarplyContext()).getUniqueDeviceId(), | ||
| 2785 | + "mobile", | ||
| 2786 | + webId, | ||
| 2787 | + WarpUtils.produceSignature(apiKey + timeStamp) | ||
| 2788 | + ); | ||
| 2789 | + | ||
| 2790 | + merchantsCall.enqueue(new Callback<MerchantModel>() { /* =================================== Merchants Start =================================== */ | ||
| 2791 | + @Override | ||
| 2792 | + public void onResponse(Call<MerchantModel> call, Response<MerchantModel> response) { | ||
| 2793 | + callback.onResponse(call, response); | ||
| 2794 | + } | ||
| 2795 | + | ||
| 2796 | + @Override | ||
| 2797 | + public void onFailure(Call<MerchantModel> call, Throwable t) { | ||
| 2798 | + callback.onFailure(call, t); | ||
| 2799 | + } | ||
| 2800 | + }); /* ====================================================================================== Merchants End ======================================= */ | ||
| 2801 | + } | ||
| 2802 | + | ||
| 2803 | + private static void getUserCouponsRetro(Callback<CouponModel> callback) { | ||
| 2804 | + String timeStamp = DateFormat.format("yyyy-MM-dd hh:mm:ss", System.currentTimeMillis()).toString(); | ||
| 2805 | + String apiKey = WarpUtils.getApiKey(Warply.getWarplyContext()); | ||
| 2806 | + String webId = WarpUtils.getWebId(Warply.getWarplyContext()); | ||
| 2807 | + ApiService service = ApiClient.getRetrofitInstance().create(ApiService.class); | ||
| 2808 | + | ||
| 2809 | + CouponRequestModel couponRequest = new CouponRequestModel(); | ||
| 2810 | + Call<CouponModel> couponCall = service.getUserCoupons( | ||
| 2811 | + WarplyProperty.getAppUuid(Warply.getWarplyContext()), | ||
| 2812 | + couponRequest, | ||
| 2813 | + timeStamp, | ||
| 2814 | + "android:" + Warply.getWarplyContext().getPackageName(), | ||
| 2815 | + new WarplyDeviceInfoCollector(Warply.getWarplyContext()).getUniqueDeviceId(), | ||
| 2816 | + "mobile", | ||
| 2817 | + webId, | ||
| 2818 | + WarpUtils.produceSignature(apiKey + timeStamp), | ||
| 2819 | + "Bearer " + WarplyDBHelper.getInstance(Warply.getWarplyContext()).getAuthValue("access_token") | ||
| 2820 | + ); | ||
| 2821 | + | ||
| 2822 | + couponCall.enqueue(new Callback<CouponModel>() { /* ================================== Coupons Start ================================== */ | ||
| 2823 | + @Override | ||
| 2824 | + public void onResponse(Call<CouponModel> call, Response<CouponModel> response) { | ||
| 2825 | + if (response.code() == 401) { | ||
| 2826 | + refreshToken(new WarplyRefreshTokenRequest(), new CallbackReceiver<JSONObject>() { | ||
| 2827 | + @Override | ||
| 2828 | + public void onSuccess(JSONObject result) { | ||
| 2829 | + int status = result.optInt("status", 2); | ||
| 2830 | + if (status == 1) | ||
| 2831 | + getUserCouponsRetro(callback); | ||
| 2832 | + else | ||
| 2833 | + callback.onFailure(call, new Throwable()); | ||
| 2834 | + } | ||
| 2835 | + | ||
| 2836 | + @Override | ||
| 2837 | + public void onFailure(int errorCode) { | ||
| 2838 | + callback.onFailure(call, new Throwable()); | ||
| 2839 | + } | ||
| 2840 | + }); | ||
| 2841 | + } else if (response.code() == 200) { | ||
| 2842 | + callback.onResponse(call, response); | ||
| 2843 | + } | ||
| 2844 | + } | ||
| 2845 | + | ||
| 2846 | + @Override | ||
| 2847 | + public void onFailure(Call<CouponModel> call, Throwable t) { | ||
| 2848 | + callback.onFailure(call, t); | ||
| 2849 | + } | ||
| 2850 | + }); /* ============================================================================== Coupons nd ====================================== */ | ||
| 2851 | + } | ||
| 2852 | + | ||
| 2534 | public static void getCosmoteUser(WarplyCosmoteUserRequest request, final CallbackReceiver<JSONObject> receiver) { | 2853 | public static void getCosmoteUser(WarplyCosmoteUserRequest request, final CallbackReceiver<JSONObject> receiver) { |
| 2535 | WarpUtils.log("************* WARPLY Cosmote User Request ********************"); | 2854 | WarpUtils.log("************* WARPLY Cosmote User Request ********************"); |
| 2536 | WarpUtils.log("[WARP Trace] WARPLY Cosmote User Request is active"); | 2855 | WarpUtils.log("[WARP Trace] WARPLY Cosmote User Request is active"); | ... | ... |
-
Please register or login to post a comment