judokit-react-native 4.1.3 → 4.2.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.
Files changed (101) hide show
  1. package/JudoKit-ReactNative.podspec +42 -0
  2. package/LICENSE +1 -2
  3. package/README.md +106 -119
  4. package/android/build.gradle +65 -202
  5. package/android/gradle.properties +6 -1
  6. package/android/src/main/AndroidManifest.xml +2 -2
  7. package/android/src/main/AndroidManifestNew.xml +2 -0
  8. package/android/src/main/java/com/judopay/judokit/reactnative/Extensions.kt +382 -0
  9. package/android/src/main/java/com/judopay/judokit/reactnative/Helpers.kt +653 -0
  10. package/android/src/main/java/com/judopay/judokit/reactnative/JudoActivityEventListener.kt +49 -0
  11. package/android/src/main/java/com/judopay/judokit/reactnative/JudoKitReactNativeModule.kt +238 -0
  12. package/android/src/main/java/com/judopay/judokit/reactnative/JudoKitReactNativePackage.kt +16 -0
  13. package/ios/{Classes/Extensions → Extensions}/NSDictionary+JudoConvert.h +1 -1
  14. package/ios/{Classes/Extensions → Extensions}/NSDictionary+JudoConvert.m +2 -2
  15. package/ios/{Classes/Extensions → Extensions}/NSException+JudoValidationExceptions.h +1 -1
  16. package/ios/{Classes/Extensions → Extensions}/NSException+JudoValidationExceptions.m +1 -1
  17. package/ios/{Classes/Extensions → Extensions}/UIColor+RNAdditions.h +1 -1
  18. package/ios/{Classes/Extensions → Extensions}/UIColor+RNAdditions.m +3 -3
  19. package/ios/{Classes/RNJudo.h → JudoKitReactNative.h} +12 -6
  20. package/ios/{Classes/RNJudo.m → JudoKitReactNative.mm} +83 -81
  21. package/ios/{Classes/RNTypes.h → RNTypes.h} +8 -2
  22. package/ios/{Classes/Wrappers → Wrappers}/RNApplePayWrappers.h +1 -1
  23. package/ios/{Classes/Wrappers → Wrappers}/RNApplePayWrappers.m +105 -4
  24. package/ios/{Classes/Wrappers → Wrappers}/RNWrappers.h +14 -14
  25. package/ios/{Classes/Wrappers → Wrappers}/RNWrappers.m +46 -25
  26. package/lib/commonjs/index.js +268 -0
  27. package/lib/commonjs/index.js.map +1 -0
  28. package/lib/commonjs/judo-kit/index.js +212 -0
  29. package/lib/commonjs/judo-kit/index.js.map +1 -0
  30. package/lib/commonjs/types/index.js +267 -0
  31. package/lib/commonjs/types/index.js.map +1 -0
  32. package/lib/commonjs/types/judo-apple-pay-configuration.js +49 -0
  33. package/lib/commonjs/types/judo-apple-pay-configuration.js.map +1 -0
  34. package/lib/commonjs/types/judo-configuration.js +71 -0
  35. package/lib/commonjs/types/judo-configuration.js.map +1 -0
  36. package/lib/commonjs/types/judo-google-pay-configuration.js +28 -0
  37. package/lib/commonjs/types/judo-google-pay-configuration.js.map +1 -0
  38. package/lib/module/index.js +6 -0
  39. package/lib/module/index.js.map +1 -0
  40. package/lib/module/judo-kit/index.js +205 -0
  41. package/lib/module/judo-kit/index.js.map +1 -0
  42. package/lib/module/types/index.js +8 -0
  43. package/lib/module/types/index.js.map +1 -0
  44. package/lib/module/types/judo-apple-pay-configuration.js +43 -0
  45. package/lib/module/types/judo-apple-pay-configuration.js.map +1 -0
  46. package/lib/module/types/judo-configuration.js +65 -0
  47. package/lib/module/types/judo-configuration.js.map +1 -0
  48. package/lib/module/types/judo-google-pay-configuration.js +22 -0
  49. package/lib/module/types/judo-google-pay-configuration.js.map +1 -0
  50. package/lib/typescript/src/index.d.ts +4 -0
  51. package/lib/typescript/src/index.d.ts.map +1 -0
  52. package/lib/typescript/src/judo-kit/index.d.ts +86 -0
  53. package/lib/typescript/src/judo-kit/index.d.ts.map +1 -0
  54. package/lib/typescript/src/types/index.d.ts +4 -0
  55. package/lib/typescript/src/types/index.d.ts.map +1 -0
  56. package/lib/typescript/src/types/judo-apple-pay-configuration.d.ts +75 -0
  57. package/lib/typescript/src/types/judo-apple-pay-configuration.d.ts.map +1 -0
  58. package/lib/typescript/src/types/judo-configuration.d.ts +236 -0
  59. package/lib/typescript/src/types/judo-configuration.d.ts.map +1 -0
  60. package/lib/typescript/src/types/judo-google-pay-configuration.d.ts +42 -0
  61. package/lib/typescript/src/types/judo-google-pay-configuration.d.ts.map +1 -0
  62. package/package.json +158 -79
  63. package/src/index.tsx +50 -0
  64. package/src/judo-kit/index.ts +262 -0
  65. package/src/types/index.ts +53 -0
  66. package/src/types/judo-apple-pay-configuration.ts +85 -0
  67. package/src/types/judo-configuration.ts +263 -0
  68. package/src/types/judo-google-pay-configuration.ts +47 -0
  69. package/JudoPay.tsx +0 -334
  70. package/RNJudopay.podspec +0 -24
  71. package/android/src/main/java/com/reactlibrary/Extensions.kt +0 -372
  72. package/android/src/main/java/com/reactlibrary/Helpers.kt +0 -606
  73. package/android/src/main/java/com/reactlibrary/JudoReactNativeActivityEventListener.kt +0 -48
  74. package/android/src/main/java/com/reactlibrary/JudoReactNativeModule.kt +0 -257
  75. package/android/src/main/java/com/reactlibrary/JudoReactNativePBBAManager.kt +0 -52
  76. package/android/src/main/java/com/reactlibrary/JudoReactNativePackage.kt +0 -14
  77. package/components/JudoPBBAButton.ts +0 -2
  78. package/ios/.xcode.env +0 -11
  79. package/ios/Classes/Views/RNPBBAButtonManager.m +0 -42
  80. package/ios/Classes/Wrappers/RNPBBAWrappers.h +0 -40
  81. package/ios/Classes/Wrappers/RNPBBAWrappers.m +0 -57
  82. package/ios/Podfile +0 -44
  83. package/ios/Podfile.lock +0 -572
  84. package/ios/RNJudo.xcodeproj/project.pbxproj +0 -703
  85. package/ios/RNJudo.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -7
  86. package/ios/RNJudo.xcodeproj/xcshareddata/xcschemes/RNJudo.xcscheme +0 -97
  87. package/ios/RNJudo.xcworkspace/contents.xcworkspacedata +0 -10
  88. package/ios/RNJudoTests/Info.plist +0 -22
  89. package/ios/RNJudoTests/MockConfiguration.json +0 -114
  90. package/ios/RNJudoTests/NSDictionaryConvertTests.m +0 -475
  91. package/ios/RNJudoTests/RNApplePayWrappersTests.m +0 -770
  92. package/ios/RNJudoTests/RNJudoTests.m +0 -37
  93. package/ios/RNJudoTests/RNMocks.h +0 -54
  94. package/ios/RNJudoTests/RNMocks.m +0 -55
  95. package/ios/RNJudoTests/RNPBBAWrappersTests.m +0 -121
  96. package/ios/RNJudoTests/RNThemeTests.m +0 -576
  97. package/ios/RNJudoTests/RNWrappersTests.m +0 -947
  98. package/types/JudoApplePayTypes.tsx +0 -59
  99. package/types/JudoGooglePayTypes.tsx +0 -47
  100. package/types/JudoPBBATypes.tsx +0 -7
  101. package/types/JudoTypes.tsx +0 -251
