From 1b1ec27222107eee976faae18476bf088502b1d0 Mon Sep 17 00:00:00 2001 From: Maurits van Beusekom Date: Mon, 20 Sep 2021 17:10:36 +0200 Subject: [PATCH 1/3] Update tests to prove issue 90244. Updates the SKUDetailsWrapper map used in the unit test to match the output from the JAVA code and causes the tests to fail (proving issue 90244). --- .../test/billing_client_wrappers/sku_details_wrapper_test.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/in_app_purchase/in_app_purchase_android/test/billing_client_wrappers/sku_details_wrapper_test.dart b/packages/in_app_purchase/in_app_purchase_android/test/billing_client_wrappers/sku_details_wrapper_test.dart index b8ba9d5cc854..62d9104f3738 100644 --- a/packages/in_app_purchase/in_app_purchase_android/test/billing_client_wrappers/sku_details_wrapper_test.dart +++ b/packages/in_app_purchase/in_app_purchase_android/test/billing_client_wrappers/sku_details_wrapper_test.dart @@ -134,7 +134,7 @@ Map buildSkuMap(SkuDetailsWrapper original) { 'description': original.description, 'freeTrialPeriod': original.freeTrialPeriod, 'introductoryPrice': original.introductoryPrice, - 'introductoryPriceMicros': original.introductoryPriceMicros, + 'introductoryPriceAmountMicros': original.introductoryPriceMicros, 'introductoryPriceCycles': original.introductoryPriceCycles, 'introductoryPricePeriod': original.introductoryPricePeriod, 'price': original.price, From 77e2c6ddaae95600b1b93f9d51350fb155a045f9 Mon Sep 17 00:00:00 2001 From: Maurits van Beusekom Date: Mon, 20 Sep 2021 17:15:20 +0200 Subject: [PATCH 2/3] Use correct JSON key for introductoryPriceMicros. The SKUDetailsWrapper property is send using a JSON key with the name `introductoryPriceAmountMicros`. This commit updates the JSON key to use the correct name and makes sure it passes all unit tests again. --- .../lib/src/billing_client_wrappers/sku_details_wrapper.dart | 2 +- .../src/billing_client_wrappers/sku_details_wrapper.g.dart | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/in_app_purchase/in_app_purchase_android/lib/src/billing_client_wrappers/sku_details_wrapper.dart b/packages/in_app_purchase/in_app_purchase_android/lib/src/billing_client_wrappers/sku_details_wrapper.dart index 5bbe7504783d..9c349badbb04 100644 --- a/packages/in_app_purchase/in_app_purchase_android/lib/src/billing_client_wrappers/sku_details_wrapper.dart +++ b/packages/in_app_purchase/in_app_purchase_android/lib/src/billing_client_wrappers/sku_details_wrapper.dart @@ -68,7 +68,7 @@ class SkuDetailsWrapper { final String introductoryPrice; /// [introductoryPrice] in micro-units 990000 - @JsonKey(defaultValue: '') + @JsonKey(name: 'introductoryPriceAmountMicros', defaultValue: '') final String introductoryPriceMicros; /// The number of subscription billing periods for which the user will be given the introductory price, such as 3. diff --git a/packages/in_app_purchase/in_app_purchase_android/lib/src/billing_client_wrappers/sku_details_wrapper.g.dart b/packages/in_app_purchase/in_app_purchase_android/lib/src/billing_client_wrappers/sku_details_wrapper.g.dart index 49e86087bc13..d21f832a2de6 100644 --- a/packages/in_app_purchase/in_app_purchase_android/lib/src/billing_client_wrappers/sku_details_wrapper.g.dart +++ b/packages/in_app_purchase/in_app_purchase_android/lib/src/billing_client_wrappers/sku_details_wrapper.g.dart @@ -11,7 +11,8 @@ SkuDetailsWrapper _$SkuDetailsWrapperFromJson(Map json) { description: json['description'] as String? ?? '', freeTrialPeriod: json['freeTrialPeriod'] as String? ?? '', introductoryPrice: json['introductoryPrice'] as String? ?? '', - introductoryPriceMicros: json['introductoryPriceMicros'] as String? ?? '', + introductoryPriceMicros: + json['introductoryPriceAmountMicros'] as String? ?? '', introductoryPriceCycles: json['introductoryPriceCycles'] as int? ?? 0, introductoryPricePeriod: json['introductoryPricePeriod'] as String? ?? '', price: json['price'] as String? ?? '', @@ -32,7 +33,7 @@ Map _$SkuDetailsWrapperToJson(SkuDetailsWrapper instance) => 'description': instance.description, 'freeTrialPeriod': instance.freeTrialPeriod, 'introductoryPrice': instance.introductoryPrice, - 'introductoryPriceMicros': instance.introductoryPriceMicros, + 'introductoryPriceAmountMicros': instance.introductoryPriceMicros, 'introductoryPriceCycles': instance.introductoryPriceCycles, 'introductoryPricePeriod': instance.introductoryPricePeriod, 'price': instance.price, From 172201d8e6996014a885fd3452ea9e9d908cff90 Mon Sep 17 00:00:00 2001 From: Maurits van Beusekom Date: Mon, 20 Sep 2021 17:20:00 +0200 Subject: [PATCH 3/3] Bump version number. Update version to 0.1.4+7 and added a change description to the CHANGELOG.md. --- packages/in_app_purchase/in_app_purchase_android/CHANGELOG.md | 4 ++++ packages/in_app_purchase/in_app_purchase_android/pubspec.yaml | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/in_app_purchase/in_app_purchase_android/CHANGELOG.md b/packages/in_app_purchase/in_app_purchase_android/CHANGELOG.md index 1a03ba27feb7..7a998d0547de 100644 --- a/packages/in_app_purchase/in_app_purchase_android/CHANGELOG.md +++ b/packages/in_app_purchase/in_app_purchase_android/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.1.4+7 + +* Ensure that the `SkuDetailsWrapper.introductoryPriceMicros` is populated correctly. + ## 0.1.4+6 * Ensure that purchases correctly indicate whether they are acknowledged or not. The `PurchaseDetails.pendingCompletePurchase` field now correctly indicates if the purchase still needs to be completed. diff --git a/packages/in_app_purchase/in_app_purchase_android/pubspec.yaml b/packages/in_app_purchase/in_app_purchase_android/pubspec.yaml index d9b09827824b..64a40889f375 100644 --- a/packages/in_app_purchase/in_app_purchase_android/pubspec.yaml +++ b/packages/in_app_purchase/in_app_purchase_android/pubspec.yaml @@ -2,7 +2,7 @@ name: in_app_purchase_android description: An implementation for the Android platform of the Flutter `in_app_purchase` plugin. This uses the Android BillingClient APIs. repository: https://github.com/flutter/plugins/tree/master/packages/in_app_purchase/in_app_purchase_android issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+in_app_purchase%22 -version: 0.1.4+6 +version: 0.1.4+7 environment: sdk: ">=2.12.0 <3.0.0"