11import Entitlement from './dto/Entitlement' ;
22import Product from './dto/Product' ;
3- import { UserPropertyKey , ProrationMode , AttributionProvider } from './dto/enums' ;
3+ import { UserPropertyKey , AttributionProvider } from './dto/enums' ;
44import Offerings from './dto/Offerings' ;
55import IntroEligibility from './dto/IntroEligibility' ;
66import User from './dto/User' ;
77import { EntitlementsUpdateListener } from './dto/EntitlementsUpdateListener' ;
88import { PromoPurchasesListener } from './dto/PromoPurchasesListener' ;
99import RemoteConfig from "./dto/RemoteConfig" ;
1010import UserProperties from './dto/UserProperties' ;
11+ import PurchaseModel from './dto/PurchaseModel' ;
12+ import PurchaseUpdateModel from './dto/PurchaseUpdateModel' ;
1113
1214interface QonversionApi {
1315
@@ -25,68 +27,30 @@ interface QonversionApi {
2527
2628 /**
2729 * Make a purchase and validate it through server-to-server using Qonversion's Backend
28- *
29- * @param productId Qonversion product identifier for purchase
30+ * @param purchaseModel necessary information for purchase
3031 * @returns the promise with the user entitlements including the ones obtained by the purchase
31- */
32- purchase ( productId : string ) : Promise < Map < string , Entitlement > > ;
33-
34- /**
35- * Make a purchase and validate it through server-to-server using Qonversion's Backend
3632 *
37- * @param product - Qonversion's {@link Product} object
38- * @returns the promise with the user entitlements including the ones obtained by the purchase
33+ * @see [Making Purchases](https://documentation.qonversion.io/docs/making-purchases)
3934 */
40- purchaseProduct ( product : Product ) : Promise < Map < string , Entitlement > > ;
35+ purchase ( purchaseModel : PurchaseModel ) : Promise < Map < string , Entitlement > > ;
4136
4237 /**
4338 * Android only. Returns `null` if called on iOS.
4439 *
4540 * Update (upgrade/downgrade) subscription on Google Play Store and validate it through server-to-server using Qonversion's Backend
4641 *
47- * @param productId Qonversion product identifier for purchase
48- * @param oldProductId Qonversion product identifier from which the upgrade/downgrade will be initialized
49- * @param prorationMode proration mode
42+ * @param purchaseUpdateModel necessary information for purchase update
5043 * @returns the promise with the user entitlements including updated ones.
5144 *
52- * @see [Google Play Documentation](https://developer.android.com/google/play/billing/subscriptions#upgrade-downgrade)
53- * for more details.
54- * @see [Proration mode](https://developer.android.com/google/play/billing/subscriptions#proration)
55- * @see [Product Center](https://qonversion.io/docs/product-center)
45+ * @see [Update policy](https://developer.android.com/google/play/billing/subscriptions#replacement-modes)
46+ * @see [Making Purchases](https://documentation.qonversion.io/docs/making-purchases)
5647 */
57- updatePurchase (
58- productId : string ,
59- oldProductId : string ,
60- prorationMode : ProrationMode | undefined
61- ) : Promise < Map < string , Entitlement > | null > ;
62-
63- /**
64- * Android only. Returns `null` if called on iOS.
65- *
66- * Update (upgrade/downgrade) subscription on Google Play Store and validate it through server-to-server using Qonversion's Backend
67- *
68- * @param product Qonversion product for purchase
69- * @param oldProductId Qonversion product identifier from which the upgrade/downgrade will be initialized
70- * @param prorationMode proration mode
71- * @returns the promise with the user entitlements including updated ones
72- *
73- * @see [Google Play Documentation](https://developer.android.com/google/play/billing/subscriptions#upgrade-downgrade)
74- * for more details.
75- * @see [Proration mode](https://developer.android.com/google/play/billing/subscriptions#proration)
76- * @see [Product Center](https://qonversion.io/docs/product-center)
77- */
78- updatePurchaseWithProduct (
79- product : Product ,
80- oldProductId : String ,
81- prorationMode : ProrationMode | undefined
82- ) : Promise < Map < string , Entitlement > | null > ;
48+ updatePurchase ( purchaseUpdateModel : PurchaseUpdateModel ) : Promise < Map < string , Entitlement > | null > ;
8349
8450 /**
8551 * Returns Qonversion products in association with Apple and Google Play Store Products.
8652 *
8753 * @returns the promise with Qonversion products
88- *
89- * @see [Product Center](https://qonversion.io/docs/product-center)
9054 */
9155 products ( ) : Promise < Map < string , Product > > ;
9256
@@ -101,7 +65,6 @@ interface QonversionApi {
10165 * @returns the promise with Qonversion offerings
10266 *
10367 * @see [Offerings](https://qonversion.io/docs/offerings) for more details
104- * @see [Product Center](https://qonversion.io/docs/product-center) for more details
10568 */
10669 offerings ( ) : Promise < Offerings | null > ;
10770
0 commit comments