Toggle navigation
Toggle navigation
This project
Loading...
Sign in
open-source
/
warply_android_sdk_maven_plugin
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
Panagiotis Triantafyllou
2024-03-05 18:15:12 +0200
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
c1cbb93a505ad8118ce4b002681d6f37de4164a7
c1cbb93a
1 parent
b84ba327
new coupons request part1
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
131 additions
and
2 deletions
warply_android_sdk/src/main/java/ly/warp/sdk/activities/BaseFragmentActivity.java
warply_android_sdk/src/main/java/ly/warp/sdk/io/models/Coupon.java
warply_android_sdk/src/main/java/ly/warp/sdk/io/models/Couponset.java
warply_android_sdk/src/main/java/ly/warp/sdk/utils/managers/WarplyManager.java
warply_android_sdk/src/main/java/ly/warp/sdk/activities/BaseFragmentActivity.java
View file @
c1cbb93
...
...
@@ -50,8 +50,8 @@ public class BaseFragmentActivity extends FragmentActivity implements Navigation
mBottomNavigationView
=
findViewById
(
R
.
id
.
bt_tabs
);
WarplyManager
.
getUserCouponsWithCouponsets
(
mUserCouponsReceiver
);
WarplyManager
.
getCampaigns
(
mCampaignsCallback
);
WarplyManager
.
getUnifiedCouponsDeals
(
mUnifiedCallback
);
//
WarplyManager.getCampaigns(mCampaignsCallback);
//
WarplyManager.getUnifiedCouponsDeals(mUnifiedCallback);
}
@Override
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/io/models/Coupon.java
View file @
c1cbb93
...
...
@@ -95,6 +95,7 @@ public class Coupon implements Parcelable, Serializable {
private
double
final_price
=
0.0d
;
private
String
short_description
=
""
;
private
String
terms
=
""
;
private
Couponset
couponsetDetails
=
new
Couponset
(
true
);
public
Coupon
()
{
this
.
barcode
=
""
;
...
...
@@ -121,6 +122,19 @@ public class Coupon implements Parcelable, Serializable {
this
.
terms
=
""
;
}
public
Coupon
(
boolean
isUniversal
)
{
this
.
barcode
=
""
;
this
.
coupon
=
""
;
this
.
discount
=
""
;
this
.
expiration
=
""
;
this
.
status
=
0
;
this
.
changesDates
=
new
JSONObject
();
this
.
couponsetUuid
=
""
;
this
.
merchantUuid
=
""
;
this
.
redeemDate
=
new
Date
();
this
.
couponsetDetails
=
new
Couponset
(
isUniversal
);
}
/**
* Basic constructor used to create an object from a String, representing a
* JSON Object
...
...
@@ -176,6 +190,50 @@ public class Coupon implements Parcelable, Serializable {
}
}
public
Coupon
(
JSONObject
json
,
boolean
isUniversal
)
{
if
(
json
!=
null
)
{
this
.
barcode
=
json
.
optString
(
BARCODE
);
this
.
changesDates
=
json
.
optJSONObject
(
CHANGES_DATES
);
if
(
this
.
changesDates
!=
null
)
{
SimpleDateFormat
simpleDateFormat
=
new
SimpleDateFormat
(
"yyyy-MM-dd hh:mm"
);
Date
newDate
=
new
Date
();
String
tempRedeemDate
=
this
.
changesDates
.
optString
(
"redeemed"
);
try
{
newDate
=
simpleDateFormat
.
parse
(
tempRedeemDate
);
this
.
redeemDate
=
newDate
;
}
catch
(
ParseException
e
)
{
e
.
printStackTrace
();
}
}
this
.
coupon
=
json
.
optString
(
COUPON
);
this
.
couponsetUuid
=
json
.
optString
(
COUPONSET_UUID
);
this
.
discount
=
json
.
optString
(
DISCOUNT
);
if
(
this
.
discount
.
contains
(
","
))
{
this
.
discount
=
this
.
discount
.
replace
(
","
,
"."
);
}
this
.
expiration
=
json
.
optString
(
EXPIRATION
);
this
.
merchantUuid
=
json
.
optString
(
MERCHANT_UUID
);
this
.
status
=
json
.
optInt
(
STATUS
);
JSONObject
tempCouponsetDetails
=
json
.
optJSONObject
(
"couponset_details"
);
if
(
tempCouponsetDetails
!=
null
)
{
this
.
couponsetDetails
=
new
Couponset
(
tempCouponsetDetails
,
isUniversal
);
}
// this.category = json.optString(CATEGORY);
// this.created = json.optString(CREATED);
// this.description = json.optString(DESCRIPTION);
// this.image = json.optString(IMAGE);
// this.name = json.optString(NAME);
// this.transactionDate = json.optString(TRANSACTION_DATE);
// this.transactionUuid = json.optString(TRANSACTION_UUID);
// this.innerText = json.optString(INNER_TEXT);
// this.discount_type = json.isNull(DISCOUNT_TYPE) ? "" : json.optString(DISCOUNT_TYPE);
// this.final_price = json.optDouble(FINAL_PRICE);
// this.short_description = json.optString(SHORT_DESCRIPTION);
// this.terms = json.optString(TERMS);
}
}
public
Coupon
(
Parcel
source
)
{
this
.
barcode
=
source
.
readString
();
this
.
category
=
source
.
readString
();
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/io/models/Couponset.java
View file @
c1cbb93
...
...
@@ -33,6 +33,9 @@ import org.json.JSONException;
import
org.json.JSONObject
;
import
java.io.Serializable
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.util.Date
;
import
ly.warp.sdk.utils.WarpUtils
;
import
ly.warp.sdk.utils.constants.WarpConstants
;
...
...
@@ -108,6 +111,7 @@ public class Couponset implements Parcelable, Serializable {
private
String
innerText
=
""
;
private
String
discount_type
=
""
;
private
double
final_price
=
0.0d
;
private
Date
endDate
=
new
Date
();
public
Couponset
()
{
this
.
uuid
=
""
;
...
...
@@ -140,6 +144,23 @@ public class Couponset implements Parcelable, Serializable {
this
.
final_price
=
0.0d
;
}
public
Couponset
(
boolean
isUniversal
)
{
this
.
admin_name
=
""
;
this
.
active
=
false
;
this
.
buyable
=
false
;
this
.
category
=
""
;
this
.
created
=
""
;
this
.
discount
=
""
;
this
.
discount_type
=
""
;
this
.
name
=
""
;
this
.
img
=
new
JSONArray
();
this
.
short_description
=
""
;
this
.
terms
=
""
;
this
.
updated
=
""
;
this
.
uuid
=
""
;
// this.endDate = new Date();
}
/**
* Basic constructor used to create an object from a String, representing a
* JSON Object
...
...
@@ -196,6 +217,56 @@ public class Couponset implements Parcelable, Serializable {
}
}
public
Couponset
(
JSONObject
json
,
boolean
isUniversal
)
{
if
(
json
!=
null
)
{
this
.
uuid
=
json
.
optString
(
UUID
);
this
.
admin_name
=
json
.
optString
(
ADMIN_NAME
);
this
.
created
=
json
.
optString
(
CREATED
);
this
.
updated
=
json
.
optString
(
UPDATED
);
this
.
img
=
json
.
optJSONArray
(
IMG
);
this
.
active
=
json
.
optBoolean
(
ACTIVE
);
this
.
buyable
=
json
.
optBoolean
(
BUYABLE
);
this
.
name
=
json
.
optString
(
NAME
);
this
.
short_description
=
json
.
optString
(
SHORT_DESCRIPTION
);
this
.
discount
=
json
.
optString
(
DISCOUNT
);
this
.
category
=
json
.
optString
(
CATEGORY
);
this
.
terms
=
json
.
optString
(
TERMS
);
this
.
discount_type
=
json
.
isNull
(
DISCOUNT_TYPE
)
?
""
:
json
.
optString
(
DISCOUNT_TYPE
);
// SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm");
// Date newDate = new Date();
// String tempRedeemDate = json.optString("end_date");
// try {
// newDate = simpleDateFormat.parse(tempRedeemDate);
// this.endDate = newDate;
// } catch (ParseException e) {
// e.printStackTrace();
// }
// this.app_uuid = json.optString(APP_UUID);
// this.img_preview = json.optString(IMG_PREVIEW);
// this.sorting = json.optInt(SORTING);
// this.visible = json.optBoolean(VISIBLE);
// this.user_generated = json.optBoolean(USER_GENERATED);
// this.limits = json.optJSONObject(LIMITS);
// this.points = json.optInt(POINTS);
// this.points_cause = json.optString(POINTS_CAUSE);
// JSONObject exp = null;
// try {
// exp = new JSONObject(json.optString(EXPIRATION));
// this.expiration = exp.optString(VALUE);
// } catch (JSONException e) {
// e.printStackTrace();
// this.expiration = "";
// }
// this.third_party_service = json.optBoolean(THIRD_PARTY_SERVICE);
// this.description = json.optString(DESCRIPTION);
// this.availability = json.optInt(AVAILABILITY);
// this.merchantUuid = json.optString(MERCHANT_UUID);
// this.innerText = json.optString(INNER_TEXT);
// this.final_price = json.isNull(FINAL_PRICE) ? 0.0d : json.optDouble(FINAL_PRICE);
}
}
public
Couponset
(
Parcel
source
)
{
this
.
uuid
=
source
.
readString
();
this
.
admin_name
=
source
.
readString
();
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/utils/managers/WarplyManager.java
View file @
c1cbb93
This diff is collapsed. Click to expand it.
Please
register
or
login
to post a comment