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-06 18:48:28 +0200
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
d27ec90d3af1cbfe056b845d8a03c9bb7a82efee
d27ec90d
1 parent
c1cbb93a
new coupons part2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
84 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/Merchant.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 @
d27ec90
...
...
@@ -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 @
d27ec90
...
...
@@ -96,6 +96,7 @@ public class Coupon implements Parcelable, Serializable {
private
String
short_description
=
""
;
private
String
terms
=
""
;
private
Couponset
couponsetDetails
=
new
Couponset
(
true
);
private
Merchant
merchantDetails
=
new
Merchant
(
true
);
public
Coupon
()
{
this
.
barcode
=
""
;
...
...
@@ -133,6 +134,7 @@ public class Coupon implements Parcelable, Serializable {
this
.
merchantUuid
=
""
;
this
.
redeemDate
=
new
Date
();
this
.
couponsetDetails
=
new
Couponset
(
isUniversal
);
this
.
merchantDetails
=
new
Merchant
(
isUniversal
);
}
/**
...
...
@@ -218,6 +220,10 @@ public class Coupon implements Parcelable, Serializable {
if
(
tempCouponsetDetails
!=
null
)
{
this
.
couponsetDetails
=
new
Couponset
(
tempCouponsetDetails
,
isUniversal
);
}
JSONObject
tempMerchantDetails
=
json
.
optJSONObject
(
"merchant_details"
);
if
(
tempMerchantDetails
!=
null
)
{
this
.
merchantDetails
=
new
Merchant
(
tempMerchantDetails
,
isUniversal
);
}
// this.category = json.optString(CATEGORY);
// this.created = json.optString(CREATED);
...
...
@@ -522,6 +528,22 @@ public class Coupon implements Parcelable, Serializable {
this
.
terms
=
terms
;
}
public
Couponset
getCouponsetDetails
()
{
return
couponsetDetails
;
}
public
void
setCouponsetDetails
(
Couponset
couponsetDetails
)
{
this
.
couponsetDetails
=
couponsetDetails
;
}
public
Merchant
getMerchantDetails
()
{
return
merchantDetails
;
}
public
void
setMerchantDetails
(
Merchant
merchantDetails
)
{
this
.
merchantDetails
=
merchantDetails
;
}
@Override
public
int
describeContents
()
{
return
0
;
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/io/models/Merchant.java
View file @
d27ec90
...
...
@@ -180,6 +180,19 @@ public class Merchant implements Parcelable, Serializable, ClusterItem {
coordinates
=
new
LatLng
(
this
.
latitude
,
this
.
longitude
);
}
public
Merchant
(
boolean
isUniversal
)
{
this
.
address
=
""
;
this
.
city
=
""
;
this
.
body
=
""
;
this
.
logo
=
""
;
this
.
country
=
""
;
this
.
name
=
""
;
this
.
postal_code
=
""
;
this
.
region
=
""
;
this
.
telephone
=
""
;
this
.
merchant_metadata
=
new
JSONObject
();
}
/**
* Basic constructor used to create an object from a String, representing a
* JSON Object
...
...
@@ -242,6 +255,53 @@ public class Merchant implements Parcelable, Serializable, ClusterItem {
}
}
public
Merchant
(
JSONObject
json
,
boolean
isUniversal
)
{
if
(
json
!=
null
)
{
this
.
address
=
json
.
isNull
(
ADDRESS
)
?
""
:
json
.
optString
(
ADDRESS
);
this
.
body
=
json
.
optString
(
BODY
);
this
.
city
=
json
.
optString
(
CITY
);
this
.
logo
=
json
.
optString
(
LOGO
);
this
.
country
=
json
.
optString
(
COUNTRY
);
this
.
name
=
json
.
isNull
(
NAME
)
?
""
:
json
.
optString
(
NAME
);
this
.
postal_code
=
json
.
optString
(
POSTAL_CODE
);
this
.
region
=
json
.
optString
(
REGION
);
this
.
telephone
=
json
.
isNull
(
TELEPHONE
)
?
""
:
json
.
optString
(
TELEPHONE
);
this
.
merchant_metadata
=
json
.
optJSONObject
(
MERCHANT_METADATA
);
// this.id = json.optString(ID);
// this.store_id = json.optString(STORE_ID);
// this.website = json.optString(WEBSITE);
// this.email = json.optString(EMAIL);
// this.category = json.optString(CATEGORY);
// this.description = json.optString(DESCRIPTION);
// this.short_description = json.optString(SHORT_DESCRIPTION);
// this.latitude = json.isNull(LAT) ? 0.0 : json.optDouble(LAT);
// this.longitude = json.isNull(LON) ? 0.0 : json.optDouble(LON);
// this.image = json.optString(IMAGE);
// this.extra_fields = json.optJSONObject(EXTRA_FIELDS);
// this.active = json.optBoolean(ACTIVE);
// this.vat = json.optString(VAT);
// this.uuid = json.optString(UUID);
// this.category_uuid = json.optString(CATEGORY_UUID);
// this.created = json.optString(CREATED);
// this.parent = json.optString(PARENT);
// this.img = json.optJSONArray(IMG);
// this.img_preview = json.optString(IMG_PREVIEW);
// this.admin_name = json.optString(ADMIN_NAME);
// this.sorting = json.optInt(SORTING);
// this.owner_name = json.optString(OWNER_NAME);
// this.preview = json.optString(PREVIEW);
// this.promoted = json.optBoolean(PROMOTED);
// this.distance = json.optInt(DISTANCE);
// this.default_shown = json.optBoolean(DEFAULT_SHOWN);
// this.hidden = json.optBoolean(HIDDEN);
// this.working_hours = json.optJSONObject(WORKING_HOURS);
// this.tags = json.optJSONArray(TAGS);
// this.product = json.optJSONObject(PRODUCT);
// coordinates = new LatLng(this.latitude, this.longitude);
}
}
public
Merchant
(
Parcel
source
)
{
this
.
address
=
source
.
readString
();
this
.
id
=
source
.
readString
();
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/utils/managers/WarplyManager.java
View file @
d27ec90
This diff is collapsed. Click to expand it.
Please
register
or
login
to post a comment