@jimrising/easymerchantsdk-react-native 1.1.6 → 1.1.7
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/README.md +13 -109
- package/SampleApp/App.js +1 -1
- package/SampleApp/ios/Podfile +1 -1
- package/SampleApp/ios/Pods/Pods.xcodeproj/project.pbxproj +603 -524
- package/SampleApp/ios/SampleApp/AppDelegate.mm +1 -1
- package/SampleApp/ios/SampleApp.xcworkspace/xcuserdata/appdev.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/SampleApp/node_modules/.package-lock.json +3 -2
- package/SampleApp/package-lock.json +3 -2
- package/SampleApp/package.json +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@ To add the path of sdk in your project. Open your `package.json` file and inside
|
|
|
8
8
|
```json
|
|
9
9
|
"dependencies": {
|
|
10
10
|
...
|
|
11
|
-
"@jimrising/easymerchantsdk-react-native": "^1.1.
|
|
11
|
+
"@jimrising/easymerchantsdk-react-native": "^1.1.7"
|
|
12
12
|
},
|
|
13
13
|
```
|
|
14
14
|
|
|
@@ -37,6 +37,7 @@ allprojects {
|
|
|
37
37
|
```
|
|
38
38
|
|
|
39
39
|
Now add below settings in AndroidManifest.xml file.
|
|
40
|
+
|
|
40
41
|
```xml
|
|
41
42
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
|
42
43
|
xmlns:tools="http://schemas.android.com/tools"> <!-- you need to add this-->
|
|
@@ -56,20 +57,18 @@ Now add below settings in AndroidManifest.xml file.
|
|
|
56
57
|
|
|
57
58
|
## Changes in IOS side.
|
|
58
59
|
|
|
59
|
-
###
|
|
60
|
-
No need to create any AppDelegate.swift File.
|
|
61
|
-
|
|
62
|
-
### If project is based on Swift :-
|
|
60
|
+
### Project is based on Swift :-
|
|
63
61
|
Add below content inside the AppDelegate.swift File :-
|
|
64
62
|
|
|
65
63
|
```swift
|
|
64
|
+
|
|
66
65
|
import UIKit
|
|
67
66
|
import easymerchantsdk
|
|
68
67
|
import React
|
|
69
68
|
|
|
70
69
|
@UIApplicationMain
|
|
71
70
|
class AppDelegate: UIResponder, UIApplicationDelegate {
|
|
72
|
-
var window: UIWindow?
|
|
71
|
+
var window: UIWindow?
|
|
73
72
|
|
|
74
73
|
func application(
|
|
75
74
|
_ application: UIApplication,
|
|
@@ -95,7 +94,7 @@ var window: UIWindow?
|
|
|
95
94
|
|
|
96
95
|
let rootView = RCTRootView(
|
|
97
96
|
bridge: validBridge,
|
|
98
|
-
moduleName: "EasyMerchantTestApp",
|
|
97
|
+
moduleName: "EasyMerchantTestApp",
|
|
99
98
|
initialProperties: nil
|
|
100
99
|
)
|
|
101
100
|
|
|
@@ -113,8 +112,8 @@ var window: UIWindow?
|
|
|
113
112
|
return true
|
|
114
113
|
}
|
|
115
114
|
}
|
|
116
|
-
```
|
|
117
115
|
|
|
116
|
+
```
|
|
118
117
|
|
|
119
118
|
### inside the PodFile add below
|
|
120
119
|
```pod
|
|
@@ -127,52 +126,11 @@ var window: UIWindow?
|
|
|
127
126
|
pod 'easymerchantsdk', :path => '../node_modules/@jimrising/easymerchantsdk-react-native/ios'
|
|
128
127
|
```
|
|
129
128
|
|
|
130
|
-
## Inside Xcode Open Pods
|
|
131
|
-
### Manually Adding .xib Files to Copy Bundle Resources
|
|
132
|
-
|
|
133
|
-
#### Steps to Add SavedAccountTVC.xib & SavedCardsTVC.xib
|
|
134
|
-
|
|
135
|
-
Step 1 : Open Xcode and Navigate to the Pods Project
|
|
136
|
-
|
|
137
|
-
Step 2 : Inside your main Xcode workspace, locate and expand the Pods project.
|
|
138
|
-
|
|
139
|
-
Step 3 : Select the easymerchantsdk-easymerchantsdk Target
|
|
140
|
-
In the Project Navigator, find and select the easymerchantsdk-easymerchantsdk target.
|
|
141
|
-
|
|
142
|
-
Step 4 : Go to Build Phases
|
|
143
|
-
|
|
144
|
-
Step 5 : In the project settings, switch to the Build Phases tab.
|
|
145
|
-
|
|
146
|
-
Add .xib Files to Copy Bundle Resources
|
|
147
|
-
|
|
148
|
-
Expand the Copy Bundle Resources section.
|
|
149
|
-
|
|
150
|
-
Click the "+" button and select the following files:
|
|
151
|
-
|
|
152
|
-
SavedAccountTVC.xib &
|
|
153
|
-
SavedCardsTVC.xib
|
|
154
|
-
|
|
155
|
-
Click Add to confirm.
|
|
156
|
-
|
|
157
|
-
Verify and Rebuild
|
|
158
|
-
|
|
159
|
-
Ensure the .xib files appear in Copy Bundle Resources.
|
|
160
|
-
|
|
161
|
-
Clean the build folder using:
|
|
162
|
-
|
|
163
|
-
Shift + Command + K
|
|
164
|
-
|
|
165
|
-
Rebuild the project using:
|
|
166
|
-
|
|
167
|
-
Command + B
|
|
168
|
-
|
|
169
129
|
|
|
170
130
|
## How to call the sdk in `App.js`.
|
|
171
131
|
you can call the sdk using below example:
|
|
172
|
-
|
|
173
|
-
|
|
132
|
+
t
|
|
174
133
|
```javascript
|
|
175
|
-
|
|
176
134
|
import React, { useState, useEffect } from 'react';
|
|
177
135
|
import { View, Text, Button, StyleSheet, NativeModules, Platform } from 'react-native';
|
|
178
136
|
|
|
@@ -183,13 +141,12 @@ const App = () => {
|
|
|
183
141
|
const [paymentResponse, setPaymentResponse] = useState('');
|
|
184
142
|
const [billingResult, setBillingResult] = useState('');
|
|
185
143
|
|
|
186
|
-
// Get the platform version of the device
|
|
187
144
|
const getPlatformVersion = async () => {
|
|
188
145
|
try {
|
|
189
146
|
if (Platform.OS === 'android') {
|
|
190
147
|
const platformVersion = await RNEasymerchantsdk.platformVersion();
|
|
191
148
|
setVersion(platformVersion);
|
|
192
|
-
} else if (Platform.OS === 'ios') {
|
|
149
|
+
} else if tttt(Platform.OS === 'ios') {
|
|
193
150
|
const version = await EasyMerchantSdk.getPlatformVersion();
|
|
194
151
|
setVersion(version);
|
|
195
152
|
}
|
|
@@ -198,27 +155,12 @@ const App = () => {
|
|
|
198
155
|
}
|
|
199
156
|
};
|
|
200
157
|
|
|
201
|
-
// Set the environment config for iOS
|
|
202
|
-
const configureEnvironment = async () => {
|
|
203
|
-
const apiKey = "mobilesdk1980IUuCzwWl";
|
|
204
|
-
const apiSecret = "mobilesdk1980LVHnN0Oh";
|
|
205
|
-
try {
|
|
206
|
-
if (Platform.OS === 'ios' && EasyMerchantSdk) {
|
|
207
|
-
await EasyMerchantSdk.configureEnvironment(apiKey, apiSecret);
|
|
208
|
-
console.log("EasyPay Environment Configured");
|
|
209
|
-
}
|
|
210
|
-
} catch (error) {
|
|
211
|
-
console.error("Error configuring environment:", error);
|
|
212
|
-
}
|
|
213
|
-
};
|
|
214
|
-
|
|
215
|
-
// Handle billing (payment process)
|
|
216
158
|
const handleBilling = async () => {
|
|
217
159
|
const amount = '100';
|
|
218
160
|
const additionalInfoRequest = {
|
|
219
161
|
name: "Test User",
|
|
220
162
|
email: "test@gmail.com",
|
|
221
|
-
phone_number: "
|
|
163
|
+
phone_number: "9465351125",
|
|
222
164
|
country_code: "91",
|
|
223
165
|
description: "Test"
|
|
224
166
|
};
|
|
@@ -227,7 +169,7 @@ const App = () => {
|
|
|
227
169
|
address: "Mohali, Punjab",
|
|
228
170
|
country: "India",
|
|
229
171
|
state: "Punjab",
|
|
230
|
-
city: "
|
|
172
|
+
city: "Anandpur Sahib",
|
|
231
173
|
postal_code: "140118",
|
|
232
174
|
additional_info: additionalInfoRequest
|
|
233
175
|
};
|
|
@@ -236,38 +178,10 @@ const App = () => {
|
|
|
236
178
|
|
|
237
179
|
try {
|
|
238
180
|
if (Platform.OS === 'android') {
|
|
239
|
-
|
|
240
|
-
const response = await RNEasymerchantsdk.billing(amount, jsonString, 'sandbox', 'apiKey', 'secretKey');
|
|
181
|
+
const response = await RNEasymerchantsdk.billing(amount, null);
|
|
241
182
|
setPaymentResponse(`Payment Success: ${response}`);
|
|
242
183
|
} else if (Platform.OS === 'ios') {
|
|
243
|
-
|
|
244
|
-
const themeConfiguration = {
|
|
245
|
-
bodyBackgroundColor: "#EEEFF2",
|
|
246
|
-
containerBackgroundColor: "#FFFF00",
|
|
247
|
-
primaryFontColor: "#000000",
|
|
248
|
-
secondaryFontColor: "#666666",
|
|
249
|
-
primaryButtonBackgroundColor: "#1757D9",
|
|
250
|
-
primaryButtonHoverColor: "#3A70DF",
|
|
251
|
-
primaryButtonFontColor: "#FFFFFF",
|
|
252
|
-
secondaryButtonBackgroundColor: "#FFFFFF",
|
|
253
|
-
secondaryButtonHoverColor: "#1757D9",
|
|
254
|
-
secondaryButtonFontColor: "#1757D9",
|
|
255
|
-
borderRadius: "8",
|
|
256
|
-
fontSize: "16"
|
|
257
|
-
};
|
|
258
|
-
|
|
259
|
-
const request = {
|
|
260
|
-
amount: 99,
|
|
261
|
-
billingInfoData: json,
|
|
262
|
-
paymentMethods: ['Card', 'Bank', 'Crypto'],
|
|
263
|
-
themeConfiguration: themeConfiguration,
|
|
264
|
-
tokenOnly: false,
|
|
265
|
-
saveCard: false,
|
|
266
|
-
saveAccount: false,
|
|
267
|
-
submitButtonText: "Submit"
|
|
268
|
-
};
|
|
269
|
-
|
|
270
|
-
const result = await EasyMerchantSdk.billing(request);
|
|
184
|
+
const result = await EasyMerchantSdk.billing(amount, jsonString);
|
|
271
185
|
setBillingResult(`Billing Success: ${result}`);
|
|
272
186
|
}
|
|
273
187
|
} catch (error) {
|
|
@@ -279,16 +193,13 @@ const App = () => {
|
|
|
279
193
|
}
|
|
280
194
|
};
|
|
281
195
|
|
|
282
|
-
// Set the ViewController for iOS (needs to be called once during app initialization)
|
|
283
196
|
useEffect(() => {
|
|
284
197
|
if (Platform.OS === 'ios') {
|
|
285
198
|
const initializeViewController = async () => {
|
|
286
199
|
if (EasyMerchantSdk && EasyMerchantSdk.setViewController) {
|
|
287
200
|
try {
|
|
288
|
-
// Assuming you want to pass the current view controller
|
|
289
201
|
await EasyMerchantSdk.setViewController();
|
|
290
202
|
console.log('ViewController set successfully');
|
|
291
|
-
configureEnvironment(); // Configure environment after setting view controller
|
|
292
203
|
} catch (error) {
|
|
293
204
|
console.error('Error setting ViewController:', error.message || error);
|
|
294
205
|
}
|
|
@@ -324,15 +235,8 @@ const styles = StyleSheet.create({
|
|
|
324
235
|
});
|
|
325
236
|
|
|
326
237
|
export default App;
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
238
|
```
|
|
332
239
|
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
240
|
You can send `null` if billing info not available.
|
|
337
241
|
|
|
338
242
|
|
package/SampleApp/App.js
CHANGED
|
@@ -13,7 +13,7 @@ const App = () => {
|
|
|
13
13
|
if (Platform.OS === 'android') {
|
|
14
14
|
const platformVersion = await RNEasymerchantsdk.platformVersion();
|
|
15
15
|
setVersion(platformVersion);
|
|
16
|
-
} else if (Platform.OS === 'ios') {
|
|
16
|
+
} else if tttt(Platform.OS === 'ios') {
|
|
17
17
|
const version = await EasyMerchantSdk.getPlatformVersion();
|
|
18
18
|
setVersion(version);
|
|
19
19
|
}
|
package/SampleApp/ios/Podfile
CHANGED
|
@@ -20,7 +20,7 @@ target 'SampleApp' do
|
|
|
20
20
|
:app_path => "#{Pod::Config.instance.installation_root}/.."
|
|
21
21
|
)
|
|
22
22
|
|
|
23
|
-
pod 'easymerchantsdk', :path => '../node_modules
|
|
23
|
+
pod 'easymerchantsdk', :path => '../node_modules/easymerchantsdk/ios'
|
|
24
24
|
|
|
25
25
|
target 'SampleAppTests' do
|
|
26
26
|
inherit! :complete
|