payme-mini-app 0.4.25 → 0.4.27
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/android/build.gradle +1 -1
- package/ios/RNPayMEMiniApp.swift +42 -33
- package/ios/RNPayMEMiniApp.xcodeproj/project.xcworkspace/xcuserdata/dattm.tran.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/ios/RNPayMEMiniApp.xcodeproj/xcuserdata/dattm.tran.xcuserdatad/xcschemes/xcschememanagement.plist +14 -0
- package/package.json +1 -1
- package/payme-mini-app.podspec +1 -1
package/android/build.gradle
CHANGED
|
@@ -74,7 +74,7 @@ dependencies {
|
|
|
74
74
|
//noinspection GradleDynamicVersion
|
|
75
75
|
implementation "com.facebook.react:react-native"
|
|
76
76
|
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
|
77
|
-
implementation 'com.github.PayME-Miniapp:native-android:0.0.
|
|
77
|
+
implementation 'com.github.PayME-Miniapp:native-android:0.0.76'
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
if (isNewArchitectureEnabled()) {
|
package/ios/RNPayMEMiniApp.swift
CHANGED
|
@@ -4,9 +4,12 @@ import PayMEMiniApp
|
|
|
4
4
|
class RNPayMEMiniApp: RCTEventEmitter, PayMEDelegate {
|
|
5
5
|
var payme: PayME!
|
|
6
6
|
|
|
7
|
-
@objc func initPayME(
|
|
7
|
+
@objc func initPayME(
|
|
8
|
+
_ appId: String, publicKey: String, privateKey: String, env: String? = "PRODUCTION",
|
|
9
|
+
mode: String? = "miniapp_product"
|
|
10
|
+
) {
|
|
8
11
|
DispatchQueue.main.sync {
|
|
9
|
-
PayMEConfig.instance.setMode(mode)
|
|
12
|
+
PayMEConfig.instance.setMode(mode ?? "miniapp_product")
|
|
10
13
|
PayMEConfig.instance.env = (env == "SANDBOX") ? .sbx : .prod
|
|
11
14
|
self.payme = PayME(key: PayMEKey(appId: appId, publicKey: publicKey, privateKey: privateKey))
|
|
12
15
|
self.payme.delegate = self
|
|
@@ -16,40 +19,47 @@ class RNPayMEMiniApp: RCTEventEmitter, PayMEDelegate {
|
|
|
16
19
|
@objc func open(_ type: String, param: NSDictionary) {
|
|
17
20
|
let openAction: PayMEAction = {
|
|
18
21
|
switch param["action"] as? String {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
22
|
+
case "PAYME": return PayMEAction.PayME
|
|
23
|
+
case "OPEN": return PayMEAction.Open
|
|
24
|
+
case "PAY": return PayMEAction.Pay
|
|
25
|
+
case "SERVICE": return PayMEAction.Service
|
|
26
|
+
case "DEPOSIT": return PayMEAction.Deposit
|
|
27
|
+
case "WITHDRAW": return PayMEAction.Withdraw
|
|
28
|
+
case "TRANSFER": return PayMEAction.Transfer
|
|
29
|
+
case "KYC": return PayMEAction.KYC
|
|
30
|
+
default: fatalError("Invalid action!")
|
|
28
31
|
}
|
|
29
32
|
}()
|
|
30
33
|
var openData: Any? {
|
|
31
34
|
guard let data = param["data"] as? NSDictionary else { return nil }
|
|
32
35
|
switch param["action"] as? String {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
36
|
+
case "PAYME", "OPEN": return nil
|
|
37
|
+
case "KYC": return nil
|
|
38
|
+
case "PAY":
|
|
39
|
+
return PayMEPaymentParam(
|
|
40
|
+
amount: data["amount"] as! Int, transactionId: data["transactionId"] as! String,
|
|
41
|
+
note: data["note"] as? String, ipnUrl: data["ipnUrl"] as? String)
|
|
42
|
+
case "SERVICE":
|
|
43
|
+
return PayMEServiceParam(service: data["service"] as! String)
|
|
44
|
+
case "DEPOSIT":
|
|
45
|
+
return PayMEPayParam(
|
|
46
|
+
amount: data["amount"] as? Int, description: data["description"] as? String)
|
|
47
|
+
case "WITHDRAW":
|
|
48
|
+
return PayMEPayParam(
|
|
49
|
+
amount: data["amount"] as? Int, description: data["description"] as? String)
|
|
50
|
+
case "TRANSFER":
|
|
51
|
+
return PayMEPayParam(
|
|
52
|
+
amount: data["amount"] as? Int, description: data["description"] as? String)
|
|
53
|
+
default: fatalError("Invalid action!")
|
|
47
54
|
}
|
|
48
55
|
}
|
|
49
56
|
|
|
50
57
|
DispatchQueue.main.sync {
|
|
51
58
|
let RNVC = UIApplication.shared.delegate?.window??.rootViewController
|
|
52
|
-
self.payme.open(
|
|
59
|
+
self.payme.open(
|
|
60
|
+
with: PayMEOpeningParam(
|
|
61
|
+
action: openAction, phone: param["phone"] as! String, data: openData), from: RNVC,
|
|
62
|
+
type: PayMEOpeningType(rawValue: type) ?? .screen)
|
|
53
63
|
}
|
|
54
64
|
}
|
|
55
65
|
|
|
@@ -70,15 +80,14 @@ class RNPayMEMiniApp: RCTEventEmitter, PayMEDelegate {
|
|
|
70
80
|
}
|
|
71
81
|
|
|
72
82
|
func onError(action: PayMEMiniApp.PayMEAction, error: PayMEMiniApp.PayMEError) {
|
|
73
|
-
sendEvent(
|
|
83
|
+
sendEvent(
|
|
84
|
+
withName: "onError",
|
|
85
|
+
body: ["action": action.rawValue, "code": error.code, "description": error.description])
|
|
74
86
|
}
|
|
75
87
|
|
|
76
88
|
func onResponse(action: PayMEMiniApp.PayMEAction, response: [String: Any]) {
|
|
77
|
-
sendEvent(
|
|
89
|
+
sendEvent(
|
|
90
|
+
withName: "onResponse",
|
|
91
|
+
body: ["action": action.rawValue].merging(response) { (_, new) in new })
|
|
78
92
|
}
|
|
79
93
|
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
Binary file
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
3
|
+
<plist version="1.0">
|
|
4
|
+
<dict>
|
|
5
|
+
<key>SchemeUserState</key>
|
|
6
|
+
<dict>
|
|
7
|
+
<key>RNPayMEMiniApp.xcscheme_^#shared#^_</key>
|
|
8
|
+
<dict>
|
|
9
|
+
<key>orderHint</key>
|
|
10
|
+
<integer>0</integer>
|
|
11
|
+
</dict>
|
|
12
|
+
</dict>
|
|
13
|
+
</dict>
|
|
14
|
+
</plist>
|
package/package.json
CHANGED
package/payme-mini-app.podspec
CHANGED
|
@@ -16,7 +16,7 @@ Pod::Spec.new do |s|
|
|
|
16
16
|
s.swift_versions = "5.0"
|
|
17
17
|
s.source_files = "ios/**/*.{h,m,mm,swift}"
|
|
18
18
|
|
|
19
|
-
s.dependency "PayME-Miniapp", "0.2.
|
|
19
|
+
s.dependency "PayME-Miniapp", "0.2.24"
|
|
20
20
|
s.dependency "React-Core"
|
|
21
21
|
s.pod_target_xcconfig = { 'BUILD_LIBRARY_FOR_DISTRIBUTION' => 'YES' }
|
|
22
22
|
# Don't install the dependencies when we run `pod install` in the old architecture.
|