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
2022-05-12 17:17:17 +0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
04b78c0ee12682b78d99c2759a332a8706d548dd
04b78c0e
1 parent
67a26ec0
new version 4.5.4.3
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
392 additions
and
9 deletions
warply_android_sdk/build.gradle
warply_android_sdk/src/main/java/ly/warp/sdk/Warply.java
warply_android_sdk/src/main/java/ly/warp/sdk/io/callbacks/NewCampaignsHook.java
warply_android_sdk/src/main/java/ly/warp/sdk/io/models/NewCampaign.java
warply_android_sdk/src/main/java/ly/warp/sdk/io/models/NewCampaignList.java
warply_android_sdk/src/main/java/ly/warp/sdk/io/request/WarplyContentRequest.java
warply_android_sdk/src/main/java/ly/warp/sdk/io/request/WarplyGetCampaignsRequest.java
warply_android_sdk/src/main/java/ly/warp/sdk/io/request/WarplyGetCouponsetsRequest.java
warply_android_sdk/src/main/java/ly/warp/sdk/io/request/WarplyMerchantCategoriesRequest.java
warply_android_sdk/src/main/java/ly/warp/sdk/io/request/WarplyMerchantsRequest.java
warply_android_sdk/src/main/java/ly/warp/sdk/io/request/WarplyProductsRequest.java
warply_android_sdk/src/main/java/ly/warp/sdk/io/request/WarplyTagsCategoriesRequest.java
warply_android_sdk/src/main/java/ly/warp/sdk/io/request/WarplyTagsRequest.java
warply_android_sdk/src/main/java/ly/warp/sdk/utils/constants/WarpConstants.java
warply_android_sdk/src/main/java/ly/warp/sdk/utils/managers/WarplyManager.java
warply_android_sdk/build.gradle
View file @
04b78c0
...
...
@@ -2,7 +2,7 @@ apply plugin: 'com.android.library'
ext
{
PUBLISH_GROUP_ID
=
'ly.warp'
PUBLISH_VERSION
=
'4.5.4.
2
'
PUBLISH_VERSION
=
'4.5.4.
3
'
PUBLISH_ARTIFACT_ID
=
'warply-android-sdk'
}
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/Warply.java
View file @
04b78c0
...
...
@@ -1487,6 +1487,8 @@ public enum Warply {
if
(
path
.
equals
(
"register"
)
||
path
.
equals
(
"change_password"
)
||
path
.
equals
(
"password_reset"
)
||
path
.
equals
(
"generate"
))
url
=
buildWarplyAuthRequestUrl
(
path
,
true
);
else
if
(
path
.
equals
(
"campaigns"
))
url
=
buildWarplyRequestUrl
(
null
);
else
url
=
buildWarplyAuthRequestUrl
(
path
,
false
);
requestToServerInternal
(
Method
.
POST
,
url
,
data
,
listener
,
tag
,
hasAuthHeaders
);
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/io/callbacks/NewCampaignsHook.java
0 → 100644
View file @
04b78c0
/*
* 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
;
import
org.json.JSONObject
;
import
ly.warp.sdk.io.models.NewCampaignList
;
/**
* Created by Panagiotis Triantafyllou on 12-May-22.
*/
public
class
NewCampaignsHook
implements
CallbackReceiver
<
JSONObject
>
{
private
final
CallbackReceiver
<
NewCampaignList
>
mListener
;
private
final
String
mRequestSignature
;
public
NewCampaignsHook
(
CallbackReceiver
<
NewCampaignList
>
listener
,
String
requestSignature
)
{
this
.
mListener
=
listener
;
this
.
mRequestSignature
=
requestSignature
;
}
@Override
public
void
onSuccess
(
JSONObject
result
)
{
if
(
mListener
!=
null
)
{
int
status
=
result
.
optInt
(
"status"
,
2
);
if
(
status
==
1
)
{
mListener
.
onSuccess
(
new
NewCampaignList
(
result
,
mRequestSignature
));
}
else
mListener
.
onFailure
(
status
);
}
}
@Override
public
void
onFailure
(
int
errorCode
)
{
if
(
mListener
!=
null
)
mListener
.
onFailure
(
errorCode
);
}
}
warply_android_sdk/src/main/java/ly/warp/sdk/io/models/NewCampaign.java
0 → 100644
View file @
04b78c0
This diff is collapsed. Click to expand it.
warply_android_sdk/src/main/java/ly/warp/sdk/io/models/NewCampaignList.java
0 → 100644
View file @
04b78c0
/*
* 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
;
import
androidx.annotation.NonNull
;
import
org.json.JSONArray
;
import
org.json.JSONObject
;
import
java.util.ArrayList
;
/**
* Created by Panagiotis Triantafyllou on 12-May-22.
*/
public
class
NewCampaignList
extends
ArrayList
<
NewCampaign
>
{
/**
* Generated for serialized class
*/
private
static
final
long
serialVersionUID
=
-
188843583823948267L
;
private
static
final
String
JSON_KEY_MAPP
=
"MAPP_CAMPAIGNING"
;
private
static
final
String
JSON_KEY_MAPP_VALUE
=
"campaigns"
;
private
static
final
String
JSON_KEY_CONTEXT
=
"context"
;
private
String
mRequestSignature
=
""
;
private
NewCampaignList
(
String
requestSignature
)
{
this
.
mRequestSignature
=
requestSignature
;
}
public
NewCampaignList
()
{
super
();
}
/**
* Constructor used to create the CampaignList from a JSON Object.
*
* @param campaignListJSONObject The JSON Object, used to create the CampaignList
*/
public
NewCampaignList
(
JSONObject
campaignListJSONObject
,
String
requestSignature
)
{
this
(
requestSignature
);
campaignListJSONObject
=
campaignListJSONObject
.
optJSONObject
(
JSON_KEY_CONTEXT
);
if
(
campaignListJSONObject
==
null
)
return
;
JSONObject
jsonObject
=
campaignListJSONObject
.
optJSONObject
(
JSON_KEY_MAPP
);
if
(
jsonObject
==
null
)
return
;;
JSONArray
jArray
=
jsonObject
.
optJSONArray
(
JSON_KEY_MAPP_VALUE
);
if
(
jArray
!=
null
)
{
for
(
int
i
=
0
,
lim
=
jArray
.
length
();
i
<
lim
;
++
i
)
{
add
(
new
NewCampaign
(
jArray
.
optJSONObject
(
i
)));
}
}
}
@NonNull
public
String
getRequestSignature
()
{
return
mRequestSignature
;
}
}
warply_android_sdk/src/main/java/ly/warp/sdk/io/request/WarplyContentRequest.java
View file @
04b78c0
...
...
@@ -13,6 +13,8 @@ import java.security.NoSuchAlgorithmException;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
ly.warp.sdk.Warply
;
import
ly.warp.sdk.utils.WarplyProperty
;
import
ly.warp.sdk.utils.constants.WarpConstants
;
/**
...
...
@@ -40,7 +42,7 @@ public class WarplyContentRequest {
private
long
mCacheUpdateInterval
=
0
;
private
String
mContentCategory
=
""
;
private
ArrayList
<
String
>
mTags
=
new
ArrayList
<>();
private
String
mLanguage
=
""
;
private
String
mLanguage
=
WarplyProperty
.
getLanguage
(
Warply
.
getWarplyContext
())
;
// ===========================================================
// Constructor
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/io/request/WarplyGetCampaignsRequest.java
0 → 100644
View file @
04b78c0
package
ly
.
warp
.
sdk
.
io
.
request
;
import
android.util.Base64
;
import
org.json.JSONException
;
import
org.json.JSONObject
;
import
java.io.UnsupportedEncodingException
;
import
java.security.MessageDigest
;
import
java.security.NoSuchAlgorithmException
;
import
ly.warp.sdk.Warply
;
import
ly.warp.sdk.utils.WarplyProperty
;
import
ly.warp.sdk.utils.constants.WarpConstants
;
/**
* Created by Panagiotis Triantafyllou on 12-May-22.
*/
public
class
WarplyGetCampaignsRequest
{
// ===========================================================
// Constants
// ===========================================================
private
final
String
KEY_ACTION
=
"action"
;
private
final
String
KEY_ACTION_VALUE
=
"retrieve"
;
private
final
String
KEY_LANGUAGE
=
"language"
;
private
final
String
KEY_FILTERS
=
"filters"
;
// ===========================================================
// Fields
// ===========================================================
private
JSONObject
mFilters
=
new
JSONObject
();
private
long
mCacheUpdateInterval
=
0
;
private
String
mLanguage
=
WarplyProperty
.
getLanguage
(
Warply
.
getWarplyContext
());
// ===========================================================
// Constructor
// ===========================================================
/**
* Default constructor of WarplyGetCampaignsRequest, initializes an empty filters HashMap
*/
public
WarplyGetCampaignsRequest
()
{
mFilters
=
new
JSONObject
();
}
public
WarplyGetCampaignsRequest
(
WarplyGetCampaignsRequest
copy
)
{
if
(
copy
!=
null
)
{
this
.
mFilters
=
copy
.
mFilters
;
this
.
mCacheUpdateInterval
=
copy
.
mCacheUpdateInterval
;
}
}
// ===========================================================
// Methods for/from SuperClass/Interfaces
// ===========================================================
@Override
public
boolean
equals
(
Object
object
)
{
if
(
object
instanceof
WarplyGetCampaignsRequest
)
{
WarplyGetCampaignsRequest
other
=
(
WarplyGetCampaignsRequest
)
object
;
return
other
==
this
||
(
this
.
mFilters
==
other
.
mFilters
||
(
this
.
mFilters
!=
null
&&
this
.
mFilters
.
equals
(
other
.
mFilters
)));
}
return
false
;
}
@Override
public
int
hashCode
()
{
return
mFilters
.
hashCode
();
}
// ===========================================================
// Methods
// ===========================================================
// ===========================================================
// Getter & Setter
// ===========================================================
public
WarplyGetCampaignsRequest
setLanguage
(
String
language
)
{
mLanguage
=
language
;
return
this
;
}
public
WarplyGetCampaignsRequest
setFilters
(
JSONObject
filters
)
{
mFilters
=
filters
;
return
this
;
}
/**
* Call this to get how often the cached data will be updated.
*
* @return mCacheUpdateInterval
*/
public
long
getCacheUpdateInterval
()
{
return
mCacheUpdateInterval
;
}
/**
* Call this to set how often the cached data will be updated.
*
* @param updateInterval The time that data will be cached
* @return WarplyGetCampaignsRequest
*/
public
WarplyGetCampaignsRequest
setCacheUpdateInterval
(
long
updateInterval
)
{
this
.
mCacheUpdateInterval
=
updateInterval
;
if
(
mCacheUpdateInterval
<
0
)
{
mCacheUpdateInterval
=
0
;
}
return
this
;
}
/**
* Call this to check if the Application uses Cache
*
* @return <p>true - the Application is using Cache</p>
* <p>false - the Application is not using Cache</p>
*/
public
boolean
isUseCache
()
{
return
mCacheUpdateInterval
>
0
;
}
/**
* Call this to check whether the cached data need to be updated
*
* @param useCache <p>true - the Application is using Cache</p>
* <p>false - the Application is not using Cache</p>
* @return WarplyGetCampaignsRequest
*/
public
WarplyGetCampaignsRequest
setUseCache
(
boolean
useCache
)
{
if
(
useCache
)
{
mCacheUpdateInterval
=
mCacheUpdateInterval
>
0
?
mCacheUpdateInterval
:
WarpConstants
.
INBOX_UPDATE_INTERVAL
;
}
else
{
mCacheUpdateInterval
=
0
;
}
return
this
;
}
/**
* Call this to build the campaigns Json object
*
* @return bodyJsonObject
*/
public
JSONObject
toJson
()
{
JSONObject
bodyJsonObject
=
new
JSONObject
();
try
{
bodyJsonObject
.
putOpt
(
KEY_ACTION
,
KEY_ACTION_VALUE
);
bodyJsonObject
.
putOpt
(
KEY_LANGUAGE
,
mLanguage
);
if
(
mFilters
!=
null
&&
mFilters
.
length
()
>
0
)
bodyJsonObject
.
putOpt
(
KEY_FILTERS
,
mFilters
);
else
bodyJsonObject
.
putOpt
(
KEY_FILTERS
,
new
JSONObject
());
}
catch
(
JSONException
e
)
{
if
(
WarpConstants
.
DEBUG
)
e
.
printStackTrace
();
}
return
bodyJsonObject
;
}
public
String
getSignature
()
{
String
signature
=
mFilters
!=
null
&&
mFilters
.
length
()
>
0
?
String
.
valueOf
(
mFilters
.
hashCode
())
:
"default_get_campaigns_request"
;
try
{
byte
[]
hash
=
MessageDigest
.
getInstance
(
"SHA-256"
).
digest
(
signature
.
getBytes
(
"UTF-8"
));
signature
=
Base64
.
encodeToString
(
hash
,
Base64
.
NO_WRAP
);
}
catch
(
NullPointerException
|
NoSuchAlgorithmException
|
UnsupportedEncodingException
e
)
{
e
.
printStackTrace
();
}
return
signature
;
}
}
warply_android_sdk/src/main/java/ly/warp/sdk/io/request/WarplyGetCouponsetsRequest.java
View file @
04b78c0
...
...
@@ -12,6 +12,8 @@ import java.security.NoSuchAlgorithmException;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
ly.warp.sdk.Warply
;
import
ly.warp.sdk.utils.WarplyProperty
;
import
ly.warp.sdk.utils.constants.WarpConstants
;
/**
...
...
@@ -40,7 +42,7 @@ public class WarplyGetCouponsetsRequest {
private
boolean
mActive
=
true
;
private
boolean
mVisible
=
true
;
private
ArrayList
<
String
>
mUuids
=
new
ArrayList
<>();
private
String
mLanguage
=
""
;
private
String
mLanguage
=
WarplyProperty
.
getLanguage
(
Warply
.
getWarplyContext
())
;
// ===========================================================
// Constructor
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/io/request/WarplyMerchantCategoriesRequest.java
View file @
04b78c0
...
...
@@ -10,6 +10,8 @@ import java.security.MessageDigest;
import
java.security.NoSuchAlgorithmException
;
import
java.util.HashMap
;
import
ly.warp.sdk.Warply
;
import
ly.warp.sdk.utils.WarplyProperty
;
import
ly.warp.sdk.utils.constants.WarpConstants
;
/**
...
...
@@ -32,7 +34,7 @@ public class WarplyMerchantCategoriesRequest {
private
HashMap
<
String
,
String
>
mFilters
;
private
long
mCacheUpdateInterval
=
0
;
private
String
mLanguage
=
""
;
private
String
mLanguage
=
WarplyProperty
.
getLanguage
(
Warply
.
getWarplyContext
())
;
// ===========================================================
// Constructor
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/io/request/WarplyMerchantsRequest.java
View file @
04b78c0
...
...
@@ -13,6 +13,8 @@ import java.security.NoSuchAlgorithmException;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
ly.warp.sdk.Warply
;
import
ly.warp.sdk.utils.WarplyProperty
;
import
ly.warp.sdk.utils.constants.WarpConstants
;
/**
...
...
@@ -51,7 +53,7 @@ public class WarplyMerchantsRequest {
private
String
mUuid
=
""
;
private
int
mDistance
=
0
;
private
ArrayList
<
Double
>
mCenter
=
new
ArrayList
<>();
private
String
mLanguage
=
""
;
private
String
mLanguage
=
WarplyProperty
.
getLanguage
(
Warply
.
getWarplyContext
())
;
// ===========================================================
// Constructor
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/io/request/WarplyProductsRequest.java
View file @
04b78c0
...
...
@@ -39,7 +39,7 @@ public class WarplyProductsRequest {
private
HashMap
<
String
,
String
>
mFilters
;
private
long
mCacheUpdateInterval
=
0
;
private
String
mProductsCategory
=
""
;
private
String
mLanguage
=
""
;
private
String
mLanguage
=
WarplyProperty
.
getLanguage
(
Warply
.
getWarplyContext
())
;
// ===========================================================
// Constructor
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/io/request/WarplyTagsCategoriesRequest.java
View file @
04b78c0
...
...
@@ -10,6 +10,8 @@ import java.security.MessageDigest;
import
java.security.NoSuchAlgorithmException
;
import
java.util.HashMap
;
import
ly.warp.sdk.Warply
;
import
ly.warp.sdk.utils.WarplyProperty
;
import
ly.warp.sdk.utils.constants.WarpConstants
;
/**
...
...
@@ -33,7 +35,7 @@ public class WarplyTagsCategoriesRequest {
private
HashMap
<
String
,
String
>
mFilters
;
private
long
mCacheUpdateInterval
=
0
;
private
String
mLanguage
=
""
;
private
String
mLanguage
=
WarplyProperty
.
getLanguage
(
Warply
.
getWarplyContext
())
;
// ===========================================================
// Constructor
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/io/request/WarplyTagsRequest.java
View file @
04b78c0
...
...
@@ -10,6 +10,8 @@ import java.security.MessageDigest;
import
java.security.NoSuchAlgorithmException
;
import
java.util.HashMap
;
import
ly.warp.sdk.Warply
;
import
ly.warp.sdk.utils.WarplyProperty
;
import
ly.warp.sdk.utils.constants.WarpConstants
;
/**
...
...
@@ -33,7 +35,7 @@ public class WarplyTagsRequest {
private
HashMap
<
String
,
String
>
mFilters
;
private
long
mCacheUpdateInterval
=
0
;
private
String
mLanguage
=
""
;
private
String
mLanguage
=
WarplyProperty
.
getLanguage
(
Warply
.
getWarplyContext
())
;
// ===========================================================
// Constructor
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/utils/constants/WarpConstants.java
View file @
04b78c0
...
...
@@ -30,7 +30,7 @@ public class WarpConstants {
/**
* The version of the SDK installed in the device
*/
public
static
final
String
SDK_VERSION
=
"4.5.4.
2
"
;
public
static
final
String
SDK_VERSION
=
"4.5.4.
3
"
;
/**
* The URL of the server where it should ping
...
...
@@ -126,6 +126,7 @@ public class WarpConstants {
public
static
final
String
MICROAPP_CONTACT
=
"contact"
;
public
static
final
String
MICROAPP_CARDS
=
"cards"
;
public
static
final
String
MICROAPP_COUPONS
=
"coupon"
;
public
static
final
String
MICROAPP_NEW_CAMPAIGNS
=
"campaigns"
;
public
static
final
String
MICROAPP_TRANSACTIONS
=
"transactions"
;
public
static
final
String
MICROAPP_CONTENT
=
"content"
;
public
static
final
String
MICROAPP_APPLICATION_DATA
=
"application_data"
;
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/utils/managers/WarplyManager.java
View file @
04b78c0
...
...
@@ -39,6 +39,7 @@ import ly.warp.sdk.io.callbacks.CouponsHook;
import
ly.warp.sdk.io.callbacks.CouponsetsHook
;
import
ly.warp.sdk.io.callbacks.MerchantCategoriesHook
;
import
ly.warp.sdk.io.callbacks.MerchantsHook
;
import
ly.warp.sdk.io.callbacks.NewCampaignsHook
;
import
ly.warp.sdk.io.callbacks.PointsHook
;
import
ly.warp.sdk.io.callbacks.ProductsHook
;
import
ly.warp.sdk.io.callbacks.TagsCategoriesHook
;
...
...
@@ -53,6 +54,7 @@ import ly.warp.sdk.io.models.CouponList;
import
ly.warp.sdk.io.models.CouponsetsList
;
import
ly.warp.sdk.io.models.MerchantCategoriesList
;
import
ly.warp.sdk.io.models.MerchantList
;
import
ly.warp.sdk.io.models.NewCampaignList
;
import
ly.warp.sdk.io.models.PointsList
;
import
ly.warp.sdk.io.models.ProductList
;
import
ly.warp.sdk.io.models.TagsCategoriesList
;
...
...
@@ -71,6 +73,7 @@ import ly.warp.sdk.io.request.WarplyEditAddressRequest;
import
ly.warp.sdk.io.request.WarplyEditConsumerRequest
;
import
ly.warp.sdk.io.request.WarplyForgotPasswordRequest
;
import
ly.warp.sdk.io.request.WarplyGetAddressRequest
;
import
ly.warp.sdk.io.request.WarplyGetCampaignsRequest
;
import
ly.warp.sdk.io.request.WarplyGetCardsRequest
;
import
ly.warp.sdk.io.request.WarplyGetCouponsetsRequest
;
import
ly.warp.sdk.io.request.WarplyLoginRequest
;
...
...
@@ -1267,4 +1270,43 @@ public class WarplyManager {
}
});
}
public
static
void
getCampaigns
(
WarplyGetCampaignsRequest
request
,
boolean
auth
,
final
CallbackReceiver
<
NewCampaignList
>
receiver
)
{
WarpUtils
.
log
(
"************* WARPLY Get Campaigns Request ********************"
);
WarpUtils
.
log
(
"[WARP Trace] WARPLY Get Campaigns Request is active"
);
WarpUtils
.
log
(
"**************************************************"
);
Warply
.
postReceiveMicroappData
(
WarpConstants
.
MICROAPP_NEW_CAMPAIGNS
,
auth
,
"campaigns"
,
request
.
toJson
(),
new
NewCampaignsHook
(
new
CallbackReceiver
<
NewCampaignList
>()
{
@Override
public
void
onSuccess
(
NewCampaignList
result
)
{
receiver
.
onSuccess
(
result
);
}
@Override
public
void
onFailure
(
int
errorCode
)
{
if
(
auth
)
{
if
(
errorCode
==
401
)
{
refreshToken
(
new
WarplyRefreshTokenRequest
(),
new
CallbackReceiver
<
JSONObject
>()
{
@Override
public
void
onSuccess
(
JSONObject
result
)
{
int
status
=
result
.
optInt
(
"status"
,
2
);
if
(
status
==
1
)
getCampaigns
(
request
,
auth
,
receiver
);
else
receiver
.
onFailure
(
status
);
}
@Override
public
void
onFailure
(
int
errorCode
)
{
receiver
.
onFailure
(
errorCode
);
}
});
}
else
receiver
.
onFailure
(
errorCode
);
}
else
receiver
.
onFailure
(
errorCode
);
}
},
request
.
getSignature
()));
}
}
...
...
Please
register
or
login
to post a comment