Showing
14 changed files
with
1273 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 | +} |
This diff is collapsed. Click to expand it.
-
Please register or login to post a comment