Compare commits
22 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
3e948d1346 | ||
![]() |
2f94805630 | ||
![]() |
e61f7e3525 | ||
![]() |
18a2fdd50a | ||
![]() |
35435fddd7 | ||
![]() |
6d78177551 | ||
![]() |
2557b6020b | ||
![]() |
a9e5bdb91e | ||
![]() |
26adf1ac70 | ||
![]() |
a1ef27db98 | ||
![]() |
4d23f71b5a | ||
![]() |
fbcb24510f | ||
![]() |
16f47c70c2 | ||
![]() |
c29e51fd42 | ||
![]() |
21e6416992 | ||
![]() |
0d9d70f5cc | ||
![]() |
121f52d8f6 | ||
![]() |
31a4bd9c3e | ||
![]() |
e83aa446c7 | ||
![]() |
fa3fb0787b | ||
![]() |
937427dbb8 | ||
![]() |
1a91171e70 |
26
.github/workflows/ci.yml
vendored
Normal file
26
.github/workflows/ci.yml
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
name: Build and Deploy Documents
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
build-deploy:
|
||||
runs-on: ubuntu-18.04
|
||||
steps:
|
||||
- uses: actions/checkout@master
|
||||
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: 10
|
||||
|
||||
- run: npm install
|
||||
- run: npm run build
|
||||
|
||||
- name: Build and Deploy
|
||||
uses: peaceiris/actions-gh-pages@v2.5.0
|
||||
env:
|
||||
ACTIONS_DEPLOY_KEY: ${{ secrets.ACTIONS_DEPLOY_KEY }}
|
||||
PUBLISH_BRANCH: gh-pages
|
||||
PUBLISH_DIR: ./typedoc
|
2
.gitignore
vendored
2
.gitignore
vendored
@@ -4,9 +4,11 @@
|
||||
|
||||
# node.js
|
||||
#
|
||||
typedoc
|
||||
node_modules/
|
||||
npm-debug.log
|
||||
yarn-error.log
|
||||
yarn.lock
|
||||
|
||||
# Xcode
|
||||
#
|
||||
|
15
README.md
15
README.md
@@ -3,7 +3,7 @@
|
||||
|
||||
[](https://npmjs.org/package/@uiw/react-native-alipay)
|
||||
|
||||
基于 React Native 的宝支付插件,支持 iOS/Android。适用于商家在 App 应用中集成支付宝支付功能,商家 APP 调用支付宝提供的 SDK,SDK 再调用支付宝 APP 内的支付模块。如果用户已安装支付宝APP,商家APP会跳转到支付宝中完成支付,支付完后跳回到商家 APP 内,最后展示支付结果。如果用户没有安装支付宝 APP,商家 APP 内会调起支付宝网页支付收银台,用户登录支付宝账户,支付完后展示支付结果。完整实例 [Example](./example)
|
||||
基于 React Native 的宝支付插件,支持 iOS/Android。适用于商家在 App 应用中集成支付宝支付功能,商家 APP 调用支付宝提供的 SDK,SDK 再调用支付宝 APP 内的支付模块。如果用户已安装支付宝APP,商家APP会跳转到支付宝中完成支付,支付完后跳回到商家 APP 内,最后展示支付结果。如果用户没有安装支付宝 APP,商家 APP 内会调起支付宝网页支付收银台,用户登录支付宝账户,支付完后展示支付结果。完整实例 [Example](./example) | [完整的接口文档](https://uiwjs.github.io/react-native-amap-geolocation/)
|
||||
|
||||

|
||||
|
||||
@@ -207,12 +207,21 @@ Alipay.alipay(payInfo, (res)=>console.log(res))
|
||||
npx create-react-native-module --package-identifier com.uiwjs --object-class-name RNAlipay --generate-example Alipay --example-react-native-version 0.63.0 --module-name @uiw/react-native-alipay --github-account uiwjs --author-name "Kenny Wong" --author-email "wowohoo@qq.com"
|
||||
```
|
||||
|
||||
## 开发
|
||||
|
||||
```bash
|
||||
cd example # 进入实例 example 工程,根目录不需要安装,会引发错误
|
||||
yarn install # 安装依赖
|
||||
|
||||
cd ios # 进入 example/ios 目录安装依赖
|
||||
pod instll # 安装依赖
|
||||
```
|
||||
|
||||
## 相关连接
|
||||
|
||||
- [支付宝:生成秘钥指南](https://opendocs.alipay.com/open/291/105971)
|
||||
- [支付宝:SDK 下载地址,当前使用的是 AlipaySDK 15.7.7](https://opendocs.alipay.com/open/54/104509)
|
||||
- [支付宝:SDK 下载地址,当前使用的是 AlipaySDK 15.7.9](https://opendocs.alipay.com/open/54/104509)
|
||||
- [支付宝:客户端调试工具及使用教程](https://openclub.alipay.com/club/history/read/7695)
|
||||
- [支付宝:支付,接入前准备](https://opendocs.alipay.com/open/204/105297/)
|
||||
- [支付宝:完整版授权 SDK 调用方法](https://opendocs.alipay.com/open/218/105325)
|
||||
- [支付宝:异步通知错误码: IllRet](https://opensupport.alipay.com/support/problem.htm?ant_source=antsupport)
|
||||
- [React-native 0.6版本集成支付宝-Alipay爬坑](https://segmentfault.com/a/1190000020758279)
|
||||
|
@@ -86,7 +86,7 @@ def configureReactNativePom(def pom) {
|
||||
name packageJson.title
|
||||
artifactId packageJson.name
|
||||
version = packageJson.version
|
||||
group = "com.uiwjs"
|
||||
group = "com.uiwjs.alipay"
|
||||
description packageJson.description
|
||||
url packageJson.repository.baseUrl
|
||||
|
||||
|
Binary file not shown.
@@ -1,5 +1,5 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.uiwjs">
|
||||
package="com.uiwjs.alipay">
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
|
@@ -1,4 +1,4 @@
|
||||
package com.uiwjs;
|
||||
package com.uiwjs.alipay;
|
||||
|
||||
import com.alipay.sdk.app.AuthTask;
|
||||
import com.alipay.sdk.app.PayTask;
|
||||
|
@@ -1,4 +1,4 @@
|
||||
package com.uiwjs;
|
||||
package com.uiwjs.alipay;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
|
@@ -13,21 +13,33 @@ export default class App extends Component {
|
||||
Alipay.setAlipayScheme('uiwjspay');
|
||||
}
|
||||
aliPay = async () => {
|
||||
try {
|
||||
// return_url=
|
||||
const payInfo = 'alipay_sdk=alipay-sdk-java-dynamicVersionNo&app_id=2021001172656340&biz_content=%7B%22out_trade_no%22%3A%221111112222222%22%2C%22total_amount%22%3A%220.01%22%2C%22subject%22%3A%221234%22%2C%22product_code%22%3A%22QUICK_MSECURITY_PAY%22%7D&charset=UTF-8&format=json&method=alipay.trade.app.pay¬ify_url=http%3A%2F%2Fane.boshu.ltd%2Fowner%2Fpay%2Fapi%2FownerPay%2Fcallback&sign=oUQmGtkv8mrhJ0YwHl9%2FfxMcoLACWuSFKiMTC4Id8nc%2FZVvDQ6MLQq5hhtEN03Qn1%2BAtzTAaofE8nNixdroxOek2l5YtOAcYcXVYlJIyogN%2B22erN2NpDTWJ7tQTKgYFDJLRiG0DZJaxfADhUUF6UR9kdA8omoXKLDlP17ZPUs5Jr4aKv5HJtH5C53ui7PbmyWYg934L4UDC2F%2F9pPQlRwwDeE1SAaV3HW9Dt83kK52o8%2FlChXdotbFdAvH0d4qYGhpEYU5sepj9xiOMyL9aC4pMXW9INYLLGbvtqtlRchZTAfH5yji6nqqQm9KKMmcVrWdBDLyjFVNpejq1UjbJBw%3D%3D&sign_type=RSA2×tamp=2020-07-09+12%3A16%3A16&version=1.0';
|
||||
const resule = await Alipay.alipay(payInfo);
|
||||
console.log('alipay:resule-->>>', resule);
|
||||
} catch (error) {
|
||||
console.log('alipay:error-->>>', error);
|
||||
}
|
||||
}
|
||||
authInfo = async () => {
|
||||
try {
|
||||
const authInfoStr = 'app_name=mc&auth_type=AUTHACCOUNT&apiname=com.alipay.account.auth&biz_type=openservice&product_id=APP_FAST_LOGIN&scope=kuaijie&pid=2088421915791034&target_id=15946456110003465&app_id=2021001172656340&sign_type=RSA2&sign=keluG28qbbLwAcSDI4VmCNOGHJoF3xgpVeqXu1nCBCYo%2FlYYGe00fTfV9L4G73Sk7%2B4IwK%2BZV8IL%2F04cVtk6SR74lKAR3rYOoUdQ09ZrZFuQoUkO0vekajhp75IDQIg6PedCyY0SjFTqrHlH%2FImscBwitxrlSc9YbN7uW0gY34K8t7v8NhDoqzKJeoIz43UxF5U1DpUA1ISBVxwO7du1t6rYltsRhReayPS3hnvmwYSKQZUEgBvJ%2BT2XdyCaz%2FdGV907lYagPp1Oxkoaj%2FvW5NjNsRnid7vH944CoFj9XtBK%2FNTk2tBPTHFxYRQTEG1PkgkBohGpAWOFGGOuapH0ag%3D%3D';
|
||||
const resule = await Alipay.authInfo(authInfoStr);
|
||||
// resule => success=true&auth_code=9c11732de44f4f1790b63978b6fbOX53&result_code=200&alipay_open_id=20881001757376426161095132517425&user_id=2088003646494707
|
||||
console.log('authInfo:resule-->>>', resule);
|
||||
} catch (error) {
|
||||
console.log('authInfo:error-->>>', error);
|
||||
}
|
||||
}
|
||||
getVersion = async () => {
|
||||
try {
|
||||
const version = await Alipay.getVersion();
|
||||
this.setState({ version });
|
||||
console.log('version:', version);
|
||||
console.log('getVersion:', version);
|
||||
} catch (error) {
|
||||
console.log('getVersion:error-->>>', error);
|
||||
}
|
||||
}
|
||||
render() {
|
||||
return (
|
||||
|
@@ -35,12 +35,12 @@ android_library(
|
||||
|
||||
android_build_config(
|
||||
name = "build_config",
|
||||
package = "com.example",
|
||||
package = "com.uiwjs.example.alipay",
|
||||
)
|
||||
|
||||
android_resource(
|
||||
name = "res",
|
||||
package = "com.example",
|
||||
package = "com.uiwjs.example.alipay",
|
||||
res = "src/main/res",
|
||||
)
|
||||
|
||||
|
@@ -129,7 +129,7 @@ android {
|
||||
}
|
||||
|
||||
defaultConfig {
|
||||
applicationId "com.example"
|
||||
applicationId "com.uiwjs.example.alipay"
|
||||
minSdkVersion rootProject.ext.minSdkVersion
|
||||
targetSdkVersion rootProject.ext.targetSdkVersion
|
||||
versionCode 1
|
||||
|
@@ -4,7 +4,7 @@
|
||||
* <p>This source code is licensed under the MIT license found in the LICENSE file in the root
|
||||
* directory of this source tree.
|
||||
*/
|
||||
package com.example;
|
||||
package com.uiwjs.example.alipay;
|
||||
|
||||
import android.content.Context;
|
||||
import com.facebook.flipper.android.AndroidFlipperClient;
|
||||
|
@@ -1,5 +1,5 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.example">
|
||||
package="com.uiwjs.example.alipay">
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
|
||||
|
@@ -1,4 +1,4 @@
|
||||
package com.example;
|
||||
package com.uiwjs.example.alipay;
|
||||
|
||||
import com.facebook.react.ReactActivity;
|
||||
|
||||
|
@@ -1,4 +1,4 @@
|
||||
package com.example;
|
||||
package com.uiwjs.example.alipay;
|
||||
|
||||
import android.app.Application;
|
||||
import android.content.Context;
|
||||
@@ -62,7 +62,7 @@ public class MainApplication extends Application implements ReactApplication {
|
||||
We use reflection here to pick up the class that initializes Flipper,
|
||||
since Flipper library is not available in release mode
|
||||
*/
|
||||
Class<?> aClass = Class.forName("com.example.ReactNativeFlipper");
|
||||
Class<?> aClass = Class.forName("com.uiwjs.example.alipay.ReactNativeFlipper");
|
||||
aClass
|
||||
.getMethod("initializeFlipper", Context.class, ReactInstanceManager.class)
|
||||
.invoke(null, context, reactInstanceManager);
|
||||
|
@@ -161,7 +161,6 @@
|
||||
C40641DB7F56A684B820B607 /* Pods-example-tvOSTests.debug.xcconfig */,
|
||||
9E02A36BA0975904A97235F2 /* Pods-example-tvOSTests.release.xcconfig */,
|
||||
);
|
||||
name = Pods;
|
||||
path = Pods;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
@@ -294,6 +293,7 @@
|
||||
TestTargetID = 13B07F861A680F5B00A75B9A;
|
||||
};
|
||||
13B07F861A680F5B00A75B9A = {
|
||||
DevelopmentTeam = 968DSZ49MT;
|
||||
LastSwiftMigration = 1120;
|
||||
};
|
||||
2D02E47A1E0B4A5D006451C7 = {
|
||||
@@ -660,6 +660,7 @@
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
DEVELOPMENT_TEAM = 968DSZ49MT;
|
||||
ENABLE_BITCODE = NO;
|
||||
INFOPLIST_FILE = example/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
||||
@@ -668,7 +669,7 @@
|
||||
"-ObjC",
|
||||
"-lc++",
|
||||
);
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.uiwjs.example.alipay;
|
||||
PRODUCT_NAME = example;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
SWIFT_VERSION = 5.0;
|
||||
@@ -683,6 +684,7 @@
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
DEVELOPMENT_TEAM = 968DSZ49MT;
|
||||
INFOPLIST_FILE = example/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
||||
OTHER_LDFLAGS = (
|
||||
@@ -690,7 +692,7 @@
|
||||
"-ObjC",
|
||||
"-lc++",
|
||||
);
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.uiwjs.example.alipay;
|
||||
PRODUCT_NAME = example;
|
||||
SWIFT_VERSION = 5.0;
|
||||
VERSIONING_SYSTEM = "apple-generic";
|
||||
|
@@ -15,13 +15,13 @@
|
||||
"react-native": "0.63.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.8.4",
|
||||
"@babel/runtime": "^7.8.4",
|
||||
"@react-native-community/eslint-config": "^1.1.0",
|
||||
"babel-jest": "^25.1.0",
|
||||
"eslint": "^6.5.1",
|
||||
"jest": "^25.1.0",
|
||||
"metro-react-native-babel-preset": "^0.59.0",
|
||||
"@babel/core": "7.10.4",
|
||||
"@babel/runtime": "7.10.4",
|
||||
"@react-native-community/eslint-config": "1.1.0",
|
||||
"babel-jest": "25.5.1",
|
||||
"eslint": "6.8.0",
|
||||
"jest": "25.5.4",
|
||||
"metro-react-native-babel-preset": "0.59.0",
|
||||
"react-test-renderer": "16.13.1"
|
||||
},
|
||||
"jest": {
|
||||
|
@@ -9,7 +9,7 @@
|
||||
dependencies:
|
||||
"@babel/highlight" "^7.10.4"
|
||||
|
||||
"@babel/core@^7.0.0", "@babel/core@^7.1.0", "@babel/core@^7.7.5", "@babel/core@^7.8.4":
|
||||
"@babel/core@7.10.4", "@babel/core@^7.0.0", "@babel/core@^7.1.0", "@babel/core@^7.7.5":
|
||||
version "7.10.4"
|
||||
resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.10.4.tgz#780e8b83e496152f8dd7df63892b2e052bf1d51d"
|
||||
integrity sha512-3A0tS0HWpy4XujGc7QtOIHTeNwUgWaZc/WuS5YQrfhU67jnVmsD6OGPc1AKHH0LJHQICGncy3+YUjIhVlfDdcA==
|
||||
@@ -675,7 +675,7 @@
|
||||
core-js-pure "^3.0.0"
|
||||
regenerator-runtime "^0.13.4"
|
||||
|
||||
"@babel/runtime@^7.0.0", "@babel/runtime@^7.8.4":
|
||||
"@babel/runtime@7.10.4", "@babel/runtime@^7.0.0", "@babel/runtime@^7.8.4":
|
||||
version "7.10.4"
|
||||
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.10.4.tgz#a6724f1a6b8d2f6ea5236dbfe58c7d7ea9c5eb99"
|
||||
integrity sha512-UpTN5yUJr9b4EX2CnGNWIvER7Ab83ibv0pcvvHc4UOdrBI5jb8bj+32cCwPX6xu0mt2daFNjYhoi+X7beH0RSw==
|
||||
@@ -1096,7 +1096,7 @@
|
||||
sudo-prompt "^9.0.0"
|
||||
wcwidth "^1.0.1"
|
||||
|
||||
"@react-native-community/eslint-config@^1.1.0":
|
||||
"@react-native-community/eslint-config@1.1.0":
|
||||
version "1.1.0"
|
||||
resolved "https://registry.yarnpkg.com/@react-native-community/eslint-config/-/eslint-config-1.1.0.tgz#2dacad06dd44d13e778510864473fc6091f080c0"
|
||||
integrity sha512-hwb1hC28BhkwLwnO6vDISV6XZbipw2RIEhBVBN+pE7AUG9HjFXxoksiiOSoYgox9C8g86VJwHnKpak/3NnVBkQ==
|
||||
@@ -1285,8 +1285,7 @@
|
||||
tsutils "^3.17.1"
|
||||
|
||||
"@uiw/react-native-alipay@link:..":
|
||||
version "0.0.0"
|
||||
uid ""
|
||||
version "2.0.9"
|
||||
|
||||
abab@^2.0.0:
|
||||
version "2.0.3"
|
||||
@@ -1596,7 +1595,7 @@ babel-eslint@10.1.0:
|
||||
eslint-visitor-keys "^1.0.0"
|
||||
resolve "^1.12.0"
|
||||
|
||||
babel-jest@^25.1.0, babel-jest@^25.5.1:
|
||||
babel-jest@25.5.1, babel-jest@^25.5.1:
|
||||
version "25.5.1"
|
||||
resolved "https://registry.yarnpkg.com/babel-jest/-/babel-jest-25.5.1.tgz#bc2e6101f849d6f6aec09720ffc7bc5332e62853"
|
||||
integrity sha512-9dA9+GmMjIzgPnYtkhBg73gOo/RHqPmLruP3BaGL4KEX3Dwz6pI8auSN8G8+iuEG90+GSswyKvslN+JYSaacaQ==
|
||||
@@ -2544,7 +2543,7 @@ eslint-visitor-keys@^1.0.0, eslint-visitor-keys@^1.1.0:
|
||||
resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz#30ebd1ef7c2fdff01c3a4f151044af25fab0523e"
|
||||
integrity sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==
|
||||
|
||||
eslint@^6.5.1:
|
||||
eslint@6.8.0:
|
||||
version "6.8.0"
|
||||
resolved "https://registry.yarnpkg.com/eslint/-/eslint-6.8.0.tgz#62262d6729739f9275723824302fb227c8c93ffb"
|
||||
integrity sha512-K+Iayyo2LtyYhDSYwz5D5QdWw0hCacNzyq1Y821Xna2xSJj7cijoLLYmLxTQgcgZ9mC61nryMy9S7GRbYpI5Ig==
|
||||
@@ -4063,7 +4062,7 @@ jest-worker@^25.5.0:
|
||||
merge-stream "^2.0.0"
|
||||
supports-color "^7.0.0"
|
||||
|
||||
jest@^25.1.0:
|
||||
jest@25.5.4:
|
||||
version "25.5.4"
|
||||
resolved "https://registry.yarnpkg.com/jest/-/jest-25.5.4.tgz#f21107b6489cfe32b076ce2adcadee3587acb9db"
|
||||
integrity sha512-hHFJROBTqZahnO+X+PMtT6G2/ztqAZJveGqz//FnWWHurizkD05PQGzRZOhF3XP6z7SJmL+5tCfW8qV06JypwQ==
|
||||
@@ -4530,7 +4529,7 @@ metro-react-native-babel-preset@0.58.0:
|
||||
"@babel/template" "^7.0.0"
|
||||
react-refresh "^0.4.0"
|
||||
|
||||
metro-react-native-babel-preset@0.59.0, metro-react-native-babel-preset@^0.59.0:
|
||||
metro-react-native-babel-preset@0.59.0:
|
||||
version "0.59.0"
|
||||
resolved "https://registry.yarnpkg.com/metro-react-native-babel-preset/-/metro-react-native-babel-preset-0.59.0.tgz#20e020bc6ac9849e1477de1333d303ed42aba225"
|
||||
integrity sha512-BoO6ncPfceIDReIH8pQ5tQptcGo5yRWQXJGVXfANbiKLq4tfgdZB1C1e2rMUJ6iypmeJU9dzl+EhPmIFKtgREg==
|
||||
|
96
index.d.ts
vendored
96
index.d.ts
vendored
@@ -1,9 +1,11 @@
|
||||
/// <reference no-default-lib="true" />
|
||||
/// <reference lib="esnext" />
|
||||
|
||||
/**
|
||||
* 支付宝端支付
|
||||
* 支付宝回调结果, 详情见 https://docs.open.alipay.com/204/105301
|
||||
*/
|
||||
export interface AliOrderResult {
|
||||
export interface OrderResultStr {
|
||||
alipay_trade_app_pay_response: {
|
||||
/**
|
||||
* 长度:64,商户网站唯一订单号 70501111111S001111119
|
||||
@@ -46,51 +48,65 @@ export interface AliOrderResult {
|
||||
sign_type: 'RSA2' | 'RSA';
|
||||
}
|
||||
|
||||
|
||||
interface OrderResult {
|
||||
/**
|
||||
* @callback AliOrderResult
|
||||
* 支付订单返回结果
|
||||
* @returns 成功返回
|
||||
*
|
||||
* ```json
|
||||
* {
|
||||
* result: '{"alipay_trade_app_pay_response":{"code":"10000","msg":"Success","app_id":"2021001172656340","auth_app_id":"2021001172656340","charset":"UTF-8","timestamp":"2020-07-08 21:30:14","out_trade_no":"123123213123214","total_amount":"0.01","trade_no":"2020070822001414841426413774","seller_id":"2088421915791034"},"sign":"LY7wCsNLp+QnDqCq6VelY/RvyK7ZGY8wsXoKvS+Or7JjONLDUx5P6lDgqRKkpkng7br3y6GZzfGKaZ88Tf4eMnBMKyqU+huR2Um47xUxP383njvHlxuQZsSTLQZRswy4wmb/fPkFfvyH6Or6+oj0eboePOTu63bNr+h03w0QnP4znuHpfRuoVgWpsYh/6B1DL+4xfWRKJ21zm1SV9Feo9RWqnyTaGZyFVi6IKge0dUCYs9hXju95fOUVUOx5YflOFtSEnZafY9Ls4FCRQE1ANkjaKiKIE0+c4c4sEVEf/9Dwh88N+aSQOoLT+AV4RpjMoA8hF2k+vv2OKNeqr6SYGQ==","sign_type":"RSA2"}',
|
||||
* resultStatus: '9000',
|
||||
* memo: ''
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* @returns 错误返回
|
||||
*
|
||||
* ```json
|
||||
* {
|
||||
* memo: "Error Domain=系统繁忙,请稍后再试 Code=1000 \"(null)\"",
|
||||
* result: "",
|
||||
* resultStatus: "4000",
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
export interface OrderResult {
|
||||
/**
|
||||
* 支付返回结果:
|
||||
* 支付宝支付返回结果文档地址:https://opendocs.alipay.com/open/204/105301#%E8%BF%94%E5%9B%9E%E7%BB%93%E6%9E%9C%E7%A4%BA%E4%BE%8B%EF%BC%88iOS%7CAndroid%EF%BC%89
|
||||
* 支付宝支付返回结果,[支付宝文档地址](https://opendocs.alipay.com/open/204/105301#%E8%BF%94%E5%9B%9E%E7%BB%93%E6%9E%9C%E7%A4%BA%E4%BE%8B%EF%BC%88iOS%7CAndroid%EF%BC%89)
|
||||
* 支付返回结果字符串通过 `JSON.parse` 进行转换为对象 {@link OrderResultStr}
|
||||
* @typeParam OrderResultStr
|
||||
* @example
|
||||
*
|
||||
* ```json
|
||||
* '{"alipay_trade_app_pay_response":{"code":"10000","msg":"Success","app_id":"2021001172656340","auth_app_id":"2021001172656340","charset":"UTF-8","timestamp":"2020-07-08 21:30:14","out_trade_no":"123123213123214","total_amount":"0.01","trade_no":"2020070822001414841426413774","seller_id":"2088421915791034"},"sign":"LY7wCsNLp+QnDqCq6VelY/RvyK7ZGY8wsXoKvS+Or7JjONLDUx5P6lDgqRKkpkng7br3y6GZzfGKaZ88Tf4eMnBMKyqU+huR2Um47xUxP383njvHlxuQZsSTLQZRswy4wmb/fPkFfvyH6Or6+oj0eboePOTu63bNr+h03w0QnP4znuHpfRuoVgWpsYh/6B1DL+4xfWRKJ21zm1SV9Feo9RWqnyTaGZyFVi6IKge0dUCYs9hXju95fOUVUOx5YflOFtSEnZafY9Ls4FCRQE1ANkjaKiKIE0+c4c4sEVEf/9Dwh88N+aSQOoLT+AV4RpjMoA8hF2k+vv2OKNeqr6SYGQ==","sign_type":"RSA2"}'
|
||||
* ```
|
||||
*
|
||||
*/
|
||||
result?: string;
|
||||
/**
|
||||
* 9000 订单支付成功
|
||||
* 8000 正在处理中,支付结果未知(有可能已经支付成功),请查询商户订单列表中订单的支付状态
|
||||
* 4000 订单支付失败
|
||||
* 5000 重复请求
|
||||
* 6001 用户中途取消
|
||||
* 6002 网络连接出错
|
||||
* 6004 支付结果未知(有可能已经支付成功),请查询商户订单列表中订单的支付状态
|
||||
* 其它 其它支付错误
|
||||
* 错误状态码
|
||||
* - 9000 订单支付成功
|
||||
* - 8000 正在处理中,支付结果未知(有可能已经支付成功),请查询商户订单列表中订单的支付状态
|
||||
* - 4000 订单支付失败
|
||||
* - 5000 重复请求
|
||||
* - 6001 用户中途取消
|
||||
* - 6002 网络连接出错
|
||||
* - 6004 支付结果未知(有可能已经支付成功),请查询商户订单列表中订单的支付状态
|
||||
* - 其它 其它支付错误
|
||||
*/
|
||||
resultStatus?: '9000' | '8000' | '4000' | '5000' | '6001' | '6002' | '6004' | string;
|
||||
/**
|
||||
* "Error Domain=系统繁忙,请稍后再试 Code=1000 "(null)""
|
||||
* 优惠券备注信息
|
||||
* "Error Domain=系统繁忙,请稍后再试 Code=1000 "(null)""
|
||||
*/
|
||||
memo: string;
|
||||
}
|
||||
|
||||
// 错误返回
|
||||
// {
|
||||
// memo: "Error Domain=系统繁忙,请稍后再试 Code=1000 \"(null)\"",
|
||||
// result: "",
|
||||
// resultStatus: "4000",
|
||||
// }
|
||||
// 成功返回
|
||||
// {
|
||||
// result: '{"alipay_trade_app_pay_response":{"code":"10000","msg":"Success","app_id":"2021001172656340","auth_app_id":"2021001172656340","charset":"UTF-8","timestamp":"2020-07-08 21:30:14","out_trade_no":"123123213123214","total_amount":"0.01","trade_no":"2020070822001414841426413774","seller_id":"2088421915791034"},"sign":"LY7wCsNLp+QnDqCq6VelY/RvyK7ZGY8wsXoKvS+Or7JjONLDUx5P6lDgqRKkpkng7br3y6GZzfGKaZ88Tf4eMnBMKyqU+huR2Um47xUxP383njvHlxuQZsSTLQZRswy4wmb/fPkFfvyH6Or6+oj0eboePOTu63bNr+h03w0QnP4znuHpfRuoVgWpsYh/6B1DL+4xfWRKJ21zm1SV9Feo9RWqnyTaGZyFVi6IKge0dUCYs9hXju95fOUVUOx5YflOFtSEnZafY9Ls4FCRQE1ANkjaKiKIE0+c4c4sEVEf/9Dwh88N+aSQOoLT+AV4RpjMoA8hF2k+vv2OKNeqr6SYGQ==","sign_type":"RSA2"}',
|
||||
// resultStatus: '9000',
|
||||
// memo: ''
|
||||
// }
|
||||
|
||||
/**
|
||||
* 快速登录授权
|
||||
* https://opendocs.alipay.com/open/218/105327#%E8%BF%94%E5%9B%9E%E7%BB%93%E6%9E%9C%E8%AF%B4%E6%98%8E
|
||||
* 快速登录授权,[支付宝文档](https://opendocs.alipay.com/open/218/105327#%E8%BF%94%E5%9B%9E%E7%BB%93%E6%9E%9C%E8%AF%B4%E6%98%8E)
|
||||
*
|
||||
*/
|
||||
interface AuthResult {
|
||||
export interface AuthResult {
|
||||
/**
|
||||
* 长度:144,本次操作返回的结果数据。
|
||||
* - `result_code` 具体状态码值请参见“result_code状态代码”。仅当resultStatus为“9000”且result_code为“200”时,代表授权成功。
|
||||
@@ -111,36 +127,32 @@ interface AuthResult {
|
||||
*/
|
||||
memo: string;
|
||||
}
|
||||
|
||||
|
||||
export const Alipay: {
|
||||
/**
|
||||
* 支付
|
||||
* @param payInfo 支付详情
|
||||
* @returns result 支付宝回调结果 https://docs.open.alipay.com/204/105301
|
||||
*/
|
||||
alipay: (payInfo: string) => Promise<OrderResult>;
|
||||
export function alipay(payInfo: string): Promise<OrderResult>;
|
||||
/**
|
||||
* 快速登录授权
|
||||
* @param authInfoStr 验证详情
|
||||
* @returns result 支付宝回调结果 https://opendocs.alipay.com/open/218/105327
|
||||
*/
|
||||
authInfo: (authInfoStr: string) => Promise<AuthResult>;
|
||||
export function authInfo(authInfoStr: string): Promise<AuthResult>;
|
||||
/**
|
||||
* 获取当前 SDK 版本号
|
||||
* @return 当前 SDK 版本字符串
|
||||
*/
|
||||
getVersion: () => Promise<string>;
|
||||
export function getVersion(): Promise<string>;
|
||||
/**
|
||||
* 设置支付宝跳转Scheme,仅 iOS
|
||||
* @param scheme scheme = `ap` + `APPID`
|
||||
* @platform ios
|
||||
*/
|
||||
setAlipayScheme: (scheme: string) => void;
|
||||
export function setAlipayScheme(scheme: string): void;
|
||||
/**
|
||||
* 设置支付宝沙箱环境,仅 Android
|
||||
* @param isSandBox
|
||||
* @platform android
|
||||
*/
|
||||
setAlipaySandbox: (isSandbox: boolean) => void;
|
||||
};
|
||||
|
||||
export default Alipay;
|
||||
export function setAlipaySandbox(isSandbox: boolean): void;
|
2
index.js
2
index.js
@@ -30,6 +30,7 @@ export default class Alipay {
|
||||
/**
|
||||
* 设置支付宝跳转Scheme,仅 iOS
|
||||
* @param scheme
|
||||
* @platform ios
|
||||
*/
|
||||
static setAlipayScheme(scheme) {
|
||||
if (Platform.OS === 'ios') {
|
||||
@@ -40,6 +41,7 @@ export default class Alipay {
|
||||
/**
|
||||
* 设置支付宝沙箱环境,仅 Android
|
||||
* @param isSandBox
|
||||
* @platform android
|
||||
*/
|
||||
static setAlipaySandbox(isSandBox) {
|
||||
if (Platform.OS === 'android') {
|
||||
|
Binary file not shown.
@@ -9,7 +9,7 @@
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
///////////////// 支付宝标准版本支付SDK ///////////////////
|
||||
///////// version:15.7.7 motify:2020.07.02///////////
|
||||
///////// version:15.7.9 motify:2020.07.27///////////
|
||||
////////////////////////////////////////////////////////
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
22
package.json
22
package.json
@@ -1,18 +1,20 @@
|
||||
{
|
||||
"name": "@uiw/react-native-alipay",
|
||||
"version": "2.0.7",
|
||||
"version": "2.1.1",
|
||||
"description": "基于 React Native 的支付宝插件,支持Android/iOS。",
|
||||
"main": "index.js",
|
||||
"typings": "index.d.ts",
|
||||
"files": [
|
||||
"README.md",
|
||||
"android",
|
||||
"index.js",
|
||||
"index.d.ts",
|
||||
"android/libs",
|
||||
"android/src",
|
||||
"android/build.gradle",
|
||||
"ios",
|
||||
"react-native-alipay.podspec"
|
||||
"index.d.ts",
|
||||
"index.js",
|
||||
"README.md"
|
||||
],
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
"build": "typedoc"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@@ -40,7 +42,9 @@
|
||||
"react-native": ">=0.60.0-rc.0 <1.0.x"
|
||||
},
|
||||
"devDependencies": {
|
||||
"react": "^16.9.0",
|
||||
"react-native": "^0.61.5"
|
||||
"react": "16.13.1",
|
||||
"react-native": "0.63.0",
|
||||
"typedoc": "0.17.8",
|
||||
"typescript": "3.9.7"
|
||||
}
|
||||
}
|
||||
|
13
typedoc.json
Normal file
13
typedoc.json
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"inputFiles": "./index.d.ts",
|
||||
"out": "typedoc",
|
||||
"name": "React Native Alipay",
|
||||
"mode": "file",
|
||||
"includeDeclarations": true,
|
||||
"excludeExternals": true,
|
||||
"ignoreCompilerErrors": true,
|
||||
"excludePrivate": true,
|
||||
"excludeProtected": true,
|
||||
"toc": true,
|
||||
"hideGenerator": true
|
||||
}
|
Reference in New Issue
Block a user