Skip to content

getPurchaseHistory fails because an app is twice contained in the purchase history list

Hi, first of all thanks for your great work providing GPlayAPI.

On my Google account I ran into a problem with PurchaseHelper.getPurchaseHistory. Don't ask my why but my purchase history contains one app twice (may be I reposited that app and then bought it later again?).

And this leads to a server error when at the end of getPurchaseHistory AppDetailsHelper.getAppByPackageName is called.

Minimal reproducible example:

AppDetailsHelper appDetailsHelper = new AppDetailsHelper(authData);
appDetailsHelper.getAppByPackageName(List.of("com.teamspeak.ts3client", "com.teamspeak.ts3client"));

-> Server(code=500, reason=Internal Server Error)

The question is if the duplicate values should be filtered out in getPurchaseHistory or in getAppByPackageName.

BTW: I don't need all the app details when retrieving the purchase history (I only use packageName). Do you see a chance to modify getPurchaseHistory and for example add an optional Boolean argument that allows to bypass the mapping step using getAppByPackageName?

    fun getPurchaseHistory(offset: Int = 0, getAllAppDetails: Boolean = true): List<App> {
		....

        if (!getAllAppDetails)
            return purchaseAppList
        return AppDetailsHelper(authData).getAppByPackageName(purchaseAppList.map { it.packageName })
    }

If this would be acceptable I could provide a PR.