react-native-iap 14.3.5-rc.1 → 14.3.6

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.
Files changed (79) hide show
  1. package/NitroIap.podspec +1 -1
  2. package/README.md +1 -1
  3. package/android/CMakeLists.txt +4 -0
  4. package/android/build.gradle +2 -2
  5. package/android/src/main/cpp/cpp-adapter.cpp +8 -0
  6. package/android/src/main/java/com/margelo/nitro/iap/HybridRnIap.kt +93 -51
  7. package/ios/HybridRnIap.swift +38 -30
  8. package/lib/module/hooks/useIAP.js +6 -39
  9. package/lib/module/hooks/useIAP.js.map +1 -1
  10. package/lib/module/index.js +54 -55
  11. package/lib/module/index.js.map +1 -1
  12. package/lib/module/types.js +1 -1
  13. package/lib/module/utils/type-bridge.js.map +1 -1
  14. package/lib/typescript/src/hooks/useIAP.d.ts +4 -8
  15. package/lib/typescript/src/hooks/useIAP.d.ts.map +1 -1
  16. package/lib/typescript/src/index.d.ts +8 -7
  17. package/lib/typescript/src/index.d.ts.map +1 -1
  18. package/lib/typescript/src/specs/RnIap.nitro.d.ts +2 -1
  19. package/lib/typescript/src/specs/RnIap.nitro.d.ts.map +1 -1
  20. package/lib/typescript/src/types.d.ts +141 -146
  21. package/lib/typescript/src/types.d.ts.map +1 -1
  22. package/lib/typescript/src/utils/type-bridge.d.ts.map +1 -1
  23. package/nitrogen/generated/android/NitroIap+autolinking.cmake +9 -4
  24. package/nitrogen/generated/android/c++/JHybridRnIapSpec.cpp +32 -5
  25. package/nitrogen/generated/android/c++/JHybridRnIapSpec.hpp +1 -1
  26. package/nitrogen/generated/android/c++/JIapPlatform.hpp +59 -0
  27. package/nitrogen/generated/android/c++/JPurchase.cpp +26 -0
  28. package/nitrogen/generated/android/c++/JPurchase.hpp +80 -0
  29. package/nitrogen/generated/android/c++/JPurchaseAndroid.hpp +140 -0
  30. package/nitrogen/generated/android/c++/JPurchaseIOS.hpp +194 -0
  31. package/nitrogen/generated/android/c++/JPurchaseOfferIOS.hpp +61 -0
  32. package/nitrogen/generated/android/c++/JPurchaseState.hpp +71 -0
  33. package/nitrogen/generated/android/c++/JRequestPurchaseResult.hpp +89 -0
  34. package/nitrogen/generated/android/c++/JVariant_PurchaseAndroid_PurchaseIOS.cpp +26 -0
  35. package/nitrogen/generated/android/c++/JVariant_PurchaseAndroid_PurchaseIOS.hpp +80 -0
  36. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/HybridRnIapSpec.kt +1 -1
  37. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/IapPlatform.kt +21 -0
  38. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/Purchase.kt +42 -0
  39. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/PurchaseAndroid.kt +77 -0
  40. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/PurchaseIOS.kt +116 -0
  41. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/PurchaseOfferIOS.kt +35 -0
  42. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/PurchaseState.kt +25 -0
  43. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/RequestPurchaseResult.kt +32 -0
  44. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/Variant_PurchaseAndroid_PurchaseIOS.kt +42 -0
  45. package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Bridge.cpp +13 -5
  46. package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Bridge.hpp +186 -25
  47. package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Umbrella.hpp +18 -0
  48. package/nitrogen/generated/ios/c++/HybridRnIapSpecSwift.hpp +20 -2
  49. package/nitrogen/generated/ios/swift/Func_void_RequestPurchaseResult.swift +47 -0
  50. package/nitrogen/generated/ios/swift/HybridRnIapSpec.swift +1 -1
  51. package/nitrogen/generated/ios/swift/HybridRnIapSpec_cxx.swift +7 -7
  52. package/nitrogen/generated/ios/swift/IapPlatform.swift +40 -0
  53. package/nitrogen/generated/ios/swift/Purchase.swift +18 -0
  54. package/nitrogen/generated/ios/swift/PurchaseAndroid.swift +399 -0
  55. package/nitrogen/generated/ios/swift/PurchaseIOS.swift +768 -0
  56. package/nitrogen/generated/ios/swift/PurchaseOfferIOS.swift +57 -0
  57. package/nitrogen/generated/ios/swift/PurchaseState.swift +56 -0
  58. package/nitrogen/generated/ios/swift/RequestPurchaseResult.swift +148 -0
  59. package/nitrogen/generated/ios/swift/Variant_PurchaseAndroid_PurchaseIOS.swift +18 -0
  60. package/nitrogen/generated/shared/c++/HybridRnIapSpec.hpp +4 -1
  61. package/nitrogen/generated/shared/c++/IapPlatform.hpp +76 -0
  62. package/nitrogen/generated/shared/c++/PurchaseAndroid.hpp +138 -0
  63. package/nitrogen/generated/shared/c++/PurchaseIOS.hpp +193 -0
  64. package/nitrogen/generated/shared/c++/PurchaseOfferIOS.hpp +75 -0
  65. package/nitrogen/generated/shared/c++/PurchaseState.hpp +92 -0
  66. package/nitrogen/generated/shared/c++/RequestPurchaseResult.hpp +78 -0
  67. package/package.json +5 -4
  68. package/plugin/build/withIAP.js +1 -1
  69. package/plugin/src/withIAP.ts +1 -1
  70. package/plugin/tsconfig.tsbuildinfo +1 -1
  71. package/src/hooks/useIAP.ts +17 -59
  72. package/src/index.ts +73 -77
  73. package/src/specs/RnIap.nitro.ts +4 -1
  74. package/src/types.ts +168 -178
  75. package/src/utils/type-bridge.ts +3 -1
  76. package/lib/index.d.ts +0 -8
  77. package/lib/index.js +0 -36
  78. package/lib/specs/RnIap.nitro.d.ts +0 -7
  79. package/lib/specs/RnIap.nitro.js +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"type-bridge.d.ts","sourceRoot":"","sources":["../../../../src/utils/type-bridge.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACV,YAAY,EACZ,aAAa,EACb,uBAAuB,EACxB,MAAM,sBAAsB,CAAC;AAS9B,OAAO,KAAK,EACV,OAAO,EACP,mBAAmB,EACnB,QAAQ,EACR,qBAAqB,EACtB,MAAM,UAAU,CAAC;AA6JlB;;GAEG;AACH,wBAAgB,4BAA4B,CAC1C,YAAY,EAAE,YAAY,GACzB,OAAO,CAyET;AAED;;GAEG;AACH,wBAAgB,mCAAmC,CACjD,OAAO,EAAE,OAAO,GACf,mBAAmB,CAiBrB;AAED;;GAEG;AACH,wBAAgB,8BAA8B,CAC5C,aAAa,EAAE,aAAa,GAC3B,QAAQ,CA8DV;AAED;;GAEG;AACH,wBAAgB,qDAAqD,CACnE,KAAK,EAAE,uBAAuB,GAC7B,qBAAqB,CAavB;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,YAAY,EAAE,YAAY,GAAG,OAAO,CAoBxE;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,aAAa,EAAE,aAAa,GAAG,OAAO,CAoB3E;AAED;;GAEG;AACH,wBAAgB,wBAAwB,IAAI;IAC1C,MAAM,EAAE,OAAO,CAAC;IAChB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,CA2BA"}
