Panagiotis Triantafyllou

feedback fixes

...@@ -36,7 +36,7 @@ public class SplashActivity extends BaseActivity { ...@@ -36,7 +36,7 @@ public class SplashActivity extends BaseActivity {
36 public void onWarplyReady() { 36 public void onWarplyReady() {
37 if (!WarplyDBHelper.getInstance(SplashActivity.this).isTableNotEmpty("auth")) { 37 if (!WarplyDBHelper.getInstance(SplashActivity.this).isTableNotEmpty("auth")) {
38 WarplyManager.getCosmoteUser(new WarplyCosmoteUserRequest() 38 WarplyManager.getCosmoteUser(new WarplyCosmoteUserRequest()
39 - .setGuid("6005892749"), //6012049321, 6012049322, 6012049323, 7000000831 history, 7000000826, 7000000831 shared coupons, prod 6006552990, prod 6005892749, live 3000184910 39 + .setGuid("7000070282"), //6012049321, 6012049322, 6012049323, 7000000831 history, 7000000826, 7000000831 shared coupons, prod 6006552990, prod 6005892749, live 3000184910
40 mLoginReceiver); 40 mLoginReceiver);
41 } else { 41 } else {
42 startNextActivity(); 42 startNextActivity();
......
...@@ -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.6rc70' 5 + PUBLISH_VERSION = '4.5.4.6rc71'
6 PUBLISH_ARTIFACT_ID = 'warply-android-sdk' 6 PUBLISH_ARTIFACT_ID = 'warply-android-sdk'
7 } 7 }
8 8
......
...@@ -280,9 +280,9 @@ public class LoyaltyMarketAnalysisActivity extends Activity implements View.OnCl ...@@ -280,9 +280,9 @@ public class LoyaltyMarketAnalysisActivity extends Activity implements View.OnCl
280 @Override 280 @Override
281 public void onSuccess(SharingList result) { 281 public void onSuccess(SharingList result) {
282 if (result != null && result.size() > 0) { 282 if (result != null && result.size() > 0) {
283 - if (WarplyManagerHelper.getCouponsets() != null && WarplyManagerHelper.getCouponsets().size() > 0) { 283 + if (WarplyManagerHelper.getCouponsetsDeals() != null && WarplyManagerHelper.getCouponsetsDeals().size() > 0) {
284 for (SharingCoupon shCoupon : result) { 284 for (SharingCoupon shCoupon : result) {
285 - for (Couponset cpnset : WarplyManagerHelper.getCouponsets()) { 285 + for (Couponset cpnset : WarplyManagerHelper.getCouponsetsDeals()) {
286 if (shCoupon.getCouponsetUuid().equals(cpnset.getUuid())) { 286 if (shCoupon.getCouponsetUuid().equals(cpnset.getUuid())) {
287 SharingCoupon newShCoupon = new SharingCoupon(); 287 SharingCoupon newShCoupon = new SharingCoupon();
288 newShCoupon = shCoupon; 288 newShCoupon = shCoupon;
......
...@@ -55,6 +55,7 @@ import ly.warp.sdk.io.models.ActiveDFYCouponEventModel; ...@@ -55,6 +55,7 @@ import ly.warp.sdk.io.models.ActiveDFYCouponEventModel;
55 import ly.warp.sdk.io.models.ActiveDFYCouponModel; 55 import ly.warp.sdk.io.models.ActiveDFYCouponModel;
56 import ly.warp.sdk.io.models.Coupon; 56 import ly.warp.sdk.io.models.Coupon;
57 import ly.warp.sdk.io.models.CouponList; 57 import ly.warp.sdk.io.models.CouponList;
58 +import ly.warp.sdk.io.models.Couponset;
58 import ly.warp.sdk.io.models.LoyaltySDKFirebaseEventModel; 59 import ly.warp.sdk.io.models.LoyaltySDKFirebaseEventModel;
59 import ly.warp.sdk.io.models.UnifiedCoupon; 60 import ly.warp.sdk.io.models.UnifiedCoupon;
60 import ly.warp.sdk.io.models.WarplyDealsAnalysisEventModel; 61 import ly.warp.sdk.io.models.WarplyDealsAnalysisEventModel;
...@@ -530,15 +531,29 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie ...@@ -530,15 +531,29 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie
530 // Third Expandable Banner 531 // Third Expandable Banner
531 if (WarplyManagerHelper.getMarketCoupons().size() > 0) { 532 if (WarplyManagerHelper.getMarketCoupons().size() > 0) {
532 countValue = 0.0f; 533 countValue = 0.0f;
533 - for (UnifiedCoupon unicou : WarplyManagerHelper.getMarketCoupons()) { 534 +// for (UnifiedCoupon unicou : WarplyManagerHelper.getMarketCoupons()) {
534 - if (unicou.getCoupons() != null && unicou.getCoupons().size() > 0) { 535 +// if (unicou.getCoupons() != null && unicou.getCoupons().size() > 0) {
535 - for (Coupon inncou : unicou.getCoupons()) { 536 +// for (Coupon inncou : unicou.getCoupons()) {
536 - if (inncou.getStatus() == 0) { 537 +// if (inncou.getStatus() == 0) {
537 - countValue += Float.valueOf(inncou.getDiscount()); 538 +// countValue += Float.valueOf(inncou.getDiscount());
539 +// }
540 +// }
541 +// }
542 +// }
543 +
544 + if (WarplyManagerHelper.getCouponRedeemedList().size() > 0) {
545 + if (WarplyManagerHelper.getCouponsetsDeals().size() > 0) {
546 + for (Couponset couset : WarplyManagerHelper.getCouponsetsDeals()) {
547 + for (Coupon cou : WarplyManagerHelper.getCouponRedeemedList()) {
548 + if (cou.getCouponsetUuid().equals(couset.getUuid())) {
549 + countValue += Float.valueOf(cou.getDiscount());
550 + break;
551 + }
538 } 552 }
539 } 553 }
540 } 554 }
541 } 555 }
556 +
542 mFavValue += countValue; 557 mFavValue += countValue;
543 String badgeValue = String.format("%.02f", countValue); 558 String badgeValue = String.format("%.02f", countValue);
544 mTvMarketValue.setText(String.format(getString(R.string.cos_value), badgeValue)); 559 mTvMarketValue.setText(String.format(getString(R.string.cos_value), badgeValue));
......
...@@ -43,6 +43,18 @@ public interface ApiService { ...@@ -43,6 +43,18 @@ public interface ApiService {
43 43
44 @Headers("Content-Type: application/json") 44 @Headers("Content-Type: application/json")
45 @POST("/oauth/{appUuid}/context") 45 @POST("/oauth/{appUuid}/context")
46 + Call<ResponseBody> getCouponsets(@Path("appUuid") String appUuid,
47 + @Body RequestBody request,
48 + @Header(WarpConstants.HEADER_DATE) String timeStamp,
49 + @Header(WarpConstants.HEADER_LOYALTY_BUNDLE_ID) String bundleId,
50 + @Header(WarpConstants.HEADER_UNIQUE_DEVICE_ID) String deviceId,
51 + @Header(WarpConstants.HEADER_CHANNEL) String channel,
52 + @Header(WarpConstants.HEADER_WEB_ID) String webId,
53 + @Header(WarpConstants.HEADER_SIGNATURE) String signature,
54 + @Header(WarpConstants.HEADER_AUTHORIZATION) String bearer);
55 +
56 + @Headers("Content-Type: application/json")
57 + @POST("/oauth/{appUuid}/context")
46 Call<ResponseBody> getUserCoupons(@Path("appUuid") String appUuid, 58 Call<ResponseBody> getUserCoupons(@Path("appUuid") String appUuid,
47 @Body RequestBody request, 59 @Body RequestBody request,
48 @Header(WarpConstants.HEADER_DATE) String timeStamp, 60 @Header(WarpConstants.HEADER_DATE) String timeStamp,
......
...@@ -111,8 +111,10 @@ public class WarplyManagerHelper { ...@@ -111,8 +111,10 @@ public class WarplyManagerHelper {
111 private static Consumer mConsumerInternal = new Consumer(); 111 private static Consumer mConsumerInternal = new Consumer();
112 private static HashMap<String, CampaignList> mUniqueCampaignList = new HashMap<String, CampaignList>(); 112 private static HashMap<String, CampaignList> mUniqueCampaignList = new HashMap<String, CampaignList>();
113 private static CouponList mCouponList = new CouponList(); 113 private static CouponList mCouponList = new CouponList();
114 + private static CouponList mCouponRedeemedList = new CouponList();
114 private static CouponList mCouponListExpired = new CouponList(); 115 private static CouponList mCouponListExpired = new CouponList();
115 private static CouponsetsList mCouponsetsList = new CouponsetsList(); 116 private static CouponsetsList mCouponsetsList = new CouponsetsList();
117 + private static CouponsetsList mCouponsetsDealsList = new CouponsetsList();
116 private static CustomerStateModel mCustomerStateModel = new CustomerStateModel(); 118 private static CustomerStateModel mCustomerStateModel = new CustomerStateModel();
117 private static ArrayList<Campaign> mCampaignList = new ArrayList<Campaign>(); 119 private static ArrayList<Campaign> mCampaignList = new ArrayList<Campaign>();
118 private static ArrayList<Campaign> mCampaignListAll = new ArrayList<Campaign>(); 120 private static ArrayList<Campaign> mCampaignListAll = new ArrayList<Campaign>();
...@@ -1231,6 +1233,15 @@ public class WarplyManagerHelper { ...@@ -1231,6 +1233,15 @@ public class WarplyManagerHelper {
1231 }); 1233 });
1232 } 1234 }
1233 1235
1236 + public static void setCouponRedeemedList(CouponList couponRedeemedList) {
1237 + mCouponRedeemedList.clear();
1238 + mCouponRedeemedList.addAll(couponRedeemedList);
1239 + }
1240 +
1241 + public static CouponList getCouponRedeemedList() {
1242 + return mCouponRedeemedList;
1243 + }
1244 +
1234 public static LoyaltyBadgeModel getLoyaltyBadge() { 1245 public static LoyaltyBadgeModel getLoyaltyBadge() {
1235 return mLoyaltyBadge; 1246 return mLoyaltyBadge;
1236 } 1247 }
...@@ -1243,6 +1254,14 @@ public class WarplyManagerHelper { ...@@ -1243,6 +1254,14 @@ public class WarplyManagerHelper {
1243 mCouponsetsList = couponsets; 1254 mCouponsetsList = couponsets;
1244 } 1255 }
1245 1256
1257 + public static void setCouponsetsDeals(CouponsetsList couponsetsDeals) {
1258 + mCouponsetsDealsList = couponsetsDeals;
1259 + }
1260 +
1261 + public static CouponsetsList getCouponsetsDeals() {
1262 + return mCouponsetsDealsList;
1263 + }
1264 +
1246 public static void setMerchantList(MerchantList merchantList) { 1265 public static void setMerchantList(MerchantList merchantList) {
1247 mMerchantList.clear(); 1266 mMerchantList.clear();
1248 mMerchantList = merchantList; 1267 mMerchantList = merchantList;
......
...@@ -1898,66 +1898,124 @@ public class WarplyManager { ...@@ -1898,66 +1898,124 @@ public class WarplyManager {
1898 WarpUtils.log("[WARP Trace] WARPLY User Coupons Request is active"); 1898 WarpUtils.log("[WARP Trace] WARPLY User Coupons Request is active");
1899 WarpUtils.log("**************************************************"); 1899 WarpUtils.log("**************************************************");
1900 ApiService service = ApiClient.getRetrofitInstance().create(ApiService.class); 1900 ApiService service = ApiClient.getRetrofitInstance().create(ApiService.class);
1901 - getUnifiedCouponsRetro(service, new Callback<ResponseBody>() { 1901 + getCouponsetsRetro(service, true, new Callback<ResponseBody>() {
1902 @Override 1902 @Override
1903 - public void onResponse(@NonNull Call<ResponseBody> call, @NonNull Response<ResponseBody> responseCoupons) { 1903 + public void onResponse(Call<ResponseBody> call, Response<ResponseBody> responseCouponsets) {
1904 - if (responseCoupons.code() == 200 && responseCoupons.body() != null) { 1904 + if (responseCouponsets.code() == 200 && responseCouponsets.body() != null) {
1905 - JSONObject jobjCouponsResponse = null; 1905 + JSONObject jobjCouponsetsResponse = null;
1906 try { 1906 try {
1907 - jobjCouponsResponse = new JSONObject(responseCoupons.body().string()); 1907 + jobjCouponsetsResponse = new JSONObject(responseCouponsets.body().string());
1908 } catch (Exception e) { 1908 } catch (Exception e) {
1909 e.printStackTrace(); 1909 e.printStackTrace();
1910 } 1910 }
1911 - if (jobjCouponsResponse != null && jobjCouponsResponse.has("status") && jobjCouponsResponse.optInt("status", 2) == 1) { 1911 +
1912 - ArrayList<UnifiedCoupon> couponList = new ArrayList<UnifiedCoupon>(); 1912 + if (jobjCouponsetsResponse != null && jobjCouponsetsResponse.has("status") && jobjCouponsetsResponse.optString("status", "2").equals("1")) {
1913 - ArrayList<UnifiedCoupon> allCouponList = new ArrayList<UnifiedCoupon>();
1914 LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel(); 1913 LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
1915 - dynatraceEvent.setEventName("custom_success_unified_coupons_loyalty"); 1914 + dynatraceEvent.setEventName("custom_success_couponsets_sm_loyalty");
1916 EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent)); 1915 EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent));
1917 - JSONObject finalJobjCouponsResponse = jobjCouponsResponse;
1918 - final ExecutorService executor = Executors.newFixedThreadPool(1);
1919 - executor.submit(() -> {
1920 - JSONObject jCouponsBody = null;
1921 - try {
1922 - jCouponsBody = finalJobjCouponsResponse.optJSONObject("result");
1923 - if (jCouponsBody != null && jCouponsBody.length() > 0) {
1924 - JSONArray jCouponsInnerBody = null;
1925 - jCouponsInnerBody = jCouponsBody.optJSONArray("coupons");
1926 - if (jCouponsInnerBody != null && jCouponsInnerBody.length() > 0) {
1927 - for (int i = 0; i < jCouponsInnerBody.length(); i++) {
1928 - UnifiedCoupon tempUni = new UnifiedCoupon(jCouponsInnerBody.optJSONObject(i));
1929 - allCouponList.add(tempUni);
1930 - if (tempUni.getStatus().trim().equals("active"))
1931 - couponList.add(tempUni);
1932 - }
1933 1916
1934 - WarplyManagerHelper.setMarketCoupons(allCouponList); 1917 + JSONObject finalJobjCouponsetsResponse = jobjCouponsetsResponse;
1918 + // COUPONSETS START //
1919 + JSONArray jCouponsetsBody = null;
1920 + try {
1921 + jCouponsetsBody = finalJobjCouponsetsResponse.optJSONArray("result");
1922 + } catch (Exception e) {
1923 + e.printStackTrace();
1924 + }
1925 + // COUPONSETS END //
1926 +
1927 + if (jCouponsetsBody != null) {
1928 + CouponsetsList mCouponsetList = new CouponsetsList();
1929 + for (int i = 0; i < jCouponsetsBody.length(); ++i) {
1930 + Couponset tempCouponset = new Couponset(jCouponsetsBody.optJSONObject(i));
1931 + mCouponsetList.add(tempCouponset);
1932 + }
1933 + WarplyManagerHelper.setCouponsetsDeals(mCouponsetList);
1934 +
1935 + getUnifiedCouponsRetro(service, new Callback<ResponseBody>() {
1936 + @Override
1937 + public void onResponse(@NonNull Call<ResponseBody> call, @NonNull Response<ResponseBody> responseCoupons) {
1938 + if (responseCoupons.code() == 200 && responseCoupons.body() != null) {
1939 + JSONObject jobjCouponsResponse = null;
1940 + try {
1941 + jobjCouponsResponse = new JSONObject(responseCoupons.body().string());
1942 + } catch (Exception e) {
1943 + e.printStackTrace();
1944 + }
1945 + if (jobjCouponsResponse != null && jobjCouponsResponse.has("status") && jobjCouponsResponse.optInt("status", 2) == 1) {
1946 + ArrayList<UnifiedCoupon> couponList = new ArrayList<UnifiedCoupon>();
1947 + ArrayList<UnifiedCoupon> allCouponList = new ArrayList<UnifiedCoupon>();
1948 + LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
1949 + dynatraceEvent.setEventName("custom_success_unified_coupons_loyalty");
1950 + EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent));
1951 + JSONObject finalJobjCouponsResponse = jobjCouponsResponse;
1952 + final ExecutorService executor = Executors.newFixedThreadPool(1);
1953 + executor.submit(() -> {
1954 + JSONObject jCouponsBody = null;
1955 + try {
1956 + jCouponsBody = finalJobjCouponsResponse.optJSONObject("result");
1957 + if (jCouponsBody != null && jCouponsBody.length() > 0) {
1958 + JSONArray jCouponsInnerBody = null;
1959 + jCouponsInnerBody = jCouponsBody.optJSONArray("coupons");
1960 + if (jCouponsInnerBody != null && jCouponsInnerBody.length() > 0) {
1961 + for (int i = 0; i < jCouponsInnerBody.length(); i++) {
1962 + UnifiedCoupon tempUni = new UnifiedCoupon(jCouponsInnerBody.optJSONObject(i));
1963 + allCouponList.add(tempUni);
1964 + if (tempUni.getStatus().trim().equals("active"))
1965 + couponList.add(tempUni);
1966 + }
1967 +
1968 + WarplyManagerHelper.setMarketCoupons(allCouponList);
1969 + }
1970 + }
1971 + } catch (Exception e) {
1972 + e.printStackTrace();
1973 + }
1974 + new Handler(Looper.getMainLooper()).post(() -> receiver.onSuccess(couponList));
1975 + executor.shutdownNow();
1976 + });
1977 + } else {
1978 + LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
1979 + dynatraceEvent.setEventName("custom_error_unified_coupons_loyalty");
1980 + EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent));
1981 + receiver.onFailure(2);
1982 + }
1983 + } else {
1984 + LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
1985 + dynatraceEvent.setEventName("custom_error_unified_coupons_loyalty");
1986 + EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent));
1987 + receiver.onFailure(responseCoupons.code());
1935 } 1988 }
1936 } 1989 }
1937 - } catch (Exception e) { 1990 +
1938 - e.printStackTrace(); 1991 + @Override
1939 - } 1992 + public void onFailure(@NonNull Call<ResponseBody> call, @NonNull Throwable t) {
1940 - new Handler(Looper.getMainLooper()).post(() -> receiver.onSuccess(couponList)); 1993 + LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
1941 - executor.shutdownNow(); 1994 + dynatraceEvent.setEventName("custom_error_user_coupons_loyalty");
1942 - }); 1995 + EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent));
1996 + receiver.onFailure(2);
1997 + }
1998 + });
1999 + }
1943 } else { 2000 } else {
1944 LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel(); 2001 LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
1945 - dynatraceEvent.setEventName("custom_error_unified_coupons_loyalty"); 2002 + dynatraceEvent.setEventName("custom_error_couponsets_sm_loyalty");
1946 EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent)); 2003 EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent));
1947 receiver.onFailure(2); 2004 receiver.onFailure(2);
1948 } 2005 }
2006 +
1949 } else { 2007 } else {
1950 LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel(); 2008 LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
1951 - dynatraceEvent.setEventName("custom_error_unified_coupons_loyalty"); 2009 + dynatraceEvent.setEventName("custom_error_couponsets_sm_loyalty");
1952 EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent)); 2010 EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent));
1953 - receiver.onFailure(responseCoupons.code()); 2011 + receiver.onFailure(responseCouponsets.code());
1954 } 2012 }
1955 } 2013 }
1956 2014
1957 @Override 2015 @Override
1958 - public void onFailure(@NonNull Call<ResponseBody> call, @NonNull Throwable t) { 2016 + public void onFailure(Call<ResponseBody> call, Throwable t) {
1959 LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel(); 2017 LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
1960 - dynatraceEvent.setEventName("custom_error_user_coupons_loyalty"); 2018 + dynatraceEvent.setEventName("custom_error_couponsets_sm_loyalty");
1961 EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent)); 2019 EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent));
1962 receiver.onFailure(2); 2020 receiver.onFailure(2);
1963 } 2021 }
...@@ -2305,6 +2363,7 @@ public class WarplyManager { ...@@ -2305,6 +2363,7 @@ public class WarplyManager {
2305 2363
2306 if (jCouponsetsBody != null && jCouponsBody != null) { 2364 if (jCouponsetsBody != null && jCouponsBody != null) {
2307 CouponList mCouponList = new CouponList(); 2365 CouponList mCouponList = new CouponList();
2366 + CouponList mCouponRedeemedList = new CouponList();
2308 CouponsetsList mCouponsetList = new CouponsetsList(); 2367 CouponsetsList mCouponsetList = new CouponsetsList();
2309 for (int i = 0; i < jCouponsetsBody.length(); ++i) { 2368 for (int i = 0; i < jCouponsetsBody.length(); ++i) {
2310 Couponset tempCouponset = new Couponset(jCouponsetsBody.optJSONObject(i)); 2369 Couponset tempCouponset = new Couponset(jCouponsetsBody.optJSONObject(i));
...@@ -2323,8 +2382,16 @@ public class WarplyManager { ...@@ -2323,8 +2382,16 @@ public class WarplyManager {
2323 } 2382 }
2324 } 2383 }
2325 } 2384 }
2385 +
2386 + for (int j = 0; j < jCouponsBody.length(); ++j) {
2387 + Coupon tempCoupon = new Coupon(jCouponsBody.optJSONObject(j));
2388 + if (tempCoupon.getStatus() == 0) {
2389 + mCouponRedeemedList.add(tempCoupon);
2390 + }
2391 + }
2326 WarplyManagerHelper.setCouponsets(mCouponsetList); 2392 WarplyManagerHelper.setCouponsets(mCouponsetList);
2327 WarplyManagerHelper.setCouponList(mCouponList); 2393 WarplyManagerHelper.setCouponList(mCouponList);
2394 + WarplyManagerHelper.setCouponRedeemedList(mCouponRedeemedList);
2328 2395
2329 CouponList mActiveCouponList = new CouponList(); 2396 CouponList mActiveCouponList = new CouponList();
2330 for (Coupon coupon : mCouponList) { 2397 for (Coupon coupon : mCouponList) {
...@@ -2469,6 +2536,47 @@ public class WarplyManager { ...@@ -2469,6 +2536,47 @@ public class WarplyManager {
2469 }); 2536 });
2470 } 2537 }
2471 2538
2539 + private static void getCouponsetsRetro(ApiService service, boolean isFiltered, Callback<ResponseBody> callback) {
2540 + String timeStamp = DateFormat.format("yyyy-MM-dd hh:mm:ss", System.currentTimeMillis()).toString();
2541 + String apiKey = WarpUtils.getApiKey(Warply.getWarplyContext());
2542 + String webId = WarpUtils.getWebId(Warply.getWarplyContext());
2543 +
2544 + Map<String, Object> jsonParamsCouponsets = new ArrayMap<>();
2545 + Map<String, Object> jsonParams = new ArrayMap<>();
2546 + jsonParams.put("action", "retrieve_multilingual");
2547 + jsonParams.put("active", true);
2548 + jsonParams.put("visible", true);
2549 + jsonParams.put("language", WarplyProperty.getLanguage(Warply.getWarplyContext()));
2550 + jsonParams.put("couponset_types", new JSONArray().put("supermarket"));
2551 +
2552 + jsonParamsCouponsets.put("coupon", jsonParams);
2553 + RequestBody couponsetsRequest = RequestBody.create(MediaType.get("application/json; charset=utf-8"), (new JSONObject(jsonParamsCouponsets)).toString());
2554 +
2555 + Call<ResponseBody> couponsetsCall = service.getCouponsets(
2556 + WarplyProperty.getAppUuid(Warply.getWarplyContext()),
2557 + couponsetsRequest,
2558 + timeStamp,
2559 + "android:" + Warply.getWarplyContext().getPackageName(),
2560 + new WarplyDeviceInfoCollector(Warply.getWarplyContext()).getUniqueDeviceId(),
2561 + "mobile",
2562 + webId,
2563 + WarpUtils.produceSignature(apiKey + timeStamp),
2564 + "Bearer " + WarplyDBHelper.getInstance(Warply.getWarplyContext()).getAuthValue("access_token")
2565 + );
2566 +
2567 + couponsetsCall.enqueue(new Callback<ResponseBody>() {
2568 + @Override
2569 + public void onResponse(@NonNull Call<ResponseBody> call, @NonNull Response<ResponseBody> response) {
2570 + callback.onResponse(call, response);
2571 + }
2572 +
2573 + @Override
2574 + public void onFailure(@NonNull Call<ResponseBody> call, @NonNull Throwable t) {
2575 + callback.onFailure(call, t);
2576 + }
2577 + });
2578 + }
2579 +
2472 private static void getUnifiedCouponsRetro(ApiService service, Callback<ResponseBody> callback) { 2580 private static void getUnifiedCouponsRetro(ApiService service, Callback<ResponseBody> callback) {
2473 String timeStamp = DateFormat.format("yyyy-MM-dd hh:mm:ss", System.currentTimeMillis()).toString(); 2581 String timeStamp = DateFormat.format("yyyy-MM-dd hh:mm:ss", System.currentTimeMillis()).toString();
2474 String apiKey = WarpUtils.getApiKey(Warply.getWarplyContext()); 2582 String apiKey = WarpUtils.getApiKey(Warply.getWarplyContext());
......