Skip to content

Commit

Permalink
Filled IInAppBillingVerifyPurchase productId and transactionId for An…
Browse files Browse the repository at this point in the history
…droid (Google Play)
  • Loading branch information
Sebastian1989101 committed Jan 23, 2019
1 parent 7e09535 commit efbcdf8
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions src/Plugin.InAppBilling.Android/InAppBillingImplementation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -221,11 +221,9 @@ Task<List<Purchase>> GetPurchasesAsync(string itemType, IInAppBillingVerifyPurch
string data = dataList[i];
string sign = signatures[i];

if (verifyPurchase == null || await verifyPurchase.VerifyPurchase(data, sign))
{
var purchase = JsonConvert.DeserializeObject<Purchase>(data);
var purchase = JsonConvert.DeserializeObject<Purchase>(data);
if (verifyPurchase == null || await verifyPurchase.VerifyPurchase(data, sign, purchase.ProductId, purchase.OrderId))
purchases.Add(purchase);
}
}

continuationToken = ownedItems.GetString(RESPONSE_IAP_CONTINUATION_TOKEN);
Expand Down Expand Up @@ -346,15 +344,12 @@ async Task<Purchase> PurchaseAsync(string productSku, string itemType, string pa
if (string.IsNullOrWhiteSpace(data))
{
var purchases = await GetPurchasesAsync(itemType, verifyPurchase);

var purchase = purchases.FirstOrDefault(p => p.ProductId == productSku && payload.Equals(p.DeveloperPayload ?? string.Empty));

return purchase;
return purchases.FirstOrDefault(p => p.ProductId == productSku && payload.Equals(p.DeveloperPayload ?? string.Empty));
}

if (verifyPurchase == null || await verifyPurchase.VerifyPurchase(data, sign))
var purchase = JsonConvert.DeserializeObject<Purchase>(data);
if (verifyPurchase == null || await verifyPurchase.VerifyPurchase(data, sign, productSku, purchase.OrderId))
{
var purchase = JsonConvert.DeserializeObject<Purchase>(data);
if (purchase.ProductId == productSku && payload.Equals(purchase.DeveloperPayload ?? string.Empty))
return purchase;
}
Expand Down

0 comments on commit efbcdf8

Please sign in to comment.