react-native-iap 16.2.4 → 16.3.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/README.md +2 -2
- package/android/src/main/java/com/margelo/nitro/iap/HybridRnIap.kt +115 -15
- package/ios/HybridRnIap.swift +5 -1
- package/lib/module/index.js +57 -7
- package/lib/module/index.js.map +1 -1
- package/lib/module/index.kepler.js +9 -0
- package/lib/module/index.kepler.js.map +1 -1
- package/lib/module/kit-api.js +3 -1
- package/lib/module/kit-api.js.map +1 -1
- package/lib/module/types.js +2 -0
- package/lib/module/types.js.map +1 -1
- package/lib/module/vega-adapter.js +9 -0
- package/lib/module/vega-adapter.js.map +1 -1
- package/lib/typescript/src/index.d.ts +3 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/index.kepler.d.ts.map +1 -1
- package/lib/typescript/src/kit-api.d.ts +119 -2
- package/lib/typescript/src/kit-api.d.ts.map +1 -1
- package/lib/typescript/src/specs/RnIap.nitro.d.ts +13 -3
- package/lib/typescript/src/specs/RnIap.nitro.d.ts.map +1 -1
- package/lib/typescript/src/types.d.ts +44 -9
- package/lib/typescript/src/types.d.ts.map +1 -1
- package/lib/typescript/src/vega-adapter.d.ts.map +1 -1
- package/nitrogen/generated/android/NitroIap+autolinking.cmake +1 -1
- package/nitrogen/generated/android/c++/JHybridRnIapSpec.cpp +8 -4
- package/nitrogen/generated/android/c++/JHybridRnIapSpec.hpp +1 -1
- package/nitrogen/generated/android/c++/JNitroPurchaseVerificationResultAndroid.hpp +5 -1
- package/nitrogen/generated/android/c++/JNitroPurchaseVerificationResultHorizon.hpp +69 -0
- package/nitrogen/generated/android/c++/JNitroVerifyPurchaseWithIapkitAmazonProps.hpp +5 -1
- package/nitrogen/generated/android/c++/JNitroVerifyPurchaseWithIapkitResult.hpp +5 -1
- package/nitrogen/generated/android/c++/JVariant_NitroPurchaseVerificationResultIOS_NitroPurchaseVerificationResultAndroid_NitroPurchaseVerificationResultHorizon.cpp +30 -0
- package/nitrogen/generated/android/c++/{JVariant_NitroPurchaseVerificationResultIOS_NitroPurchaseVerificationResultAndroid.hpp → JVariant_NitroPurchaseVerificationResultIOS_NitroPurchaseVerificationResultAndroid_NitroPurchaseVerificationResultHorizon.hpp} +33 -16
- package/nitrogen/generated/android/c++/JVariant_NullType_NitroVerifyPurchaseWithIapkitAmazonProps.hpp +1 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/HybridRnIapSpec.kt +1 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroPurchaseVerificationResultAndroid.kt +8 -3
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroPurchaseVerificationResultHorizon.kt +61 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroVerifyPurchaseWithIapkitAmazonProps.kt +8 -3
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroVerifyPurchaseWithIapkitResult.kt +7 -2
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/{Variant_NitroPurchaseVerificationResultIOS_NitroPurchaseVerificationResultAndroid.kt → Variant_NitroPurchaseVerificationResultIOS_NitroPurchaseVerificationResultAndroid_NitroPurchaseVerificationResultHorizon.kt} +21 -8
- package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Bridge.cpp +4 -4
- package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Bridge.hpp +43 -34
- package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Umbrella.hpp +3 -0
- package/nitrogen/generated/ios/c++/HybridRnIapSpecSwift.hpp +4 -1
- package/nitrogen/generated/ios/swift/{Func_void_std__variant_NitroPurchaseVerificationResultIOS__NitroPurchaseVerificationResultAndroid_.swift → Func_void_std__variant_NitroPurchaseVerificationResultIOS__NitroPurchaseVerificationResultAndroid__NitroPurchaseVerificationResultHorizon_.swift} +14 -11
- package/nitrogen/generated/ios/swift/HybridRnIapSpec.swift +1 -1
- package/nitrogen/generated/ios/swift/HybridRnIapSpec_cxx.swift +11 -9
- package/nitrogen/generated/ios/swift/NitroPurchaseVerificationResultAndroid.swift +7 -2
- package/nitrogen/generated/ios/swift/NitroPurchaseVerificationResultHorizon.swift +71 -0
- package/nitrogen/generated/ios/swift/NitroVerifyPurchaseWithIapkitAmazonProps.swift +39 -2
- package/nitrogen/generated/ios/swift/NitroVerifyPurchaseWithIapkitResult.swift +38 -1
- package/nitrogen/generated/ios/swift/{Variant_NitroPurchaseVerificationResultIOS_NitroPurchaseVerificationResultAndroid.swift → Variant_NitroPurchaseVerificationResultIOS_NitroPurchaseVerificationResultAndroid_NitroPurchaseVerificationResultHorizon.swift} +6 -4
- package/nitrogen/generated/shared/c++/HybridRnIapSpec.hpp +4 -1
- package/nitrogen/generated/shared/c++/NitroPurchaseVerificationResultAndroid.hpp +5 -1
- package/nitrogen/generated/shared/c++/NitroPurchaseVerificationResultHorizon.hpp +93 -0
- package/nitrogen/generated/shared/c++/NitroVerifyPurchaseWithIapkitAmazonProps.hpp +6 -2
- package/nitrogen/generated/shared/c++/NitroVerifyPurchaseWithIapkitResult.hpp +5 -1
- package/openiap-versions.json +3 -3
- package/package.json +1 -1
- package/src/index.kepler.ts +10 -2
- package/src/index.ts +94 -19
- package/src/kit-api.ts +125 -4
- package/src/specs/RnIap.nitro.ts +16 -2
- package/src/types.ts +45 -9
- package/src/vega-adapter.ts +10 -0
- package/nitrogen/generated/android/c++/JVariant_NitroPurchaseVerificationResultIOS_NitroPurchaseVerificationResultAndroid.cpp +0 -26
|
@@ -108,6 +108,8 @@ namespace margelo::nitro::iap { struct NitroSubscriptionStatus; }
|
|
|
108
108
|
namespace margelo::nitro::iap { struct NitroPurchaseVerificationResultIOS; }
|
|
109
109
|
// Forward declaration of `NitroPurchaseVerificationResultAndroid` to properly resolve imports.
|
|
110
110
|
namespace margelo::nitro::iap { struct NitroPurchaseVerificationResultAndroid; }
|
|
111
|
+
// Forward declaration of `NitroPurchaseVerificationResultHorizon` to properly resolve imports.
|
|
112
|
+
namespace margelo::nitro::iap { struct NitroPurchaseVerificationResultHorizon; }
|
|
111
113
|
// Forward declaration of `NitroPurchaseVerificationParams` to properly resolve imports.
|
|
112
114
|
namespace margelo::nitro::iap { struct NitroPurchaseVerificationParams; }
|
|
113
115
|
// Forward declaration of `NitroPurchaseVerificationAppleOptions` to properly resolve imports.
|
|
@@ -251,6 +253,7 @@ namespace margelo::nitro::iap { enum class ExternalPurchaseCustomLinkNoticeTypeI
|
|
|
251
253
|
#include "NitroSubscriptionStatus.hpp"
|
|
252
254
|
#include "NitroPurchaseVerificationResultIOS.hpp"
|
|
253
255
|
#include "NitroPurchaseVerificationResultAndroid.hpp"
|
|
256
|
+
#include "NitroPurchaseVerificationResultHorizon.hpp"
|
|
254
257
|
#include "NitroPurchaseVerificationParams.hpp"
|
|
255
258
|
#include "NitroPurchaseVerificationAppleOptions.hpp"
|
|
256
259
|
#include "NitroPurchaseVerificationGoogleOptions.hpp"
|
|
@@ -591,7 +594,7 @@ namespace margelo::nitro::iap {
|
|
|
591
594
|
auto __value = std::move(__result.value());
|
|
592
595
|
return __value;
|
|
593
596
|
}
|
|
594
|
-
inline std::shared_ptr<Promise<std::variant<NitroPurchaseVerificationResultIOS, NitroPurchaseVerificationResultAndroid>>> verifyPurchase(const NitroPurchaseVerificationParams& params) override {
|
|
597
|
+
inline std::shared_ptr<Promise<std::variant<NitroPurchaseVerificationResultIOS, NitroPurchaseVerificationResultAndroid, NitroPurchaseVerificationResultHorizon>>> verifyPurchase(const NitroPurchaseVerificationParams& params) override {
|
|
595
598
|
auto __result = _swiftPart.verifyPurchase(std::forward<decltype(params)>(params));
|
|
596
599
|
if (__result.hasError()) [[unlikely]] {
|
|
597
600
|
std::rethrow_exception(__result.error());
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
///
|
|
2
|
-
///
|
|
2
|
+
/// Func_void_std__variant_NitroPurchaseVerificationResultIOS__NitroPurchaseVerificationResultAndroid__NitroPurchaseVerificationResultHorizon_.swift
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
5
|
/// Copyright © Marc Rousavy @ Margelo
|
|
@@ -8,21 +8,21 @@
|
|
|
8
8
|
import NitroModules
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
|
-
* Wraps a Swift `(_ value:
|
|
11
|
+
* Wraps a Swift `(_ value: Variant_NitroPurchaseVerificationResultIOS_NitroPurchaseVerificationResultAndroid_NitroPurchaseVerificationResultHorizon) -> Void` as a class.
|
|
12
12
|
* This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
|
|
13
13
|
*/
|
|
14
|
-
public final class
|
|
14
|
+
public final class Func_void_std__variant_NitroPurchaseVerificationResultIOS__NitroPurchaseVerificationResultAndroid__NitroPurchaseVerificationResultHorizon_ {
|
|
15
15
|
public typealias bridge = margelo.nitro.iap.bridge.swift
|
|
16
16
|
|
|
17
|
-
private let closure: (_ value:
|
|
17
|
+
private let closure: (_ value: Variant_NitroPurchaseVerificationResultIOS_NitroPurchaseVerificationResultAndroid_NitroPurchaseVerificationResultHorizon) -> Void
|
|
18
18
|
|
|
19
|
-
public init(_ closure: @escaping (_ value:
|
|
19
|
+
public init(_ closure: @escaping (_ value: Variant_NitroPurchaseVerificationResultIOS_NitroPurchaseVerificationResultAndroid_NitroPurchaseVerificationResultHorizon) -> Void) {
|
|
20
20
|
self.closure = closure
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
@inline(__always)
|
|
24
|
-
public func call(value: bridge.
|
|
25
|
-
self.closure({ () ->
|
|
24
|
+
public func call(value: bridge.std__variant_NitroPurchaseVerificationResultIOS__NitroPurchaseVerificationResultAndroid__NitroPurchaseVerificationResultHorizon_) -> Void {
|
|
25
|
+
self.closure({ () -> Variant_NitroPurchaseVerificationResultIOS_NitroPurchaseVerificationResultAndroid_NitroPurchaseVerificationResultHorizon in
|
|
26
26
|
let __variant = value
|
|
27
27
|
switch __variant.index() {
|
|
28
28
|
case 0:
|
|
@@ -31,6 +31,9 @@ public final class Func_void_std__variant_NitroPurchaseVerificationResultIOS__Ni
|
|
|
31
31
|
case 1:
|
|
32
32
|
let __actual = __variant.get_1()
|
|
33
33
|
return .second(__actual)
|
|
34
|
+
case 2:
|
|
35
|
+
let __actual = __variant.get_2()
|
|
36
|
+
return .third(__actual)
|
|
34
37
|
default:
|
|
35
38
|
fatalError("Variant can never have index \(__variant.index())!")
|
|
36
39
|
}
|
|
@@ -47,12 +50,12 @@ public final class Func_void_std__variant_NitroPurchaseVerificationResultIOS__Ni
|
|
|
47
50
|
}
|
|
48
51
|
|
|
49
52
|
/**
|
|
50
|
-
* Casts an unsafe pointer to a `
|
|
51
|
-
* The pointer has to be a retained opaque `Unmanaged<
|
|
53
|
+
* Casts an unsafe pointer to a `Func_void_std__variant_NitroPurchaseVerificationResultIOS__NitroPurchaseVerificationResultAndroid__NitroPurchaseVerificationResultHorizon_`.
|
|
54
|
+
* The pointer has to be a retained opaque `Unmanaged<Func_void_std__variant_NitroPurchaseVerificationResultIOS__NitroPurchaseVerificationResultAndroid__NitroPurchaseVerificationResultHorizon_>`.
|
|
52
55
|
* This removes one strong reference from the object!
|
|
53
56
|
*/
|
|
54
57
|
@inline(__always)
|
|
55
|
-
public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) ->
|
|
56
|
-
return Unmanaged<
|
|
58
|
+
public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_std__variant_NitroPurchaseVerificationResultIOS__NitroPurchaseVerificationResultAndroid__NitroPurchaseVerificationResultHorizon_ {
|
|
59
|
+
return Unmanaged<Func_void_std__variant_NitroPurchaseVerificationResultIOS__NitroPurchaseVerificationResultAndroid__NitroPurchaseVerificationResultHorizon_>.fromOpaque(pointer).takeRetainedValue()
|
|
57
60
|
}
|
|
58
61
|
}
|
|
@@ -45,7 +45,7 @@ public protocol HybridRnIapSpec_protocol: HybridObject {
|
|
|
45
45
|
func requestReceiptRefreshIOS() throws -> Promise<String>
|
|
46
46
|
func isTransactionVerifiedIOS(sku: String) throws -> Promise<Bool>
|
|
47
47
|
func getTransactionJwsIOS(sku: String) throws -> Promise<Variant_NullType_String>
|
|
48
|
-
func verifyPurchase(params: NitroPurchaseVerificationParams) throws -> Promise<
|
|
48
|
+
func verifyPurchase(params: NitroPurchaseVerificationParams) throws -> Promise<Variant_NitroPurchaseVerificationResultIOS_NitroPurchaseVerificationResultAndroid_NitroPurchaseVerificationResultHorizon>
|
|
49
49
|
func verifyPurchaseWithProvider(params: NitroVerifyPurchaseWithProviderProps) throws -> Promise<NitroVerifyPurchaseWithProviderResult>
|
|
50
50
|
func getStorefront() throws -> Promise<String>
|
|
51
51
|
func deepLinkToSubscriptionsAndroid(options: NitroDeepLinkOptionsAndroid) throws -> Promise<Void>
|
|
@@ -873,28 +873,30 @@ open class HybridRnIapSpec_cxx {
|
|
|
873
873
|
}
|
|
874
874
|
|
|
875
875
|
@inline(__always)
|
|
876
|
-
public final func verifyPurchase(params: NitroPurchaseVerificationParams) -> bridge.
|
|
876
|
+
public final func verifyPurchase(params: NitroPurchaseVerificationParams) -> bridge.Result_std__shared_ptr_Promise_std__variant_NitroPurchaseVerificationResultIOS__NitroPurchaseVerificationResultAndroid__NitroPurchaseVerificationResultHorizon____ {
|
|
877
877
|
do {
|
|
878
878
|
let __result = try self.__implementation.verifyPurchase(params: params)
|
|
879
|
-
let __resultCpp = { () -> bridge.
|
|
880
|
-
let __promise = bridge.
|
|
881
|
-
let __promiseHolder = bridge.
|
|
879
|
+
let __resultCpp = { () -> bridge.std__shared_ptr_Promise_std__variant_NitroPurchaseVerificationResultIOS__NitroPurchaseVerificationResultAndroid__NitroPurchaseVerificationResultHorizon___ in
|
|
880
|
+
let __promise = bridge.create_std__shared_ptr_Promise_std__variant_NitroPurchaseVerificationResultIOS__NitroPurchaseVerificationResultAndroid__NitroPurchaseVerificationResultHorizon___()
|
|
881
|
+
let __promiseHolder = bridge.wrap_std__shared_ptr_Promise_std__variant_NitroPurchaseVerificationResultIOS__NitroPurchaseVerificationResultAndroid__NitroPurchaseVerificationResultHorizon___(__promise)
|
|
882
882
|
__result
|
|
883
|
-
.then({ __result in __promiseHolder.resolve({ () -> bridge.
|
|
883
|
+
.then({ __result in __promiseHolder.resolve({ () -> bridge.std__variant_NitroPurchaseVerificationResultIOS__NitroPurchaseVerificationResultAndroid__NitroPurchaseVerificationResultHorizon_ in
|
|
884
884
|
switch __result {
|
|
885
885
|
case .first(let __value):
|
|
886
|
-
return bridge.
|
|
886
|
+
return bridge.create_std__variant_NitroPurchaseVerificationResultIOS__NitroPurchaseVerificationResultAndroid__NitroPurchaseVerificationResultHorizon_(__value)
|
|
887
887
|
case .second(let __value):
|
|
888
|
-
return bridge.
|
|
888
|
+
return bridge.create_std__variant_NitroPurchaseVerificationResultIOS__NitroPurchaseVerificationResultAndroid__NitroPurchaseVerificationResultHorizon_(__value)
|
|
889
|
+
case .third(let __value):
|
|
890
|
+
return bridge.create_std__variant_NitroPurchaseVerificationResultIOS__NitroPurchaseVerificationResultAndroid__NitroPurchaseVerificationResultHorizon_(__value)
|
|
889
891
|
}
|
|
890
892
|
}().variant) })
|
|
891
893
|
.catch({ __error in __promiseHolder.reject(__error.toCpp()) })
|
|
892
894
|
return __promise
|
|
893
895
|
}()
|
|
894
|
-
return bridge.
|
|
896
|
+
return bridge.create_Result_std__shared_ptr_Promise_std__variant_NitroPurchaseVerificationResultIOS__NitroPurchaseVerificationResultAndroid__NitroPurchaseVerificationResultHorizon____(__resultCpp)
|
|
895
897
|
} catch (let __error) {
|
|
896
898
|
let __exceptionPtr = __error.toCpp()
|
|
897
|
-
return bridge.
|
|
899
|
+
return bridge.create_Result_std__shared_ptr_Promise_std__variant_NitroPurchaseVerificationResultIOS__NitroPurchaseVerificationResultAndroid__NitroPurchaseVerificationResultHorizon____(__exceptionPtr)
|
|
898
900
|
}
|
|
899
901
|
}
|
|
900
902
|
|
|
@@ -18,8 +18,8 @@ public extension NitroPurchaseVerificationResultAndroid {
|
|
|
18
18
|
/**
|
|
19
19
|
* Create a new instance of `NitroPurchaseVerificationResultAndroid`.
|
|
20
20
|
*/
|
|
21
|
-
init(autoRenewing: Bool, betaProduct: Bool, cancelDate: Variant_NullType_Double?, cancelReason: Variant_NullType_String?, deferredDate: Variant_NullType_Double?, deferredSku: Variant_NullType_String?, freeTrialEndDate: Double, gracePeriodEndDate: Double, parentProductId: String, productId: String, productType: String, purchaseDate: Double, quantity: Double, receiptId: String, renewalDate: Double, term: String, termSku: String, testTransaction: Bool) {
|
|
22
|
-
self.init(autoRenewing, betaProduct, { () -> bridge.std__optional_std__variant_nitro__NullType__double__ in
|
|
21
|
+
init(isValid: Bool, autoRenewing: Bool, betaProduct: Bool, cancelDate: Variant_NullType_Double?, cancelReason: Variant_NullType_String?, deferredDate: Variant_NullType_Double?, deferredSku: Variant_NullType_String?, freeTrialEndDate: Double, gracePeriodEndDate: Double, parentProductId: String, productId: String, productType: String, purchaseDate: Double, quantity: Double, receiptId: String, renewalDate: Double, term: String, termSku: String, testTransaction: Bool) {
|
|
22
|
+
self.init(isValid, autoRenewing, betaProduct, { () -> bridge.std__optional_std__variant_nitro__NullType__double__ in
|
|
23
23
|
if let __unwrappedValue = cancelDate {
|
|
24
24
|
return bridge.create_std__optional_std__variant_nitro__NullType__double__({ () -> bridge.std__variant_nitro__NullType__double_ in
|
|
25
25
|
switch __unwrappedValue {
|
|
@@ -74,6 +74,11 @@ public extension NitroPurchaseVerificationResultAndroid {
|
|
|
74
74
|
}(), freeTrialEndDate, gracePeriodEndDate, std.string(parentProductId), std.string(productId), std.string(productType), purchaseDate, quantity, std.string(receiptId), renewalDate, std.string(term), std.string(termSku), testTransaction)
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
+
@inline(__always)
|
|
78
|
+
var isValid: Bool {
|
|
79
|
+
return self.__isValid
|
|
80
|
+
}
|
|
81
|
+
|
|
77
82
|
@inline(__always)
|
|
78
83
|
var autoRenewing: Bool {
|
|
79
84
|
return self.__autoRenewing
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NitroPurchaseVerificationResultHorizon.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
import NitroModules
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Represents an instance of `NitroPurchaseVerificationResultHorizon`, backed by a C++ struct.
|
|
12
|
+
*/
|
|
13
|
+
public typealias NitroPurchaseVerificationResultHorizon = margelo.nitro.iap.NitroPurchaseVerificationResultHorizon
|
|
14
|
+
|
|
15
|
+
public extension NitroPurchaseVerificationResultHorizon {
|
|
16
|
+
private typealias bridge = margelo.nitro.iap.bridge.swift
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Create a new instance of `NitroPurchaseVerificationResultHorizon`.
|
|
20
|
+
*/
|
|
21
|
+
init(isValid: Bool, grantTime: Variant_NullType_Double?, success: Bool) {
|
|
22
|
+
self.init(isValid, { () -> bridge.std__optional_std__variant_nitro__NullType__double__ in
|
|
23
|
+
if let __unwrappedValue = grantTime {
|
|
24
|
+
return bridge.create_std__optional_std__variant_nitro__NullType__double__({ () -> bridge.std__variant_nitro__NullType__double_ in
|
|
25
|
+
switch __unwrappedValue {
|
|
26
|
+
case .first(let __value):
|
|
27
|
+
return bridge.create_std__variant_nitro__NullType__double_(margelo.nitro.NullType.null)
|
|
28
|
+
case .second(let __value):
|
|
29
|
+
return bridge.create_std__variant_nitro__NullType__double_(__value)
|
|
30
|
+
}
|
|
31
|
+
}().variant)
|
|
32
|
+
} else {
|
|
33
|
+
return .init()
|
|
34
|
+
}
|
|
35
|
+
}(), success)
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
@inline(__always)
|
|
39
|
+
var isValid: Bool {
|
|
40
|
+
return self.__isValid
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
@inline(__always)
|
|
44
|
+
var grantTime: Variant_NullType_Double? {
|
|
45
|
+
return { () -> Variant_NullType_Double? in
|
|
46
|
+
if bridge.has_value_std__optional_std__variant_nitro__NullType__double__(self.__grantTime) {
|
|
47
|
+
let __unwrapped = bridge.get_std__optional_std__variant_nitro__NullType__double__(self.__grantTime)
|
|
48
|
+
return { () -> Variant_NullType_Double in
|
|
49
|
+
let __variant = bridge.std__variant_nitro__NullType__double_(__unwrapped)
|
|
50
|
+
switch __variant.index() {
|
|
51
|
+
case 0:
|
|
52
|
+
let __actual = __variant.get_0()
|
|
53
|
+
return .first(NullType.null)
|
|
54
|
+
case 1:
|
|
55
|
+
let __actual = __variant.get_1()
|
|
56
|
+
return .second(__actual)
|
|
57
|
+
default:
|
|
58
|
+
fatalError("Variant can never have index \(__variant.index())!")
|
|
59
|
+
}
|
|
60
|
+
}()
|
|
61
|
+
} else {
|
|
62
|
+
return nil
|
|
63
|
+
}
|
|
64
|
+
}()
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
@inline(__always)
|
|
68
|
+
var success: Bool {
|
|
69
|
+
return self.__success
|
|
70
|
+
}
|
|
71
|
+
}
|
|
@@ -18,8 +18,21 @@ public extension NitroVerifyPurchaseWithIapkitAmazonProps {
|
|
|
18
18
|
/**
|
|
19
19
|
* Create a new instance of `NitroVerifyPurchaseWithIapkitAmazonProps`.
|
|
20
20
|
*/
|
|
21
|
-
init(receiptId: String, sandbox: Variant_NullType_Bool?, userId: Variant_NullType_String?) {
|
|
22
|
-
self.init(
|
|
21
|
+
init(expectedProductId: Variant_NullType_String?, receiptId: String, sandbox: Variant_NullType_Bool?, userId: Variant_NullType_String?) {
|
|
22
|
+
self.init({ () -> bridge.std__optional_std__variant_nitro__NullType__std__string__ in
|
|
23
|
+
if let __unwrappedValue = expectedProductId {
|
|
24
|
+
return bridge.create_std__optional_std__variant_nitro__NullType__std__string__({ () -> bridge.std__variant_nitro__NullType__std__string_ in
|
|
25
|
+
switch __unwrappedValue {
|
|
26
|
+
case .first(let __value):
|
|
27
|
+
return bridge.create_std__variant_nitro__NullType__std__string_(margelo.nitro.NullType.null)
|
|
28
|
+
case .second(let __value):
|
|
29
|
+
return bridge.create_std__variant_nitro__NullType__std__string_(std.string(__value))
|
|
30
|
+
}
|
|
31
|
+
}().variant)
|
|
32
|
+
} else {
|
|
33
|
+
return .init()
|
|
34
|
+
}
|
|
35
|
+
}(), std.string(receiptId), { () -> bridge.std__optional_std__variant_nitro__NullType__bool__ in
|
|
23
36
|
if let __unwrappedValue = sandbox {
|
|
24
37
|
return bridge.create_std__optional_std__variant_nitro__NullType__bool__({ () -> bridge.std__variant_nitro__NullType__bool_ in
|
|
25
38
|
switch __unwrappedValue {
|
|
@@ -48,6 +61,30 @@ public extension NitroVerifyPurchaseWithIapkitAmazonProps {
|
|
|
48
61
|
}())
|
|
49
62
|
}
|
|
50
63
|
|
|
64
|
+
@inline(__always)
|
|
65
|
+
var expectedProductId: Variant_NullType_String? {
|
|
66
|
+
return { () -> Variant_NullType_String? in
|
|
67
|
+
if bridge.has_value_std__optional_std__variant_nitro__NullType__std__string__(self.__expectedProductId) {
|
|
68
|
+
let __unwrapped = bridge.get_std__optional_std__variant_nitro__NullType__std__string__(self.__expectedProductId)
|
|
69
|
+
return { () -> Variant_NullType_String in
|
|
70
|
+
let __variant = bridge.std__variant_nitro__NullType__std__string_(__unwrapped)
|
|
71
|
+
switch __variant.index() {
|
|
72
|
+
case 0:
|
|
73
|
+
let __actual = __variant.get_0()
|
|
74
|
+
return .first(NullType.null)
|
|
75
|
+
case 1:
|
|
76
|
+
let __actual = __variant.get_1()
|
|
77
|
+
return .second(String(__actual))
|
|
78
|
+
default:
|
|
79
|
+
fatalError("Variant can never have index \(__variant.index())!")
|
|
80
|
+
}
|
|
81
|
+
}()
|
|
82
|
+
} else {
|
|
83
|
+
return nil
|
|
84
|
+
}
|
|
85
|
+
}()
|
|
86
|
+
}
|
|
87
|
+
|
|
51
88
|
@inline(__always)
|
|
52
89
|
var receiptId: String {
|
|
53
90
|
return String(self.__receiptId)
|
|
@@ -18,7 +18,7 @@ public extension NitroVerifyPurchaseWithIapkitResult {
|
|
|
18
18
|
/**
|
|
19
19
|
* Create a new instance of `NitroVerifyPurchaseWithIapkitResult`.
|
|
20
20
|
*/
|
|
21
|
-
init(clientPayload: Variant_NullType_NitroIapkitProductClientPayload?, isValid: Bool, productId: Variant_NullType_String?, state: IapkitPurchaseState, store: IapStore) {
|
|
21
|
+
init(clientPayload: Variant_NullType_NitroIapkitProductClientPayload?, environment: Variant_NullType_String?, isValid: Bool, productId: Variant_NullType_String?, state: IapkitPurchaseState, store: IapStore) {
|
|
22
22
|
self.init({ () -> bridge.std__optional_std__variant_nitro__NullType__NitroIapkitProductClientPayload__ in
|
|
23
23
|
if let __unwrappedValue = clientPayload {
|
|
24
24
|
return bridge.create_std__optional_std__variant_nitro__NullType__NitroIapkitProductClientPayload__({ () -> bridge.std__variant_nitro__NullType__NitroIapkitProductClientPayload_ in
|
|
@@ -32,6 +32,19 @@ public extension NitroVerifyPurchaseWithIapkitResult {
|
|
|
32
32
|
} else {
|
|
33
33
|
return .init()
|
|
34
34
|
}
|
|
35
|
+
}(), { () -> bridge.std__optional_std__variant_nitro__NullType__std__string__ in
|
|
36
|
+
if let __unwrappedValue = environment {
|
|
37
|
+
return bridge.create_std__optional_std__variant_nitro__NullType__std__string__({ () -> bridge.std__variant_nitro__NullType__std__string_ in
|
|
38
|
+
switch __unwrappedValue {
|
|
39
|
+
case .first(let __value):
|
|
40
|
+
return bridge.create_std__variant_nitro__NullType__std__string_(margelo.nitro.NullType.null)
|
|
41
|
+
case .second(let __value):
|
|
42
|
+
return bridge.create_std__variant_nitro__NullType__std__string_(std.string(__value))
|
|
43
|
+
}
|
|
44
|
+
}().variant)
|
|
45
|
+
} else {
|
|
46
|
+
return .init()
|
|
47
|
+
}
|
|
35
48
|
}(), isValid, { () -> bridge.std__optional_std__variant_nitro__NullType__std__string__ in
|
|
36
49
|
if let __unwrappedValue = productId {
|
|
37
50
|
return bridge.create_std__optional_std__variant_nitro__NullType__std__string__({ () -> bridge.std__variant_nitro__NullType__std__string_ in
|
|
@@ -72,6 +85,30 @@ public extension NitroVerifyPurchaseWithIapkitResult {
|
|
|
72
85
|
}()
|
|
73
86
|
}
|
|
74
87
|
|
|
88
|
+
@inline(__always)
|
|
89
|
+
var environment: Variant_NullType_String? {
|
|
90
|
+
return { () -> Variant_NullType_String? in
|
|
91
|
+
if bridge.has_value_std__optional_std__variant_nitro__NullType__std__string__(self.__environment) {
|
|
92
|
+
let __unwrapped = bridge.get_std__optional_std__variant_nitro__NullType__std__string__(self.__environment)
|
|
93
|
+
return { () -> Variant_NullType_String in
|
|
94
|
+
let __variant = bridge.std__variant_nitro__NullType__std__string_(__unwrapped)
|
|
95
|
+
switch __variant.index() {
|
|
96
|
+
case 0:
|
|
97
|
+
let __actual = __variant.get_0()
|
|
98
|
+
return .first(NullType.null)
|
|
99
|
+
case 1:
|
|
100
|
+
let __actual = __variant.get_1()
|
|
101
|
+
return .second(String(__actual))
|
|
102
|
+
default:
|
|
103
|
+
fatalError("Variant can never have index \(__variant.index())!")
|
|
104
|
+
}
|
|
105
|
+
}()
|
|
106
|
+
} else {
|
|
107
|
+
return nil
|
|
108
|
+
}
|
|
109
|
+
}()
|
|
110
|
+
}
|
|
111
|
+
|
|
75
112
|
@inline(__always)
|
|
76
113
|
var isValid: Bool {
|
|
77
114
|
return self.__isValid
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
///
|
|
2
|
-
///
|
|
2
|
+
/// Variant_NitroPurchaseVerificationResultIOS_NitroPurchaseVerificationResultAndroid_NitroPurchaseVerificationResultHorizon.swift
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
5
|
/// Copyright © Marc Rousavy @ Margelo
|
|
@@ -9,19 +9,21 @@
|
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* An Swift enum with associated values representing a Variant/Union type.
|
|
12
|
-
* JS type: `struct | struct`
|
|
12
|
+
* JS type: `struct | struct | struct`
|
|
13
13
|
*/
|
|
14
14
|
@frozen
|
|
15
|
-
public indirect enum
|
|
15
|
+
public indirect enum Variant_NitroPurchaseVerificationResultIOS_NitroPurchaseVerificationResultAndroid_NitroPurchaseVerificationResultHorizon {
|
|
16
16
|
case first(NitroPurchaseVerificationResultIOS)
|
|
17
17
|
case second(NitroPurchaseVerificationResultAndroid)
|
|
18
|
+
case third(NitroPurchaseVerificationResultHorizon)
|
|
18
19
|
}
|
|
19
20
|
|
|
20
|
-
public extension
|
|
21
|
+
public extension Variant_NitroPurchaseVerificationResultIOS_NitroPurchaseVerificationResultAndroid_NitroPurchaseVerificationResultHorizon {
|
|
21
22
|
func asType<T>(_ type: T.Type = T.self) -> T? {
|
|
22
23
|
switch self {
|
|
23
24
|
case .first(let value): return value as? T
|
|
24
25
|
case .second(let value): return value as? T
|
|
26
|
+
case .third(let value): return value as? T
|
|
25
27
|
}
|
|
26
28
|
}
|
|
27
29
|
func isType<T>(_ type: T.Type = T.self) -> Bool {
|
|
@@ -41,6 +41,8 @@ namespace margelo::nitro::iap { struct NitroSubscriptionStatus; }
|
|
|
41
41
|
namespace margelo::nitro::iap { struct NitroPurchaseVerificationResultIOS; }
|
|
42
42
|
// Forward declaration of `NitroPurchaseVerificationResultAndroid` to properly resolve imports.
|
|
43
43
|
namespace margelo::nitro::iap { struct NitroPurchaseVerificationResultAndroid; }
|
|
44
|
+
// Forward declaration of `NitroPurchaseVerificationResultHorizon` to properly resolve imports.
|
|
45
|
+
namespace margelo::nitro::iap { struct NitroPurchaseVerificationResultHorizon; }
|
|
44
46
|
// Forward declaration of `NitroPurchaseVerificationParams` to properly resolve imports.
|
|
45
47
|
namespace margelo::nitro::iap { struct NitroPurchaseVerificationParams; }
|
|
46
48
|
// Forward declaration of `NitroVerifyPurchaseWithProviderResult` to properly resolve imports.
|
|
@@ -109,6 +111,7 @@ namespace margelo::nitro::iap { enum class ExternalPurchaseCustomLinkNoticeTypeI
|
|
|
109
111
|
#include "NitroSubscriptionStatus.hpp"
|
|
110
112
|
#include "NitroPurchaseVerificationResultIOS.hpp"
|
|
111
113
|
#include "NitroPurchaseVerificationResultAndroid.hpp"
|
|
114
|
+
#include "NitroPurchaseVerificationResultHorizon.hpp"
|
|
112
115
|
#include "NitroPurchaseVerificationParams.hpp"
|
|
113
116
|
#include "NitroVerifyPurchaseWithProviderResult.hpp"
|
|
114
117
|
#include "NitroVerifyPurchaseWithProviderProps.hpp"
|
|
@@ -196,7 +199,7 @@ namespace margelo::nitro::iap {
|
|
|
196
199
|
virtual std::shared_ptr<Promise<std::string>> requestReceiptRefreshIOS() = 0;
|
|
197
200
|
virtual std::shared_ptr<Promise<bool>> isTransactionVerifiedIOS(const std::string& sku) = 0;
|
|
198
201
|
virtual std::shared_ptr<Promise<std::variant<nitro::NullType, std::string>>> getTransactionJwsIOS(const std::string& sku) = 0;
|
|
199
|
-
virtual std::shared_ptr<Promise<std::variant<NitroPurchaseVerificationResultIOS, NitroPurchaseVerificationResultAndroid>>> verifyPurchase(const NitroPurchaseVerificationParams& params) = 0;
|
|
202
|
+
virtual std::shared_ptr<Promise<std::variant<NitroPurchaseVerificationResultIOS, NitroPurchaseVerificationResultAndroid, NitroPurchaseVerificationResultHorizon>>> verifyPurchase(const NitroPurchaseVerificationParams& params) = 0;
|
|
200
203
|
virtual std::shared_ptr<Promise<NitroVerifyPurchaseWithProviderResult>> verifyPurchaseWithProvider(const NitroVerifyPurchaseWithProviderProps& params) = 0;
|
|
201
204
|
virtual std::shared_ptr<Promise<std::string>> getStorefront() = 0;
|
|
202
205
|
virtual std::shared_ptr<Promise<void>> deepLinkToSubscriptionsAndroid(const NitroDeepLinkOptionsAndroid& options) = 0;
|
|
@@ -42,6 +42,7 @@ namespace margelo::nitro::iap {
|
|
|
42
42
|
*/
|
|
43
43
|
struct NitroPurchaseVerificationResultAndroid final {
|
|
44
44
|
public:
|
|
45
|
+
bool isValid SWIFT_PRIVATE;
|
|
45
46
|
bool autoRenewing SWIFT_PRIVATE;
|
|
46
47
|
bool betaProduct SWIFT_PRIVATE;
|
|
47
48
|
std::optional<std::variant<nitro::NullType, double>> cancelDate SWIFT_PRIVATE;
|
|
@@ -63,7 +64,7 @@ namespace margelo::nitro::iap {
|
|
|
63
64
|
|
|
64
65
|
public:
|
|
65
66
|
NitroPurchaseVerificationResultAndroid() = default;
|
|
66
|
-
explicit NitroPurchaseVerificationResultAndroid(bool autoRenewing, bool betaProduct, std::optional<std::variant<nitro::NullType, double>> cancelDate, std::optional<std::variant<nitro::NullType, std::string>> cancelReason, std::optional<std::variant<nitro::NullType, double>> deferredDate, std::optional<std::variant<nitro::NullType, std::string>> deferredSku, double freeTrialEndDate, double gracePeriodEndDate, std::string parentProductId, std::string productId, std::string productType, double purchaseDate, double quantity, std::string receiptId, double renewalDate, std::string term, std::string termSku, bool testTransaction): autoRenewing(autoRenewing), betaProduct(betaProduct), cancelDate(cancelDate), cancelReason(cancelReason), deferredDate(deferredDate), deferredSku(deferredSku), freeTrialEndDate(freeTrialEndDate), gracePeriodEndDate(gracePeriodEndDate), parentProductId(parentProductId), productId(productId), productType(productType), purchaseDate(purchaseDate), quantity(quantity), receiptId(receiptId), renewalDate(renewalDate), term(term), termSku(termSku), testTransaction(testTransaction) {}
|
|
67
|
+
explicit NitroPurchaseVerificationResultAndroid(bool isValid, bool autoRenewing, bool betaProduct, std::optional<std::variant<nitro::NullType, double>> cancelDate, std::optional<std::variant<nitro::NullType, std::string>> cancelReason, std::optional<std::variant<nitro::NullType, double>> deferredDate, std::optional<std::variant<nitro::NullType, std::string>> deferredSku, double freeTrialEndDate, double gracePeriodEndDate, std::string parentProductId, std::string productId, std::string productType, double purchaseDate, double quantity, std::string receiptId, double renewalDate, std::string term, std::string termSku, bool testTransaction): isValid(isValid), autoRenewing(autoRenewing), betaProduct(betaProduct), cancelDate(cancelDate), cancelReason(cancelReason), deferredDate(deferredDate), deferredSku(deferredSku), freeTrialEndDate(freeTrialEndDate), gracePeriodEndDate(gracePeriodEndDate), parentProductId(parentProductId), productId(productId), productType(productType), purchaseDate(purchaseDate), quantity(quantity), receiptId(receiptId), renewalDate(renewalDate), term(term), termSku(termSku), testTransaction(testTransaction) {}
|
|
67
68
|
|
|
68
69
|
public:
|
|
69
70
|
friend bool operator==(const NitroPurchaseVerificationResultAndroid& lhs, const NitroPurchaseVerificationResultAndroid& rhs) = default;
|
|
@@ -79,6 +80,7 @@ namespace margelo::nitro {
|
|
|
79
80
|
static inline margelo::nitro::iap::NitroPurchaseVerificationResultAndroid fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
80
81
|
jsi::Object obj = arg.asObject(runtime);
|
|
81
82
|
return margelo::nitro::iap::NitroPurchaseVerificationResultAndroid(
|
|
83
|
+
JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "isValid"))),
|
|
82
84
|
JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "autoRenewing"))),
|
|
83
85
|
JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "betaProduct"))),
|
|
84
86
|
JSIConverter<std::optional<std::variant<nitro::NullType, double>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "cancelDate"))),
|
|
@@ -101,6 +103,7 @@ namespace margelo::nitro {
|
|
|
101
103
|
}
|
|
102
104
|
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::iap::NitroPurchaseVerificationResultAndroid& arg) {
|
|
103
105
|
jsi::Object obj(runtime);
|
|
106
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "isValid"), JSIConverter<bool>::toJSI(runtime, arg.isValid));
|
|
104
107
|
obj.setProperty(runtime, PropNameIDCache::get(runtime, "autoRenewing"), JSIConverter<bool>::toJSI(runtime, arg.autoRenewing));
|
|
105
108
|
obj.setProperty(runtime, PropNameIDCache::get(runtime, "betaProduct"), JSIConverter<bool>::toJSI(runtime, arg.betaProduct));
|
|
106
109
|
obj.setProperty(runtime, PropNameIDCache::get(runtime, "cancelDate"), JSIConverter<std::optional<std::variant<nitro::NullType, double>>>::toJSI(runtime, arg.cancelDate));
|
|
@@ -129,6 +132,7 @@ namespace margelo::nitro {
|
|
|
129
132
|
if (!nitro::isPlainObject(runtime, obj)) {
|
|
130
133
|
return false;
|
|
131
134
|
}
|
|
135
|
+
if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "isValid")))) return false;
|
|
132
136
|
if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "autoRenewing")))) return false;
|
|
133
137
|
if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "betaProduct")))) return false;
|
|
134
138
|
if (!JSIConverter<std::optional<std::variant<nitro::NullType, double>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "cancelDate")))) return false;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NitroPurchaseVerificationResultHorizon.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 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
|
+
#if __has_include(<NitroModules/PropNameIDCache.hpp>)
|
|
26
|
+
#include <NitroModules/PropNameIDCache.hpp>
|
|
27
|
+
#else
|
|
28
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
29
|
+
#endif
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
#include <NitroModules/Null.hpp>
|
|
34
|
+
#include <variant>
|
|
35
|
+
#include <optional>
|
|
36
|
+
|
|
37
|
+
namespace margelo::nitro::iap {
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* A struct which can be represented as a JavaScript object (NitroPurchaseVerificationResultHorizon).
|
|
41
|
+
*/
|
|
42
|
+
struct NitroPurchaseVerificationResultHorizon final {
|
|
43
|
+
public:
|
|
44
|
+
bool isValid SWIFT_PRIVATE;
|
|
45
|
+
std::optional<std::variant<nitro::NullType, double>> grantTime SWIFT_PRIVATE;
|
|
46
|
+
bool success SWIFT_PRIVATE;
|
|
47
|
+
|
|
48
|
+
public:
|
|
49
|
+
NitroPurchaseVerificationResultHorizon() = default;
|
|
50
|
+
explicit NitroPurchaseVerificationResultHorizon(bool isValid, std::optional<std::variant<nitro::NullType, double>> grantTime, bool success): isValid(isValid), grantTime(grantTime), success(success) {}
|
|
51
|
+
|
|
52
|
+
public:
|
|
53
|
+
friend bool operator==(const NitroPurchaseVerificationResultHorizon& lhs, const NitroPurchaseVerificationResultHorizon& rhs) = default;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
} // namespace margelo::nitro::iap
|
|
57
|
+
|
|
58
|
+
namespace margelo::nitro {
|
|
59
|
+
|
|
60
|
+
// C++ NitroPurchaseVerificationResultHorizon <> JS NitroPurchaseVerificationResultHorizon (object)
|
|
61
|
+
template <>
|
|
62
|
+
struct JSIConverter<margelo::nitro::iap::NitroPurchaseVerificationResultHorizon> final {
|
|
63
|
+
static inline margelo::nitro::iap::NitroPurchaseVerificationResultHorizon fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
64
|
+
jsi::Object obj = arg.asObject(runtime);
|
|
65
|
+
return margelo::nitro::iap::NitroPurchaseVerificationResultHorizon(
|
|
66
|
+
JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "isValid"))),
|
|
67
|
+
JSIConverter<std::optional<std::variant<nitro::NullType, double>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "grantTime"))),
|
|
68
|
+
JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "success")))
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::iap::NitroPurchaseVerificationResultHorizon& arg) {
|
|
72
|
+
jsi::Object obj(runtime);
|
|
73
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "isValid"), JSIConverter<bool>::toJSI(runtime, arg.isValid));
|
|
74
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "grantTime"), JSIConverter<std::optional<std::variant<nitro::NullType, double>>>::toJSI(runtime, arg.grantTime));
|
|
75
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "success"), JSIConverter<bool>::toJSI(runtime, arg.success));
|
|
76
|
+
return obj;
|
|
77
|
+
}
|
|
78
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
79
|
+
if (!value.isObject()) {
|
|
80
|
+
return false;
|
|
81
|
+
}
|
|
82
|
+
jsi::Object obj = value.getObject(runtime);
|
|
83
|
+
if (!nitro::isPlainObject(runtime, obj)) {
|
|
84
|
+
return false;
|
|
85
|
+
}
|
|
86
|
+
if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "isValid")))) return false;
|
|
87
|
+
if (!JSIConverter<std::optional<std::variant<nitro::NullType, double>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "grantTime")))) return false;
|
|
88
|
+
if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "success")))) return false;
|
|
89
|
+
return true;
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
} // namespace margelo::nitro
|
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
|
|
31
31
|
|
|
32
32
|
|
|
33
|
-
#include <string>
|
|
34
33
|
#include <NitroModules/Null.hpp>
|
|
34
|
+
#include <string>
|
|
35
35
|
#include <variant>
|
|
36
36
|
#include <optional>
|
|
37
37
|
|
|
@@ -42,13 +42,14 @@ namespace margelo::nitro::iap {
|
|
|
42
42
|
*/
|
|
43
43
|
struct NitroVerifyPurchaseWithIapkitAmazonProps final {
|
|
44
44
|
public:
|
|
45
|
+
std::optional<std::variant<nitro::NullType, std::string>> expectedProductId SWIFT_PRIVATE;
|
|
45
46
|
std::string receiptId SWIFT_PRIVATE;
|
|
46
47
|
std::optional<std::variant<nitro::NullType, bool>> sandbox SWIFT_PRIVATE;
|
|
47
48
|
std::optional<std::variant<nitro::NullType, std::string>> userId SWIFT_PRIVATE;
|
|
48
49
|
|
|
49
50
|
public:
|
|
50
51
|
NitroVerifyPurchaseWithIapkitAmazonProps() = default;
|
|
51
|
-
explicit NitroVerifyPurchaseWithIapkitAmazonProps(std::string receiptId, std::optional<std::variant<nitro::NullType, bool>> sandbox, std::optional<std::variant<nitro::NullType, std::string>> userId): receiptId(receiptId), sandbox(sandbox), userId(userId) {}
|
|
52
|
+
explicit NitroVerifyPurchaseWithIapkitAmazonProps(std::optional<std::variant<nitro::NullType, std::string>> expectedProductId, std::string receiptId, std::optional<std::variant<nitro::NullType, bool>> sandbox, std::optional<std::variant<nitro::NullType, std::string>> userId): expectedProductId(expectedProductId), receiptId(receiptId), sandbox(sandbox), userId(userId) {}
|
|
52
53
|
|
|
53
54
|
public:
|
|
54
55
|
friend bool operator==(const NitroVerifyPurchaseWithIapkitAmazonProps& lhs, const NitroVerifyPurchaseWithIapkitAmazonProps& rhs) = default;
|
|
@@ -64,6 +65,7 @@ namespace margelo::nitro {
|
|
|
64
65
|
static inline margelo::nitro::iap::NitroVerifyPurchaseWithIapkitAmazonProps fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
65
66
|
jsi::Object obj = arg.asObject(runtime);
|
|
66
67
|
return margelo::nitro::iap::NitroVerifyPurchaseWithIapkitAmazonProps(
|
|
68
|
+
JSIConverter<std::optional<std::variant<nitro::NullType, std::string>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "expectedProductId"))),
|
|
67
69
|
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "receiptId"))),
|
|
68
70
|
JSIConverter<std::optional<std::variant<nitro::NullType, bool>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "sandbox"))),
|
|
69
71
|
JSIConverter<std::optional<std::variant<nitro::NullType, std::string>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "userId")))
|
|
@@ -71,6 +73,7 @@ namespace margelo::nitro {
|
|
|
71
73
|
}
|
|
72
74
|
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::iap::NitroVerifyPurchaseWithIapkitAmazonProps& arg) {
|
|
73
75
|
jsi::Object obj(runtime);
|
|
76
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "expectedProductId"), JSIConverter<std::optional<std::variant<nitro::NullType, std::string>>>::toJSI(runtime, arg.expectedProductId));
|
|
74
77
|
obj.setProperty(runtime, PropNameIDCache::get(runtime, "receiptId"), JSIConverter<std::string>::toJSI(runtime, arg.receiptId));
|
|
75
78
|
obj.setProperty(runtime, PropNameIDCache::get(runtime, "sandbox"), JSIConverter<std::optional<std::variant<nitro::NullType, bool>>>::toJSI(runtime, arg.sandbox));
|
|
76
79
|
obj.setProperty(runtime, PropNameIDCache::get(runtime, "userId"), JSIConverter<std::optional<std::variant<nitro::NullType, std::string>>>::toJSI(runtime, arg.userId));
|
|
@@ -84,6 +87,7 @@ namespace margelo::nitro {
|
|
|
84
87
|
if (!nitro::isPlainObject(runtime, obj)) {
|
|
85
88
|
return false;
|
|
86
89
|
}
|
|
90
|
+
if (!JSIConverter<std::optional<std::variant<nitro::NullType, std::string>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "expectedProductId")))) return false;
|
|
87
91
|
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "receiptId")))) return false;
|
|
88
92
|
if (!JSIConverter<std::optional<std::variant<nitro::NullType, bool>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "sandbox")))) return false;
|
|
89
93
|
if (!JSIConverter<std::optional<std::variant<nitro::NullType, std::string>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "userId")))) return false;
|