1
0
Code Issues Pull Requests Packages Projects Releases Wiki Activity GitHub Gitee

Compare commits

...

14 Commits

Author SHA1 Message Date
jaywcjlove
26adf1ac70 released v2.0.10 2020-07-24 14:15:20 +08:00
jaywcjlove
a1ef27db98 doc: 修复生成文档预览问题 2020-07-24 14:00:21 +08:00
Renovate Bot
4d23f71b5a chore(deps): pin dependencies 2020-07-24 10:45:47 +08:00
jaywcjlove
fbcb24510f chore: 修复 react-native 开发版本不一致导致错误. 2020-07-24 10:37:46 +08:00
jaywcjlove
16f47c70c2 chore: Update typedoc config. 2020-07-24 10:26:50 +08:00
jaywcjlove
c29e51fd42 released v2.0.9 2020-07-24 09:04:40 +08:00
jaywcjlove
21e6416992 type: Fix type export error. 2020-07-24 09:04:16 +08:00
jaywcjlove
0d9d70f5cc released v2.0.8 2020-07-24 01:43:26 +08:00
jaywcjlove
121f52d8f6 doc: Add github workflow config. 2020-07-24 01:22:32 +08:00
jaywcjlove
31a4bd9c3e doc: Add type document. 2020-07-24 01:19:11 +08:00
jaywcjlove
e83aa446c7 chore: 更新注释. 2020-07-23 23:53:36 +08:00
jaywcjlove
fa3fb0787b chore: Update the type declaration file. 2020-07-17 09:06:49 +08:00
jaywcjlove
937427dbb8 chore(example): Update example. 2020-07-17 09:05:32 +08:00
jaywcjlove
1a91171e70 chore: Update package.json 2020-07-16 16:19:23 +08:00
9 changed files with 165 additions and 97 deletions

26
.github/workflows/ci.yml vendored Normal file
View 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
View File

@@ -4,9 +4,11 @@
# node.js # node.js
# #
typedoc
node_modules/ node_modules/
npm-debug.log npm-debug.log
yarn-error.log yarn-error.log
yarn.lock
# Xcode # Xcode
# #

View File

