feat: expose currencyCode on Product struct in IAP module (#25058)

Co-authored-by: Shur Singh <ssingh@evernote.com>
This commit is contained in:
shur 2020-08-21 10:41:40 -07:00 committed by GitHub
parent 5d3301769b
commit a17e97c3b2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 15 additions and 0 deletions

View file

@ -7,4 +7,5 @@
* `contentLengths` Number[] - The total size of the content, in bytes. * `contentLengths` Number[] - The total size of the content, in bytes.
* `price` Number - The cost of the product in the local currency. * `price` Number - The cost of the product in the local currency.
* `formattedPrice` String - The locale formatted price of the product. * `formattedPrice` String - The locale formatted price of the product.
* `currencyCode` String - 3 character code presenting a product's currency based on the ISO 4217 standard.
* `isDownloadable` Boolean - A Boolean value that indicates whether the App Store has downloadable content for this product. `true` if at least one file has been associated with the product. * `isDownloadable` Boolean - A Boolean value that indicates whether the App Store has downloadable content for this product. `true` if at least one file has been associated with the product.

View file

@ -61,6 +61,9 @@ struct Converter<in_app_purchase::Product> {
dict.Set("price", val.price); dict.Set("price", val.price);
dict.Set("formattedPrice", val.formattedPrice); dict.Set("formattedPrice", val.formattedPrice);
// Currency Information
dict.Set("currencyCode", val.currencyCode);
// Downloadable Content Information // Downloadable Content Information
dict.Set("isDownloadable", val.isDownloadable); dict.Set("isDownloadable", val.isDownloadable);

View file

@ -28,6 +28,9 @@ struct Product {
double price = 0.0; double price = 0.0;
std::string formattedPrice; std::string formattedPrice;
// Currency Information
std::string currencyCode;
// Downloadable Content Information // Downloadable Content Information
bool isDownloadable = false; bool isDownloadable = false;

View file

@ -146,6 +146,14 @@
productStruct.formattedPrice = productStruct.formattedPrice =
[[self formatPrice:product.price [[self formatPrice:product.price
withLocal:product.priceLocale] UTF8String]; withLocal:product.priceLocale] UTF8String];
// Currency Information
if (@available(macOS 10.12, *)) {
if (product.priceLocale.currencyCode != nil) {
productStruct.currencyCode =
[product.priceLocale.currencyCode UTF8String];
}
}
} }
} }