@jimrising/easymerchantsdk-react-native 1.0.1 → 1.0.3
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 +71 -6
- 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
|
-
|
|
11
|
+
"@jimrising/easymerchantsdk-react-native": "^1.0.3"
|
|
12
12
|
},
|
|
13
13
|
```
|
|
14
14
|
or using command
|
|
@@ -38,7 +38,67 @@ allprojects {
|
|
|
38
38
|
|
|
39
39
|
## Changes in IOS side.
|
|
40
40
|
|
|
41
|
-
|
|
41
|
+
### If project is based on Objective-C :-
|
|
42
|
+
No need to create any AppDelegate.swift File.
|
|
43
|
+
|
|
44
|
+
### If project is based on Swift :-
|
|
45
|
+
Add below content inside the AppDelegate.swift File :-
|
|
46
|
+
|
|
47
|
+
```swift
|
|
48
|
+
import UIKit
|
|
49
|
+
import easymerchantsdk
|
|
50
|
+
import React
|
|
51
|
+
|
|
52
|
+
@UIApplicationMain
|
|
53
|
+
class AppDelegate: UIResponder, UIApplicationDelegate {
|
|
54
|
+
var window: UIWindow?
|
|
55
|
+
|
|
56
|
+
func application(
|
|
57
|
+
_ application: UIApplication,
|
|
58
|
+
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil
|
|
59
|
+
) -> Bool {
|
|
60
|
+
let jsCodeLocation: URL
|
|
61
|
+
|
|
62
|
+
#if DEBUG
|
|
63
|
+
jsCodeLocation = URL(string: "http://localhost:8081/index.bundle?platform=ios")!
|
|
64
|
+
#else
|
|
65
|
+
jsCodeLocation = Bundle.main.url(forResource: "main", withExtension: "jsbundle")!
|
|
66
|
+
#endif
|
|
67
|
+
|
|
68
|
+
let bridge = RCTBridge(
|
|
69
|
+
bundleURL: jsCodeLocation,
|
|
70
|
+
moduleProvider: nil,
|
|
71
|
+
launchOptions: launchOptions
|
|
72
|
+
)
|
|
73
|
+
|
|
74
|
+
guard let validBridge = bridge else {
|
|
75
|
+
fatalError("React Native bridge failed to initialize.")
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
let rootView = RCTRootView(
|
|
79
|
+
bridge: validBridge,
|
|
80
|
+
moduleName: "EasyMerchantTestApp", // replace it with your app name
|
|
81
|
+
initialProperties: nil
|
|
82
|
+
)
|
|
83
|
+
|
|
84
|
+
self.window = UIWindow(frame: UIScreen.main.bounds)
|
|
85
|
+
let rootViewController = UIViewController()
|
|
86
|
+
rootViewController.view = rootView
|
|
87
|
+
self.window?.rootViewController = rootViewController
|
|
88
|
+
self.window?.makeKeyAndVisible()
|
|
89
|
+
|
|
90
|
+
if let easyMerchantSdkPlugin = bridge?.module(for: EasyMerchantSdkPlugin.self) as? EasyMerchantSdkPlugin {
|
|
91
|
+
easyMerchantSdkPlugin.setViewController(rootViewController)
|
|
92
|
+
} else {
|
|
93
|
+
print("Failed to retrieve EasyMerchantSdkPlugin instance from React Native bridge.")
|
|
94
|
+
}
|
|
95
|
+
return true
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
### inside the PodFile add below
|
|
42
102
|
```pod
|
|
43
103
|
|
|
44
104
|
require_relative '../node_modules/react-native/scripts/react_native_pods'
|
|
@@ -46,9 +106,11 @@ inside the PodFile add below
|
|
|
46
106
|
|
|
47
107
|
platform :ios, 16.0
|
|
48
108
|
|
|
49
|
-
pod 'easymerchantsdk', :path => '../node_modules/easymerchantsdk-react-native/ios'
|
|
109
|
+
pod 'easymerchantsdk', :path => '../node_modules/@jimrising/easymerchantsdk-react-native/ios'
|
|
50
110
|
```
|
|
51
111
|
|
|
112
|
+
|
|
113
|
+
|
|
52
114
|
## How to call the sdk in `App.js`.
|
|
53
115
|
you can call the sdk using below example:
|
|
54
116
|
|
|
@@ -79,11 +141,11 @@ const App = () => {
|
|
|
79
141
|
};
|
|
80
142
|
|
|
81
143
|
const handleBilling = async () => {
|
|
82
|
-
const amount = '
|
|
144
|
+
const amount = '100';
|
|
83
145
|
const additionalInfoRequest = {
|
|
84
146
|
name: "Test User",
|
|
85
147
|
email: "test@gmail.com",
|
|
86
|
-
phone_number: "
|
|
148
|
+
phone_number: "9815404694",
|
|
87
149
|
country_code: "91",
|
|
88
150
|
description: "Test"
|
|
89
151
|
};
|
|
@@ -93,7 +155,7 @@ const App = () => {
|
|
|
93
155
|
country: "India",
|
|
94
156
|
state: "Punjab",
|
|
95
157
|
city: "Mohali",
|
|
96
|
-
postal_code: "
|
|
158
|
+
postal_code: "140118",
|
|
97
159
|
additional_info: additionalInfoRequest
|
|
98
160
|
};
|
|
99
161
|
|
|
@@ -166,6 +228,9 @@ export default App;
|
|
|
166
228
|
|
|
167
229
|
```
|
|
168
230
|
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
|
|
169
234
|
You can send `null` if billing info not available.
|
|
170
235
|
|
|
171
236
|
|