Panagiotis Triantafyllou

retrofit fixes

......@@ -2,7 +2,7 @@ apply plugin: 'com.android.library'
ext {
PUBLISH_GROUP_ID = 'ly.warp'
PUBLISH_VERSION = '4.5.4.6rc21'
PUBLISH_VERSION = '4.5.4.6rc29'
PUBLISH_ARTIFACT_ID = 'warply-android-sdk'
}
......
/*
* 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.callbacks;
public interface RetrofitInterface {
// @GET("/api/session/{sessionUuid}")
// Call<ResponseBody> getSingleCampaign(@Path("sessionUuid") String sessionUuid);
}
package ly.warp.sdk.io.models;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
import java.util.ArrayList;
import java.util.Date;
/**
* Created by Panagiotis Triantafyllou on 24/Νοε/2022.
*/
public class CouponModel {
@SerializedName("msg")
@Expose
private String msg;
@SerializedName("result")
@Expose
private ArrayList<CouponResult> result = null;
@SerializedName("status")
@Expose
private Integer status;
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public ArrayList<CouponResult> getResult() {
return result;
}
public void setResult(ArrayList<CouponResult> result) {
this.result = result;
}
public class CouponResult {
@SerializedName("changes_dates")
@Expose
private ChangesDates changesDates;
@SerializedName("communication_uuid")
@Expose
private String communicationUuid;
@SerializedName("coupon")
@Expose
private String coupon;
@SerializedName("couponset_uuid")
@Expose
private String couponsetUuid;
@SerializedName("description")
@Expose
private String description;
@SerializedName("discount")
@Expose
private String discount;
@SerializedName("expiration")
@Expose
private String expiration;
@SerializedName("image")
@Expose
private String image;
@SerializedName("name")
@Expose
private String name;
@SerializedName("status")
@Expose
private Integer status;
private String merchantUuid = "";
private String innerText = "";
private Date expirationDate = new Date();
private String discount_type = "";
private double final_price = 0.0d;
public ChangesDates getChangesDates() {
return changesDates;
}
public void setChangesDates(ChangesDates changesDates) {
this.changesDates = changesDates;
}
public String getCommunicationUuid() {
return communicationUuid;
}
public void setCommunicationUuid(String communicationUuid) {
this.communicationUuid = communicationUuid;
}
public String getCoupon() {
return coupon;
}
public void setCoupon(String coupon) {
this.coupon = coupon;
}
public String getCouponsetUuid() {
return couponsetUuid;
}
public void setCouponsetUuid(String couponsetUuid) {
this.couponsetUuid = couponsetUuid;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getDiscount() {
return discount;
}
public void setDiscount(String discount) {
this.discount = discount;
}
public String getExpiration() {
return expiration;
}
public void setExpiration(String expiration) {
this.expiration = expiration;
}
public String getImage() {
return image;
}
public void setImage(String image) {
this.image = image;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public String getMerchantUuid() {
return merchantUuid;
}
public void setMerchantUuid(String merchantUuid) {
this.merchantUuid = merchantUuid;
}
public String getInnerText() {
return innerText;
}
public void setInnerText(String innerText) {
this.innerText = innerText;
}
public Date getExpirationDate() {
return expirationDate;
}
public void setExpirationDate(Date expirationDate) {
this.expirationDate = expirationDate;
}
public String getDiscount_type() {
return discount_type;
}
public void setDiscount_type(String discount_type) {
this.discount_type = discount_type;
}
public double getFinal_price() {
return final_price;
}
public void setFinal_price(double final_price) {
this.final_price = final_price;
}
}
public class ChangesDates {
@SerializedName("assigned")
@Expose
private String assigned;
@SerializedName("created")
@Expose
private String created;
public String getAssigned() {
return assigned;
}
public void setAssigned(String assigned) {
this.assigned = assigned;
}
public String getCreated() {
return created;
}
public void setCreated(String created) {
this.created = created;
}
}
}
package ly.warp.sdk.io.models;
import org.json.JSONArray;
import ly.warp.sdk.Warply;
import ly.warp.sdk.utils.WarplyProperty;
/**
* Created by Panagiotis Triantafyllou on 24/Νοε/2022.
*/
public class CouponRequestModel {
private CouponsetRequestInnerModel coupon;
public CouponRequestModel() {
this.coupon = new CouponsetRequestInnerModel();
}
private class CouponsetRequestInnerModel {
private String action;
private JSONArray fetch_data;
public CouponsetRequestInnerModel() {
this.action = "get_user_coupons";
JSONArray fetch = new JSONArray();
fetch.put("transaction");
fetch.put("communication");
this.fetch_data = fetch;
}
}
}
package ly.warp.sdk.io.models;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
import java.util.ArrayList;
/**
* Created by Panagiotis Triantafyllou on 24/Νοε/2022.
*/
public class CouponsetModel {
@SerializedName("status")
@Expose
private String status;
@SerializedName("context")
@Expose
private CouponsetContext context;
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public CouponsetContext getContext() {
return context;
}
public void setContext(CouponsetContext context) {
this.context = context;
}
public class CouponsetContext {
@SerializedName("MAPP_COUPON-status")
@Expose
private Integer mAPPCOUPONStatus;
@SerializedName("events_processed")
@Expose
private Integer eventsProcessed;
@SerializedName("MAPP_COUPON")
@Expose
private ArrayList<MappCoupon> mappCoupon = null;
public ArrayList<MappCoupon> getMappCoupon() {
return mappCoupon;
}
public void setMappCoupon(ArrayList<MappCoupon> mappCoupon) {
this.mappCoupon = mappCoupon;
}
public Integer getMAPPCOUPONStatus() {
return mAPPCOUPONStatus;
}
public void setMAPPCOUPONStatus(Integer mAPPCOUPONStatus) {
this.mAPPCOUPONStatus = mAPPCOUPONStatus;
}
public Integer getEventsProcessed() {
return eventsProcessed;
}
public void setEventsProcessed(Integer eventsProcessed) {
this.eventsProcessed = eventsProcessed;
}
}
public class MappCoupon {
@SerializedName("uuid")
@Expose
private String uuid;
@SerializedName("img_preview")
@Expose
private String imgPreview;
@SerializedName("final_price")
@Expose
private Integer finalPrice;
@SerializedName("start_date")
@Expose
private String startDate;
@SerializedName("end_date")
@Expose
private String endDate;
@SerializedName("discount_type")
@Expose
private String discountType;
@SerializedName("promoted")
@Expose
private Boolean promoted;
@SerializedName("expiration")
@Expose
private CouponsetExpiration expiration;
@SerializedName("name")
@Expose
private String name;
@SerializedName("description")
@Expose
private String description;
@SerializedName("short_description")
@Expose
private String shortDescription;
@SerializedName("discount")
@Expose
private String discount;
@SerializedName("terms")
@Expose
private String terms;
@SerializedName("inner_text")
@Expose
private String innerText;
@SerializedName("merchant_uuid")
@Expose
private String merchantUuid;
public String getUuid() {
return uuid;
}
public void setUuid(String uuid) {
this.uuid = uuid;
}
public String getImgPreview() {
return imgPreview;
}
public void setImgPreview(String imgPreview) {
this.imgPreview = imgPreview;
}
public Integer getFinalPrice() {
return finalPrice;
}
public void setFinalPrice(Integer finalPrice) {
this.finalPrice = finalPrice;
}
public String getStartDate() {
return startDate;
}
public void setStartDate(String startDate) {
this.startDate = startDate;
}
public String getEndDate() {
return endDate;
}
public void setEndDate(String endDate) {
this.endDate = endDate;
}
public String getDiscountType() {
return discountType;
}
public void setDiscountType(String discountType) {
this.discountType = discountType;
}
public Boolean getPromoted() {
return promoted;
}
public void setPromoted(Boolean promoted) {
this.promoted = promoted;
}
public CouponsetExpiration getExpiration() {
return expiration;
}
public void setExpiration(CouponsetExpiration expiration) {
this.expiration = expiration;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getShortDescription() {
return shortDescription;
}
public void setShortDescription(String shortDescription) {
this.shortDescription = shortDescription;
}
public String getDiscount() {
return discount;
}
public void setDiscount(String discount) {
this.discount = discount;
}
public String getTerms() {
return terms;
}
public void setTerms(String terms) {
this.terms = terms;
}
public String getInnerText() {
return innerText;
}
public void setInnerText(String innerText) {
this.innerText = innerText;
}
public String getMerchantUuid() {
return merchantUuid;
}
public void setMerchantUuid(String merchantUuid) {
this.merchantUuid = merchantUuid;
}
}
public class CouponsetExpiration {
@SerializedName("type")
@Expose
private String type;
@SerializedName("value")
@Expose
private String value;
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
}
}
package ly.warp.sdk.io.models;
import org.json.JSONArray;
import org.json.JSONObject;
import java.util.ArrayList;
import ly.warp.sdk.Warply;
import ly.warp.sdk.utils.WarplyProperty;
/**
* Created by Panagiotis Triantafyllou on 24/Νοε/2022.
*/
public class CouponsetRequestModel {
private CouponsetRequestInnerModel coupon;
public CouponsetRequestModel() {
this.coupon = new CouponsetRequestInnerModel();
}
private class CouponsetRequestInnerModel {
private String action;
private boolean active;
private boolean visible;
private String language;
public CouponsetRequestInnerModel() {
this.action = "retrieve_multilingual";
this.active = true;
this.visible = true;
this.language = WarplyProperty.getLanguage(Warply.getWarplyContext());
}
}
}
package ly.warp.sdk.io.models;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
import java.util.ArrayList;
import java.util.Date;
/**
* Created by Panagiotis Triantafyllou on 24/Νοε/2022.
*/
public class MerchantModel {
@SerializedName("status")
@Expose
private String status;
@SerializedName("context")
@Expose
private MerchantContext context;
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public MerchantContext getContext() {
return context;
}
public void setContext(MerchantContext context) {
this.context = context;
}
public class MerchantContext {
@SerializedName("MAPP_SHOPS")
@Expose
private MappShops mappShops;
@SerializedName("MAPP_SHOPS-status")
@Expose
private Integer mAPPSHOPSStatus;
@SerializedName("events_processed")
@Expose
private Integer eventsProcessed;
public MappShops getMappShops() {
return mappShops;
}
public void setMappShops(MappShops mappShops) {
this.mappShops = mappShops;
}
public Integer getMAPPSHOPSStatus() {
return mAPPSHOPSStatus;
}
public void setMAPPSHOPSStatus(Integer mAPPSHOPSStatus) {
this.mAPPSHOPSStatus = mAPPSHOPSStatus;
}
public Integer getEventsProcessed() {
return eventsProcessed;
}
public void setEventsProcessed(Integer eventsProcessed) {
this.eventsProcessed = eventsProcessed;
}
}
public class MappShops {
@SerializedName("msg")
@Expose
private String msg;
@SerializedName("result")
@Expose
private ArrayList<MerchantResult> result = null;
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public ArrayList<MerchantResult> getResult() {
return result;
}
public void setResult(ArrayList<MerchantResult> result) {
this.result = result;
}
}
public class MerchantResult {
@SerializedName("uuid")
@Expose
private String uuid;
@SerializedName("img_preview")
@Expose
private String imgPreview;
@SerializedName("admin_name")
@Expose
private String adminName;
@SerializedName("address")
@Expose
private String address;
@SerializedName("name")
@Expose
private String name;
@SerializedName("latitude")
@Expose
private double latitude;
@SerializedName("longitude")
@Expose
private double longitude;
@SerializedName("telephone")
@Expose
private String telephone;
@SerializedName("website")
@Expose
private String website;
public String getUuid() {
return uuid;
}
public void setUuid(String uuid) {
this.uuid = uuid;
}
public String getImgPreview() {
return imgPreview;
}
public void setImgPreview(String imgPreview) {
this.imgPreview = imgPreview;
}
public String getAdminName() {
return adminName;
}
public void setAdminName(String adminName) {
this.adminName = adminName;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public double getLatitude() {
return latitude;
}
public void setLatitude(double latitude) {
this.latitude = latitude;
}
public double getLongitude() {
return longitude;
}
public void setLongitude(double longitude) {
this.longitude = longitude;
}
public String getTelephone() {
return telephone;
}
public void setTelephone(String telephone) {
this.telephone = telephone;
}
public String getWebsite() {
return website;
}
public void setWebsite(String website) {
this.website = website;
}
}
}
package ly.warp.sdk.io.models;
import org.json.JSONArray;
import org.json.JSONObject;
import ly.warp.sdk.Warply;
import ly.warp.sdk.utils.WarplyProperty;
/**
* Created by Panagiotis Triantafyllou on 24/Νοε/2022.
*/
public class MerchantsRequestModel {
private MerchantsRequestInnerModel shops;
public MerchantsRequestModel() {
this.shops = new MerchantsRequestInnerModel();
}
private class MerchantsRequestInnerModel {
private String action;
private JSONArray categories;
private boolean active;
private JSONObject location;
private JSONArray parent_uuids;
private String language;
public MerchantsRequestInnerModel() {
this.action = "retrieve_multilingual";
this.categories = new JSONArray();
this.active = true;
this.location = null;
this.parent_uuids = null;
this.language = WarplyProperty.getLanguage(Warply.getWarplyContext());
}
}
}
package ly.warp.sdk.io.volley;
import ly.warp.sdk.io.models.CouponModel;
import ly.warp.sdk.io.models.CouponRequestModel;
import ly.warp.sdk.io.models.CouponsetModel;
import ly.warp.sdk.io.models.CouponsetRequestModel;
import ly.warp.sdk.io.models.MerchantModel;
import ly.warp.sdk.io.models.MerchantsRequestModel;
import ly.warp.sdk.utils.constants.WarpConstants;
import okhttp3.RequestBody;
import okhttp3.ResponseBody;
import retrofit2.Call;
import retrofit2.http.Body;
import retrofit2.http.Header;
import retrofit2.http.Headers;
import retrofit2.http.POST;
import retrofit2.http.Path;
......@@ -33,36 +30,39 @@ public interface ApiService {
// Methods
// ===========================================================
@Headers("Content-Type: application/json")
@POST("/api/mobile/v2/{appUuid}/context/")
Call<CouponsetModel> getCouponsets(@Path("appUuid") String appUuid,
@Body CouponsetRequestModel request,
@Header(WarpConstants.HEADER_DATE) String timeStamp,
@Header(WarpConstants.HEADER_LOYALTY_BUNDLE_ID) String bundleId,
@Header(WarpConstants.HEADER_UNIQUE_DEVICE_ID) String deviceId,
@Header(WarpConstants.HEADER_CHANNEL) String channel,
@Header(WarpConstants.HEADER_WEB_ID) String webId,
@Header(WarpConstants.HEADER_SIGNATURE) String signature);
@POST("/oauth/{appUuid}/context")
Call<CouponModel> getUserCoupons(@Path("appUuid") String appUuid,
@Body CouponRequestModel request,
Call<ResponseBody> getCouponsets(@Path("appUuid") String appUuid,
@Body RequestBody request,
@Header(WarpConstants.HEADER_DATE) String timeStamp,
@Header(WarpConstants.HEADER_LOYALTY_BUNDLE_ID) String bundleId,
@Header(WarpConstants.HEADER_UNIQUE_DEVICE_ID) String deviceId,
@Header(WarpConstants.HEADER_CHANNEL) String channel,
@Header(WarpConstants.HEADER_WEB_ID) String webId,
@Header(WarpConstants.HEADER_SIGNATURE) String signature,
@Header(WarpConstants.HEADER_AUTHORIZATION) String bearer);
@Header(WarpConstants.HEADER_SIGNATURE) String signature);
@Headers("Content-Type: application/json")
@POST("/oauth/{appUuid}/context")
Call<ResponseBody> getUserCoupons(@Path("appUuid") String appUuid,
@Body RequestBody request,
@Header(WarpConstants.HEADER_DATE) String timeStamp,
@Header(WarpConstants.HEADER_LOYALTY_BUNDLE_ID) String bundleId,
@Header(WarpConstants.HEADER_UNIQUE_DEVICE_ID) String deviceId,
@Header(WarpConstants.HEADER_CHANNEL) String channel,
@Header(WarpConstants.HEADER_WEB_ID) String webId,
@Header(WarpConstants.HEADER_SIGNATURE) String signature,
@Header(WarpConstants.HEADER_AUTHORIZATION) String bearer);
@Headers("Content-Type: application/json")
@POST("/api/mobile/v2/{appUuid}/context/")
Call<MerchantModel> getMerchants(@Path("appUuid") String appUuid,
@Body MerchantsRequestModel request,
@Header(WarpConstants.HEADER_DATE) String timeStamp,
@Header(WarpConstants.HEADER_LOYALTY_BUNDLE_ID) String bundleId,
@Header(WarpConstants.HEADER_UNIQUE_DEVICE_ID) String deviceId,
@Header(WarpConstants.HEADER_CHANNEL) String channel,
@Header(WarpConstants.HEADER_WEB_ID) String webId,
@Header(WarpConstants.HEADER_SIGNATURE) String signature);
Call<ResponseBody> getMerchants(@Path("appUuid") String appUuid,
@Body RequestBody request,
@Header(WarpConstants.HEADER_DATE) String timeStamp,
@Header(WarpConstants.HEADER_LOYALTY_BUNDLE_ID) String bundleId,
@Header(WarpConstants.HEADER_UNIQUE_DEVICE_ID) String deviceId,
@Header(WarpConstants.HEADER_CHANNEL) String channel,
@Header(WarpConstants.HEADER_WEB_ID) String webId,
@Header(WarpConstants.HEADER_SIGNATURE) String signature);
// ===========================================================
// Getter & Setter
......
......@@ -88,7 +88,7 @@
android:layout_width="240dp"
android:layout_height="50dp"
android:layout_marginHorizontal="32dp"
android:layout_marginTop="88dp"
android:layout_marginTop="27dp"
android:background="@drawable/selector_button_green"
android:gravity="center"
android:orientation="horizontal">
......
......@@ -12,8 +12,8 @@
android:id="@+id/cl_more_header"
android:layout_width="match_parent"
android:layout_height="64dp"
android:translationZ="10dp"
android:background="@drawable/ic_background_transparent_shadow">
android:background="@drawable/ic_background_transparent_shadow"
android:translationZ="10dp">
<ImageView
android:id="@+id/iv_list_close"
......@@ -43,7 +43,7 @@
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<LinearLayout
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="-18dp"
......@@ -51,11 +51,11 @@
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_height="wrap_content"
android:fillViewport="true"
android:overScrollMode="never">
<LinearLayout
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
......@@ -152,6 +152,7 @@
android:id="@+id/ll_exclusive_items"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/ll_research_items"
android:orientation="vertical"
android:visibility="gone">
......@@ -180,6 +181,7 @@
android:id="@+id/ll_contest_items"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/ll_exclusive_items"
android:orientation="vertical"
android:visibility="gone">
......@@ -208,6 +210,7 @@
android:id="@+id/ll_contextual_items"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/ll_contest_items"
android:orientation="vertical"
android:visibility="gone">
......@@ -231,7 +234,7 @@
android:overScrollMode="never"
android:paddingBottom="4dp" />
</LinearLayout>
</LinearLayout>
</RelativeLayout>
</ScrollView>
</LinearLayout>
</RelativeLayout>
</LinearLayout>
\ No newline at end of file
......