File tree 2 files changed +39
-0
lines changed
packages/in_app_purchase/in_app_purchase_platform_interface
2 files changed +39
-0
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,8 @@ class ProductDetails {
10
10
required this .title,
11
11
required this .description,
12
12
required this .price,
13
+ required this .rawPrice,
14
+ required this .currencyCode,
13
15
});
14
16
15
17
/// The identifier of the product.
@@ -31,4 +33,13 @@ class ProductDetails {
31
33
///
32
34
/// For example, on iOS it is specified in App Store Connect; on Android, it is specified in Google Play Console.
33
35
final String price;
36
+
37
+ /// The unformatted price of the product, specified in the App Store Connect or Sku in Google Play console based on the platform.
38
+ /// The currency unit for this value can be found in the [currencyCode] property.
39
+ /// The value always describes full units of the currency. (e.g. 2.45 in the case of $2.45)
40
+ final double rawPrice;
41
+
42
+ /// The currency code for the price of the product.
43
+ /// Based on the price specified in the App Store Connect or Sku in Google Play console based on the platform.
44
+ final String currencyCode;
34
45
}
Original file line number Diff line number Diff line change
1
+ // Copyright 2013 The Flutter Authors. All rights reserved.
2
+ // Use of this source code is governed by a BSD-style license that can be
3
+ // found in the LICENSE file.
4
+
5
+ import 'package:flutter_test/flutter_test.dart' ;
6
+ import 'package:in_app_purchase_platform_interface/in_app_purchase_platform_interface.dart' ;
7
+
8
+ void main () {
9
+ group ('Constructor Tests' , () {
10
+ test (
11
+ 'fromSkProduct should correctly parse data from a SKProductWrapper instance.' ,
12
+ () {
13
+ final ProductDetails productDetails = ProductDetails (
14
+ id: 'id' ,
15
+ title: 'title' ,
16
+ description: 'description' ,
17
+ price: '13.37' ,
18
+ currencyCode: 'USD' ,
19
+ rawPrice: 13.37 );
20
+
21
+ expect (productDetails.id, 'id' );
22
+ expect (productDetails.title, 'title' );
23
+ expect (productDetails.description, 'description' );
24
+ expect (productDetails.rawPrice, 13.37 );
25
+ expect (productDetails.currencyCode, 'USD' );
26
+ });
27
+ });
28
+ }
You can’t perform that action at this time.
0 commit comments