react-native-pos-pagseguro 1.2.0 → 1.2.2

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 (43) hide show
  1. package/README.md +1 -0
  2. package/android/libs/wrapper-1.33.0.aar +0 -0
  3. package/nitro.json +14 -5
  4. package/nitrogen/generated/android/c++/JCapabilities.hpp +1 -1
  5. package/nitrogen/generated/android/c++/JCardIssuerNationality.hpp +1 -1
  6. package/nitrogen/generated/android/c++/JCustomError.hpp +1 -1
  7. package/nitrogen/generated/android/c++/JCustomPrinterLayout.hpp +1 -1
  8. package/nitrogen/generated/android/c++/JFunc_void_std__string_PaymentEvent.hpp +2 -2
  9. package/nitrogen/generated/android/c++/JHybridPosPagseguroSpec.cpp +43 -49
  10. package/nitrogen/generated/android/c++/JHybridPosPagseguroSpec.hpp +19 -22
  11. package/nitrogen/generated/android/c++/JInstallment.hpp +1 -1
  12. package/nitrogen/generated/android/c++/JInstallmentTypes.hpp +1 -1
  13. package/nitrogen/generated/android/c++/JPaymentData.hpp +1 -1
  14. package/nitrogen/generated/android/c++/JPaymentEvent.hpp +1 -1
  15. package/nitrogen/generated/android/c++/JPaymentTypes.hpp +1 -1
  16. package/nitrogen/generated/android/c++/JPlugPagMode.hpp +1 -1
  17. package/nitrogen/generated/android/c++/JPlugPagOp.hpp +1 -1
  18. package/nitrogen/generated/android/c++/JStyleData.hpp +1 -1
  19. package/nitrogen/generated/android/c++/JSubAcquirer.hpp +1 -1
  20. package/nitrogen/generated/android/c++/JTransactionResult.hpp +1 -1
  21. package/nitrogen/generated/android/c++/JUserData.hpp +1 -1
  22. package/nitrogen/generated/android/c++/JVariant_CustomError_TransactionResult.hpp +3 -3
  23. package/nitrogen/generated/android/c++/JVariant_Double_CustomError.hpp +3 -3
  24. package/nitrogen/generated/android/c++/JVariant_String_Double.hpp +3 -3
  25. package/nitrogen/generated/android/c++/JVoidPayData.hpp +1 -1
  26. package/nitrogen/generated/android/c++/JVoidType.hpp +1 -1
  27. package/nitrogen/generated/android/kotlin/com/margelo/nitro/pospagseguro/CustomError.kt +15 -0
  28. package/nitrogen/generated/android/kotlin/com/margelo/nitro/pospagseguro/CustomPrinterLayout.kt +29 -0
  29. package/nitrogen/generated/android/kotlin/com/margelo/nitro/pospagseguro/HybridPosPagseguroSpec.kt +15 -18
  30. package/nitrogen/generated/android/kotlin/com/margelo/nitro/pospagseguro/Installment.kt +21 -0
  31. package/nitrogen/generated/android/kotlin/com/margelo/nitro/pospagseguro/PaymentData.kt +23 -0
  32. package/nitrogen/generated/android/kotlin/com/margelo/nitro/pospagseguro/StyleData.kt +39 -0
  33. package/nitrogen/generated/android/kotlin/com/margelo/nitro/pospagseguro/SubAcquirer.kt +35 -0
  34. package/nitrogen/generated/android/kotlin/com/margelo/nitro/pospagseguro/TransactionResult.kt +87 -0
  35. package/nitrogen/generated/android/kotlin/com/margelo/nitro/pospagseguro/UserData.kt +27 -0
  36. package/nitrogen/generated/android/kotlin/com/margelo/nitro/pospagseguro/Variant_CustomError_TransactionResult.kt +14 -11
  37. package/nitrogen/generated/android/kotlin/com/margelo/nitro/pospagseguro/Variant_Double_CustomError.kt +14 -11
  38. package/nitrogen/generated/android/kotlin/com/margelo/nitro/pospagseguro/Variant_String_Double.kt +14 -11
  39. package/nitrogen/generated/android/kotlin/com/margelo/nitro/pospagseguro/VoidPayData.kt +19 -0
  40. package/nitrogen/generated/android/pospagseguroOnLoad.cpp +27 -17
  41. package/nitrogen/generated/android/pospagseguroOnLoad.hpp +13 -4
  42. package/package.json +6 -9
  43. package/android/libs/wrapper-1.30.52.aar +0 -0
