react-native-iap 14.4.45 → 14.4.47
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/NitroIap.podspec +2 -2
- package/android/src/main/java/com/margelo/nitro/iap/HybridRnIap.kt +113 -3
- package/ios/HybridRnIap.swift +61 -2
- package/lib/module/hooks/useIAP.js +9 -1
- package/lib/module/hooks/useIAP.js.map +1 -1
- package/lib/module/index.js +68 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/types.js +5 -0
- package/lib/module/types.js.map +1 -1
- package/lib/module/utils/errorMapping.js +32 -6
- package/lib/module/utils/errorMapping.js.map +1 -1
- package/lib/typescript/src/hooks/useIAP.d.ts +5 -1
- package/lib/typescript/src/hooks/useIAP.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +34 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/specs/RnIap.nitro.d.ts +72 -26
- package/lib/typescript/src/specs/RnIap.nitro.d.ts.map +1 -1
- package/lib/typescript/src/types.d.ts +109 -51
- package/lib/typescript/src/types.d.ts.map +1 -1
- package/lib/typescript/src/utils/errorMapping.d.ts.map +1 -1
- package/nitrogen/generated/android/c++/JHybridRnIapSpec.cpp +76 -0
- package/nitrogen/generated/android/c++/JHybridRnIapSpec.hpp +2 -0
- package/nitrogen/generated/android/c++/JIapkitPurchaseState.hpp +80 -0
- package/nitrogen/generated/android/c++/JIapkitStore.hpp +59 -0
- package/nitrogen/generated/android/c++/JNitroVerifyPurchaseWithIapkitAppleProps.hpp +57 -0
- package/nitrogen/generated/android/c++/JNitroVerifyPurchaseWithIapkitGoogleProps.hpp +57 -0
- package/nitrogen/generated/android/c++/JNitroVerifyPurchaseWithIapkitProps.hpp +70 -0
- package/nitrogen/generated/android/c++/JNitroVerifyPurchaseWithIapkitResult.hpp +68 -0
- package/nitrogen/generated/android/c++/JNitroVerifyPurchaseWithProviderProps.hpp +70 -0
- package/nitrogen/generated/android/c++/JNitroVerifyPurchaseWithProviderResult.hpp +86 -0
- package/nitrogen/generated/android/c++/JPurchaseVerificationProvider.hpp +59 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/HybridRnIapSpec.kt +8 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/IapkitPurchaseState.kt +28 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/IapkitStore.kt +21 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroVerifyPurchaseWithIapkitAppleProps.kt +36 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroVerifyPurchaseWithIapkitGoogleProps.kt +36 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroVerifyPurchaseWithIapkitProps.kt +42 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroVerifyPurchaseWithIapkitResult.kt +42 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroVerifyPurchaseWithProviderProps.kt +39 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroVerifyPurchaseWithProviderResult.kt +39 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/PurchaseVerificationProvider.kt +21 -0
- package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Bridge.cpp +8 -0
- package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Bridge.hpp +123 -0
- package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Umbrella.hpp +27 -0
- package/nitrogen/generated/ios/c++/HybridRnIapSpecSwift.hpp +43 -0
- package/nitrogen/generated/ios/swift/Func_void_NitroVerifyPurchaseWithProviderResult.swift +47 -0
- package/nitrogen/generated/ios/swift/HybridRnIapSpec.swift +2 -0
- package/nitrogen/generated/ios/swift/HybridRnIapSpec_cxx.swift +45 -0
- package/nitrogen/generated/ios/swift/IapkitPurchaseState.swift +68 -0
- package/nitrogen/generated/ios/swift/IapkitStore.swift +40 -0
- package/nitrogen/generated/ios/swift/NitroVerifyPurchaseWithIapkitAppleProps.swift +35 -0
- package/nitrogen/generated/ios/swift/NitroVerifyPurchaseWithIapkitGoogleProps.swift +35 -0
- package/nitrogen/generated/ios/swift/NitroVerifyPurchaseWithIapkitProps.swift +100 -0
- package/nitrogen/generated/ios/swift/NitroVerifyPurchaseWithIapkitResult.swift +57 -0
- package/nitrogen/generated/ios/swift/NitroVerifyPurchaseWithProviderProps.swift +58 -0
- package/nitrogen/generated/ios/swift/NitroVerifyPurchaseWithProviderResult.swift +58 -0
- package/nitrogen/generated/ios/swift/PurchaseVerificationProvider.swift +40 -0
- package/nitrogen/generated/shared/c++/HybridRnIapSpec.cpp +2 -0
- package/nitrogen/generated/shared/c++/HybridRnIapSpec.hpp +8 -0
- package/nitrogen/generated/shared/c++/IapkitPurchaseState.hpp +104 -0
- package/nitrogen/generated/shared/c++/IapkitStore.hpp +76 -0
- package/nitrogen/generated/shared/c++/NitroVerifyPurchaseWithIapkitAppleProps.hpp +75 -0
- package/nitrogen/generated/shared/c++/NitroVerifyPurchaseWithIapkitGoogleProps.hpp +75 -0
- package/nitrogen/generated/shared/c++/NitroVerifyPurchaseWithIapkitProps.hpp +89 -0
- package/nitrogen/generated/shared/c++/NitroVerifyPurchaseWithIapkitResult.hpp +87 -0
- package/nitrogen/generated/shared/c++/NitroVerifyPurchaseWithProviderProps.hpp +84 -0
- package/nitrogen/generated/shared/c++/NitroVerifyPurchaseWithProviderResult.hpp +84 -0
- package/nitrogen/generated/shared/c++/PurchaseVerificationProvider.hpp +76 -0
- package/openiap-versions.json +3 -3
- package/package.json +1 -1
- package/src/hooks/useIAP.ts +32 -0
- package/src/index.ts +74 -5
- package/src/specs/RnIap.nitro.ts +101 -28
- package/src/types.ts +126 -57
- package/src/utils/errorMapping.ts +32 -4
|
@@ -41,6 +41,16 @@ namespace margelo::nitro::iap { struct NitroSubscriptionRenewalInfo; }
|
|
|
41
41
|
namespace margelo::nitro::iap { struct NitroReceiptValidationResultIOS; }
|
|
42
42
|
// Forward declaration of `NitroReceiptValidationResultAndroid` to properly resolve imports.
|
|
43
43
|
namespace margelo::nitro::iap { struct NitroReceiptValidationResultAndroid; }
|
|
44
|
+
// Forward declaration of `NitroVerifyPurchaseWithProviderResult` to properly resolve imports.
|
|
45
|
+
namespace margelo::nitro::iap { struct NitroVerifyPurchaseWithProviderResult; }
|
|
46
|
+
// Forward declaration of `NitroVerifyPurchaseWithIapkitResult` to properly resolve imports.
|
|
47
|
+
namespace margelo::nitro::iap { struct NitroVerifyPurchaseWithIapkitResult; }
|
|
48
|
+
// Forward declaration of `IapkitPurchaseState` to properly resolve imports.
|
|
49
|
+
namespace margelo::nitro::iap { enum class IapkitPurchaseState; }
|
|
50
|
+
// Forward declaration of `IapkitStore` to properly resolve imports.
|
|
51
|
+
namespace margelo::nitro::iap { enum class IapkitStore; }
|
|
52
|
+
// Forward declaration of `PurchaseVerificationProvider` to properly resolve imports.
|
|
53
|
+
namespace margelo::nitro::iap { enum class PurchaseVerificationProvider; }
|
|
44
54
|
// Forward declaration of `ExternalPurchaseNoticeResultIOS` to properly resolve imports.
|
|
45
55
|
namespace margelo::nitro::iap { struct ExternalPurchaseNoticeResultIOS; }
|
|
46
56
|
// Forward declaration of `ExternalPurchaseNoticeAction` to properly resolve imports.
|
|
@@ -77,6 +87,14 @@ namespace margelo::nitro::iap { struct NitroFinishTransactionAndroidParams; }
|
|
|
77
87
|
namespace margelo::nitro::iap { struct NitroReceiptValidationParams; }
|
|
78
88
|
// Forward declaration of `NitroReceiptValidationAndroidOptions` to properly resolve imports.
|
|
79
89
|
namespace margelo::nitro::iap { struct NitroReceiptValidationAndroidOptions; }
|
|
90
|
+
// Forward declaration of `NitroVerifyPurchaseWithProviderProps` to properly resolve imports.
|
|
91
|
+
namespace margelo::nitro::iap { struct NitroVerifyPurchaseWithProviderProps; }
|
|
92
|
+
// Forward declaration of `NitroVerifyPurchaseWithIapkitProps` to properly resolve imports.
|
|
93
|
+
namespace margelo::nitro::iap { struct NitroVerifyPurchaseWithIapkitProps; }
|
|
94
|
+
// Forward declaration of `NitroVerifyPurchaseWithIapkitAppleProps` to properly resolve imports.
|
|
95
|
+
namespace margelo::nitro::iap { struct NitroVerifyPurchaseWithIapkitAppleProps; }
|
|
96
|
+
// Forward declaration of `NitroVerifyPurchaseWithIapkitGoogleProps` to properly resolve imports.
|
|
97
|
+
namespace margelo::nitro::iap { struct NitroVerifyPurchaseWithIapkitGoogleProps; }
|
|
80
98
|
// Forward declaration of `NitroDeepLinkOptionsAndroid` to properly resolve imports.
|
|
81
99
|
namespace margelo::nitro::iap { struct NitroDeepLinkOptionsAndroid; }
|
|
82
100
|
// Forward declaration of `UserChoiceBillingDetails` to properly resolve imports.
|
|
@@ -126,6 +144,16 @@ namespace margelo::nitro::iap { struct UserChoiceBillingDetails; }
|
|
|
126
144
|
#include "JVariant_NitroReceiptValidationResultIOS_NitroReceiptValidationResultAndroid.hpp"
|
|
127
145
|
#include "JNitroReceiptValidationResultIOS.hpp"
|
|
128
146
|
#include "JNitroReceiptValidationResultAndroid.hpp"
|
|
147
|
+
#include "NitroVerifyPurchaseWithProviderResult.hpp"
|
|
148
|
+
#include "JNitroVerifyPurchaseWithProviderResult.hpp"
|
|
149
|
+
#include "NitroVerifyPurchaseWithIapkitResult.hpp"
|
|
150
|
+
#include "JNitroVerifyPurchaseWithIapkitResult.hpp"
|
|
151
|
+
#include "IapkitPurchaseState.hpp"
|
|
152
|
+
#include "JIapkitPurchaseState.hpp"
|
|
153
|
+
#include "IapkitStore.hpp"
|
|
154
|
+
#include "JIapkitStore.hpp"
|
|
155
|
+
#include "PurchaseVerificationProvider.hpp"
|
|
156
|
+
#include "JPurchaseVerificationProvider.hpp"
|
|
129
157
|
#include "ExternalPurchaseNoticeResultIOS.hpp"
|
|
130
158
|
#include "JExternalPurchaseNoticeResultIOS.hpp"
|
|
131
159
|
#include "ExternalPurchaseNoticeAction.hpp"
|
|
@@ -167,6 +195,14 @@ namespace margelo::nitro::iap { struct UserChoiceBillingDetails; }
|
|
|
167
195
|
#include "JNitroReceiptValidationParams.hpp"
|
|
168
196
|
#include "NitroReceiptValidationAndroidOptions.hpp"
|
|
169
197
|
#include "JNitroReceiptValidationAndroidOptions.hpp"
|
|
198
|
+
#include "NitroVerifyPurchaseWithProviderProps.hpp"
|
|
199
|
+
#include "JNitroVerifyPurchaseWithProviderProps.hpp"
|
|
200
|
+
#include "NitroVerifyPurchaseWithIapkitProps.hpp"
|
|
201
|
+
#include "JNitroVerifyPurchaseWithIapkitProps.hpp"
|
|
202
|
+
#include "NitroVerifyPurchaseWithIapkitAppleProps.hpp"
|
|
203
|
+
#include "JNitroVerifyPurchaseWithIapkitAppleProps.hpp"
|
|
204
|
+
#include "NitroVerifyPurchaseWithIapkitGoogleProps.hpp"
|
|
205
|
+
#include "JNitroVerifyPurchaseWithIapkitGoogleProps.hpp"
|
|
170
206
|
#include "NitroDeepLinkOptionsAndroid.hpp"
|
|
171
207
|
#include "JNitroDeepLinkOptionsAndroid.hpp"
|
|
172
208
|
#include "UserChoiceBillingDetails.hpp"
|
|
@@ -338,6 +374,30 @@ namespace margelo::nitro::iap {
|
|
|
338
374
|
return __promise;
|
|
339
375
|
}();
|
|
340
376
|
}
|
|
377
|
+
std::shared_ptr<Promise<bool>> JHybridRnIapSpec::hasActiveSubscriptions(const std::optional<std::vector<std::string>>& subscriptionIds) {
|
|
378
|
+
static const auto method = javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>(jni::alias_ref<jni::JArrayClass<jni::JString>> /* subscriptionIds */)>("hasActiveSubscriptions");
|
|
379
|
+
auto __result = method(_javaPart, subscriptionIds.has_value() ? [&]() {
|
|
380
|
+
size_t __size = subscriptionIds.value().size();
|
|
381
|
+
jni::local_ref<jni::JArrayClass<jni::JString>> __array = jni::JArrayClass<jni::JString>::newArray(__size);
|
|
382
|
+
for (size_t __i = 0; __i < __size; __i++) {
|
|
383
|
+
const auto& __element = subscriptionIds.value()[__i];
|
|
384
|
+
__array->setElement(__i, *jni::make_jstring(__element));
|
|
385
|
+
}
|
|
386
|
+
return __array;
|
|
387
|
+
}() : nullptr);
|
|
388
|
+
return [&]() {
|
|
389
|
+
auto __promise = Promise<bool>::create();
|
|
390
|
+
__result->cthis()->addOnResolvedListener([=](const jni::alias_ref<jni::JObject>& __boxedResult) {
|
|
391
|
+
auto __result = jni::static_ref_cast<jni::JBoolean>(__boxedResult);
|
|
392
|
+
__promise->resolve(static_cast<bool>(__result->value()));
|
|
393
|
+
});
|
|
394
|
+
__result->cthis()->addOnRejectedListener([=](const jni::alias_ref<jni::JThrowable>& __throwable) {
|
|
395
|
+
jni::JniException __jniError(__throwable);
|
|
396
|
+
__promise->reject(std::make_exception_ptr(__jniError));
|
|
397
|
+
});
|
|
398
|
+
return __promise;
|
|
399
|
+
}();
|
|
400
|
+
}
|
|
341
401
|
std::shared_ptr<Promise<std::variant<bool, NitroPurchaseResult>>> JHybridRnIapSpec::finishTransaction(const NitroFinishTransactionParams& params) {
|
|
342
402
|
static const auto method = javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>(jni::alias_ref<JNitroFinishTransactionParams> /* params */)>("finishTransaction");
|
|
343
403
|
auto __result = method(_javaPart, JNitroFinishTransactionParams::fromCpp(params));
|
|
@@ -755,6 +815,22 @@ namespace margelo::nitro::iap {
|
|
|
755
815
|
return __promise;
|
|
756
816
|
}();
|
|
757
817
|
}
|
|
818
|
+
std::shared_ptr<Promise<NitroVerifyPurchaseWithProviderResult>> JHybridRnIapSpec::verifyPurchaseWithProvider(const NitroVerifyPurchaseWithProviderProps& params) {
|
|
819
|
+
static const auto method = javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>(jni::alias_ref<JNitroVerifyPurchaseWithProviderProps> /* params */)>("verifyPurchaseWithProvider");
|
|
820
|
+
auto __result = method(_javaPart, JNitroVerifyPurchaseWithProviderProps::fromCpp(params));
|
|
821
|
+
return [&]() {
|
|
822
|
+
auto __promise = Promise<NitroVerifyPurchaseWithProviderResult>::create();
|
|
823
|
+
__result->cthis()->addOnResolvedListener([=](const jni::alias_ref<jni::JObject>& __boxedResult) {
|
|
824
|
+
auto __result = jni::static_ref_cast<JNitroVerifyPurchaseWithProviderResult>(__boxedResult);
|
|
825
|
+
__promise->resolve(__result->toCpp());
|
|
826
|
+
});
|
|
827
|
+
__result->cthis()->addOnRejectedListener([=](const jni::alias_ref<jni::JThrowable>& __throwable) {
|
|
828
|
+
jni::JniException __jniError(__throwable);
|
|
829
|
+
__promise->reject(std::make_exception_ptr(__jniError));
|
|
830
|
+
});
|
|
831
|
+
return __promise;
|
|
832
|
+
}();
|
|
833
|
+
}
|
|
758
834
|
std::shared_ptr<Promise<std::string>> JHybridRnIapSpec::getStorefront() {
|
|
759
835
|
static const auto method = javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>()>("getStorefront");
|
|
760
836
|
auto __result = method(_javaPart);
|
|
@@ -59,6 +59,7 @@ namespace margelo::nitro::iap {
|
|
|
59
59
|
std::shared_ptr<Promise<std::optional<std::variant<PurchaseAndroid, PurchaseIOS, std::vector<std::variant<PurchaseAndroid, PurchaseIOS>>>>>> requestPurchase(const NitroPurchaseRequest& request) override;
|
|
60
60
|
std::shared_ptr<Promise<std::vector<NitroPurchase>>> getAvailablePurchases(const std::optional<NitroAvailablePurchasesOptions>& options) override;
|
|
61
61
|
std::shared_ptr<Promise<std::vector<NitroActiveSubscription>>> getActiveSubscriptions(const std::optional<std::vector<std::string>>& subscriptionIds) override;
|
|
62
|
+
std::shared_ptr<Promise<bool>> hasActiveSubscriptions(const std::optional<std::vector<std::string>>& subscriptionIds) override;
|
|
62
63
|
std::shared_ptr<Promise<std::variant<bool, NitroPurchaseResult>>> finishTransaction(const NitroFinishTransactionParams& params) override;
|
|
63
64
|
void addPurchaseUpdatedListener(const std::function<void(const NitroPurchase& /* purchase */)>& listener) override;
|
|
64
65
|
void addPurchaseErrorListener(const std::function<void(const NitroPurchaseResult& /* error */)>& listener) override;
|
|
@@ -88,6 +89,7 @@ namespace margelo::nitro::iap {
|
|
|
88
89
|
std::shared_ptr<Promise<bool>> isTransactionVerifiedIOS(const std::string& sku) override;
|
|
89
90
|
std::shared_ptr<Promise<std::optional<std::string>>> getTransactionJwsIOS(const std::string& sku) override;
|
|
90
91
|
std::shared_ptr<Promise<std::variant<NitroReceiptValidationResultIOS, NitroReceiptValidationResultAndroid>>> validateReceipt(const NitroReceiptValidationParams& params) override;
|
|
92
|
+
std::shared_ptr<Promise<NitroVerifyPurchaseWithProviderResult>> verifyPurchaseWithProvider(const NitroVerifyPurchaseWithProviderProps& params) override;
|
|
91
93
|
std::shared_ptr<Promise<std::string>> getStorefront() override;
|
|
92
94
|
std::shared_ptr<Promise<void>> deepLinkToSubscriptionsAndroid(const NitroDeepLinkOptionsAndroid& options) override;
|
|
93
95
|
std::shared_ptr<Promise<bool>> checkAlternativeBillingAvailabilityAndroid() override;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JIapkitPurchaseState.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
|
+
#include <fbjni/fbjni.h>
|
|
11
|
+
#include "IapkitPurchaseState.hpp"
|
|
12
|
+
|
|
13
|
+
namespace margelo::nitro::iap {
|
|
14
|
+
|
|
15
|
+
using namespace facebook;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* The C++ JNI bridge between the C++ enum "IapkitPurchaseState" and the the Kotlin enum "IapkitPurchaseState".
|
|
19
|
+
*/
|
|
20
|
+
struct JIapkitPurchaseState final: public jni::JavaClass<JIapkitPurchaseState> {
|
|
21
|
+
public:
|
|
22
|
+
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/iap/IapkitPurchaseState;";
|
|
23
|
+
|
|
24
|
+
public:
|
|
25
|
+
/**
|
|
26
|
+
* Convert this Java/Kotlin-based enum to the C++ enum IapkitPurchaseState.
|
|
27
|
+
*/
|
|
28
|
+
[[maybe_unused]]
|
|
29
|
+
[[nodiscard]]
|
|
30
|
+
IapkitPurchaseState toCpp() const {
|
|
31
|
+
static const auto clazz = javaClassStatic();
|
|
32
|
+
static const auto fieldOrdinal = clazz->getField<int>("value");
|
|
33
|
+
int ordinal = this->getFieldValue(fieldOrdinal);
|
|
34
|
+
return static_cast<IapkitPurchaseState>(ordinal);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
public:
|
|
38
|
+
/**
|
|
39
|
+
* Create a Java/Kotlin-based enum with the given C++ enum's value.
|
|
40
|
+
*/
|
|
41
|
+
[[maybe_unused]]
|
|
42
|
+
static jni::alias_ref<JIapkitPurchaseState> fromCpp(IapkitPurchaseState value) {
|
|
43
|
+
static const auto clazz = javaClassStatic();
|
|
44
|
+
static const auto fieldPENDING = clazz->getStaticField<JIapkitPurchaseState>("PENDING");
|
|
45
|
+
static const auto fieldUNKNOWN = clazz->getStaticField<JIapkitPurchaseState>("UNKNOWN");
|
|
46
|
+
static const auto fieldENTITLED = clazz->getStaticField<JIapkitPurchaseState>("ENTITLED");
|
|
47
|
+
static const auto fieldPENDING_ACKNOWLEDGMENT = clazz->getStaticField<JIapkitPurchaseState>("PENDING_ACKNOWLEDGMENT");
|
|
48
|
+
static const auto fieldCANCELED = clazz->getStaticField<JIapkitPurchaseState>("CANCELED");
|
|
49
|
+
static const auto fieldEXPIRED = clazz->getStaticField<JIapkitPurchaseState>("EXPIRED");
|
|
50
|
+
static const auto fieldREADY_TO_CONSUME = clazz->getStaticField<JIapkitPurchaseState>("READY_TO_CONSUME");
|
|
51
|
+
static const auto fieldCONSUMED = clazz->getStaticField<JIapkitPurchaseState>("CONSUMED");
|
|
52
|
+
static const auto fieldINAUTHENTIC = clazz->getStaticField<JIapkitPurchaseState>("INAUTHENTIC");
|
|
53
|
+
|
|
54
|
+
switch (value) {
|
|
55
|
+
case IapkitPurchaseState::PENDING:
|
|
56
|
+
return clazz->getStaticFieldValue(fieldPENDING);
|
|
57
|
+
case IapkitPurchaseState::UNKNOWN:
|
|
58
|
+
return clazz->getStaticFieldValue(fieldUNKNOWN);
|
|
59
|
+
case IapkitPurchaseState::ENTITLED:
|
|
60
|
+
return clazz->getStaticFieldValue(fieldENTITLED);
|
|
61
|
+
case IapkitPurchaseState::PENDING_ACKNOWLEDGMENT:
|
|
62
|
+
return clazz->getStaticFieldValue(fieldPENDING_ACKNOWLEDGMENT);
|
|
63
|
+
case IapkitPurchaseState::CANCELED:
|
|
64
|
+
return clazz->getStaticFieldValue(fieldCANCELED);
|
|
65
|
+
case IapkitPurchaseState::EXPIRED:
|
|
66
|
+
return clazz->getStaticFieldValue(fieldEXPIRED);
|
|
67
|
+
case IapkitPurchaseState::READY_TO_CONSUME:
|
|
68
|
+
return clazz->getStaticFieldValue(fieldREADY_TO_CONSUME);
|
|
69
|
+
case IapkitPurchaseState::CONSUMED:
|
|
70
|
+
return clazz->getStaticFieldValue(fieldCONSUMED);
|
|
71
|
+
case IapkitPurchaseState::INAUTHENTIC:
|
|
72
|
+
return clazz->getStaticFieldValue(fieldINAUTHENTIC);
|
|
73
|
+
default:
|
|
74
|
+
std::string stringValue = std::to_string(static_cast<int>(value));
|
|
75
|
+
throw std::invalid_argument("Invalid enum value (" + stringValue + "!");
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
} // namespace margelo::nitro::iap
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JIapkitStore.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
|
+
#include <fbjni/fbjni.h>
|
|
11
|
+
#include "IapkitStore.hpp"
|
|
12
|
+
|
|
13
|
+
namespace margelo::nitro::iap {
|
|
14
|
+
|
|
15
|
+
using namespace facebook;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* The C++ JNI bridge between the C++ enum "IapkitStore" and the the Kotlin enum "IapkitStore".
|
|
19
|
+
*/
|
|
20
|
+
struct JIapkitStore final: public jni::JavaClass<JIapkitStore> {
|
|
21
|
+
public:
|
|
22
|
+
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/iap/IapkitStore;";
|
|
23
|
+
|
|
24
|
+
public:
|
|
25
|
+
/**
|
|
26
|
+
* Convert this Java/Kotlin-based enum to the C++ enum IapkitStore.
|
|
27
|
+
*/
|
|
28
|
+
[[maybe_unused]]
|
|
29
|
+
[[nodiscard]]
|
|
30
|
+
IapkitStore toCpp() const {
|
|
31
|
+
static const auto clazz = javaClassStatic();
|
|
32
|
+
static const auto fieldOrdinal = clazz->getField<int>("value");
|
|
33
|
+
int ordinal = this->getFieldValue(fieldOrdinal);
|
|
34
|
+
return static_cast<IapkitStore>(ordinal);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
public:
|
|
38
|
+
/**
|
|
39
|
+
* Create a Java/Kotlin-based enum with the given C++ enum's value.
|
|
40
|
+
*/
|
|
41
|
+
[[maybe_unused]]
|
|
42
|
+
static jni::alias_ref<JIapkitStore> fromCpp(IapkitStore value) {
|
|
43
|
+
static const auto clazz = javaClassStatic();
|
|
44
|
+
static const auto fieldAPPLE = clazz->getStaticField<JIapkitStore>("APPLE");
|
|
45
|
+
static const auto fieldGOOGLE = clazz->getStaticField<JIapkitStore>("GOOGLE");
|
|
46
|
+
|
|
47
|
+
switch (value) {
|
|
48
|
+
case IapkitStore::APPLE:
|
|
49
|
+
return clazz->getStaticFieldValue(fieldAPPLE);
|
|
50
|
+
case IapkitStore::GOOGLE:
|
|
51
|
+
return clazz->getStaticFieldValue(fieldGOOGLE);
|
|
52
|
+
default:
|
|
53
|
+
std::string stringValue = std::to_string(static_cast<int>(value));
|
|
54
|
+
throw std::invalid_argument("Invalid enum value (" + stringValue + "!");
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
} // namespace margelo::nitro::iap
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JNitroVerifyPurchaseWithIapkitAppleProps.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
|
+
#include <fbjni/fbjni.h>
|
|
11
|
+
#include "NitroVerifyPurchaseWithIapkitAppleProps.hpp"
|
|
12
|
+
|
|
13
|
+
#include <string>
|
|
14
|
+
|
|
15
|
+
namespace margelo::nitro::iap {
|
|
16
|
+
|
|
17
|
+
using namespace facebook;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* The C++ JNI bridge between the C++ struct "NitroVerifyPurchaseWithIapkitAppleProps" and the the Kotlin data class "NitroVerifyPurchaseWithIapkitAppleProps".
|
|
21
|
+
*/
|
|
22
|
+
struct JNitroVerifyPurchaseWithIapkitAppleProps final: public jni::JavaClass<JNitroVerifyPurchaseWithIapkitAppleProps> {
|
|
23
|
+
public:
|
|
24
|
+
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/iap/NitroVerifyPurchaseWithIapkitAppleProps;";
|
|
25
|
+
|
|
26
|
+
public:
|
|
27
|
+
/**
|
|
28
|
+
* Convert this Java/Kotlin-based struct to the C++ struct NitroVerifyPurchaseWithIapkitAppleProps by copying all values to C++.
|
|
29
|
+
*/
|
|
30
|
+
[[maybe_unused]]
|
|
31
|
+
[[nodiscard]]
|
|
32
|
+
NitroVerifyPurchaseWithIapkitAppleProps toCpp() const {
|
|
33
|
+
static const auto clazz = javaClassStatic();
|
|
34
|
+
static const auto fieldJws = clazz->getField<jni::JString>("jws");
|
|
35
|
+
jni::local_ref<jni::JString> jws = this->getFieldValue(fieldJws);
|
|
36
|
+
return NitroVerifyPurchaseWithIapkitAppleProps(
|
|
37
|
+
jws->toStdString()
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
public:
|
|
42
|
+
/**
|
|
43
|
+
* Create a Java/Kotlin-based struct by copying all values from the given C++ struct to Java.
|
|
44
|
+
*/
|
|
45
|
+
[[maybe_unused]]
|
|
46
|
+
static jni::local_ref<JNitroVerifyPurchaseWithIapkitAppleProps::javaobject> fromCpp(const NitroVerifyPurchaseWithIapkitAppleProps& value) {
|
|
47
|
+
using JSignature = JNitroVerifyPurchaseWithIapkitAppleProps(jni::alias_ref<jni::JString>);
|
|
48
|
+
static const auto clazz = javaClassStatic();
|
|
49
|
+
static const auto create = clazz->getStaticMethod<JSignature>("fromCpp");
|
|
50
|
+
return create(
|
|
51
|
+
clazz,
|
|
52
|
+
jni::make_jstring(value.jws)
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
} // namespace margelo::nitro::iap
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JNitroVerifyPurchaseWithIapkitGoogleProps.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
|
+
#include <fbjni/fbjni.h>
|
|
11
|
+
#include "NitroVerifyPurchaseWithIapkitGoogleProps.hpp"
|
|
12
|
+
|
|
13
|
+
#include <string>
|
|
14
|
+
|
|
15
|
+
namespace margelo::nitro::iap {
|
|
16
|
+
|
|
17
|
+
using namespace facebook;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* The C++ JNI bridge between the C++ struct "NitroVerifyPurchaseWithIapkitGoogleProps" and the the Kotlin data class "NitroVerifyPurchaseWithIapkitGoogleProps".
|
|
21
|
+
*/
|
|
22
|
+
struct JNitroVerifyPurchaseWithIapkitGoogleProps final: public jni::JavaClass<JNitroVerifyPurchaseWithIapkitGoogleProps> {
|
|
23
|
+
public:
|
|
24
|
+
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/iap/NitroVerifyPurchaseWithIapkitGoogleProps;";
|
|
25
|
+
|
|
26
|
+
public:
|
|
27
|
+
/**
|
|
28
|
+
* Convert this Java/Kotlin-based struct to the C++ struct NitroVerifyPurchaseWithIapkitGoogleProps by copying all values to C++.
|
|
29
|
+
*/
|
|
30
|
+
[[maybe_unused]]
|
|
31
|
+
[[nodiscard]]
|
|
32
|
+
NitroVerifyPurchaseWithIapkitGoogleProps toCpp() const {
|
|
33
|
+
static const auto clazz = javaClassStatic();
|
|
34
|
+
static const auto fieldPurchaseToken = clazz->getField<jni::JString>("purchaseToken");
|
|
35
|
+
jni::local_ref<jni::JString> purchaseToken = this->getFieldValue(fieldPurchaseToken);
|
|
36
|
+
return NitroVerifyPurchaseWithIapkitGoogleProps(
|
|
37
|
+
purchaseToken->toStdString()
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
public:
|
|
42
|
+
/**
|
|
43
|
+
* Create a Java/Kotlin-based struct by copying all values from the given C++ struct to Java.
|
|
44
|
+
*/
|
|
45
|
+
[[maybe_unused]]
|
|
46
|
+
static jni::local_ref<JNitroVerifyPurchaseWithIapkitGoogleProps::javaobject> fromCpp(const NitroVerifyPurchaseWithIapkitGoogleProps& value) {
|
|
47
|
+
using JSignature = JNitroVerifyPurchaseWithIapkitGoogleProps(jni::alias_ref<jni::JString>);
|
|
48
|
+
static const auto clazz = javaClassStatic();
|
|
49
|
+
static const auto create = clazz->getStaticMethod<JSignature>("fromCpp");
|
|
50
|
+
return create(
|
|
51
|
+
clazz,
|
|
52
|
+
jni::make_jstring(value.purchaseToken)
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
} // namespace margelo::nitro::iap
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JNitroVerifyPurchaseWithIapkitProps.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
|
+
#include <fbjni/fbjni.h>
|
|
11
|
+
#include "NitroVerifyPurchaseWithIapkitProps.hpp"
|
|
12
|
+
|
|
13
|
+
#include "JNitroVerifyPurchaseWithIapkitAppleProps.hpp"
|
|
14
|
+
#include "JNitroVerifyPurchaseWithIapkitGoogleProps.hpp"
|
|
15
|
+
#include "NitroVerifyPurchaseWithIapkitAppleProps.hpp"
|
|
16
|
+
#include "NitroVerifyPurchaseWithIapkitGoogleProps.hpp"
|
|
17
|
+
#include <optional>
|
|
18
|
+
#include <string>
|
|
19
|
+
|
|
20
|
+
namespace margelo::nitro::iap {
|
|
21
|
+
|
|
22
|
+
using namespace facebook;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* The C++ JNI bridge between the C++ struct "NitroVerifyPurchaseWithIapkitProps" and the the Kotlin data class "NitroVerifyPurchaseWithIapkitProps".
|
|
26
|
+
*/
|
|
27
|
+
struct JNitroVerifyPurchaseWithIapkitProps final: public jni::JavaClass<JNitroVerifyPurchaseWithIapkitProps> {
|
|
28
|
+
public:
|
|
29
|
+
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/iap/NitroVerifyPurchaseWithIapkitProps;";
|
|
30
|
+
|
|
31
|
+
public:
|
|
32
|
+
/**
|
|
33
|
+
* Convert this Java/Kotlin-based struct to the C++ struct NitroVerifyPurchaseWithIapkitProps by copying all values to C++.
|
|
34
|
+
*/
|
|
35
|
+
[[maybe_unused]]
|
|
36
|
+
[[nodiscard]]
|
|
37
|
+
NitroVerifyPurchaseWithIapkitProps toCpp() const {
|
|
38
|
+
static const auto clazz = javaClassStatic();
|
|
39
|
+
static const auto fieldApiKey = clazz->getField<jni::JString>("apiKey");
|
|
40
|
+
jni::local_ref<jni::JString> apiKey = this->getFieldValue(fieldApiKey);
|
|
41
|
+
static const auto fieldApple = clazz->getField<JNitroVerifyPurchaseWithIapkitAppleProps>("apple");
|
|
42
|
+
jni::local_ref<JNitroVerifyPurchaseWithIapkitAppleProps> apple = this->getFieldValue(fieldApple);
|
|
43
|
+
static const auto fieldGoogle = clazz->getField<JNitroVerifyPurchaseWithIapkitGoogleProps>("google");
|
|
44
|
+
jni::local_ref<JNitroVerifyPurchaseWithIapkitGoogleProps> google = this->getFieldValue(fieldGoogle);
|
|
45
|
+
return NitroVerifyPurchaseWithIapkitProps(
|
|
46
|
+
apiKey != nullptr ? std::make_optional(apiKey->toStdString()) : std::nullopt,
|
|
47
|
+
apple != nullptr ? std::make_optional(apple->toCpp()) : std::nullopt,
|
|
48
|
+
google != nullptr ? std::make_optional(google->toCpp()) : std::nullopt
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
public:
|
|
53
|
+
/**
|
|
54
|
+
* Create a Java/Kotlin-based struct by copying all values from the given C++ struct to Java.
|
|
55
|
+
*/
|
|
56
|
+
[[maybe_unused]]
|
|
57
|
+
static jni::local_ref<JNitroVerifyPurchaseWithIapkitProps::javaobject> fromCpp(const NitroVerifyPurchaseWithIapkitProps& value) {
|
|
58
|
+
using JSignature = JNitroVerifyPurchaseWithIapkitProps(jni::alias_ref<jni::JString>, jni::alias_ref<JNitroVerifyPurchaseWithIapkitAppleProps>, jni::alias_ref<JNitroVerifyPurchaseWithIapkitGoogleProps>);
|
|
59
|
+
static const auto clazz = javaClassStatic();
|
|
60
|
+
static const auto create = clazz->getStaticMethod<JSignature>("fromCpp");
|
|
61
|
+
return create(
|
|
62
|
+
clazz,
|
|
63
|
+
value.apiKey.has_value() ? jni::make_jstring(value.apiKey.value()) : nullptr,
|
|
64
|
+
value.apple.has_value() ? JNitroVerifyPurchaseWithIapkitAppleProps::fromCpp(value.apple.value()) : nullptr,
|
|
65
|
+
value.google.has_value() ? JNitroVerifyPurchaseWithIapkitGoogleProps::fromCpp(value.google.value()) : nullptr
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
} // namespace margelo::nitro::iap
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JNitroVerifyPurchaseWithIapkitResult.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
|
+
#include <fbjni/fbjni.h>
|
|
11
|
+
#include "NitroVerifyPurchaseWithIapkitResult.hpp"
|
|
12
|
+
|
|
13
|
+
#include "IapkitPurchaseState.hpp"
|
|
14
|
+
#include "IapkitStore.hpp"
|
|
15
|
+
#include "JIapkitPurchaseState.hpp"
|
|
16
|
+
#include "JIapkitStore.hpp"
|
|
17
|
+
|
|
18
|
+
namespace margelo::nitro::iap {
|
|
19
|
+
|
|
20
|
+
using namespace facebook;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* The C++ JNI bridge between the C++ struct "NitroVerifyPurchaseWithIapkitResult" and the the Kotlin data class "NitroVerifyPurchaseWithIapkitResult".
|
|
24
|
+
*/
|
|
25
|
+
struct JNitroVerifyPurchaseWithIapkitResult final: public jni::JavaClass<JNitroVerifyPurchaseWithIapkitResult> {
|
|
26
|
+
public:
|
|
27
|
+
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/iap/NitroVerifyPurchaseWithIapkitResult;";
|
|
28
|
+
|
|
29
|
+
public:
|
|
30
|
+
/**
|
|
31
|
+
* Convert this Java/Kotlin-based struct to the C++ struct NitroVerifyPurchaseWithIapkitResult by copying all values to C++.
|
|
32
|
+
*/
|
|
33
|
+
[[maybe_unused]]
|
|
34
|
+
[[nodiscard]]
|
|
35
|
+
NitroVerifyPurchaseWithIapkitResult toCpp() const {
|
|
36
|
+
static const auto clazz = javaClassStatic();
|
|
37
|
+
static const auto fieldIsValid = clazz->getField<jboolean>("isValid");
|
|
38
|
+
jboolean isValid = this->getFieldValue(fieldIsValid);
|
|
39
|
+
static const auto fieldState = clazz->getField<JIapkitPurchaseState>("state");
|
|
40
|
+
jni::local_ref<JIapkitPurchaseState> state = this->getFieldValue(fieldState);
|
|
41
|
+
static const auto fieldStore = clazz->getField<JIapkitStore>("store");
|
|
42
|
+
jni::local_ref<JIapkitStore> store = this->getFieldValue(fieldStore);
|
|
43
|
+
return NitroVerifyPurchaseWithIapkitResult(
|
|
44
|
+
static_cast<bool>(isValid),
|
|
45
|
+
state->toCpp(),
|
|
46
|
+
store->toCpp()
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
public:
|
|
51
|
+
/**
|
|
52
|
+
* Create a Java/Kotlin-based struct by copying all values from the given C++ struct to Java.
|
|
53
|
+
*/
|
|
54
|
+
[[maybe_unused]]
|
|
55
|
+
static jni::local_ref<JNitroVerifyPurchaseWithIapkitResult::javaobject> fromCpp(const NitroVerifyPurchaseWithIapkitResult& value) {
|
|
56
|
+
using JSignature = JNitroVerifyPurchaseWithIapkitResult(jboolean, jni::alias_ref<JIapkitPurchaseState>, jni::alias_ref<JIapkitStore>);
|
|
57
|
+
static const auto clazz = javaClassStatic();
|
|
58
|
+
static const auto create = clazz->getStaticMethod<JSignature>("fromCpp");
|
|
59
|
+
return create(
|
|
60
|
+
clazz,
|
|
61
|
+
value.isValid,
|
|
62
|
+
JIapkitPurchaseState::fromCpp(value.state),
|
|
63
|
+
JIapkitStore::fromCpp(value.store)
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
} // namespace margelo::nitro::iap
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JNitroVerifyPurchaseWithProviderProps.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
|
+
#include <fbjni/fbjni.h>
|
|
11
|
+
#include "NitroVerifyPurchaseWithProviderProps.hpp"
|
|
12
|
+
|
|
13
|
+
#include "JNitroVerifyPurchaseWithIapkitAppleProps.hpp"
|
|
14
|
+
#include "JNitroVerifyPurchaseWithIapkitGoogleProps.hpp"
|
|
15
|
+
#include "JNitroVerifyPurchaseWithIapkitProps.hpp"
|
|
16
|
+
#include "JPurchaseVerificationProvider.hpp"
|
|
17
|
+
#include "NitroVerifyPurchaseWithIapkitAppleProps.hpp"
|
|
18
|
+
#include "NitroVerifyPurchaseWithIapkitGoogleProps.hpp"
|
|
19
|
+
#include "NitroVerifyPurchaseWithIapkitProps.hpp"
|
|
20
|
+
#include "PurchaseVerificationProvider.hpp"
|
|
21
|
+
#include <optional>
|
|
22
|
+
#include <string>
|
|
23
|
+
|
|
24
|
+
namespace margelo::nitro::iap {
|
|
25
|
+
|
|
26
|
+
using namespace facebook;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* The C++ JNI bridge between the C++ struct "NitroVerifyPurchaseWithProviderProps" and the the Kotlin data class "NitroVerifyPurchaseWithProviderProps".
|
|
30
|
+
*/
|
|
31
|
+
struct JNitroVerifyPurchaseWithProviderProps final: public jni::JavaClass<JNitroVerifyPurchaseWithProviderProps> {
|
|
32
|
+
public:
|
|
33
|
+
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/iap/NitroVerifyPurchaseWithProviderProps;";
|
|
34
|
+
|
|
35
|
+
public:
|
|
36
|
+
/**
|
|
37
|
+
* Convert this Java/Kotlin-based struct to the C++ struct NitroVerifyPurchaseWithProviderProps by copying all values to C++.
|
|
38
|
+
*/
|
|
39
|
+
[[maybe_unused]]
|
|
40
|
+
[[nodiscard]]
|
|
41
|
+
NitroVerifyPurchaseWithProviderProps toCpp() const {
|
|
42
|
+
static const auto clazz = javaClassStatic();
|
|
43
|
+
static const auto fieldIapkit = clazz->getField<JNitroVerifyPurchaseWithIapkitProps>("iapkit");
|
|
44
|
+
jni::local_ref<JNitroVerifyPurchaseWithIapkitProps> iapkit = this->getFieldValue(fieldIapkit);
|
|
45
|
+
static const auto fieldProvider = clazz->getField<JPurchaseVerificationProvider>("provider");
|
|
46
|
+
jni::local_ref<JPurchaseVerificationProvider> provider = this->getFieldValue(fieldProvider);
|
|
47
|
+
return NitroVerifyPurchaseWithProviderProps(
|
|
48
|
+
iapkit != nullptr ? std::make_optional(iapkit->toCpp()) : std::nullopt,
|
|
49
|
+
provider->toCpp()
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
public:
|
|
54
|
+
/**
|
|
55
|
+
* Create a Java/Kotlin-based struct by copying all values from the given C++ struct to Java.
|
|
56
|
+
*/
|
|
57
|
+
[[maybe_unused]]
|
|
58
|
+
static jni::local_ref<JNitroVerifyPurchaseWithProviderProps::javaobject> fromCpp(const NitroVerifyPurchaseWithProviderProps& value) {
|
|
59
|
+
using JSignature = JNitroVerifyPurchaseWithProviderProps(jni::alias_ref<JNitroVerifyPurchaseWithIapkitProps>, jni::alias_ref<JPurchaseVerificationProvider>);
|
|
60
|
+
static const auto clazz = javaClassStatic();
|
|
61
|
+
static const auto create = clazz->getStaticMethod<JSignature>("fromCpp");
|
|
62
|
+
return create(
|
|
63
|
+
clazz,
|
|
64
|
+
value.iapkit.has_value() ? JNitroVerifyPurchaseWithIapkitProps::fromCpp(value.iapkit.value()) : nullptr,
|
|
65
|
+
JPurchaseVerificationProvider::fromCpp(value.provider)
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
} // namespace margelo::nitro::iap
|