diff --git a/playbilling/build.gradle b/playbilling/build.gradle index 3cf9a910..a6290a68 100644 --- a/playbilling/build.gradle +++ b/playbilling/build.gradle @@ -17,7 +17,7 @@ apply plugin: 'com.android.library' apply plugin: 'maven-publish' -def VERSION = "1.0.0-alpha10"; +def VERSION = "1.0.0-alpha11"; android { compileSdkVersion 31 @@ -56,7 +56,7 @@ dependencies { api 'androidx.browser:browser:1.4.0' implementation fileTree(dir: 'libs', include: ['*.jar']) - implementation 'com.android.billingclient:billing:5.2.1' + implementation 'com.android.billingclient:billing:6.2.1' testImplementation 'junit:junit:4.12' testImplementation 'org.robolectric:robolectric:4.4' diff --git a/playbilling/src/androidTest/java/com/google/androidbrowserhelper/playbilling/provider/PaymentActivityTest.java b/playbilling/src/androidTest/java/com/google/androidbrowserhelper/playbilling/provider/PaymentActivityTest.java index 9fac75cb..dd144d5a 100644 --- a/playbilling/src/androidTest/java/com/google/androidbrowserhelper/playbilling/provider/PaymentActivityTest.java +++ b/playbilling/src/androidTest/java/com/google/androidbrowserhelper/playbilling/provider/PaymentActivityTest.java @@ -90,23 +90,6 @@ public void successfulFlow() throws InterruptedException, JSONException { assertActivityResult(Activity.RESULT_OK); } - @Test - public void priceChangeConfirmationFlow() throws InterruptedException, JSONException { - mContext.startActivity(getIntent(SKU, true)); - assertTrue(WrapperActivity.waitForLaunch()); - - assertTrue(mWrapper.waitForConnect()); - mWrapper.triggerConnected(); - - assertTrue(mWrapper.waitForQuerySkuDetails()); - mWrapper.triggerOnGotSkuDetails(getSkuDetailsList()); - - assertTrue(mWrapper.waitForLaunchPriceChangeConfirmationFlow()); - mWrapper.triggerOnPriceChangeConfirmationResult(); - - assertActivityResult(Activity.RESULT_OK); - } - @Test public void setsProxy() throws InterruptedException, JSONException { mWrapper.setPaymentFlowWillBeSuccessful(true); diff --git a/playbilling/src/main/java/com/google/androidbrowserhelper/playbilling/digitalgoods/ConnectedBillingWrapper.java b/playbilling/src/main/java/com/google/androidbrowserhelper/playbilling/digitalgoods/ConnectedBillingWrapper.java index 84081872..c567a550 100644 --- a/playbilling/src/main/java/com/google/androidbrowserhelper/playbilling/digitalgoods/ConnectedBillingWrapper.java +++ b/playbilling/src/main/java/com/google/androidbrowserhelper/playbilling/digitalgoods/ConnectedBillingWrapper.java @@ -21,7 +21,6 @@ import com.android.billingclient.api.BillingClientStateListener; import com.android.billingclient.api.BillingResult; import com.android.billingclient.api.ConsumeResponseListener; -import com.android.billingclient.api.PriceChangeConfirmationListener; import com.android.billingclient.api.PurchaseHistoryResponseListener; import com.android.billingclient.api.PurchasesResponseListener; import com.android.billingclient.api.SkuDetails; @@ -120,11 +119,4 @@ public boolean launchPaymentFlow(Activity activity, SkuDetails sku, MethodData d throw new IllegalStateException( "EnsuredConnectionBillingWrapper doesn't handle launch Payment flow"); } - - @Override - public void launchPriceChangeConfirmationFlow(Activity activity, SkuDetails sku, - PriceChangeConfirmationListener listener) { - throw new IllegalStateException("EnsuredConnectionBillingWrapper doesn't handle the " + - "price change confirmation flow"); - } } diff --git a/playbilling/src/main/java/com/google/androidbrowserhelper/playbilling/provider/BillingWrapper.java b/playbilling/src/main/java/com/google/androidbrowserhelper/playbilling/provider/BillingWrapper.java index 6d71630d..ecda3d84 100644 --- a/playbilling/src/main/java/com/google/androidbrowserhelper/playbilling/provider/BillingWrapper.java +++ b/playbilling/src/main/java/com/google/androidbrowserhelper/playbilling/provider/BillingWrapper.java @@ -21,7 +21,6 @@ import com.android.billingclient.api.BillingClientStateListener; import com.android.billingclient.api.BillingResult; import com.android.billingclient.api.ConsumeResponseListener; -import com.android.billingclient.api.PriceChangeConfirmationListener; import com.android.billingclient.api.PurchaseHistoryResponseListener; import com.android.billingclient.api.PurchasesResponseListener; import com.android.billingclient.api.SkuDetails; @@ -79,10 +78,4 @@ void queryPurchaseHistory(@BillingClient.SkuType String skuType, */ boolean launchPaymentFlow(Activity activity, SkuDetails sku, MethodData methodData); - /** - * Launches the price change confirmation flow. - */ - void launchPriceChangeConfirmationFlow(Activity activity, SkuDetails sku, - PriceChangeConfirmationListener listener); - } diff --git a/playbilling/src/main/java/com/google/androidbrowserhelper/playbilling/provider/MockBillingWrapper.java b/playbilling/src/main/java/com/google/androidbrowserhelper/playbilling/provider/MockBillingWrapper.java index 7dd2c3a5..7069120f 100644 --- a/playbilling/src/main/java/com/google/androidbrowserhelper/playbilling/provider/MockBillingWrapper.java +++ b/playbilling/src/main/java/com/google/androidbrowserhelper/playbilling/provider/MockBillingWrapper.java @@ -22,7 +22,6 @@ import com.android.billingclient.api.BillingClientStateListener; import com.android.billingclient.api.BillingResult; import com.android.billingclient.api.ConsumeResponseListener; -import com.android.billingclient.api.PriceChangeConfirmationListener; import com.android.billingclient.api.Purchase; import com.android.billingclient.api.PurchaseHistoryRecord; import com.android.billingclient.api.PurchaseHistoryResponseListener; @@ -58,9 +57,6 @@ public class MockBillingWrapper implements BillingWrapper { private MultiSkuTypeInvocationTracker mQueryPurchaseHistoryInvocation = new MultiSkuTypeInvocationTracker<>(); - private InvocationTracker - mPriceChangeConfirmationFlow = new InvocationTracker<>(); - private Intent mPlayBillingFlowLaunchIntent; private final CountDownLatch mConnectLatch = new CountDownLatch(1); @@ -105,12 +101,6 @@ public boolean launchPaymentFlow(Activity activity, SkuDetails sku, MethodData d return mPaymentFlowSuccessful; } - @Override - public void launchPriceChangeConfirmationFlow(Activity activity, SkuDetails sku, - PriceChangeConfirmationListener listener) { - mPriceChangeConfirmationFlow.call(sku, listener); - } - public void triggerConnected() { mConnectionStateListener.onBillingSetupFinished( toResult(BillingClient.BillingResponseCode.OK)); @@ -171,11 +161,6 @@ public void triggerOnPurchasesUpdated() { mListener.onPurchaseFlowComplete(toResult(BillingClient.BillingResponseCode.OK), ""); } - public void triggerOnPriceChangeConfirmationResult() { - mPriceChangeConfirmationFlow.getCallback().onPriceChangeConfirmationResult( - toResult(BillingClient.BillingResponseCode.OK)); - } - public boolean waitForConnect() throws InterruptedException { return wait(mConnectLatch); } @@ -188,10 +173,6 @@ public boolean waitForLaunchPaymentFlow() throws InterruptedException { return wait(mLaunchPaymentFlowLatch); } - public boolean waitForLaunchPriceChangeConfirmationFlow() throws InterruptedException { - return mPriceChangeConfirmationFlow.waitUntilCalled(); - } - public boolean waitForQueryPurchases() throws InterruptedException { return mQueryPurchasesInvocation.waitUntilCalled(); } diff --git a/playbilling/src/main/java/com/google/androidbrowserhelper/playbilling/provider/PaymentActivity.java b/playbilling/src/main/java/com/google/androidbrowserhelper/playbilling/provider/PaymentActivity.java index aaea2ce8..60baf582 100644 --- a/playbilling/src/main/java/com/google/androidbrowserhelper/playbilling/provider/PaymentActivity.java +++ b/playbilling/src/main/java/com/google/androidbrowserhelper/playbilling/provider/PaymentActivity.java @@ -63,6 +63,9 @@ public void onCreate(@Nullable Bundle savedInstanceState) { fail("Could not parse SKU."); return; } + if (mMethodData.isPriceChangeConfirmation) { + fail("Price change confirmation flow is not supported"); + } /** * Note that we have temporarily disabled the IMMEDIATE_WITHOUT_PRORATION mode @@ -114,21 +117,7 @@ private void onSkusQueried(BillingResult result, List skus) { SkuDetails sku = skus.get(0); - if (mMethodData.isPriceChangeConfirmation) { - launchPriceChangeConfirmationFlow(sku); - } else { - launchPaymentFlow(sku); - } - } - - private void launchPriceChangeConfirmationFlow(SkuDetails sku) { - mWrapper.launchPriceChangeConfirmationFlow(this, sku, result -> { - if (result.getResponseCode() == BillingClient.BillingResponseCode.OK) { - setResultAndFinish(PaymentResult.priceChangeSuccess()); - } else { - fail("Price change confirmation flow ended with result: " + result); - } - }); + launchPaymentFlow(sku); } private void launchPaymentFlow(SkuDetails sku) { diff --git a/playbilling/src/main/java/com/google/androidbrowserhelper/playbilling/provider/PlayBillingWrapper.java b/playbilling/src/main/java/com/google/androidbrowserhelper/playbilling/provider/PlayBillingWrapper.java index 3ea9bf6d..d197be2b 100644 --- a/playbilling/src/main/java/com/google/androidbrowserhelper/playbilling/provider/PlayBillingWrapper.java +++ b/playbilling/src/main/java/com/google/androidbrowserhelper/playbilling/provider/PlayBillingWrapper.java @@ -27,8 +27,6 @@ import com.android.billingclient.api.BillingResult; import com.android.billingclient.api.ConsumeParams; import com.android.billingclient.api.ConsumeResponseListener; -import com.android.billingclient.api.PriceChangeConfirmationListener; -import com.android.billingclient.api.PriceChangeFlowParams; import com.android.billingclient.api.Purchase; import com.android.billingclient.api.PurchaseHistoryResponseListener; import com.android.billingclient.api.PurchasesResponseListener; @@ -139,14 +137,4 @@ public boolean launchPaymentFlow(Activity activity, SkuDetails sku, MethodData m return result.getResponseCode() == BillingClient.BillingResponseCode.OK; } - - @Override - public void launchPriceChangeConfirmationFlow(Activity activity, SkuDetails sku, - PriceChangeConfirmationListener listener) { - PriceChangeFlowParams params = PriceChangeFlowParams - .newBuilder() - .setSkuDetails(sku) - .build(); - mClient.launchPriceChangeConfirmationFlow(activity, params, listener); - } }