Skip to content

Commit

Permalink
release 0.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Jamling committed Jan 8, 2019
1 parent a02e9ad commit 7400c62
Show file tree
Hide file tree
Showing 5 changed files with 72 additions and 4 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

af-pay原为[QuickAF](一个快速的Android开发框架)中的支付组件,现已抽取出来作为一个单独的Android支付库, 支持支付宝,微信支付,并且同时支持客户端下单与服务端下单。

0.2.0及其以上版本支付银联支付,如需使用银联支付,[请点击这里](unipay.md)

新的版本(0.1.0及其以上)没有提供纯净版,如果您使用的是0.1以下版本,请移步[旧文档](README_old.md)

### 在Android中直接使用
Expand Down Expand Up @@ -153,6 +155,10 @@ private void doWxpay(String orderInfo) {

## 版本记录

### 0.2.0
- 支付银联支付 (aar sdk 3.5.4)
- 添加一些设计资源

### 0.1.0
- 使用支付宝最新的aar sdk 15.5.9
- 使用微信支付sdk 5.1.6
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/java/cn/ieclipse/pay/demo/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -215,15 +215,15 @@ public void onPayFailure(cn.ieclipse.pay.union.PayResult payResult) {
showToast(activity, "支付失败");
}
});
if (!TextUtils.isEmpty(orderInfo)) {
if (!TextUtils.isEmpty(orderInfo)) {// 正式环境
unionPay.pay(orderInfo, "00");
}
else {
UnionPay.DefaultTnTask tnTask = new UnionPay.DefaultTnTask(unionPay) {
@Override
protected void onPostExecute(String result) {
super.onPostExecute(result);
unionPay.pay(result, "01");
unionPay.pay(result, "01"); // 测试
}
};
tnTask.execute();
Expand Down
2 changes: 1 addition & 1 deletion library/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ publish {
userOrg = 'jamling'
groupId = 'cn.ieclipse.af'
artifactId = pure ? "af-pay-pure" : 'af-pay'
publishVersion = '0.1.0'
publishVersion = '0.2.0'
desc = 'An Android pay sdk'
website = 'https://github.com/Jamling/af-pay'
bintrayUser = 'jamling'
Expand Down
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
include ':library'
include ':library', ':wxsample'
include ':unionpay'
include ':app'
62 changes: 62 additions & 0 deletions unionpay.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# 银联支付

## 添加依赖库

```gradle
dependencies {
compile 'cn.ieclipse.aar-ref:unionpay:3.5.4'
}
```
## 示例代码

类似支付宝支付,与支付宝不同的是,银联必须在服务端下单,然后通过服务端返回的TN来调起支付。

```java
private void doUnionPay(String orderInfo) {
final Activity activity = this;
UnionPay.DEBUG = true; // 开启日志
final UnionPay unionPay = UnionPay.getInstance(activity);
unionPay.setPayListener(new UnionPay.PayListener() {
@Override
public void onPaySuccess(cn.ieclipse.pay.union.PayResult payResult) {
showToast(activity, "支付成功");
}

@Override
public void onPayCancel(cn.ieclipse.pay.union.PayResult payResult) {
showToast(activity, "支付取消");
}

@Override
public void onPayFailure(cn.ieclipse.pay.union.PayResult payResult) {
showToast(activity, "支付失败");
}
});
if (!TextUtils.isEmpty(orderInfo)) {// 正式环境
unionPay.pay(orderInfo, "00");
}
else {
UnionPay.DefaultTnTask tnTask = new UnionPay.DefaultTnTask(unionPay) {
@Override
protected void onPostExecute(String result) {
super.onPostExecute(result);
unionPay.pay(result, "01"); // 测试
}
};
tnTask.execute();
}
}
```

## 测试账号

```
// 华夏银行贷记卡:6226388000000095
// 手机号:18100000000
// cvn2:248
// 有效期:1219
// 短信验证码:111111(先点获取验证码之后再输入)
// 证件类型:01身份证
// 证件号:510265790128303
// 姓名:张三
```

0 comments on commit 7400c62

Please sign in to comment.