Commit f70fb081 by zhenzijun

juhezhong接口补充

parent c76709b7
......@@ -14,6 +14,20 @@ public class ComCode {
public static final String signCode = "Y0UKA@2018";
/**
* 新juhezhong相关url
* 2018/05/31
*/
/** 域名 **/
public static final String JUHEZHONG_URL = "http://pay.hezhongpay.com";
/** 快捷B接口 **/
public static final String QUICK_PAY = "/quick/pay";
/** 查询订单接口 **/
public static final String ORDER_QUERY = "/order/query";
/** 银联WAP快捷(借) **/
public static final String QUICK_WEB_PAY = "/quick/web/pay";
/**
* juhezhong相关参数
*/
public static final String HOST = "http://pay.hezhongpay.com"; // 请求地址
......
package com.thinkgem.jeesite.common.utils;
import com.thinkgem.jeesite.common.constant.ComCode;
import com.thinkgem.jeesite.modules.pay.juhezhong.dto.JuhezhongBaseDto;
import com.thinkgem.jeesite.modules.pay.juhezhong.utils.Bean2Map;
import com.thinkgem.jeesite.modules.pay.juhezhong.utils.SignUtils;
import java.util.Map;
public class JuhezhongUtils {
public static Map<String,Object> juhezhongBaseDtoToMap(JuhezhongBaseDto dto){
Map<String, Object> params = Bean2Map.Entity2Map(dto);
String signBefore = SignUtils.signBefore(params);
String sign = null;
try {
sign = SignUtils.sign(signBefore, ComCode.MERCHANT_SECRET);
} catch (Exception e) {
e.printStackTrace();
}
params.put("sign", sign);
return params;
}
}
package com.thinkgem.jeesite.modules.pay.juhezhong.dto;
public class JuhezhongBaseDto {
/**
* 订单号
* quickBPay 必传
* orderQuery 必传
* webPay 必传
*/
private String orderId;
/**
* 商户号
* quickBPay 必传
* orderQuery 必传
* webPay 必传
*/
private String merchantId;
/**
* 通商户key
* quickBPay 必传
* orderQuery 必传
* webPay 必传
*/
private String merchantKey;
/**
* 签名
* quickBPay 必传
* orderQuery 必传
* webPay 必传
*/
private String sign;
public String getOrderId() {
return orderId;
}
public void setOrderId(String orderId) {
this.orderId = orderId;
}
public String getMerchantId() {
return merchantId;
}
public void setMerchantId(String merchantId) {
this.merchantId = merchantId;
}
public String getMerchantKey() {
return merchantKey;
}
public void setMerchantKey(String merchantKey) {
this.merchantKey = merchantKey;
}
public String getSign() {
return sign;
}
public void setSign(String sign) {
this.sign = sign;
}
}
package com.thinkgem.jeesite.modules.pay.juhezhong.dto;
public class JuhezhongDto extends JuhezhongBaseDto implements java.io.Serializable{
/**
* 订单金额 (分)
* quickBPay 必传
* webPay 必传
*/
private Integer amount;
/**
* 交易类型
* quickBPay 必传
*/
private Integer trxType;
/**
* 5 借记卡 只能 D0 6 贷记卡 D0 t1
* quickBPay 必传
* webPay 必传
*/
private Integer type;
/**
* 支付卡号
* quickBPay 必传
*/
private String bankNo;
/**
* 安全码
* quickBPay 必传
*/
private String cvn2;
/**
* 支付卡预留手机号
* quickBPay 必传
*/
private String phone;
/**
* 信用卡有效期(MMYY)
* quickBPay 必传
*/
private String expired;
/**
* 手续费 单位:分 ,D0 业务必传
*/
private Integer userFee;
/**
* 结算银行 D0 业务必传
*/
private String settleBankName;
/**
* 一个身份证只能对应一个结算卡 D0 业务必传
*/
private String settleBankNo;
/**
* 结算卡预留手机号 D0 业务必传
*/
private String settleBankPhone;
/**
* 开户名 D0 业务必传
*/
private String name;
/**
* 开户人身份证号 D0 业务必传
*/
private String certificateCode;
/**
* 通知url
* quickBPay 必传
* webPay 必传
*/
private String notifyUrl;
/**
* 前台地址 get 请求地址 frontUrl?code=0000&orderId=xxx&msg=xxx
* quickBPay 必传
* webPay 必传
*/
private String frontUrl;
/**
* 记录用户绑卡信息
*/
private String userId;
/**
* 时间戳
* quickBPay 必传
* orderQuery 必传
* webPay 必传
*/
private Long timestamp;
/**
* 商品描述
* webPay 必传
*/
private String productName;
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public String getProductName() {
return productName;
}
public void setProductName(String productName) {
this.productName = productName;
}
public Integer getAmount() {
return amount;
}
public void setAmount(Integer amount) {
this.amount = amount;
}
public Integer getTrxType() {
return trxType;
}
public void setTrxType(Integer trxType) {
this.trxType = trxType;
}
public Integer getType() {
return type;
}
public void setType(Integer type) {
this.type = type;
}
public String getBankNo() {
return bankNo;
}
public void setBankNo(String bankNo) {
this.bankNo = bankNo;
}
public String getCvn2() {
return cvn2;
}
public void setCvn2(String cvn2) {
this.cvn2 = cvn2;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getExpired() {
return expired;
}
public void setExpired(String expired) {
this.expired = expired;
}
public Integer getUserFee() {
return userFee;
}
public void setUserFee(Integer userFee) {
this.userFee = userFee;
}
public String getSettleBankName() {
return settleBankName;
}
public void setSettleBankName(String settleBankName) {
this.settleBankName = settleBankName;
}
public String getSettleBankNo() {
return settleBankNo;
}
public void setSettleBankNo(String settleBankNo) {
this.settleBankNo = settleBankNo;
}
public String getSettleBankPhone() {
return settleBankPhone;
}
public void setSettleBankPhone(String settleBankPhone) {
this.settleBankPhone = settleBankPhone;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getCertificateCode() {
return certificateCode;
}
public void setCertificateCode(String certificateCode) {
this.certificateCode = certificateCode;
}
public String getNotifyUrl() {
return notifyUrl;
}
public void setNotifyUrl(String notifyUrl) {
this.notifyUrl = notifyUrl;
}
public String getFrontUrl() {
return frontUrl;
}
public void setFrontUrl(String frontUrl) {
this.frontUrl = frontUrl;
}
public Long getTimestamp() {
return timestamp;
}
public void setTimestamp(Long timestamp) {
this.timestamp = timestamp;
}
}
......@@ -2,10 +2,8 @@ package com.thinkgem.jeesite.modules.pay.juhezhong.service;
import com.alibaba.fastjson.JSONObject;
import com.thinkgem.jeesite.common.constant.ComCode;
import com.thinkgem.jeesite.modules.pay.juhezhong.dto.ApiQuickPayDto;
import com.thinkgem.jeesite.modules.pay.juhezhong.dto.MerchantDto;
import com.thinkgem.jeesite.modules.pay.juhezhong.dto.CommonDto;
import com.thinkgem.jeesite.modules.pay.juhezhong.dto.QuickDto;
import com.thinkgem.jeesite.common.utils.JuhezhongUtils;
import com.thinkgem.jeesite.modules.pay.juhezhong.dto.*;
import com.thinkgem.jeesite.modules.pay.juhezhong.utils.Bean2Map;
import com.thinkgem.jeesite.modules.pay.juhezhong.utils.HttpUtil;
import com.thinkgem.jeesite.modules.pay.juhezhong.utils.SignUtils;
......@@ -25,6 +23,39 @@ import java.util.Map;
public class JuHeZhongPayService {
/**
* 2018/05/31
* 快捷B接口
* @return
*/
public JSONObject quickBPay(JuhezhongDto dto) throws Exception {
Map<String, Object> params = JuhezhongUtils.juhezhongBaseDtoToMap(dto);
String respStr = HttpUtil.post(ComCode.JUHEZHONG_URL + ComCode.QUICK_PAY, params);
return JSONObject.parseObject(respStr);
}
/**
* 2018/05/31
* 查询订单接口
* @return
*/
public JSONObject orderQuery(JuhezhongDto dto) throws Exception {
Map<String, Object> params = JuhezhongUtils.juhezhongBaseDtoToMap(dto);
String respStr = HttpUtil.post(ComCode.JUHEZHONG_URL + ComCode.ORDER_QUERY, params);
return JSONObject.parseObject(respStr);
}
/**
* 2018/05/31
* 银联WAP快捷(借)
* @return
*/
public JSONObject quickWebPay(JuhezhongDto dto) throws Exception {
Map<String, Object> params = JuhezhongUtils.juhezhongBaseDtoToMap(dto);
String respStr = HttpUtil.post(ComCode.JUHEZHONG_URL + ComCode.QUICK_WEB_PAY, params);
return JSONObject.parseObject(respStr);
}
/**
* 注册子商户
*
* @param dto
......@@ -158,6 +189,7 @@ public class JuHeZhongPayService {
dto.setOrderId("Dy58WqJG3MmNpSpQMq3wKZV55OiO48asPzRp4YUBBZUsVEiow7q6CZTQqwrBTl4k");
dto.setMerchantId(ComCode.MERCHANT_ID);
dto.setMerchantKey(ComCode.MERCHANT_KEY);
dto.setTimestamp(System.currentTimeMillis());
Map<String, Object> params = Bean2Map.Entity2Map(dto);
String signBefore = SignUtils.signBefore(params);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment