react-native-iap 14.4.47 → 14.5.0
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/src/main/java/com/margelo/nitro/iap/HybridRnIap.kt +29 -9
- package/ios/HybridRnIap.swift +17 -5
- package/ios/RnIapHelper.swift +8 -0
- package/lib/module/index.js +6 -5
- package/lib/module/index.js.map +1 -1
- package/lib/module/types.js.map +1 -1
- package/lib/module/utils/type-bridge.js +19 -0
- package/lib/module/utils/type-bridge.js.map +1 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/specs/RnIap.nitro.d.ts +17 -3
- package/lib/typescript/src/specs/RnIap.nitro.d.ts.map +1 -1
- package/lib/typescript/src/types.d.ts +40 -8
- package/lib/typescript/src/types.d.ts.map +1 -1
- package/lib/typescript/src/utils/type-bridge.d.ts.map +1 -1
- package/nitrogen/generated/android/c++/JFunc_void_NitroPurchase.hpp +2 -0
- package/nitrogen/generated/android/c++/JHybridRnIapSpec.cpp +8 -4
- package/nitrogen/generated/android/c++/{JIapkitStore.hpp → JIapStore.hpp} +19 -13
- package/nitrogen/generated/android/c++/JNitroPurchase.hpp +7 -1
- package/nitrogen/generated/android/c++/JNitroPurchaseRequest.hpp +11 -3
- package/nitrogen/generated/android/c++/JNitroReceiptValidationResultIOS.hpp +2 -0
- package/nitrogen/generated/android/c++/JNitroVerifyPurchaseWithIapkitResult.hpp +6 -6
- package/nitrogen/generated/android/c++/JNitroVerifyPurchaseWithProviderError.hpp +62 -0
- package/nitrogen/generated/android/c++/JNitroVerifyPurchaseWithProviderResult.hpp +24 -16
- package/nitrogen/generated/android/c++/JPurchase.hpp +2 -0
- package/nitrogen/generated/android/c++/JPurchaseAndroid.hpp +7 -1
- package/nitrogen/generated/android/c++/JPurchaseIOS.hpp +7 -1
- package/nitrogen/generated/android/c++/JRequestPurchaseResult.hpp +2 -0
- package/nitrogen/generated/android/c++/JVariant_NitroReceiptValidationResultIOS_NitroReceiptValidationResultAndroid.hpp +2 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/{IapkitStore.kt → IapStore.kt} +7 -5
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroPurchase.kt +5 -2
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroPurchaseRequest.kt +9 -3
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroVerifyPurchaseWithIapkitResult.kt +2 -2
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroVerifyPurchaseWithProviderError.kt +39 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroVerifyPurchaseWithProviderResult.kt +6 -3
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/PurchaseAndroid.kt +5 -2
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/PurchaseIOS.kt +5 -2
- package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Bridge.hpp +41 -8
- package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Umbrella.hpp +6 -3
- package/nitrogen/generated/ios/c++/HybridRnIapSpecSwift.hpp +6 -3
- package/nitrogen/generated/ios/swift/{IapkitStore.swift → IapStore.swift} +14 -6
- package/nitrogen/generated/ios/swift/NitroPurchase.swift +13 -2
- package/nitrogen/generated/ios/swift/NitroPurchaseRequest.swift +47 -1
- package/nitrogen/generated/ios/swift/NitroVerifyPurchaseWithIapkitResult.swift +2 -2
- package/nitrogen/generated/ios/swift/NitroVerifyPurchaseWithProviderError.swift +65 -0
- package/nitrogen/generated/ios/swift/NitroVerifyPurchaseWithProviderResult.swift +55 -13
- package/nitrogen/generated/ios/swift/PurchaseAndroid.swift +13 -2
- package/nitrogen/generated/ios/swift/PurchaseIOS.swift +13 -2
- package/nitrogen/generated/shared/c++/{IapkitStore.hpp → IapStore.hpp} +23 -15
- package/nitrogen/generated/shared/c++/NitroPurchase.hpp +8 -1
- package/nitrogen/generated/shared/c++/NitroPurchaseRequest.hpp +10 -2
- package/nitrogen/generated/shared/c++/NitroVerifyPurchaseWithIapkitResult.hpp +8 -8
- package/nitrogen/generated/shared/c++/NitroVerifyPurchaseWithProviderError.hpp +80 -0
- package/nitrogen/generated/shared/c++/NitroVerifyPurchaseWithProviderResult.hpp +13 -5
- package/nitrogen/generated/shared/c++/PurchaseAndroid.hpp +8 -1
- package/nitrogen/generated/shared/c++/PurchaseIOS.hpp +8 -1
- package/openiap-versions.json +3 -3
- package/package.json +1 -1
- package/src/index.ts +8 -5
- package/src/specs/RnIap.nitro.ts +19 -3
- package/src/types.ts +42 -9
- package/src/utils/type-bridge.ts +22 -0
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NitroVerifyPurchaseWithProviderError.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
|
11
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
|
16
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
17
|
+
#else
|
|
18
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
19
|
+
#endif
|
|
20
|
+
#if __has_include(<NitroModules/JSIHelpers.hpp>)
|
|
21
|
+
#include <NitroModules/JSIHelpers.hpp>
|
|
22
|
+
#else
|
|
23
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
24
|
+
#endif
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
#include <string>
|
|
29
|
+
#include <optional>
|
|
30
|
+
|
|
31
|
+
namespace margelo::nitro::iap {
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* A struct which can be represented as a JavaScript object (NitroVerifyPurchaseWithProviderError).
|
|
35
|
+
*/
|
|
36
|
+
struct NitroVerifyPurchaseWithProviderError {
|
|
37
|
+
public:
|
|
38
|
+
std::optional<std::string> code SWIFT_PRIVATE;
|
|
39
|
+
std::string message SWIFT_PRIVATE;
|
|
40
|
+
|
|
41
|
+
public:
|
|
42
|
+
NitroVerifyPurchaseWithProviderError() = default;
|
|
43
|
+
explicit NitroVerifyPurchaseWithProviderError(std::optional<std::string> code, std::string message): code(code), message(message) {}
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
} // namespace margelo::nitro::iap
|
|
47
|
+
|
|
48
|
+
namespace margelo::nitro {
|
|
49
|
+
|
|
50
|
+
// C++ NitroVerifyPurchaseWithProviderError <> JS NitroVerifyPurchaseWithProviderError (object)
|
|
51
|
+
template <>
|
|
52
|
+
struct JSIConverter<margelo::nitro::iap::NitroVerifyPurchaseWithProviderError> final {
|
|
53
|
+
static inline margelo::nitro::iap::NitroVerifyPurchaseWithProviderError fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
54
|
+
jsi::Object obj = arg.asObject(runtime);
|
|
55
|
+
return margelo::nitro::iap::NitroVerifyPurchaseWithProviderError(
|
|
56
|
+
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "code")),
|
|
57
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "message"))
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::iap::NitroVerifyPurchaseWithProviderError& arg) {
|
|
61
|
+
jsi::Object obj(runtime);
|
|
62
|
+
obj.setProperty(runtime, "code", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.code));
|
|
63
|
+
obj.setProperty(runtime, "message", JSIConverter<std::string>::toJSI(runtime, arg.message));
|
|
64
|
+
return obj;
|
|
65
|
+
}
|
|
66
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
67
|
+
if (!value.isObject()) {
|
|
68
|
+
return false;
|
|
69
|
+
}
|
|
70
|
+
jsi::Object obj = value.getObject(runtime);
|
|
71
|
+
if (!nitro::isPlainObject(runtime, obj)) {
|
|
72
|
+
return false;
|
|
73
|
+
}
|
|
74
|
+
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "code"))) return false;
|
|
75
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "message"))) return false;
|
|
76
|
+
return true;
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
} // namespace margelo::nitro
|
|
@@ -25,10 +25,14 @@
|
|
|
25
25
|
|
|
26
26
|
// Forward declaration of `NitroVerifyPurchaseWithIapkitResult` to properly resolve imports.
|
|
27
27
|
namespace margelo::nitro::iap { struct NitroVerifyPurchaseWithIapkitResult; }
|
|
28
|
+
// Forward declaration of `NitroVerifyPurchaseWithProviderError` to properly resolve imports.
|
|
29
|
+
namespace margelo::nitro::iap { struct NitroVerifyPurchaseWithProviderError; }
|
|
28
30
|
// Forward declaration of `PurchaseVerificationProvider` to properly resolve imports.
|
|
29
31
|
namespace margelo::nitro::iap { enum class PurchaseVerificationProvider; }
|
|
30
32
|
|
|
31
33
|
#include "NitroVerifyPurchaseWithIapkitResult.hpp"
|
|
34
|
+
#include <optional>
|
|
35
|
+
#include "NitroVerifyPurchaseWithProviderError.hpp"
|
|
32
36
|
#include <vector>
|
|
33
37
|
#include "PurchaseVerificationProvider.hpp"
|
|
34
38
|
|
|
@@ -39,12 +43,13 @@ namespace margelo::nitro::iap {
|
|
|
39
43
|
*/
|
|
40
44
|
struct NitroVerifyPurchaseWithProviderResult {
|
|
41
45
|
public:
|
|
42
|
-
std::
|
|
46
|
+
std::optional<NitroVerifyPurchaseWithIapkitResult> iapkit SWIFT_PRIVATE;
|
|
47
|
+
std::optional<std::vector<NitroVerifyPurchaseWithProviderError>> errors SWIFT_PRIVATE;
|
|
43
48
|
PurchaseVerificationProvider provider SWIFT_PRIVATE;
|
|
44
49
|
|
|
45
50
|
public:
|
|
46
51
|
NitroVerifyPurchaseWithProviderResult() = default;
|
|
47
|
-
explicit NitroVerifyPurchaseWithProviderResult(std::
|
|
52
|
+
explicit NitroVerifyPurchaseWithProviderResult(std::optional<NitroVerifyPurchaseWithIapkitResult> iapkit, std::optional<std::vector<NitroVerifyPurchaseWithProviderError>> errors, PurchaseVerificationProvider provider): iapkit(iapkit), errors(errors), provider(provider) {}
|
|
48
53
|
};
|
|
49
54
|
|
|
50
55
|
} // namespace margelo::nitro::iap
|
|
@@ -57,13 +62,15 @@ namespace margelo::nitro {
|
|
|
57
62
|
static inline margelo::nitro::iap::NitroVerifyPurchaseWithProviderResult fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
58
63
|
jsi::Object obj = arg.asObject(runtime);
|
|
59
64
|
return margelo::nitro::iap::NitroVerifyPurchaseWithProviderResult(
|
|
60
|
-
JSIConverter<std::
|
|
65
|
+
JSIConverter<std::optional<margelo::nitro::iap::NitroVerifyPurchaseWithIapkitResult>>::fromJSI(runtime, obj.getProperty(runtime, "iapkit")),
|
|
66
|
+
JSIConverter<std::optional<std::vector<margelo::nitro::iap::NitroVerifyPurchaseWithProviderError>>>::fromJSI(runtime, obj.getProperty(runtime, "errors")),
|
|
61
67
|
JSIConverter<margelo::nitro::iap::PurchaseVerificationProvider>::fromJSI(runtime, obj.getProperty(runtime, "provider"))
|
|
62
68
|
);
|
|
63
69
|
}
|
|
64
70
|
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::iap::NitroVerifyPurchaseWithProviderResult& arg) {
|
|
65
71
|
jsi::Object obj(runtime);
|
|
66
|
-
obj.setProperty(runtime, "iapkit", JSIConverter<std::
|
|
72
|
+
obj.setProperty(runtime, "iapkit", JSIConverter<std::optional<margelo::nitro::iap::NitroVerifyPurchaseWithIapkitResult>>::toJSI(runtime, arg.iapkit));
|
|
73
|
+
obj.setProperty(runtime, "errors", JSIConverter<std::optional<std::vector<margelo::nitro::iap::NitroVerifyPurchaseWithProviderError>>>::toJSI(runtime, arg.errors));
|
|
67
74
|
obj.setProperty(runtime, "provider", JSIConverter<margelo::nitro::iap::PurchaseVerificationProvider>::toJSI(runtime, arg.provider));
|
|
68
75
|
return obj;
|
|
69
76
|
}
|
|
@@ -75,7 +82,8 @@ namespace margelo::nitro {
|
|
|
75
82
|
if (!nitro::isPlainObject(runtime, obj)) {
|
|
76
83
|
return false;
|
|
77
84
|
}
|
|
78
|
-
if (!JSIConverter<std::
|
|
85
|
+
if (!JSIConverter<std::optional<margelo::nitro::iap::NitroVerifyPurchaseWithIapkitResult>>::canConvert(runtime, obj.getProperty(runtime, "iapkit"))) return false;
|
|
86
|
+
if (!JSIConverter<std::optional<std::vector<margelo::nitro::iap::NitroVerifyPurchaseWithProviderError>>>::canConvert(runtime, obj.getProperty(runtime, "errors"))) return false;
|
|
79
87
|
if (!JSIConverter<margelo::nitro::iap::PurchaseVerificationProvider>::canConvert(runtime, obj.getProperty(runtime, "provider"))) return false;
|
|
80
88
|
return true;
|
|
81
89
|
}
|
|
@@ -27,12 +27,15 @@
|
|
|
27
27
|
namespace margelo::nitro::iap { enum class IapPlatform; }
|
|
28
28
|
// Forward declaration of `PurchaseState` to properly resolve imports.
|
|
29
29
|
namespace margelo::nitro::iap { enum class PurchaseState; }
|
|
30
|
+
// Forward declaration of `IapStore` to properly resolve imports.
|
|
31
|
+
namespace margelo::nitro::iap { enum class IapStore; }
|
|
30
32
|
|
|
31
33
|
#include <optional>
|
|
32
34
|
#include <string>
|
|
33
35
|
#include <vector>
|
|
34
36
|
#include "IapPlatform.hpp"
|
|
35
37
|
#include "PurchaseState.hpp"
|
|
38
|
+
#include "IapStore.hpp"
|
|
36
39
|
|
|
37
40
|
namespace margelo::nitro::iap {
|
|
38
41
|
|
|
@@ -58,12 +61,13 @@ namespace margelo::nitro::iap {
|
|
|
58
61
|
std::optional<std::string> purchaseToken SWIFT_PRIVATE;
|
|
59
62
|
double quantity SWIFT_PRIVATE;
|
|
60
63
|
std::optional<std::string> signatureAndroid SWIFT_PRIVATE;
|
|
64
|
+
IapStore store SWIFT_PRIVATE;
|
|
61
65
|
double transactionDate SWIFT_PRIVATE;
|
|
62
66
|
std::optional<std::string> transactionId SWIFT_PRIVATE;
|
|
63
67
|
|
|
64
68
|
public:
|
|
65
69
|
PurchaseAndroid() = default;
|
|
66
|
-
explicit PurchaseAndroid(std::optional<bool> autoRenewingAndroid, std::optional<std::string> currentPlanId, std::optional<std::string> dataAndroid, std::optional<std::string> developerPayloadAndroid, std::string id, std::optional<std::vector<std::string>> ids, std::optional<bool> isAcknowledgedAndroid, bool isAutoRenewing, std::optional<std::string> obfuscatedAccountIdAndroid, std::optional<std::string> obfuscatedProfileIdAndroid, std::optional<std::string> packageNameAndroid, IapPlatform platform, std::string productId, PurchaseState purchaseState, std::optional<std::string> purchaseToken, double quantity, std::optional<std::string> signatureAndroid, double transactionDate, std::optional<std::string> transactionId): autoRenewingAndroid(autoRenewingAndroid), currentPlanId(currentPlanId), dataAndroid(dataAndroid), developerPayloadAndroid(developerPayloadAndroid), id(id), ids(ids), isAcknowledgedAndroid(isAcknowledgedAndroid), isAutoRenewing(isAutoRenewing), obfuscatedAccountIdAndroid(obfuscatedAccountIdAndroid), obfuscatedProfileIdAndroid(obfuscatedProfileIdAndroid), packageNameAndroid(packageNameAndroid), platform(platform), productId(productId), purchaseState(purchaseState), purchaseToken(purchaseToken), quantity(quantity), signatureAndroid(signatureAndroid), transactionDate(transactionDate), transactionId(transactionId) {}
|
|
70
|
+
explicit PurchaseAndroid(std::optional<bool> autoRenewingAndroid, std::optional<std::string> currentPlanId, std::optional<std::string> dataAndroid, std::optional<std::string> developerPayloadAndroid, std::string id, std::optional<std::vector<std::string>> ids, std::optional<bool> isAcknowledgedAndroid, bool isAutoRenewing, std::optional<std::string> obfuscatedAccountIdAndroid, std::optional<std::string> obfuscatedProfileIdAndroid, std::optional<std::string> packageNameAndroid, IapPlatform platform, std::string productId, PurchaseState purchaseState, std::optional<std::string> purchaseToken, double quantity, std::optional<std::string> signatureAndroid, IapStore store, double transactionDate, std::optional<std::string> transactionId): autoRenewingAndroid(autoRenewingAndroid), currentPlanId(currentPlanId), dataAndroid(dataAndroid), developerPayloadAndroid(developerPayloadAndroid), id(id), ids(ids), isAcknowledgedAndroid(isAcknowledgedAndroid), isAutoRenewing(isAutoRenewing), obfuscatedAccountIdAndroid(obfuscatedAccountIdAndroid), obfuscatedProfileIdAndroid(obfuscatedProfileIdAndroid), packageNameAndroid(packageNameAndroid), platform(platform), productId(productId), purchaseState(purchaseState), purchaseToken(purchaseToken), quantity(quantity), signatureAndroid(signatureAndroid), store(store), transactionDate(transactionDate), transactionId(transactionId) {}
|
|
67
71
|
};
|
|
68
72
|
|
|
69
73
|
} // namespace margelo::nitro::iap
|
|
@@ -93,6 +97,7 @@ namespace margelo::nitro {
|
|
|
93
97
|
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "purchaseToken")),
|
|
94
98
|
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, "quantity")),
|
|
95
99
|
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "signatureAndroid")),
|
|
100
|
+
JSIConverter<margelo::nitro::iap::IapStore>::fromJSI(runtime, obj.getProperty(runtime, "store")),
|
|
96
101
|
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, "transactionDate")),
|
|
97
102
|
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "transactionId"))
|
|
98
103
|
);
|
|
@@ -116,6 +121,7 @@ namespace margelo::nitro {
|
|
|
116
121
|
obj.setProperty(runtime, "purchaseToken", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.purchaseToken));
|
|
117
122
|
obj.setProperty(runtime, "quantity", JSIConverter<double>::toJSI(runtime, arg.quantity));
|
|
118
123
|
obj.setProperty(runtime, "signatureAndroid", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.signatureAndroid));
|
|
124
|
+
obj.setProperty(runtime, "store", JSIConverter<margelo::nitro::iap::IapStore>::toJSI(runtime, arg.store));
|
|
119
125
|
obj.setProperty(runtime, "transactionDate", JSIConverter<double>::toJSI(runtime, arg.transactionDate));
|
|
120
126
|
obj.setProperty(runtime, "transactionId", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.transactionId));
|
|
121
127
|
return obj;
|
|
@@ -145,6 +151,7 @@ namespace margelo::nitro {
|
|
|
145
151
|
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "purchaseToken"))) return false;
|
|
146
152
|
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, "quantity"))) return false;
|
|
147
153
|
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "signatureAndroid"))) return false;
|
|
154
|
+
if (!JSIConverter<margelo::nitro::iap::IapStore>::canConvert(runtime, obj.getProperty(runtime, "store"))) return false;
|
|
148
155
|
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, "transactionDate"))) return false;
|
|
149
156
|
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "transactionId"))) return false;
|
|
150
157
|
return true;
|
|
@@ -31,6 +31,8 @@ namespace margelo::nitro::iap { enum class IapPlatform; }
|
|
|
31
31
|
namespace margelo::nitro::iap { enum class PurchaseState; }
|
|
32
32
|
// Forward declaration of `RenewalInfoIOS` to properly resolve imports.
|
|
33
33
|
namespace margelo::nitro::iap { struct RenewalInfoIOS; }
|
|
34
|
+
// Forward declaration of `IapStore` to properly resolve imports.
|
|
35
|
+
namespace margelo::nitro::iap { enum class IapStore; }
|
|
34
36
|
|
|
35
37
|
#include <string>
|
|
36
38
|
#include <optional>
|
|
@@ -39,6 +41,7 @@ namespace margelo::nitro::iap { struct RenewalInfoIOS; }
|
|
|
39
41
|
#include "IapPlatform.hpp"
|
|
40
42
|
#include "PurchaseState.hpp"
|
|
41
43
|
#include "RenewalInfoIOS.hpp"
|
|
44
|
+
#include "IapStore.hpp"
|
|
42
45
|
|
|
43
46
|
namespace margelo::nitro::iap {
|
|
44
47
|
|
|
@@ -74,6 +77,7 @@ namespace margelo::nitro::iap {
|
|
|
74
77
|
std::optional<RenewalInfoIOS> renewalInfoIOS SWIFT_PRIVATE;
|
|
75
78
|
std::optional<double> revocationDateIOS SWIFT_PRIVATE;
|
|
76
79
|
std::optional<std::string> revocationReasonIOS SWIFT_PRIVATE;
|
|
80
|
+
IapStore store SWIFT_PRIVATE;
|
|
77
81
|
std::optional<std::string> storefrontCountryCodeIOS SWIFT_PRIVATE;
|
|
78
82
|
std::optional<std::string> subscriptionGroupIdIOS SWIFT_PRIVATE;
|
|
79
83
|
double transactionDate SWIFT_PRIVATE;
|
|
@@ -83,7 +87,7 @@ namespace margelo::nitro::iap {
|
|
|
83
87
|
|
|
84
88
|
public:
|
|
85
89
|
PurchaseIOS() = default;
|
|
86
|
-
explicit PurchaseIOS(std::optional<std::string> appAccountToken, std::optional<std::string> appBundleIdIOS, std::optional<std::string> countryCodeIOS, std::optional<std::string> currencyCodeIOS, std::optional<std::string> currencySymbolIOS, std::optional<std::string> currentPlanId, std::optional<std::string> environmentIOS, std::optional<double> expirationDateIOS, std::string id, std::optional<std::vector<std::string>> ids, bool isAutoRenewing, std::optional<bool> isUpgradedIOS, std::optional<PurchaseOfferIOS> offerIOS, std::optional<double> originalTransactionDateIOS, std::optional<std::string> originalTransactionIdentifierIOS, std::optional<std::string> ownershipTypeIOS, IapPlatform platform, std::string productId, PurchaseState purchaseState, std::optional<std::string> purchaseToken, double quantity, std::optional<double> quantityIOS, std::optional<std::string> reasonIOS, std::optional<std::string> reasonStringRepresentationIOS, std::optional<RenewalInfoIOS> renewalInfoIOS, std::optional<double> revocationDateIOS, std::optional<std::string> revocationReasonIOS, std::optional<std::string> storefrontCountryCodeIOS, std::optional<std::string> subscriptionGroupIdIOS, double transactionDate, std::string transactionId, std::optional<std::string> transactionReasonIOS, std::optional<std::string> webOrderLineItemIdIOS): appAccountToken(appAccountToken), appBundleIdIOS(appBundleIdIOS), countryCodeIOS(countryCodeIOS), currencyCodeIOS(currencyCodeIOS), currencySymbolIOS(currencySymbolIOS), currentPlanId(currentPlanId), environmentIOS(environmentIOS), expirationDateIOS(expirationDateIOS), id(id), ids(ids), isAutoRenewing(isAutoRenewing), isUpgradedIOS(isUpgradedIOS), offerIOS(offerIOS), originalTransactionDateIOS(originalTransactionDateIOS), originalTransactionIdentifierIOS(originalTransactionIdentifierIOS), ownershipTypeIOS(ownershipTypeIOS), platform(platform), productId(productId), purchaseState(purchaseState), purchaseToken(purchaseToken), quantity(quantity), quantityIOS(quantityIOS), reasonIOS(reasonIOS), reasonStringRepresentationIOS(reasonStringRepresentationIOS), renewalInfoIOS(renewalInfoIOS), revocationDateIOS(revocationDateIOS), revocationReasonIOS(revocationReasonIOS), storefrontCountryCodeIOS(storefrontCountryCodeIOS), subscriptionGroupIdIOS(subscriptionGroupIdIOS), transactionDate(transactionDate), transactionId(transactionId), transactionReasonIOS(transactionReasonIOS), webOrderLineItemIdIOS(webOrderLineItemIdIOS) {}
|
|
90
|
+
explicit PurchaseIOS(std::optional<std::string> appAccountToken, std::optional<std::string> appBundleIdIOS, std::optional<std::string> countryCodeIOS, std::optional<std::string> currencyCodeIOS, std::optional<std::string> currencySymbolIOS, std::optional<std::string> currentPlanId, std::optional<std::string> environmentIOS, std::optional<double> expirationDateIOS, std::string id, std::optional<std::vector<std::string>> ids, bool isAutoRenewing, std::optional<bool> isUpgradedIOS, std::optional<PurchaseOfferIOS> offerIOS, std::optional<double> originalTransactionDateIOS, std::optional<std::string> originalTransactionIdentifierIOS, std::optional<std::string> ownershipTypeIOS, IapPlatform platform, std::string productId, PurchaseState purchaseState, std::optional<std::string> purchaseToken, double quantity, std::optional<double> quantityIOS, std::optional<std::string> reasonIOS, std::optional<std::string> reasonStringRepresentationIOS, std::optional<RenewalInfoIOS> renewalInfoIOS, std::optional<double> revocationDateIOS, std::optional<std::string> revocationReasonIOS, IapStore store, std::optional<std::string> storefrontCountryCodeIOS, std::optional<std::string> subscriptionGroupIdIOS, double transactionDate, std::string transactionId, std::optional<std::string> transactionReasonIOS, std::optional<std::string> webOrderLineItemIdIOS): appAccountToken(appAccountToken), appBundleIdIOS(appBundleIdIOS), countryCodeIOS(countryCodeIOS), currencyCodeIOS(currencyCodeIOS), currencySymbolIOS(currencySymbolIOS), currentPlanId(currentPlanId), environmentIOS(environmentIOS), expirationDateIOS(expirationDateIOS), id(id), ids(ids), isAutoRenewing(isAutoRenewing), isUpgradedIOS(isUpgradedIOS), offerIOS(offerIOS), originalTransactionDateIOS(originalTransactionDateIOS), originalTransactionIdentifierIOS(originalTransactionIdentifierIOS), ownershipTypeIOS(ownershipTypeIOS), platform(platform), productId(productId), purchaseState(purchaseState), purchaseToken(purchaseToken), quantity(quantity), quantityIOS(quantityIOS), reasonIOS(reasonIOS), reasonStringRepresentationIOS(reasonStringRepresentationIOS), renewalInfoIOS(renewalInfoIOS), revocationDateIOS(revocationDateIOS), revocationReasonIOS(revocationReasonIOS), store(store), storefrontCountryCodeIOS(storefrontCountryCodeIOS), subscriptionGroupIdIOS(subscriptionGroupIdIOS), transactionDate(transactionDate), transactionId(transactionId), transactionReasonIOS(transactionReasonIOS), webOrderLineItemIdIOS(webOrderLineItemIdIOS) {}
|
|
87
91
|
};
|
|
88
92
|
|
|
89
93
|
} // namespace margelo::nitro::iap
|
|
@@ -123,6 +127,7 @@ namespace margelo::nitro {
|
|
|
123
127
|
JSIConverter<std::optional<margelo::nitro::iap::RenewalInfoIOS>>::fromJSI(runtime, obj.getProperty(runtime, "renewalInfoIOS")),
|
|
124
128
|
JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, "revocationDateIOS")),
|
|
125
129
|
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "revocationReasonIOS")),
|
|
130
|
+
JSIConverter<margelo::nitro::iap::IapStore>::fromJSI(runtime, obj.getProperty(runtime, "store")),
|
|
126
131
|
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "storefrontCountryCodeIOS")),
|
|
127
132
|
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "subscriptionGroupIdIOS")),
|
|
128
133
|
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, "transactionDate")),
|
|
@@ -160,6 +165,7 @@ namespace margelo::nitro {
|
|
|
160
165
|
obj.setProperty(runtime, "renewalInfoIOS", JSIConverter<std::optional<margelo::nitro::iap::RenewalInfoIOS>>::toJSI(runtime, arg.renewalInfoIOS));
|
|
161
166
|
obj.setProperty(runtime, "revocationDateIOS", JSIConverter<std::optional<double>>::toJSI(runtime, arg.revocationDateIOS));
|
|
162
167
|
obj.setProperty(runtime, "revocationReasonIOS", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.revocationReasonIOS));
|
|
168
|
+
obj.setProperty(runtime, "store", JSIConverter<margelo::nitro::iap::IapStore>::toJSI(runtime, arg.store));
|
|
163
169
|
obj.setProperty(runtime, "storefrontCountryCodeIOS", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.storefrontCountryCodeIOS));
|
|
164
170
|
obj.setProperty(runtime, "subscriptionGroupIdIOS", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.subscriptionGroupIdIOS));
|
|
165
171
|
obj.setProperty(runtime, "transactionDate", JSIConverter<double>::toJSI(runtime, arg.transactionDate));
|
|
@@ -203,6 +209,7 @@ namespace margelo::nitro {
|
|
|
203
209
|
if (!JSIConverter<std::optional<margelo::nitro::iap::RenewalInfoIOS>>::canConvert(runtime, obj.getProperty(runtime, "renewalInfoIOS"))) return false;
|
|
204
210
|
if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, "revocationDateIOS"))) return false;
|
|
205
211
|
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "revocationReasonIOS"))) return false;
|
|
212
|
+
if (!JSIConverter<margelo::nitro::iap::IapStore>::canConvert(runtime, obj.getProperty(runtime, "store"))) return false;
|
|
206
213
|
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "storefrontCountryCodeIOS"))) return false;
|
|
207
214
|
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "subscriptionGroupIdIOS"))) return false;
|
|
208
215
|
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, "transactionDate"))) return false;
|
package/openiap-versions.json
CHANGED
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -1461,11 +1461,14 @@ export const verifyPurchaseWithProvider: MutationField<
|
|
|
1461
1461
|
}
|
|
1462
1462
|
return {
|
|
1463
1463
|
provider: result.provider,
|
|
1464
|
-
iapkit: result.iapkit
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1464
|
+
iapkit: result.iapkit
|
|
1465
|
+
? {
|
|
1466
|
+
isValid: result.iapkit.isValid,
|
|
1467
|
+
state: result.iapkit.state,
|
|
1468
|
+
store: result.iapkit.store,
|
|
1469
|
+
}
|
|
1470
|
+
: null,
|
|
1471
|
+
errors: result.errors ?? null,
|
|
1469
1472
|
};
|
|
1470
1473
|
} catch (error) {
|
|
1471
1474
|
RnIapConsole.error('[verifyPurchaseWithProvider] Failed:', error);
|
package/src/specs/RnIap.nitro.ts
CHANGED
|
@@ -38,7 +38,8 @@ export type IapkitPurchaseState =
|
|
|
38
38
|
| 'unknown'
|
|
39
39
|
| 'inauthentic';
|
|
40
40
|
|
|
41
|
-
|
|
41
|
+
// IapStore enum for purchase store identification
|
|
42
|
+
export type IapStore = 'unknown' | 'apple' | 'google' | 'horizon';
|
|
42
43
|
|
|
43
44
|
// Note: Nitro requires at least 2 values for union types
|
|
44
45
|
export type PurchaseVerificationProvider = 'iapkit' | 'none';
|
|
@@ -85,8 +86,14 @@ export interface NitroRequestPurchaseAndroid {
|
|
|
85
86
|
}
|
|
86
87
|
|
|
87
88
|
export interface NitroPurchaseRequest {
|
|
89
|
+
/** @deprecated Use apple instead */
|
|
88
90
|
ios?: NitroRequestPurchaseIos | null;
|
|
91
|
+
/** @deprecated Use google instead */
|
|
89
92
|
android?: NitroRequestPurchaseAndroid | null;
|
|
93
|
+
/** Apple-specific purchase parameters */
|
|
94
|
+
apple?: NitroRequestPurchaseIos | null;
|
|
95
|
+
/** Google-specific purchase parameters */
|
|
96
|
+
google?: NitroRequestPurchaseAndroid | null;
|
|
90
97
|
}
|
|
91
98
|
|
|
92
99
|
// Available purchases parameters
|
|
@@ -230,11 +237,17 @@ export interface NitroVerifyPurchaseWithProviderProps {
|
|
|
230
237
|
export interface NitroVerifyPurchaseWithIapkitResult {
|
|
231
238
|
isValid: boolean;
|
|
232
239
|
state: IapkitPurchaseState;
|
|
233
|
-
store:
|
|
240
|
+
store: IapStore;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
export interface NitroVerifyPurchaseWithProviderError {
|
|
244
|
+
code?: string | null;
|
|
245
|
+
message: string;
|
|
234
246
|
}
|
|
235
247
|
|
|
236
248
|
export interface NitroVerifyPurchaseWithProviderResult {
|
|
237
|
-
iapkit
|
|
249
|
+
iapkit?: NitroVerifyPurchaseWithIapkitResult | null;
|
|
250
|
+
errors?: NitroVerifyPurchaseWithProviderError[] | null;
|
|
238
251
|
provider: PurchaseVerificationProvider;
|
|
239
252
|
}
|
|
240
253
|
|
|
@@ -252,7 +265,10 @@ export interface NitroPurchase {
|
|
|
252
265
|
productId: PurchaseCommon['productId'];
|
|
253
266
|
transactionDate: PurchaseCommon['transactionDate'];
|
|
254
267
|
purchaseToken?: PurchaseCommon['purchaseToken'];
|
|
268
|
+
/** @deprecated Use store instead */
|
|
255
269
|
platform: IapPlatform;
|
|
270
|
+
/** Store where purchase was made */
|
|
271
|
+
store: IapStore;
|
|
256
272
|
quantity: PurchaseCommon['quantity'];
|
|
257
273
|
purchaseState: PurchaseCommon['purchaseState'];
|
|
258
274
|
isAutoRenewing: PurchaseCommon['isAutoRenewing'];
|
package/src/types.ts
CHANGED
|
@@ -180,11 +180,11 @@ export type IapEvent = 'purchase-updated' | 'purchase-error' | 'promoted-product
|
|
|
180
180
|
|
|
181
181
|
export type IapPlatform = 'ios' | 'android';
|
|
182
182
|
|
|
183
|
+
export type IapStore = 'unknown' | 'apple' | 'google' | 'horizon';
|
|
184
|
+
|
|
183
185
|
/** Unified purchase states from IAPKit verification response. */
|
|
184
186
|
export type IapkitPurchaseState = 'entitled' | 'pending-acknowledgment' | 'pending' | 'canceled' | 'expired' | 'ready-to-consume' | 'consumed' | 'unknown' | 'inauthentic';
|
|
185
187
|
|
|
186
|
-
export type IapkitStore = 'apple' | 'google';
|
|
187
|
-
|
|
188
188
|
/** Connection initialization configuration */
|
|
189
189
|
export interface InitConnectionConfig {
|
|
190
190
|
/**
|
|
@@ -457,12 +457,18 @@ export interface PurchaseAndroid extends PurchaseCommon {
|
|
|
457
457
|
obfuscatedAccountIdAndroid?: (string | null);
|
|
458
458
|
obfuscatedProfileIdAndroid?: (string | null);
|
|
459
459
|
packageNameAndroid?: (string | null);
|
|
460
|
+
/**
|
|
461
|
+
* @deprecated Use store instead
|
|
462
|
+
* @deprecated Use store instead
|
|
463
|
+
*/
|
|
460
464
|
platform: IapPlatform;
|
|
461
465
|
productId: string;
|
|
462
466
|
purchaseState: PurchaseState;
|
|
463
467
|
purchaseToken?: (string | null);
|
|
464
468
|
quantity: number;
|
|
465
469
|
signatureAndroid?: (string | null);
|
|
470
|
+
/** Store where purchase was made */
|
|
471
|
+
store: IapStore;
|
|
466
472
|
transactionDate: number;
|
|
467
473
|
transactionId?: (string | null);
|
|
468
474
|
}
|
|
@@ -478,12 +484,18 @@ export interface PurchaseCommon {
|
|
|
478
484
|
id: string;
|
|
479
485
|
ids?: (string[] | null);
|
|
480
486
|
isAutoRenewing: boolean;
|
|
487
|
+
/**
|
|
488
|
+
* @deprecated Use store instead
|
|
489
|
+
* @deprecated Use store instead
|
|
490
|
+
*/
|
|
481
491
|
platform: IapPlatform;
|
|
482
492
|
productId: string;
|
|
483
493
|
purchaseState: PurchaseState;
|
|
484
494
|
/** Unified purchase token (iOS JWS, Android purchaseToken) */
|
|
485
495
|
purchaseToken?: (string | null);
|
|
486
496
|
quantity: number;
|
|
497
|
+
/** Store where purchase was made */
|
|
498
|
+
store: IapStore;
|
|
487
499
|
transactionDate: number;
|
|
488
500
|
}
|
|
489
501
|
|
|
@@ -510,6 +522,10 @@ export interface PurchaseIOS extends PurchaseCommon {
|
|
|
510
522
|
originalTransactionDateIOS?: (number | null);
|
|
511
523
|
originalTransactionIdentifierIOS?: (string | null);
|
|
512
524
|
ownershipTypeIOS?: (string | null);
|
|
525
|
+
/**
|
|
526
|
+
* @deprecated Use store instead
|
|
527
|
+
* @deprecated Use store instead
|
|
528
|
+
*/
|
|
513
529
|
platform: IapPlatform;
|
|
514
530
|
productId: string;
|
|
515
531
|
purchaseState: PurchaseState;
|
|
@@ -521,6 +537,8 @@ export interface PurchaseIOS extends PurchaseCommon {
|
|
|
521
537
|
renewalInfoIOS?: (RenewalInfoIOS | null);
|
|
522
538
|
revocationDateIOS?: (number | null);
|
|
523
539
|
revocationReasonIOS?: (string | null);
|
|
540
|
+
/** Store where purchase was made */
|
|
541
|
+
store: IapStore;
|
|
524
542
|
storefrontCountryCodeIOS?: (string | null);
|
|
525
543
|
subscriptionGroupIdIOS?: (string | null);
|
|
526
544
|
transactionDate: number;
|
|
@@ -710,9 +728,13 @@ export type RequestPurchaseProps =
|
|
|
710
728
|
};
|
|
711
729
|
|
|
712
730
|
export interface RequestPurchasePropsByPlatforms {
|
|
713
|
-
/**
|
|
731
|
+
/** @deprecated Use google instead */
|
|
714
732
|
android?: (RequestPurchaseAndroidProps | null);
|
|
715
|
-
/**
|
|
733
|
+
/** Apple-specific purchase parameters */
|
|
734
|
+
apple?: (RequestPurchaseIosProps | null);
|
|
735
|
+
/** Google-specific purchase parameters */
|
|
736
|
+
google?: (RequestPurchaseAndroidProps | null);
|
|
737
|
+
/** @deprecated Use apple instead */
|
|
716
738
|
ios?: (RequestPurchaseIosProps | null);
|
|
717
739
|
}
|
|
718
740
|
|
|
@@ -744,9 +766,13 @@ export interface RequestSubscriptionIosProps {
|
|
|
744
766
|
}
|
|
745
767
|
|
|
746
768
|
export interface RequestSubscriptionPropsByPlatforms {
|
|
747
|
-
/**
|
|
769
|
+
/** @deprecated Use google instead */
|
|
748
770
|
android?: (RequestSubscriptionAndroidProps | null);
|
|
749
|
-
/**
|
|
771
|
+
/** Apple-specific subscription parameters */
|
|
772
|
+
apple?: (RequestSubscriptionIosProps | null);
|
|
773
|
+
/** Google-specific subscription parameters */
|
|
774
|
+
google?: (RequestSubscriptionAndroidProps | null);
|
|
775
|
+
/** @deprecated Use apple instead */
|
|
750
776
|
ios?: (RequestSubscriptionIosProps | null);
|
|
751
777
|
}
|
|
752
778
|
|
|
@@ -774,7 +800,7 @@ export interface RequestVerifyPurchaseWithIapkitResult {
|
|
|
774
800
|
isValid: boolean;
|
|
775
801
|
/** The current state of the purchase. */
|
|
776
802
|
state: IapkitPurchaseState;
|
|
777
|
-
store:
|
|
803
|
+
store: IapStore;
|
|
778
804
|
}
|
|
779
805
|
|
|
780
806
|
export interface Subscription {
|
|
@@ -882,14 +908,21 @@ export interface VerifyPurchaseResultIOS {
|
|
|
882
908
|
receiptData: string;
|
|
883
909
|
}
|
|
884
910
|
|
|
911
|
+
export interface VerifyPurchaseWithProviderError {
|
|
912
|
+
code?: (string | null);
|
|
913
|
+
message: string;
|
|
914
|
+
}
|
|
915
|
+
|
|
885
916
|
export interface VerifyPurchaseWithProviderProps {
|
|
886
917
|
iapkit?: (RequestVerifyPurchaseWithIapkitProps | null);
|
|
887
918
|
provider: PurchaseVerificationProvider;
|
|
888
919
|
}
|
|
889
920
|
|
|
890
921
|
export interface VerifyPurchaseWithProviderResult {
|
|
891
|
-
/**
|
|
892
|
-
|
|
922
|
+
/** Error details if verification failed */
|
|
923
|
+
errors?: (VerifyPurchaseWithProviderError[] | null);
|
|
924
|
+
/** IAPKit verification result */
|
|
925
|
+
iapkit?: (RequestVerifyPurchaseWithIapkitResult | null);
|
|
893
926
|
provider: PurchaseVerificationProvider;
|
|
894
927
|
}
|
|
895
928
|
|
package/src/utils/type-bridge.ts
CHANGED
|
@@ -12,6 +12,7 @@ import type {
|
|
|
12
12
|
} from '../specs/RnIap.nitro';
|
|
13
13
|
import type {
|
|
14
14
|
IapPlatform,
|
|
15
|
+
IapStore,
|
|
15
16
|
PaymentModeIOS,
|
|
16
17
|
ProductType,
|
|
17
18
|
ProductTypeIOS,
|
|
@@ -30,6 +31,10 @@ import {RnIapConsole} from './debug';
|
|
|
30
31
|
|
|
31
32
|
const PLATFORM_IOS: IapPlatform = 'ios';
|
|
32
33
|
const PLATFORM_ANDROID: IapPlatform = 'android';
|
|
34
|
+
const STORE_UNKNOWN: IapStore = 'unknown';
|
|
35
|
+
const STORE_APPLE: IapStore = 'apple';
|
|
36
|
+
const STORE_GOOGLE: IapStore = 'google';
|
|
37
|
+
const STORE_HORIZON: IapStore = 'horizon';
|
|
33
38
|
const PRODUCT_TYPE_SUBS: ProductType = 'subs';
|
|
34
39
|
const PRODUCT_TYPE_IN_APP: ProductType = 'in-app';
|
|
35
40
|
const PURCHASE_STATE_DEFERRED: PurchaseState = 'deferred';
|
|
@@ -57,6 +62,19 @@ function normalizePlatform(value?: Nullable<string>): IapPlatform {
|
|
|
57
62
|
: PLATFORM_ANDROID;
|
|
58
63
|
}
|
|
59
64
|
|
|
65
|
+
function normalizeStore(value?: Nullable<string>): IapStore {
|
|
66
|
+
switch (value?.toLowerCase()) {
|
|
67
|
+
case 'apple':
|
|
68
|
+
return STORE_APPLE;
|
|
69
|
+
case 'google':
|
|
70
|
+
return STORE_GOOGLE;
|
|
71
|
+
case 'horizon':
|
|
72
|
+
return STORE_HORIZON;
|
|
73
|
+
default:
|
|
74
|
+
return STORE_UNKNOWN;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
60
78
|
function normalizeProductType(value?: Nullable<string>): ProductType {
|
|
61
79
|
return value?.toLowerCase() === PRODUCT_TYPE_SUBS
|
|
62
80
|
? PRODUCT_TYPE_SUBS
|
|
@@ -332,6 +350,8 @@ export function convertNitroPurchaseToPurchase(
|
|
|
332
350
|
purchaseState = normalizePurchaseState(nitroPurchase.purchaseStateAndroid);
|
|
333
351
|
}
|
|
334
352
|
|
|
353
|
+
const store = normalizeStore(nitroPurchase.store);
|
|
354
|
+
|
|
335
355
|
if (platform === PLATFORM_IOS) {
|
|
336
356
|
const iosPurchase: PurchaseIOS = {
|
|
337
357
|
id: nitroPurchase.id,
|
|
@@ -339,6 +359,7 @@ export function convertNitroPurchaseToPurchase(
|
|
|
339
359
|
transactionDate: nitroPurchase.transactionDate ?? Date.now(),
|
|
340
360
|
purchaseToken: nitroPurchase.purchaseToken ?? null,
|
|
341
361
|
platform,
|
|
362
|
+
store,
|
|
342
363
|
quantity: nitroPurchase.quantity ?? 1,
|
|
343
364
|
purchaseState,
|
|
344
365
|
isAutoRenewing: Boolean(nitroPurchase.isAutoRenewing),
|
|
@@ -433,6 +454,7 @@ export function convertNitroPurchaseToPurchase(
|
|
|
433
454
|
purchaseToken:
|
|
434
455
|
nitroPurchase.purchaseToken ?? nitroPurchase.purchaseTokenAndroid ?? null,
|
|
435
456
|
platform,
|
|
457
|
+
store,
|
|
436
458
|
quantity: nitroPurchase.quantity ?? 1,
|
|
437
459
|
purchaseState,
|
|
438
460
|
isAutoRenewing: Boolean(nitroPurchase.isAutoRenewing),
|