Panagiotis Triantafyllou

sm deals changes, cancel unified coupon

...@@ -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("7000000833"), //6012049321, 6012049322, 6012049323, 7000000831 history, 7000000826, 7000000831 shared coupons, prod 6006552990, prod 6005892749, live 3000184910 39 + .setGuid("7000000800"), //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.6rc76' 5 + PUBLISH_VERSION = '4.5.4.6rc77'
6 PUBLISH_ARTIFACT_ID = 'warply-android-sdk' 6 PUBLISH_ARTIFACT_ID = 'warply-android-sdk'
7 } 7 }
8 8
......
...@@ -6,11 +6,13 @@ import android.content.Intent; ...@@ -6,11 +6,13 @@ import android.content.Intent;
6 import android.graphics.Bitmap; 6 import android.graphics.Bitmap;
7 import android.graphics.Color; 7 import android.graphics.Color;
8 import android.os.Bundle; 8 import android.os.Bundle;
9 +import android.text.TextUtils;
9 import android.view.View; 10 import android.view.View;
10 import android.widget.ImageView; 11 import android.widget.ImageView;
11 import android.widget.LinearLayout; 12 import android.widget.LinearLayout;
12 import android.widget.TextView; 13 import android.widget.TextView;
13 14
15 +import androidx.appcompat.app.AlertDialog;
14 import androidx.core.content.ContextCompat; 16 import androidx.core.content.ContextCompat;
15 import androidx.core.text.HtmlCompat; 17 import androidx.core.text.HtmlCompat;
16 import androidx.recyclerview.widget.LinearLayoutManager; 18 import androidx.recyclerview.widget.LinearLayoutManager;
...@@ -22,6 +24,8 @@ import com.google.zxing.BarcodeFormat; ...@@ -22,6 +24,8 @@ import com.google.zxing.BarcodeFormat;
22 import com.google.zxing.common.BitMatrix; 24 import com.google.zxing.common.BitMatrix;
23 import com.google.zxing.oned.EAN13Writer; 25 import com.google.zxing.oned.EAN13Writer;
24 26
27 +import org.greenrobot.eventbus.EventBus;
28 +
25 import java.io.Serializable; 29 import java.io.Serializable;
26 import java.text.ParseException; 30 import java.text.ParseException;
27 import java.text.SimpleDateFormat; 31 import java.text.SimpleDateFormat;
...@@ -30,11 +34,15 @@ import java.util.Date; ...@@ -30,11 +34,15 @@ import java.util.Date;
30 34
31 import io.github.inflationx.viewpump.ViewPumpContextWrapper; 35 import io.github.inflationx.viewpump.ViewPumpContextWrapper;
32 import ly.warp.sdk.R; 36 import ly.warp.sdk.R;
37 +import ly.warp.sdk.io.callbacks.CallbackReceiver;
33 import ly.warp.sdk.io.models.Coupon; 38 import ly.warp.sdk.io.models.Coupon;
34 import ly.warp.sdk.io.models.CouponList; 39 import ly.warp.sdk.io.models.CouponList;
40 +import ly.warp.sdk.io.models.RefreshUnifiedCouponsEventModel;
35 import ly.warp.sdk.io.models.UnifiedCoupon; 41 import ly.warp.sdk.io.models.UnifiedCoupon;
36 import ly.warp.sdk.utils.WarplyManagerHelper; 42 import ly.warp.sdk.utils.WarplyManagerHelper;
37 import ly.warp.sdk.utils.managers.WarplyAnalyticsManager; 43 import ly.warp.sdk.utils.managers.WarplyAnalyticsManager;
44 +import ly.warp.sdk.utils.managers.WarplyEventBusManager;
45 +import ly.warp.sdk.utils.managers.WarplyManager;
38 import ly.warp.sdk.views.adapters.ActiveCouponAdapter; 46 import ly.warp.sdk.views.adapters.ActiveCouponAdapter;
39 47
40 48
...@@ -51,12 +59,14 @@ public class UnifiedCouponInfoActivity extends Activity implements View.OnClickL ...@@ -51,12 +59,14 @@ public class UnifiedCouponInfoActivity extends Activity implements View.OnClickL
51 private ImageView mIvBack, mIvBarcode, mIvMarketExpand; 59 private ImageView mIvBack, mIvBarcode, mIvMarketExpand;
52 private TextView mTvTerms, mTvCouponCode, mTvCouponDate, mTvMarketExpand, 60 private TextView mTvTerms, mTvCouponCode, mTvCouponDate, mTvMarketExpand,
53 mTvTermsValue, mTvFullBarcode, mTvActiveValue; 61 mTvTermsValue, mTvFullBarcode, mTvActiveValue;
54 - private LinearLayout mLlShops, mLlBarcodeContainer, mLlTerms, mLlMarketCoupons, mLlMarketExpand; 62 + private LinearLayout mLlShops, mLlBarcodeContainer, mLlTerms, mLlMarketCoupons, mLlMarketExpand,
63 + mLlCancelUnified;
55 private UnifiedCoupon mCoupon; 64 private UnifiedCoupon mCoupon;
56 private boolean mIsBarcodeShown = false, mIsTermsShown = false, mIsFromWallet = false, 65 private boolean mIsBarcodeShown = false, mIsTermsShown = false, mIsFromWallet = false,
57 mIsMarketExpand = true, mShopsPressed = false, mCouponPressed = false; 66 mIsMarketExpand = true, mShopsPressed = false, mCouponPressed = false;
58 private RecyclerView mRecyclerCoupons; 67 private RecyclerView mRecyclerCoupons;
59 private ActiveCouponAdapter mAdapterCoupons; 68 private ActiveCouponAdapter mAdapterCoupons;
69 + private AlertDialog mErrorAlertDialog, mSuccessAlertDialog, mAskCancelUnifiedAlertDialog;
60 70
61 // =========================================================== 71 // ===========================================================
62 // Methods for/from SuperClass/Interfaces 72 // Methods for/from SuperClass/Interfaces
...@@ -94,6 +104,7 @@ public class UnifiedCouponInfoActivity extends Activity implements View.OnClickL ...@@ -94,6 +104,7 @@ public class UnifiedCouponInfoActivity extends Activity implements View.OnClickL
94 mIvMarketExpand = findViewById(R.id.iv_market_expand); 104 mIvMarketExpand = findViewById(R.id.iv_market_expand);
95 mRecyclerCoupons = findViewById(R.id.rv_active_market_coupons); 105 mRecyclerCoupons = findViewById(R.id.rv_active_market_coupons);
96 mTvActiveValue = findViewById(R.id.textView14); 106 mTvActiveValue = findViewById(R.id.textView14);
107 + mLlCancelUnified = findViewById(R.id.ll_cancel_coupon);
97 mRecyclerCoupons.setNestedScrollingEnabled(false); 108 mRecyclerCoupons.setNestedScrollingEnabled(false);
98 mRecyclerCoupons.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false)); 109 mRecyclerCoupons.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false));
99 110
...@@ -155,6 +166,10 @@ public class UnifiedCouponInfoActivity extends Activity implements View.OnClickL ...@@ -155,6 +166,10 @@ public class UnifiedCouponInfoActivity extends Activity implements View.OnClickL
155 mIvMarketExpand.setImageDrawable(ContextCompat.getDrawable(this, R.drawable.ic_up_dark_new)); 166 mIvMarketExpand.setImageDrawable(ContextCompat.getDrawable(this, R.drawable.ic_up_dark_new));
156 mIsMarketExpand = true; 167 mIsMarketExpand = true;
157 } 168 }
169 + return;
170 + }
171 + if (view.getId() == R.id.ll_cancel_coupon) {
172 + askCancelUnifiedDialog();
158 } 173 }
159 } 174 }
160 175
...@@ -193,7 +208,8 @@ public class UnifiedCouponInfoActivity extends Activity implements View.OnClickL ...@@ -193,7 +208,8 @@ public class UnifiedCouponInfoActivity extends Activity implements View.OnClickL
193 cpnlist.add(cpn); 208 cpnlist.add(cpn);
194 } 209 }
195 210
196 - mTvActiveValue.setText(HtmlCompat.fromHtml(String.format(getString(R.string.cos_unified_subtitle), String.valueOf(activeValue)), HtmlCompat.FROM_HTML_MODE_COMPACT)); 211 +// mTvActiveValue.setText(HtmlCompat.fromHtml(String.format(getString(R.string.cos_unified_subtitle), String.valueOf(activeValue)), HtmlCompat.FROM_HTML_MODE_COMPACT));
212 + mTvActiveValue.setText(getString(R.string.cos_unified_subtitle2));
197 213
198 Collections.sort(cpnlist, (coupon1, coupon2) -> coupon1.getExpirationDate().compareTo(coupon2.getExpirationDate())); 214 Collections.sort(cpnlist, (coupon1, coupon2) -> coupon1.getExpirationDate().compareTo(coupon2.getExpirationDate()));
199 for (Coupon tempItem : cpnlist) { 215 for (Coupon tempItem : cpnlist) {
...@@ -234,6 +250,7 @@ public class UnifiedCouponInfoActivity extends Activity implements View.OnClickL ...@@ -234,6 +250,7 @@ public class UnifiedCouponInfoActivity extends Activity implements View.OnClickL
234 mLlShops.setOnClickListener(this); 250 mLlShops.setOnClickListener(this);
235 mLlTerms.setOnClickListener(this); 251 mLlTerms.setOnClickListener(this);
236 mLlMarketExpand.setOnClickListener(this); 252 mLlMarketExpand.setOnClickListener(this);
253 + mLlCancelUnified.setOnClickListener(this);
237 254
238 String tempCoupon = ""; 255 String tempCoupon = "";
239 int result = 0; 256 int result = 0;
...@@ -280,6 +297,72 @@ public class UnifiedCouponInfoActivity extends Activity implements View.OnClickL ...@@ -280,6 +297,72 @@ public class UnifiedCouponInfoActivity extends Activity implements View.OnClickL
280 } 297 }
281 } 298 }
282 299
300 + private void cancelUnified() {
301 + if (mCoupon.getCoupons() != null && mCoupon.getCoupons().size() == 0) return;
302 +
303 + String transactionID = mCoupon.getCoupons().get(0).getTransactionUuid();
304 +
305 + if (TextUtils.isEmpty(transactionID)) return;
306 +
307 + WarplyManager.cancelUnifiedCoupon(transactionID, mCancelUnifiedCallback);
308 + }
309 +
310 + private void askCancelUnifiedDialog() {
311 + if (!isFinishing()) {
312 + mAskCancelUnifiedAlertDialog = new AlertDialog.Builder(this)
313 + .setTitle(R.string.cos_dlg_cancel_unified_coupon_success_title)
314 + .setMessage(R.string.cos_dlg_cancel_unified_coupon_success_subtitle2)
315 + .setPositiveButton(R.string.cos_dlg_positive_button3, (dialogPositive, whichPositive) -> {
316 + cancelUnified();
317 + })
318 + .setNegativeButton(R.string.cos_dlg_negative_button4, (dialogNegative, whichNegative) -> {
319 + dialogNegative.dismiss();
320 + })
321 + .show();
322 + }
323 + }
324 +
325 + private void errorDialog() {
326 + if (!isFinishing()) {
327 + mErrorAlertDialog = new AlertDialog.Builder(this)
328 + .setTitle(R.string.cos_dlg_cancel_unified_coupon_success_title)
329 + .setMessage(R.string.cos_dlg_error_subtitle)
330 + .setPositiveButton(R.string.cos_dlg_positive_button2, (dialogPositive, whichPositive) -> {
331 + dialogPositive.dismiss();
332 + })
333 + .setCancelable(false)
334 + .show();
335 + }
336 + }
337 +
338 + private void successDialog() {
339 + if (!isFinishing()) {
340 + mSuccessAlertDialog = new AlertDialog.Builder(this)
341 + .setTitle(R.string.cos_dlg_cancel_unified_coupon_success_title)
342 + .setMessage(R.string.cos_dlg_cancel_unified_coupon_success_subtitle)
343 + .setPositiveButton(R.string.cos_dlg_positive_button2, (dialogPositive, whichPositive) -> {
344 + dialogPositive.dismiss();
345 + RefreshUnifiedCouponsEventModel couponsRefreshed = new RefreshUnifiedCouponsEventModel();
346 + EventBus.getDefault().post(new WarplyEventBusManager(couponsRefreshed));
347 + onBackPressed();
348 + })
349 + .setCancelable(false)
350 + .show();
351 + }
352 + }
353 +
354 + private final CallbackReceiver<Integer> mCancelUnifiedCallback = new CallbackReceiver<Integer>() {
355 + @Override
356 + public void onSuccess(Integer result) {
357 + successDialog();
358 + }
359 +
360 + @Override
361 + public void onFailure(int errorCode) {
362 + errorDialog();
363 + }
364 + };
365 +
283 // =========================================================== 366 // ===========================================================
284 // Inner and Anonymous Classes 367 // Inner and Anonymous Classes
285 // =========================================================== 368 // ===========================================================
......
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.models;
27 +
28 +
29 +/**
30 + * Created by Panagiotis Triantafyllou on 03-Oct-23.
31 + */
32 +
33 +public class RefreshUnifiedCouponsEventModel {
34 + private boolean success;
35 +
36 + public RefreshUnifiedCouponsEventModel() {
37 + this.success = true;
38 + }
39 +
40 + public boolean isSuccess() {
41 + return success;
42 + }
43 +
44 + public void setSuccess(boolean success) {
45 + this.success = success;
46 + }
47 +}
...@@ -102,6 +102,18 @@ public interface ApiService { ...@@ -102,6 +102,18 @@ public interface ApiService {
102 102
103 @Headers("Content-Type: application/json") 103 @Headers("Content-Type: application/json")
104 @POST("/oauth/{appUuid}/context") 104 @POST("/oauth/{appUuid}/context")
105 + Call<ResponseBody> cancelUnifiedCoupon(@Path("appUuid") String appUuid,
106 + @Body RequestBody request,
107 + @Header(WarpConstants.HEADER_DATE) String timeStamp,
108 + @Header(WarpConstants.HEADER_LOYALTY_BUNDLE_ID) String bundleId,
109 + @Header(WarpConstants.HEADER_UNIQUE_DEVICE_ID) String deviceId,
110 + @Header(WarpConstants.HEADER_CHANNEL) String channel,
111 + @Header(WarpConstants.HEADER_WEB_ID) String webId,
112 + @Header(WarpConstants.HEADER_SIGNATURE) String signature,
113 + @Header(WarpConstants.HEADER_AUTHORIZATION) String bearer);
114 +
115 + @Headers("Content-Type: application/json")
116 + @POST("/oauth/{appUuid}/context")
105 Call<ResponseBody> getTelematicsHistoy(@Path("appUuid") String appUuid, 117 Call<ResponseBody> getTelematicsHistoy(@Path("appUuid") String appUuid,
106 @Body RequestBody request, 118 @Body RequestBody request,
107 @Header(WarpConstants.HEADER_DATE) String timeStamp, 119 @Header(WarpConstants.HEADER_DATE) String timeStamp,
......
...@@ -14,6 +14,7 @@ import ly.warp.sdk.io.models.LoyaltySDKDynatraceEventModel; ...@@ -14,6 +14,7 @@ import ly.warp.sdk.io.models.LoyaltySDKDynatraceEventModel;
14 import ly.warp.sdk.io.models.LoyaltySDKFirebaseEventModel; 14 import ly.warp.sdk.io.models.LoyaltySDKFirebaseEventModel;
15 import ly.warp.sdk.io.models.LoyaltySDKSessionExpiredEventModel; 15 import ly.warp.sdk.io.models.LoyaltySDKSessionExpiredEventModel;
16 import ly.warp.sdk.io.models.QuestionnaireEventModel; 16 import ly.warp.sdk.io.models.QuestionnaireEventModel;
17 +import ly.warp.sdk.io.models.RefreshUnifiedCouponsEventModel;
17 import ly.warp.sdk.io.models.UnifiedCouponsEventModel; 18 import ly.warp.sdk.io.models.UnifiedCouponsEventModel;
18 import ly.warp.sdk.io.models.WarplyCCMSEnabledModel; 19 import ly.warp.sdk.io.models.WarplyCCMSEnabledModel;
19 import ly.warp.sdk.io.models.WarplyCouponsChangedEventModel; 20 import ly.warp.sdk.io.models.WarplyCouponsChangedEventModel;
...@@ -46,6 +47,7 @@ public class WarplyEventBusManager { ...@@ -46,6 +47,7 @@ public class WarplyEventBusManager {
46 private CouponsEventModel couponsAdded; 47 private CouponsEventModel couponsAdded;
47 48
48 private UnifiedCouponsEventModel unifiedCouponsAdded; 49 private UnifiedCouponsEventModel unifiedCouponsAdded;
50 + private RefreshUnifiedCouponsEventModel refreshUnifiedCouponsAdded;
49 private LoyaltyEventModel campaignsAdded; 51 private LoyaltyEventModel campaignsAdded;
50 private HealthEventModel healthAdded; 52 private HealthEventModel healthAdded;
51 private WarplyCouponsChangedEventModel couponsChanged; 53 private WarplyCouponsChangedEventModel couponsChanged;
...@@ -96,6 +98,10 @@ public class WarplyEventBusManager { ...@@ -96,6 +98,10 @@ public class WarplyEventBusManager {
96 this.unifiedCouponsAdded = unifiedCouponsAdded; 98 this.unifiedCouponsAdded = unifiedCouponsAdded;
97 } 99 }
98 100
101 + public WarplyEventBusManager(RefreshUnifiedCouponsEventModel refreshUnifiedCouponsAdded) {
102 + this.refreshUnifiedCouponsAdded = refreshUnifiedCouponsAdded;
103 + }
104 +
99 public WarplyEventBusManager(WarplyPacingCardEventModel widgetChanged) { 105 public WarplyEventBusManager(WarplyPacingCardEventModel widgetChanged) {
100 this.widgetChanged = widgetChanged; 106 this.widgetChanged = widgetChanged;
101 } 107 }
...@@ -238,6 +244,10 @@ public class WarplyEventBusManager { ...@@ -238,6 +244,10 @@ public class WarplyEventBusManager {
238 return unifiedCouponsAdded; 244 return unifiedCouponsAdded;
239 } 245 }
240 246
247 + public RefreshUnifiedCouponsEventModel getRefreshUnifiedCouponsAdded() {
248 + return refreshUnifiedCouponsAdded;
249 + }
250 +
241 public LoyaltyEventModel getCampaignsAdded() { 251 public LoyaltyEventModel getCampaignsAdded() {
242 return campaignsAdded; 252 return campaignsAdded;
243 } 253 }
......
...@@ -2027,6 +2027,56 @@ public class WarplyManager { ...@@ -2027,6 +2027,56 @@ public class WarplyManager {
2027 }); 2027 });
2028 } 2028 }
2029 2029
2030 + public static void cancelUnifiedCoupon(String transactionID, final CallbackReceiver<Integer> receiver) {
2031 + WarpUtils.log("************* WARPLY Cancel Unified Request ********************");
2032 + WarpUtils.log("[WARP Trace] WARPLY Cancel Unified Request is active");
2033 + WarpUtils.log("**************************************************");
2034 + ApiService service = ApiClient.getRetrofitInstance().create(ApiService.class);
2035 + cancelUnifiedCoupon(service, transactionID, new Callback<ResponseBody>() {
2036 + @Override
2037 + public void onResponse(Call<ResponseBody> call, Response<ResponseBody> response) {
2038 + if (response.code() == 200 && response.body() != null) {
2039 + JSONObject jobjResponse = null;
2040 + try {
2041 + jobjResponse = new JSONObject(response.body().string());
2042 + } catch (Exception e) {
2043 + LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
2044 + dynatraceEvent.setEventName("custom_error_cancel_unified_loyalty");
2045 + EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent));
2046 + e.printStackTrace();
2047 + }
2048 +
2049 + if (jobjResponse != null && jobjResponse.has("status") && jobjResponse.optInt("status", 2) == 1) {
2050 + LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
2051 + dynatraceEvent.setEventName("custom_success_cancel_unified_loyalty");
2052 + EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent));
2053 + Integer status = new Integer(jobjResponse.optInt("status", 2));
2054 + receiver.onSuccess(status);
2055 + } else {
2056 + LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
2057 + dynatraceEvent.setEventName("custom_error_cancel_unified_loyalty");
2058 + EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent));
2059 + receiver.onFailure(2);
2060 + }
2061 +
2062 + } else {
2063 + LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
2064 + dynatraceEvent.setEventName("custom_error_cancel_unified_loyalty");
2065 + EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent));
2066 + receiver.onFailure(response.code());
2067 + }
2068 + }
2069 +
2070 + @Override
2071 + public void onFailure(Call<ResponseBody> call, Throwable t) {
2072 + LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
2073 + dynatraceEvent.setEventName("custom_error_cancel_unified_loyalty");
2074 + EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent));
2075 + receiver.onFailure(2);
2076 + }
2077 + });
2078 + }
2079 +
2030 public static void getUnifiedCouponsDeals(final CallbackReceiver<ArrayList<UnifiedCoupon>> receiver) { 2080 public static void getUnifiedCouponsDeals(final CallbackReceiver<ArrayList<UnifiedCoupon>> receiver) {
2031 WarpUtils.log("************* WARPLY User Coupons Request ********************"); 2081 WarpUtils.log("************* WARPLY User Coupons Request ********************");
2032 WarpUtils.log("[WARP Trace] WARPLY User Coupons Request is active"); 2082 WarpUtils.log("[WARP Trace] WARPLY User Coupons Request is active");
...@@ -2997,6 +3047,44 @@ public class WarplyManager { ...@@ -2997,6 +3047,44 @@ public class WarplyManager {
2997 }); 3047 });
2998 } 3048 }
2999 3049
3050 + private static void cancelUnifiedCoupon(ApiService service, String transactionID, Callback<ResponseBody> callback) {
3051 + String timeStamp = DateFormat.format("yyyy-MM-dd hh:mm:ss", System.currentTimeMillis()).toString();
3052 + String apiKey = WarpUtils.getApiKey(Warply.getWarplyContext());
3053 + String webId = WarpUtils.getWebId(Warply.getWarplyContext());
3054 +
3055 + Map<String, Object> jsonParamsUnified = new ArrayMap<>();
3056 + Map<String, Object> jsonParams = new ArrayMap<>();
3057 + jsonParams.put("action", "cancel_unified_coupon");
3058 + jsonParams.put("transaction_id", transactionID);
3059 +
3060 + jsonParamsUnified.put("coupon", jsonParams);
3061 + RequestBody cancelUnifiedDataRequest = RequestBody.create(MediaType.get("application/json; charset=utf-8"), (new JSONObject(jsonParamsUnified)).toString());
3062 +
3063 + Call<ResponseBody> telematicsCall = service.cancelUnifiedCoupon(
3064 + WarplyProperty.getAppUuid(Warply.getWarplyContext()),
3065 + cancelUnifiedDataRequest,
3066 + timeStamp,
3067 + "android:" + Warply.getWarplyContext().getPackageName(),
3068 + new WarplyDeviceInfoCollector(Warply.getWarplyContext()).getUniqueDeviceId(),
3069 + "mobile",
3070 + webId,
3071 + WarpUtils.produceSignature(apiKey + timeStamp),
3072 + "Bearer " + WarplyDBHelper.getInstance(Warply.getWarplyContext()).getAuthValue("access_token")
3073 + );
3074 +
3075 + telematicsCall.enqueue(new Callback<ResponseBody>() {
3076 + @Override
3077 + public void onResponse(@NonNull Call<ResponseBody> call, @NonNull Response<ResponseBody> response) {
3078 + callback.onResponse(call, response);
3079 + }
3080 +
3081 + @Override
3082 + public void onFailure(@NonNull Call<ResponseBody> call, @NonNull Throwable t) {
3083 + callback.onFailure(call, t);
3084 + }
3085 + });
3086 + }
3087 +
3000 private static void getTelematicsHistory(ApiService service, Callback<ResponseBody> callback) { 3088 private static void getTelematicsHistory(ApiService service, Callback<ResponseBody> callback) {
3001 String timeStamp = DateFormat.format("yyyy-MM-dd hh:mm:ss", System.currentTimeMillis()).toString(); 3089 String timeStamp = DateFormat.format("yyyy-MM-dd hh:mm:ss", System.currentTimeMillis()).toString();
3002 String apiKey = WarpUtils.getApiKey(Warply.getWarplyContext()); 3090 String apiKey = WarpUtils.getApiKey(Warply.getWarplyContext());
......
...@@ -125,9 +125,9 @@ public class MarketCouponAdapter extends RecyclerView.Adapter<MarketCouponAdapte ...@@ -125,9 +125,9 @@ public class MarketCouponAdapter extends RecyclerView.Adapter<MarketCouponAdapte
125 } 125 }
126 126
127 if (count > 1) { 127 if (count > 1) {
128 - holder.tvCouponCount.setText(String.format(mContext.getString(R.string.cos_market_active_coupons), String.valueOf(count), String.valueOf(activeValue))); 128 + holder.tvCouponCount.setText(String.format(mContext.getString(R.string.cos_market_active_coupons2), String.valueOf(count)));
129 } else if (count == 1) { 129 } else if (count == 1) {
130 - holder.tvCouponCount.setText(String.format(mContext.getString(R.string.cos_market_active_coupons_single), String.valueOf(count), String.valueOf(activeValue))); 130 + holder.tvCouponCount.setText(String.format(mContext.getString(R.string.cos_market_active_coupons_single2), String.valueOf(count)));
131 } 131 }
132 132
133 133
......
...@@ -219,7 +219,7 @@ ...@@ -219,7 +219,7 @@
219 219
220 <LinearLayout 220 <LinearLayout
221 android:id="@+id/ll_shops" 221 android:id="@+id/ll_shops"
222 - android:layout_width="220dp" 222 + android:layout_width="260dp"
223 android:layout_height="55dp" 223 android:layout_height="55dp"
224 android:layout_gravity="center" 224 android:layout_gravity="center"
225 android:layout_marginHorizontal="32dp" 225 android:layout_marginHorizontal="32dp"
...@@ -240,6 +240,29 @@ ...@@ -240,6 +240,29 @@
240 android:textSize="16sp" /> 240 android:textSize="16sp" />
241 </LinearLayout> 241 </LinearLayout>
242 242
243 + <LinearLayout
244 + android:id="@+id/ll_cancel_coupon"
245 + android:layout_width="260dp"
246 + android:layout_height="55dp"
247 + android:layout_gravity="center"
248 + android:layout_marginHorizontal="32dp"
249 + android:layout_marginTop="20dp"
250 + android:background="@drawable/selector_button_green_border"
251 + android:gravity="center"
252 + android:orientation="horizontal"
253 + android:paddingVertical="8dp">
254 +
255 + <TextView
256 + fontPath="fonts/PeridotPE-SemiBold.ttf"
257 + android:layout_width="wrap_content"
258 + android:layout_height="wrap_content"
259 + android:gravity="center"
260 + android:includeFontPadding="false"
261 + android:text="@string/cos_cancel_unified_coupon"
262 + android:textColor="@color/cos_green12"
263 + android:textSize="16sp" />
264 + </LinearLayout>
265 +
243 <RelativeLayout 266 <RelativeLayout
244 android:id="@+id/rl_terms" 267 android:id="@+id/rl_terms"
245 android:layout_width="wrap_content" 268 android:layout_width="wrap_content"
......
...@@ -156,8 +156,11 @@ ...@@ -156,8 +156,11 @@
156 <string name="cos_market_item_title">COSMOTE\nSUPERMARKET\nDEALS</string> 156 <string name="cos_market_item_title">COSMOTE\nSUPERMARKET\nDEALS</string>
157 <string name="cos_market_active_coupons">έχεις %1$s ενεργά κουπόνια αξίας %2$s€</string> 157 <string name="cos_market_active_coupons">έχεις %1$s ενεργά κουπόνια αξίας %2$s€</string>
158 <string name="cos_market_active_coupons_single">έχεις %1$s ενεργό κουπόνι αξίας %2$s€</string> 158 <string name="cos_market_active_coupons_single">έχεις %1$s ενεργό κουπόνι αξίας %2$s€</string>
159 + <string name="cos_market_active_coupons2">έχεις %1$s ενεργά κουπόνια</string>
160 + <string name="cos_market_active_coupons_single2">έχεις %1$s ενεργό κουπόνι</string>
159 <string name="cos_unified_title">Εκπτωτικό κουπόνι COSMOTE SUPERMARKET DEALS!</string> 161 <string name="cos_unified_title">Εκπτωτικό κουπόνι COSMOTE SUPERMARKET DEALS!</string>
160 <string name="cos_unified_subtitle">Χρησιμοποίησε τον παρακάτω κωδικό και πάρε έκπτωση στα ενεργά κουπόνια προσφορών αξίας <![CDATA[<b>%1$s€</b>]]>.</string> 162 <string name="cos_unified_subtitle">Χρησιμοποίησε τον παρακάτω κωδικό και πάρε έκπτωση στα ενεργά κουπόνια προσφορών αξίας <![CDATA[<b>%1$s€</b>]]>.</string>
163 + <string name="cos_unified_subtitle2">Χρησιμοποίησε τον παρακάτω κωδικό και πάρε έκπτωση στα ενεργά κουπόνια προσφορών.</string>
161 <string name="cos_markets">Δες τα supermarket</string> 164 <string name="cos_markets">Δες τα supermarket</string>
162 <string name="cos_show_market_coupons">Εμφάνιση προσφορών</string> 165 <string name="cos_show_market_coupons">Εμφάνιση προσφορών</string>
163 <string name="cos_hide_market_coupons">Απόκρυψη προσφορών</string> 166 <string name="cos_hide_market_coupons">Απόκρυψη προσφορών</string>
...@@ -189,6 +192,12 @@ ...@@ -189,6 +192,12 @@
189 <string name="cos_telematics_history_analysis_rate">Αξιολογήστε την ανάλυση</string> 192 <string name="cos_telematics_history_analysis_rate">Αξιολογήστε την ανάλυση</string>
190 <string name="lbl_telematics_no_location">Για να ξεκινήσετε θα πρέπει να ενεργοποιήσετε την τοποθεσία σας</string> 193 <string name="lbl_telematics_no_location">Για να ξεκινήσετε θα πρέπει να ενεργοποιήσετε την τοποθεσία σας</string>
191 <string name="lbl_telematics_generic_error">Άγνωστο σφάλμα</string> 194 <string name="lbl_telematics_generic_error">Άγνωστο σφάλμα</string>
195 + <string name="cos_cancel_unified_coupon">Ακύρωση ενιαίου κουπονιού</string>
196 + <string name="cos_dlg_cancel_unified_coupon_success_title">Ακύρωση Κουπονιού</string>
197 + <string name="cos_dlg_cancel_unified_coupon_success_subtitle">Το ενιαίο κουπόνι σου ακυρώθηκε επιτυχώς. Βρες τα μεμονωμένα κουπόνια στο καλάθι SM deals.</string>
198 + <string name="cos_dlg_cancel_unified_coupon_success_subtitle2">Είσαι σίγουρος ότι θέλεις να ακυρώσεις το κουπόνι σου;</string>
199 + <string name="cos_dlg_negative_button4">Όχι</string>
200 + <string name="cos_dlg_positive_button3">Ναι</string>
192 201
193 <string-array name="coupons_array"> 202 <string-array name="coupons_array">
194 <item>Κουπόνια</item> 203 <item>Κουπόνια</item>
......