Skip to content

Commit d2ed57a

Browse files
authored
New Unified StoreReplacementMode APIs (#1622)
1 parent 4fbedfe commit d2ed57a

7 files changed

Lines changed: 994 additions & 17 deletions

File tree

android/api-tests/src/test/java/com/revenuecat/apitests/java/CommonApiTests.java

Lines changed: 51 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ private void checkPurchaseProduct(Activity activity,
4949
OnResult onResult,
5050
List<Map<String, Object>> addOnStoreProducts,
5151
List<Map<String, Object>> addOnSubscriptionOptions,
52-
List<Map<String, Object>> addOnPackages) {
52+
List<Map<String, Object>> addOnPackages,
53+
String storeReplacementModeString) {
5354
CommonKt.purchaseProduct(
5455
activity,
5556
productIdentifier,
@@ -103,6 +104,22 @@ private void checkPurchaseProduct(Activity activity,
103104
addOnSubscriptionOptions,
104105
addOnPackages
105106
);
107+
108+
CommonKt.purchaseProduct(
109+
activity,
110+
productIdentifier,
111+
type,
112+
googleBasePlanId,
113+
googleOldProductId,
114+
googleReplacementMode,
115+
googleIsPersonalizedPrice,
116+
presentedOfferingContext,
117+
onResult,
118+
addOnStoreProducts,
119+
addOnSubscriptionOptions,
120+
addOnPackages,
121+
storeReplacementModeString
122+
);
106123
}
107124

108125
private void checkPurchasePackage(Activity activity,
@@ -114,7 +131,8 @@ private void checkPurchasePackage(Activity activity,
114131
OnResult onResult,
115132
List<Map<String, Object>> addOnStoreProducts,
116133
List<Map<String, Object>> addOnSubscriptionOptions,
117-
List<Map<String, Object>> addOnPackages) {
134+
List<Map<String, Object>> addOnPackages,
135+
String storeReplacementModeString) {
118136
CommonKt.purchasePackage(
119137
activity,
120138
packageIdentifier,
@@ -160,6 +178,20 @@ private void checkPurchasePackage(Activity activity,
160178
addOnSubscriptionOptions,
161179
addOnPackages
162180
);
181+
182+
CommonKt.purchasePackage(
183+
activity,
184+
packageIdentifier,
185+
presentedOfferingContext,
186+
googleOldProductId,
187+
googleReplacementMode,
188+
googleIsPersonalizedPrice,
189+
onResult,
190+
addOnStoreProducts,
191+
addOnSubscriptionOptions,
192+
addOnPackages,
193+
storeReplacementModeString
194+
);
163195
}
164196

165197
private void checkPurchaseSubscriptionOption(Activity activity,
@@ -172,7 +204,8 @@ private void checkPurchaseSubscriptionOption(Activity activity,
172204
OnResult onResult,
173205
List<Map<String, Object>> addOnStoreProducts,
174206
List<Map<String, Object>> addOnSubscriptionOptions,
175-
List<Map<String, Object>> addOnPackages) {
207+
List<Map<String, Object>> addOnPackages,
208+
String storeReplacementModeString) {
176209
CommonKt.purchaseSubscriptionOption(
177210
activity,
178211
productIdentifier,
@@ -222,6 +255,21 @@ private void checkPurchaseSubscriptionOption(Activity activity,
222255
addOnSubscriptionOptions,
223256
addOnPackages
224257
);
258+
259+
CommonKt.purchaseSubscriptionOption(
260+
activity,
261+
productIdentifier,
262+
optionIdentifier,
263+
googleOldProductId,
264+
googleReplacementMode,
265+
googleIsPersonalizedPrice,
266+
presentedOfferingContext,
267+
onResult,
268+
addOnStoreProducts,
269+
addOnSubscriptionOptions,
270+
addOnPackages,
271+
storeReplacementModeString
272+
);
225273
}
226274

227275
private void checkGetStorefront() {

android/api-tests/src/test/java/com/revenuecat/apitests/kotlin/CommonApiTests.kt

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ private class CommonApiTests {
7070
purchase(activity, options, onResult)
7171
}
7272

73+
@Suppress("LongMethod")
7374
fun checkPurchaseProduct(
7475
activity: Activity?,
7576
productIdentifier: String,
@@ -82,6 +83,7 @@ private class CommonApiTests {
8283
addOnStoreProducts: List<Map<String, Any?>>?,
8384
addOnSubscriptionOptions: List<Map<String, Any?>>?,
8485
addOnPackages: List<Map<String, Any?>>?,
86+
storeReplacementModeString: String?,
8587
onResult: OnResult,
8688
) {
8789
purchaseProduct(
@@ -137,6 +139,22 @@ private class CommonApiTests {
137139
addOnSubscriptionOptions,
138140
addOnPackages,
139141
)
142+
143+
purchaseProduct(
144+
activity,
145+
productIdentifier,
146+
type,
147+
googleBasePlanId,
148+
googleOldProductId,
149+
googleReplacementMode,
150+
googleIsPersonalizedPrice,
151+
presentedOfferingContext,
152+
onResult,
153+
addOnStoreProducts,
154+
addOnSubscriptionOptions,
155+
addOnPackages,
156+
storeReplacementModeString,
157+
)
140158
}
141159

142160
fun checkPurchasePackage(
@@ -150,6 +168,7 @@ private class CommonApiTests {
150168
addOnStoreProducts: List<Map<String, Any?>>?,
151169
addOnSubscriptionOptions: List<Map<String, Any?>>?,
152170
addOnPackages: List<Map<String, Any?>>?,
171+
storeReplacementModeString: String?,
153172
) {
154173
purchasePackage(
155174
activity,
@@ -196,8 +215,23 @@ private class CommonApiTests {
196215
addOnSubscriptionOptions,
197216
addOnPackages,
198217
)
218+
219+
purchasePackage(
220+
activity,
221+
packageIdentifier,
222+
presentedOfferingContext,
223+
googleOldProductId,
224+
googleReplacementMode,
225+
googleIsPersonalizedPrice,
226+
onResult,
227+
addOnStoreProducts,
228+
addOnSubscriptionOptions,
229+
addOnPackages,
230+
storeReplacementModeString,
231+
)
199232
}
200233

234+
@Suppress("LongMethod")
201235
fun checkPurchaseSubscriptionOption(
202236
activity: Activity?,
203237
productIdentifier: String,
@@ -210,6 +244,7 @@ private class CommonApiTests {
210244
addOnStoreProducts: List<Map<String, Any?>>?,
211245
addOnSubscriptionOptions: List<Map<String, Any?>>?,
212246
addOnPackages: List<Map<String, Any?>>?,
247+
storeReplacementModeString: String?,
213248
) {
214249
purchaseSubscriptionOption(
215250
activity,
@@ -260,6 +295,21 @@ private class CommonApiTests {
260295
addOnSubscriptionOptions,
261296
addOnPackages,
262297
)
298+
299+
purchaseSubscriptionOption(
300+
activity,
301+
productIdentifier,
302+
optionIdentifier,
303+
googleOldProductId,
304+
googleReplacementMode,
305+
googleIsPersonalizedPrice,
306+
presentedOfferingContext,
307+
onResult,
308+
addOnStoreProducts,
309+
addOnSubscriptionOptions,
310+
addOnPackages,
311+
storeReplacementModeString,
312+
)
263313
}
264314

265315
fun checkGetAppUserId() {

0 commit comments

Comments
 (0)