react-native-pos-pagseguro 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +20 -0
- package/PosPagseguro.podspec +29 -0
- package/README.md +193 -0
- package/android/CMakeLists.txt +24 -0
- package/android/build.gradle +132 -0
- package/android/gradle.properties +5 -0
- package/android/libs/wrapper-1.30.52.aar +0 -0
- package/android/src/main/AndroidManifest.xml +2 -0
- package/android/src/main/cpp/cpp-adapter.cpp +6 -0
- package/android/src/main/java/com/margelo/nitro/pospagseguro/PosPagseguro.kt +251 -0
- package/android/src/main/java/com/margelo/nitro/pospagseguro/PosPagseguroPackage.kt +23 -0
- package/android/src/main/java/com/margelo/nitro/pospagseguro/maps/SubAcquirer.kt +23 -0
- package/android/src/main/java/com/margelo/nitro/pospagseguro/maps/TransactionResult.kt +53 -0
- package/android/src/main/java/com/margelo/nitro/pospagseguro/maps/Userdata.kt +17 -0
- package/ios/PosPagseguro.swift +5 -0
- package/lib/module/PosPagseguro.nitro.js +4 -0
- package/lib/module/PosPagseguro.nitro.js.map +1 -0
- package/lib/module/index.js +7 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/pag_seguro.js +290 -0
- package/lib/module/pag_seguro.js.map +1 -0
- package/lib/module/types/device.js +71 -0
- package/lib/module/types/device.js.map +1 -0
- package/lib/module/types/exceptions.js +16 -0
- package/lib/module/types/exceptions.js.map +1 -0
- package/lib/module/types/payments.js +84 -0
- package/lib/module/types/payments.js.map +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/PosPagseguro.nitro.d.ts +27 -0
- package/lib/typescript/src/PosPagseguro.nitro.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +7 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/lib/typescript/src/pag_seguro.d.ts +188 -0
- package/lib/typescript/src/pag_seguro.d.ts.map +1 -0
- package/lib/typescript/src/types/device.d.ts +92 -0
- package/lib/typescript/src/types/device.d.ts.map +1 -0
- package/lib/typescript/src/types/exceptions.d.ts +16 -0
- package/lib/typescript/src/types/exceptions.d.ts.map +1 -0
- package/lib/typescript/src/types/payments.d.ts +205 -0
- package/lib/typescript/src/types/payments.d.ts.map +1 -0
- package/nitro.json +16 -0
- package/nitrogen/generated/android/c++/JCapabilities.hpp +100 -0
- package/nitrogen/generated/android/c++/JCardIssuerNationality.hpp +61 -0
- package/nitrogen/generated/android/c++/JCustomError.hpp +61 -0
- package/nitrogen/generated/android/c++/JFunc_void_std__string.hpp +76 -0
- package/nitrogen/generated/android/c++/JHybridPosPagseguroSpec.cpp +248 -0
- package/nitrogen/generated/android/c++/JHybridPosPagseguroSpec.hpp +81 -0
- package/nitrogen/generated/android/c++/JInstallmentTypes.hpp +61 -0
- package/nitrogen/generated/android/c++/JPaymentData.hpp +81 -0
- package/nitrogen/generated/android/c++/JPaymentTypes.hpp +64 -0
- package/nitrogen/generated/android/c++/JSubAcquirer.hpp +101 -0
- package/nitrogen/generated/android/c++/JTransactionResult.hpp +208 -0
- package/nitrogen/generated/android/c++/JUserData.hpp +86 -0
- package/nitrogen/generated/android/c++/JVariant_CustomError_TransactionResult.cpp +26 -0
- package/nitrogen/generated/android/c++/JVariant_CustomError_TransactionResult.hpp +75 -0
- package/nitrogen/generated/android/c++/JVariant_Double_CustomError.cpp +26 -0
- package/nitrogen/generated/android/c++/JVariant_Double_CustomError.hpp +70 -0
- package/nitrogen/generated/android/c++/JVoidPayData.hpp +72 -0
- package/nitrogen/generated/android/c++/JVoidType.hpp +58 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/pospagseguro/Capabilities.kt +37 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/pospagseguro/CardIssuerNationality.kt +24 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/pospagseguro/CustomError.kt +41 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/pospagseguro/Func_void_std__string.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/pospagseguro/HybridPosPagseguroSpec.kt +132 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/pospagseguro/InstallmentTypes.kt +24 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/pospagseguro/PaymentData.kt +53 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/pospagseguro/PaymentTypes.kt +25 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/pospagseguro/SubAcquirer.kt +71 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/pospagseguro/TransactionResult.kt +149 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/pospagseguro/UserData.kt +59 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/pospagseguro/Variant_CustomError_TransactionResult.kt +59 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/pospagseguro/Variant_Double_CustomError.kt +59 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/pospagseguro/VoidPayData.kt +47 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/pospagseguro/VoidType.kt +23 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/pospagseguro/pospagseguroOnLoad.kt +35 -0
- package/nitrogen/generated/android/pospagseguro+autolinking.cmake +83 -0
- package/nitrogen/generated/android/pospagseguro+autolinking.gradle +27 -0
- package/nitrogen/generated/android/pospagseguroOnLoad.cpp +46 -0
- package/nitrogen/generated/android/pospagseguroOnLoad.hpp +25 -0
- package/nitrogen/generated/ios/PosPagseguro+autolinking.rb +60 -0
- package/nitrogen/generated/ios/PosPagseguro-Swift-Cxx-Bridge.cpp +65 -0
- package/nitrogen/generated/ios/PosPagseguro-Swift-Cxx-Bridge.hpp +422 -0
- package/nitrogen/generated/ios/PosPagseguro-Swift-Cxx-Umbrella.hpp +81 -0
- package/nitrogen/generated/ios/c++/HybridPosPagseguroSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridPosPagseguroSpecSwift.hpp +236 -0
- package/nitrogen/generated/ios/swift/Capabilities.swift +96 -0
- package/nitrogen/generated/ios/swift/CardIssuerNationality.swift +44 -0
- package/nitrogen/generated/ios/swift/CustomError.swift +35 -0
- package/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_std__string.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_std__variant_CustomError__TransactionResult_.swift +59 -0
- package/nitrogen/generated/ios/swift/Func_void_std__variant_double__CustomError_.swift +59 -0
- package/nitrogen/generated/ios/swift/HybridPosPagseguroSpec.swift +72 -0
- package/nitrogen/generated/ios/swift/HybridPosPagseguroSpec_cxx.swift +434 -0
- package/nitrogen/generated/ios/swift/InstallmentTypes.swift +44 -0
- package/nitrogen/generated/ios/swift/PaymentData.swift +74 -0
- package/nitrogen/generated/ios/swift/PaymentTypes.swift +48 -0
- package/nitrogen/generated/ios/swift/SubAcquirer.swift +85 -0
- package/nitrogen/generated/ios/swift/TransactionResult.swift +674 -0
- package/nitrogen/generated/ios/swift/UserData.swift +169 -0
- package/nitrogen/generated/ios/swift/Variant_CustomError_TransactionResult.swift +18 -0
- package/nitrogen/generated/ios/swift/Variant_Double_CustomError.swift +18 -0
- package/nitrogen/generated/ios/swift/VoidPayData.swift +64 -0
- package/nitrogen/generated/ios/swift/VoidType.swift +40 -0
- package/nitrogen/generated/shared/c++/Capabilities.hpp +76 -0
- package/nitrogen/generated/shared/c++/CardIssuerNationality.hpp +80 -0
- package/nitrogen/generated/shared/c++/CustomError.hpp +87 -0
- package/nitrogen/generated/shared/c++/HybridPosPagseguroSpec.cpp +37 -0
- package/nitrogen/generated/shared/c++/HybridPosPagseguroSpec.hpp +102 -0
- package/nitrogen/generated/shared/c++/InstallmentTypes.hpp +63 -0
- package/nitrogen/generated/shared/c++/PaymentData.hpp +108 -0
- package/nitrogen/generated/shared/c++/PaymentTypes.hpp +69 -0
- package/nitrogen/generated/shared/c++/SubAcquirer.hpp +127 -0
- package/nitrogen/generated/shared/c++/TransactionResult.hpp +234 -0
- package/nitrogen/generated/shared/c++/UserData.hpp +112 -0
- package/nitrogen/generated/shared/c++/VoidPayData.hpp +98 -0
- package/nitrogen/generated/shared/c++/VoidType.hpp +62 -0
- package/package.json +179 -0
- package/src/PosPagseguro.nitro.ts +32 -0
- package/src/index.ts +19 -0
- package/src/pag_seguro.ts +306 -0
- package/src/types/device.ts +97 -0
- package/src/types/exceptions.ts +19 -0
- package/src/types/payments.ts +215 -0
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridPosPagseguroSpec.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#if __has_include(<NitroModules/HybridObject.hpp>)
|
|
11
|
+
#include <NitroModules/HybridObject.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
|
|
16
|
+
// Forward declaration of `SubAcquirer` to properly resolve imports.
|
|
17
|
+
namespace margelo::nitro::pospagseguro { struct SubAcquirer; }
|
|
18
|
+
// Forward declaration of `UserData` to properly resolve imports.
|
|
19
|
+
namespace margelo::nitro::pospagseguro { struct UserData; }
|
|
20
|
+
// Forward declaration of `CustomError` to properly resolve imports.
|
|
21
|
+
namespace margelo::nitro::pospagseguro { struct CustomError; }
|
|
22
|
+
// Forward declaration of `Capabilities` to properly resolve imports.
|
|
23
|
+
namespace margelo::nitro::pospagseguro { enum class Capabilities; }
|
|
24
|
+
// Forward declaration of `TransactionResult` to properly resolve imports.
|
|
25
|
+
namespace margelo::nitro::pospagseguro { struct TransactionResult; }
|
|
26
|
+
// Forward declaration of `PaymentData` to properly resolve imports.
|
|
27
|
+
namespace margelo::nitro::pospagseguro { struct PaymentData; }
|
|
28
|
+
// Forward declaration of `VoidPayData` to properly resolve imports.
|
|
29
|
+
namespace margelo::nitro::pospagseguro { struct VoidPayData; }
|
|
30
|
+
|
|
31
|
+
#include <string>
|
|
32
|
+
#include "SubAcquirer.hpp"
|
|
33
|
+
#include <optional>
|
|
34
|
+
#include "UserData.hpp"
|
|
35
|
+
#include "CustomError.hpp"
|
|
36
|
+
#include <variant>
|
|
37
|
+
#include <NitroModules/Promise.hpp>
|
|
38
|
+
#include "Capabilities.hpp"
|
|
39
|
+
#include "TransactionResult.hpp"
|
|
40
|
+
#include "PaymentData.hpp"
|
|
41
|
+
#include <functional>
|
|
42
|
+
#include "VoidPayData.hpp"
|
|
43
|
+
|
|
44
|
+
namespace margelo::nitro::pospagseguro {
|
|
45
|
+
|
|
46
|
+
using namespace margelo::nitro;
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* An abstract base class for `PosPagseguro`
|
|
50
|
+
* Inherit this class to create instances of `HybridPosPagseguroSpec` in C++.
|
|
51
|
+
* You must explicitly call `HybridObject`'s constructor yourself, because it is virtual.
|
|
52
|
+
* @example
|
|
53
|
+
* ```cpp
|
|
54
|
+
* class HybridPosPagseguro: public HybridPosPagseguroSpec {
|
|
55
|
+
* public:
|
|
56
|
+
* HybridPosPagseguro(...): HybridObject(TAG) { ... }
|
|
57
|
+
* // ...
|
|
58
|
+
* };
|
|
59
|
+
* ```
|
|
60
|
+
*/
|
|
61
|
+
class HybridPosPagseguroSpec: public virtual HybridObject {
|
|
62
|
+
public:
|
|
63
|
+
// Constructor
|
|
64
|
+
explicit HybridPosPagseguroSpec(): HybridObject(TAG) { }
|
|
65
|
+
|
|
66
|
+
// Destructor
|
|
67
|
+
~HybridPosPagseguroSpec() override = default;
|
|
68
|
+
|
|
69
|
+
public:
|
|
70
|
+
// Properties
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
public:
|
|
74
|
+
// Methods
|
|
75
|
+
virtual std::string getModel() = 0;
|
|
76
|
+
virtual std::string getSerialNumber() = 0;
|
|
77
|
+
virtual std::optional<SubAcquirer> getSubAcquirerData() = 0;
|
|
78
|
+
virtual UserData getUserData() = 0;
|
|
79
|
+
virtual void reboot() = 0;
|
|
80
|
+
virtual std::shared_ptr<Promise<std::variant<double, CustomError>>> reprintCustomerReceipt() = 0;
|
|
81
|
+
virtual std::shared_ptr<Promise<std::variant<double, CustomError>>> reprintStablishmentReceipt() = 0;
|
|
82
|
+
virtual std::shared_ptr<Promise<std::variant<double, CustomError>>> printFromFile(const std::string& file_path, double quality, std::optional<double> bottomPad) = 0;
|
|
83
|
+
virtual std::shared_ptr<Promise<std::variant<double, CustomError>>> printFromBase64(const std::string& base_64, double quality, std::optional<double> bottomPad) = 0;
|
|
84
|
+
virtual std::optional<CustomError> abort() = 0;
|
|
85
|
+
virtual bool isServiceBusy() = 0;
|
|
86
|
+
virtual bool isAuthenticated() = 0;
|
|
87
|
+
virtual bool hasCapability(Capabilities capability) = 0;
|
|
88
|
+
virtual void initialize(const std::string& activation_code) = 0;
|
|
89
|
+
virtual std::shared_ptr<Promise<std::variant<CustomError, TransactionResult>>> doPayment(const PaymentData& payment_data, const std::function<void(const std::string& /* event */)>& process_callback) = 0;
|
|
90
|
+
virtual std::shared_ptr<Promise<std::variant<CustomError, TransactionResult>>> voidPayment(const VoidPayData& void_data, const std::function<void(const std::string& /* event */)>& process_callback) = 0;
|
|
91
|
+
virtual std::variant<CustomError, TransactionResult> getLastApprovedTransaction() = 0;
|
|
92
|
+
|
|
93
|
+
protected:
|
|
94
|
+
// Hybrid Setup
|
|
95
|
+
void loadHybridMethods() override;
|
|
96
|
+
|
|
97
|
+
protected:
|
|
98
|
+
// Tag for logging
|
|
99
|
+
static constexpr auto TAG = "PosPagseguro";
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
} // namespace margelo::nitro::pospagseguro
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// InstallmentTypes.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2026 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
|
+
|
|
21
|
+
namespace margelo::nitro::pospagseguro {
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* An enum which can be represented as a JavaScript enum (InstallmentTypes).
|
|
25
|
+
*/
|
|
26
|
+
enum class InstallmentTypes {
|
|
27
|
+
NO_INSTALLMENT SWIFT_NAME(noInstallment) = 1,
|
|
28
|
+
SELLER_INSTALLMENT SWIFT_NAME(sellerInstallment) = 2,
|
|
29
|
+
BUYER_INSTALLMENT SWIFT_NAME(buyerInstallment) = 3,
|
|
30
|
+
} CLOSED_ENUM;
|
|
31
|
+
|
|
32
|
+
} // namespace margelo::nitro::pospagseguro
|
|
33
|
+
|
|
34
|
+
namespace margelo::nitro {
|
|
35
|
+
|
|
36
|
+
// C++ InstallmentTypes <> JS InstallmentTypes (enum)
|
|
37
|
+
template <>
|
|
38
|
+
struct JSIConverter<margelo::nitro::pospagseguro::InstallmentTypes> final {
|
|
39
|
+
static inline margelo::nitro::pospagseguro::InstallmentTypes fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
40
|
+
int enumValue = JSIConverter<int>::fromJSI(runtime, arg);
|
|
41
|
+
return static_cast<margelo::nitro::pospagseguro::InstallmentTypes>(enumValue);
|
|
42
|
+
}
|
|
43
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, margelo::nitro::pospagseguro::InstallmentTypes arg) {
|
|
44
|
+
int enumValue = static_cast<int>(arg);
|
|
45
|
+
return JSIConverter<int>::toJSI(runtime, enumValue);
|
|
46
|
+
}
|
|
47
|
+
static inline bool canConvert(jsi::Runtime&, const jsi::Value& value) {
|
|
48
|
+
if (!value.isNumber()) {
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
double number = value.getNumber();
|
|
52
|
+
int integer = static_cast<int>(number);
|
|
53
|
+
if (number != integer) {
|
|
54
|
+
// The integer is not the same value as the double - we truncated floating points.
|
|
55
|
+
// Enums are all integers, so the input floating point number is obviously invalid.
|
|
56
|
+
return false;
|
|
57
|
+
}
|
|
58
|
+
// Check if we are within the bounds of the enum.
|
|
59
|
+
return integer >= 1 && integer <= 3;
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
} // namespace margelo::nitro
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// PaymentData.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2026 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
|
+
// Forward declaration of `InstallmentTypes` to properly resolve imports.
|
|
32
|
+
namespace margelo::nitro::pospagseguro { enum class InstallmentTypes; }
|
|
33
|
+
// Forward declaration of `PaymentTypes` to properly resolve imports.
|
|
34
|
+
namespace margelo::nitro::pospagseguro { enum class PaymentTypes; }
|
|
35
|
+
|
|
36
|
+
#include "InstallmentTypes.hpp"
|
|
37
|
+
#include <optional>
|
|
38
|
+
#include "PaymentTypes.hpp"
|
|
39
|
+
|
|
40
|
+
namespace margelo::nitro::pospagseguro {
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* A struct which can be represented as a JavaScript object (PaymentData).
|
|
44
|
+
*/
|
|
45
|
+
struct PaymentData final {
|
|
46
|
+
public:
|
|
47
|
+
double amount SWIFT_PRIVATE;
|
|
48
|
+
InstallmentTypes installment_type SWIFT_PRIVATE;
|
|
49
|
+
double installments SWIFT_PRIVATE;
|
|
50
|
+
std::optional<bool> print_receipt SWIFT_PRIVATE;
|
|
51
|
+
PaymentTypes type SWIFT_PRIVATE;
|
|
52
|
+
std::optional<double> user_reference SWIFT_PRIVATE;
|
|
53
|
+
|
|
54
|
+
public:
|
|
55
|
+
PaymentData() = default;
|
|
56
|
+
explicit PaymentData(double amount, InstallmentTypes installment_type, double installments, std::optional<bool> print_receipt, PaymentTypes type, std::optional<double> user_reference): amount(amount), installment_type(installment_type), installments(installments), print_receipt(print_receipt), type(type), user_reference(user_reference) {}
|
|
57
|
+
|
|
58
|
+
public:
|
|
59
|
+
friend bool operator==(const PaymentData& lhs, const PaymentData& rhs) = default;
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
} // namespace margelo::nitro::pospagseguro
|
|
63
|
+
|
|
64
|
+
namespace margelo::nitro {
|
|
65
|
+
|
|
66
|
+
// C++ PaymentData <> JS PaymentData (object)
|
|
67
|
+
template <>
|
|
68
|
+
struct JSIConverter<margelo::nitro::pospagseguro::PaymentData> final {
|
|
69
|
+
static inline margelo::nitro::pospagseguro::PaymentData fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
70
|
+
jsi::Object obj = arg.asObject(runtime);
|
|
71
|
+
return margelo::nitro::pospagseguro::PaymentData(
|
|
72
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "amount"))),
|
|
73
|
+
JSIConverter<margelo::nitro::pospagseguro::InstallmentTypes>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "installment_type"))),
|
|
74
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "installments"))),
|
|
75
|
+
JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "print_receipt"))),
|
|
76
|
+
JSIConverter<margelo::nitro::pospagseguro::PaymentTypes>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "type"))),
|
|
77
|
+
JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "user_reference")))
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::pospagseguro::PaymentData& arg) {
|
|
81
|
+
jsi::Object obj(runtime);
|
|
82
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "amount"), JSIConverter<double>::toJSI(runtime, arg.amount));
|
|
83
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "installment_type"), JSIConverter<margelo::nitro::pospagseguro::InstallmentTypes>::toJSI(runtime, arg.installment_type));
|
|
84
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "installments"), JSIConverter<double>::toJSI(runtime, arg.installments));
|
|
85
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "print_receipt"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.print_receipt));
|
|
86
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "type"), JSIConverter<margelo::nitro::pospagseguro::PaymentTypes>::toJSI(runtime, arg.type));
|
|
87
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "user_reference"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.user_reference));
|
|
88
|
+
return obj;
|
|
89
|
+
}
|
|
90
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
91
|
+
if (!value.isObject()) {
|
|
92
|
+
return false;
|
|
93
|
+
}
|
|
94
|
+
jsi::Object obj = value.getObject(runtime);
|
|
95
|
+
if (!nitro::isPlainObject(runtime, obj)) {
|
|
96
|
+
return false;
|
|
97
|
+
}
|
|
98
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "amount")))) return false;
|
|
99
|
+
if (!JSIConverter<margelo::nitro::pospagseguro::InstallmentTypes>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "installment_type")))) return false;
|
|
100
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "installments")))) return false;
|
|
101
|
+
if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "print_receipt")))) return false;
|
|
102
|
+
if (!JSIConverter<margelo::nitro::pospagseguro::PaymentTypes>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "type")))) return false;
|
|
103
|
+
if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "user_reference")))) return false;
|
|
104
|
+
return true;
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
} // namespace margelo::nitro
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// PaymentTypes.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2026 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
|
+
|
|
21
|
+
namespace margelo::nitro::pospagseguro {
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* An enum which can be represented as a JavaScript enum (PaymentTypes).
|
|
25
|
+
*/
|
|
26
|
+
enum class PaymentTypes {
|
|
27
|
+
CREDIT SWIFT_NAME(credit) = 1,
|
|
28
|
+
DEBIT SWIFT_NAME(debit) = 2,
|
|
29
|
+
VOUCHER SWIFT_NAME(voucher) = 3,
|
|
30
|
+
PIX SWIFT_NAME(pix) = 5,
|
|
31
|
+
} CLOSED_ENUM;
|
|
32
|
+
|
|
33
|
+
} // namespace margelo::nitro::pospagseguro
|
|
34
|
+
|
|
35
|
+
namespace margelo::nitro {
|
|
36
|
+
|
|
37
|
+
// C++ PaymentTypes <> JS PaymentTypes (enum)
|
|
38
|
+
template <>
|
|
39
|
+
struct JSIConverter<margelo::nitro::pospagseguro::PaymentTypes> final {
|
|
40
|
+
static inline margelo::nitro::pospagseguro::PaymentTypes fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
41
|
+
int enumValue = JSIConverter<int>::fromJSI(runtime, arg);
|
|
42
|
+
return static_cast<margelo::nitro::pospagseguro::PaymentTypes>(enumValue);
|
|
43
|
+
}
|
|
44
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, margelo::nitro::pospagseguro::PaymentTypes arg) {
|
|
45
|
+
int enumValue = static_cast<int>(arg);
|
|
46
|
+
return JSIConverter<int>::toJSI(runtime, enumValue);
|
|
47
|
+
}
|
|
48
|
+
static inline bool canConvert(jsi::Runtime&, const jsi::Value& value) {
|
|
49
|
+
if (!value.isNumber()) {
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
52
|
+
double number = value.getNumber();
|
|
53
|
+
int integer = static_cast<int>(number);
|
|
54
|
+
if (number != integer) {
|
|
55
|
+
// The integer is not the same value as the double - we truncated floating points.
|
|
56
|
+
// Enums are all integers, so the input floating point number is obviously invalid.
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
switch (integer) {
|
|
60
|
+
case 1 /* CREDIT */: return true;
|
|
61
|
+
case 2 /* DEBIT */: return true;
|
|
62
|
+
case 3 /* VOUCHER */: return true;
|
|
63
|
+
case 5 /* PIX */: return true;
|
|
64
|
+
default: return false;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
} // namespace margelo::nitro
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// SubAcquirer.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2026 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 <string>
|
|
34
|
+
|
|
35
|
+
namespace margelo::nitro::pospagseguro {
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* A struct which can be represented as a JavaScript object (SubAcquirer).
|
|
39
|
+
*/
|
|
40
|
+
struct SubAcquirer final {
|
|
41
|
+
public:
|
|
42
|
+
std::string name SWIFT_PRIVATE;
|
|
43
|
+
std::string address SWIFT_PRIVATE;
|
|
44
|
+
std::string city SWIFT_PRIVATE;
|
|
45
|
+
std::string uf SWIFT_PRIVATE;
|
|
46
|
+
std::string country SWIFT_PRIVATE;
|
|
47
|
+
std::string zip_code SWIFT_PRIVATE;
|
|
48
|
+
std::string mcc SWIFT_PRIVATE;
|
|
49
|
+
std::string cnpj_cpf SWIFT_PRIVATE;
|
|
50
|
+
std::string doc_type SWIFT_PRIVATE;
|
|
51
|
+
std::string telephone SWIFT_PRIVATE;
|
|
52
|
+
std::string full_name SWIFT_PRIVATE;
|
|
53
|
+
std::string merchant_id SWIFT_PRIVATE;
|
|
54
|
+
|
|
55
|
+
public:
|
|
56
|
+
SubAcquirer() = default;
|
|
57
|
+
explicit SubAcquirer(std::string name, std::string address, std::string city, std::string uf, std::string country, std::string zip_code, std::string mcc, std::string cnpj_cpf, std::string doc_type, std::string telephone, std::string full_name, std::string merchant_id): name(name), address(address), city(city), uf(uf), country(country), zip_code(zip_code), mcc(mcc), cnpj_cpf(cnpj_cpf), doc_type(doc_type), telephone(telephone), full_name(full_name), merchant_id(merchant_id) {}
|
|
58
|
+
|
|
59
|
+
public:
|
|
60
|
+
friend bool operator==(const SubAcquirer& lhs, const SubAcquirer& rhs) = default;
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
} // namespace margelo::nitro::pospagseguro
|
|
64
|
+
|
|
65
|
+
namespace margelo::nitro {
|
|
66
|
+
|
|
67
|
+
// C++ SubAcquirer <> JS SubAcquirer (object)
|
|
68
|
+
template <>
|
|
69
|
+
struct JSIConverter<margelo::nitro::pospagseguro::SubAcquirer> final {
|
|
70
|
+
static inline margelo::nitro::pospagseguro::SubAcquirer fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
71
|
+
jsi::Object obj = arg.asObject(runtime);
|
|
72
|
+
return margelo::nitro::pospagseguro::SubAcquirer(
|
|
73
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "name"))),
|
|
74
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "address"))),
|
|
75
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "city"))),
|
|
76
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "uf"))),
|
|
77
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "country"))),
|
|
78
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "zip_code"))),
|
|
79
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "mcc"))),
|
|
80
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "cnpj_cpf"))),
|
|
81
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "doc_type"))),
|
|
82
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "telephone"))),
|
|
83
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "full_name"))),
|
|
84
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "merchant_id")))
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::pospagseguro::SubAcquirer& arg) {
|
|
88
|
+
jsi::Object obj(runtime);
|
|
89
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "name"), JSIConverter<std::string>::toJSI(runtime, arg.name));
|
|
90
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "address"), JSIConverter<std::string>::toJSI(runtime, arg.address));
|
|
91
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "city"), JSIConverter<std::string>::toJSI(runtime, arg.city));
|
|
92
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "uf"), JSIConverter<std::string>::toJSI(runtime, arg.uf));
|
|
93
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "country"), JSIConverter<std::string>::toJSI(runtime, arg.country));
|
|
94
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "zip_code"), JSIConverter<std::string>::toJSI(runtime, arg.zip_code));
|
|
95
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "mcc"), JSIConverter<std::string>::toJSI(runtime, arg.mcc));
|
|
96
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "cnpj_cpf"), JSIConverter<std::string>::toJSI(runtime, arg.cnpj_cpf));
|
|
97
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "doc_type"), JSIConverter<std::string>::toJSI(runtime, arg.doc_type));
|
|
98
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "telephone"), JSIConverter<std::string>::toJSI(runtime, arg.telephone));
|
|
99
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "full_name"), JSIConverter<std::string>::toJSI(runtime, arg.full_name));
|
|
100
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "merchant_id"), JSIConverter<std::string>::toJSI(runtime, arg.merchant_id));
|
|
101
|
+
return obj;
|
|
102
|
+
}
|
|
103
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
104
|
+
if (!value.isObject()) {
|
|
105
|
+
return false;
|
|
106
|
+
}
|
|
107
|
+
jsi::Object obj = value.getObject(runtime);
|
|
108
|
+
if (!nitro::isPlainObject(runtime, obj)) {
|
|
109
|
+
return false;
|
|
110
|
+
}
|
|
111
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "name")))) return false;
|
|
112
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "address")))) return false;
|
|
113
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "city")))) return false;
|
|
114
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "uf")))) return false;
|
|
115
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "country")))) return false;
|
|
116
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "zip_code")))) return false;
|
|
117
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "mcc")))) return false;
|
|
118
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "cnpj_cpf")))) return false;
|
|
119
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "doc_type")))) return false;
|
|
120
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "telephone")))) return false;
|
|
121
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "full_name")))) return false;
|
|
122
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "merchant_id")))) return false;
|
|
123
|
+
return true;
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
} // namespace margelo::nitro
|