@jimrising/easymerchantsdk-react-native 1.0.0 → 1.0.1
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 +11 -69
- package/ios/Classes/EasyMerchantSdk.swift +0 -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
|
-
"easymerchantsdk-react-native": "^1.0.
|
|
11
|
+
"easymerchantsdk-react-native": "^1.0.1"
|
|
12
12
|
},
|
|
13
13
|
```
|
|
14
14
|
or using command
|
|
@@ -37,61 +37,6 @@ allprojects {
|
|
|
37
37
|
```
|
|
38
38
|
|
|
39
39
|
## Changes in IOS side.
|
|
40
|
-
Add below content inside the AppDelegate.swift File :-
|
|
41
|
-
|
|
42
|
-
Create a new file named AppDelegate.swift
|
|
43
|
-
```swift
|
|
44
|
-
import UIKit
|
|
45
|
-
import easymerchantsdk
|
|
46
|
-
import React
|
|
47
|
-
|
|
48
|
-
@UIApplicationMain
|
|
49
|
-
class AppDelegate: UIResponder, UIApplicationDelegate {
|
|
50
|
-
var window: UIWindow?
|
|
51
|
-
|
|
52
|
-
func application(
|
|
53
|
-
_ application: UIApplication,
|
|
54
|
-
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil
|
|
55
|
-
) -> Bool {
|
|
56
|
-
let jsCodeLocation: URL
|
|
57
|
-
|
|
58
|
-
#if DEBUG
|
|
59
|
-
jsCodeLocation = URL(string: "http://localhost:8081/index.bundle?platform=ios")!
|
|
60
|
-
#else
|
|
61
|
-
jsCodeLocation = Bundle.main.url(forResource: "main", withExtension: "jsbundle")!
|
|
62
|
-
#endif
|
|
63
|
-
|
|
64
|
-
let bridge = RCTBridge(
|
|
65
|
-
bundleURL: jsCodeLocation,
|
|
66
|
-
moduleProvider: nil,
|
|
67
|
-
launchOptions: launchOptions
|
|
68
|
-
)
|
|
69
|
-
|
|
70
|
-
guard let validBridge = bridge else {
|
|
71
|
-
fatalError("React Native bridge failed to initialize.")
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
let rootView = RCTRootView(
|
|
75
|
-
bridge: validBridge,
|
|
76
|
-
moduleName: "EasyMerchantTestApp", // replace it with your app name
|
|
77
|
-
initialProperties: nil
|
|
78
|
-
)
|
|
79
|
-
|
|
80
|
-
self.window = UIWindow(frame: UIScreen.main.bounds)
|
|
81
|
-
let rootViewController = UIViewController()
|
|
82
|
-
rootViewController.view = rootView
|
|
83
|
-
self.window?.rootViewController = rootViewController
|
|
84
|
-
self.window?.makeKeyAndVisible()
|
|
85
|
-
|
|
86
|
-
if let easyMerchantSdkPlugin = bridge?.module(for: EasyMerchantSdkPlugin.self) as? EasyMerchantSdkPlugin {
|
|
87
|
-
easyMerchantSdkPlugin.setViewController(rootViewController)
|
|
88
|
-
} else {
|
|
89
|
-
print("Failed to retrieve EasyMerchantSdkPlugin instance from React Native bridge.")
|
|
90
|
-
}
|
|
91
|
-
return true
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
```
|
|
95
40
|
|
|
96
41
|
inside the PodFile add below
|
|
97
42
|
```pod
|
|
@@ -104,8 +49,6 @@ inside the PodFile add below
|
|
|
104
49
|
pod 'easymerchantsdk', :path => '../node_modules/easymerchantsdk-react-native/ios'
|
|
105
50
|
```
|
|
106
51
|
|
|
107
|
-
|
|
108
|
-
|
|
109
52
|
## How to call the sdk in `App.js`.
|
|
110
53
|
you can call the sdk using below example:
|
|
111
54
|
|
|
@@ -136,11 +79,11 @@ const App = () => {
|
|
|
136
79
|
};
|
|
137
80
|
|
|
138
81
|
const handleBilling = async () => {
|
|
139
|
-
const amount = '
|
|
82
|
+
const amount = '10';
|
|
140
83
|
const additionalInfoRequest = {
|
|
141
84
|
name: "Test User",
|
|
142
85
|
email: "test@gmail.com",
|
|
143
|
-
phone_number: "
|
|
86
|
+
phone_number: "7888821587",
|
|
144
87
|
country_code: "91",
|
|
145
88
|
description: "Test"
|
|
146
89
|
};
|
|
@@ -149,8 +92,8 @@ const App = () => {
|
|
|
149
92
|
address: "Mohali, Punjab",
|
|
150
93
|
country: "India",
|
|
151
94
|
state: "Punjab",
|
|
152
|
-
city: "
|
|
153
|
-
postal_code: "
|
|
95
|
+
city: "Mohali",
|
|
96
|
+
postal_code: "144520",
|
|
154
97
|
additional_info: additionalInfoRequest
|
|
155
98
|
};
|
|
156
99
|
|
|
@@ -158,12 +101,14 @@ const App = () => {
|
|
|
158
101
|
|
|
159
102
|
try {
|
|
160
103
|
if (Platform.OS === 'android') {
|
|
161
|
-
//
|
|
162
|
-
const response = await RNEasymerchantsdk.billing(amount, null,'sandbox','
|
|
104
|
+
// const response = await RNEasymerchantsdk.billing(amount, null,'staging','apiKey','secretKey');
|
|
105
|
+
const response = await RNEasymerchantsdk.billing(amount, null,'sandbox','apiKey','secretKey');
|
|
106
|
+
// const response = await RNEasymerchantsdk.billing(amount, null,'production','apiKey','secretKey');
|
|
163
107
|
setPaymentResponse(`Payment Success: ${response}`);
|
|
164
108
|
} else if (Platform.OS === 'ios') {
|
|
165
|
-
const result = await EasyMerchantSdk.billing(amount, jsonString,'staging','
|
|
166
|
-
//
|
|
109
|
+
const result = await EasyMerchantSdk.billing(amount, jsonString,'staging','apiKey','secretKey');
|
|
110
|
+
// const result = await EasyMerchantSdk.billing(amount, jsonString,'sandbox','apiKey','secretKey');
|
|
111
|
+
// const result = await EasyMerchantSdk.billing(amount, jsonString,'production','apiKey','secretKey');
|
|
167
112
|
setBillingResult(`Billing Success: ${result}`);
|
|
168
113
|
}
|
|
169
114
|
} catch (error) {
|
|
@@ -221,9 +166,6 @@ export default App;
|
|
|
221
166
|
|
|
222
167
|
```
|
|
223
168
|
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
169
|
You can send `null` if billing info not available.
|
|
228
170
|
|
|
229
171
|
|