1
+ {"version":3,"file":"type-bridge.d.ts","sourceRoot":"","sources":["../../../../src/utils/type-bridge.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACV,YAAY,EACZ,aAAa,EACb,uBAAuB,EACxB,MAAM,sBAAsB,CAAC;AAS9B,OAAO,KAAK,EACV,OAAO,EACP,mBAAmB,EACnB,QAAQ,EACR,qBAAqB,EACtB,MAAM,UAAU,CAAC;AA+JlB;;GAEG;AACH,wBAAgB,4BAA4B,CAC1C,YAAY,EAAE,YAAY,GACzB,OAAO,CAyET;AAED;;GAEG;AACH,wBAAgB,mCAAmC,CACjD,OAAO,EAAE,OAAO,GACf,mBAAmB,CAiBrB;AAED;;GAEG;AACH,wBAAgB,8BAA8B,CAC5C,aAAa,EAAE,aAAa,GAC3B,QAAQ,CA8DV;AAED;;GAEG;AACH,wBAAgB,qDAAqD,CACnE,KAAK,EAAE,uBAAuB,GAC7B,qBAAqB,CAavB;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,YAAY,EAAE,YAAY,GAAG,OAAO,CAoBxE;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,aAAa,EAAE,aAAa,GAAG,OAAO,CAoB3E;AAED;;GAEG;AACH,wBAAgB,wBAAwB,IAAI;IAC1C,MAAM,EAAE,OAAO,CAAC;IAChB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,CA2BA"}
@@ -13,6 +13,12 @@
13
13
  # include(${CMAKE_SOURCE_DIR}/../nitrogen/generated/android/NitroIap+autolinking.cmake)
14
14
  # ```
15
15
 
16
+ # Define a flag to check if we are building properly
17
+ add_definitions(-DBUILDING_NITROIAP_WITH_GENERATED_CMAKE_PROJECT)
18
+
19
+ # Enable Raw Props parsing in react-native (for Nitro Views)
20
+ add_definitions(-DRN_SERIALIZABLE_STATE)
21
+
16
22
  # Add all headers that were generated by Nitrogen
17
23
  include_directories(
18
24
  "../nitrogen/generated/shared/c++"
@@ -30,16 +36,15 @@ target_sources(
30
36
  ../nitrogen/generated/shared/c++/HybridRnIapSpec.cpp
31
37
  # Android-specific Nitrogen C++ sources
32
38
  ../nitrogen/generated/android/c++/JHybridRnIapSpec.cpp
39
+ ../nitrogen/generated/android/c++/JVariant_PurchaseAndroid_PurchaseIOS.cpp
40
+ ../nitrogen/generated/android/c++/JPurchase.cpp
33
41
  ../nitrogen/generated/android/c++/JVariant_Boolean_NitroPurchaseResult.cpp
34
42
  ../nitrogen/generated/android/c++/JVariant_NitroReceiptValidationResultIOS_NitroReceiptValidationResultAndroid.cpp
35
43
  )
36
44
 
37
- # Define a flag to check if we are building properly
38
- add_definitions(-DBUILDING_NITROIAP_WITH_GENERATED_CMAKE_PROJECT)
39
-
40
45
  # From node_modules/react-native/ReactAndroid/cmake-utils/folly-flags.cmake
41
46
  # Used in node_modules/react-native/ReactAndroid/cmake-utils/ReactNative-application.cmake
42
- target_compile_definitions(
47
+ target_compile_definitions(
43
48
  NitroIap PRIVATE
44
49
  -DFOLLY_NO_CONFIG=1
45
50
  -DFOLLY_HAVE_CLOCK_GETTIME=1
@@ -9,6 +9,18 @@
9
9
 
10
10
  // Forward declaration of `NitroProduct` to properly resolve imports.
11
11
  namespace margelo::nitro::iap { struct NitroProduct; }
12
+ // Forward declaration of `RequestPurchaseResult` to properly resolve imports.
13
+ namespace margelo::nitro::iap { struct RequestPurchaseResult; }
14
+ // Forward declaration of `PurchaseAndroid` to properly resolve imports.
15
+ namespace margelo::nitro::iap { struct PurchaseAndroid; }
16
+ // Forward declaration of `PurchaseIOS` to properly resolve imports.
17
+ namespace margelo::nitro::iap { struct PurchaseIOS; }
18
+ // Forward declaration of `IapPlatform` to properly resolve imports.
19
+ namespace margelo::nitro::iap { enum class IapPlatform; }
20
+ // Forward declaration of `PurchaseState` to properly resolve imports.
21
+ namespace margelo::nitro::iap { enum class PurchaseState; }
22
+ // Forward declaration of `PurchaseOfferIOS` to properly resolve imports.
23
+ namespace margelo::nitro::iap { struct PurchaseOfferIOS; }
12
24
  // Forward declaration of `NitroPurchase` to properly resolve imports.
13
25
  namespace margelo::nitro::iap { struct NitroPurchase; }
14
26
  // Forward declaration of `NitroPurchaseResult` to properly resolve imports.
@@ -55,10 +67,24 @@ namespace margelo::nitro::iap { struct NitroDeepLinkOptionsAndroid; }
55
67
  #include "JNitroProduct.hpp"
56
68
  #include <string>
57
69
  #include <optional>
70
+ #include "RequestPurchaseResult.hpp"
71
+ #include "JRequestPurchaseResult.hpp"
72
+ #include "PurchaseAndroid.hpp"
73
+ #include "PurchaseIOS.hpp"
74
+ #include <variant>
75
+ #include "JVariant_PurchaseAndroid_PurchaseIOS.hpp"
76
+ #include "JPurchaseAndroid.hpp"
77
+ #include "IapPlatform.hpp"
78
+ #include "JIapPlatform.hpp"
79
+ #include "PurchaseState.hpp"
80
+ #include "JPurchaseState.hpp"
81
+ #include "JPurchaseIOS.hpp"
82
+ #include "PurchaseOfferIOS.hpp"
83
+ #include "JPurchaseOfferIOS.hpp"
84
+ #include "JPurchase.hpp"
58
85
  #include "NitroPurchase.hpp"
59
86
  #include "JNitroPurchase.hpp"
60
87
  #include "NitroPurchaseResult.hpp"
61
- #include <variant>
62
88
  #include "JVariant_Boolean_NitroPurchaseResult.hpp"
63
89
  #include "JNitroPurchaseResult.hpp"
64
90
  #include "NitroSubscriptionStatus.hpp"
@@ -193,13 +219,14 @@ namespace margelo::nitro::iap {
193
219
  return __promise;
194
220
  }();
195
221
  }
196
- std::shared_ptr<Promise<void>> JHybridRnIapSpec::requestPurchase(const NitroPurchaseRequest& request) {
222
+ std::shared_ptr<Promise<RequestPurchaseResult>> JHybridRnIapSpec::requestPurchase(const NitroPurchaseRequest& request) {
197
223
  static const auto method = javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>(jni::alias_ref<JNitroPurchaseRequest> /* request */)>("requestPurchase");
198
224
  auto __result = method(_javaPart, JNitroPurchaseRequest::fromCpp(request));
199
225
  return [&]() {
200
- auto __promise = Promise<void>::create();
201
- __result->cthis()->addOnResolvedListener([=](const jni::alias_ref<jni::JObject>& /* unit */) {
202
- __promise->resolve();
226
+ auto __promise = Promise<RequestPurchaseResult>::create();
227
+ __result->cthis()->addOnResolvedListener([=](const jni::alias_ref<jni::JObject>& __boxedResult) {
228
+ auto __result = jni::static_ref_cast<JRequestPurchaseResult>(__boxedResult);
229
+ __promise->resolve(__result->toCpp());
203
230
  });
204
231
  __result->cthis()->addOnRejectedListener([=](const jni::alias_ref<jni::JThrowable>& __throwable) {
205
232
  jni::JniException __jniError(__throwable);
@@ -56,7 +56,7 @@ namespace margelo::nitro::iap {
56
56
  std::shared_ptr<Promise<bool>> initConnection() override;
57
57
  std::shared_ptr<Promise<bool>> endConnection() override;
58
58
  std::shared_ptr<Promise<std::vector<NitroProduct>>> fetchProducts(const std::vector<std::string>& skus, const std::string& type) override;
59
- std::shared_ptr<Promise<void>> requestPurchase(const NitroPurchaseRequest& request) override;
59
+ std::shared_ptr<Promise<RequestPurchaseResult>> 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::variant<bool, NitroPurchaseResult>>> finishTransaction(const NitroFinishTransactionParams& params) override;
62
62
  void addPurchaseUpdatedListener(const std::function<void(const NitroPurchase& /* purchase */)>& listener) override;
@@ -0,0 +1,59 @@
1
+ ///
2
+ /// JIapPlatform.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 "IapPlatform.hpp"
12
+
13
+ namespace margelo::nitro::iap {
14
+
15
+ using namespace facebook;
16
+
17
+ /**
18
+ * The C++ JNI bridge between the C++ enum "IapPlatform" and the the Kotlin enum "IapPlatform".
19
+ */
20
+ struct JIapPlatform final: public jni::JavaClass<JIapPlatform> {
21
+ public:
22
+ static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/iap/IapPlatform;";
23
+
24
+ public:
25
+ /**
26
+ * Convert this Java/Kotlin-based enum to the C++ enum IapPlatform.
27
+ */
28
+ [[maybe_unused]]
29
+ [[nodiscard]]
30
+ IapPlatform 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<IapPlatform>(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<JIapPlatform> fromCpp(IapPlatform value) {
43
+ static const auto clazz = javaClassStatic();
44
+ static const auto fieldANDROID = clazz->getStaticField<JIapPlatform>("ANDROID");
45
+ static const auto fieldIOS = clazz->getStaticField<JIapPlatform>("IOS");
46
+
47
+ switch (value) {
48
+ case IapPlatform::ANDROID:
49
+ return clazz->getStaticFieldValue(fieldANDROID);
50
+ case IapPlatform::IOS:
51
+ return clazz->getStaticFieldValue(fieldIOS);
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,26 @@
1
+ ///
2
+ /// JPurchase.cpp
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
+ #include "JPurchase.hpp"
9
+
10
+ namespace margelo::nitro::iap {
11
+ /**
12
+ * Converts JPurchase to std::variant<PurchaseAndroid, PurchaseIOS>
13
+ */
14
+ std::variant<PurchaseAndroid, PurchaseIOS> JPurchase::toCpp() const {
15
+ if (isInstanceOf(JPurchase_impl::First::javaClassStatic())) {
16
+ // It's a `PurchaseAndroid`
17
+ auto jniValue = static_cast<const JPurchase_impl::First*>(this)->getValue();
18
+ return jniValue->toCpp();
19
+ } else if (isInstanceOf(JPurchase_impl::Second::javaClassStatic())) {
20
+ // It's a `PurchaseIOS`
21
+ auto jniValue = static_cast<const JPurchase_impl::Second*>(this)->getValue();
22
+ return jniValue->toCpp();
23
+ }
24
+ throw std::invalid_argument("Variant is unknown Kotlin instance!");
25
+ }
26
+ } // namespace margelo::nitro::iap
@@ -0,0 +1,80 @@
1
+ ///
2
+ /// JPurchase.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 <variant>
12
+
13
+ #include "PurchaseAndroid.hpp"
14
+ #include "PurchaseIOS.hpp"
15
+ #include <variant>
16
+ #include "JPurchaseAndroid.hpp"
17
+ #include <optional>
18
+ #include <string>
19
+ #include <vector>
20
+ #include "IapPlatform.hpp"
21
+ #include "JIapPlatform.hpp"
22
+ #include "PurchaseState.hpp"
23
+ #include "JPurchaseState.hpp"
24
+ #include "JPurchaseIOS.hpp"
25
+ #include "PurchaseOfferIOS.hpp"
26
+ #include "JPurchaseOfferIOS.hpp"
27
+
28
+ namespace margelo::nitro::iap {
29
+
30
+ using namespace facebook;
31
+
32
+ /**
33
+ * The C++ JNI bridge between the C++ std::variant and the Java class "Purchase".
34
+ */
35
+ class JPurchase: public jni::JavaClass<JPurchase> {
36
+ public:
37
+ static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/iap/Purchase;";
38
+
39
+ static jni::local_ref<JPurchase> create_0(jni::alias_ref<JPurchaseAndroid> value) {
40
+ static const auto method = javaClassStatic()->getStaticMethod<JPurchase(jni::alias_ref<JPurchaseAndroid>)>("create");
41
+ return method(javaClassStatic(), value);
42
+ }
43
+ static jni::local_ref<JPurchase> create_1(jni::alias_ref<JPurchaseIOS> value) {
44
+ static const auto method = javaClassStatic()->getStaticMethod<JPurchase(jni::alias_ref<JPurchaseIOS>)>("create");
45
+ return method(javaClassStatic(), value);
46
+ }
47
+
48
+ static jni::local_ref<JPurchase> fromCpp(const std::variant<PurchaseAndroid, PurchaseIOS>& variant) {
49
+ switch (variant.index()) {
50
+ case 0: return create_0(JPurchaseAndroid::fromCpp(std::get<0>(variant)));
51
+ case 1: return create_1(JPurchaseIOS::fromCpp(std::get<1>(variant)));
52
+ default: throw std::invalid_argument("Variant holds unknown index! (" + std::to_string(variant.index()) + ")");
53
+ }
54
+ }
55
+
56
+ [[nodiscard]] std::variant<PurchaseAndroid, PurchaseIOS> toCpp() const;
57
+ };
58
+
59
+ namespace JPurchase_impl {
60
+ class First: public jni::JavaClass<First, JPurchase> {
61
+ public:
62
+ static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/iap/Purchase$First;";
63
+
64
+ [[nodiscard]] jni::local_ref<JPurchaseAndroid> getValue() const {
65
+ static const auto field = javaClassStatic()->getField<JPurchaseAndroid>("value");
66
+ return getFieldValue(field);
67
+ }
68
+ };
69
+
70
+ class Second: public jni::JavaClass<Second, JPurchase> {
71
+ public:
72
+ static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/iap/Purchase$Second;";
73
+
74
+ [[nodiscard]] jni::local_ref<JPurchaseIOS> getValue() const {
75
+ static const auto field = javaClassStatic()->getField<JPurchaseIOS>("value");
76
+ return getFieldValue(field);
77
+ }
78
+ };
79
+ } // namespace JPurchase_impl
80
+ } // namespace margelo::nitro::iap
@@ -0,0 +1,140 @@
1
+ ///
2
+ /// JPurchaseAndroid.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 "PurchaseAndroid.hpp"
12
+
13
+ #include "IapPlatform.hpp"
14
+ #include "JIapPlatform.hpp"
15
+ #include "JPurchaseState.hpp"
16
+ #include "PurchaseState.hpp"
17
+ #include <optional>
18
+ #include <string>
19
+ #include <vector>
20
+
21
+ namespace margelo::nitro::iap {
22
+
23
+ using namespace facebook;
24
+
25
+ /**
26
+ * The C++ JNI bridge between the C++ struct "PurchaseAndroid" and the the Kotlin data class "PurchaseAndroid".
27
+ */
28
+ struct JPurchaseAndroid final: public jni::JavaClass<JPurchaseAndroid> {
29
+ public:
30
+ static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/iap/PurchaseAndroid;";
31
+
32
+ public:
33
+ /**
34
+ * Convert this Java/Kotlin-based struct to the C++ struct PurchaseAndroid by copying all values to C++.
35
+ */
36
+ [[maybe_unused]]
37
+ [[nodiscard]]
38
+ PurchaseAndroid toCpp() const {
39
+ static const auto clazz = javaClassStatic();
40
+ static const auto fieldAutoRenewingAndroid = clazz->getField<jni::JBoolean>("autoRenewingAndroid");
41
+ jni::local_ref<jni::JBoolean> autoRenewingAndroid = this->getFieldValue(fieldAutoRenewingAndroid);
42
+ static const auto fieldDataAndroid = clazz->getField<jni::JString>("dataAndroid");
43
+ jni::local_ref<jni::JString> dataAndroid = this->getFieldValue(fieldDataAndroid);
44
+ static const auto fieldDeveloperPayloadAndroid = clazz->getField<jni::JString>("developerPayloadAndroid");
45
+ jni::local_ref<jni::JString> developerPayloadAndroid = this->getFieldValue(fieldDeveloperPayloadAndroid);
46
+ static const auto fieldId = clazz->getField<jni::JString>("id");
47
+ jni::local_ref<jni::JString> id = this->getFieldValue(fieldId);
48
+ static const auto fieldIds = clazz->getField<jni::JArrayClass<jni::JString>>("ids");
49
+ jni::local_ref<jni::JArrayClass<jni::JString>> ids = this->getFieldValue(fieldIds);
50
+ static const auto fieldIsAcknowledgedAndroid = clazz->getField<jni::JBoolean>("isAcknowledgedAndroid");
51
+ jni::local_ref<jni::JBoolean> isAcknowledgedAndroid = this->getFieldValue(fieldIsAcknowledgedAndroid);
52
+ static const auto fieldIsAutoRenewing = clazz->getField<jboolean>("isAutoRenewing");
53
+ jboolean isAutoRenewing = this->getFieldValue(fieldIsAutoRenewing);
54
+ static const auto fieldObfuscatedAccountIdAndroid = clazz->getField<jni::JString>("obfuscatedAccountIdAndroid");
55
+ jni::local_ref<jni::JString> obfuscatedAccountIdAndroid = this->getFieldValue(fieldObfuscatedAccountIdAndroid);
56
+ static const auto fieldObfuscatedProfileIdAndroid = clazz->getField<jni::JString>("obfuscatedProfileIdAndroid");
57
+ jni::local_ref<jni::JString> obfuscatedProfileIdAndroid = this->getFieldValue(fieldObfuscatedProfileIdAndroid);
58
+ static const auto fieldPackageNameAndroid = clazz->getField<jni::JString>("packageNameAndroid");
59
+ jni::local_ref<jni::JString> packageNameAndroid = this->getFieldValue(fieldPackageNameAndroid);
60
+ static const auto fieldPlatform = clazz->getField<JIapPlatform>("platform");
61
+ jni::local_ref<JIapPlatform> platform = this->getFieldValue(fieldPlatform);
62
+ static const auto fieldProductId = clazz->getField<jni::JString>("productId");
63
+ jni::local_ref<jni::JString> productId = this->getFieldValue(fieldProductId);
64
+ static const auto fieldPurchaseState = clazz->getField<JPurchaseState>("purchaseState");
65
+ jni::local_ref<JPurchaseState> purchaseState = this->getFieldValue(fieldPurchaseState);
66
+ static const auto fieldPurchaseToken = clazz->getField<jni::JString>("purchaseToken");
67
+ jni::local_ref<jni::JString> purchaseToken = this->getFieldValue(fieldPurchaseToken);
68
+ static const auto fieldQuantity = clazz->getField<double>("quantity");
69
+ double quantity = this->getFieldValue(fieldQuantity);
70
+ static const auto fieldSignatureAndroid = clazz->getField<jni::JString>("signatureAndroid");
71
+ jni::local_ref<jni::JString> signatureAndroid = this->getFieldValue(fieldSignatureAndroid);
72
+ static const auto fieldTransactionDate = clazz->getField<double>("transactionDate");
73
+ double transactionDate = this->getFieldValue(fieldTransactionDate);
74
+ return PurchaseAndroid(
75
+ autoRenewingAndroid != nullptr ? std::make_optional(static_cast<bool>(autoRenewingAndroid->value())) : std::nullopt,
76
+ dataAndroid != nullptr ? std::make_optional(dataAndroid->toStdString()) : std::nullopt,
77
+ developerPayloadAndroid != nullptr ? std::make_optional(developerPayloadAndroid->toStdString()) : std::nullopt,
78
+ id->toStdString(),
79
+ ids != nullptr ? std::make_optional([&]() {
80
+ size_t __size = ids->size();
81
+ std::vector<std::string> __vector;
82
+ __vector.reserve(__size);
83
+ for (size_t __i = 0; __i < __size; __i++) {
84
+ auto __element = ids->getElement(__i);
85
+ __vector.push_back(__element->toStdString());
86
+ }
87
+ return __vector;
88
+ }()) : std::nullopt,
89
+ isAcknowledgedAndroid != nullptr ? std::make_optional(static_cast<bool>(isAcknowledgedAndroid->value())) : std::nullopt,
90
+ static_cast<bool>(isAutoRenewing),
91
+ obfuscatedAccountIdAndroid != nullptr ? std::make_optional(obfuscatedAccountIdAndroid->toStdString()) : std::nullopt,
92
+ obfuscatedProfileIdAndroid != nullptr ? std::make_optional(obfuscatedProfileIdAndroid->toStdString()) : std::nullopt,
93
+ packageNameAndroid != nullptr ? std::make_optional(packageNameAndroid->toStdString()) : std::nullopt,
94
+ platform->toCpp(),
95
+ productId->toStdString(),
96
+ purchaseState->toCpp(),
97
+ purchaseToken != nullptr ? std::make_optional(purchaseToken->toStdString()) : std::nullopt,
98
+ quantity,
99
+ signatureAndroid != nullptr ? std::make_optional(signatureAndroid->toStdString()) : std::nullopt,
100
+ transactionDate
101
+ );
102
+ }
103
+
104
+ public:
105
+ /**
106
+ * Create a Java/Kotlin-based struct by copying all values from the given C++ struct to Java.
107
+ */
108
+ [[maybe_unused]]
109
+ static jni::local_ref<JPurchaseAndroid::javaobject> fromCpp(const PurchaseAndroid& value) {
110
+ return newInstance(
111
+ value.autoRenewingAndroid.has_value() ? jni::JBoolean::valueOf(value.autoRenewingAndroid.value()) : nullptr,
112
+ value.dataAndroid.has_value() ? jni::make_jstring(value.dataAndroid.value()) : nullptr,
113
+ value.developerPayloadAndroid.has_value() ? jni::make_jstring(value.developerPayloadAndroid.value()) : nullptr,
114
+ jni::make_jstring(value.id),
115
+ value.ids.has_value() ? [&]() {
116
+ size_t __size = value.ids.value().size();
117
+ jni::local_ref<jni::JArrayClass<jni::JString>> __array = jni::JArrayClass<jni::JString>::newArray(__size);
118
+ for (size_t __i = 0; __i < __size; __i++) {
119
+ const auto& __element = value.ids.value()[__i];
120
+ __array->setElement(__i, *jni::make_jstring(__element));
121
+ }
122
+ return __array;
123
+ }() : nullptr,
124
+ value.isAcknowledgedAndroid.has_value() ? jni::JBoolean::valueOf(value.isAcknowledgedAndroid.value()) : nullptr,
125
+ value.isAutoRenewing,
126
+ value.obfuscatedAccountIdAndroid.has_value() ? jni::make_jstring(value.obfuscatedAccountIdAndroid.value()) : nullptr,
127
+ value.obfuscatedProfileIdAndroid.has_value() ? jni::make_jstring(value.obfuscatedProfileIdAndroid.value()) : nullptr,
128
+ value.packageNameAndroid.has_value() ? jni::make_jstring(value.packageNameAndroid.value()) : nullptr,
129
+ JIapPlatform::fromCpp(value.platform),
130
+ jni::make_jstring(value.productId),
131
+ JPurchaseState::fromCpp(value.purchaseState),
132
+ value.purchaseToken.has_value() ? jni::make_jstring(value.purchaseToken.value()) : nullptr,
133
+ value.quantity,
134
+ value.signatureAndroid.has_value() ? jni::make_jstring(value.signatureAndroid.value()) : nullptr,
135
+ value.transactionDate
136
+ );
137
+ }
138
+ };
139
+
140
+ } // namespace margelo::nitro::iap
@@ -0,0 +1,194 @@
1
+ ///
2
+ /// JPurchaseIOS.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 "PurchaseIOS.hpp"
12
+
13
+ #include "IapPlatform.hpp"
14
+ #include "JIapPlatform.hpp"
15
+ #include "JPurchaseOfferIOS.hpp"
16
+ #include "JPurchaseState.hpp"
17
+ #include "PurchaseOfferIOS.hpp"
18
+ #include "PurchaseState.hpp"
19
+ #include <optional>
20
+ #include <string>
21
+ #include <vector>
22
+
23
+ namespace margelo::nitro::iap {
24
+
25
+ using namespace facebook;
26
+
27
+ /**
28
+ * The C++ JNI bridge between the C++ struct "PurchaseIOS" and the the Kotlin data class "PurchaseIOS".
29
+ */
30
+ struct JPurchaseIOS final: public jni::JavaClass<JPurchaseIOS> {
31
+ public:
32
+ static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/iap/PurchaseIOS;";
33
+
34
+ public:
35
+ /**
36
+ * Convert this Java/Kotlin-based struct to the C++ struct PurchaseIOS by copying all values to C++.
37
+ */
38
+ [[maybe_unused]]
39
+ [[nodiscard]]
40
+ PurchaseIOS toCpp() const {
41
+ static const auto clazz = javaClassStatic();
42
+ static const auto fieldAppAccountToken = clazz->getField<jni::JString>("appAccountToken");
43
+ jni::local_ref<jni::JString> appAccountToken = this->getFieldValue(fieldAppAccountToken);
44
+ static const auto fieldAppBundleIdIOS = clazz->getField<jni::JString>("appBundleIdIOS");
45
+ jni::local_ref<jni::JString> appBundleIdIOS = this->getFieldValue(fieldAppBundleIdIOS);
46
+ static const auto fieldCountryCodeIOS = clazz->getField<jni::JString>("countryCodeIOS");
47
+ jni::local_ref<jni::JString> countryCodeIOS = this->getFieldValue(fieldCountryCodeIOS);
48
+ static const auto fieldCurrencyCodeIOS = clazz->getField<jni::JString>("currencyCodeIOS");
49
+ jni::local_ref<jni::JString> currencyCodeIOS = this->getFieldValue(fieldCurrencyCodeIOS);
50
+ static const auto fieldCurrencySymbolIOS = clazz->getField<jni::JString>("currencySymbolIOS");
51
+ jni::local_ref<jni::JString> currencySymbolIOS = this->getFieldValue(fieldCurrencySymbolIOS);
52
+ static const auto fieldEnvironmentIOS = clazz->getField<jni::JString>("environmentIOS");
53
+ jni::local_ref<jni::JString> environmentIOS = this->getFieldValue(fieldEnvironmentIOS);
54
+ static const auto fieldExpirationDateIOS = clazz->getField<jni::JDouble>("expirationDateIOS");
55
+ jni::local_ref<jni::JDouble> expirationDateIOS = this->getFieldValue(fieldExpirationDateIOS);
56
+ static const auto fieldId = clazz->getField<jni::JString>("id");
57
+ jni::local_ref<jni::JString> id = this->getFieldValue(fieldId);
58
+ static const auto fieldIds = clazz->getField<jni::JArrayClass<jni::JString>>("ids");
59
+ jni::local_ref<jni::JArrayClass<jni::JString>> ids = this->getFieldValue(fieldIds);
60
+ static const auto fieldIsAutoRenewing = clazz->getField<jboolean>("isAutoRenewing");
61
+ jboolean isAutoRenewing = this->getFieldValue(fieldIsAutoRenewing);
62
+ static const auto fieldIsUpgradedIOS = clazz->getField<jni::JBoolean>("isUpgradedIOS");
63
+ jni::local_ref<jni::JBoolean> isUpgradedIOS = this->getFieldValue(fieldIsUpgradedIOS);
64
+ static const auto fieldOfferIOS = clazz->getField<JPurchaseOfferIOS>("offerIOS");
65
+ jni::local_ref<JPurchaseOfferIOS> offerIOS = this->getFieldValue(fieldOfferIOS);
66
+ static const auto fieldOriginalTransactionDateIOS = clazz->getField<jni::JDouble>("originalTransactionDateIOS");
67
+ jni::local_ref<jni::JDouble> originalTransactionDateIOS = this->getFieldValue(fieldOriginalTransactionDateIOS);
68
+ static const auto fieldOriginalTransactionIdentifierIOS = clazz->getField<jni::JString>("originalTransactionIdentifierIOS");
69
+ jni::local_ref<jni::JString> originalTransactionIdentifierIOS = this->getFieldValue(fieldOriginalTransactionIdentifierIOS);
70
+ static const auto fieldOwnershipTypeIOS = clazz->getField<jni::JString>("ownershipTypeIOS");
71
+ jni::local_ref<jni::JString> ownershipTypeIOS = this->getFieldValue(fieldOwnershipTypeIOS);
72
+ static const auto fieldPlatform = clazz->getField<JIapPlatform>("platform");
73
+ jni::local_ref<JIapPlatform> platform = this->getFieldValue(fieldPlatform);
74
+ static const auto fieldProductId = clazz->getField<jni::JString>("productId");
75
+ jni::local_ref<jni::JString> productId = this->getFieldValue(fieldProductId);
76
+ static const auto fieldPurchaseState = clazz->getField<JPurchaseState>("purchaseState");
77
+ jni::local_ref<JPurchaseState> purchaseState = this->getFieldValue(fieldPurchaseState);
78
+ static const auto fieldPurchaseToken = clazz->getField<jni::JString>("purchaseToken");
79
+ jni::local_ref<jni::JString> purchaseToken = this->getFieldValue(fieldPurchaseToken);
80
+ static const auto fieldQuantity = clazz->getField<double>("quantity");
81
+ double quantity = this->getFieldValue(fieldQuantity);
82
+ static const auto fieldQuantityIOS = clazz->getField<jni::JDouble>("quantityIOS");
83
+ jni::local_ref<jni::JDouble> quantityIOS = this->getFieldValue(fieldQuantityIOS);
84
+ static const auto fieldReasonIOS = clazz->getField<jni::JString>("reasonIOS");
85
+ jni::local_ref<jni::JString> reasonIOS = this->getFieldValue(fieldReasonIOS);
86
+ static const auto fieldReasonStringRepresentationIOS = clazz->getField<jni::JString>("reasonStringRepresentationIOS");
87
+ jni::local_ref<jni::JString> reasonStringRepresentationIOS = this->getFieldValue(fieldReasonStringRepresentationIOS);
88
+ static const auto fieldRevocationDateIOS = clazz->getField<jni::JDouble>("revocationDateIOS");
89
+ jni::local_ref<jni::JDouble> revocationDateIOS = this->getFieldValue(fieldRevocationDateIOS);
90
+ static const auto fieldRevocationReasonIOS = clazz->getField<jni::JString>("revocationReasonIOS");
91
+ jni::local_ref<jni::JString> revocationReasonIOS = this->getFieldValue(fieldRevocationReasonIOS);
92
+ static const auto fieldStorefrontCountryCodeIOS = clazz->getField<jni::JString>("storefrontCountryCodeIOS");
93
+ jni::local_ref<jni::JString> storefrontCountryCodeIOS = this->getFieldValue(fieldStorefrontCountryCodeIOS);
94
+ static const auto fieldSubscriptionGroupIdIOS = clazz->getField<jni::JString>("subscriptionGroupIdIOS");
95
+ jni::local_ref<jni::JString> subscriptionGroupIdIOS = this->getFieldValue(fieldSubscriptionGroupIdIOS);
96
+ static const auto fieldTransactionDate = clazz->getField<double>("transactionDate");
97
+ double transactionDate = this->getFieldValue(fieldTransactionDate);
98
+ static const auto fieldTransactionReasonIOS = clazz->getField<jni::JString>("transactionReasonIOS");
99
+ jni::local_ref<jni::JString> transactionReasonIOS = this->getFieldValue(fieldTransactionReasonIOS);
100
+ static const auto fieldWebOrderLineItemIdIOS = clazz->getField<jni::JString>("webOrderLineItemIdIOS");
101
+ jni::local_ref<jni::JString> webOrderLineItemIdIOS = this->getFieldValue(fieldWebOrderLineItemIdIOS);
102
+ return PurchaseIOS(
103
+ appAccountToken != nullptr ? std::make_optional(appAccountToken->toStdString()) : std::nullopt,
104
+ appBundleIdIOS != nullptr ? std::make_optional(appBundleIdIOS->toStdString()) : std::nullopt,
105
+ countryCodeIOS != nullptr ? std::make_optional(countryCodeIOS->toStdString()) : std::nullopt,
106
+ currencyCodeIOS != nullptr ? std::make_optional(currencyCodeIOS->toStdString()) : std::nullopt,
107
+ currencySymbolIOS != nullptr ? std::make_optional(currencySymbolIOS->toStdString()) : std::nullopt,
108
+ environmentIOS != nullptr ? std::make_optional(environmentIOS->toStdString()) : std::nullopt,
109
+ expirationDateIOS != nullptr ? std::make_optional(expirationDateIOS->value()) : std::nullopt,
110
+ id->toStdString(),
111
+ ids != nullptr ? std::make_optional([&]() {
112
+ size_t __size = ids->size();
113
+ std::vector<std::string> __vector;
114
+ __vector.reserve(__size);
115
+ for (size_t __i = 0; __i < __size; __i++) {
116
+ auto __element = ids->getElement(__i);
117
+ __vector.push_back(__element->toStdString());
118
+ }
119
+ return __vector;
120
+ }()) : std::nullopt,
121
+ static_cast<bool>(isAutoRenewing),
122
+ isUpgradedIOS != nullptr ? std::make_optional(static_cast<bool>(isUpgradedIOS->value())) : std::nullopt,
123
+ offerIOS != nullptr ? std::make_optional(offerIOS->toCpp()) : std::nullopt,
124
+ originalTransactionDateIOS != nullptr ? std::make_optional(originalTransactionDateIOS->value()) : std::nullopt,
125
+ originalTransactionIdentifierIOS != nullptr ? std::make_optional(originalTransactionIdentifierIOS->toStdString()) : std::nullopt,
126
+ ownershipTypeIOS != nullptr ? std::make_optional(ownershipTypeIOS->toStdString()) : std::nullopt,
127
+ platform->toCpp(),
128
+ productId->toStdString(),
129
+ purchaseState->toCpp(),
130
+ purchaseToken != nullptr ? std::make_optional(purchaseToken->toStdString()) : std::nullopt,
131
+ quantity,
132
+ quantityIOS != nullptr ? std::make_optional(quantityIOS->value()) : std::nullopt,
133
+ reasonIOS != nullptr ? std::make_optional(reasonIOS->toStdString()) : std::nullopt,
134
+ reasonStringRepresentationIOS != nullptr ? std::make_optional(reasonStringRepresentationIOS->toStdString()) : std::nullopt,
135
+ revocationDateIOS != nullptr ? std::make_optional(revocationDateIOS->value()) : std::nullopt,
136
+ revocationReasonIOS != nullptr ? std::make_optional(revocationReasonIOS->toStdString()) : std::nullopt,
137
+ storefrontCountryCodeIOS != nullptr ? std::make_optional(storefrontCountryCodeIOS->toStdString()) : std::nullopt,
138
+ subscriptionGroupIdIOS != nullptr ? std::make_optional(subscriptionGroupIdIOS->toStdString()) : std::nullopt,
139
+ transactionDate,
140
+ transactionReasonIOS != nullptr ? std::make_optional(transactionReasonIOS->toStdString()) : std::nullopt,
141
+ webOrderLineItemIdIOS != nullptr ? std::make_optional(webOrderLineItemIdIOS->toStdString()) : std::nullopt
142
+ );
143
+ }
144
+
145
+ public:
146
+ /**
147
+ * Create a Java/Kotlin-based struct by copying all values from the given C++ struct to Java.
148
+ */
149
+ [[maybe_unused]]
150
+ static jni::local_ref<JPurchaseIOS::javaobject> fromCpp(const PurchaseIOS& value) {
151
+ return newInstance(
152
+ value.appAccountToken.has_value() ? jni::make_jstring(value.appAccountToken.value()) : nullptr,
153
+ value.appBundleIdIOS.has_value() ? jni::make_jstring(value.appBundleIdIOS.value()) : nullptr,
154
+ value.countryCodeIOS.has_value() ? jni::make_jstring(value.countryCodeIOS.value()) : nullptr,
155
+ value.currencyCodeIOS.has_value() ? jni::make_jstring(value.currencyCodeIOS.value()) : nullptr,
156
+ value.currencySymbolIOS.has_value() ? jni::make_jstring(value.currencySymbolIOS.value()) : nullptr,
157
+ value.environmentIOS.has_value() ? jni::make_jstring(value.environmentIOS.value()) : nullptr,
158
+ value.expirationDateIOS.has_value() ? jni::JDouble::valueOf(value.expirationDateIOS.value()) : nullptr,
159
+ jni::make_jstring(value.id),
160
+ value.ids.has_value() ? [&]() {
161
+ size_t __size = value.ids.value().size();
162
+ jni::local_ref<jni::JArrayClass<jni::JString>> __array = jni::JArrayClass<jni::JString>::newArray(__size);
163
+ for (size_t __i = 0; __i < __size; __i++) {
164
+ const auto& __element = value.ids.value()[__i];
165
+ __array->setElement(__i, *jni::make_jstring(__element));
166
+ }
167
+ return __array;
168
+ }() : nullptr,
169
+ value.isAutoRenewing,
170
+ value.isUpgradedIOS.has_value() ? jni::JBoolean::valueOf(value.isUpgradedIOS.value()) : nullptr,
171
+ value.offerIOS.has_value() ? JPurchaseOfferIOS::fromCpp(value.offerIOS.value()) : nullptr,
172
+ value.originalTransactionDateIOS.has_value() ? jni::JDouble::valueOf(value.originalTransactionDateIOS.value()) : nullptr,
173
+ value.originalTransactionIdentifierIOS.has_value() ? jni::make_jstring(value.originalTransactionIdentifierIOS.value()) : nullptr,
174
+ value.ownershipTypeIOS.has_value() ? jni::make_jstring(value.ownershipTypeIOS.value()) : nullptr,
175
+ JIapPlatform::fromCpp(value.platform),
176
+ jni::make_jstring(value.productId),
177
+ JPurchaseState::fromCpp(value.purchaseState),
178
+ value.purchaseToken.has_value() ? jni::make_jstring(value.purchaseToken.value()) : nullptr,
179
+ value.quantity,
180
+ value.quantityIOS.has_value() ? jni::JDouble::valueOf(value.quantityIOS.value()) : nullptr,
181
+ value.reasonIOS.has_value() ? jni::make_jstring(value.reasonIOS.value()) : nullptr,
182
+ value.reasonStringRepresentationIOS.has_value() ? jni::make_jstring(value.reasonStringRepresentationIOS.value()) : nullptr,
183
+ value.revocationDateIOS.has_value() ? jni::JDouble::valueOf(value.revocationDateIOS.value()) : nullptr,
184
+ value.revocationReasonIOS.has_value() ? jni::make_jstring(value.revocationReasonIOS.value()) : nullptr,
185
+ value.storefrontCountryCodeIOS.has_value() ? jni::make_jstring(value.storefrontCountryCodeIOS.value()) : nullptr,
186
+ value.subscriptionGroupIdIOS.has_value() ? jni::make_jstring(value.subscriptionGroupIdIOS.value()) : nullptr,
187
+ value.transactionDate,
188
+ value.transactionReasonIOS.has_value() ? jni::make_jstring(value.transactionReasonIOS.value()) : nullptr,
189
+ value.webOrderLineItemIdIOS.has_value() ? jni::make_jstring(value.webOrderLineItemIdIOS.value()) : nullptr
190
+ );
191
+ }
192
+ };
193
+
194
+ } // namespace margelo::nitro::iap