Skip to content

Commit

Permalink
refac: rename verifyPurchase to verifyPlayStorePurchase
Browse files Browse the repository at this point in the history
  • Loading branch information
uerceg committed May 30, 2024
1 parent f8545c3 commit c93925e
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -805,11 +805,11 @@ public void run() {
}

@Override
public void verifyPurchase(final AdjustPurchase purchase, final OnPurchaseVerificationFinishedListener callback) {
public void verifyPlayStorePurchase(final AdjustPurchase purchase, final OnPurchaseVerificationFinishedListener callback) {
executor.submit(new Runnable() {
@Override
public void run() {
verifyPurchaseI(purchase, callback);
verifyPlayStorePurchaseI(purchase, callback);
}
});
}
Expand Down Expand Up @@ -2504,7 +2504,8 @@ private void trackPlayStoreSubscriptionI(final AdjustPlayStoreSubscription subsc
packageHandler.sendFirstPackage();
}

private void verifyPurchaseI(final AdjustPurchase purchase, final OnPurchaseVerificationFinishedListener callback) {
private void verifyPlayStorePurchaseI(final AdjustPurchase purchase,
final OnPurchaseVerificationFinishedListener callback) {
if (callback == null) {
logger.warn("Purchase verification aborted because verification callback is null");
return;
Expand Down Expand Up @@ -2582,6 +2583,11 @@ private void verifyAndTrackPlayStorePurchaseI(final AdjustEvent event,
// from this moment on we know that we can ping client callback in case of error
if (adjustConfig.isDataResidency) {
logger.warn("Purchase verification not available for data residency users right now");
AdjustPurchaseVerificationResult result = new AdjustPurchaseVerificationResult(
"not_verified",
109,
"Purchase verification not available for data residency users right now");
callback.onVerificationFinished(result);
return;
}
if (!checkActivityStateI(activityState)) {
Expand Down
5 changes: 3 additions & 2 deletions Adjust/sdk-core/src/main/java/com/adjust/sdk/Adjust.java
Original file line number Diff line number Diff line change
Expand Up @@ -431,13 +431,14 @@ public static void getSdkVersion(final OnSdkVersionReadListener onSdkVersionRead
* @param purchase AdjustPurchase object to be tracked
* @param callback Callback to obtain verification results
*/
public static void verifyPurchase(final AdjustPurchase purchase, final OnPurchaseVerificationFinishedListener callback) {
public static void verifyPlayStorePurchase(final AdjustPurchase purchase,
final OnPurchaseVerificationFinishedListener callback) {
if (callback == null) {
AdjustFactory.getLogger().error("Purchase verification aborted because verification callback is null");
return;
}
AdjustInstance adjustInstance = Adjust.getDefaultInstance();
adjustInstance.verifyPurchase(purchase, callback);
adjustInstance.verifyPlayStorePurchase(purchase, callback);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -771,7 +771,8 @@ private boolean isInstanceEnabled() {
* @param purchase AdjustPurchase object to be verified
* @param callback Callback to be pinged with the verification results
*/
public void verifyPurchase(final AdjustPurchase purchase, final OnPurchaseVerificationFinishedListener callback) {
public void verifyPlayStorePurchase(final AdjustPurchase purchase,
final OnPurchaseVerificationFinishedListener callback) {
if (!checkActivityHandler("verifyPurchase")) {
AdjustPurchaseVerificationResult result = new AdjustPurchaseVerificationResult(
"not_verified",
Expand All @@ -780,7 +781,7 @@ public void verifyPurchase(final AdjustPurchase purchase, final OnPurchaseVerifi
callback.onVerificationFinished(result);
return;
}
activityHandler.verifyPurchase(purchase, callback);
activityHandler.verifyPlayStorePurchase(purchase, callback);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public interface IActivityHandler {

void trackPlayStoreSubscription(AdjustPlayStoreSubscription subscription);

void verifyPurchase(AdjustPurchase purchase, OnPurchaseVerificationFinishedListener callback);
void verifyPlayStorePurchase(AdjustPurchase purchase, OnPurchaseVerificationFinishedListener callback);

void verifyAndTrackPlayStorePurchase(AdjustEvent event, OnPurchaseVerificationFinishedListener callback);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -794,7 +794,7 @@ private void verifyPurchase() {

final String localBasePath = basePath;
AdjustPurchase purchase = new AdjustPurchase(sku, purchaseToken);
Adjust.verifyPurchase(purchase, new OnPurchaseVerificationFinishedListener() {
Adjust.verifyPlayStorePurchase(purchase, new OnPurchaseVerificationFinishedListener() {
@Override
public void onVerificationFinished(AdjustPurchaseVerificationResult result) {
MainActivity.testLibrary.addInfoToSend("verification_status", result.getVerificationStatus());
Expand Down

0 comments on commit c93925e

Please sign in to comment.