GoneToneStudio / node-google-play-api

Access Google Play by logging in and making requests as an Android device!
https://www.npmjs.com/package/@gonetone/google-play-api
MIT License
36 stars 9 forks source link

Wrong exception when trying to download unsupported apk #10

Closed dudul closed 3 years ago

dudul commented 3 years ago

Hi, When trying to download an apk and it's not supported by the device, the "this.purchase" throw this exception: Purchase Request Failed: Cannot read property 'toString' of null

This happened because this.appDetails(packageName) doesn't fetch the appDetails.details.appDetails.versionCode (I guess it's not available when the device is not supported by the apk) and then pass undefined versionCode.

When (just for testing) I added this line before the actual purchase,

if(!versionCode){
        versionCode = 0;
}

it return the correct error (I guess) Error retrieving information from server. DF-DFERH-01

It can be tested with this apk com.macmillan.navio (I think it support only big screens)

GoneTone commented 3 years ago

Fixed!