Skip to content

Commit

Permalink
Merge e8c4e4a into 8802f2a
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesmontemagno committed May 31, 2023
2 parents 8802f2a + e8c4e4a commit 1b9da57
Show file tree
Hide file tree
Showing 8 changed files with 205 additions and 144 deletions.
8 changes: 8 additions & 0 deletions nuget/readme.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
In-App Billing Plugin for .NET MAUI, Xamarin, & Windows

Version 7.0+ - Major Android updates
1.) You must compile and target against Android 12 or higher
2.) Android: Now using Android Billing v6
3.) Android: Major changes to Android product details, subscriptions, and more

Please read through: https://developer.android.com/google/play/billing/migrate-gpblv6


Version 5.0+ has significant updates!
1.) We have removed IInAppBillingVerifyPurchase from all methods. All data required to handle this yourself is returned.
2.) iOS ReceiptURL data is avaialble via ReceiptData
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,6 @@
<Project>{6D4D9135-F225-4626-A9CE-32BDF97AEA89}</Project>
<Name>InAppBillingTests</Name>
</ProjectReference>
<ProjectReference Include="..\..\Plugin.InAppBilling\Plugin.InAppBilling.csproj">
<Project>{C570E25E-259F-4D4C-88F0-B2982815192D}</Project>
<Name>Plugin.InAppBilling</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Mac\Xamarin.Mac.CSharp.targets" />
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,5 @@
<Project>{6D4D9135-F225-4626-A9CE-32BDF97AEA89}</Project>
<Name>InAppBillingTests</Name>
</ProjectReference>
<ProjectReference Include="..\..\Plugin.InAppBilling\Plugin.InAppBilling.csproj">
<Project>{C570E25E-259F-4D4C-88F0-B2982815192D}</Project>
<Name>Plugin.InAppBilling</Name>
</ProjectReference>
</ItemGroup>
</Project>
40 changes: 26 additions & 14 deletions src/Plugin.InAppBilling/Converters.android.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,27 +54,39 @@ internal static InAppBillingPurchase ToIABPurchase(this PurchaseHistoryRecord pu
};
}

internal static InAppBillingProduct ToIAPProduct(this SkuDetails product)
internal static InAppBillingProduct ToIAPProduct(this ProductDetails product)
{
var oneTime = product.GetOneTimePurchaseOfferDetails();
var subs = product.GetSubscriptionOfferDetails()?.Select(s => new SubscriptionOfferDetail
{
BasePlanId = s.BasePlanId,
OfferId = s.OfferId,
OfferTags = s.OfferTags?.ToList(),
OfferToken = s.OfferToken,
PricingPhases = s?.PricingPhases?.PricingPhaseList?.Select(p =>
new PricingPhase
{
BillingCycleCount = p.BillingCycleCount,
BillingPeriod = p.BillingPeriod,
FormattedPrice = p.FormattedPrice,
PriceAmountMicros = p.PriceAmountMicros,
PriceCurrencyCode = p.PriceCurrencyCode,
RecurrenceMode = p.RecurrenceMode
}).ToList()
});

return new InAppBillingProduct
{
Name = product.Title,
Description = product.Description,
CurrencyCode = product.PriceCurrencyCode,
LocalizedPrice = product.Price,
ProductId = product.Sku,
MicrosPrice = product.PriceAmountMicros,
CurrencyCode = oneTime?.PriceCurrencyCode,
LocalizedPrice = oneTime?.FormattedPrice,
ProductId = product.ProductId,
MicrosPrice = oneTime?.PriceAmountMicros ?? 0,

AndroidExtras = new InAppBillingProductAndroidExtras
{
SubscriptionPeriod = product.SubscriptionPeriod,
LocalizedIntroductoryPrice = product.IntroductoryPrice,
MicrosIntroductoryPrice = product.IntroductoryPriceAmountMicros,
FreeTrialPeriod = product.FreeTrialPeriod,
IconUrl = product.IconUrl,
IntroductoryPriceCycles = product.IntroductoryPriceCycles,
IntroductoryPricePeriod = product.IntroductoryPricePeriod,
MicrosOriginalPriceAmount = product.OriginalPriceAmountMicros,
OriginalPrice = product.OriginalPrice

}
};
}
Expand Down

0 comments on commit 1b9da57

Please sign in to comment.