react-native-iap 14.4.33 â 14.4.35-rc.1
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.
- package/android/build.gradle +5 -0
- package/android/src/main/java/com/margelo/nitro/iap/HybridRnIap.kt +42 -26
- package/android/src/test/java/com/margelo/nitro/iap/OpenIapExceptionTest.kt +93 -0
- package/ios/reactnativeiap.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
- package/ios/reactnativeiap.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
- package/lib/module/index.js +184 -46
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/plugin/build/src/withIAP.d.ts +3 -0
- package/plugin/build/src/withIAP.js +81 -0
- package/plugin/build/tsconfig.tsbuildinfo +1 -0
- package/plugin/tsconfig.tsbuildinfo +1 -1
- package/src/index.ts +187 -46
package/package.json
CHANGED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const config_plugins_1 = require("expo/config-plugins");
|
|
4
|
+
const pkg = require('../../package.json');
|
|
5
|
+
// Global flag to prevent duplicate logs
|
|
6
|
+
let hasLoggedPluginExecution = false;
|
|
7
|
+
const addLineToGradle = (content, anchor, lineToAdd, offset = 1) => {
|
|
8
|
+
const lines = content.split('\n');
|
|
9
|
+
const index = lines.findIndex((line) => line.match(anchor));
|
|
10
|
+
if (index === -1) {
|
|
11
|
+
console.warn(`Anchor "${anchor}" not found in build.gradle. Appending to end.`);
|
|
12
|
+
lines.push(lineToAdd);
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
lines.splice(index + offset, 0, lineToAdd);
|
|
16
|
+
}
|
|
17
|
+
return lines.join('\n');
|
|
18
|
+
};
|
|
19
|
+
const modifyAppBuildGradle = (gradle) => {
|
|
20
|
+
let modified = gradle;
|
|
21
|
+
// Add billing library dependencies to app-level build.gradle
|
|
22
|
+
const billingDep = ` implementation "com.android.billingclient:billing-ktx:8.0.0"`;
|
|
23
|
+
const gmsDep = ` implementation "com.google.android.gms:play-services-base:18.1.0"`;
|
|
24
|
+
let hasAddedDependency = false;
|
|
25
|
+
if (!modified.includes(billingDep)) {
|
|
26
|
+
modified = addLineToGradle(modified, /dependencies\s*{/, billingDep);
|
|
27
|
+
hasAddedDependency = true;
|
|
28
|
+
}
|
|
29
|
+
if (!modified.includes(gmsDep)) {
|
|
30
|
+
modified = addLineToGradle(modified, /dependencies\s*{/, gmsDep, 1);
|
|
31
|
+
hasAddedDependency = true;
|
|
32
|
+
}
|
|
33
|
+
// Log only once and only if we actually added dependencies
|
|
34
|
+
if (hasAddedDependency && !hasLoggedPluginExecution) {
|
|
35
|
+
console.log('đ ī¸ react-native-iap: Added billing dependencies to build.gradle');
|
|
36
|
+
}
|
|
37
|
+
return modified;
|
|
38
|
+
};
|
|
39
|
+
const withIapAndroid = (config) => {
|
|
40
|
+
// Add IAP dependencies to app build.gradle
|
|
41
|
+
config = (0, config_plugins_1.withAppBuildGradle)(config, (config) => {
|
|
42
|
+
config.modResults.contents = modifyAppBuildGradle(config.modResults.contents);
|
|
43
|
+
return config;
|
|
44
|
+
});
|
|
45
|
+
config = (0, config_plugins_1.withAndroidManifest)(config, (config) => {
|
|
46
|
+
const manifest = config.modResults;
|
|
47
|
+
if (!manifest.manifest['uses-permission']) {
|
|
48
|
+
manifest.manifest['uses-permission'] = [];
|
|
49
|
+
}
|
|
50
|
+
const permissions = manifest.manifest['uses-permission'];
|
|
51
|
+
const billingPerm = { $: { 'android:name': 'com.android.vending.BILLING' } };
|
|
52
|
+
const alreadyExists = permissions.some((p) => p.$['android:name'] === 'com.android.vending.BILLING');
|
|
53
|
+
if (!alreadyExists) {
|
|
54
|
+
permissions.push(billingPerm);
|
|
55
|
+
if (!hasLoggedPluginExecution) {
|
|
56
|
+
console.log('â
Added com.android.vending.BILLING to AndroidManifest.xml');
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
if (!hasLoggedPluginExecution) {
|
|
61
|
+
console.log('âšī¸ com.android.vending.BILLING already exists in AndroidManifest.xml');
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return config;
|
|
65
|
+
});
|
|
66
|
+
return config;
|
|
67
|
+
};
|
|
68
|
+
const withIAP = (config, _props) => {
|
|
69
|
+
try {
|
|
70
|
+
const result = withIapAndroid(config);
|
|
71
|
+
// Set flag after first execution to prevent duplicate logs
|
|
72
|
+
hasLoggedPluginExecution = true;
|
|
73
|
+
return result;
|
|
74
|
+
}
|
|
75
|
+
catch (error) {
|
|
76
|
+
config_plugins_1.WarningAggregator.addWarningAndroid('react-native-iap', `react-native-iap plugin encountered an error: ${error}`);
|
|
77
|
+
console.error('react-native-iap plugin error:', error);
|
|
78
|
+
return config;
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
exports.default = (0, config_plugins_1.createRunOncePlugin)(withIAP, pkg.name, pkg.version);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"root":["../src/withiap.ts"],"version":"5.9.2"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"root":["./src/
|
|
1
|
+
{"root":["./src/withiap.ts"],"version":"5.9.2"}
|
package/src/index.ts
CHANGED
|
@@ -47,7 +47,10 @@ import {
|
|
|
47
47
|
convertNitroSubscriptionStatusToSubscriptionStatusIOS,
|
|
48
48
|
} from './utils/type-bridge';
|
|
49
49
|
import {parseErrorStringToJsonObj} from './utils/error';
|
|
50
|
-
import {
|
|
50
|
+
import {
|
|
51
|
+
normalizeErrorCodeFromNative,
|
|
52
|
+
createPurchaseError,
|
|
53
|
+
} from './utils/errorMapping';
|
|
51
54
|
import {RnIapConsole} from './utils/debug';
|
|
52
55
|
import {getSuccessFromPurchaseVariant} from './utils/purchase';
|
|
53
56
|
import {parseAppTransactionPayload} from './utils';
|
|
@@ -616,8 +619,13 @@ export const getPromotedProductIOS: QueryField<
|
|
|
616
619
|
return converted.platform === 'ios' ? (converted as ProductIOS) : null;
|
|
617
620
|
} catch (error) {
|
|
618
621
|
RnIapConsole.error('[getPromotedProductIOS] Failed:', error);
|
|
619
|
-
const
|
|
620
|
-
throw
|
|
622
|
+
const parsedError = parseErrorStringToJsonObj(error);
|
|
623
|
+
throw createPurchaseError({
|
|
624
|
+
code: parsedError.code,
|
|
625
|
+
message: parsedError.message,
|
|
626
|
+
responseCode: parsedError.responseCode,
|
|
627
|
+
debugMessage: parsedError.debugMessage,
|
|
628
|
+
});
|
|
621
629
|
}
|
|
622
630
|
};
|
|
623
631
|
|
|
@@ -717,8 +725,13 @@ export const subscriptionStatusIOS: QueryField<
|
|
|
717
725
|
.map(convertNitroSubscriptionStatusToSubscriptionStatusIOS);
|
|
718
726
|
} catch (error) {
|
|
719
727
|
RnIapConsole.error('[subscriptionStatusIOS] Failed:', error);
|
|
720
|
-
const
|
|
721
|
-
throw
|
|
728
|
+
const parsedError = parseErrorStringToJsonObj(error);
|
|
729
|
+
throw createPurchaseError({
|
|
730
|
+
code: parsedError.code,
|
|
731
|
+
message: parsedError.message,
|
|
732
|
+
responseCode: parsedError.responseCode,
|
|
733
|
+
debugMessage: parsedError.debugMessage,
|
|
734
|
+
});
|
|
722
735
|
}
|
|
723
736
|
};
|
|
724
737
|
|
|
@@ -738,8 +751,13 @@ export const currentEntitlementIOS: QueryField<
|
|
|
738
751
|
return null;
|
|
739
752
|
} catch (error) {
|
|
740
753
|
RnIapConsole.error('[currentEntitlementIOS] Failed:', error);
|
|
741
|
-
const
|
|
742
|
-
throw
|
|
754
|
+
const parsedError = parseErrorStringToJsonObj(error);
|
|
755
|
+
throw createPurchaseError({
|
|
756
|
+
code: parsedError.code,
|
|
757
|
+
message: parsedError.message,
|
|
758
|
+
responseCode: parsedError.responseCode,
|
|
759
|
+
debugMessage: parsedError.debugMessage,
|
|
760
|
+
});
|
|
743
761
|
}
|
|
744
762
|
};
|
|
745
763
|
|
|
@@ -759,8 +777,13 @@ export const latestTransactionIOS: QueryField<'latestTransactionIOS'> = async (
|
|
|
759
777
|
return null;
|
|
760
778
|
} catch (error) {
|
|
761
779
|
RnIapConsole.error('[latestTransactionIOS] Failed:', error);
|
|
762
|
-
const
|
|
763
|
-
throw
|
|
780
|
+
const parsedError = parseErrorStringToJsonObj(error);
|
|
781
|
+
throw createPurchaseError({
|
|
782
|
+
code: parsedError.code,
|
|
783
|
+
message: parsedError.message,
|
|
784
|
+
responseCode: parsedError.responseCode,
|
|
785
|
+
debugMessage: parsedError.debugMessage,
|
|
786
|
+
});
|
|
764
787
|
}
|
|
765
788
|
};
|
|
766
789
|
|
|
@@ -780,8 +803,13 @@ export const getPendingTransactionsIOS: QueryField<
|
|
|
780
803
|
);
|
|
781
804
|
} catch (error) {
|
|
782
805
|
RnIapConsole.error('[getPendingTransactionsIOS] Failed:', error);
|
|
783
|
-
const
|
|
784
|
-
throw
|
|
806
|
+
const parsedError = parseErrorStringToJsonObj(error);
|
|
807
|
+
throw createPurchaseError({
|
|
808
|
+
code: parsedError.code,
|
|
809
|
+
message: parsedError.message,
|
|
810
|
+
responseCode: parsedError.responseCode,
|
|
811
|
+
debugMessage: parsedError.debugMessage,
|
|
812
|
+
});
|
|
785
813
|
}
|
|
786
814
|
};
|
|
787
815
|
|
|
@@ -801,8 +829,13 @@ export const showManageSubscriptionsIOS: MutationField<
|
|
|
801
829
|
);
|
|
802
830
|
} catch (error) {
|
|
803
831
|
RnIapConsole.error('[showManageSubscriptionsIOS] Failed:', error);
|
|
804
|
-
const
|
|
805
|
-
throw
|
|
832
|
+
const parsedError = parseErrorStringToJsonObj(error);
|
|
833
|
+
throw createPurchaseError({
|
|
834
|
+
code: parsedError.code,
|
|
835
|
+
message: parsedError.message,
|
|
836
|
+
responseCode: parsedError.responseCode,
|
|
837
|
+
debugMessage: parsedError.debugMessage,
|
|
838
|
+
});
|
|
806
839
|
}
|
|
807
840
|
};
|
|
808
841
|
|
|
@@ -817,8 +850,13 @@ export const isEligibleForIntroOfferIOS: QueryField<
|
|
|
817
850
|
return await IAP.instance.isEligibleForIntroOfferIOS(groupID);
|
|
818
851
|
} catch (error) {
|
|
819
852
|
RnIapConsole.error('[isEligibleForIntroOfferIOS] Failed:', error);
|
|
820
|
-
const
|
|
821
|
-
throw
|
|
853
|
+
const parsedError = parseErrorStringToJsonObj(error);
|
|
854
|
+
throw createPurchaseError({
|
|
855
|
+
code: parsedError.code,
|
|
856
|
+
message: parsedError.message,
|
|
857
|
+
responseCode: parsedError.responseCode,
|
|
858
|
+
debugMessage: parsedError.debugMessage,
|
|
859
|
+
});
|
|
822
860
|
}
|
|
823
861
|
};
|
|
824
862
|
|
|
@@ -837,8 +875,13 @@ export const getReceiptDataIOS: QueryField<'getReceiptDataIOS'> = async () => {
|
|
|
837
875
|
return await IAP.instance.getReceiptDataIOS();
|
|
838
876
|
} catch (error) {
|
|
839
877
|
RnIapConsole.error('[getReceiptDataIOS] Failed:', error);
|
|
840
|
-
const
|
|
841
|
-
throw
|
|
878
|
+
const parsedError = parseErrorStringToJsonObj(error);
|
|
879
|
+
throw createPurchaseError({
|
|
880
|
+
code: parsedError.code,
|
|
881
|
+
message: parsedError.message,
|
|
882
|
+
responseCode: parsedError.responseCode,
|
|
883
|
+
debugMessage: parsedError.debugMessage,
|
|
884
|
+
});
|
|
842
885
|
}
|
|
843
886
|
};
|
|
844
887
|
|
|
@@ -860,8 +903,13 @@ export const getReceiptIOS = async (): Promise<string> => {
|
|
|
860
903
|
return await IAP.instance.getReceiptDataIOS();
|
|
861
904
|
} catch (error) {
|
|
862
905
|
RnIapConsole.error('[getReceiptIOS] Failed:', error);
|
|
863
|
-
const
|
|
864
|
-
throw
|
|
906
|
+
const parsedError = parseErrorStringToJsonObj(error);
|
|
907
|
+
throw createPurchaseError({
|
|
908
|
+
code: parsedError.code,
|
|
909
|
+
message: parsedError.message,
|
|
910
|
+
responseCode: parsedError.responseCode,
|
|
911
|
+
debugMessage: parsedError.debugMessage,
|
|
912
|
+
});
|
|
865
913
|
}
|
|
866
914
|
};
|
|
867
915
|
|
|
@@ -883,8 +931,13 @@ export const requestReceiptRefreshIOS = async (): Promise<string> => {
|
|
|
883
931
|
return await IAP.instance.getReceiptDataIOS();
|
|
884
932
|
} catch (error) {
|
|
885
933
|
RnIapConsole.error('[requestReceiptRefreshIOS] Failed:', error);
|
|
886
|
-
const
|
|
887
|
-
throw
|
|
934
|
+
const parsedError = parseErrorStringToJsonObj(error);
|
|
935
|
+
throw createPurchaseError({
|
|
936
|
+
code: parsedError.code,
|
|
937
|
+
message: parsedError.message,
|
|
938
|
+
responseCode: parsedError.responseCode,
|
|
939
|
+
debugMessage: parsedError.debugMessage,
|
|
940
|
+
});
|
|
888
941
|
}
|
|
889
942
|
};
|
|
890
943
|
|
|
@@ -899,8 +952,13 @@ export const isTransactionVerifiedIOS: QueryField<
|
|
|
899
952
|
return await IAP.instance.isTransactionVerifiedIOS(sku);
|
|
900
953
|
} catch (error) {
|
|
901
954
|
RnIapConsole.error('[isTransactionVerifiedIOS] Failed:', error);
|
|
902
|
-
const
|
|
903
|
-
throw
|
|
955
|
+
const parsedError = parseErrorStringToJsonObj(error);
|
|
956
|
+
throw createPurchaseError({
|
|
957
|
+
code: parsedError.code,
|
|
958
|
+
message: parsedError.message,
|
|
959
|
+
responseCode: parsedError.responseCode,
|
|
960
|
+
debugMessage: parsedError.debugMessage,
|
|
961
|
+
});
|
|
904
962
|
}
|
|
905
963
|
};
|
|
906
964
|
|
|
@@ -915,8 +973,13 @@ export const getTransactionJwsIOS: QueryField<'getTransactionJwsIOS'> = async (
|
|
|
915
973
|
return await IAP.instance.getTransactionJwsIOS(sku);
|
|
916
974
|
} catch (error) {
|
|
917
975
|
RnIapConsole.error('[getTransactionJwsIOS] Failed:', error);
|
|
918
|
-
const
|
|
919
|
-
throw
|
|
976
|
+
const parsedError = parseErrorStringToJsonObj(error);
|
|
977
|
+
throw createPurchaseError({
|
|
978
|
+
code: parsedError.code,
|
|
979
|
+
message: parsedError.message,
|
|
980
|
+
responseCode: parsedError.responseCode,
|
|
981
|
+
debugMessage: parsedError.debugMessage,
|
|
982
|
+
});
|
|
920
983
|
}
|
|
921
984
|
};
|
|
922
985
|
|
|
@@ -954,7 +1017,13 @@ export const initConnection: MutationField<'initConnection'> = async (
|
|
|
954
1017
|
);
|
|
955
1018
|
} catch (error) {
|
|
956
1019
|
RnIapConsole.error('Failed to initialize IAP connection:', error);
|
|
957
|
-
|
|
1020
|
+
const parsedError = parseErrorStringToJsonObj(error);
|
|
1021
|
+
throw createPurchaseError({
|
|
1022
|
+
code: parsedError.code,
|
|
1023
|
+
message: parsedError.message,
|
|
1024
|
+
responseCode: parsedError.responseCode,
|
|
1025
|
+
debugMessage: parsedError.debugMessage,
|
|
1026
|
+
});
|
|
958
1027
|
}
|
|
959
1028
|
};
|
|
960
1029
|
|
|
@@ -967,7 +1036,13 @@ export const endConnection: MutationField<'endConnection'> = async () => {
|
|
|
967
1036
|
return await IAP.instance.endConnection();
|
|
968
1037
|
} catch (error) {
|
|
969
1038
|
RnIapConsole.error('Failed to end IAP connection:', error);
|
|
970
|
-
|
|
1039
|
+
const parsedError = parseErrorStringToJsonObj(error);
|
|
1040
|
+
throw createPurchaseError({
|
|
1041
|
+
code: parsedError.code,
|
|
1042
|
+
message: parsedError.message,
|
|
1043
|
+
responseCode: parsedError.responseCode,
|
|
1044
|
+
debugMessage: parsedError.debugMessage,
|
|
1045
|
+
});
|
|
971
1046
|
}
|
|
972
1047
|
};
|
|
973
1048
|
|
|
@@ -983,7 +1058,13 @@ export const restorePurchases: MutationField<'restorePurchases'> = async () => {
|
|
|
983
1058
|
});
|
|
984
1059
|
} catch (error) {
|
|
985
1060
|
RnIapConsole.error('Failed to restore purchases:', error);
|
|
986
|
-
|
|
1061
|
+
const parsedError = parseErrorStringToJsonObj(error);
|
|
1062
|
+
throw createPurchaseError({
|
|
1063
|
+
code: parsedError.code,
|
|
1064
|
+
message: parsedError.message,
|
|
1065
|
+
responseCode: parsedError.responseCode,
|
|
1066
|
+
debugMessage: parsedError.debugMessage,
|
|
1067
|
+
});
|
|
987
1068
|
}
|
|
988
1069
|
};
|
|
989
1070
|
|
|
@@ -1111,7 +1192,14 @@ export const requestPurchase: MutationField<'requestPurchase'> = async (
|
|
|
1111
1192
|
return await IAP.instance.requestPurchase(unifiedRequest);
|
|
1112
1193
|
} catch (error) {
|
|
1113
1194
|
RnIapConsole.error('Failed to request purchase:', error);
|
|
1114
|
-
|
|
1195
|
+
const parsedError = parseErrorStringToJsonObj(error);
|
|
1196
|
+
throw createPurchaseError({
|
|
1197
|
+
code: parsedError.code,
|
|
1198
|
+
message: parsedError.message,
|
|
1199
|
+
responseCode: parsedError.responseCode,
|
|
1200
|
+
debugMessage: parsedError.debugMessage,
|
|
1201
|
+
productId: parsedError.productId,
|
|
1202
|
+
});
|
|
1115
1203
|
}
|
|
1116
1204
|
};
|
|
1117
1205
|
|
|
@@ -1216,7 +1304,13 @@ export const acknowledgePurchaseAndroid: MutationField<
|
|
|
1216
1304
|
return getSuccessFromPurchaseVariant(result, 'acknowledgePurchaseAndroid');
|
|
1217
1305
|
} catch (error) {
|
|
1218
1306
|
RnIapConsole.error('Failed to acknowledge purchase Android:', error);
|
|
1219
|
-
|
|
1307
|
+
const parsedError = parseErrorStringToJsonObj(error);
|
|
1308
|
+
throw createPurchaseError({
|
|
1309
|
+
code: parsedError.code,
|
|
1310
|
+
message: parsedError.message,
|
|
1311
|
+
responseCode: parsedError.responseCode,
|
|
1312
|
+
debugMessage: parsedError.debugMessage,
|
|
1313
|
+
});
|
|
1220
1314
|
}
|
|
1221
1315
|
};
|
|
1222
1316
|
|
|
@@ -1247,7 +1341,13 @@ export const consumePurchaseAndroid: MutationField<
|
|
|
1247
1341
|
return getSuccessFromPurchaseVariant(result, 'consumePurchaseAndroid');
|
|
1248
1342
|
} catch (error) {
|
|
1249
1343
|
RnIapConsole.error('Failed to consume purchase Android:', error);
|
|
1250
|
-
|
|
1344
|
+
const parsedError = parseErrorStringToJsonObj(error);
|
|
1345
|
+
throw createPurchaseError({
|
|
1346
|
+
code: parsedError.code,
|
|
1347
|
+
message: parsedError.message,
|
|
1348
|
+
responseCode: parsedError.responseCode,
|
|
1349
|
+
debugMessage: parsedError.debugMessage,
|
|
1350
|
+
});
|
|
1251
1351
|
}
|
|
1252
1352
|
};
|
|
1253
1353
|
|
|
@@ -1323,8 +1423,13 @@ export const validateReceipt: MutationField<'validateReceipt'> = async (
|
|
|
1323
1423
|
}
|
|
1324
1424
|
} catch (error) {
|
|
1325
1425
|
RnIapConsole.error('[validateReceipt] Failed:', error);
|
|
1326
|
-
const
|
|
1327
|
-
throw
|
|
1426
|
+
const parsedError = parseErrorStringToJsonObj(error);
|
|
1427
|
+
throw createPurchaseError({
|
|
1428
|
+
code: parsedError.code,
|
|
1429
|
+
message: parsedError.message,
|
|
1430
|
+
responseCode: parsedError.responseCode,
|
|
1431
|
+
debugMessage: parsedError.debugMessage,
|
|
1432
|
+
});
|
|
1328
1433
|
}
|
|
1329
1434
|
};
|
|
1330
1435
|
|
|
@@ -1343,8 +1448,13 @@ export const syncIOS: MutationField<'syncIOS'> = async () => {
|
|
|
1343
1448
|
return Boolean(result);
|
|
1344
1449
|
} catch (error) {
|
|
1345
1450
|
RnIapConsole.error('[syncIOS] Failed:', error);
|
|
1346
|
-
const
|
|
1347
|
-
throw
|
|
1451
|
+
const parsedError = parseErrorStringToJsonObj(error);
|
|
1452
|
+
throw createPurchaseError({
|
|
1453
|
+
code: parsedError.code,
|
|
1454
|
+
message: parsedError.message,
|
|
1455
|
+
responseCode: parsedError.responseCode,
|
|
1456
|
+
debugMessage: parsedError.debugMessage,
|
|
1457
|
+
});
|
|
1348
1458
|
}
|
|
1349
1459
|
};
|
|
1350
1460
|
|
|
@@ -1365,8 +1475,13 @@ export const presentCodeRedemptionSheetIOS: MutationField<
|
|
|
1365
1475
|
return Boolean(result);
|
|
1366
1476
|
} catch (error) {
|
|
1367
1477
|
RnIapConsole.error('[presentCodeRedemptionSheetIOS] Failed:', error);
|
|
1368
|
-
const
|
|
1369
|
-
throw
|
|
1478
|
+
const parsedError = parseErrorStringToJsonObj(error);
|
|
1479
|
+
throw createPurchaseError({
|
|
1480
|
+
code: parsedError.code,
|
|
1481
|
+
message: parsedError.message,
|
|
1482
|
+
responseCode: parsedError.responseCode,
|
|
1483
|
+
debugMessage: parsedError.debugMessage,
|
|
1484
|
+
});
|
|
1370
1485
|
}
|
|
1371
1486
|
};
|
|
1372
1487
|
|
|
@@ -1400,7 +1515,13 @@ export const requestPurchaseOnPromotedProductIOS: MutationField<
|
|
|
1400
1515
|
return true;
|
|
1401
1516
|
} catch (error) {
|
|
1402
1517
|
RnIapConsole.error('[requestPurchaseOnPromotedProductIOS] Failed:', error);
|
|
1403
|
-
|
|
1518
|
+
const parsedError = parseErrorStringToJsonObj(error);
|
|
1519
|
+
throw createPurchaseError({
|
|
1520
|
+
code: parsedError.code,
|
|
1521
|
+
message: parsedError.message,
|
|
1522
|
+
responseCode: parsedError.responseCode,
|
|
1523
|
+
debugMessage: parsedError.debugMessage,
|
|
1524
|
+
});
|
|
1404
1525
|
}
|
|
1405
1526
|
};
|
|
1406
1527
|
|
|
@@ -1421,8 +1542,13 @@ export const clearTransactionIOS: MutationField<
|
|
|
1421
1542
|
return true;
|
|
1422
1543
|
} catch (error) {
|
|
1423
1544
|
RnIapConsole.error('[clearTransactionIOS] Failed:', error);
|
|
1424
|
-
const
|
|
1425
|
-
throw
|
|
1545
|
+
const parsedError = parseErrorStringToJsonObj(error);
|
|
1546
|
+
throw createPurchaseError({
|
|
1547
|
+
code: parsedError.code,
|
|
1548
|
+
message: parsedError.message,
|
|
1549
|
+
responseCode: parsedError.responseCode,
|
|
1550
|
+
debugMessage: parsedError.debugMessage,
|
|
1551
|
+
});
|
|
1426
1552
|
}
|
|
1427
1553
|
};
|
|
1428
1554
|
|
|
@@ -1444,8 +1570,13 @@ export const beginRefundRequestIOS: MutationField<
|
|
|
1444
1570
|
return status ?? null;
|
|
1445
1571
|
} catch (error) {
|
|
1446
1572
|
RnIapConsole.error('[beginRefundRequestIOS] Failed:', error);
|
|
1447
|
-
const
|
|
1448
|
-
throw
|
|
1573
|
+
const parsedError = parseErrorStringToJsonObj(error);
|
|
1574
|
+
throw createPurchaseError({
|
|
1575
|
+
code: parsedError.code,
|
|
1576
|
+
message: parsedError.message,
|
|
1577
|
+
responseCode: parsedError.responseCode,
|
|
1578
|
+
debugMessage: parsedError.debugMessage,
|
|
1579
|
+
});
|
|
1449
1580
|
}
|
|
1450
1581
|
};
|
|
1451
1582
|
|
|
@@ -1554,8 +1685,13 @@ export const deepLinkToSubscriptionsIOS = async (): Promise<boolean> => {
|
|
|
1554
1685
|
return true;
|
|
1555
1686
|
} catch (error) {
|
|
1556
1687
|
RnIapConsole.error('[deepLinkToSubscriptionsIOS] Failed:', error);
|
|
1557
|
-
const
|
|
1558
|
-
throw
|
|
1688
|
+
const parsedError = parseErrorStringToJsonObj(error);
|
|
1689
|
+
throw createPurchaseError({
|
|
1690
|
+
code: parsedError.code,
|
|
1691
|
+
message: parsedError.message,
|
|
1692
|
+
responseCode: parsedError.responseCode,
|
|
1693
|
+
debugMessage: parsedError.debugMessage,
|
|
1694
|
+
});
|
|
1559
1695
|
}
|
|
1560
1696
|
};
|
|
1561
1697
|
|
|
@@ -1648,8 +1784,13 @@ export const getActiveSubscriptions: QueryField<
|
|
|
1648
1784
|
throw error;
|
|
1649
1785
|
}
|
|
1650
1786
|
RnIapConsole.error('Failed to get active subscriptions:', error);
|
|
1651
|
-
const
|
|
1652
|
-
throw
|
|
1787
|
+
const parsedError = parseErrorStringToJsonObj(error);
|
|
1788
|
+
throw createPurchaseError({
|
|
1789
|
+
code: parsedError.code,
|
|
1790
|
+
message: parsedError.message,
|
|
1791
|
+
responseCode: parsedError.responseCode,
|
|
1792
|
+
debugMessage: parsedError.debugMessage,
|
|
1793
|
+
});
|
|
1653
1794
|
}
|
|
1654
1795
|
};
|
|
1655
1796
|
|