@@ -13,21 +13,33 @@ export default class App extends Component {
Alipay.setAlipayScheme('uiwjspay'); Alipay.setAlipayScheme('uiwjspay');
} }
aliPay = async () => { aliPay = async () => {
// return_url= try {
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&notify_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&timestamp=2020-07-09+12%3A16%3A16&version=1.0'; // return_url=
const resule = await Alipay.alipay(payInfo); 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&notify_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&timestamp=2020-07-09+12%3A16%3A16&version=1.0';
console.log('alipay:resule-->>>', resule); const resule = await Alipay.alipay(payInfo);
console.log('alipay:resule-->>>', resule);
} catch (error) {
console.log('alipay:error-->>>', error);
}
} }
authInfo = async () => { authInfo = async () => {
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'; try {
const resule = await Alipay.authInfo(authInfoStr); 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';
// resule => success=true&auth_code=9c11732de44f4f1790b63978b6fbOX53&result_code=200&alipay_open_id=20881001757376426161095132517425&user_id=2088003646494707 const resule = await Alipay.authInfo(authInfoStr);
console.log('authInfo:resule-->>>', resule); // 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 () => { getVersion = async () => {
const version = await Alipay.getVersion(); try {
this.setState({ version }); const version = await Alipay.getVersion();
console.log('version:', version); this.setState({ version });
console.log('getVersion:', version);
} catch (error) {
console.log('getVersion:error-->>>', error);
}
} }
render() { render() {
return ( return (

View File

@@ -15,13 +15,13 @@
"react-native": "0.63.0" "react-native": "0.63.0"
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "^7.8.4", "@babel/core": "7.10.4",
"@babel/runtime": "^7.8.4", "@babel/runtime": "7.10.4",
"@react-native-community/eslint-config": "^1.1.0", "@react-native-community/eslint-config": "1.1.0",
"babel-jest": "^25.1.0", "babel-jest": "25.5.1",
"eslint": "^6.5.1", "eslint": "6.8.0",
"jest": "^25.1.0", "jest": "25.5.4",
"metro-react-native-babel-preset": "^0.59.0", "metro-react-native-babel-preset": "0.59.0",
"react-test-renderer": "16.13.1" "react-test-renderer": "16.13.1"
}, },
"jest": { "jest": {

View File

@@ -9,7 +9,7 @@
dependencies: dependencies:
"@babel/highlight" "^7.10.4" "@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" version "7.10.4"
resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.10.4.tgz#780e8b83e496152f8dd7df63892b2e052bf1d51d" resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.10.4.tgz#780e8b83e496152f8dd7df63892b2e052bf1d51d"
integrity sha512-3A0tS0HWpy4XujGc7QtOIHTeNwUgWaZc/WuS5YQrfhU67jnVmsD6OGPc1AKHH0LJHQICGncy3+YUjIhVlfDdcA== integrity sha512-3A0tS0HWpy4XujGc7QtOIHTeNwUgWaZc/WuS5YQrfhU67jnVmsD6OGPc1AKHH0LJHQICGncy3+YUjIhVlfDdcA==
@@ -675,7 +675,7 @@
core-js-pure "^3.0.0" core-js-pure "^3.0.0"
regenerator-runtime "^0.13.4" 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" version "7.10.4"
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.10.4.tgz#a6724f1a6b8d2f6ea5236dbfe58c7d7ea9c5eb99" resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.10.4.tgz#a6724f1a6b8d2f6ea5236dbfe58c7d7ea9c5eb99"
integrity sha512-UpTN5yUJr9b4EX2CnGNWIvER7Ab83ibv0pcvvHc4UOdrBI5jb8bj+32cCwPX6xu0mt2daFNjYhoi+X7beH0RSw== integrity sha512-UpTN5yUJr9b4EX2CnGNWIvER7Ab83ibv0pcvvHc4UOdrBI5jb8bj+32cCwPX6xu0mt2daFNjYhoi+X7beH0RSw==
@@ -1096,7 +1096,7 @@
sudo-prompt "^9.0.0" sudo-prompt "^9.0.0"
wcwidth "^1.0.1" wcwidth "^1.0.1"
"@react-native-community/eslint-config@^1.1.0": "@react-native-community/eslint-config@1.1.0":
version "1.1.0" version "1.1.0"
resolved "https://registry.yarnpkg.com/@react-native-community/eslint-config/-/eslint-config-1.1.0.tgz#2dacad06dd44d13e778510864473fc6091f080c0" resolved "https://registry.yarnpkg.com/@react-native-community/eslint-config/-/eslint-config-1.1.0.tgz#2dacad06dd44d13e778510864473fc6091f080c0"
integrity sha512-hwb1hC28BhkwLwnO6vDISV6XZbipw2RIEhBVBN+pE7AUG9HjFXxoksiiOSoYgox9C8g86VJwHnKpak/3NnVBkQ== integrity sha512-hwb1hC28BhkwLwnO6vDISV6XZbipw2RIEhBVBN+pE7AUG9HjFXxoksiiOSoYgox9C8g86VJwHnKpak/3NnVBkQ==
@@ -1285,8 +1285,7 @@
tsutils "^3.17.1" tsutils "^3.17.1"
"@uiw/react-native-alipay@link:..": "@uiw/react-native-alipay@link:..":
version "0.0.0" version "2.0.9"
uid ""
abab@^2.0.0: abab@^2.0.0:
version "2.0.3" version "2.0.3"
@@ -1596,7 +1595,7 @@ babel-eslint@10.1.0:
eslint-visitor-keys "^1.0.0" eslint-visitor-keys "^1.0.0"
resolve "^1.12.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" version "25.5.1"
resolved "https://registry.yarnpkg.com/babel-jest/-/babel-jest-25.5.1.tgz#bc2e6101f849d6f6aec09720ffc7bc5332e62853" resolved "https://registry.yarnpkg.com/babel-jest/-/babel-jest-25.5.1.tgz#bc2e6101f849d6f6aec09720ffc7bc5332e62853"
integrity sha512-9dA9+GmMjIzgPnYtkhBg73gOo/RHqPmLruP3BaGL4KEX3Dwz6pI8auSN8G8+iuEG90+GSswyKvslN+JYSaacaQ== 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" resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz#30ebd1ef7c2fdff01c3a4f151044af25fab0523e"
integrity sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ== integrity sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==
eslint@^6.5.1: eslint@6.8.0:
version "6.8.0" version "6.8.0"
resolved "https://registry.yarnpkg.com/eslint/-/eslint-6.8.0.tgz#62262d6729739f9275723824302fb227c8c93ffb" resolved "https://registry.yarnpkg.com/eslint/-/eslint-6.8.0.tgz#62262d6729739f9275723824302fb227c8c93ffb"
integrity sha512-K+Iayyo2LtyYhDSYwz5D5QdWw0hCacNzyq1Y821Xna2xSJj7cijoLLYmLxTQgcgZ9mC61nryMy9S7GRbYpI5Ig== integrity sha512-K+Iayyo2LtyYhDSYwz5D5QdWw0hCacNzyq1Y821Xna2xSJj7cijoLLYmLxTQgcgZ9mC61nryMy9S7GRbYpI5Ig==
@@ -4063,7 +4062,7 @@ jest-worker@^25.5.0:
merge-stream "^2.0.0" merge-stream "^2.0.0"
supports-color "^7.0.0" supports-color "^7.0.0"
jest@^25.1.0: jest@25.5.4:
version "25.5.4" version "25.5.4"
resolved "https://registry.yarnpkg.com/jest/-/jest-25.5.4.tgz#f21107b6489cfe32b076ce2adcadee3587acb9db" resolved "https://registry.yarnpkg.com/jest/-/jest-25.5.4.tgz#f21107b6489cfe32b076ce2adcadee3587acb9db"
integrity sha512-hHFJROBTqZahnO+X+PMtT6G2/ztqAZJveGqz//FnWWHurizkD05PQGzRZOhF3XP6z7SJmL+5tCfW8qV06JypwQ== 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" "@babel/template" "^7.0.0"
react-refresh "^0.4.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" version "0.59.0"
resolved "https://registry.yarnpkg.com/metro-react-native-babel-preset/-/metro-react-native-babel-preset-0.59.0.tgz#20e020bc6ac9849e1477de1333d303ed42aba225" resolved "https://registry.yarnpkg.com/metro-react-native-babel-preset/-/metro-react-native-babel-preset-0.59.0.tgz#20e020bc6ac9849e1477de1333d303ed42aba225"
integrity sha512-BoO6ncPfceIDReIH8pQ5tQptcGo5yRWQXJGVXfANbiKLq4tfgdZB1C1e2rMUJ6iypmeJU9dzl+EhPmIFKtgREg== integrity sha512-BoO6ncPfceIDReIH8pQ5tQptcGo5yRWQXJGVXfANbiKLq4tfgdZB1C1e2rMUJ6iypmeJU9dzl+EhPmIFKtgREg==

140
index.d.ts vendored
View File

@@ -1,9 +1,11 @@
/// <reference no-default-lib="true" />
/// <reference lib="esnext" />
/** /**
* 支付宝端支付 * 支付宝端支付
* 支付宝回调结果, 详情见 https://docs.open.alipay.com/204/105301 * 支付宝回调结果, 详情见 https://docs.open.alipay.com/204/105301
*/ */
export interface AliOrderResult { export interface OrderResultStr {
alipay_trade_app_pay_response: { alipay_trade_app_pay_response: {
/** /**
* 长度64商户网站唯一订单号 70501111111S001111119 * 长度64商户网站唯一订单号 70501111111S001111119
@@ -46,51 +48,65 @@ export interface AliOrderResult {
sign_type: 'RSA2' | 'RSA'; sign_type: 'RSA2' | 'RSA';
} }
/**
interface OrderResult { * 支付订单返回结果
* @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 {
/** /**
* @callback AliOrderResult
* 支付返回结果: * 支付返回结果:
* 支付宝支付返回结果文档地址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"}' * '{"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; result?: string;
/** /**
* 9000 订单支付成功 * 错误状态码
* 8000 正在处理中,支付结果未知(有可能已经支付成功),请查询商户订单列表中订单的支付状态 * - 9000 订单支付成功
* 4000 订单支付失败 * - 8000 正在处理中,支付结果未知(有可能已经支付成功),请查询商户订单列表中订单的支付状态
* 5000 重复请求 * - 4000 订单支付失败
* 6001 用户中途取消 * - 5000 重复请求
* 6002 网络连接出错 * - 6001 用户中途取消
* 6004 支付结果未知(有可能已经支付成功),请查询商户订单列表中订单的支付状态 * - 6002 网络连接出错
* 其它 其它支付错误 * - 6004 支付结果未知(有可能已经支付成功),请查询商户订单列表中订单的支付状态
* - 其它 其它支付错误
*/ */
resultStatus?: '9000' | '8000' | '4000' | '5000' | '6001' | '6002' | '6004' | string; resultStatus?: '9000' | '8000' | '4000' | '5000' | '6001' | '6002' | '6004' | string;
/** /**
* "Error Domain=系统繁忙,请稍后再试 Code=1000 "(null)""
* 优惠券备注信息 * 优惠券备注信息
* "Error Domain=系统繁忙,请稍后再试 Code=1000 "(null)""
*/ */
memo: string; 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本次操作返回的结果数据。 * 长度144本次操作返回的结果数据。
* - `result_code` 具体状态码值请参见“result_code状态代码”。仅当resultStatus为“9000”且result_code为“200”时代表授权成功。 * - `result_code` 具体状态码值请参见“result_code状态代码”。仅当resultStatus为“9000”且result_code为“200”时代表授权成功。
@@ -111,36 +127,32 @@ interface AuthResult {
*/ */
memo: string; memo: string;
} }
/**
* 支付
export const Alipay: { * @param payInfo 支付详情
/** * @returns result 支付宝回调结果 https://docs.open.alipay.com/204/105301
* 支付 */
* @param payInfo 支付详情 export function alipay(payInfo: string): Promise<OrderResult>;
* @returns result 支付宝回调结果 https://docs.open.alipay.com/204/105301 /**
*/ * 快速登录授权
alipay: (payInfo: string) => Promise<OrderResult>; * @param authInfoStr 验证详情
/** * @returns result 支付宝回调结果 https://opendocs.alipay.com/open/218/105327
* 快速登录授权 */
* @param authInfoStr 验证详情 export function authInfo(authInfoStr: string): Promise<AuthResult>;
* @returns result 支付宝回调结果 https://opendocs.alipay.com/open/218/105327 /**
*/ * 获取当前 SDK 版本号
authInfo: (authInfoStr: string) => Promise<AuthResult>; * @return 当前 SDK 版本字符串
/** */
* 获取当前 SDK 版本号 export function getVersion(): Promise<string>;
* @return 当前 SDK 版本字符串 /**
*/ * 设置支付宝跳转Scheme仅 iOS
getVersion: () => Promise<string>; * @param scheme scheme = `ap` + `APPID`
/** * @platform ios
* 设置支付宝跳转Scheme仅 iOS */
* @param scheme scheme = `ap` + `APPID` export function setAlipayScheme(scheme: string): void;
*/ /**
setAlipayScheme: (scheme: string) => void; * 设置支付宝沙箱环境,仅 Android
/** * @param isSandBox
* 设置支付宝沙箱环境,仅 Android * @platform android
* @param isSandBox */
*/ export function setAlipaySandbox(isSandbox: boolean): void;
setAlipaySandbox: (isSandbox: boolean) => void;
};
export default Alipay;

View File

@@ -30,6 +30,7 @@ export default class Alipay {
/** /**
* 设置支付宝跳转Scheme仅 iOS * 设置支付宝跳转Scheme仅 iOS
* @param scheme * @param scheme
* @platform ios
*/ */
static setAlipayScheme(scheme) { static setAlipayScheme(scheme) {
if (Platform.OS === 'ios') { if (Platform.OS === 'ios') {
@@ -40,6 +41,7 @@ export default class Alipay {
/** /**
* 设置支付宝沙箱环境,仅 Android * 设置支付宝沙箱环境,仅 Android
* @param isSandBox * @param isSandBox
* @platform android
*/ */
static setAlipaySandbox(isSandBox) { static setAlipaySandbox(isSandBox) {
if (Platform.OS === 'android') { if (Platform.OS === 'android') {

View File

@@ -1,18 +1,18 @@
{ {
"name": "@uiw/react-native-alipay", "name": "@uiw/react-native-alipay",
"version": "2.0.7", "version": "2.0.10",
"description": "基于 React Native 的支付宝插件支持Android/iOS。", "description": "基于 React Native 的支付宝插件支持Android/iOS。",
"main": "index.js", "main": "index.js",
"typings": "index.d.ts",
"files": [ "files": [
"README.md", "README.md",
"android", "android",
"index.js", "index.js",
"index.d.ts", "index.d.ts",
"ios", "ios"
"react-native-alipay.podspec"
], ],
"scripts": { "scripts": {
"test": "echo \"Error: no test specified\" && exit 1" "build": "typedoc"
}, },
"repository": { "repository": {
"type": "git", "type": "git",
@@ -40,7 +40,9 @@
"react-native": ">=0.60.0-rc.0 <1.0.x" "react-native": ">=0.60.0-rc.0 <1.0.x"
}, },
"devDependencies": { "devDependencies": {
"react": "^16.9.0", "react": "16.13.1",
"react-native": "^0.61.5" "react-native": "0.63.0",
"typedoc": "0.17.8",
"typescript": "3.9.7"
} }
} }

13
typedoc.json Normal file
View 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
}