Panagiotis Triantafyllou

retrofit fixes

...@@ -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.6rc21' 5 + PUBLISH_VERSION = '4.5.4.6rc29'
6 PUBLISH_ARTIFACT_ID = 'warply-android-sdk' 6 PUBLISH_ARTIFACT_ID = 'warply-android-sdk'
7 } 7 }
8 8
......
1 -/*
2 - * Copyright 2010-2013 Warply Ltd. All rights reserved.
3 - *
4 - * Redistribution and use in source and binary forms, without modification, are
5 - * permitted provided that the following conditions are met:
6 - *
7 - * 1. Redistributions of source code must retain the above copyright notice,
8 - * this list of conditions and the following disclaimer.
9 - *
10 - * 2. Redistributions in binary form must reproduce the above copyright notice,
11 - * this list of conditions and the following disclaimer in the documentation
12 - * and/or other materials provided with the distribution.
13 - *
14 - * THIS SOFTWARE IS PROVIDED BY THE WARPLY LTD ``AS IS'' AND ANY EXPRESS OR
15 - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
16 - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
17 - * EVENT SHALL WARPLY LTD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
18 - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
19 - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
20 - * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
21 - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
22 - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
23 - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 - */
25 -
26 -package ly.warp.sdk.io.callbacks;
27 -
28 -
29 -public interface RetrofitInterface {
30 -// @GET("/api/session/{sessionUuid}")
31 -// Call<ResponseBody> getSingleCampaign(@Path("sessionUuid") String sessionUuid);
32 -}
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 -}
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 -}
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; 1 package ly.warp.sdk.io.volley;
2 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; 3 import ly.warp.sdk.utils.constants.WarpConstants;
4 +import okhttp3.RequestBody;
5 +import okhttp3.ResponseBody;
10 import retrofit2.Call; 6 import retrofit2.Call;
11 import retrofit2.http.Body; 7 import retrofit2.http.Body;
12 import retrofit2.http.Header; 8 import retrofit2.http.Header;
9 +import retrofit2.http.Headers;
13 import retrofit2.http.POST; 10 import retrofit2.http.POST;
14 import retrofit2.http.Path; 11 import retrofit2.http.Path;
15 12
...@@ -33,9 +30,10 @@ public interface ApiService { ...@@ -33,9 +30,10 @@ public interface ApiService {
33 // Methods 30 // Methods
34 // =========================================================== 31 // ===========================================================
35 32
33 + @Headers("Content-Type: application/json")
36 @POST("/api/mobile/v2/{appUuid}/context/") 34 @POST("/api/mobile/v2/{appUuid}/context/")
37 - Call<CouponsetModel> getCouponsets(@Path("appUuid") String appUuid, 35 + Call<ResponseBody> getCouponsets(@Path("appUuid") String appUuid,
38 - @Body CouponsetRequestModel request, 36 + @Body RequestBody request,
39 @Header(WarpConstants.HEADER_DATE) String timeStamp, 37 @Header(WarpConstants.HEADER_DATE) String timeStamp,
40 @Header(WarpConstants.HEADER_LOYALTY_BUNDLE_ID) String bundleId, 38 @Header(WarpConstants.HEADER_LOYALTY_BUNDLE_ID) String bundleId,
41 @Header(WarpConstants.HEADER_UNIQUE_DEVICE_ID) String deviceId, 39 @Header(WarpConstants.HEADER_UNIQUE_DEVICE_ID) String deviceId,
...@@ -43,9 +41,10 @@ public interface ApiService { ...@@ -43,9 +41,10 @@ public interface ApiService {
43 @Header(WarpConstants.HEADER_WEB_ID) String webId, 41 @Header(WarpConstants.HEADER_WEB_ID) String webId,
44 @Header(WarpConstants.HEADER_SIGNATURE) String signature); 42 @Header(WarpConstants.HEADER_SIGNATURE) String signature);
45 43
44 + @Headers("Content-Type: application/json")
46 @POST("/oauth/{appUuid}/context") 45 @POST("/oauth/{appUuid}/context")
47 - Call<CouponModel> getUserCoupons(@Path("appUuid") String appUuid, 46 + Call<ResponseBody> getUserCoupons(@Path("appUuid") String appUuid,
48 - @Body CouponRequestModel request, 47 + @Body RequestBody request,
49 @Header(WarpConstants.HEADER_DATE) String timeStamp, 48 @Header(WarpConstants.HEADER_DATE) String timeStamp,
50 @Header(WarpConstants.HEADER_LOYALTY_BUNDLE_ID) String bundleId, 49 @Header(WarpConstants.HEADER_LOYALTY_BUNDLE_ID) String bundleId,
51 @Header(WarpConstants.HEADER_UNIQUE_DEVICE_ID) String deviceId, 50 @Header(WarpConstants.HEADER_UNIQUE_DEVICE_ID) String deviceId,
...@@ -54,9 +53,10 @@ public interface ApiService { ...@@ -54,9 +53,10 @@ public interface ApiService {
54 @Header(WarpConstants.HEADER_SIGNATURE) String signature, 53 @Header(WarpConstants.HEADER_SIGNATURE) String signature,
55 @Header(WarpConstants.HEADER_AUTHORIZATION) String bearer); 54 @Header(WarpConstants.HEADER_AUTHORIZATION) String bearer);
56 55
56 + @Headers("Content-Type: application/json")
57 @POST("/api/mobile/v2/{appUuid}/context/") 57 @POST("/api/mobile/v2/{appUuid}/context/")
58 - Call<MerchantModel> getMerchants(@Path("appUuid") String appUuid, 58 + Call<ResponseBody> getMerchants(@Path("appUuid") String appUuid,
59 - @Body MerchantsRequestModel request, 59 + @Body RequestBody request,
60 @Header(WarpConstants.HEADER_DATE) String timeStamp, 60 @Header(WarpConstants.HEADER_DATE) String timeStamp,
61 @Header(WarpConstants.HEADER_LOYALTY_BUNDLE_ID) String bundleId, 61 @Header(WarpConstants.HEADER_LOYALTY_BUNDLE_ID) String bundleId,
62 @Header(WarpConstants.HEADER_UNIQUE_DEVICE_ID) String deviceId, 62 @Header(WarpConstants.HEADER_UNIQUE_DEVICE_ID) String deviceId,
......
...@@ -25,20 +25,19 @@ ...@@ -25,20 +25,19 @@
25 25
26 package ly.warp.sdk.utils.managers; 26 package ly.warp.sdk.utils.managers;
27 27
28 -import static java.lang.Boolean.FALSE;
29 -
30 import android.app.ActivityManager; 28 import android.app.ActivityManager;
31 import android.app.AlarmManager; 29 import android.app.AlarmManager;
32 import android.app.PendingIntent; 30 import android.app.PendingIntent;
33 import android.content.Context; 31 import android.content.Context;
34 import android.content.Intent; 32 import android.content.Intent;
35 -import android.os.AsyncTask;
36 import android.os.Build; 33 import android.os.Build;
37 import android.os.Handler; 34 import android.os.Handler;
38 import android.os.Looper; 35 import android.os.Looper;
39 import android.os.SystemClock; 36 import android.os.SystemClock;
40 import android.text.format.DateFormat; 37 import android.text.format.DateFormat;
38 +import android.util.ArrayMap;
41 39
40 +import androidx.annotation.NonNull;
42 import androidx.work.OneTimeWorkRequest; 41 import androidx.work.OneTimeWorkRequest;
43 import androidx.work.WorkManager; 42 import androidx.work.WorkManager;
44 43
...@@ -53,6 +52,7 @@ import java.util.ArrayList; ...@@ -53,6 +52,7 @@ import java.util.ArrayList;
53 import java.util.Collections; 52 import java.util.Collections;
54 import java.util.Date; 53 import java.util.Date;
55 import java.util.LinkedHashSet; 54 import java.util.LinkedHashSet;
55 +import java.util.Map;
56 import java.util.Set; 56 import java.util.Set;
57 import java.util.concurrent.ExecutorService; 57 import java.util.concurrent.ExecutorService;
58 import java.util.concurrent.Executors; 58 import java.util.concurrent.Executors;
...@@ -72,7 +72,6 @@ import ly.warp.sdk.io.callbacks.NewCampaignsHook; ...@@ -72,7 +72,6 @@ import ly.warp.sdk.io.callbacks.NewCampaignsHook;
72 import ly.warp.sdk.io.callbacks.PacingDetailsHook; 72 import ly.warp.sdk.io.callbacks.PacingDetailsHook;
73 import ly.warp.sdk.io.callbacks.PointsHook; 73 import ly.warp.sdk.io.callbacks.PointsHook;
74 import ly.warp.sdk.io.callbacks.ProductsHook; 74 import ly.warp.sdk.io.callbacks.ProductsHook;
75 -import ly.warp.sdk.io.callbacks.RetrofitInterface;
76 import ly.warp.sdk.io.callbacks.SharingHook; 75 import ly.warp.sdk.io.callbacks.SharingHook;
77 import ly.warp.sdk.io.callbacks.TagsCategoriesHook; 76 import ly.warp.sdk.io.callbacks.TagsCategoriesHook;
78 import ly.warp.sdk.io.callbacks.TagsHook; 77 import ly.warp.sdk.io.callbacks.TagsHook;
...@@ -85,19 +84,12 @@ import ly.warp.sdk.io.models.Consumer; ...@@ -85,19 +84,12 @@ import ly.warp.sdk.io.models.Consumer;
85 import ly.warp.sdk.io.models.ContentList; 84 import ly.warp.sdk.io.models.ContentList;
86 import ly.warp.sdk.io.models.Coupon; 85 import ly.warp.sdk.io.models.Coupon;
87 import ly.warp.sdk.io.models.CouponList; 86 import ly.warp.sdk.io.models.CouponList;
88 -import ly.warp.sdk.io.models.CouponModel;
89 -import ly.warp.sdk.io.models.CouponRequestModel;
90 import ly.warp.sdk.io.models.Couponset; 87 import ly.warp.sdk.io.models.Couponset;
91 -import ly.warp.sdk.io.models.CouponsetModel;
92 -import ly.warp.sdk.io.models.CouponsetRequestModel;
93 import ly.warp.sdk.io.models.CouponsetsList; 88 import ly.warp.sdk.io.models.CouponsetsList;
94 -import ly.warp.sdk.io.models.LoyaltyContextualOfferModel;
95 import ly.warp.sdk.io.models.LoyaltySDKDynatraceEventModel; 89 import ly.warp.sdk.io.models.LoyaltySDKDynatraceEventModel;
96 import ly.warp.sdk.io.models.Merchant; 90 import ly.warp.sdk.io.models.Merchant;
97 import ly.warp.sdk.io.models.MerchantCategoriesList; 91 import ly.warp.sdk.io.models.MerchantCategoriesList;
98 import ly.warp.sdk.io.models.MerchantList; 92 import ly.warp.sdk.io.models.MerchantList;
99 -import ly.warp.sdk.io.models.MerchantModel;
100 -import ly.warp.sdk.io.models.MerchantsRequestModel;
101 import ly.warp.sdk.io.models.PacingDetails; 93 import ly.warp.sdk.io.models.PacingDetails;
102 import ly.warp.sdk.io.models.PointsList; 94 import ly.warp.sdk.io.models.PointsList;
103 import ly.warp.sdk.io.models.ProductList; 95 import ly.warp.sdk.io.models.ProductList;
...@@ -162,6 +154,9 @@ import ly.warp.sdk.utils.WarplyDeviceInfoCollector; ...@@ -162,6 +154,9 @@ import ly.warp.sdk.utils.WarplyDeviceInfoCollector;
162 import ly.warp.sdk.utils.WarplyManagerHelper; 154 import ly.warp.sdk.utils.WarplyManagerHelper;
163 import ly.warp.sdk.utils.WarplyProperty; 155 import ly.warp.sdk.utils.WarplyProperty;
164 import ly.warp.sdk.utils.constants.WarpConstants; 156 import ly.warp.sdk.utils.constants.WarpConstants;
157 +import okhttp3.MediaType;
158 +import okhttp3.RequestBody;
159 +import okhttp3.ResponseBody;
165 import retrofit2.Call; 160 import retrofit2.Call;
166 import retrofit2.Callback; 161 import retrofit2.Callback;
167 import retrofit2.Response; 162 import retrofit2.Response;
...@@ -1574,557 +1569,6 @@ public class WarplyManager { ...@@ -1574,557 +1569,6 @@ public class WarplyManager {
1574 } 1569 }
1575 WarplyManagerHelper.setCarouselList(campaignCarouselList); 1570 WarplyManagerHelper.setCarouselList(campaignCarouselList);
1576 1571
1577 -// ArrayList<LoyaltyContextualOfferModel> list = new ArrayList<>();
1578 -// JSONArray jArray = null;
1579 -// try {
1580 -// jArray = new JSONArray("[\n" +
1581 -// " {\n" +
1582 -// " \"UACIOfferTrackingCode\": \"5166.e07.fffffffffa10663a.ffffffffda30c76a\",\n" +
1583 -// " \"businessAdditionalId\": \"\",\n" +
1584 -// " \"dataCategory\": \"Data\",\n" +
1585 -// " \"dataValue\": \"None\",\n" +
1586 -// " \"discount\": \"None\",\n" +
1587 -// " \"eligibleAssets\": [\n" +
1588 -// " \"306945218770\",\n" +
1589 -// " \"306944333488\",\n" +
1590 -// " \"306932222490\",\n" +
1591 -// " \"306996824010\",\n" +
1592 -// " \"306972713201\",\n" +
1593 -// " \"306942496252\",\n" +
1594 -// " \"306977316716\",\n" +
1595 -// " \"306945433100\",\n" +
1596 -// " \"306977403986\",\n" +
1597 -// " \"306936581495\",\n" +
1598 -// " \"306980689662\",\n" +
1599 -// " \"306970101490\",\n" +
1600 -// " \"306973396329\",\n" +
1601 -// " \"306972577064\",\n" +
1602 -// " \"306974923219\",\n" +
1603 -// " \"306977513761\",\n" +
1604 -// " \"306984220987\",\n" +
1605 -// " \"306979949205\",\n" +
1606 -// " \"306943134127\",\n" +
1607 -// " \"306970437794\",\n" +
1608 -// " \"306932535319\",\n" +
1609 -// " \"306974063133\",\n" +
1610 -// " \"306932520323\",\n" +
1611 -// " \"306978733823\",\n" +
1612 -// " \"306985995420\",\n" +
1613 -// " \"306983879555\",\n" +
1614 -// " ],\n" +
1615 -// " \"id\": \"000003590\",\n" +
1616 -// " \"loyaltyCampaignId\": \"NA\",\n" +
1617 -// " \"minsValue\": \"None\",\n" +
1618 -// " \"noOfRecurrance\": \"None\",\n" +
1619 -// " \"notificationMessage\": \"None\",\n" +
1620 -// " \"offerAudienceLevel\": \"msisdn\",\n" +
1621 -// " \"offerCode1\": \"000003590\",\n" +
1622 -// " \"offerName\": \"CCMS loyalty white label\",\n" +
1623 -// " \"price\": \"None\",\n" +
1624 -// " \"productType\": \"White Label\",\n" +
1625 -// " \"provDuration\": \"0.0\",\n" +
1626 -// " \"provStepValueMins\": \"None\",\n" +
1627 -// " \"score\": \"50\",\n" +
1628 -// " \"treatmentCode\": \"5166.e07.fffffffffa10663a.ffffffffda30c76a\",\n" +
1629 -// " \"validity\": \"0\",\n" +
1630 -// " \"voiceCategory\": \"None\",\n" +
1631 -// " \"wave\": \"1\",\n" +
1632 -// " \"zone\": \"COSMOTE_APP_LOYALTY_PROMO\"\n" +
1633 -// " },\n" +
1634 -// " {\n" +
1635 -// " \"UACIOfferTrackingCode\": \"546d.ea1.ffffffffcc4c34b3.c64ed53\",\n" +
1636 -// " \"businessAdditionalId\": \"\",\n" +
1637 -// " \"dataCategory\": \"Data\",\n" +
1638 -// " \"dataValue\": \"1\",\n" +
1639 -// " \"description\": \"5days1000 3744\",\n" +
1640 -// " \"discount\": \"None\",\n" +
1641 -// " \"duration\": \"5\",\n" +
1642 -// " \"eligibleAssets\": [],\n" +
1643 -// " \"giftType\": \"GB\",\n" +
1644 -// " \"giftValue\": \"1\",\n" +
1645 -// " \"id\": \"000003744\",\n" +
1646 -// " \"imageOfferUrl\": \"https://uatatg.cosmote.gr/images/ContexualOffers//testOffer/x3_detailed_default.png\",\n" +
1647 -// " \"imageUrl\": \"https://uatatg.cosmote.gr/images/ContexualOffers//testOffer/x3_store_default.png\",\n" +
1648 -// " \"loyaltyCampaignId\": \"NA\",\n" +
1649 -// " \"minsValue\": \"None\",\n" +
1650 -// " \"noOfRecurrance\": \"5\",\n" +
1651 -// " \"notificationMessage\": \"5days1000 3744\",\n" +
1652 -// " \"offerAudienceLevel\": \"guid\",\n" +
1653 -// " \"offerCode1\": \"000003744\",\n" +
1654 -// " \"offerName\": \"White_Label_5days1000 3744\",\n" +
1655 -// " \"price\": \"0\",\n" +
1656 -// " \"productType\": \"White Label\",\n" +
1657 -// " \"provDuration\": \"1.0\",\n" +
1658 -// " \"score\": \"50\",\n" +
1659 -// " \"sessionId\": \"COSMOTE_APP_BALANCES.6945251078.20220908115231\",\n" +
1660 -// " \"treatmentCode\": \"546d.ea1.ffffffffcc4c34b3.c64ed53\",\n" +
1661 -// " \"validity\": \"0\",\n" +
1662 -// " \"wave\": \"1\",\n" +
1663 -// " \"voiceCategory\": \"None\",\n" +
1664 -// " \"validity\": \"5\",\n" +
1665 -// " \"imageUrl\": \"https://www.cosmotetvott.gr/assets/images/ogImage.jpg\",\n" +
1666 -// " \"title\": \"White_Label_5days1000 3744\",\n" +
1667 -// " \"titleOffer\": \"5days1000 3744\",\n" +
1668 -// " \"termsAndConditions\": \"5days1000 3744\",\n" +
1669 -// " \"subtitle\": \"5days1000 3744\",\n" +
1670 -// " \"description\": \"Test6\",\n" +
1671 -// " \"zone\": \"COSMOTE_APP_GIFTS4U\"\n" +
1672 -// " },\n" +
1673 -// " {\n" +
1674 -// " \"UACIOfferTrackingCode\": \"51ed.e10.2c006f18.71e96d08\",\n" +
1675 -// " \"businessAdditionalId\": \"\",\n" +
1676 -// " \"dataCategory\": \"Data\",\n" +
1677 -// " \"dataValue\": \"233\",\n" +
1678 -// " \"discount\": \"None\",\n" +
1679 -// " \"eligibleAssets\": [\n" +
1680 -// " \"306945218770\",\n" +
1681 -// " \"306944333488\",\n" +
1682 -// " \"306932222490\",\n" +
1683 -// " \"306996824010\",\n" +
1684 -// " \"306972713201\",\n" +
1685 -// " \"306942496252\",\n" +
1686 -// " \"306977316716\",\n" +
1687 -// " \"306945433100\",\n" +
1688 -// " \"306977403986\",\n" +
1689 -// " \"306936581495\",\n" +
1690 -// " \"306980689662\",\n" +
1691 -// " \"306970101490\",\n" +
1692 -// " \"306973396329\",\n" +
1693 -// " \"306972577064\",\n" +
1694 -// " \"306974923219\",\n" +
1695 -// " \"306977513761\",\n" +
1696 -// " \"306984220987\",\n" +
1697 -// " \"306979949205\",\n" +
1698 -// " \"306943134127\",\n" +
1699 -// " \"306970437794\",\n" +
1700 -// " \"306932535319\",\n" +
1701 -// " \"306974063133\",\n" +
1702 -// " \"306932520323\",\n" +
1703 -// " \"306978733823\",\n" +
1704 -// " \"306985995420\",\n" +
1705 -// " \"306983879555\",\n" +
1706 -// " ],\n" +
1707 -// " \"id\": \"000003599\",\n" +
1708 -// " \"loyaltyCampaignId\": \"9a92d445956145f6bbc5cd20cef543b9\",\n" + //c5cc5f4f65624f47a580b720233fa60d
1709 -// " \"minsValue\": \"None\",\n" +
1710 -// " \"noOfRecurrance\": \"None\",\n" +
1711 -// " \"notificationMessage\": \"None\",\n" +
1712 -// " \"offerAudienceLevel\": \"msisdn\",\n" +
1713 -// " \"offerCode1\": \"000003599\",\n" +
1714 -// " \"offerName\": \"CCMS loyalty white label with campaignId\",\n" +
1715 -// " \"price\": \"None\",\n" +
1716 -// " \"productType\": \"White Label\",\n" +
1717 -// " \"provDuration\": \"0.0\",\n" +
1718 -// " \"provStepValueMins\": \"None\",\n" +
1719 -// " \"score\": \"50\",\n" +
1720 -// " \"treatmentCode\": \"51ed.e10.2c006f18.71e96d08\",\n" +
1721 -// " \"validity\": \"0\",\n" +
1722 -// " \"voiceCategory\": \"None\",\n" +
1723 -// " \"wave\": \"1\",\n" +
1724 -// " \"imageUrl\": \"https://www.cosmotetvott.gr/assets/images/ogImage.jpg\",\n" +
1725 -// " \"title\": \"Title External\",\n" +
1726 -// " \"subtitle\": \"Subtitle MFY second\",\n" +
1727 -// " \"description\": \"Description Internal\",\n" +
1728 -// " \"message\": \"Message MFY third\",\n" +
1729 -// " \"titleOffer\": \"Title Internal\",\n" +
1730 -// " \"imageOfferUrl\": \"https://www.cosmotetvott.gr/assets/images/ogImage.jpg\",\n" +
1731 -// " \"duration\": \"gia 7 imeres\",\n" +
1732 -// " \"giftType\": \"Internet\",\n" +
1733 -// " \"giftValue\": \"1 GB\",\n" +
1734 -// " \"termsAndConditions\": \"Terms and Conditions Lorem Ipsum Dolores sit amen\",\n" +
1735 -// " \"zone\": \"COSMOTE_APP_LOYALTY_PROMO\"\n" +
1736 -// " },\n" +
1737 -// " {\n" +
1738 -// " \"UACIOfferTrackingCode\": \"516c.e05.ffffffffa943695b.79ff470b\",\n" +
1739 -// " \"businessAdditionalId\": \"\",\n" +
1740 -// " \"businessService\": \"0.0\",\n" +
1741 -// " \"eligibleAssets\": [\n" +
1742 -// " \"306945218770\",\n" +
1743 -// " \"306944333488\",\n" +
1744 -// " \"306932222490\",\n" +
1745 -// " \"306996824010\",\n" +
1746 -// " \"306972713201\",\n" +
1747 -// " \"306942496252\",\n" +
1748 -// " \"306977316716\",\n" +
1749 -// " \"306945433100\",\n" +
1750 -// " \"306977403986\",\n" +
1751 -// " \"306936581495\",\n" +
1752 -// " \"306980689662\",\n" +
1753 -// " \"306970101490\",\n" +
1754 -// " \"306973396329\",\n" +
1755 -// " \"306972577064\",\n" +
1756 -// " \"306974923219\",\n" +
1757 -// " \"306977513761\",\n" +
1758 -// " \"306984220987\",\n" +
1759 -// " \"306979949205\",\n" +
1760 -// " \"306943134127\",\n" +
1761 -// " \"306970437794\",\n" +
1762 -// " \"306932535319\",\n" +
1763 -// " \"306974063133\",\n" +
1764 -// " \"306932520323\",\n" +
1765 -// " \"306978733823\",\n" +
1766 -// " \"306985995420\",\n" +
1767 -// " \"306983879555\",\n" +
1768 -// " ],\n" +
1769 -// " \"id\": \"000003588\",\n" +
1770 -// " \"loyaltyCampaignId\": \"NA\",\n" +
1771 -// " \"noOfRecurrance\": \"0\",\n" +
1772 -// " \"notificationMessage\": \"None\",\n" +
1773 -// " \"offerAudienceLevel\": \"msisdn\",\n" +
1774 -// " \"offerCode1\": \"000003588\",\n" +
1775 -// " \"offerName\": \"CCMS loyalty postpay addon\",\n" +
1776 -// " \"postpayProduct\": \"0.0\",\n" +
1777 -// " \"price\": \"None\",\n" +
1778 -// " \"productType\": \"MOBILE ADDON\",\n" +
1779 -// " \"provDuration\": \"0.0\",\n" +
1780 -// " \"score\": \"50\",\n" +
1781 -// " \"treatmentCode\": \"516c.e05.ffffffffa943695b.79ff470b\",\n" +
1782 -// " \"validity\": \"0\",\n" +
1783 -// " \"wave\": \"1\",\n" +
1784 -// " \"imageUrl\": \"https://www.cosmotetvott.gr/assets/images/ogImage.jpg\",\n" +
1785 -// " \"title\": \"Test2\",\n" +
1786 -// " \"subtitle\": \"Test2\",\n" +
1787 -// " \"description\": \"Test2\",\n" +
1788 -// " \"zone\": \"COSMOTE_APP_LOYALTY_PROMO\"\n" +
1789 -// " },\n" +
1790 -// " {\n" +
1791 -// " \"UACIOfferTrackingCode\": \"5224.e19.30e2f27b.ffffffffeb22b0db\",\n" +
1792 -// " \"businessAdditionalId\": \"\",\n" +
1793 -// " \"dataCategory\": \"Data\",\n" +
1794 -// " \"dataValue\": \"None\",\n" +
1795 -// " \"discount\": \"None\",\n" +
1796 -// " \"eligibleAssets\": [\n" +
1797 -// " \"306945218770\",\n" +
1798 -// " \"306944333488\",\n" +
1799 -// " \"306932222490\",\n" +
1800 -// " \"306996824010\",\n" +
1801 -// " \"306972713201\",\n" +
1802 -// " \"306942496252\",\n" +
1803 -// " \"306977316716\",\n" +
1804 -// " \"306945433100\",\n" +
1805 -// " \"306977403986\",\n" +
1806 -// " \"306936581495\",\n" +
1807 -// " \"306980689662\",\n" +
1808 -// " \"306970101490\",\n" +
1809 -// " \"306973396329\",\n" +
1810 -// " \"306972577064\",\n" +
1811 -// " \"306974923219\",\n" +
1812 -// " \"306977513761\",\n" +
1813 -// " \"306984220987\",\n" +
1814 -// " \"306979949205\",\n" +
1815 -// " \"306943134127\",\n" +
1816 -// " \"306970437794\",\n" +
1817 -// " \"306932535319\",\n" +
1818 -// " \"306974063133\",\n" +
1819 -// " \"306932520323\",\n" +
1820 -// " \"306978733823\",\n" +
1821 -// " \"306985995420\",\n" +
1822 -// " \"306983879555\",\n" +
1823 -// " ],\n" +
1824 -// " \"id\": \"000003608\",\n" +
1825 -// " \"loyaltyCampaignId\": \"c134cdeb8a924f8eac38e261acb9caf5\",\n" +
1826 -// " \"minsValue\": \"None\",\n" +
1827 -// " \"noOfRecurrance\": \"None\",\n" +
1828 -// " \"notificationMessage\": \"None\",\n" +
1829 -// " \"offerAudienceLevel\": \"msisdn\",\n" +
1830 -// " \"offerCode1\": \"000003608\",\n" +
1831 -// " \"offerName\": \"CCMS loyalty gifts4u v1\",\n" +
1832 -// " \"price\": \"None\",\n" +
1833 -// " \"productType\": \"White Label\",\n" +
1834 -// " \"provDuration\": \"0.0\",\n" +
1835 -// " \"provStepValueMins\": \"None\",\n" +
1836 -// " \"score\": \"50\",\n" +
1837 -// " \"treatmentCode\": \"5224.e19.30e2f27b.ffffffffeb22b0db\",\n" +
1838 -// " \"validity\": \"0\",\n" +
1839 -// " \"voiceCategory\": \"None\",\n" +
1840 -// " \"wave\": \"1\",\n" +
1841 -// " \"imageUrl\": \"https://www.cosmotetvott.gr/assets/images/ogImage.jpg\",\n" +
1842 -// " \"title\": \"Test3\",\n" +
1843 -// " \"subtitle\": \"Test3\",\n" +
1844 -// " \"description\": \"Test3\",\n" +
1845 -// " \"zone\": \"COSMOTE_APP_GIFTS4U\"\n" +
1846 -// " },\n" +
1847 -// " {\n" +
1848 -// " \"UACIOfferTrackingCode\": \"5228.e1d.38378e61.750186c1\",\n" +
1849 -// " \"businessAdditionalId\": \"\",\n" +
1850 -// " \"businessService\": \"0.0\",\n" +
1851 -// " \"eligibleAssets\": [\n" +
1852 -// " \"306945218770\",\n" +
1853 -// " \"306944333488\",\n" +
1854 -// " \"306932222490\",\n" +
1855 -// " \"306996824010\",\n" +
1856 -// " \"306972713201\",\n" +
1857 -// " \"306942496252\",\n" +
1858 -// " \"306977316716\",\n" +
1859 -// " \"306945433100\",\n" +
1860 -// " \"306977403986\",\n" +
1861 -// " \"306936581495\",\n" +
1862 -// " \"306980689662\",\n" +
1863 -// " \"306970101490\",\n" +
1864 -// " \"306973396329\",\n" +
1865 -// " \"306972577064\",\n" +
1866 -// " \"306974923219\",\n" +
1867 -// " \"306977513761\",\n" +
1868 -// " \"306984220987\",\n" +
1869 -// " \"306979949205\",\n" +
1870 -// " \"306943134127\",\n" +
1871 -// " \"306970437794\",\n" +
1872 -// " \"306932535319\",\n" +
1873 -// " \"306974063133\",\n" +
1874 -// " \"306932520323\",\n" +
1875 -// " \"306978733823\",\n" +
1876 -// " \"306985995420\",\n" +
1877 -// " \"306983879555\",\n" +
1878 -// " ],\n" +
1879 -// " \"id\": \"000003612\",\n" +
1880 -// " \"loyaltyCampaignId\": \"8eb71c4ceaff409c896e2d1f6f1c20f3\",\n" +
1881 -// " \"noOfRecurrance\": \"0\",\n" +
1882 -// " \"notificationMessage\": \"None\",\n" +
1883 -// " \"offerAudienceLevel\": \"msisdn\",\n" +
1884 -// " \"offerCode1\": \"000003612\",\n" +
1885 -// " \"offerName\": \"CCMS loyalty - postpay addon gifts4u\",\n" +
1886 -// " \"postpayProduct\": \"0.0\",\n" +
1887 -// " \"price\": \"None\",\n" +
1888 -// " \"productType\": \"MOBILE ADDON\",\n" +
1889 -// " \"provDuration\": \"0.0\",\n" +
1890 -// " \"score\": \"50\",\n" +
1891 -// " \"treatmentCode\": \"5228.e1d.38378e61.750186c1\",\n" +
1892 -// " \"validity\": \"0\",\n" +
1893 -// " \"wave\": \"1\",\n" +
1894 -// " \"imageUrl\": \"https://www.cosmotetvott.gr/assets/images/ogImage.jpg\",\n" +
1895 -// " \"title\": \"Test4\",\n" +
1896 -// " \"subtitle\": \"Test4\",\n" +
1897 -// " \"description\": \"Test4\",\n" +
1898 -// " \"zone\": \"COSMOTE_APP_GIFTS4U\"\n" +
1899 -// " },\n" +
1900 -// " {\n" +
1901 -// " \"UACIOfferTrackingCode\": \"5222.e1b.ffffffffe725d1b3.ffffffffed6d8723\",\n" +
1902 -// " \"businessAdditionalId\": \"\",\n" +
1903 -// " \"dataCategory\": \"Data\",\n" +
1904 -// " \"dataValue\": \"None\",\n" +
1905 -// " \"discount\": \"None\",\n" +
1906 -// " \"eligibleAssets\": [\n" +
1907 -// " \"306945218770\",\n" +
1908 -// " \"306944333488\",\n" +
1909 -// " \"306932222490\",\n" +
1910 -// " \"306996824010\",\n" +
1911 -// " \"306972713201\",\n" +
1912 -// " \"306942496252\",\n" +
1913 -// " \"306977316716\",\n" +
1914 -// " \"306945433100\",\n" +
1915 -// " \"306977403986\",\n" +
1916 -// " \"306936581495\",\n" +
1917 -// " \"306980689662\",\n" +
1918 -// " \"306970101490\",\n" +
1919 -// " \"306973396329\",\n" +
1920 -// " \"306972577064\",\n" +
1921 -// " \"306974923219\",\n" +
1922 -// " \"306977513761\",\n" +
1923 -// " \"306984220987\",\n" +
1924 -// " \"306979949205\",\n" +
1925 -// " \"306943134127\",\n" +
1926 -// " \"306970437794\",\n" +
1927 -// " \"306932535319\",\n" +
1928 -// " \"306974063133\",\n" +
1929 -// " \"306932520323\",\n" +
1930 -// " \"306978733823\",\n" +
1931 -// " \"306985995420\",\n" +
1932 -// " \"306983879555\",\n" +
1933 -// " ],\n" +
1934 -// " \"id\": \"000003610\",\n" +
1935 -// " \"loyaltyCampaignId\": \"8e2c88ec94c948d8b51577324ed9a4d5\",\n" +
1936 -// " \"minsValue\": \"None\",\n" +
1937 -// " \"noOfRecurrance\": \"None\",\n" +
1938 -// " \"notificationMessage\": \"None\",\n" +
1939 -// " \"offerAudienceLevel\": \"msisdn\",\n" +
1940 -// " \"offerCode1\": \"000003610\",\n" +
1941 -// " \"offerName\": \"CCMS loyalty more4u v1\",\n" +
1942 -// " \"price\": \"20\",\n" +
1943 -// " \"productType\": \"White Label\",\n" +
1944 -// " \"provDuration\": \"7.0\",\n" +
1945 -// " \"provStepValueMins\": \"None\",\n" +
1946 -// " \"score\": \"60\",\n" +
1947 -// " \"treatmentCode\": \"5222.e1b.ffffffffe725d1b3.ffffffffed6d8723\",\n" +
1948 -// " \"validity\": \"0\",\n" +
1949 -// " \"voiceCategory\": \"None\",\n" +
1950 -// " \"wave\": \"1\",\n" +
1951 -// " \"imageUrl\": \"https://www.cosmotetvott.gr/assets/images/ogImage.jpg\",\n" +
1952 -// " \"title\": \"Test5\",\n" +
1953 -// " \"subtitle\": \"Test5\",\n" +
1954 -// " \"description\": \"Test5\",\n" +
1955 -// " \"zone\": \"COSMOTE_APP_MORE4U\"\n" +
1956 -// " },\n" +
1957 -// " {\n" +
1958 -// " \"UACIOfferTrackingCode\": \"5226.e1f.728b68c6.ffffffffa6c7b10e\",\n" +
1959 -// " \"businessAdditionalId\": \"\",\n" +
1960 -// " \"businessService\": \"0.0\",\n" +
1961 -// " \"eligibleAssets\": [\n" +
1962 -// " \"306945218770\",\n" +
1963 -// " \"306944333488\",\n" +
1964 -// " \"306932222490\",\n" +
1965 -// " \"306996824010\",\n" +
1966 -// " \"306972713201\",\n" +
1967 -// " \"306942496252\",\n" +
1968 -// " \"306977316716\",\n" +
1969 -// " \"306945433100\",\n" +
1970 -// " \"306977403986\",\n" +
1971 -// " \"306936581495\",\n" +
1972 -// " \"306980689662\",\n" +
1973 -// " \"306970101490\",\n" +
1974 -// " \"306973396329\",\n" +
1975 -// " \"306972577064\",\n" +
1976 -// " \"306974923219\",\n" +
1977 -// " \"306977513761\",\n" +
1978 -// " \"306984220987\",\n" +
1979 -// " \"306979949205\",\n" +
1980 -// " \"306943134127\",\n" +
1981 -// " \"306970437794\",\n" +
1982 -// " \"306932535319\",\n" +
1983 -// " \"306974063133\",\n" +
1984 -// " \"306932520323\",\n" +
1985 -// " \"306978733823\",\n" +
1986 -// " \"306985995420\",\n" +
1987 -// " \"306983879555\",\n" +
1988 -// " ],\n" +
1989 -// " \"id\": \"000003614\",\n" +
1990 -// " \"loyaltyCampaignId\": \"aaf4022194584f02bb84c7b283c7c51e\",\n" +
1991 -// " \"noOfRecurrance\": \"0\",\n" +
1992 -// " \"notificationMessage\": \"None\",\n" +
1993 -// " \"offerAudienceLevel\": \"msisdn\",\n" +
1994 -// " \"offerCode1\": \"000003614\",\n" +
1995 -// " \"offerName\": \"CCMS loyalty - postpay addon more4u\",\n" +
1996 -// " \"postpayProduct\": \"0.0\",\n" +
1997 -// " \"price\": \"None\",\n" +
1998 -// " \"productType\": \"MOBILE ADDON\",\n" +
1999 -// " \"provDuration\": \"0.0\",\n" +
2000 -// " \"score\": \"50\",\n" +
2001 -// " \"treatmentCode\": \"5226.e1f.728b68c6.ffffffffa6c7b10e\",\n" +
2002 -// " \"validity\": \"0\",\n" +
2003 -// " \"wave\": \"1\",\n" +
2004 -// " \"imageUrl\": \"https://www.cosmotetvott.gr/assets/images/ogImage.jpg\",\n" +
2005 -// " \"title\": \"Test6\",\n" +
2006 -// " \"subtitle\": \"Test6\",\n" +
2007 -// " \"description\": \"Test6\",\n" +
2008 -// " \"zone\": \"COSMOTE_APP_MORE4U\"\n" +
2009 -// " },\n" +
2010 -// " {\n" +
2011 -// " \"UACIOfferTrackingCode\": \"5154.e03.ffffffffeebc476a.ffffffffc5b96f6a\",\n" +
2012 -// " \"businessAdditionalId\": \"\",\n" +
2013 -// " \"eligibleAssets\": [],\n" +
2014 -// " \"id\": \"000003586\",\n" +
2015 -// " \"loyaltyCampaignId\": \"NA\",\n" +
2016 -// " \"offerAudienceLevel\": \"guid\",\n" +
2017 -// " \"offerCode1\": \"000003586\",\n" +
2018 -// " \"offerName\": \"CCMS loyalty offer 6\",\n" +
2019 -// " \"productType\": \"GENERIC\",\n" +
2020 -// " \"score\": \"50\",\n" +
2021 -// " \"treatmentCode\": \"5154.e03.ffffffffeebc476a.ffffffffc5b96f6a\",\n" +
2022 -// " \"validity\": \"0\",\n" +
2023 -// " \"zone\": \"COSMOTE_APP_LOYALTY_PROMO\"\n" +
2024 -// " },\n" +
2025 -// " {\n" +
2026 -// " \"UACIOfferTrackingCode\": \"51d2.e0c.291f49d9.40d5a689\",\n" +
2027 -// " \"businessAdditionalId\": \"\",\n" +
2028 -// " \"eligibleAssets\": [],\n" +
2029 -// " \"id\": \"000003595\",\n" +
2030 -// " \"loyaltyCampaignId\": \"c5cc5f4f65624f47a580b720233fa60d\",\n" +
2031 -// " \"offerAudienceLevel\": \"guid\",\n" +
2032 -// " \"offerCode1\": \"000003595\",\n" +
2033 -// " \"offerName\": \"CCMS Loyal offer campaignId\",\n" +
2034 -// " \"productType\": \"GENERIC\",\n" +
2035 -// " \"score\": \"50\",\n" +
2036 -// " \"treatmentCode\": \"51d2.e0c.291f49d9.40d5a689\",\n" +
2037 -// " \"validity\": \"0\",\n" +
2038 -// " \"imageUrl\": \"https://www.cosmotetvott.gr/assets/images/ogImage.jpg\",\n" +
2039 -// " \"title\": \"Test7\",\n" +
2040 -// " \"subtitle\": \"Test7\",\n" +
2041 -// " \"description\": \"Test7\",\n" +
2042 -// " \"zone\": \"COSMOTE_APP_LOYALTY_PROMO\"\n" +
2043 -// " },\n" +
2044 -// " {\n" +
2045 -// " \"UACIOfferTrackingCode\": \"51d6.e0c.291f49d9.40d5a689\",\n" +
2046 -// " \"businessAdditionalId\": \"\",\n" +
2047 -// " \"eligibleAssets\": [],\n" +
2048 -// " \"id\": \"000003595\",\n" +
2049 -// " \"loyaltyCampaignId\": \"c5cc5f4f65624f47a580b720233fa60d\",\n" +
2050 -// " \"offerAudienceLevel\": \"guid\",\n" +
2051 -// " \"offerCode1\": \"000003595\",\n" +
2052 -// " \"offerName\": \"CCMS Loyal offer campaignId\",\n" +
2053 -// " \"productType\": \"GENERIC\",\n" +
2054 -// " \"score\": \"50\",\n" +
2055 -// " \"treatmentCode\": \"51d6.e0c.291f49d9.40d5a689\",\n" +
2056 -// " \"validity\": \"0\",\n" +
2057 -// " \"imageUrl\": \"https://www.cosmotetvott.gr/assets/images/ogImage.jpg\",\n" +
2058 -// " \"title\": \"Test8\",\n" +
2059 -// " \"subtitle\": \"Test8\",\n" +
2060 -// " \"description\": \"Test8\",\n" +
2061 -// " \"zone\": \"COSMOTE_APP_GIFTS4U\"\n" +
2062 -// " },\n" +
2063 -// " {\n" +
2064 -// " \"UACIOfferTrackingCode\": \"5150.e03.ffffffffeebc476a.ffffffffc5b96f6a\",\n" +
2065 -// " \"businessAdditionalId\": \"\",\n" +
2066 -// " \"eligibleAssets\": [],\n" +
2067 -// " \"id\": \"000003586\",\n" +
2068 -// " \"loyaltyCampaignId\": \"NA\",\n" +
2069 -// " \"offerAudienceLevel\": \"guid\",\n" +
2070 -// " \"offerCode1\": \"000003586\",\n" +
2071 -// " \"offerName\": \"CCMS loyalty offer 6\",\n" +
2072 -// " \"productType\": \"GENERIC\",\n" +
2073 -// " \"score\": \"50\",\n" +
2074 -// " \"treatmentCode\": \"5150.e03.ffffffffeebc476a.ffffffffc5b96f6a\",\n" +
2075 -// " \"validity\": \"0\",\n" +
2076 -// " \"zone\": \"COSMOTE_APP_GIFTS4U\"\n" +
2077 -// " },\n" +
2078 -// " {\n" +
2079 -// " \"UACIOfferTrackingCode\": \"5152.e03.ffffffffeebc476a.ffffffffc5b96f6a\",\n" +
2080 -// " \"businessAdditionalId\": \"\",\n" +
2081 -// " \"eligibleAssets\": [],\n" +
2082 -// " \"id\": \"000003586\",\n" +
2083 -// " \"loyaltyCampaignId\": \"NA\",\n" +
2084 -// " \"offerAudienceLevel\": \"guid\",\n" +
2085 -// " \"offerCode1\": \"000003586\",\n" +
2086 -// " \"offerName\": \"CCMS loyalty offer 6\",\n" +
2087 -// " \"productType\": \"GENERIC\",\n" +
2088 -// " \"score\": \"50\",\n" +
2089 -// " \"treatmentCode\": \"5152.e03.ffffffffeebc476a.ffffffffc5b96f6a\",\n" +
2090 -// " \"validity\": \"0\",\n" +
2091 -// " \"zone\": \"COSMOTE_APP_MORE4U\"\n" +
2092 -// " },\n" +
2093 -// " {\n" +
2094 -// " \"UACIOfferTrackingCode\": \"51d4.e0c.291f49d9.40d5a689\",\n" +
2095 -// " \"businessAdditionalId\": \"\",\n" +
2096 -// " \"eligibleAssets\": [],\n" +
2097 -// " \"id\": \"000003595\",\n" +
2098 -// " \"loyaltyCampaignId\": \"c5cc5f4f65624f47a580b720233fa60d\",\n" +
2099 -// " \"offerAudienceLevel\": \"guid\",\n" +
2100 -// " \"offerCode1\": \"000003595\",\n" +
2101 -// " \"offerName\": \"CCMS Loyal offer campaignId\",\n" +
2102 -// " \"productType\": \"GENERIC\",\n" +
2103 -// " \"score\": \"50\",\n" +
2104 -// " \"treatmentCode\": \"51d4.e0c.291f49d9.40d5a689\",\n" +
2105 -// " \"validity\": \"0\",\n" +
2106 -// " \"imageUrl\": \"https://www.cosmotetvott.gr/assets/images/ogImage.jpg\",\n" +
2107 -// " \"title\": \"Test9\",\n" +
2108 -// " \"subtitle\": \"Test9\",\n" +
2109 -// " \"description\": \"Test9\",\n" +
2110 -// " \"zone\": \"COSMOTE_APP_MORE4U\"\n" +
2111 -// " }\n" +
2112 -// " ]");
2113 -// } catch (JSONException e) {
2114 -// e.printStackTrace();
2115 -// }
2116 -// if (jArray != null && jArray.length() > 0) {
2117 -// for (int i = 0; i < jArray.length(); i++) {
2118 -// JSONObject jobj = new JSONObject();
2119 -// jobj = jArray.optJSONObject(i);
2120 -// if (jobj != null) {
2121 -// LoyaltyContextualOfferModel model = new LoyaltyContextualOfferModel(jobj);
2122 -// list.add(model);
2123 -// }
2124 -// }
2125 -// }
2126 -// WarplyManagerHelper.setCCMSLoyaltyCampaigns(list);
2127 -
2128 Set<Campaign> set = new LinkedHashSet<>(campaignLoyaltyList); 1572 Set<Campaign> set = new LinkedHashSet<>(campaignLoyaltyList);
2129 campaignLoyaltyList.clear(); 1573 campaignLoyaltyList.clear();
2130 campaignLoyaltyList.addAll(set); 1574 campaignLoyaltyList.addAll(set);
...@@ -2555,79 +1999,120 @@ public class WarplyManager { ...@@ -2555,79 +1999,120 @@ public class WarplyManager {
2555 WarpUtils.log("[WARP Trace] WARPLY User Coupons Request is active"); 1999 WarpUtils.log("[WARP Trace] WARPLY User Coupons Request is active");
2556 WarpUtils.log("**************************************************"); 2000 WarpUtils.log("**************************************************");
2557 2001
2558 - getMerchantsRetro(new Callback<MerchantModel>() { 2002 + ApiService service = ApiClient.getRetrofitInstance().create(ApiService.class);
2003 +
2004 + getMerchantsRetro(service, new Callback<ResponseBody>() {
2559 @Override 2005 @Override
2560 - public void onResponse(Call<MerchantModel> call, Response<MerchantModel> response) { 2006 + public void onResponse(@NonNull Call<ResponseBody> call, @NonNull Response<ResponseBody> responseMerchants) {
2561 - if (response.code() == 200) { 2007 + if (responseMerchants.code() == 200 && responseMerchants.body() != null) {
2562 - if (response.body() != null && response.body().getStatus().equals("1")) { 2008 + JSONObject jobjMerchantsResponse = null;
2009 + try {
2010 + jobjMerchantsResponse = new JSONObject(responseMerchants.body().string());
2011 + } catch (Exception e) {
2012 + e.printStackTrace();
2013 + }
2014 +
2015 + if (jobjMerchantsResponse != null && jobjMerchantsResponse.has("status") && jobjMerchantsResponse.optString("status", "2").equals("1")) {
2016 + LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
2017 + dynatraceEvent.setEventName("custom_success_shops_loyalty");
2018 + EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent));
2019 +
2020 + JSONArray jMerchantsBody = null;
2021 + try {
2022 + jMerchantsBody = jobjMerchantsResponse.optJSONObject("context").optJSONObject("MAPP_SHOPS").optJSONArray("result");
2023 + } catch (Exception e) {
2024 + e.printStackTrace();
2025 + }
2026 +
2027 + if (jMerchantsBody != null) {
2563 MerchantList mMerchantList = new MerchantList(); 2028 MerchantList mMerchantList = new MerchantList();
2564 - final ExecutorService executorShops = Executors.newFixedThreadPool(2); 2029 +
2030 + final ExecutorService executorShops = Executors.newFixedThreadPool(1);
2031 + JSONArray finalMerchantsJBody = jMerchantsBody;
2565 executorShops.submit(() -> { 2032 executorShops.submit(() -> {
2566 - for (MerchantModel.MerchantResult shop : response.body().getContext().getMappShops().getResult()) { 2033 + for (int i = 0; i < finalMerchantsJBody.length(); ++i) {
2567 - Merchant merchant = new Merchant(); 2034 + mMerchantList.add(new Merchant(finalMerchantsJBody.optJSONObject(i)));
2568 - merchant.setAddress(shop.getAddress());
2569 - merchant.setName(shop.getName());
2570 - merchant.setWebsite(shop.getWebsite());
2571 - merchant.setTelephone(shop.getTelephone());
2572 - merchant.setLatitude(shop.getLatitude());
2573 - merchant.setLongitude(shop.getLongitude());
2574 - merchant.setUuid(shop.getUuid());
2575 - merchant.setImg_preview(shop.getImgPreview());
2576 - merchant.setAdmin_name(shop.getAdminName());
2577 - mMerchantList.add(merchant);
2578 } 2035 }
2579 WarplyManagerHelper.setMerchantList(mMerchantList); 2036 WarplyManagerHelper.setMerchantList(mMerchantList);
2580 - });
2581 executorShops.shutdownNow(); 2037 executorShops.shutdownNow();
2038 + });
2582 2039
2583 - getCouponsetsRetro(new Callback<CouponsetModel>() { 2040 + getCouponsetsRetro(service, new Callback<ResponseBody>() {
2584 - @Override
2585 - public void onResponse(Call<CouponsetModel> call, Response<CouponsetModel> response) {
2586 - if (response.code() == 200) {
2587 - if (response.body() != null && response.body().getStatus().equals("1")) {
2588 - getUserCouponsRetro(new Callback<CouponModel>() {
2589 @Override 2041 @Override
2590 - public void onResponse(Call<CouponModel> call, Response<CouponModel> responseCoupons) { 2042 + public void onResponse(@NonNull Call<ResponseBody> call, @NonNull Response<ResponseBody> responseCouponsets) {
2591 - if (responseCoupons.code() == 200) { 2043 + if (responseCouponsets.code() == 200 && responseCouponsets.body() != null) {
2592 - if (responseCoupons.body() != null && responseCoupons.body().getStatus() == 1) { 2044 + JSONObject jobjCouponsetsResponse = null;
2045 + try {
2046 + jobjCouponsetsResponse = new JSONObject(responseCouponsets.body().string());
2047 + } catch (Exception e) {
2048 + e.printStackTrace();
2049 + }
2050 +
2051 + if (jobjCouponsetsResponse != null && jobjCouponsetsResponse.has("status") && jobjCouponsetsResponse.optString("status", "2").equals("1")) {
2593 LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel(); 2052 LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
2594 - dynatraceEvent.setEventName("custom_success_user_coupons_loyalty"); 2053 + dynatraceEvent.setEventName("custom_success_couponsets_loyalty");
2595 EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent)); 2054 EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent));
2596 2055
2597 - new AsyncTask<Void, CouponList, CouponList>() { 2056 + JSONObject finalJobjCouponsetsResponse = jobjCouponsetsResponse;
2057 + getUserCouponsRetro(service, new Callback<ResponseBody>() {
2598 @Override 2058 @Override
2599 - protected CouponList doInBackground(Void... voids) { 2059 + public void onResponse(@NonNull Call<ResponseBody> call, @NonNull Response<ResponseBody> responseCoupons) {
2600 - CouponList mCouponList = new CouponList(); 2060 + if (responseCoupons.code() == 200 && responseCoupons.body() != null) {
2601 - for (CouponModel.CouponResult coupon : responseCoupons.body().getResult()) { 2061 + JSONObject jobjCouponsResponse = null;
2602 - for (CouponsetModel.MappCoupon couponset : response.body().getContext().getMappCoupon()) {
2603 - if (coupon.getCouponsetUuid().equals(couponset.getUuid())) {
2604 - Coupon newCoupon = new Coupon();
2605 - newCoupon.setStatus(coupon.getStatus());
2606 -
2607 - JSONObject obj = new JSONObject();
2608 try { 2062 try {
2609 - obj.putOpt("assigned", coupon.getChangesDates().getAssigned()); 2063 + jobjCouponsResponse = new JSONObject(responseCoupons.body().string());
2610 - obj.putOpt("created", coupon.getChangesDates().getCreated()); 2064 + } catch (Exception e) {
2611 - newCoupon.setChangesDates(obj);
2612 - } catch (JSONException e) {
2613 e.printStackTrace(); 2065 e.printStackTrace();
2614 } 2066 }
2615 - newCoupon.setImage(couponset.getImgPreview()); 2067 +
2616 - newCoupon.setMerchantUuid(coupon.getMerchantUuid()); 2068 + if (jobjCouponsResponse != null && jobjCouponsResponse.has("status") && jobjCouponsResponse.optInt("status", 2) == 1) {
2617 - newCoupon.setCoupon(coupon.getCoupon()); 2069 + LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
2618 - newCoupon.setCouponsetUuid(coupon.getCouponsetUuid()); 2070 + dynatraceEvent.setEventName("custom_success_user_coupons_loyalty");
2619 - newCoupon.setDiscount(coupon.getDiscount()); 2071 + EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent));
2620 - newCoupon.setExpiration(coupon.getExpiration()); 2072 +
2621 - newCoupon.setDescription(couponset.getShortDescription()); 2073 + JSONObject finalJobjCouponsResponse = jobjCouponsResponse;
2622 - newCoupon.setName(couponset.getName()); 2074 + final ExecutorService executor = Executors.newFixedThreadPool(1);
2623 - newCoupon.setMerchantUuid(couponset.getMerchantUuid()); 2075 + executor.submit(() -> {
2624 - newCoupon.setInnerText(couponset.getInnerText()); 2076 + // COUPONS START //
2625 - newCoupon.setDiscount_type(couponset.getDiscountType()); 2077 + JSONArray jCouponsBody = null;
2626 - newCoupon.setFinal_price(couponset.getFinalPrice()); 2078 + try {
2627 - mCouponList.add(newCoupon); 2079 + jCouponsBody = finalJobjCouponsResponse.optJSONArray("result");
2628 - } 2080 + } catch (Exception e) {
2081 + e.printStackTrace();
2629 } 2082 }
2083 + // COUPONS END //
2084 +
2085 + // COUPONSETS START //
2086 + JSONArray jCouponsetsBody = null;
2087 + try {
2088 + jCouponsetsBody = finalJobjCouponsetsResponse.optJSONObject("context").optJSONArray("MAPP_COUPON");
2089 + } catch (Exception e) {
2090 + e.printStackTrace();
2630 } 2091 }
2092 + // COUPONSETS END //
2093 +
2094 + if (jCouponsetsBody != null && jCouponsBody != null) {
2095 + CouponList mCouponList = new CouponList();
2096 + CouponsetsList mCouponsetList = new CouponsetsList();
2097 + for (int i = 0; i < jCouponsetsBody.length(); ++i) {
2098 + Couponset tempCouponset = new Couponset(jCouponsetsBody.optJSONObject(i));
2099 + mCouponsetList.add(tempCouponset);
2100 + for (int j = 0; j < jCouponsBody.length(); ++j) {
2101 + Coupon tempCoupon = new Coupon(jCouponsBody.optJSONObject(j));
2102 + if (tempCoupon.getCouponsetUuid().equals(tempCouponset.getUuid())) {
2103 + tempCoupon.setDescription(tempCouponset.getShortDescription());
2104 + tempCoupon.setImage(tempCouponset.getImgPreview());
2105 + tempCoupon.setName(tempCouponset.getName());
2106 + tempCoupon.setMerchantUuid(tempCouponset.getMerchantUuid());
2107 + tempCoupon.setInnerText(tempCouponset.getInnerText());
2108 + tempCoupon.setDiscount_type(tempCouponset.getDiscount_type());
2109 + tempCoupon.setFinal_price(tempCouponset.getFinal_price());
2110 + mCouponList.add(tempCoupon);
2111 + break;
2112 + }
2113 + }
2114 + }
2115 + WarplyManagerHelper.setCouponsets(mCouponsetList);
2631 WarplyManagerHelper.setCouponList(mCouponList); 2116 WarplyManagerHelper.setCouponList(mCouponList);
2632 2117
2633 CouponList mActiveCouponList = new CouponList(); 2118 CouponList mActiveCouponList = new CouponList();
...@@ -2647,34 +2132,10 @@ public class WarplyManager { ...@@ -2647,34 +2132,10 @@ public class WarplyManager {
2647 2132
2648 Collections.sort(mActiveCouponList, (coupon1, coupon2) -> coupon1.getExpirationDate().compareTo(coupon2.getExpirationDate())); 2133 Collections.sort(mActiveCouponList, (coupon1, coupon2) -> coupon1.getExpirationDate().compareTo(coupon2.getExpirationDate()));
2649 2134
2650 - CouponsetsList newCouponstList = new CouponsetsList(); 2135 + new Handler(Looper.getMainLooper()).post(() -> receiver.onSuccess(mActiveCouponList));
2651 - for (CouponsetModel.MappCoupon couponsetOld : response.body().getContext().getMappCoupon()) { 2136 + executor.shutdownNow();
2652 - Couponset newCouponset = new Couponset();
2653 - newCouponset.setUuid(couponsetOld.getUuid());
2654 - newCouponset.setImg_preview(couponsetOld.getImgPreview());
2655 - newCouponset.setExpiration(couponsetOld.getExpiration().getValue());
2656 - newCouponset.setName(couponsetOld.getName());
2657 - newCouponset.setDescription(couponsetOld.getDescription());
2658 - newCouponset.setShort_description(couponsetOld.getShortDescription());
2659 - newCouponset.setDiscount(couponsetOld.getDiscount());
2660 - newCouponset.setTerms(couponsetOld.getTerms());
2661 - newCouponset.setMerchantUuid(couponsetOld.getMerchantUuid());
2662 - newCouponset.setInnerText(couponsetOld.getInnerText());
2663 - newCouponset.setDiscount_type(couponsetOld.getDiscountType());
2664 - newCouponset.setFinal_price(couponsetOld.getFinalPrice());
2665 - newCouponstList.add(newCouponset);
2666 - }
2667 - WarplyManagerHelper.setCouponsets(newCouponstList);
2668 -
2669 - return mActiveCouponList;
2670 - }
2671 -
2672 - @Override
2673 - protected void onPostExecute(CouponList couponsResponse) {
2674 - super.onPostExecute(couponsResponse);
2675 - receiver.onSuccess(couponsResponse);
2676 } 2137 }
2677 - }.execute(); 2138 + });
2678 } else { 2139 } else {
2679 LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel(); 2140 LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
2680 dynatraceEvent.setEventName("custom_error_user_coupons_loyalty"); 2141 dynatraceEvent.setEventName("custom_error_user_coupons_loyalty");
...@@ -2690,35 +2151,38 @@ public class WarplyManager { ...@@ -2690,35 +2151,38 @@ public class WarplyManager {
2690 } 2151 }
2691 2152
2692 @Override 2153 @Override
2693 - public void onFailure(Call<CouponModel> call, Throwable t) { 2154 + public void onFailure(@NonNull Call<ResponseBody> call, @NonNull Throwable t) {
2694 LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel(); 2155 LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
2695 dynatraceEvent.setEventName("custom_error_user_coupons_loyalty"); 2156 dynatraceEvent.setEventName("custom_error_user_coupons_loyalty");
2696 EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent)); 2157 EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent));
2697 receiver.onFailure(2); 2158 receiver.onFailure(2);
2698 } 2159 }
2699 }); 2160 });
2161 +
2700 } else { 2162 } else {
2701 LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel(); 2163 LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
2702 dynatraceEvent.setEventName("custom_error_couponsets_loyalty"); 2164 dynatraceEvent.setEventName("custom_error_couponsets_loyalty");
2703 EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent)); 2165 EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent));
2704 receiver.onFailure(2); 2166 receiver.onFailure(2);
2705 } 2167 }
2168 +
2706 } else { 2169 } else {
2707 LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel(); 2170 LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
2708 dynatraceEvent.setEventName("custom_error_couponsets_loyalty"); 2171 dynatraceEvent.setEventName("custom_error_couponsets_loyalty");
2709 EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent)); 2172 EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent));
2710 - receiver.onFailure(2); 2173 + receiver.onFailure(responseCouponsets.code());
2711 } 2174 }
2712 } 2175 }
2713 2176
2714 @Override 2177 @Override
2715 - public void onFailure(Call<CouponsetModel> call, Throwable t) { 2178 + public void onFailure(@NonNull Call<ResponseBody> call, @NonNull Throwable t) {
2716 LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel(); 2179 LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
2717 dynatraceEvent.setEventName("custom_error_couponsets_loyalty"); 2180 dynatraceEvent.setEventName("custom_error_couponsets_loyalty");
2718 EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent)); 2181 EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent));
2719 receiver.onFailure(2); 2182 receiver.onFailure(2);
2720 } 2183 }
2721 }); 2184 });
2185 + }
2722 } else { 2186 } else {
2723 LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel(); 2187 LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
2724 dynatraceEvent.setEventName("custom_error_shops_loyalty"); 2188 dynatraceEvent.setEventName("custom_error_shops_loyalty");
...@@ -2731,12 +2195,12 @@ public class WarplyManager { ...@@ -2731,12 +2195,12 @@ public class WarplyManager {
2731 dynatraceEvent.setEventName("custom_error_shops_loyalty"); 2195 dynatraceEvent.setEventName("custom_error_shops_loyalty");
2732 EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent)); 2196 EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent));
2733 2197
2734 - receiver.onFailure(2); 2198 + receiver.onFailure(responseMerchants.code());
2735 } 2199 }
2736 } 2200 }
2737 2201
2738 @Override 2202 @Override
2739 - public void onFailure(Call<MerchantModel> call, Throwable t) { 2203 + public void onFailure(@NonNull Call<ResponseBody> call, @NonNull Throwable t) {
2740 LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel(); 2204 LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
2741 dynatraceEvent.setEventName("custom_error_shops_loyalty"); 2205 dynatraceEvent.setEventName("custom_error_shops_loyalty");
2742 EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent)); 2206 EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent));
...@@ -2746,16 +2210,24 @@ public class WarplyManager { ...@@ -2746,16 +2210,24 @@ public class WarplyManager {
2746 }); 2210 });
2747 } 2211 }
2748 2212
2749 - private static void getCouponsetsRetro(Callback<CouponsetModel> callback) { 2213 + private static void getCouponsetsRetro(ApiService service, Callback<ResponseBody> callback) {
2750 String timeStamp = DateFormat.format("yyyy-MM-dd hh:mm:ss", System.currentTimeMillis()).toString(); 2214 String timeStamp = DateFormat.format("yyyy-MM-dd hh:mm:ss", System.currentTimeMillis()).toString();
2751 String apiKey = WarpUtils.getApiKey(Warply.getWarplyContext()); 2215 String apiKey = WarpUtils.getApiKey(Warply.getWarplyContext());
2752 String webId = WarpUtils.getWebId(Warply.getWarplyContext()); 2216 String webId = WarpUtils.getWebId(Warply.getWarplyContext());
2753 - ApiService service = ApiClient.getRetrofitInstance().create(ApiService.class);
2754 2217
2755 - CouponsetRequestModel couponsetRequest = new CouponsetRequestModel(); 2218 + Map<String, Object> jsonParamsCouponsets = new ArrayMap<>();
2756 - Call<CouponsetModel> couponsetCall = service.getCouponsets( 2219 + Map<String, Object> jsonParams = new ArrayMap<>();
2220 + jsonParams.put("action", "retrieve_multilingual");
2221 + jsonParams.put("active", true);
2222 + jsonParams.put("visible", true);
2223 + jsonParams.put("language", WarplyProperty.getLanguage(Warply.getWarplyContext()));
2224 +
2225 + jsonParamsCouponsets.put("coupon", jsonParams);
2226 + RequestBody couponsetsRequest = RequestBody.create(MediaType.get("application/json; charset=utf-8"), (new JSONObject(jsonParamsCouponsets)).toString());
2227 +
2228 + Call<ResponseBody> couponsetsCall = service.getCouponsets(
2757 WarplyProperty.getAppUuid(Warply.getWarplyContext()), 2229 WarplyProperty.getAppUuid(Warply.getWarplyContext()),
2758 - couponsetRequest, 2230 + couponsetsRequest,
2759 timeStamp, 2231 timeStamp,
2760 "android:" + Warply.getWarplyContext().getPackageName(), 2232 "android:" + Warply.getWarplyContext().getPackageName(),
2761 new WarplyDeviceInfoCollector(Warply.getWarplyContext()).getUniqueDeviceId(), 2233 new WarplyDeviceInfoCollector(Warply.getWarplyContext()).getUniqueDeviceId(),
...@@ -2764,27 +2236,39 @@ public class WarplyManager { ...@@ -2764,27 +2236,39 @@ public class WarplyManager {
2764 WarpUtils.produceSignature(apiKey + timeStamp) 2236 WarpUtils.produceSignature(apiKey + timeStamp)
2765 ); 2237 );
2766 2238
2767 - couponsetCall.enqueue(new Callback<CouponsetModel>() { /* =================================== Couponsets Start =================================== */ 2239 + couponsetsCall.enqueue(new Callback<ResponseBody>() {
2768 @Override 2240 @Override
2769 - public void onResponse(Call<CouponsetModel> call, Response<CouponsetModel> response) { 2241 + public void onResponse(@NonNull Call<ResponseBody> call, @NonNull Response<ResponseBody> response) {
2770 callback.onResponse(call, response); 2242 callback.onResponse(call, response);
2771 } 2243 }
2772 2244
2773 @Override 2245 @Override
2774 - public void onFailure(Call<CouponsetModel> call, Throwable t) { 2246 + public void onFailure(@NonNull Call<ResponseBody> call, @NonNull Throwable t) {
2775 callback.onFailure(call, t); 2247 callback.onFailure(call, t);
2776 } 2248 }
2777 - }); /* ====================================================================================== Couponsets nd =========================================== */ 2249 + });
2778 } 2250 }
2779 2251
2780 - private static void getMerchantsRetro(Callback<MerchantModel> callback) { 2252 + private static void getMerchantsRetro(ApiService service, Callback<ResponseBody> callback) {
2781 String timeStamp = DateFormat.format("yyyy-MM-dd hh:mm:ss", System.currentTimeMillis()).toString(); 2253 String timeStamp = DateFormat.format("yyyy-MM-dd hh:mm:ss", System.currentTimeMillis()).toString();
2782 String apiKey = WarpUtils.getApiKey(Warply.getWarplyContext()); 2254 String apiKey = WarpUtils.getApiKey(Warply.getWarplyContext());
2783 String webId = WarpUtils.getWebId(Warply.getWarplyContext()); 2255 String webId = WarpUtils.getWebId(Warply.getWarplyContext());
2784 - ApiService service = ApiClient.getRetrofitInstance().create(ApiService.class);
2785 2256
2786 - MerchantsRequestModel merchantsRequest = new MerchantsRequestModel(); 2257 + Map<String, Object> jsonParamsShops = new ArrayMap<>();
2787 - Call<MerchantModel> merchantsCall = service.getMerchants( 2258 + Map<String, Object> jsonParams = new ArrayMap<>();
2259 + jsonParams.put("action", "retrieve_multilingual");
2260 + jsonParams.put("categories", new JSONArray());
2261 + jsonParams.put("active", true);
2262 + jsonParams.put("location", null);
2263 + jsonParams.put("parent_uuids", null);
2264 + jsonParams.put("tags", null);
2265 + jsonParams.put("default_shown", null);
2266 + jsonParams.put("language", WarplyProperty.getLanguage(Warply.getWarplyContext()));
2267 +
2268 + jsonParamsShops.put("shops", jsonParams);
2269 + RequestBody merchantsRequest = RequestBody.create(MediaType.get("application/json; charset=utf-8"), (new JSONObject(jsonParamsShops)).toString());
2270 +
2271 + Call<ResponseBody> merchantsCall = service.getMerchants(
2788 WarplyProperty.getAppUuid(Warply.getWarplyContext()), 2272 WarplyProperty.getAppUuid(Warply.getWarplyContext()),
2789 merchantsRequest, 2273 merchantsRequest,
2790 timeStamp, 2274 timeStamp,
...@@ -2795,29 +2279,38 @@ public class WarplyManager { ...@@ -2795,29 +2279,38 @@ public class WarplyManager {
2795 WarpUtils.produceSignature(apiKey + timeStamp) 2279 WarpUtils.produceSignature(apiKey + timeStamp)
2796 ); 2280 );
2797 2281
2798 - merchantsCall.enqueue(new Callback<MerchantModel>() { /* =================================== Merchants Start =================================== */ 2282 + merchantsCall.enqueue(new Callback<ResponseBody>() {
2799 @Override 2283 @Override
2800 - public void onResponse(Call<MerchantModel> call, Response<MerchantModel> response) { 2284 + public void onResponse(@NonNull Call<ResponseBody> call, @NonNull Response<ResponseBody> response) {
2801 callback.onResponse(call, response); 2285 callback.onResponse(call, response);
2802 } 2286 }
2803 2287
2804 @Override 2288 @Override
2805 - public void onFailure(Call<MerchantModel> call, Throwable t) { 2289 + public void onFailure(@NonNull Call<ResponseBody> call, @NonNull Throwable t) {
2806 callback.onFailure(call, t); 2290 callback.onFailure(call, t);
2807 } 2291 }
2808 - }); /* ====================================================================================== Merchants End ======================================= */ 2292 + });
2809 } 2293 }
2810 2294
2811 - private static void getUserCouponsRetro(Callback<CouponModel> callback) { 2295 + private static void getUserCouponsRetro(ApiService service, Callback<ResponseBody> callback) {
2812 String timeStamp = DateFormat.format("yyyy-MM-dd hh:mm:ss", System.currentTimeMillis()).toString(); 2296 String timeStamp = DateFormat.format("yyyy-MM-dd hh:mm:ss", System.currentTimeMillis()).toString();
2813 String apiKey = WarpUtils.getApiKey(Warply.getWarplyContext()); 2297 String apiKey = WarpUtils.getApiKey(Warply.getWarplyContext());
2814 String webId = WarpUtils.getWebId(Warply.getWarplyContext()); 2298 String webId = WarpUtils.getWebId(Warply.getWarplyContext());
2815 - ApiService service = ApiClient.getRetrofitInstance().create(ApiService.class);
2816 2299
2817 - CouponRequestModel couponRequest = new CouponRequestModel(); 2300 + Map<String, Object> jsonParamsCoupons = new ArrayMap<>();
2818 - Call<CouponModel> couponCall = service.getUserCoupons( 2301 + Map<String, Object> jsonParams = new ArrayMap<>();
2302 + jsonParams.put("action", "get_user_coupons");
2303 + JSONArray jArr = new JSONArray();
2304 + jArr.put("transaction");
2305 + jArr.put("communication");
2306 + jsonParams.put("fetch_data", jArr);
2307 +
2308 + jsonParamsCoupons.put("coupon", jsonParams);
2309 + RequestBody couponsRequest = RequestBody.create(MediaType.get("application/json; charset=utf-8"), (new JSONObject(jsonParamsCoupons)).toString());
2310 +
2311 + Call<ResponseBody> couponsCall = service.getUserCoupons(
2819 WarplyProperty.getAppUuid(Warply.getWarplyContext()), 2312 WarplyProperty.getAppUuid(Warply.getWarplyContext()),
2820 - couponRequest, 2313 + couponsRequest,
2821 timeStamp, 2314 timeStamp,
2822 "android:" + Warply.getWarplyContext().getPackageName(), 2315 "android:" + Warply.getWarplyContext().getPackageName(),
2823 new WarplyDeviceInfoCollector(Warply.getWarplyContext()).getUniqueDeviceId(), 2316 new WarplyDeviceInfoCollector(Warply.getWarplyContext()).getUniqueDeviceId(),
...@@ -2827,16 +2320,16 @@ public class WarplyManager { ...@@ -2827,16 +2320,16 @@ public class WarplyManager {
2827 "Bearer " + WarplyDBHelper.getInstance(Warply.getWarplyContext()).getAuthValue("access_token") 2320 "Bearer " + WarplyDBHelper.getInstance(Warply.getWarplyContext()).getAuthValue("access_token")
2828 ); 2321 );
2829 2322
2830 - couponCall.enqueue(new Callback<CouponModel>() { /* ================================== Coupons Start ================================== */ 2323 + couponsCall.enqueue(new Callback<ResponseBody>() {
2831 @Override 2324 @Override
2832 - public void onResponse(Call<CouponModel> call, Response<CouponModel> response) { 2325 + public void onResponse(@NonNull Call<ResponseBody> call, @NonNull Response<ResponseBody> response) {
2833 if (response.code() == 401) { 2326 if (response.code() == 401) {
2834 refreshToken(new WarplyRefreshTokenRequest(), new CallbackReceiver<JSONObject>() { 2327 refreshToken(new WarplyRefreshTokenRequest(), new CallbackReceiver<JSONObject>() {
2835 @Override 2328 @Override
2836 public void onSuccess(JSONObject result) { 2329 public void onSuccess(JSONObject result) {
2837 int status = result.optInt("status", 2); 2330 int status = result.optInt("status", 2);
2838 if (status == 1) 2331 if (status == 1)
2839 - getUserCouponsRetro(callback); 2332 + getUserCouponsRetro(service, callback);
2840 else 2333 else
2841 callback.onFailure(call, new Throwable()); 2334 callback.onFailure(call, new Throwable());
2842 } 2335 }
...@@ -2846,16 +2339,16 @@ public class WarplyManager { ...@@ -2846,16 +2339,16 @@ public class WarplyManager {
2846 callback.onFailure(call, new Throwable()); 2339 callback.onFailure(call, new Throwable());
2847 } 2340 }
2848 }); 2341 });
2849 - } else if (response.code() == 200) { 2342 + } else {
2850 callback.onResponse(call, response); 2343 callback.onResponse(call, response);
2851 } 2344 }
2852 } 2345 }
2853 2346
2854 @Override 2347 @Override
2855 - public void onFailure(Call<CouponModel> call, Throwable t) { 2348 + public void onFailure(@NonNull Call<ResponseBody> call, @NonNull Throwable t) {
2856 callback.onFailure(call, t); 2349 callback.onFailure(call, t);
2857 } 2350 }
2858 - }); /* ============================================================================== Coupons nd ====================================== */ 2351 + });
2859 } 2352 }
2860 2353
2861 public static void getCosmoteUser(WarplyCosmoteUserRequest request, final CallbackReceiver<JSONObject> receiver) { 2354 public static void getCosmoteUser(WarplyCosmoteUserRequest request, final CallbackReceiver<JSONObject> receiver) {
...@@ -3196,7 +2689,7 @@ public class WarplyManager { ...@@ -3196,7 +2689,7 @@ public class WarplyManager {
3196 } 2689 }
3197 2690
3198 public static void makeGetRequest(String url) { 2691 public static void makeGetRequest(String url) {
3199 -// Always run it in a new Thread, not in the main 2692 +// Always run it in a new Thread, not in the main, ie Executors
3200 // new Thread(() -> { 2693 // new Thread(() -> {
3201 // makeGetRequest(session_uuid); 2694 // makeGetRequest(session_uuid);
3202 // }).start(); 2695 // }).start();
...@@ -3205,11 +2698,11 @@ public class WarplyManager { ...@@ -3205,11 +2698,11 @@ public class WarplyManager {
3205 // api 'com.squareup.retrofit2:retrofit:2.9.0' 2698 // api 'com.squareup.retrofit2:retrofit:2.9.0'
3206 // api 'com.squareup.okhttp3:okhttp:4.10.0' 2699 // api 'com.squareup.okhttp3:okhttp:4.10.0'
3207 2700
3208 -// And uncomment the code inside RetrofitInterface.java 2701 +// And uncomment the code inside ApiService.java
3209 2702
3210 // OkHttpClient.Builder httpClient = new OkHttpClient.Builder(); 2703 // OkHttpClient.Builder httpClient = new OkHttpClient.Builder();
3211 -// httpClient.followRedirects(FALSE) 2704 +// httpClient.followRedirects(false)
3212 -// .followSslRedirects(FALSE); 2705 +// .followSslRedirects(false);
3213 // 2706 //
3214 // Retrofit retrofit = new Retrofit.Builder() 2707 // Retrofit retrofit = new Retrofit.Builder()
3215 // .baseUrl(WarplyProperty.getBaseUrl(Warply.getWarplyContext())) 2708 // .baseUrl(WarplyProperty.getBaseUrl(Warply.getWarplyContext()))
......
...@@ -88,7 +88,7 @@ ...@@ -88,7 +88,7 @@
88 android:layout_width="240dp" 88 android:layout_width="240dp"
89 android:layout_height="50dp" 89 android:layout_height="50dp"
90 android:layout_marginHorizontal="32dp" 90 android:layout_marginHorizontal="32dp"
91 - android:layout_marginTop="88dp" 91 + android:layout_marginTop="27dp"
92 android:background="@drawable/selector_button_green" 92 android:background="@drawable/selector_button_green"
93 android:gravity="center" 93 android:gravity="center"
94 android:orientation="horizontal"> 94 android:orientation="horizontal">
......
...@@ -12,8 +12,8 @@ ...@@ -12,8 +12,8 @@
12 android:id="@+id/cl_more_header" 12 android:id="@+id/cl_more_header"
13 android:layout_width="match_parent" 13 android:layout_width="match_parent"
14 android:layout_height="64dp" 14 android:layout_height="64dp"
15 - android:translationZ="10dp" 15 + android:background="@drawable/ic_background_transparent_shadow"
16 - android:background="@drawable/ic_background_transparent_shadow"> 16 + android:translationZ="10dp">
17 17
18 <ImageView 18 <ImageView
19 android:id="@+id/iv_list_close" 19 android:id="@+id/iv_list_close"
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
43 app:layout_constraintTop_toTopOf="parent" /> 43 app:layout_constraintTop_toTopOf="parent" />
44 </androidx.constraintlayout.widget.ConstraintLayout> 44 </androidx.constraintlayout.widget.ConstraintLayout>
45 45
46 - <LinearLayout 46 + <RelativeLayout
47 android:layout_width="match_parent" 47 android:layout_width="match_parent"
48 android:layout_height="match_parent" 48 android:layout_height="match_parent"
49 android:layout_marginTop="-18dp" 49 android:layout_marginTop="-18dp"
...@@ -51,11 +51,11 @@ ...@@ -51,11 +51,11 @@
51 51
52 <ScrollView 52 <ScrollView
53 android:layout_width="match_parent" 53 android:layout_width="match_parent"
54 - android:layout_height="match_parent" 54 + android:layout_height="wrap_content"
55 android:fillViewport="true" 55 android:fillViewport="true"
56 android:overScrollMode="never"> 56 android:overScrollMode="never">
57 57
58 - <LinearLayout 58 + <RelativeLayout
59 android:layout_width="match_parent" 59 android:layout_width="match_parent"
60 android:layout_height="wrap_content" 60 android:layout_height="wrap_content"
61 android:orientation="vertical"> 61 android:orientation="vertical">
...@@ -152,6 +152,7 @@ ...@@ -152,6 +152,7 @@
152 android:id="@+id/ll_exclusive_items" 152 android:id="@+id/ll_exclusive_items"
153 android:layout_width="match_parent" 153 android:layout_width="match_parent"
154 android:layout_height="wrap_content" 154 android:layout_height="wrap_content"
155 + android:layout_below="@+id/ll_research_items"
155 android:orientation="vertical" 156 android:orientation="vertical"
156 android:visibility="gone"> 157 android:visibility="gone">
157 158
...@@ -180,6 +181,7 @@ ...@@ -180,6 +181,7 @@
180 android:id="@+id/ll_contest_items" 181 android:id="@+id/ll_contest_items"
181 android:layout_width="match_parent" 182 android:layout_width="match_parent"
182 android:layout_height="wrap_content" 183 android:layout_height="wrap_content"
184 + android:layout_below="@+id/ll_exclusive_items"
183 android:orientation="vertical" 185 android:orientation="vertical"
184 android:visibility="gone"> 186 android:visibility="gone">
185 187
...@@ -208,6 +210,7 @@ ...@@ -208,6 +210,7 @@
208 android:id="@+id/ll_contextual_items" 210 android:id="@+id/ll_contextual_items"
209 android:layout_width="match_parent" 211 android:layout_width="match_parent"
210 android:layout_height="wrap_content" 212 android:layout_height="wrap_content"
213 + android:layout_below="@+id/ll_contest_items"
211 android:orientation="vertical" 214 android:orientation="vertical"
212 android:visibility="gone"> 215 android:visibility="gone">
213 216
...@@ -231,7 +234,7 @@ ...@@ -231,7 +234,7 @@
231 android:overScrollMode="never" 234 android:overScrollMode="never"
232 android:paddingBottom="4dp" /> 235 android:paddingBottom="4dp" />
233 </LinearLayout> 236 </LinearLayout>
234 - </LinearLayout> 237 + </RelativeLayout>
235 </ScrollView> 238 </ScrollView>
236 - </LinearLayout> 239 + </RelativeLayout>
237 </LinearLayout> 240 </LinearLayout>
...\ No newline at end of file ...\ No newline at end of file
......