@capgo/native-purchases 0.0.28 → 0.0.29

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -183,9 +183,9 @@ public class NativePurchasesPlugin extends Plugin {
183
183
  call.reject("productType is empty");
184
184
  return;
185
185
  }
186
- if (planIdentifier.isEmpty()) {
187
- // Handle error: quantity is less than 1
188
- call.reject("productType is empty");
186
+ if (productType.equals("subs") && planIdentifier.isEmpty()) {
187
+ // Handle error: no planIdentifier with productType subs
188
+ call.reject("planIdentifier cannot be empty if productType is subs");
189
189
  return;
190
190
  }
191
191
  if (quantity.intValue() < 1) {
@@ -277,11 +277,16 @@ public class NativePurchasesPlugin extends Plugin {
277
277
  public void getProducts(PluginCall call) {
278
278
  JSONArray productIdentifiersArray = call.getArray("productIdentifiers");
279
279
  String planIdentifier = call.getString("planIdentifier");
280
- if (productIdentifiersArray == null) {
281
- call.reject("productIdentifiers is missing");
280
+ String productType = call.getString("productType", "inapp");
281
+ if (productType.equals("subs") && planIdentifier.isEmpty()) {
282
+ // Handle error: no planIdentifier with productType subs
283
+ call.reject("planIdentifier cannot be empty if productType is subs");
284
+ return;
285
+ }
286
+ if (productIdentifiersArray == null || productIdentifiersArray.length() == 0) {
287
+ call.reject("productIdentifiers array missing");
282
288
  return;
283
289
  }
284
- String productType = call.getString("productType", "inapp");
285
290
  List<String> productIdentifiers = new ArrayList<>();
286
291
 
287
292
  for (int i = 0; i < productIdentifiersArray.length(); i++) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capgo/native-purchases",
3
- "version": "0.0.28",
3
+ "version": "0.0.29",
4
4
  "description": "In-app Subscriptions Made Easy",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",