Panagiotis Triantafyllou

session changes, small fixes

......@@ -36,7 +36,7 @@ public class SplashActivity extends BaseActivity {
public void onWarplyReady() {
if (!WarplyDBHelper.getInstance(SplashActivity.this).isTableNotEmpty("auth")) {
WarplyManager.getCosmoteUser(new WarplyCosmoteUserRequest()
.setGuid("6005892749"), //6012049321, 6012049322, 6012049323, 7000000831 history, 7000000826, 7000000831 shared coupons, prod 6006552990, prod 6005892749, live 3000184910
.setGuid("6010490808"), //6012049321, 6012049322, 6012049323, 7000000831 history, 7000000826, 7000000831 shared coupons, prod 6006552990, prod 6005892749, live 3000184910
mLoginReceiver);
} else {
startNextActivity();
......
......@@ -2,7 +2,7 @@ apply plugin: 'com.android.library'
ext {
PUBLISH_GROUP_ID = 'ly.warp'
PUBLISH_VERSION = '4.5.4.6rc36'
PUBLISH_VERSION = '4.5.4.6rc37'
PUBLISH_ARTIFACT_ID = 'warply-android-sdk'
}
......
......@@ -298,6 +298,7 @@ public class LoyaltyAnalysisActivity extends Activity implements View.OnClickLis
SharingCoupon newShCoupon = new SharingCoupon();
newShCoupon = shCoupon;
newShCoupon.setName(cpnset.getName());
newShCoupon.setFinal_price(cpnset.getFinal_price());
mSharedCoupons.add(newShCoupon);
break;
}
......
/*
* Copyright 2010-2013 Warply Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE WARPLY LTD ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
* EVENT SHALL WARPLY LTD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package ly.warp.sdk.io.models;
/**
* Created by Panagiotis Triantafyllou on 13-Jan-23.
*/
public class LoyaltySDKSessionExpiredEventModel {
private boolean sessionExpired;
public LoyaltySDKSessionExpiredEventModel() {
this.sessionExpired = true;
}
public boolean isLoyaltySessionExpired() {
return sessionExpired;
}
public void setLoyaltySessionExpired(boolean sessionExpired) {
this.sessionExpired = sessionExpired;
}
}
......@@ -53,6 +53,7 @@ public class SharingCoupon implements Parcelable, Serializable {
private static final String COUPONSET_UUID = "couponset_uuid";
private static final String NAME = "name";
private static final String MERCHANT_UUID = "merchant_uuid";
private static final String FINAL_PRICE = "final_price";
/* Member variables of the Campaign object */
......@@ -63,6 +64,7 @@ public class SharingCoupon implements Parcelable, Serializable {
private String couponsetUuid = "";
private String name = "";
private String merchantUuid = "";
private double final_price = 0.0d;
/**
* Basic constructor used to create an object from a String, representing a
......@@ -82,6 +84,7 @@ public class SharingCoupon implements Parcelable, Serializable {
this.date = "";
this.couponsetUuid = "";
this.name = "";
this.final_price = 0.0d;
}
/**
......@@ -98,6 +101,7 @@ public class SharingCoupon implements Parcelable, Serializable {
this.transactionMetadata = json.optString(TRANSACTION_METADATA);
this.name = json.optString(NAME);
this.merchantUuid = json.optString(MERCHANT_UUID);
this.final_price = json.optDouble(FINAL_PRICE);
}
}
......@@ -109,6 +113,7 @@ public class SharingCoupon implements Parcelable, Serializable {
this.transactionMetadata = source.readString();
this.name = source.readString();
this.merchantUuid = source.readString();
this.final_price = source.readDouble();
}
@Override
......@@ -120,6 +125,7 @@ public class SharingCoupon implements Parcelable, Serializable {
dest.writeString(this.transactionMetadata);
dest.writeString(this.name);
dest.writeString(this.merchantUuid);
dest.writeDouble(this.final_price);
}
/**
......@@ -137,6 +143,7 @@ public class SharingCoupon implements Parcelable, Serializable {
jObj.putOpt(TRANSACTION_METADATA, this.transactionMetadata);
jObj.putOpt(NAME, this.name);
jObj.putOpt(MERCHANT_UUID, this.merchantUuid);
jObj.putOpt(FINAL_PRICE, this.final_price);
} catch (JSONException e) {
if (WarpConstants.DEBUG) {
e.printStackTrace();
......@@ -232,6 +239,14 @@ public class SharingCoupon implements Parcelable, Serializable {
this.merchantUuid = merchantUuid;
}
public double getFinal_price() {
return final_price;
}
public void setFinal_price(double final_price) {
this.final_price = final_price;
}
@Override
public int describeContents() {
return 0;
......
......@@ -12,6 +12,7 @@ import ly.warp.sdk.io.models.LoyaltyEventModel;
import ly.warp.sdk.io.models.LoyaltyGiftsForYouOfferClickEvent;
import ly.warp.sdk.io.models.LoyaltySDKDynatraceEventModel;
import ly.warp.sdk.io.models.LoyaltySDKFirebaseEventModel;
import ly.warp.sdk.io.models.LoyaltySDKSessionExpiredEventModel;
import ly.warp.sdk.io.models.QuestionnaireEventModel;
import ly.warp.sdk.io.models.WarplyCCMSEnabledModel;
import ly.warp.sdk.io.models.WarplyCouponsChangedEventModel;
......@@ -43,6 +44,7 @@ public class WarplyEventBusManager {
private HealthEventModel healthAdded;
private WarplyCouponsChangedEventModel couponsChanged;
private WarplyPacingCardEventModel widgetChanged;
private LoyaltySDKSessionExpiredEventModel sessionExpired;
public WarplyEventBusManager() {
......@@ -60,6 +62,10 @@ public class WarplyEventBusManager {
this.ccmsAdded = ccmsAdded;
}
public WarplyEventBusManager (LoyaltySDKSessionExpiredEventModel sessionExpired) {
this.sessionExpired = sessionExpired;
}
public WarplyEventBusManager(CouponsEventModel couponsAdded) {
this.couponsAdded = couponsAdded;
}
......@@ -217,4 +223,8 @@ public class WarplyEventBusManager {
public WarplyPacingCardEventModel getWidgetChanged() {
return widgetChanged;
}
public LoyaltySDKSessionExpiredEventModel isLoyaltySessionExpired() {
return sessionExpired;
}
}
......
......@@ -87,6 +87,7 @@ import ly.warp.sdk.io.models.CouponList;
import ly.warp.sdk.io.models.Couponset;
import ly.warp.sdk.io.models.CouponsetsList;
import ly.warp.sdk.io.models.LoyaltySDKDynatraceEventModel;
import ly.warp.sdk.io.models.LoyaltySDKSessionExpiredEventModel;
import ly.warp.sdk.io.models.Merchant;
import ly.warp.sdk.io.models.MerchantCategoriesList;
import ly.warp.sdk.io.models.MerchantList;
......@@ -543,21 +544,31 @@ public class WarplyManager {
@Override
public void onFailure(int errorCode) {
if (errorCode == 401) {
refreshToken(new WarplyRefreshTokenRequest(), new CallbackReceiver<JSONObject>() {
@Override
public void onSuccess(JSONObject result) {
int status = result.optInt("status", 2);
if (status == 1)
getConsumer(request, receiver);
else
receiver.onFailure(status);
}
// refreshToken(new WarplyRefreshTokenRequest(), new CallbackReceiver<JSONObject>() {
// @Override
// public void onSuccess(JSONObject result) {
// int status = result.optInt("status", 2);
// if (status == 1)
// getConsumer(request, receiver);
// else
// receiver.onFailure(status);
// }
//
// @Override
// public void onFailure(int errorCode) {
// receiver.onFailure(errorCode);
// }
// });
LoyaltySDKSessionExpiredEventModel sessionExpired = new LoyaltySDKSessionExpiredEventModel();
sessionExpired.setLoyaltySessionExpired(true);
EventBus.getDefault().post(new WarplyEventBusManager(sessionExpired));
LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
dynatraceEvent.setEventName("custom_error_profile_loyalty");
EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent));
@Override
public void onFailure(int errorCode) {
receiver.onFailure(errorCode);
}
});
} else {
LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
dynatraceEvent.setEventName("custom_error_profile_loyalty");
......@@ -975,21 +986,30 @@ public class WarplyManager {
@Override
public void onFailure(int errorCode) {
if (errorCode == 401) {
refreshToken(new WarplyRefreshTokenRequest(), new CallbackReceiver<JSONObject>() {
@Override
public void onSuccess(JSONObject result) {
int status = result.optInt("status", 2);
if (status == 1)
getUserCoupons(request, receiver);
else
receiver.onFailure(status);
}
// refreshToken(new WarplyRefreshTokenRequest(), new CallbackReceiver<JSONObject>() {
// @Override
// public void onSuccess(JSONObject result) {
// int status = result.optInt("status", 2);
// if (status == 1)
// getUserCoupons(request, receiver);
// else
// receiver.onFailure(status);
// }
//
// @Override
// public void onFailure(int errorCode) {
// receiver.onFailure(errorCode);
// }
// });
@Override
public void onFailure(int errorCode) {
LoyaltySDKSessionExpiredEventModel sessionExpired = new LoyaltySDKSessionExpiredEventModel();
sessionExpired.setLoyaltySessionExpired(true);
EventBus.getDefault().post(new WarplyEventBusManager(sessionExpired));
LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
dynatraceEvent.setEventName("custom_error_user_coupons_loyalty");
EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent));
receiver.onFailure(errorCode);
}
});
} else {
LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
dynatraceEvent.setEventName("custom_error_user_coupons_loyalty");
......@@ -1421,21 +1441,30 @@ public class WarplyManager {
@Override
public void onFailure(int errorCode) {
if (errorCode == 401) {
refreshToken(new WarplyRefreshTokenRequest(), new CallbackReceiver<JSONObject>() {
@Override
public void onSuccess(JSONObject result) {
int status = result.optInt("status", 2);
if (status == 1)
redeemCoupon(request, receiver);
else
receiver.onFailure(status);
}
// refreshToken(new WarplyRefreshTokenRequest(), new CallbackReceiver<JSONObject>() {
// @Override
// public void onSuccess(JSONObject result) {
// int status = result.optInt("status", 2);
// if (status == 1)
// redeemCoupon(request, receiver);
// else
// receiver.onFailure(status);
// }
//
// @Override
// public void onFailure(int errorCode) {
// receiver.onFailure(errorCode);
// }
// });
@Override
public void onFailure(int errorCode) {
LoyaltySDKSessionExpiredEventModel sessionExpired = new LoyaltySDKSessionExpiredEventModel();
sessionExpired.setLoyaltySessionExpired(true);
EventBus.getDefault().post(new WarplyEventBusManager(sessionExpired));
LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
dynatraceEvent.setEventName("custom_error_retrieve_coupon_loyalty");
EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent));
receiver.onFailure(errorCode);
}
});
} else {
LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
dynatraceEvent.setEventName("custom_error_retrieve_coupon_loyalty");
......@@ -1610,21 +1639,30 @@ public class WarplyManager {
@Override
public void onFailure(int errorCode) {
if (errorCode == 401) {
refreshToken(new WarplyRefreshTokenRequest(), new CallbackReceiver<JSONObject>() {
@Override
public void onSuccess(JSONObject result) {
int status = result.optInt("status", 2);
if (status == 1)
getCampaignsPersonalized(request, receiver);
else
receiver.onFailure(status);
}
// refreshToken(new WarplyRefreshTokenRequest(), new CallbackReceiver<JSONObject>() {
// @Override
// public void onSuccess(JSONObject result) {
// int status = result.optInt("status", 2);
// if (status == 1)
// getCampaignsPersonalized(request, receiver);
// else
// receiver.onFailure(status);
// }
//
// @Override
// public void onFailure(int errorCode) {
// receiver.onFailure(errorCode);
// }
// });
@Override
public void onFailure(int errorCode) {
LoyaltySDKSessionExpiredEventModel sessionExpired = new LoyaltySDKSessionExpiredEventModel();
sessionExpired.setLoyaltySessionExpired(true);
EventBus.getDefault().post(new WarplyEventBusManager(sessionExpired));
LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
dynatraceEvent.setEventName("custom_error_campaigns_personalized_loyalty");
EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent));
receiver.onFailure(errorCode);
}
});
} else {
LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
dynatraceEvent.setEventName("custom_error_campaigns_personalized_loyalty");
......@@ -1661,21 +1699,30 @@ public class WarplyManager {
@Override
public void onFailure(int errorCode) {
if (errorCode == 401) {
refreshToken(new WarplyRefreshTokenRequest(), new CallbackReceiver<JSONObject>() {
@Override
public void onSuccess(JSONObject result) {
int status = result.optInt("status", 2);
if (status == 1)
consumerIntegration(request, receiver);
else
receiver.onFailure(status);
}
// refreshToken(new WarplyRefreshTokenRequest(), new CallbackReceiver<JSONObject>() {
// @Override
// public void onSuccess(JSONObject result) {
// int status = result.optInt("status", 2);
// if (status == 1)
// consumerIntegration(request, receiver);
// else
// receiver.onFailure(status);
// }
//
// @Override
// public void onFailure(int errorCode) {
// receiver.onFailure(errorCode);
// }
// });
@Override
public void onFailure(int errorCode) {
LoyaltySDKSessionExpiredEventModel sessionExpired = new LoyaltySDKSessionExpiredEventModel();
sessionExpired.setLoyaltySessionExpired(true);
EventBus.getDefault().post(new WarplyEventBusManager(sessionExpired));
LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
dynatraceEvent.setEventName("custom_error_customer_state_loyalty");
EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent));
receiver.onFailure(errorCode);
}
});
} else {
LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
dynatraceEvent.setEventName("custom_error_customer_state_loyalty");
......@@ -1711,21 +1758,30 @@ public class WarplyManager {
@Override
public void onFailure(int errorCode) {
if (errorCode == 401) {
refreshToken(new WarplyRefreshTokenRequest(), new CallbackReceiver<JSONObject>() {
@Override
public void onSuccess(JSONObject result) {
int status = result.optInt("status", 2);
if (status == 1)
cosmoteSharing(request, receiver);
else
receiver.onFailure(status);
}
// refreshToken(new WarplyRefreshTokenRequest(), new CallbackReceiver<JSONObject>() {
// @Override
// public void onSuccess(JSONObject result) {
// int status = result.optInt("status", 2);
// if (status == 1)
// cosmoteSharing(request, receiver);
// else
// receiver.onFailure(status);
// }
//
// @Override
// public void onFailure(int errorCode) {
// receiver.onFailure(errorCode);
// }
// });
@Override
public void onFailure(int errorCode) {
LoyaltySDKSessionExpiredEventModel sessionExpired = new LoyaltySDKSessionExpiredEventModel();
sessionExpired.setLoyaltySessionExpired(true);
EventBus.getDefault().post(new WarplyEventBusManager(sessionExpired));
LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
dynatraceEvent.setEventName("custom_error_sharing_loyalty");
EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent));
receiver.onFailure(errorCode);
}
});
} else {
LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
dynatraceEvent.setEventName("custom_error_sharing_loyalty");
......@@ -1761,21 +1817,30 @@ public class WarplyManager {
@Override
public void onFailure(int errorCode) {
if (errorCode == 401) {
refreshToken(new WarplyRefreshTokenRequest(), new CallbackReceiver<JSONObject>() {
@Override
public void onSuccess(JSONObject result) {
int status = result.optInt("status", 2);
if (status == 1)
cosmoteRetrieveSharing(request, receiver);
else
receiver.onFailure(status);
}
// refreshToken(new WarplyRefreshTokenRequest(), new CallbackReceiver<JSONObject>() {
// @Override
// public void onSuccess(JSONObject result) {
// int status = result.optInt("status", 2);
// if (status == 1)
// cosmoteRetrieveSharing(request, receiver);
// else
// receiver.onFailure(status);
// }
//
// @Override
// public void onFailure(int errorCode) {
// receiver.onFailure(errorCode);
// }
// });
@Override
public void onFailure(int errorCode) {
LoyaltySDKSessionExpiredEventModel sessionExpired = new LoyaltySDKSessionExpiredEventModel();
sessionExpired.setLoyaltySessionExpired(true);
EventBus.getDefault().post(new WarplyEventBusManager(sessionExpired));
LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
dynatraceEvent.setEventName("custom_error_retrieve_sharing_loyalty");
EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent));
receiver.onFailure(errorCode);
}
});
} else {
LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
dynatraceEvent.setEventName("custom_error_retrieve_sharing_loyalty");
......@@ -1816,21 +1881,30 @@ public class WarplyManager {
@Override
public void onFailure(int errorCode) {
if (errorCode == 401) {
refreshToken(new WarplyRefreshTokenRequest(), new CallbackReceiver<JSONObject>() {
@Override
public void onSuccess(JSONObject result) {
int status = result.optInt("status", 2);
if (status == 1)
getPacingDetails(request, receiver);
else
receiver.onFailure(status);
}
// refreshToken(new WarplyRefreshTokenRequest(), new CallbackReceiver<JSONObject>() {
// @Override
// public void onSuccess(JSONObject result) {
// int status = result.optInt("status", 2);
// if (status == 1)
// getPacingDetails(request, receiver);
// else
// receiver.onFailure(status);
// }
//
// @Override
// public void onFailure(int errorCode) {
// receiver.onFailure(errorCode);
// }
// });
@Override
public void onFailure(int errorCode) {
LoyaltySDKSessionExpiredEventModel sessionExpired = new LoyaltySDKSessionExpiredEventModel();
sessionExpired.setLoyaltySessionExpired(true);
EventBus.getDefault().post(new WarplyEventBusManager(sessionExpired));
LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
dynatraceEvent.setEventName("custom_error_pacing_loyalty");
EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent));
receiver.onFailure(errorCode);
}
});
} else {
LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
dynatraceEvent.setEventName("custom_error_pacing_loyalty");
......@@ -1867,21 +1941,30 @@ public class WarplyManager {
@Override
public void onFailure(int errorCode) {
if (errorCode == 401) {
refreshToken(new WarplyRefreshTokenRequest(), new CallbackReceiver<JSONObject>() {
@Override
public void onSuccess(JSONObject result) {
int status = result.optInt("status", 2);
if (status == 1)
cosmoteCouponSharing(request, receiver);
else
receiver.onFailure(status);
}
// refreshToken(new WarplyRefreshTokenRequest(), new CallbackReceiver<JSONObject>() {
// @Override
// public void onSuccess(JSONObject result) {
// int status = result.optInt("status", 2);
// if (status == 1)
// cosmoteCouponSharing(request, receiver);
// else
// receiver.onFailure(status);
// }
//
// @Override
// public void onFailure(int errorCode) {
// receiver.onFailure(errorCode);
// }
// });
@Override
public void onFailure(int errorCode) {
LoyaltySDKSessionExpiredEventModel sessionExpired = new LoyaltySDKSessionExpiredEventModel();
sessionExpired.setLoyaltySessionExpired(true);
EventBus.getDefault().post(new WarplyEventBusManager(sessionExpired));
LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
dynatraceEvent.setEventName("custom_error_coupon_sharing_loyalty");
EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent));
receiver.onFailure(errorCode);
}
});
} else {
LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
dynatraceEvent.setEventName("custom_error_coupon_sharing_loyalty");
......@@ -1954,21 +2037,30 @@ public class WarplyManager {
@Override
public void onFailure(int errorCode) {
if (errorCode == 401) {
refreshToken(new WarplyRefreshTokenRequest(), new CallbackReceiver<JSONObject>() {
@Override
public void onSuccess(JSONObject result) {
int status = result.optInt("status", 2);
if (status == 1)
getUserCoupons(request, receiver);
else
receiver.onFailure(status);
}
// refreshToken(new WarplyRefreshTokenRequest(), new CallbackReceiver<JSONObject>() {
// @Override
// public void onSuccess(JSONObject result) {
// int status = result.optInt("status", 2);
// if (status == 1)
// getUserCoupons(request, receiver);
// else
// receiver.onFailure(status);
// }
//
// @Override
// public void onFailure(int errorCode) {
// receiver.onFailure(errorCode);
// }
// });
@Override
public void onFailure(int errorCode) {
LoyaltySDKSessionExpiredEventModel sessionExpired = new LoyaltySDKSessionExpiredEventModel();
sessionExpired.setLoyaltySessionExpired(true);
EventBus.getDefault().post(new WarplyEventBusManager(sessionExpired));
LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
dynatraceEvent.setEventName("custom_error_user_coupons_loyalty");
EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent));
receiver.onFailure(errorCode);
}
});
} else
receiver.onFailure(errorCode);
}
......@@ -2141,6 +2233,15 @@ public class WarplyManager {
EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent));
receiver.onFailure(2);
}
} else if (responseCoupons.code() == 401) {
LoyaltySDKSessionExpiredEventModel sessionExpired = new LoyaltySDKSessionExpiredEventModel();
sessionExpired.setLoyaltySessionExpired(true);
EventBus.getDefault().post(new WarplyEventBusManager(sessionExpired));
LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
dynatraceEvent.setEventName("custom_error_user_coupons_loyalty");
EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent));
receiver.onFailure(responseCoupons.code());
} else {
LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
dynatraceEvent.setEventName("custom_error_user_coupons_loyalty");
......@@ -2323,21 +2424,23 @@ public class WarplyManager {
@Override
public void onResponse(@NonNull Call<ResponseBody> call, @NonNull Response<ResponseBody> response) {
if (response.code() == 401) {
refreshToken(new WarplyRefreshTokenRequest(), new CallbackReceiver<JSONObject>() {
@Override
public void onSuccess(JSONObject result) {
int status = result.optInt("status", 2);
if (status == 1)
getUserCouponsRetro(service, callback);
else
callback.onFailure(call, new Throwable());
}
// refreshToken(new WarplyRefreshTokenRequest(), new CallbackReceiver<JSONObject>() {
// @Override
// public void onSuccess(JSONObject result) {
// int status = result.optInt("status", 2);
// if (status == 1)
// getUserCouponsRetro(service, callback);
// else
// callback.onFailure(call, new Throwable());
// }
//
// @Override
// public void onFailure(int errorCode) {
// callback.onFailure(call, new Throwable());
// }
// });
@Override
public void onFailure(int errorCode) {
callback.onFailure(call, new Throwable());
}
});
callback.onResponse(call, response);
} else {
callback.onResponse(call, response);
}
......@@ -2468,21 +2571,30 @@ public class WarplyManager {
@Override
public void onFailure(int errorCode) {
if (errorCode == 401) {
refreshToken(new WarplyRefreshTokenRequest(), new CallbackReceiver<JSONObject>() {
@Override
public void onSuccess(JSONObject result) {
int status = result.optInt("status", 2);
if (status == 1)
submitOrder(request, receiver);
else
receiver.onFailure(status);
}
// refreshToken(new WarplyRefreshTokenRequest(), new CallbackReceiver<JSONObject>() {
// @Override
// public void onSuccess(JSONObject result) {
// int status = result.optInt("status", 2);
// if (status == 1)
// submitOrder(request, receiver);
// else
// receiver.onFailure(status);
// }
//
// @Override
// public void onFailure(int errorCode) {
// receiver.onFailure(errorCode);
// }
// });
@Override
public void onFailure(int errorCode) {
LoyaltySDKSessionExpiredEventModel sessionExpired = new LoyaltySDKSessionExpiredEventModel();
sessionExpired.setLoyaltySessionExpired(true);
EventBus.getDefault().post(new WarplyEventBusManager(sessionExpired));
LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
dynatraceEvent.setEventName("custom_error_submit_order_loyalty");
EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent));
receiver.onFailure(errorCode);
}
});
} else {
LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
dynatraceEvent.setEventName("custom_error_submit_order_loyalty");
......@@ -2510,21 +2622,30 @@ public class WarplyManager {
@Override
public void onFailure(int errorCode) {
if (errorCode == 401) {
refreshToken(new WarplyRefreshTokenRequest(), new CallbackReceiver<JSONObject>() {
@Override
public void onSuccess(JSONObject result) {
int status = result.optInt("status", 2);
if (status == 1)
getSharingHistory(request, receiver);
else
receiver.onFailure(status);
}
// refreshToken(new WarplyRefreshTokenRequest(), new CallbackReceiver<JSONObject>() {
// @Override
// public void onSuccess(JSONObject result) {
// int status = result.optInt("status", 2);
// if (status == 1)
// getSharingHistory(request, receiver);
// else
// receiver.onFailure(status);
// }
//
// @Override
// public void onFailure(int errorCode) {
// receiver.onFailure(errorCode);
// }
// });
@Override
public void onFailure(int errorCode) {
LoyaltySDKSessionExpiredEventModel sessionExpired = new LoyaltySDKSessionExpiredEventModel();
sessionExpired.setLoyaltySessionExpired(true);
EventBus.getDefault().post(new WarplyEventBusManager(sessionExpired));
LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
dynatraceEvent.setEventName("custom_error_sharing_history_loyalty");
EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent));
receiver.onFailure(errorCode);
}
});
} else {
LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
dynatraceEvent.setEventName("custom_error_sharing_history_loyalty");
......@@ -2561,21 +2682,30 @@ public class WarplyManager {
@Override
public void onFailure(int errorCode) {
if (errorCode == 401) {
refreshToken(new WarplyRefreshTokenRequest(), new CallbackReceiver<JSONObject>() {
@Override
public void onSuccess(JSONObject result) {
int status = result.optInt("status", 2);
if (status == 1)
postEvent(request, receiver);
else
receiver.onFailure(status);
}
// refreshToken(new WarplyRefreshTokenRequest(), new CallbackReceiver<JSONObject>() {
// @Override
// public void onSuccess(JSONObject result) {
// int status = result.optInt("status", 2);
// if (status == 1)
// postEvent(request, receiver);
// else
// receiver.onFailure(status);
// }
//
// @Override
// public void onFailure(int errorCode) {
// receiver.onFailure(errorCode);
// }
// });
@Override
public void onFailure(int errorCode) {
LoyaltySDKSessionExpiredEventModel sessionExpired = new LoyaltySDKSessionExpiredEventModel();
sessionExpired.setLoyaltySessionExpired(true);
EventBus.getDefault().post(new WarplyEventBusManager(sessionExpired));
LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
dynatraceEvent.setEventName("custom_error_post_event_loyalty");
EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent));
receiver.onFailure(errorCode);
}
});
} else {
LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
dynatraceEvent.setEventName("custom_error_post_event_loyalty");
......@@ -2611,21 +2741,30 @@ public class WarplyManager {
@Override
public void onFailure(int errorCode) {
if (errorCode == 401) {
refreshToken(new WarplyRefreshTokenRequest(), new CallbackReceiver<JSONObject>() {
@Override
public void onSuccess(JSONObject result) {
int status = result.optInt("status", 2);
if (status == 1)
setPacingDetails(request, receiver);
else
receiver.onFailure(status);
}
// refreshToken(new WarplyRefreshTokenRequest(), new CallbackReceiver<JSONObject>() {
// @Override
// public void onSuccess(JSONObject result) {
// int status = result.optInt("status", 2);
// if (status == 1)
// setPacingDetails(request, receiver);
// else
// receiver.onFailure(status);
// }
//
// @Override
// public void onFailure(int errorCode) {
// receiver.onFailure(errorCode);
// }
// });
@Override
public void onFailure(int errorCode) {
LoyaltySDKSessionExpiredEventModel sessionExpired = new LoyaltySDKSessionExpiredEventModel();
sessionExpired.setLoyaltySessionExpired(true);
EventBus.getDefault().post(new WarplyEventBusManager(sessionExpired));
LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
dynatraceEvent.setEventName("custom_error_save_pacing_loyalty");
EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent));
receiver.onFailure(errorCode);
}
});
} else {
LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
dynatraceEvent.setEventName("custom_error_save_pacing_loyalty");
......
......@@ -124,7 +124,8 @@ public class ExpiredCouponAdapter extends RecyclerView.Adapter<ExpiredCouponAdap
simpleDateFormat = new SimpleDateFormat("dd/MM/yyyy");
holder.tvCouponDate.setText(simpleDateFormat.format(newDate != null ? newDate : ""));
holder.tvCouponValue.setText(couponItem.getDiscount() + mContext.getResources().getString(R.string.euro));
String itemValue = String.format("%.02f", couponItem.getFinal_price());
holder.tvCouponValue.setText(itemValue + mContext.getResources().getString(R.string.euro));
holder.itemView.setOnClickListener(v -> onClickSubject.onNext(couponItem));
}
}
......
......@@ -144,7 +144,8 @@ public class SharedCouponAdapter extends RecyclerView.Adapter<SharedCouponAdapte
}
}
holder.tvCouponValue.setText(couponItem.getDiscount() + mContext.getResources().getString(R.string.euro));
String itemValue = String.format("%.02f", couponItem.getFinal_price());
holder.tvCouponValue.setText(itemValue + mContext.getResources().getString(R.string.euro));
holder.itemView.setOnClickListener(v -> onClickSubject.onNext(couponItem));
}
}
......
......@@ -70,7 +70,7 @@
<string name="cos_popup_gifts_title">COSMOTE GIFTS FOR YOU</string>
<string name="cos_popup_gifts_subtitle">Σε αυτή την ενότητα βρίσκεις τα διαθέσιμα δώρα και επιβραβεύσεις αποκλειστικά για σένα!</string>
<string name="cos_mycoupon_date">Το κουπόνι ισχύει έως %1$s</string>
<string name="cos_gift_it">Kάνε δώρο</string>
<string name="cos_gift_it">Δώρισε το</string>
<string name="cos_popup_more_title">COSMOTE MORE FOR YOU</string>
<string name="cos_popup_more_subtitle">Σε αυτή την ενότητα βρες έρευνες, παιχνίδια, διαγωνισμούς και επιβραβεύσεις για τις αθλητικές σου δραστηριότητες!</string>
<string name="cos_deals_win_title">Μέχρι τώρα έχεις κερδίσει %1$s€ σε προσφορές από %2$s κουπόνια!</string>
......@@ -95,7 +95,7 @@
<string name="cos_shops">Δες τα καταστήματα</string>
<string name="cos_website">Δες το eshop</string>
<string name="cos_coupon_shops_title">Καταστήματα</string>
<string name="cos_coupon_gift">Kάνε δώρο</string>
<string name="cos_coupon_gift">Δώρισε το</string>
<string name="cos_coupon_share_gift_title">Επίλεξε το κινητό από το οποίο θα γίνει η αποστολή και συμπλήρωσε το COSMOTE κινητό που θα λάβει το δώρο.</string>
<string name="cos_coupon_share_sender">Αποστολέας</string>
<string name="cos_coupon_share_hint">Καταχώρηση τηλεφώνου</string>
......