支付宝转账,发红包实现

This commit is contained in:
egzosn
2020-05-19 23:12:26 +08:00
parent 739f850902
commit 780a4c52e4
4 changed files with 144 additions and 15 deletions

View File

@@ -88,14 +88,6 @@ public enum AliTransactionType implements TransactionType {
* 下载对账单
*/
DOWNLOADBILL("alipay.data.dataservice.bill.downloadurl.query"),
/**
* 转账到支付宝
*/
TRANS("alipay.fund.trans.toaccount.transfer"),
/**
* 转账查询
*/
TRANS_QUERY("alipay.fund.trans.order.query"),
/**
* 查询刷脸结果信息
* 暂时未接入

View File

@@ -0,0 +1,58 @@
package com.egzosn.pay.ali.bean;
import com.egzosn.pay.common.bean.TransferOrder;
/**
* 支付转账(红包)订单
* @author egan
* date 2020/5/18 21:08
* email egzosn@gmail.com
*/
public class AliTransferOrder extends TransferOrder {
private String orderTitle;
private String identity;
private String identityType;
private String name;
private String businessParams;
public String getOrderTitle() {
return orderTitle;
}
public void setOrderTitle(String orderTitle) {
this.orderTitle = orderTitle;
}
public String getIdentity() {
return identity;
}
public void setIdentity(String identity) {
this.identity = identity;
}
public String getIdentityType() {
return identityType;
}
public void setIdentityType(String identityType) {
this.identityType = identityType;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getBusinessParams() {
return businessParams;
}
public void setBusinessParams(String businessParams) {
this.businessParams = businessParams;
}
}

View File

@@ -2,6 +2,9 @@ package com.egzosn.pay.ali.bean;
import com.egzosn.pay.common.bean.TransferType;
import java.util.HashMap;
import java.util.Map;
/**
* 收款方账户类型
* @author egan
@@ -10,17 +13,59 @@ import com.egzosn.pay.common.bean.TransferType;
*/
public enum AliTransferType implements TransferType {
/**
* 支付宝账号对应的支付宝唯一用户号。以2088开头的16位纯数字组成。
* 单笔无密转账到支付宝账户固定为
*/
ALIPAY_USERID,
TRANS_ACCOUNT_NO_PWD("alipay.fund.trans.uni.transfer", "DIRECT_TRANSFER"),
/**
* 支付宝登录号,支持邮箱和手机号格式。
* 单笔无密转账到银行卡固定为
*/
ALIPAY_LOGONID
;
TRANS_BANKCARD_NO_PWD("alipay.fund.trans.uni.transfer", "DIRECT_TRANSFER"),
/**
* 收发现金红包固定为
*/
STD_RED_PACKET("alipay.fund.trans.uni.transfer", "DIRECT_TRANSFER"),
/**
* 现金红包无线支付接口
*/
STD_RED_PACKET_APP("alipay.fund.trans.app.pay", "PERSONAL_PAY"){
/**
* 获取转账类型
*
* @return 转账类型
*/
@Override
public String getType() {
return STD_RED_PACKET.name();
}
},
/**
* 获取转账类型
* 转账查询
*/
TRANS_QUERY("alipay.fund.trans.order.query")
;
/**
* 接口名称
*/
private String method;
/**
* 业务场景
*/
private String bizScene;
AliTransferType(String method) {
this.method = method;
}
AliTransferType(String method, String bizScene) {
this.method = method;
this.bizScene = bizScene;
}
/**
* 获取转账类型, product_code 业务产品码
*
* @return 转账类型
*/
@@ -29,6 +74,10 @@ public enum AliTransferType implements TransferType {
return name();
}
public String getBizScene() {
return bizScene;
}
/**
* 获取接口
*
@@ -36,6 +85,17 @@ public enum AliTransferType implements TransferType {
*/
@Override
public String getMethod() {
return name();
return method;
}
/**
* 设置属性
* @param attr 已有属性对象
* @return 属性对象
*/
public Map<String, Object> setAttr(Map<String, Object> attr){
attr.put("product_code", getType());
attr.put("biz_scene", getBizScene());
return attr;
}
}

View File

@@ -0,0 +1,19 @@
package com.egzosn.pay.ali.bean;
/**
* 参与方的标识类型
* @author egan
* date 2020/5/19 21:45
* email egzosn@gmail.com
*/
public enum IdentityType {
/**
* 支付宝的会员ID
*/
ALIPAY_USER_ID,
/**
* 支付宝登录号,支持邮箱和手机号格式
*/
ALIPAY_LOGON_ID
}