Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
hackerfj authored Sep 16, 2018
1 parent 3d05e0d commit 8993f80
Showing 1 changed file with 104 additions and 89 deletions.
193 changes: 104 additions & 89 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,94 +1,109 @@
# WindingPay
遨易科技支付插件
1.里面集成了支付宝支付和微信支付
一分钟集成集成支付不是梦
现在仅支持支付宝和微信
之后将集成银联等支付方式


将其添加到存储库末尾的根build.gradle中:<br/>
allprojects {<br/>
&nbsp;&nbsp;&nbsp; repositories {<br/>
&nbsp;&nbsp;&nbsp; ...<br/>
&nbsp;&nbsp;&nbsp; maven { url 'https://jitpack.io' }<br/>
&nbsp;&nbsp; }<br/>
}<br/>

第2步.添加依赖关系<br/>
dependencies {<br/>
&nbsp;&nbsp; compile 'com.github.luckyfj:WindingPay:v1.0.0'<br/>
}<br/>
<br/>
#支付宝支付 使用方法<br/>
-----------------------------<br/>
PayFactory.createPay(PayFactory.ALPAY,MainActivity.this,“支付宝订单KEY”)<br/>
.setOnResultListener(new IPayBean.OnResultListener() {<br/>
@Override<br/>
public void onPaySuccess() {<br/>
&nbsp;&nbsp;      //TODO 支付宝支付支付成功回调<br/>
}<br/>
@Override<br/>
public void onPayFail() {<br/>
&nbsp;&nbsp;       //TODO 支付宝支付支付失败回调<br/>
}<br/>
});<br/>
----------------------------<br/>
#微信支付 使用方式<br/>
----------------------------<br/>
//微信支付<br/>
PayFactory.createPay(PayFactory.WXPAY, MainActivity.this,”微信订单KEY“)<br/>
.setOnResultListener(new IPayBean.OnResultListener() {<br/>
@Override<br/>
public void onPaySuccess() {<br/>
&nbsp;&nbsp;       //TODO 微信支付支付成功回调<br/>
}<br/>
<br/>
@Override<br/>
public void onPayFail() {<br/>
&nbsp;&nbsp;         //TODO 微信支付支付失败回调<br/>
   }<br/>
}));<br/>


微信支付回调配置

新建一个wxapi文件夹
然后新建类

public class WXPayEntryActivity extends Activity implements IWXAPIEventHandler {

private IWXAPI api;

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
  api = WXAPIFactory.createWXAPI(this,"wx18eaff444811186d");//填写微信APPKey
       api.handleIntent(getIntent(), this);
}

@Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
setIntent(intent);
api.handleIntent(intent, this);
}
### 遨易科技支付插件

@Override
public void onReq(BaseReq req) {
}
#### 集成了支付宝支付和微信支付一分钟集成集成支付不是梦现在仅支持支付宝和微信之后将集成银联等支付方式

@Override
public void onResp(BaseResp resp) {
if (resp.getType() == ConstantsAPI.COMMAND_PAY_BY_WX) {
Log.i("SLL",""+resp.errCode);
if(resp.errCode == 0){
Toast.makeText(this, "支付成功!", Toast.LENGTH_SHORT).show();
}else if(resp.errCode == -2){
Toast.makeText(this, "支付取消!", Toast.LENGTH_SHORT).show();
}
finish();


第一步 将其添加到存储库末尾的根的build.gradle中:


allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
第2步.添加依赖关系:

dependencies {
compile 'com.github.luckyfj:WindingPay:v1.0.0'
}
}
}

#### 支付宝支付 使用方法
```javascript
//支付宝支付
AliPay.setOnClickListener(v -> PayFactory.createPay(PayFactory.ALPAY,this,“支付宝订单码”)
.setOnResultListener(new IPayBean.OnResultListener() {
@Override
public void onPaySuccess() {
Toast.makeText(MainActivity.this, "支付宝支付成功!", Toast.LENGTH_SHORT).show();
}

@Override
public void onPayFail() {
Toast.makeText(MainActivity.this, "支付宝支付失败!", Toast.LENGTH_SHORT).show();
}
}));
```

#### 微信支付 使用方法
```javascript
//微信支付
WeChatPay.setOnClickListener(v -> PayFactory.createPay(PayFactory.WXPAY, MainActivity.this,WechatPayData)
.setOnResultListener(new IPayBean.OnResultListener() {
@Override
public void onPaySuccess() {
Toast.makeText(MainActivity.this, "微信支付成功!", Toast.LENGTH_SHORT).show();
}

@Override
public void onPayFail() {
Toast.makeText(MainActivity.this, "微信支付失败!", Toast.LENGTH_SHORT).show();
}
}));
```

### 微信支付回调配置
1.新建一个wxapi文件夹 然后新建类
```javascript
public class WXPayEntryActivity extends Activity implements IWXAPIEventHandler {

private IWXAPI api;

public IPayBean.OnResultListener listener;

public void setOnResultListener(IPayBean.OnResultListener listener) {
this.listener = listener;
}

public interface OnResultListener {

void onPaySuccess();

void onPayFail();
}

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
api = WXAPIFactory.createWXAPI(this,"wx18eaff444811186d");//填写微信的APPKey
api.handleIntent(getIntent(), this);
}

@Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
setIntent(intent);
api.handleIntent(intent, this);
}

@Override
public void onReq(BaseReq req) {
}

@Override
public void onResp(BaseResp resp) {
if (resp.getType() == ConstantsAPI.COMMAND_PAY_BY_WX) {
Log.i("SLL",""+resp.errCode);
if(resp.errCode == 0){
listener.onPaySuccess();
Toast.makeText(this, "支付成功!", Toast.LENGTH_SHORT).show();
}else if(resp.errCode == -2){
listener.onPayFail();
Toast.makeText(this, "支付取消!", Toast.LENGTH_SHORT).show();
}
finish();
}
}
}
```

0 comments on commit 8993f80

Please sign in to comment.