@@ -1,257 +0,0 @@
1
- package com.reactlibrary
2
-
3
- import android.content.BroadcastReceiver
4
- import android.content.Context
5
- import android.content.Intent
6
- import android.content.IntentFilter
7
- import androidx.fragment.app.FragmentActivity
8
- import androidx.localbroadcastmanager.content.LocalBroadcastManager
9
- import com.facebook.react.bridge.*
10
- import com.judopay.judokit.android.Judo
11
- import com.judopay.judokit.android.api.factory.JudoApiServiceFactory
12
- import com.judopay.judokit.android.api.model.response.JudoApiCallResult
13
- import com.judopay.judokit.android.api.model.response.Receipt
14
- import com.judopay.judokit.android.api.model.response.toJudoResult
15
- import com.judopay.judokit.android.model.*
16
- import com.judopay.judokit.android.service.CardTransactionManager
17
- import com.judopay.judokit.android.service.CardTransactionManagerResultListener
18
- import com.judopay.judokit.android.ui.common.BR_PBBA_RESULT
19
- import com.judopay.judokit.android.ui.common.PBBA_RESULT
20
- import com.judopay.judokit.android.ui.common.isBankingAppAvailable
21
- import retrofit2.Call
22
- import retrofit2.Callback
23
- import retrofit2.Response
24
-
25
- const val JUDO_PAYMENT_WIDGET_REQUEST_CODE = 65520
26
- const val JUDO_PROMISE_REJECTION_CODE = "JUDO_ERROR"
27
- const val REQUEST_FAILED_MESSAGE = "The request was unsuccessful."
28
-
29
- class JudoReactNativeModule internal constructor(val context: ReactApplicationContext) :
30
- ReactContextBaseJavaModule(context), CardTransactionManagerResultListener {
31
-
32
- private val listener = JudoReactNativeActivityEventListener()
33
- internal var transactionPromise: Promise? = null
34
- private var isSubscribedToCardTransactionResults = false
35
-
36
- /**
37
- * A broadcast receiver to catch Pay by Bank app /order/bank/sale response event.
38
- */
39
- private val payByBankAppReceiver: BroadcastReceiver = object : BroadcastReceiver() {
40
- override fun onReceive(context: Context?, intent: Intent) {
41
- val pbbaSaleResult = intent.getParcelableExtra<JudoResult>(PBBA_RESULT)
42
- payByBankSalePromise.resolve(getMappedResult(pbbaSaleResult))
43
- }
44
- }
45
-
46
- init {
47
- context.addActivityEventListener(listener)
48
- LocalBroadcastManager.getInstance(context).registerReceiver(payByBankAppReceiver, IntentFilter(BR_PBBA_RESULT))
49
- }
50
-
51
- override fun getName() = "RNJudo"
52
-
53
- /**
54
- * Promise to make a callback from the first /order/bank/sale response of PbBa request.
55
- * Initialised in [invokePayByBankApp] or [invokePaymentMethodScreen].
56
- * Resolved in [payByBankAppReceiver].
57
- */
58
- private lateinit var payByBankSalePromise: Promise
59
-
60
- @ReactMethod
61
- fun invokeTransaction(options: ReadableMap, promise: Promise) {
62
- try {
63
- val judo = getTransactionConfiguration(options)
64
- startJudoActivity(judo, promise)
65
- } catch (error: Exception) {
66
- promise.reject(JUDO_PROMISE_REJECTION_CODE, error.localizedMessage, error)
67
- }
68
- }
69
-
70
- @ReactMethod
71
- fun invokeGooglePay(options: ReadableMap, promise: Promise) {
72
- try {
73
- val judo = getGoogleTransactionConfiguration(options)
74
- startJudoActivity(judo, promise)
75
- } catch (error: Exception) {
76
- promise.reject(JUDO_PROMISE_REJECTION_CODE, error.localizedMessage, error)
77
- }
78
- }
79
-
80
- @ReactMethod
81
- fun invokePayByBankApp(options: ReadableMap, promise: Promise) {
82
- try {
83
- val judo = getJudoConfiguration(PaymentWidgetType.PAY_BY_BANK_APP, options)
84
- payByBankSalePromise = promise
85
- startJudoActivity(judo, promise)
86
- } catch (error: Exception) {
87
- promise.reject(JUDO_PROMISE_REJECTION_CODE, error.localizedMessage, error)
88
- }
89
- }
90
-
91
- @ReactMethod
92
- fun invokePaymentMethodScreen(options: ReadableMap, promise: Promise) {
93
- try {
94
- val judo = getPaymentMethodsConfiguration(options)
95
- payByBankSalePromise = promise
96
- startJudoActivity(judo, promise)
97
- } catch (error: Exception) {
98
- promise.reject(JUDO_PROMISE_REJECTION_CODE, error.localizedMessage, error)
99
- }
100
- }
101
-
102
- @ReactMethod
103
- fun performTokenTransaction(options: ReadableMap, promise: Promise) {
104
- try {
105
- ensureIsSubscribedToCardTransactionResults()
106
-
107
- val activity = context.currentActivity as FragmentActivity
108
- val manager = CardTransactionManager.getInstance(activity)
109
-
110
- val judo = getTokenTransactionConfiguration(options)
111
- val cardToken = options.cardToken
112
-
113
- if (cardToken == null) {
114
- promise.reject(JUDO_PROMISE_REJECTION_CODE, "No card token found")
115
- return
116
- }
117
-
118
- manager.configureWith(judo)
119
-
120
- val details = TransactionDetails.Builder()
121
- .setCardHolderName(options.cardholderName)
122
- .setSecurityNumber(options.securityCode)
123
- .setCardType(options.cardType)
124
- .setCardToken(cardToken)
125
- .setEmail(judo.emailAddress)
126
- .setCountryCode(judo.address?.countryCode.toString())
127
- .setPhoneCountryCode(judo.phoneCountryCode)
128
- .setMobileNumber(judo.mobileNumber)
129
- .setAddressLine1(judo.address?.line1)
130
- .setAddressLine2(judo.address?.line2)
131
- .setAddressLine3(judo.address?.line3)
132
- .setCity(judo.address?.town)
133
- .setPostalCode(judo.address?.postCode)
134
- .build()
135
-
136
- transactionPromise = promise
137
-
138
- when (judo.paymentWidgetType) {
139
- PaymentWidgetType.CARD_PAYMENT -> manager.paymentWithToken(details, JudoReactNativeModule::class.java.name)
140
- PaymentWidgetType.PRE_AUTH -> manager.preAuthWithToken(details, JudoReactNativeModule::class.java.name)
141
- else -> promise.reject(JUDO_PROMISE_REJECTION_CODE, "${judo.paymentWidgetType.name} payment widget type is not valid for token transactions")
142
- }
143
- } catch (exception: Exception) {
144
- promise.reject(exception)
145
- }
146
- }
147
-
148
- @ReactMethod
149
- fun fetchTransactionDetails(options: ReadableMap, promise: Promise) {
150
- try {
151
- val judo = getJudoConfigurationForApiService(options)
152
- val receiptId = options.receiptId ?: ""
153
-
154
- val service = JudoApiServiceFactory.createApiService(context, judo)
155
-
156
- val fetchTransactionDetailsCallback = object : Callback<JudoApiCallResult<Receipt>> {
157
- override fun onResponse(
158
- call: Call<JudoApiCallResult<Receipt>>,
159
- response: Response<JudoApiCallResult<Receipt>>
160
- ) {
161
- when (val result = response.body()) {
162
- is JudoApiCallResult.Success -> {
163
- val receipt = result.data
164
- if (receipt != null) {
165
- val judoResult = receipt.toJudoResult()
166
- promise.resolve(getMappedResult(judoResult))
167
- } else {
168
- promise.reject(JUDO_PROMISE_REJECTION_CODE, REQUEST_FAILED_MESSAGE)
169
- }
170
- }
171
- is JudoApiCallResult.Failure -> {
172
- val message = result.error?.message ?: REQUEST_FAILED_MESSAGE
173
- promise.reject(JUDO_PROMISE_REJECTION_CODE, message)
174
- }
175
- else -> {
176
- promise.reject(JUDO_PROMISE_REJECTION_CODE, REQUEST_FAILED_MESSAGE)
177
- }
178
- }
179
- }
180
-
181
- override fun onFailure(
182
- call: Call<JudoApiCallResult<Receipt>>,
183
- throwable: Throwable
184
- ) {
185
- promise.reject(JUDO_PROMISE_REJECTION_CODE, throwable.localizedMessage, throwable)
186
- }
187
- }
188
-
189
- service
190
- .fetchTransactionWithReceiptId(receiptId)
191
- .enqueue(fetchTransactionDetailsCallback)
192
-
193
- } catch (error: Exception) {
194
- promise.reject(JUDO_PROMISE_REJECTION_CODE, error.localizedMessage, error)
195
- }
196
- }
197
-
198
- private fun ensureIsSubscribedToCardTransactionResults() {
199
- if (isSubscribedToCardTransactionResults) {
200
- return
201
- }
202
-
203
- val activity = context.currentActivity
204
- activity?.let {
205
- isSubscribedToCardTransactionResults = true
206
- CardTransactionManager.getInstance(activity as FragmentActivity).registerResultListener(this)
207
- }
208
- }
209
-
210
- private fun unsubscribeFromCardTransactionResults() {
211
- val activity = context.currentActivity
212
- activity?.let {
213
- isSubscribedToCardTransactionResults = false
214
- CardTransactionManager.getInstance(activity as FragmentActivity).unRegisterResultListener(this)
215
- }
216
- }
217
-
218
- override fun initialize() {
219
- super.initialize()
220
- ensureIsSubscribedToCardTransactionResults()
221
- }
222
-
223
- override fun invalidate() {
224
- super.invalidate()
225
- unsubscribeFromCardTransactionResults()
226
- }
227
-
228
- override fun onCardTransactionResult(result: JudoPaymentResult) {
229
- transactionPromise?.let {
230
- if (result is JudoPaymentResult.Success) {
231
- it.resolve(getMappedResult(result.result))
232
- } else {
233
- val message = when (result) {
234
- is JudoPaymentResult.Error -> result.error.message
235
- is JudoPaymentResult.UserCancelled -> result.error.message
236
- else -> "The transaction was unsuccessful"
237
- }
238
- it.reject(JUDO_PROMISE_REJECTION_CODE, message)
239
- }
240
- }
241
- }
242
-
243
- @ReactMethod
244
- fun isBankingAppAvailable(promise: Promise) {
245
- try {
246
- promise.resolve(isBankingAppAvailable(context))
247
- } catch (exception: Exception) {
248
- promise.reject(JUDO_PROMISE_REJECTION_CODE, exception.localizedMessage, exception)
249
- }
250
- }
251
-
252
- private fun startJudoActivity(configuration: Judo, promise: Promise) = currentActivity?.let {
253
- listener.transactionPromise = promise
254
- val intent = configuration.toJudoActivityIntent(it)
255
- it.startActivityForResult(intent, JUDO_PAYMENT_WIDGET_REQUEST_CODE)
256
- }
257
- }
@@ -1,52 +0,0 @@
1
- package com.reactlibrary
2
-
3
- import com.facebook.react.uimanager.SimpleViewManager
4
- import com.facebook.react.uimanager.ThemedReactContext
5
- import com.judopay.judokit.android.ui.common.PayByBankButton
6
- import com.facebook.react.bridge.Arguments
7
- import com.facebook.react.bridge.WritableMap
8
- import com.facebook.react.common.MapBuilder
9
- import com.facebook.react.uimanager.UIManagerHelper
10
- import com.facebook.react.uimanager.events.Event
11
-
12
- internal class OnPressEvent constructor(surfaceId: Int, viewId: Int):Event<OnPressEvent>(surfaceId, viewId) {
13
-
14
- override fun getEventName(): String = EVENT_NAME
15
-
16
- override fun getCoalescingKey(): Short = 0
17
-
18
- override fun getEventData(): WritableMap? = Arguments.createMap()
19
-
20
- companion object {
21
- const val EVENT_NAME = "onPress"
22
- }
23
- }
24
-
25
- class JudoReactNativePBBAManager: SimpleViewManager<PayByBankButton>() {
26
-
27
- override fun getName(): String {
28
- return "RNPBBAButton"
29
- }
30
-
31
- override fun createViewInstance(reactContext: ThemedReactContext): PayByBankButton {
32
- val button = PayByBankButton(reactContext)
33
- button.setOnClickListener {
34
- val screenContext = it.context as ThemedReactContext
35
- val eventDispatcher = UIManagerHelper.getEventDispatcherForReactTag(screenContext, it.id)
36
- eventDispatcher?.dispatchEvent(
37
- OnPressEvent(
38
- screenContext.surfaceId,
39
- it.id
40
- )
41
- )
42
- }
43
- return button
44
- }
45
-
46
- override fun getExportedCustomBubblingEventTypeConstants(): Map<String, Any> {
47
- return MapBuilder.of(
48
- OnPressEvent.EVENT_NAME,
49
- MapBuilder.of("registrationName", "onPress"),
50
- )
51
- }
52
- }
@@ -1,14 +0,0 @@
1
- package com.reactlibrary
2
-
3
- import com.facebook.react.ReactPackage
4
- import com.facebook.react.bridge.ReactApplicationContext
5
-
6
- @Suppress("unused")
7
- class JudoReactNativePackage : ReactPackage {
8
-
9
- override fun createNativeModules(reactContext: ReactApplicationContext) =
10
- listOf(JudoReactNativeModule(reactContext))
11
-
12
- override fun createViewManagers(reactContext: ReactApplicationContext) =
13
- listOf(JudoReactNativePBBAManager())
14
- }
@@ -1,2 +0,0 @@
1
- import { requireNativeComponent } from 'react-native'
2
- export default requireNativeComponent('RNPBBAButton')
package/ios/.xcode.env DELETED
@@ -1,11 +0,0 @@
1
- # This `.xcode.env` file is versioned and is used to source the environment
2
- # used when running script phases inside Xcode.
3
- # To customize your local environment, you can create an `.xcode.env.local`
4
- # file that is not versioned.
5
-
6
- # NODE_BINARY variable contains the PATH to the node executable.
7
- #
8
- # Customize the NODE_BINARY variable here.
9
- # For example, to use nvm with brew, add the following line
10
- # . "$(brew --prefix nvm)/nvm.sh" --no-use
11
- export NODE_BINARY=$(command -v node)
@@ -1,42 +0,0 @@
1
- //
2
- // RNPBBAButtonManager.h
3
- // RNJudo
4
- //
5
- // Copyright (c) 2020 Alternative Payments Ltd
6
- //
7
- // Permission is hereby granted, free of charge, to any person obtaining a copy
8
- // of this software and associated documentation files (the "Software"), to deal
9
- // in the Software without restriction, including without limitation the rights
10
- // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
- // copies of the Software, and to permit persons to whom the Software is
12
- // furnished to do so, subject to the following conditions:
13
- //
14
- // The above copyright notice and this permission notice shall be included in all
15
- // copies or substantial portions of the Software.
16
- //
17
- // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
- // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
- // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
- // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
- // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
- // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
- // SOFTWARE.
24
-
25
- #import <React/RCTViewManager.h>
26
- #import <JudoKit-iOS/JudoKit_iOS.h>
27
-
28
- @interface RNPBBAButtonManager: RCTViewManager
29
- @end
30
-
31
- @implementation RNPBBAButtonManager
32
-
33
- static double const kPBBAButtonWidth = 310.0f;
34
- static double const kPBBAButtonHeight = 50.0f;
35
-
36
- RCT_EXPORT_MODULE(RNPBBAButton)
37
-
38
- - (UIView *)view {
39
- return [[JPPBBAButton alloc] initWithFrame:CGRectMake(0, 0, kPBBAButtonWidth, kPBBAButtonHeight)];
40
- }
41
-
42
- @end
@@ -1,40 +0,0 @@
1
- //
2
- // RNPBBAWrappers.h
3
- // RNJudo
4
- //
5
- // Copyright (c) 2020 Alternative Payments Ltd
6
- //
7
- // Permission is hereby granted, free of charge, to any person obtaining a copy
8
- // of this software and associated documentation files (the "Software"), to deal
9
- // in the Software without restriction, including without limitation the rights
10
- // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
- // copies of the Software, and to permit persons to whom the Software is
12
- // furnished to do so, subject to the following conditions:
13
- //
14
- // The above copyright notice and this permission notice shall be included in all
15
- // copies or substantial portions of the Software.
16
- //
17
- // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
- // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
- // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
- // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
- // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
- // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
- // SOFTWARE.
24
-
25
- #import <JudoKit-iOS/JudoKit_iOS.h>
26
-
27
- @interface RNPBBAWrappers : NSObject
28
-
29
- /**
30
- * A method that returns a configured JPPBBAConfiguration instance based on the passed dictionary parameters.
31
- * The JPPBBAConfiguration instance sets the required parameters for making PBBA transactions.
32
- *
33
- * @param configuration - an NSDictionary that contains the complete configuration properties set by the merchant
34
- *
35
- * @returns a configured JPPBBAConfiguration instance
36
- */
37
- + (JPPBBAConfiguration *)pbbaConfigurationFromConfiguration:(NSDictionary *)configuration;
38
-
39
- @end
40
-
@@ -1,57 +0,0 @@
1
- //
2
- // RNPBBAWrappers.m
3
- // RNJudo
4
- //
5
- // Copyright (c) 2020 Alternative Payments Ltd
6
- //
7
- // Permission is hereby granted, free of charge, to any person obtaining a copy
8
- // of this software and associated documentation files (the "Software"), to deal
9
- // in the Software without restriction, including without limitation the rights
10
- // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
- // copies of the Software, and to permit persons to whom the Software is
12
- // furnished to do so, subject to the following conditions:
13
- //
14
- // The above copyright notice and this permission notice shall be included in all
15
- // copies or substantial portions of the Software.
16
- //
17
- // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
- // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
- // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
- // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
- // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
- // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
- // SOFTWARE.
24
-
25
- #import "RNPBBAWrappers.h"
26
- #import "NSDictionary+JudoConvert.h"
27
-
28
- //TODO: iOS Project should add this to the JudoKit-iOS header
29
- #import <JudoKit-iOS/JPPBBAConfiguration.h>
30
-
31
- @implementation RNPBBAWrappers
32
-
33
- + (JPPBBAConfiguration *)pbbaConfigurationFromConfiguration:(NSDictionary *)configuration {
34
- NSDictionary *dictionary = [configuration optionalDictionaryForKey:@"pbbaConfiguration"];
35
-
36
- if (!dictionary) {
37
- return nil;
38
- }
39
-
40
- NSString *mobileNumber = [dictionary optionalStringForKey:@"mobileNumber"];
41
- NSString *emailAddress = [dictionary optionalStringForKey:@"emailAddress"];
42
- NSString *appearsOnStatement = [dictionary optionalStringForKey:@"appearsOnStatement"];
43
- NSString *deeplinkScheme = [dictionary optionalStringForKey:@"deeplinkScheme"];
44
- NSString *deeplinkURLString = [dictionary optionalStringForKey:@"deeplinkURL"];
45
-
46
- JPPBBAConfiguration *config = [JPPBBAConfiguration new];
47
-
48
- config.mobileNumber = mobileNumber;
49
- config.emailAddress = emailAddress;
50
- config.appearsOnStatement = appearsOnStatement;
51
- config.deeplinkURL = [NSURL URLWithString:deeplinkURLString];
52
- config.deeplinkScheme = deeplinkScheme;
53
-
54
- return config;
55
- }
56
-
57
- @end
package/ios/Podfile DELETED
@@ -1,44 +0,0 @@
1
- require_relative '../node_modules/react-native/scripts/react_native_pods'
2
- require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
3
-
4
- platform :ios, '12.4'
5
- install! 'cocoapods', :deterministic_uuids => false
6
-
7
- production = ENV["PRODUCTION"] == "1"
8
-
9
- target 'RNJudo' do
10
- config = use_native_modules!
11
-
12
- # Flags change depending on the env values.
13
- flags = get_default_flags()
14
-
15
- use_react_native!(
16
- :path => config[:reactNativePath],
17
- # to enable hermes on iOS, change `false` to `true` and then install pods
18
- :production => production,
19
- :hermes_enabled => flags[:hermes_enabled],
20
- :fabric_enabled => flags[:fabric_enabled],
21
- :flipper_configuration => FlipperConfiguration.enabled,
22
- # An absolute path to your application root.
23
- :app_path => "#{Pod::Config.instance.installation_root}/.."
24
- )
25
-
26
- # Pods for RNJudo
27
- pod "JudoKit-iOS", "3.2.5"
28
-
29
- target 'RNJudoTests' do
30
- inherit! :complete
31
- requires_app_host = true
32
- # Pods for testing
33
- end
34
-
35
- post_install do |installer|
36
- react_native_post_install(installer)
37
- __apply_Xcode_12_5_M1_post_install_workaround(installer)
38
-
39
- installer.pods_project.build_configurations.each do |config|
40
- # https://khushwanttanwar.medium.com/xcode-12-compilation-errors-while-running-with-ios-14-simulators-5731c91326e9
41
- config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
42
- end
43
- end
44
- end