Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android. Trying to purchase a subscription while it's still active return general error instead of InAppBillingPurchase #97

Closed
ghost opened this issue Nov 22, 2017 · 0 comments

Comments

@ghost
Copy link

ghost commented Nov 22, 2017

Bug Information

Version Number of Plugin: 1.2.3.107
Device Tested On: Galaxy S3, Galaxy S6
Version of VS: Visual Studio Professional 2015 update 3
Version of Xamarin: 4.7.10.38

Steps to reproduce the Behavior

  • Purchase a auto-renew subscription with PurchaseAsync
  • try to purchase again, the google store will give an error that you already have it.

Expected Behavior

That we will receive the lastest inAppBillingPurchase

Actual Behavior

  • it will trigger an exeption in the purchase flow, with a PurchaseError.GeneralError error, and the message "7"

Code snippet

the request code 7 triggers an exception that prevent some of the internal code from being called. I think.
public static void HandleActivityResult(int requestCode, Result resultCode, Intent data)
{

        if (PURCHASE_REQUEST_CODE != requestCode || data == null)
        {
            return;
        }

        int responseCode = data.GetIntExtra(RESPONSE_CODE, 0);

        switch (responseCode)
        {
            case 0:
                //Reponse returned OK
                var purchaseData = data.GetStringExtra(RESPONSE_IAP_DATA);
                var dataSignature = data.GetStringExtra(RESPONSE_IAP_DATA_SIGNATURE);

                tcsPurchase?.TrySetResult(new PurchaseResponse
                {
                    PurchaseData = purchaseData,
                    DataSignature = dataSignature
                });
                break;
            case RESPONSE_CODE_RESULT_USER_CANCELED:
                tcsPurchase.SetException(new InAppBillingPurchaseException(PurchaseError.UserCancelled));
                break;
            case RESPONSE_CODE_RESULT_SERVICE_UNAVAILABLE:
                tcsPurchase.SetException(new InAppBillingPurchaseException(PurchaseError.ServiceUnavailable));
                break;
            default: // ----------------------HERE---------------------------
                tcsPurchase.SetException(new InAppBillingPurchaseException(PurchaseError.GeneralError, responseCode.ToString()));
                break;
        }
    }

The code in InAppBillingImplementation on Android: async Task PurchaseAsync, never gets to the case 7, so never returns the purchase.

Screenshotst

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants