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

Start the windows re-write #525

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/Plugin.InAppBilling/InAppBilling.android.cs
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ public async override Task<IEnumerable<(string Id, bool Success)>> FinalizePurch
/// <param name="productId">Id or Sku of product</param>
/// <param name="transactionIdentifier">Original Purchase Token</param>
/// <returns>If consumed successful</returns>
public override async Task<bool> ConsumePurchaseAsync(string productId, string transactionIdentifier)
public override async Task<bool> ConsumePurchaseAsync(string productId, string transactionIdentifier, int quantity)
{
if (BillingClient == null || !IsConnected)
{
Expand Down
4 changes: 2 additions & 2 deletions src/Plugin.InAppBilling/InAppBilling.apple.cs
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ Task<IEnumerable<SKProduct>> GetProductAsync(string[] productId)
}

/// <summary>
/// Get app purchaes
/// Get app purchases
/// </summary>
/// <param name="itemType"></param>
/// <returns></returns>
Expand Down Expand Up @@ -459,7 +459,7 @@ public override string ReceiptData
/// <param name="transactionIdentifier">Original Purchase Token</param>
/// <returns>If consumed successful</returns>
/// <exception cref="InAppBillingPurchaseException">If an error occurs during processing</exception>
public override async Task<bool> ConsumePurchaseAsync(string productId, string transactionIdentifier)
public override async Task<bool> ConsumePurchaseAsync(string productId, string transactionIdentifier, int quantity)
{
var items = await FinalizePurchaseAsync(transactionIdentifier);
var item = items.FirstOrDefault();
Expand Down
42 changes: 21 additions & 21 deletions src/Plugin.InAppBilling/InAppBilling.uwp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,17 +53,17 @@ public async override Task<IEnumerable<InAppBillingProduct>> GetProductInfoAsync
Description = product.Description,
ProductId = product.ProductId,
LocalizedPrice = product.FormattedPrice,
WindowsExtras = new InAppBillingProductWindowsExtras
WindowsExtras = new InAppBillingProductWindowsExtras
{
FormattedBasePrice = product.FormattedBasePrice,
ImageUri = product.ImageUri,
IsOnSale = product.IsOnSale,
IsOnSale = product.IsOnSale,
SaleEndDate = product.SaleEndDate,
Tag = product.Tag,
IsConsumable = product.ProductType == ProductType.Consumable,
IsDurable = product.ProductType == ProductType.Durable,
Keywords = product.Keywords
}
}
//CurrencyCode = product.CurrencyCode // Does not work at the moment, as UWP throws an InvalidCastException when getting CurrencyCode
});
}
Expand All @@ -72,7 +72,7 @@ public async override Task<IEnumerable<InAppBillingProduct>> GetProductInfoAsync
}

/// <summary>
/// Get all pruchases
/// Get all purchases
/// </summary>
/// <param name="itemType"></param>
/// <returns></returns>
Expand Down Expand Up @@ -100,15 +100,15 @@ public async override Task<InAppBillingPurchase> PurchaseAsync(string productId,
var purchaseResult = await CurrentAppMock.RequestProductPurchaseAsync(InTestingMode, productId);


if (purchaseResult == null)
return null;
if (purchaseResult == null)
return null;

if (string.IsNullOrWhiteSpace(purchaseResult.ReceiptXml))
return null;
if (string.IsNullOrWhiteSpace(purchaseResult.ReceiptXml))
return null;

// Transform it to InAppBillingPurchase
return purchaseResult.ReceiptXml.ToInAppBillingPurchase(purchaseResult.Status).FirstOrDefault();

// Transform it to InAppBillingPurchase
return purchaseResult.ReceiptXml.ToInAppBillingPurchase(purchaseResult.Status).FirstOrDefault();

}

/// <summary>
Expand All @@ -124,8 +124,8 @@ public async override Task<InAppBillingPurchase> PurchaseAsync(string productId,
/// <param name="productId">Id or Sku of product</param>
/// <param name="transactionIdentifier">Original Purchase Token</param>
/// <returns>If consumed successful</returns>
/// <exception cref="InAppBillingPurchaseException">If an error occures during processing</exception>
public async override Task<bool> ConsumePurchaseAsync(string productId, string transactionIdentifier)
/// <exception cref="InAppBillingPurchaseException">If an error occurs during processing</exception>
public async override Task<bool> ConsumePurchaseAsync(string productId, string transactionIdentifier, int quantity)
{
var result = await CurrentAppMock.ReportConsumableFulfillmentAsync(InTestingMode, productId, new Guid(transactionIdentifier));
return result switch
Expand Down Expand Up @@ -184,14 +184,14 @@ public static IEnumerable<InAppBillingPurchase> ToInAppBillingPurchase(this stri
var purchases = new List<InAppBillingPurchase>();

var xmlDoc = new XmlDocument();
try
{
xmlDoc.LoadXml(xml);
}
catch
{
//Invalid XML, we haven't finished this transaction yet.
}
try
{
xmlDoc.LoadXml(xml);
}
catch
{
//Invalid XML, we haven't finished this transaction yet.
}

// Iterate through all ProductReceipt elements
var xmlProductReceipts = xmlDoc.GetElementsByTagName("ProductReceipt");
Expand Down
Loading