@jimrising/easymerchantsdk-react-native 1.1.3 → 1.1.4
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 +47 -4
- package/ios/easymerchantsdk.podspec +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -8,15 +8,15 @@ 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.4"
|
|
12
12
|
},
|
|
13
13
|
```
|
|
14
|
+
|
|
14
15
|
or using command
|
|
15
16
|
```cmd
|
|
16
17
|
npm i easymerchantsdk-react-native
|
|
17
18
|
```
|
|
18
19
|
|
|
19
|
-
|
|
20
20
|
## Changes in android side.
|
|
21
21
|
Now open your `android` folder and there is a `build.gradle` file. Open it and add the below code in it.
|
|
22
22
|
```gradle
|
|
@@ -172,6 +172,7 @@ you can call the sdk using below example:
|
|
|
172
172
|
|
|
173
173
|
|
|
174
174
|
```javascript
|
|
175
|
+
|
|
175
176
|
import React, { useState, useEffect } from 'react';
|
|
176
177
|
import { View, Text, Button, StyleSheet, NativeModules, Platform } from 'react-native';
|
|
177
178
|
|
|
@@ -197,6 +198,20 @@ const App = () => {
|
|
|
197
198
|
}
|
|
198
199
|
};
|
|
199
200
|
|
|
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
|
+
|
|
200
215
|
// Handle billing (payment process)
|
|
201
216
|
const handleBilling = async () => {
|
|
202
217
|
const amount = '100';
|
|
@@ -225,8 +240,34 @@ const App = () => {
|
|
|
225
240
|
const response = await RNEasymerchantsdk.billing(amount, jsonString, 'sandbox', 'apiKey', 'secretKey');
|
|
226
241
|
setPaymentResponse(`Payment Success: ${response}`);
|
|
227
242
|
} else if (Platform.OS === 'ios') {
|
|
228
|
-
//
|
|
229
|
-
const
|
|
243
|
+
// Create payment request for iOS with additional info and theme
|
|
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);
|
|
230
271
|
setBillingResult(`Billing Success: ${result}`);
|
|
231
272
|
}
|
|
232
273
|
} catch (error) {
|
|
@@ -247,6 +288,7 @@ const App = () => {
|
|
|
247
288
|
// Assuming you want to pass the current view controller
|
|
248
289
|
await EasyMerchantSdk.setViewController();
|
|
249
290
|
console.log('ViewController set successfully');
|
|
291
|
+
configureEnvironment(); // Configure environment after setting view controller
|
|
250
292
|
} catch (error) {
|
|
251
293
|
console.error('Error setting ViewController:', error.message || error);
|
|
252
294
|
}
|
|
@@ -285,6 +327,7 @@ export default App;
|
|
|
285
327
|
|
|
286
328
|
|
|
287
329
|
|
|
330
|
+
|
|
288
331
|
```
|
|
289
332
|
|
|
290
333
|
|