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

Compare commits

..

20 Commits

Author SHA1 Message Date
jaywcjlove
e61f7e3525 released v2.1.0 2020-07-29 10:02:06 +08:00
jaywcjlove
18a2fdd50a chore: Upgrade AlipaySDK to v15.7.9 #10 2020-07-29 10:01:08 +08:00
jaywcjlove
35435fddd7 doc: Update README.md 2020-07-28 16:55:13 +08:00
jaywcjlove
6d78177551 released v2.0.11 2020-07-28 16:53:34 +08:00
jaywcjlove
2557b6020b chore(android): Modify package name. 2020-07-28 16:52:47 +08:00
jaywcjlove
a9e5bdb91e chore: Modify bundleId & packageName. 2020-07-28 15:56:07 +08:00
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
24 changed files with 199 additions and 118 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

@@ -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" 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) - [支付宝:生成秘钥指南](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://openclub.alipay.com/club/history/read/7695)
- [支付宝:支付,接入前准备](https://opendocs.alipay.com/open/204/105297/) - [支付宝:支付,接入前准备](https://opendocs.alipay.com/open/204/105297/)
- [支付宝:完整版授权 SDK 调用方法](https://opendocs.alipay.com/open/218/105325) - [支付宝:完整版授权 SDK 调用方法](https://opendocs.alipay.com/open/218/105325)
- [支付宝:异步通知错误码: IllRet](https://opensupport.alipay.com/support/problem.htm?ant_source=antsupport) - [支付宝:异步通知错误码: IllRet](https://opensupport.alipay.com/support/problem.htm?ant_source=antsupport)
- [React-native 0.6版本集成支付宝-Alipay爬坑](https://segmentfault.com/a/1190000020758279)

View File

@@ -86,7 +86,7 @@ def configureReactNativePom(def pom) {
name packageJson.title name packageJson.title
artifactId packageJson.name artifactId packageJson.name
version = packageJson.version version = packageJson.version
group = "com.uiwjs" group = "com.uiwjs.alipay"
description packageJson.description description packageJson.description
url packageJson.repository.baseUrl url packageJson.repository.baseUrl

View File

@@ -1,5 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <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.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

View File

@@ -1,4 +1,4 @@
package com.uiwjs; package com.uiwjs.alipay;
import com.alipay.sdk.app.AuthTask; import com.alipay.sdk.app.AuthTask;
import com.alipay.sdk.app.PayTask; import com.alipay.sdk.app.PayTask;

View File

@@ -1,4 +1,4 @@
package com.uiwjs; package com.uiwjs.alipay;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections; import java.util.Collections;

View File

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

View File

@@ -35,12 +35,12 @@ android_library(
android_build_config( android_build_config(
name = "build_config", name = "build_config",
package = "com.example", package = "com.uiwjs.example.alipay",
) )
android_resource( android_resource(
name = "res", name = "res",
package = "com.example", package = "com.uiwjs.example.alipay",
res = "src/main/res", res = "src/main/res",
) )

View File

@@ -129,7 +129,7 @@ android {
} }
defaultConfig { defaultConfig {
applicationId "com.example" applicationId "com.uiwjs.example.alipay"
minSdkVersion rootProject.ext.minSdkVersion minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1 versionCode 1

View File

@@ -4,7 +4,7 @@
* <p>This source code is licensed under the MIT license found in the LICENSE file in the root * <p>This source code is licensed under the MIT license found in the LICENSE file in the root
* directory of this source tree. * directory of this source tree.
*/ */
package com.example; package com.uiwjs.example.alipay;
import android.content.Context; import android.content.Context;
import com.facebook.flipper.android.AndroidFlipperClient; import com.facebook.flipper.android.AndroidFlipperClient;

View File

@@ -1,5 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <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" /> <uses-permission android:name="android.permission.INTERNET" />

View File

@@ -1,4 +1,4 @@
package com.example; package com.uiwjs.example.alipay;
import com.facebook.react.ReactActivity; import com.facebook.react.ReactActivity;

View File

@@ -1,4 +1,4 @@
package com.example; package com.uiwjs.example.alipay;
import android.app.Application; import android.app.Application;
import android.content.Context; 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, We use reflection here to pick up the class that initializes Flipper,
since Flipper library is not available in release mode 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 aClass
.getMethod("initializeFlipper", Context.class, ReactInstanceManager.class) .getMethod("initializeFlipper", Context.class, ReactInstanceManager.class)
.invoke(null, context, reactInstanceManager); .invoke(null, context, reactInstanceManager);

View File

@@ -161,7 +161,6 @@
C40641DB7F56A684B820B607 /* Pods-example-tvOSTests.debug.xcconfig */, C40641DB7F56A684B820B607 /* Pods-example-tvOSTests.debug.xcconfig */,
9E02A36BA0975904A97235F2 /* Pods-example-tvOSTests.release.xcconfig */, 9E02A36BA0975904A97235F2 /* Pods-example-tvOSTests.release.xcconfig */,
); );
name = Pods;
path = Pods; path = Pods;
sourceTree = "<group>"; sourceTree = "<group>";
}; };
@@ -294,6 +293,7 @@
TestTargetID = 13B07F861A680F5B00A75B9A; TestTargetID = 13B07F861A680F5B00A75B9A;
}; };
13B07F861A680F5B00A75B9A = { 13B07F861A680F5B00A75B9A = {
DevelopmentTeam = 968DSZ49MT;
LastSwiftMigration = 1120; LastSwiftMigration = 1120;
}; };
2D02E47A1E0B4A5D006451C7 = { 2D02E47A1E0B4A5D006451C7 = {
@@ -660,6 +660,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = 1; CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = 968DSZ49MT;
ENABLE_BITCODE = NO; ENABLE_BITCODE = NO;
INFOPLIST_FILE = example/Info.plist; INFOPLIST_FILE = example/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
@@ -668,7 +669,7 @@
"-ObjC", "-ObjC",
"-lc++", "-lc++",
); );
PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_BUNDLE_IDENTIFIER = com.uiwjs.example.alipay;
PRODUCT_NAME = example; PRODUCT_NAME = example;
SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0; SWIFT_VERSION = 5.0;
@@ -683,6 +684,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = 1; CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = 968DSZ49MT;
INFOPLIST_FILE = example/Info.plist; INFOPLIST_FILE = example/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
OTHER_LDFLAGS = ( OTHER_LDFLAGS = (
@@ -690,7 +692,7 @@
"-ObjC", "-ObjC",
"-lc++", "-lc++",
); );
PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_BUNDLE_IDENTIFIER = com.uiwjs.example.alipay;
PRODUCT_NAME = example; PRODUCT_NAME = example;
SWIFT_VERSION = 5.0; SWIFT_VERSION = 5.0;
VERSIONING_SYSTEM = "apple-generic"; VERSIONING_SYSTEM = "apple-generic";

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==

106
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 支付详情 * @param payInfo 支付详情
* @returns result 支付宝回调结果 https://docs.open.alipay.com/204/105301 * @returns result 支付宝回调结果 https://docs.open.alipay.com/204/105301
*/ */
alipay: (payInfo: string) => Promise<OrderResult>; export function alipay(payInfo: string): Promise<OrderResult>;
/** /**
* 快速登录授权 * 快速登录授权
* @param authInfoStr 验证详情 * @param authInfoStr 验证详情
* @returns result 支付宝回调结果 https://opendocs.alipay.com/open/218/105327 * @returns result 支付宝回调结果 https://opendocs.alipay.com/open/218/105327
*/ */
authInfo: (authInfoStr: string) => Promise<AuthResult>; export function authInfo(authInfoStr: string): Promise<AuthResult>;
/** /**
* 获取当前 SDK 版本号 * 获取当前 SDK 版本号
* @return 当前 SDK 版本字符串 * @return 当前 SDK 版本字符串
*/ */
getVersion: () => Promise<string>; export function getVersion(): Promise<string>;
/** /**
* 设置支付宝跳转Scheme仅 iOS * 设置支付宝跳转Scheme仅 iOS
* @param scheme scheme = `ap` + `APPID` * @param scheme scheme = `ap` + `APPID`
* @platform ios
*/ */
setAlipayScheme: (scheme: string) => void; export function setAlipayScheme(scheme: string): void;
/** /**
* 设置支付宝沙箱环境,仅 Android * 设置支付宝沙箱环境,仅 Android
* @param isSandBox * @param isSandBox
* @platform android
*/ */
setAlipaySandbox: (isSandbox: boolean) => void; export function 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') {

Binary file not shown.

View File

@@ -9,7 +9,7 @@
//////////////////////////////////////////////////////// ////////////////////////////////////////////////////////
///////////////// 支付宝标准版本支付SDK /////////////////// ///////////////// 支付宝标准版本支付SDK ///////////////////
///////// version:15.7.7 motify:2020.07.02/////////// ///////// version:15.7.9 motify:2020.07.27///////////
//////////////////////////////////////////////////////// ////////////////////////////////////////////////////////
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>

View File

@@ -1,18 +1,20 @@
{ {
"name": "@uiw/react-native-alipay", "name": "@uiw/react-native-alipay",
"version": "2.0.7", "version": "2.1.0",
"description": "基于 React Native 的支付宝插件支持Android/iOS。", "description": "基于 React Native 的支付宝插件支持Android/iOS。",
"main": "index.js", "main": "index.js",
"typings": "index.d.ts",
"files": [ "files": [
"README.md", "android/libs",
"android", "android/src",
"index.js", "android/build.gradle",
"index.d.ts",
"ios", "ios",
"react-native-alipay.podspec" "index.d.ts",
"index.js",
"README.md"
], ],
"scripts": { "scripts": {
"test": "echo \"Error: no test specified\" && exit 1" "build": "typedoc"
}, },
"repository": { "repository": {
"type": "git", "type": "git",
@@ -40,7 +42,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
}