@@ -9,6 +9,7 @@ package com.margelo.nitro.pospagseguro
9
9
 
10
10
  import androidx.annotation.Keep
11
11
  import com.facebook.proguard.annotations.DoNotStrip
12
+ import java.util.Objects
12
13
 
13
14
 
14
15
  /**
@@ -47,6 +48,34 @@ data class CustomPrinterLayout(
47
48
  ) {
48
49
  /* primary constructor */
49
50
 
51
+ override fun equals(other: Any?): Boolean {
52
+ if (this === other) return true
53
+ if (other !is CustomPrinterLayout) return false
54
+ return Objects.deepEquals(this.title, other.title)
55
+ && Objects.deepEquals(this.title_color, other.title_color)
56
+ && Objects.deepEquals(this.confirm_text_color, other.confirm_text_color)
57
+ && Objects.deepEquals(this.cancel_text_color, other.cancel_text_color)
58
+ && Objects.deepEquals(this.window_background_color, other.window_background_color)
59
+ && Objects.deepEquals(this.button_background_color, other.button_background_color)
60
+ && Objects.deepEquals(this.button_background_color_disabled, other.button_background_color_disabled)
61
+ && Objects.deepEquals(this.send_sms_text_color, other.send_sms_text_color)
62
+ && Objects.deepEquals(this.max_time_show_popup, other.max_time_show_popup)
63
+ }
64
+
65
+ override fun hashCode(): Int {
66
+ return arrayOf<Any?>(
67
+ title,
68
+ title_color,
69
+ confirm_text_color,
70
+ cancel_text_color,
71
+ window_background_color,
72
+ button_background_color,
73
+ button_background_color_disabled,
74
+ send_sms_text_color,
75
+ max_time_show_popup
76
+ ).contentDeepHashCode()
77
+ }
78
+
50
79
  companion object {
51
80
  /**
52
81
  * Constructor called from C++
@@ -25,23 +25,6 @@ import com.margelo.nitro.core.HybridObject
25
25
  "LocalVariableName", "PropertyName", "PrivatePropertyName", "FunctionName"
26
26
  )
27
27
  abstract class HybridPosPagseguroSpec: HybridObject() {
28
- @DoNotStrip
29
- private var mHybridData: HybridData = initHybrid()
30
-
31
- init {
32
- super.updateNative(mHybridData)
33
- }
34
-
35
- override fun updateNative(hybridData: HybridData) {
36
- mHybridData = hybridData
37
- super.updateNative(hybridData)
38
- }
39
-
40
- // Default implementation of `HybridObject.toString()`
41
- override fun toString(): String {
42
- return "[HybridObject PosPagseguro]"
43
- }
44
-
45
28
  // Properties
46
29
 
47
30
 
@@ -140,7 +123,21 @@ abstract class HybridPosPagseguroSpec: HybridObject() {
140
123
  @Keep
141
124
  abstract fun setPrinterLayout(data: CustomPrinterLayout): Unit
142
125
 
143
- private external fun initHybrid(): HybridData
126
+ // Default implementation of `HybridObject.toString()`
127
+ override fun toString(): String {
128
+ return "[HybridObject PosPagseguro]"
129
+ }
130
+
131
+ // C++ backing class
132
+ @DoNotStrip
133
+ @Keep
134
+ protected open class CxxPart(javaPart: HybridPosPagseguroSpec): HybridObject.CxxPart(javaPart) {
135
+ // C++ JHybridPosPagseguroSpec::CxxPart::initHybrid(...)
136
+ external override fun initHybrid(): HybridData
137
+ }
138
+ override fun createCxxPart(): CxxPart {
139
+ return CxxPart(this)
140
+ }
144
141
 
145
142
  companion object {
146
143
  protected const val TAG = "HybridPosPagseguroSpec"
@@ -9,6 +9,7 @@ package com.margelo.nitro.pospagseguro
9
9
 
10
10
  import androidx.annotation.Keep
11
11
  import com.facebook.proguard.annotations.DoNotStrip
12
+ import java.util.Objects
12
13
 
13
14
 
14
15
  /**
@@ -35,6 +36,26 @@ data class Installment(
35
36
  ) {
36
37
  /* primary constructor */
37
38
 
39
+ override fun equals(other: Any?): Boolean {
40
+ if (this === other) return true
41
+ if (other !is Installment) return false
42
+ return Objects.deepEquals(this.quantity, other.quantity)
43
+ && Objects.deepEquals(this.amount, other.amount)
44
+ && Objects.deepEquals(this.total, other.total)
45
+ && Objects.deepEquals(this.formatted_amount, other.formatted_amount)
46
+ && Objects.deepEquals(this.formatted_total, other.formatted_total)
47
+ }
48
+
49
+ override fun hashCode(): Int {
50
+ return arrayOf<Any?>(
51
+ quantity,
52
+ amount,
53
+ total,
54
+ formatted_amount,
55
+ formatted_total
56
+ ).contentDeepHashCode()
57
+ }
58
+
38
59
  companion object {
39
60
  /**
40
61
  * Constructor called from C++
@@ -9,6 +9,7 @@ package com.margelo.nitro.pospagseguro
9
9
 
10
10
  import androidx.annotation.Keep
11
11
  import com.facebook.proguard.annotations.DoNotStrip
12
+ import java.util.Objects
12
13
 
13
14
 
14
15
  /**
@@ -38,6 +39,28 @@ data class PaymentData(
38
39
  ) {
39
40
  /* primary constructor */
40
41
 
42
+ override fun equals(other: Any?): Boolean {
43
+ if (this === other) return true
44
+ if (other !is PaymentData) return false
45
+ return Objects.deepEquals(this.amount, other.amount)
46
+ && Objects.deepEquals(this.installment_type, other.installment_type)
47
+ && Objects.deepEquals(this.installments, other.installments)
48
+ && Objects.deepEquals(this.print_receipt, other.print_receipt)
49
+ && Objects.deepEquals(this.type, other.type)
50
+ && Objects.deepEquals(this.user_reference, other.user_reference)
51
+ }
52
+
53
+ override fun hashCode(): Int {
54
+ return arrayOf<Any?>(
55
+ amount,
56
+ installment_type,
57
+ installments,
58
+ print_receipt,
59
+ type,
60
+ user_reference
61
+ ).contentDeepHashCode()
62
+ }
63
+
41
64
  companion object {
42
65
  /**
43
66
  * Constructor called from C++
@@ -9,6 +9,7 @@ package com.margelo.nitro.pospagseguro
9
9
 
10
10
  import androidx.annotation.Keep
11
11
  import com.facebook.proguard.annotations.DoNotStrip
12
+ import java.util.Objects
12
13
 
13
14
 
14
15
  /**
@@ -62,6 +63,44 @@ data class StyleData(
62
63
  ) {
63
64
  /* primary constructor */
64
65
 
66
+ override fun equals(other: Any?): Boolean {
67
+ if (this === other) return true
68
+ if (other !is StyleData) return false
69
+ return Objects.deepEquals(this.head_text_color, other.head_text_color)
70
+ && Objects.deepEquals(this.head_background_color, other.head_background_color)
71
+ && Objects.deepEquals(this.content_text_color, other.content_text_color)
72
+ && Objects.deepEquals(this.content_text_value1_color, other.content_text_value1_color)
73
+ && Objects.deepEquals(this.content_text_value2_color, other.content_text_value2_color)
74
+ && Objects.deepEquals(this.positive_button_text_color, other.positive_button_text_color)
75
+ && Objects.deepEquals(this.positive_button_background, other.positive_button_background)
76
+ && Objects.deepEquals(this.negative_button_text_color, other.negative_button_text_color)
77
+ && Objects.deepEquals(this.negative_button_background, other.negative_button_background)
78
+ && Objects.deepEquals(this.generic_button_background, other.generic_button_background)
79
+ && Objects.deepEquals(this.generic_button_text_color, other.generic_button_text_color)
80
+ && Objects.deepEquals(this.generic_sms_edit_text_background, other.generic_sms_edit_text_background)
81
+ && Objects.deepEquals(this.generic_sms_edit_text_text_color, other.generic_sms_edit_text_text_color)
82
+ && Objects.deepEquals(this.line_color, other.line_color)
83
+ }
84
+
85
+ override fun hashCode(): Int {
86
+ return arrayOf<Any?>(
87
+ head_text_color,
88
+ head_background_color,
89
+ content_text_color,
90
+ content_text_value1_color,
91
+ content_text_value2_color,
92
+ positive_button_text_color,
93
+ positive_button_background,
94
+ negative_button_text_color,
95
+ negative_button_background,
96
+ generic_button_background,
97
+ generic_button_text_color,
98
+ generic_sms_edit_text_background,
99
+ generic_sms_edit_text_text_color,
100
+ line_color
101
+ ).contentDeepHashCode()
102
+ }
103
+
65
104
  companion object {
66
105
  /**
67
106
  * Constructor called from C++
@@ -9,6 +9,7 @@ package com.margelo.nitro.pospagseguro
9
9
 
10
10
  import androidx.annotation.Keep
11
11
  import com.facebook.proguard.annotations.DoNotStrip
12
+ import java.util.Objects
12
13
 
13
14
 
14
15
  /**
@@ -56,6 +57,40 @@ data class SubAcquirer(
56
57
  ) {
57
58
  /* primary constructor */
58
59
 
60
+ override fun equals(other: Any?): Boolean {
61
+ if (this === other) return true
62
+ if (other !is SubAcquirer) return false
63
+ return Objects.deepEquals(this.name, other.name)
64
+ && Objects.deepEquals(this.address, other.address)
65
+ && Objects.deepEquals(this.city, other.city)
66
+ && Objects.deepEquals(this.uf, other.uf)
67
+ && Objects.deepEquals(this.country, other.country)
68
+ && Objects.deepEquals(this.zip_code, other.zip_code)
69
+ && Objects.deepEquals(this.mcc, other.mcc)
70
+ && Objects.deepEquals(this.cnpj_cpf, other.cnpj_cpf)
71
+ && Objects.deepEquals(this.doc_type, other.doc_type)
72
+ && Objects.deepEquals(this.telephone, other.telephone)
73
+ && Objects.deepEquals(this.full_name, other.full_name)
74
+ && Objects.deepEquals(this.merchant_id, other.merchant_id)
75
+ }
76
+
77
+ override fun hashCode(): Int {
78
+ return arrayOf<Any?>(
79
+ name,
80
+ address,
81
+ city,
82
+ uf,
83
+ country,
84
+ zip_code,
85
+ mcc,
86
+ cnpj_cpf,
87
+ doc_type,
88
+ telephone,
89
+ full_name,
90
+ merchant_id
91
+ ).contentDeepHashCode()
92
+ }
93
+
59
94
  companion object {
60
95
  /**
61
96
  * Constructor called from C++
@@ -9,6 +9,7 @@ package com.margelo.nitro.pospagseguro
9
9
 
10
10
  import androidx.annotation.Keep
11
11
  import com.facebook.proguard.annotations.DoNotStrip
12
+ import java.util.Objects
12
13
 
13
14
 
14
15
  /**
@@ -134,6 +135,92 @@ data class TransactionResult(
134
135
  ) {
135
136
  /* primary constructor */
136
137
 
138
+ override fun equals(other: Any?): Boolean {
139
+ if (this === other) return true
140
+ if (other !is TransactionResult) return false
141
+ return Objects.deepEquals(this.transaction_code, other.transaction_code)
142
+ && Objects.deepEquals(this.transaction_id, other.transaction_id)
143
+ && Objects.deepEquals(this.date, other.date)
144
+ && Objects.deepEquals(this.time, other.time)
145
+ && Objects.deepEquals(this.host_nsu, other.host_nsu)
146
+ && Objects.deepEquals(this.card_brand, other.card_brand)
147
+ && Objects.deepEquals(this.bin, other.bin)
148
+ && Objects.deepEquals(this.holder, other.holder)
149
+ && Objects.deepEquals(this.user_reference, other.user_reference)
150
+ && Objects.deepEquals(this.terminal_serial_number, other.terminal_serial_number)
151
+ && Objects.deepEquals(this.amount, other.amount)
152
+ && Objects.deepEquals(this.available_balance, other.available_balance)
153
+ && Objects.deepEquals(this.card_application, other.card_application)
154
+ && Objects.deepEquals(this.label, other.label)
155
+ && Objects.deepEquals(this.holder_name, other.holder_name)
156
+ && Objects.deepEquals(this.extended_holder_name, other.extended_holder_name)
157
+ && Objects.deepEquals(this.card_issuer_nationality, other.card_issuer_nationality)
158
+ && Objects.deepEquals(this.reader_model, other.reader_model)
159
+ && Objects.deepEquals(this.nsu, other.nsu)
160
+ && Objects.deepEquals(this.auto_code, other.auto_code)
161
+ && Objects.deepEquals(this.installments, other.installments)
162
+ && Objects.deepEquals(this.original_amount, other.original_amount)
163
+ && Objects.deepEquals(this.buyer_name, other.buyer_name)
164
+ && Objects.deepEquals(this.payment_type, other.payment_type)
165
+ && Objects.deepEquals(this.type_transaction, other.type_transaction)
166
+ && Objects.deepEquals(this.app_identification, other.app_identification)
167
+ && Objects.deepEquals(this.card_hash, other.card_hash)
168
+ && Objects.deepEquals(this.pre_auto_due_date, other.pre_auto_due_date)
169
+ && Objects.deepEquals(this.pre_auto_original_amount, other.pre_auto_original_amount)
170
+ && Objects.deepEquals(this.user_registered, other.user_registered)
171
+ && Objects.deepEquals(this.accumulated_value, other.accumulated_value)
172
+ && Objects.deepEquals(this.consumer_identification, other.consumer_identification)
173
+ && Objects.deepEquals(this.current_balance, other.current_balance)
174
+ && Objects.deepEquals(this.consumer_phone_number, other.consumer_phone_number)
175
+ && Objects.deepEquals(this.clube_pag_screens_ids, other.clube_pag_screens_ids)
176
+ && Objects.deepEquals(this.partial_pay_partially_authorized_amount, other.partial_pay_partially_authorized_amount)
177
+ && Objects.deepEquals(this.partial_pay_remaining_amount, other.partial_pay_remaining_amount)
178
+ && Objects.deepEquals(this.pix_tx_id_code, other.pix_tx_id_code)
179
+ }
180
+
181
+ override fun hashCode(): Int {
182
+ return arrayOf<Any?>(
183
+ transaction_code,
184
+ transaction_id,
185
+ date,
186
+ time,
187
+ host_nsu,
188
+ card_brand,
189
+ bin,
190
+ holder,
191
+ user_reference,
192
+ terminal_serial_number,
193
+ amount,
194
+ available_balance,
195
+ card_application,
196
+ label,
197
+ holder_name,
198
+ extended_holder_name,
199
+ card_issuer_nationality,
200
+ reader_model,
201
+ nsu,
202
+ auto_code,
203
+ installments,
204
+ original_amount,
205
+ buyer_name,
206
+ payment_type,
207
+ type_transaction,
208
+ app_identification,
209
+ card_hash,
210
+ pre_auto_due_date,
211
+ pre_auto_original_amount,
212
+ user_registered,
213
+ accumulated_value,
214
+ consumer_identification,
215
+ current_balance,
216
+ consumer_phone_number,
217
+ clube_pag_screens_ids,
218
+ partial_pay_partially_authorized_amount,
219
+ partial_pay_remaining_amount,
220
+ pix_tx_id_code
221
+ ).contentDeepHashCode()
222
+ }
223
+
137
224
  companion object {
138
225
  /**
139
226
  * Constructor called from C++
@@ -9,6 +9,7 @@ package com.margelo.nitro.pospagseguro
9
9
 
10
10
  import androidx.annotation.Keep
11
11
  import com.facebook.proguard.annotations.DoNotStrip
12
+ import java.util.Objects
12
13
 
13
14
 
14
15
  /**
@@ -44,6 +45,32 @@ data class UserData(
44
45
  ) {
45
46
  /* primary constructor */
46
47
 
48
+ override fun equals(other: Any?): Boolean {
49
+ if (this === other) return true
50
+ if (other !is UserData) return false
51
+ return Objects.deepEquals(this.address, other.address)
52
+ && Objects.deepEquals(this.city, other.city)
53
+ && Objects.deepEquals(this.cnpj_cpf, other.cnpj_cpf)
54
+ && Objects.deepEquals(this.address_complement, other.address_complement)
55
+ && Objects.deepEquals(this.company_name, other.company_name)
56
+ && Objects.deepEquals(this.nick_name, other.nick_name)
57
+ && Objects.deepEquals(this.address_state, other.address_state)
58
+ && Objects.deepEquals(this.email, other.email)
59
+ }
60
+
61
+ override fun hashCode(): Int {
62
+ return arrayOf<Any?>(
63
+ address,
64
+ city,
65
+ cnpj_cpf,
66
+ address_complement,
67
+ company_name,
68
+ nick_name,
69
+ address_state,
70
+ email
71
+ ).contentDeepHashCode()
72
+ }
73
+
47
74
  companion object {
48
75
  /**
49
76
  * Constructor called from C++
@@ -21,10 +21,20 @@ sealed class Variant_CustomError_TransactionResult {
21
21
  @DoNotStrip
22
22
  data class Second(@DoNotStrip val value: TransactionResult): Variant_CustomError_TransactionResult()
23
23
 
24
- @Deprecated("getAs() is not type-safe. Use fold/asFirstOrNull/asSecondOrNull instead.", level = DeprecationLevel.ERROR)
25
- inline fun <reified T> getAs(): T? = when (this) {
26
- is First -> value as? T
27
- is Second -> value as? T
24
+ inline fun <reified T> asType(): T? {
25
+ return when (this) {
26
+ is First -> (value) as? T
27
+ is Second -> (value) as? T
28
+ }
29
+ }
30
+ inline fun <reified T> isType(): Boolean {
31
+ return asType<T>() != null
32
+ }
33
+ inline fun <R> match(first: (CustomError) -> R, second: (TransactionResult) -> R): R {
34
+ return when (this) {
35
+ is First -> first(value)
36
+ is Second -> second(value)
37
+ }
28
38
  }
29
39
 
30
40
  val isFirst: Boolean
@@ -41,13 +51,6 @@ sealed class Variant_CustomError_TransactionResult {
41
51
  return value
42
52
  }
43
53
 
44
- inline fun <R> match(first: (CustomError) -> R, second: (TransactionResult) -> R): R {
45
- return when (this) {
46
- is First -> first(value)
47
- is Second -> second(value)
48
- }
49
- }
50
-
51
54
  companion object {
52
55
  @JvmStatic
53
56
  @DoNotStrip
@@ -21,10 +21,20 @@ sealed class Variant_Double_CustomError {
21
21
  @DoNotStrip
22
22
  data class Second(@DoNotStrip val value: CustomError): Variant_Double_CustomError()
23
23
 
24
- @Deprecated("getAs() is not type-safe. Use fold/asFirstOrNull/asSecondOrNull instead.", level = DeprecationLevel.ERROR)
25
- inline fun <reified T> getAs(): T? = when (this) {
26
- is First -> value as? T
27
- is Second -> value as? T
24
+ inline fun <reified T> asType(): T? {
25
+ return when (this) {
26
+ is First -> (value) as? T
27
+ is Second -> (value) as? T
28
+ }
29
+ }
30
+ inline fun <reified T> isType(): Boolean {
31
+ return asType<T>() != null
32
+ }
33
+ inline fun <R> match(first: (Double) -> R, second: (CustomError) -> R): R {
34
+ return when (this) {
35
+ is First -> first(value)
36
+ is Second -> second(value)
37
+ }
28
38
  }
29
39
 
30
40
  val isFirst: Boolean
@@ -41,13 +51,6 @@ sealed class Variant_Double_CustomError {
41
51
  return value
42
52
  }
43
53
 
44
- inline fun <R> match(first: (Double) -> R, second: (CustomError) -> R): R {
45
- return when (this) {
46
- is First -> first(value)
47
- is Second -> second(value)
48
- }
49
- }
50
-
51
54
  companion object {
52
55
  @JvmStatic
53
56
  @DoNotStrip
@@ -21,10 +21,20 @@ sealed class Variant_String_Double {
21
21
  @DoNotStrip
22
22
  data class Second(@DoNotStrip val value: Double): Variant_String_Double()
23
23
 
24
- @Deprecated("getAs() is not type-safe. Use fold/asFirstOrNull/asSecondOrNull instead.", level = DeprecationLevel.ERROR)
25
- inline fun <reified T> getAs(): T? = when (this) {
26
- is First -> value as? T
27
- is Second -> value as? T
24
+ inline fun <reified T> asType(): T? {
25
+ return when (this) {
26
+ is First -> (value) as? T
27
+ is Second -> (value) as? T
28
+ }
29
+ }
30
+ inline fun <reified T> isType(): Boolean {
31
+ return asType<T>() != null
32
+ }
33
+ inline fun <R> match(first: (String) -> R, second: (Double) -> R): R {
34
+ return when (this) {
35
+ is First -> first(value)
36
+ is Second -> second(value)
37
+ }
28
38
  }
29
39
 
30
40
  val isFirst: Boolean
@@ -41,13 +51,6 @@ sealed class Variant_String_Double {
41
51
  return value
42
52
  }
43
53
 
44
- inline fun <R> match(first: (String) -> R, second: (Double) -> R): R {
45
- return when (this) {
46
- is First -> first(value)
47
- is Second -> second(value)
48
- }
49
- }
50
-
51
54
  companion object {
52
55
  @JvmStatic
53
56
  @DoNotStrip
@@ -9,6 +9,7 @@ package com.margelo.nitro.pospagseguro
9
9
 
10
10
  import androidx.annotation.Keep
11
11
  import com.facebook.proguard.annotations.DoNotStrip
12
+ import java.util.Objects
12
13
 
13
14
 
14
15
  /**
@@ -32,6 +33,24 @@ data class VoidPayData(
32
33
  ) {
33
34
  /* primary constructor */
34
35
 
36
+ override fun equals(other: Any?): Boolean {
37
+ if (this === other) return true
38
+ if (other !is VoidPayData) return false
39
+ return Objects.deepEquals(this.transaction_code, other.transaction_code)
40
+ && Objects.deepEquals(this.transaction_id, other.transaction_id)
41
+ && Objects.deepEquals(this.print_receipt, other.print_receipt)
42
+ && Objects.deepEquals(this.void_type, other.void_type)
43
+ }
44
+
45
+ override fun hashCode(): Int {
46
+ return arrayOf<Any?>(
47
+ transaction_code,
48
+ transaction_id,
49
+ print_receipt,
50
+ void_type
51
+ ).contentDeepHashCode()
52
+ }
53
+
35
54
  companion object {
36
55
  /**
37
56
  * Constructor called from C++
@@ -22,25 +22,35 @@
22
22
  namespace margelo::nitro::pospagseguro {
23
23
 
24
24
  int initialize(JavaVM* vm) {
25
+ return facebook::jni::initialize(vm, []() {
26
+ ::margelo::nitro::pospagseguro::registerAllNatives();
27
+ });
28
+ }
29
+
30
+ struct JHybridPosPagseguroSpecImpl: public jni::JavaClass<JHybridPosPagseguroSpecImpl, JHybridPosPagseguroSpec::JavaPart> {
31
+ static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/pospagseguro/PosPagseguro;";
32
+ static std::shared_ptr<JHybridPosPagseguroSpec> create() {
33
+ static const auto constructorFn = javaClassStatic()->getConstructor<JHybridPosPagseguroSpecImpl::javaobject()>();
34
+ jni::local_ref<JHybridPosPagseguroSpec::JavaPart> javaPart = javaClassStatic()->newObject(constructorFn);
35
+ return javaPart->getJHybridPosPagseguroSpec();
36
+ }
37
+ };
38
+
39
+ void registerAllNatives() {
25
40
  using namespace margelo::nitro;
26
41
  using namespace margelo::nitro::pospagseguro;
27
- using namespace facebook;
28
-
29
- return facebook::jni::initialize(vm, [] {
30
- // Register native JNI methods
31
- margelo::nitro::pospagseguro::JHybridPosPagseguroSpec::registerNatives();
32
- margelo::nitro::pospagseguro::JFunc_void_std__string_PaymentEvent_cxx::registerNatives();
33
-
34
- // Register Nitro Hybrid Objects
35
- HybridObjectRegistry::registerHybridObjectConstructor(
36
- "PosPagseguro",
37
- []() -> std::shared_ptr<HybridObject> {
38
- static DefaultConstructableObject<JHybridPosPagseguroSpec::javaobject> object("com/margelo/nitro/pospagseguro/PosPagseguro");
39
- auto instance = object.create();
40
- return instance->cthis()->shared();
41
- }
42
- );
43
- });
42
+
43
+ // Register native JNI methods
44
+ margelo::nitro::pospagseguro::JHybridPosPagseguroSpec::CxxPart::registerNatives();
45
+ margelo::nitro::pospagseguro::JFunc_void_std__string_PaymentEvent_cxx::registerNatives();
46
+
47
+ // Register Nitro Hybrid Objects
48
+ HybridObjectRegistry::registerHybridObjectConstructor(
49
+ "PosPagseguro",
50
+ []() -> std::shared_ptr<HybridObject> {
51
+ return JHybridPosPagseguroSpecImpl::create();
52
+ }
53
+ );
44
54
  }
45
55
 
46
56
  } // namespace margelo::nitro::pospagseguro
@@ -6,20 +6,29 @@
6
6
  ///
7
7
 
8
8
  #include <jni.h>
9
+ #include <functional>
9
10
  #include <NitroModules/NitroDefines.hpp>
10
11
 
11
12
  namespace margelo::nitro::pospagseguro {
12
13
 
14
+ [[deprecated("Use registerNatives() instead.")]]
15
+ int initialize(JavaVM* vm);
16
+
13
17
  /**
14
- * Initializes the native (C++) part of pospagseguro, and autolinks all Hybrid Objects.
15
- * Call this in your `JNI_OnLoad` function (probably inside `cpp-adapter.cpp`).
18
+ * Register the native (C++) part of pospagseguro, and autolinks all Hybrid Objects.
19
+ * Call this in your `JNI_OnLoad` function (probably inside `cpp-adapter.cpp`),
20
+ * inside a `facebook::jni::initialize(vm, ...)` call.
16
21
  * Example:
17
22
  * ```cpp (cpp-adapter.cpp)
18
23
  * JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void*) {
19
- * return margelo::nitro::pospagseguro::initialize(vm);
24
+ * return facebook::jni::initialize(vm, []() {
25
+ * // register all pospagseguro HybridObjects
26
+ * margelo::nitro::pospagseguro::registerNatives();
27
+ * // any other custom registrations go here.
28
+ * });
20
29
  * }
21
30
  * ```
22
31
  */
23
- int initialize(JavaVM* vm);
32
+ void registerAllNatives();
24
33
 
25
34
  } // namespace margelo::nitro::pospagseguro