Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
Jeepay
Commits
d53783a9
Commit
d53783a9
authored
Aug 12, 2017
by
jmdhappy
Browse files
初始化提交
parent
324ccaaf
Changes
465
Hide whitespace changes
Inline
Side-by-side
xxpay4spring-cloud/xxpay-service/src/main/java/org/xxpay/service/channel/tencent/common/report/protocol/ReportResData.java
0 → 100755
View file @
d53783a9
package
org.xxpay.service.channel.tencent.common.report.protocol
;
/**
* User: rizenguo
* Date: 2014/11/12
* Time: 17:06
*/
public
class
ReportResData
{
//以下是API接口返回的对应数据
private
String
return_code
;
private
String
return_msg
;
private
String
result_code
;
public
String
getReturn_code
()
{
return
return_code
;
}
public
void
setReturn_code
(
String
return_code
)
{
this
.
return_code
=
return_code
;
}
public
String
getReturn_msg
()
{
return
return_msg
;
}
public
void
setReturn_msg
(
String
return_msg
)
{
this
.
return_msg
=
return_msg
;
}
public
String
getResult_code
()
{
return
result_code
;
}
public
void
setResult_code
(
String
result_code
)
{
this
.
result_code
=
result_code
;
}
}
xxpay4spring-cloud/xxpay-service/src/main/java/org/xxpay/service/channel/tencent/common/report/service/ReportService.java
0 → 100755
View file @
d53783a9
package
org.xxpay.service.channel.tencent.common.report.service
;
import
org.xxpay.service.channel.tencent.common.Configure
;
import
org.xxpay.service.channel.tencent.common.HttpsRequest
;
import
org.xxpay.service.channel.tencent.common.Util
;
import
org.xxpay.service.channel.tencent.common.report.protocol.ReportReqData
;
import
org.springframework.stereotype.Service
;
import
java.io.IOException
;
import
java.security.KeyManagementException
;
import
java.security.KeyStoreException
;
import
java.security.NoSuchAlgorithmException
;
import
java.security.UnrecoverableKeyException
;
import
java.text.SimpleDateFormat
;
import
java.util.Date
;
/**
* User: rizenguo
* Date: 2014/11/12
* Time: 17:07
*/
@Service
public
class
ReportService
{
private
ReportReqData
reqData
;
/**
* 请求统计上报API
* @param reportReqData 这个数据对象里面包含了API要求提交的各种数据字段
*/
public
ReportService
(
ReportReqData
reportReqData
){
reqData
=
reportReqData
;
}
public
ReportService
(){
}
public
String
request
()
throws
UnrecoverableKeyException
,
KeyManagementException
,
NoSuchAlgorithmException
,
KeyStoreException
,
IOException
{
String
responseString
=
new
HttpsRequest
().
sendPost
(
Configure
.
REPORT_API
,
reqData
);
Util
.
log
(
" report返回的数据:"
+
responseString
);
return
responseString
;
}
/**
* 请求统计上报API
* @param reportReqData 这个数据对象里面包含了API要求提交的各种数据字段
* @return API返回的数据
* @throws Exception
*/
public
static
String
request
(
ReportReqData
reportReqData
)
throws
Exception
{
//--------------------------------------------------------------------
//发送HTTPS的Post请求到API地址
//--------------------------------------------------------------------
String
responseString
=
new
HttpsRequest
().
sendPost
(
Configure
.
REPORT_API
,
reportReqData
);
Util
.
log
(
"report返回的数据:"
+
responseString
);
return
responseString
;
}
/**
* 获取time:统计发送时间,格式为yyyyMMddHHmmss,如2009年12 月25 日9 点10 分10 秒表示为20091225091010。时区为GMT+8 beijing。
* @return 订单生成时间
*/
private
static
String
getTime
(){
//订单生成时间自然就是当前服务器系统时间咯
SimpleDateFormat
simpleDateFormat
=
new
SimpleDateFormat
(
"yyyyMMddHHmmss"
);
return
simpleDateFormat
.
format
(
new
Date
());
}
}
xxpay4spring-cloud/xxpay-service/src/main/java/org/xxpay/service/channel/tencent/protocol/downloadbill_protocol/DownloadBillReqData.java
0 → 100755
View file @
d53783a9
package
org.xxpay.service.channel.tencent.protocol.downloadbill_protocol
;
import
org.xxpay.service.channel.tencent.common.Configure
;
import
org.xxpay.service.channel.tencent.common.RandomStringGenerator
;
import
org.xxpay.service.channel.tencent.common.Signature
;
import
java.lang.reflect.Field
;
import
java.util.HashMap
;
import
java.util.Map
;
/**
* User: rizenguo
* Date: 2014/10/25
* Time: 16:48
*/
public
class
DownloadBillReqData
{
//每个字段具体的意思请查看API文档
private
String
appid
=
""
;
private
String
mch_id
=
""
;
private
String
device_info
=
""
;
private
String
nonce_str
=
""
;
private
String
sign
=
""
;
private
String
bill_date
=
""
;
private
String
bill_type
=
""
;
/**
* 请求对账单下载服务
* @param deviceInfo 商户自己定义的扫码支付终端设备号,方便追溯这笔交易发生在哪台终端设备上
* @param billDate 下载对账单的日期,格式:yyyyMMdd 例如:20140603
* @param billType 账单类型
* ALL,返回当日所有订单信息,默认值
SUCCESS,返回当日成功支付的订单
REFUND,返回当日退款订单
REVOKED,已撤销的订单
*/
public
DownloadBillReqData
(
Configure
configure
,
String
deviceInfo
,
String
billDate
,
String
billType
){
//微信分配的公众号ID(开通公众号之后可以获取到)
setAppid
(
configure
.
getAppID
());
//微信支付分配的商户号ID(开通公众号的微信支付功能之后可以获取到)
setMch_id
(
configure
.
getMchID
());
//商户自己定义的扫码支付终端设备号,方便追溯这笔交易发生在哪台终端设备上
setDevice_info
(
deviceInfo
);
setBill_date
(
billDate
);
setBill_type
(
billType
);
//随机字符串,不长于32 位
setNonce_str
(
RandomStringGenerator
.
getRandomStringByLength
(
32
));
//根据API给的签名规则进行签名
String
sign
=
Signature
.
getSign
(
toMap
(),
configure
.
getKey
());
setSign
(
sign
);
//把签名数据设置到Sign这个属性中
}
public
String
getAppid
()
{
return
appid
;
}
public
void
setAppid
(
String
appid
)
{
this
.
appid
=
appid
;
}
public
String
getMch_id
()
{
return
mch_id
;
}
public
void
setMch_id
(
String
mch_id
)
{
this
.
mch_id
=
mch_id
;
}
public
String
getDevice_info
()
{
return
device_info
;
}
public
void
setDevice_info
(
String
device_info
)
{
this
.
device_info
=
device_info
;
}
public
String
getNonce_str
()
{
return
nonce_str
;
}
public
void
setNonce_str
(
String
nonce_str
)
{
this
.
nonce_str
=
nonce_str
;
}
public
String
getSign
()
{
return
sign
;
}
public
void
setSign
(
String
sign
)
{
this
.
sign
=
sign
;
}
public
String
getBill_date
()
{
return
bill_date
;
}
public
void
setBill_date
(
String
bill_date
)
{
this
.
bill_date
=
bill_date
;
}
public
String
getBill_type
()
{
return
bill_type
;
}
public
void
setBill_type
(
String
bill_type
)
{
this
.
bill_type
=
bill_type
;
}
public
Map
<
String
,
Object
>
toMap
(){
Map
<
String
,
Object
>
map
=
new
HashMap
<
String
,
Object
>();
Field
[]
fields
=
this
.
getClass
().
getDeclaredFields
();
for
(
Field
field
:
fields
)
{
Object
obj
;
try
{
obj
=
field
.
get
(
this
);
if
(
obj
!=
null
){
map
.
put
(
field
.
getName
(),
obj
);
}
}
catch
(
IllegalArgumentException
e
)
{
e
.
printStackTrace
();
}
catch
(
IllegalAccessException
e
)
{
e
.
printStackTrace
();
}
}
return
map
;
}
}
xxpay4spring-cloud/xxpay-service/src/main/java/org/xxpay/service/channel/tencent/protocol/downloadbill_protocol/DownloadBillResData.java
0 → 100755
View file @
d53783a9
package
org.xxpay.service.channel.tencent.protocol.downloadbill_protocol
;
/**
* User: rizenguo
* Date: 2014/10/25
* Time: 16:48
*/
public
class
DownloadBillResData
{
//协议层
private
String
return_code
=
""
;
private
String
return_msg
=
""
;
public
String
getReturn_code
()
{
return
return_code
;
}
public
void
setReturn_code
(
String
return_code
)
{
this
.
return_code
=
return_code
;
}
public
String
getReturn_msg
()
{
return
return_msg
;
}
public
void
setReturn_msg
(
String
return_msg
)
{
this
.
return_msg
=
return_msg
;
}
}
xxpay4spring-cloud/xxpay-service/src/main/java/org/xxpay/service/channel/tencent/protocol/notify_protocol/NotifyUnifiedOrderReqData.java
0 → 100755
View file @
d53783a9
package
org.xxpay.service.channel.tencent.protocol.notify_protocol
;
/**
* User: dingzhiwei
* Date: 2016/05/13
* Time: 15:03
*/
import
java.io.Serializable
;
/**
* 统一下单通知请求数据
*/
public
class
NotifyUnifiedOrderReqData
implements
Serializable
{
private
static
final
long
serialVersionUID
=
-
6165278068603647287L
;
//协议层
private
String
return_code
;
// 返回状态码
private
String
return_msg
;
// 返回信息
//协议返回的具体数据(以下字段在return_code 为SUCCESS 的时候有返回)
private
String
appid
;
// 应用APPID
private
String
mch_id
;
// 商户号
private
String
device_info
;
// 设备号
private
String
nonce_str
;
// 随机字符串
private
String
sign
;
// 签名
private
String
result_code
;
// 业务结果
private
String
err_code
;
// 错误代码
private
String
err_code_des
;
// 错误代码描述
private
String
openid
;
// 用户标识
private
String
is_subscribe
;
// 是否关注公众号
private
String
trade_type
;
// 交易类型
private
String
bank_type
;
// 付款银行
private
String
total_fee
;
// 总金额
private
String
fee_type
;
// 货币种类
private
String
cash_fee
;
// 现金支付金额
private
String
cash_fee_type
;
// 现金支付货币类型
private
String
coupon_fee
;
// 代金券或立减优惠金额
private
String
coupon_count
;
// 代金券或立减优惠使用数量
private
String
transaction_id
;
// 微信支付订单号
private
String
out_trade_no
;
// 单个代金券或立减优惠支付金额
private
String
attach
;
// 商家数据包
private
String
time_end
;
// 支付完成时间
public
String
getAppid
()
{
return
appid
;
}
public
void
setAppid
(
String
appid
)
{
this
.
appid
=
appid
;
}
public
String
getAttach
()
{
return
attach
;
}
public
void
setAttach
(
String
attach
)
{
this
.
attach
=
attach
;
}
public
String
getBank_type
()
{
return
bank_type
;
}
public
void
setBank_type
(
String
bank_type
)
{
this
.
bank_type
=
bank_type
;
}
public
String
getCash_fee
()
{
return
cash_fee
;
}
public
void
setCash_fee
(
String
cash_fee
)
{
this
.
cash_fee
=
cash_fee
;
}
public
String
getCash_fee_type
()
{
return
cash_fee_type
;
}
public
void
setCash_fee_type
(
String
cash_fee_type
)
{
this
.
cash_fee_type
=
cash_fee_type
;
}
public
String
getCoupon_count
()
{
return
coupon_count
;
}
public
void
setCoupon_count
(
String
coupon_count
)
{
this
.
coupon_count
=
coupon_count
;
}
public
String
getCoupon_fee
()
{
return
coupon_fee
;
}
public
void
setCoupon_fee
(
String
coupon_fee
)
{
this
.
coupon_fee
=
coupon_fee
;
}
public
String
getDevice_info
()
{
return
device_info
;
}
public
void
setDevice_info
(
String
device_info
)
{
this
.
device_info
=
device_info
;
}
public
String
getErr_code
()
{
return
err_code
;
}
public
void
setErr_code
(
String
err_code
)
{
this
.
err_code
=
err_code
;
}
public
String
getErr_code_des
()
{
return
err_code_des
;
}
public
void
setErr_code_des
(
String
err_code_des
)
{
this
.
err_code_des
=
err_code_des
;
}
public
String
getFee_type
()
{
return
fee_type
;
}
public
void
setFee_type
(
String
fee_type
)
{
this
.
fee_type
=
fee_type
;
}
public
String
getIs_subscribe
()
{
return
is_subscribe
;
}
public
void
setIs_subscribe
(
String
is_subscribe
)
{
this
.
is_subscribe
=
is_subscribe
;
}
public
String
getMch_id
()
{
return
mch_id
;
}
public
void
setMch_id
(
String
mch_id
)
{
this
.
mch_id
=
mch_id
;
}
public
String
getNonce_str
()
{
return
nonce_str
;
}
public
void
setNonce_str
(
String
nonce_str
)
{
this
.
nonce_str
=
nonce_str
;
}
public
String
getOpenid
()
{
return
openid
;
}
public
void
setOpenid
(
String
openid
)
{
this
.
openid
=
openid
;
}
public
String
getOut_trade_no
()
{
return
out_trade_no
;
}
public
void
setOut_trade_no
(
String
out_trade_no
)
{
this
.
out_trade_no
=
out_trade_no
;
}
public
String
getResult_code
()
{
return
result_code
;
}
public
void
setResult_code
(
String
result_code
)
{
this
.
result_code
=
result_code
;
}
public
String
getReturn_code
()
{
return
return_code
;
}
public
void
setReturn_code
(
String
return_code
)
{
this
.
return_code
=
return_code
;
}
public
String
getReturn_msg
()
{
return
return_msg
;
}
public
void
setReturn_msg
(
String
return_msg
)
{
this
.
return_msg
=
return_msg
;
}
public
String
getSign
()
{
return
sign
;
}
public
void
setSign
(
String
sign
)
{
this
.
sign
=
sign
;
}
public
String
getTime_end
()
{
return
time_end
;
}
public
void
setTime_end
(
String
time_end
)
{
this
.
time_end
=
time_end
;
}
public
String
getTotal_fee
()
{
return
total_fee
;
}
public
void
setTotal_fee
(
String
total_fee
)
{
this
.
total_fee
=
total_fee
;
}
public
String
getTrade_type
()
{
return
trade_type
;
}
public
void
setTrade_type
(
String
trade_type
)
{
this
.
trade_type
=
trade_type
;
}
public
String
getTransaction_id
()
{
return
transaction_id
;
}
public
void
setTransaction_id
(
String
transaction_id
)
{
this
.
transaction_id
=
transaction_id
;
}
}
xxpay4spring-cloud/xxpay-service/src/main/java/org/xxpay/service/channel/tencent/protocol/notify_protocol/NotifyUnifiedOrderResData.java
0 → 100755
View file @
d53783a9
package
org.xxpay.service.channel.tencent.protocol.notify_protocol
;
/**
* User: dingzhiwei
* Date: 2016/05/13
* Time: 15:20
*/
import
java.io.Serializable
;
/**
* 统一下单通知响应数据
*/
public
class
NotifyUnifiedOrderResData
implements
Serializable
{
private
static
final
long
serialVersionUID
=
-
2089583048909946750L
;
//协议层
private
String
return_code
;
// 返回状态码
private
String
return_msg
;
// 返回信息
public
String
getReturn_code
()
{
return
return_code
;
}
public
void
setReturn_code
(
String
return_code
)
{
this
.
return_code
=
return_code
;
}
public
String
getReturn_msg
()
{
return
return_msg
;
}
public
void
setReturn_msg
(
String
return_msg
)
{
this
.
return_msg
=
return_msg
;
}
}
xxpay4spring-cloud/xxpay-service/src/main/java/org/xxpay/service/channel/tencent/protocol/order_protocol/UnifiedOrderReqData.java
0 → 100755
View file @
d53783a9
package
org.xxpay.service.channel.tencent.protocol.order_protocol
;
/**
* User: dingzhiwei
* Date: 2016/04/29
* Time: 18:06
*/
import
org.xxpay.service.channel.tencent.common.Configure
;
import
org.xxpay.service.channel.tencent.common.RandomStringGenerator
;
import
org.xxpay.service.channel.tencent.common.Signature
;
import
java.lang.reflect.Field
;
import
java.util.HashMap
;
import
java.util.Map
;
/**
* 请求统一下单API需要提交的数据
*/
public
class
UnifiedOrderReqData
{
private
String
appid
=
""
;
// 公众号或应用ID
private
String
mch_id
=
""
;
// 商户号
private
String
device_info
=
""
;
// 设备号
private
String
nonce_str
=
""
;
// 随机字符串
private
String
sign
=
""
;
// 签名
private
String
body
=
""
;
// 商品描述
private
String
detail
=
""
;
// 商品详情
private
String
attach
=
""
;
// 附加数据
private
String
out_trade_no
=
""
;
// 商户订单号
private
String
fee_type
=
""
;
// 货币类型
private
String
total_fee
=
""
;
// 总金额
private
String
spbill_create_ip
=
""
;
// 终端IP
private
String
time_start
=
""
;
// 交易起始时间
private
String
time_expire
=
""
;
// 交易结束时间
private
String
goods_tag
=
""
;
// 商品标记
private
String
notify_url
=
""
;
// 通知地址
private
String
trade_type
=
""
;
// 交易类型
private
String
product_id
=
""
;
// 商品ID
private
String
limit_pay
=
""
;
// 指定支付方式
private
String
openid
=
""
;
// 用户标识
/**
*
* @param deviceInfo 终端设备号(门店号或收银设备ID),注意:PC网页或公众号内支付请传"WEB"
* @param body 商品或支付单简要描述
* @param detail 商品名称明细列表
* @param attach 附加数据,在查询API和支付通知中原样返回,该字段主要用于商户携带订单的自定义数据
* @param outTradeNo 商户系统内部的订单号,32个字符内、可包含字母, 其他说明见商户订单号
* @param feeType 符合ISO 4217标准的三位字母代码,默认人民币:CNY,其他值列表详见货币类型
* @param totalFee 订单总金额,单位为分,详见支付金额
* @param spBillCreateIP APP和网页支付提交用户端ip,Native支付填调用微信支付API的机器IP
* @param timeStart 订单生成时间,格式为yyyyMMddHHmmss,如2009年12月25日9点10分10秒表示为20091225091010。其他详见时间规则
* @param timeExpire 订单失效时间,格式为yyyyMMddHHmmss,如2009年12月27日9点10分10秒表示为20091227091010。其他详见时间规则,注意:最短失效时间间隔必须大于5分钟
* @param goodsTag 商品标记,代金券或立减优惠功能的参数,说明详见代金券或立减优惠
* @param notifyUrl 接收微信支付异步通知回调地址,通知url必须为直接可访问的url,不能携带参数
* @param tradeType 取值:JSAPI--公众号支付、NATIVE--原生扫码支付、APP--app支付
* @param productId trade_type=NATIVE,此参数必传。此id为二维码中包含的商品ID,商户自行定义
* @param limitPay no_credit--指定不能使用信用卡支付
* @param openId trade_type=JSAPI,此参数必传,用户在商户appid下的唯一标识。
*/
public
UnifiedOrderReqData
(
Configure
configure
,
String
deviceInfo
,
String
body
,
String
detail
,
String
attach
,
String
outTradeNo
,
String
feeType
,
String
totalFee
,
String
spBillCreateIP
,
String
timeStart
,
String
timeExpire
,
String
goodsTag
,
String
notifyUrl
,
String
tradeType
,
String
productId
,
String
limitPay
,
String
openId
){
//微信分配的公众号ID(开通公众号之后可以获取到)
setAppid
(
configure
.
getAppID
());
//微信支付分配的商户号ID(开通公众号的微信支付功能之后可以获取到)
setMch_id
(
configure
.
getMchID
());
//支付终端设备号,方便追溯这笔交易发生在哪台终端设备上
setDevice_info
(
deviceInfo
);
//要支付的商品的描述信息,用户会在支付成功页面里看到这个信息
setBody
(
body
);
setDetail
(
detail
);
//商户系统内部的订单号,32个字符内可包含字母, 确保在商户系统唯一
setOut_trade_no
(
outTradeNo
);
setFee_type
(
feeType
);
//订单总金额,单位为“分”,只能整数
setTotal_fee
(
totalFee
);
//订单生成的机器IP
setSpbill_create_ip
(
spBillCreateIP
);
//订单生成时间, 格式为yyyyMMddHHmmss,如2009年12 月25 日9 点10 分10 秒表示为20091225091010。时区为GMT+8 beijing。该时间取自商户服务器
setTime_start
(
timeStart
);
//订单失效时间,格式同上
setTime_expire
(
timeExpire
);
//商品标记,微信平台配置的商品标记,用于优惠券或者满减使用
setGoods_tag
(
goodsTag
);
setNotify_url
(
notifyUrl
);
setTrade_type
(
tradeType
);
setProduct_id
(
productId
);
setLimit_pay
(
limitPay
);
setOpenid
(
openId
);
//随机字符串,不长于32 位
setNonce_str
(
RandomStringGenerator
.
getRandomStringByLength
(
32
));
//附加信息
setAttach
(
attach
);
//根据API给的签名规则进行签名
String
sign
=
Signature
.
getSign
(
toMap
(),
configure
.
getKey
());
setSign
(
sign
);
//把签名数据设置到Sign这个属性中
}
public
String
getAppid
()
{
return
appid
;
}
public
void
setAppid
(
String
appid
)
{
this
.
appid
=
appid
;
}
public
String
getMch_id
()
{
return
mch_id
;
}
public
void
setMch_id
(
String
mch_id
)
{
this
.
mch_id
=
mch_id
;
}
public
String
getDevice_info
()
{
return
device_info
;
}
public
void
setDevice_info
(
String
device_info
)
{
this
.
device_info
=
device_info
;
}
public
String
getNonce_str
()
{
return
nonce_str
;
}
public
void
setNonce_str
(
String
nonce_str
)
{
this
.
nonce_str
=
nonce_str
;
}
public
String
getSign
()
{
return
sign
;
}
public
void
setSign
(
String
sign
)
{
this
.
sign
=
sign
;
}
public
String
getBody
()
{
return
body
;
}
public
void
setBody
(
String
body
)
{
this
.
body
=
body
;
}
public
String
getAttach
()
{
return
attach
;
}
public
void
setAttach
(
String
attach
)
{
this
.
attach
=
attach
;
}
public
String
getOut_trade_no
()
{
return
out_trade_no
;
}
public
void
setOut_trade_no
(
String
out_trade_no
)
{
this
.
out_trade_no
=
out_trade_no
;
}
public
String
getTotal_fee
()
{
return
total_fee
;
}
public
void
setTotal_fee
(
String
total_fee
)
{
this
.
total_fee
=
total_fee
;
}
public
String
getSpbill_create_ip
()
{
return
spbill_create_ip
;
}
public
void
setSpbill_create_ip
(
String
spbill_create_ip
)
{
this
.
spbill_create_ip
=
spbill_create_ip
;
}
public
String
getTime_start
()
{
return
time_start
;
}
public
void
setTime_start
(
String
time_start
)
{
this
.
time_start
=
time_start
;
}
public
String
getTime_expire
()
{
return
time_expire
;
}
public
void
setTime_expire
(
String
time_expire
)
{
this
.
time_expire
=
time_expire
;
}
public
String
getGoods_tag
()
{
return
goods_tag
;
}
public
void
setGoods_tag
(
String
goods_tag
)
{
this
.
goods_tag
=
goods_tag
;
}
public
String
getDetail
()
{
return
detail
;
}
public
void
setDetail
(
String
detail
)
{
this
.
detail
=
detail
;
}
public
String
getFee_type
()
{
return
fee_type
;
}
public
void
setFee_type
(
String
fee_type
)
{
this
.
fee_type
=
fee_type
;
}
public
String
getNotify_url
()
{
return
notify_url
;
}
public
void
setNotify_url
(
String
notify_url
)
{
this
.
notify_url
=
notify_url
;
}
public
String
getTrade_type
()
{
return
trade_type
;
}
public
void
setTrade_type
(
String
trade_type
)
{
this
.
trade_type
=
trade_type
;
}
public
String
getProduct_id
()
{
return
product_id
;
}
public
void
setProduct_id
(
String
product_id
)
{
this
.
product_id
=
product_id
;
}
public
String
getLimit_pay
()
{
return
limit_pay
;
}
public
void
setLimit_pay
(
String
limit_pay
)
{
this
.
limit_pay
=
limit_pay
;
}
public
String
getOpenid
()
{
return
openid
;
}
public
void
setOpenid
(
String
openid
)
{
this
.
openid
=
openid
;
}
public
Map
<
String
,
Object
>
toMap
(){
Map
<
String
,
Object
>
map
=
new
HashMap
<
String
,
Object
>();
Field
[]
fields
=
this
.
getClass
().
getDeclaredFields
();
for
(
Field
field
:
fields
)
{
Object
obj
;
try
{
obj
=
field
.
get
(
this
);
if
(
obj
!=
null
){
map
.
put
(
field
.
getName
(),
obj
);
}
}
catch
(
IllegalArgumentException
e
)
{
e
.
printStackTrace
();
}
catch
(
IllegalAccessException
e
)
{
e
.
printStackTrace
();
}
}
return
map
;
}
}
xxpay4spring-cloud/xxpay-service/src/main/java/org/xxpay/service/channel/tencent/protocol/order_protocol/UnifiedOrderResData.java
0 → 100755
View file @
d53783a9
package
org.xxpay.service.channel.tencent.protocol.order_protocol
;
/**
* User: dingzhiwei
* Date: 2016/04/29
* Time: 18:42
*/
/**
* 统一下单提交Post数据给到API之后,API会返回XML格式的数据,这个类用来装这些数据
*/
public
class
UnifiedOrderResData
{
//协议层
private
String
return_code
=
""
;
// 返回状态码
private
String
return_msg
=
""
;
// 返回信息
//协议返回的具体数据(以下字段在return_code 为SUCCESS 的时候有返回)
private
String
appid
=
""
;
// 应用APPID
private
String
mch_id
=
""
;
// 商户号
private
String
device_info
=
""
;
// 设备号
private
String
nonce_str
=
""
;
// 随机字符串
private
String
sign
=
""
;
// 签名
private
String
result_code
=
""
;
// 业务结果
private
String
err_code
=
""
;
// 错误代码
private
String
err_code_des
=
""
;
// 错误代码描述
//业务返回的具体数据(以下字段在return_code 和result_code 都为SUCCESS 的时候有返回)
private
String
trade_type
=
""
;
// 交易类型
private
String
prepay_id
=
""
;
// 预支付交易会话标识
private
String
code_url
=
""
;
// 二维码链接
public
String
getReturn_code
()
{
return
return_code
;
}
public
void
setReturn_code
(
String
return_code
)
{
this
.
return_code
=
return_code
;
}
public
String
getReturn_msg
()
{
return
return_msg
;
}
public
void
setReturn_msg
(
String
return_msg
)
{
this
.
return_msg
=
return_msg
;
}
public
String
getAppid
()
{
return
appid
;
}
public
void
setAppid
(
String
appid
)
{
this
.
appid
=
appid
;
}
public
String
getMch_id
()
{
return
mch_id
;
}
public
void
setMch_id
(
String
mch_id
)
{
this
.
mch_id
=
mch_id
;
}
public
String
getDevice_info
()
{
return
device_info
;
}
public
void
setDevice_info
(
String
device_info
)
{
this
.
device_info
=
device_info
;
}
public
String
getNonce_str
()
{
return
nonce_str
;
}
public
void
setNonce_str
(
String
nonce_str
)
{
this
.
nonce_str
=
nonce_str
;
}
public
String
getSign
()
{
return
sign
;
}
public
void
setSign
(
String
sign
)
{
this
.
sign
=
sign
;
}
public
String
getResult_code
()
{
return
result_code
;
}
public
void
setResult_code
(
String
result_code
)
{
this
.
result_code
=
result_code
;
}
public
String
getErr_code
()
{
return
err_code
;
}
public
void
setErr_code
(
String
err_code
)
{
this
.
err_code
=
err_code
;
}
public
String
getErr_code_des
()
{
return
err_code_des
;
}
public
void
setErr_code_des
(
String
err_code_des
)
{
this
.
err_code_des
=
err_code_des
;
}
public
String
getTrade_type
()
{
return
trade_type
;
}
public
void
setTrade_type
(
String
trade_type
)
{
this
.
trade_type
=
trade_type
;
}
public
String
getPrepay_id
()
{
return
prepay_id
;
}
public
void
setPrepay_id
(
String
prepay_id
)
{
this
.
prepay_id
=
prepay_id
;
}
public
String
getCode_url
()
{
return
code_url
;
}
public
void
setCode_url
(
String
code_url
)
{
this
.
code_url
=
code_url
;
}
}
xxpay4spring-cloud/xxpay-service/src/main/java/org/xxpay/service/channel/tencent/protocol/pay_protocol/ScanPayReqData.java
0 → 100755
View file @
d53783a9
package
org.xxpay.service.channel.tencent.protocol.pay_protocol
;
/**
* User: rizenguo
* Date: 2014/10/22
* Time: 21:29
*/
import
org.xxpay.service.channel.tencent.common.Configure
;
import
org.xxpay.service.channel.tencent.common.RandomStringGenerator
;
import
org.xxpay.service.channel.tencent.common.Signature
;
import
org.xxpay.common.constant.PayConstant
;
import
java.lang.reflect.Field
;
import
java.util.HashMap
;
import
java.util.Map
;
/**
* 请求被扫支付API需要提交的数据
*/
public
class
ScanPayReqData
{
//每个字段具体的意思请查看API文档
private
String
appid
=
""
;
private
String
mch_id
=
""
;
private
String
device_info
=
""
;
private
String
nonce_str
=
""
;
private
String
sign
=
""
;
private
String
body
=
""
;
private
String
attach
=
""
;
private
String
out_trade_no
=
""
;
private
int
total_fee
=
0
;
private
String
spbill_create_ip
=
""
;
private
String
time_start
=
""
;
private
String
time_expire
=
""
;
private
String
goods_tag
=
""
;
private
String
auth_code
=
""
;
/**
* @param authCode 这个是扫码终端设备从用户手机上扫取到的支付授权号,这个号是跟用户用来支付的银行卡绑定的,有效期是1分钟
* @param body 要支付的商品的描述信息,用户会在支付成功页面里看到这个信息
* @param attach 支付订单里面可以填的附加数据,API会将提交的这个附加数据原样返回
* @param outTradeNo 商户系统内部的订单号,32个字符内可包含字母, 确保在商户系统唯一
* @param totalFee 订单总金额,单位为“分”,只能整数
* @param deviceInfo 商户自己定义的扫码支付终端设备号,方便追溯这笔交易发生在哪台终端设备上
* @param spBillCreateIP 订单生成的机器IP
* @param timeStart 订单生成时间, 格式为yyyyMMddHHmmss,如2009年12 月25 日9 点10 分10 秒表示为20091225091010。时区为GMT+8 beijing。该时间取自商户服务器
* @param timeExpire 订单失效时间,格式同上
* @param goodsTag 商品标记,微信平台配置的商品标记,用于优惠券或者满减使用
*/
public
ScanPayReqData
(
Configure
configure
,
String
authCode
,
String
body
,
String
attach
,
String
outTradeNo
,
int
totalFee
,
String
deviceInfo
,
String
spBillCreateIP
,
String
timeStart
,
String
timeExpire
,
String
goodsTag
){
//微信分配的公众号ID(开通公众号之后可以获取到)
setAppid
(
configure
.
getAppID
());
//微信支付分配的商户号ID(开通公众号的微信支付功能之后可以获取到)
setMch_id
(
configure
.
getMchID
());
//这个是扫码终端设备从用户手机上扫取到的支付授权号,这个号是跟用户用来支付的银行卡绑定的,有效期是1分钟
//调试的时候可以在微信上打开“钱包”里面的“刷卡”,将扫码页面里的那一串14位的数字输入到这里来,进行提交验证
//记住out_trade_no这个订单号可以将这一笔支付进行退款
setAuth_code
(
authCode
);
//要支付的商品的描述信息,用户会在支付成功页面里看到这个信息
setBody
(
body
);
//支付订单里面可以填的附加数据,API会将提交的这个附加数据原样返回,有助于商户自己可以注明该笔消费的具体内容,方便后续的运营和记录
setAttach
(
attach
);
//商户系统内部的订单号,32个字符内可包含字母, 确保在商户系统唯一
setOut_trade_no
(
outTradeNo
);
//订单总金额,单位为“分”,只能整数
setTotal_fee
(
totalFee
);
//商户自己定义的扫码支付终端设备号,方便追溯这笔交易发生在哪台终端设备上
setDevice_info
(
deviceInfo
);
//订单生成的机器IP
setSpbill_create_ip
(
spBillCreateIP
);
//订单生成时间, 格式为yyyyMMddHHmmss,如2009年12 月25 日9 点10 分10 秒表示为20091225091010。时区为GMT+8 beijing。该时间取自商户服务器
setTime_start
(
timeStart
);
//订单失效时间,格式同上
setTime_expire
(
timeExpire
);
//商品标记,微信平台配置的商品标记,用于优惠券或者满减使用
setGoods_tag
(
goodsTag
);
//随机字符串,不长于32 位
setNonce_str
(
RandomStringGenerator
.
getRandomStringByLength
(
32
));
//根据API给的签名规则进行签名
String
sign
=
Signature
.
getSign
(
toMap
(),
configure
.
getKey
());
setSign
(
sign
);
//把签名数据设置到Sign这个属性中
}
public
String
getAppid
()
{
return
appid
;
}
public
void
setAppid
(
String
appid
)
{
this
.
appid
=
appid
;
}
public
String
getMch_id
()
{
return
mch_id
;
}
public
void
setMch_id
(
String
mch_id
)
{
this
.
mch_id
=
mch_id
;
}
public
String
getDevice_info
()
{
return
device_info
;
}
public
void
setDevice_info
(
String
device_info
)
{
this
.
device_info
=
device_info
;
}
public
String
getNonce_str
()
{
return
nonce_str
;
}
public
void
setNonce_str
(
String
nonce_str
)
{
this
.
nonce_str
=
nonce_str
;
}
public
String
getSign
()
{
return
sign
;
}
public
void
setSign
(
String
sign
)
{
this
.
sign
=
sign
;
}
public
String
getBody
()
{
return
body
;
}
public
void
setBody
(
String
body
)
{
this
.
body
=
body
;
}
public
String
getAttach
()
{
return
attach
;
}
public
void
setAttach
(
String
attach
)
{
this
.
attach
=
attach
;
}
public
String
getOut_trade_no
()
{
return
out_trade_no
;
}
public
void
setOut_trade_no
(
String
out_trade_no
)
{
this
.
out_trade_no
=
out_trade_no
;
}
public
int
getTotal_fee
()
{
return
total_fee
;
}
public
void
setTotal_fee
(
int
total_fee
)
{
this
.
total_fee
=
total_fee
;
}
public
String
getSpbill_create_ip
()
{
return
spbill_create_ip
;
}
public
void
setSpbill_create_ip
(
String
spbill_create_ip
)
{
this
.
spbill_create_ip
=
spbill_create_ip
;
}
public
String
getTime_start
()
{
return
time_start
;
}
public
void
setTime_start
(
String
time_start
)
{
this
.
time_start
=
time_start
;
}
public
String
getTime_expire
()
{
return
time_expire
;
}
public
void
setTime_expire
(
String
time_expire
)
{
this
.
time_expire
=
time_expire
;
}
public
String
getGoods_tag
()
{
return
goods_tag
;
}
public
void
setGoods_tag
(
String
goods_tag
)
{
this
.
goods_tag
=
goods_tag
;
}
public
String
getAuth_code
()
{
return
auth_code
;
}
public
void
setAuth_code
(
String
auth_code
)
{
this
.
auth_code
=
auth_code
;
}
public
Map
<
String
,
Object
>
toMap
(){
Map
<
String
,
Object
>
map
=
new
HashMap
<
String
,
Object
>();
Field
[]
fields
=
this
.
getClass
().
getDeclaredFields
();
for
(
Field
field
:
fields
)
{
Object
obj
;
try
{
obj
=
field
.
get
(
this
);
if
(
obj
!=
null
){
map
.
put
(
field
.
getName
(),
obj
);
}
}
catch
(
IllegalArgumentException
e
)
{
e
.
printStackTrace
();
}
catch
(
IllegalAccessException
e
)
{
e
.
printStackTrace
();
}
}
return
map
;
}
}
xxpay4spring-cloud/xxpay-service/src/main/java/org/xxpay/service/channel/tencent/protocol/pay_protocol/ScanPayResData.java
0 → 100755
View file @
d53783a9
package
org.xxpay.service.channel.tencent.protocol.pay_protocol
;
/**
* User: rizenguo
* Date: 2014/10/22
* Time: 16:42
*/
/**
* 被扫支付提交Post数据给到API之后,API会返回XML格式的数据,这个类用来装这些数据
*/
public
class
ScanPayResData
{
//协议层
private
String
return_code
=
""
;
private
String
return_msg
=
""
;
//协议返回的具体数据(以下字段在return_code 为SUCCESS 的时候有返回)
private
String
appid
=
""
;
private
String
mch_id
=
""
;
private
String
nonce_str
=
""
;
private
String
sign
=
""
;
private
String
result_code
=
""
;
private
String
err_code
=
""
;
private
String
err_code_des
=
""
;
private
String
device_info
=
""
;
//业务返回的具体数据(以下字段在return_code 和result_code 都为SUCCESS 的时候有返回)
private
String
openid
=
""
;
private
String
is_subscribe
=
""
;
private
String
trade_type
=
""
;
private
String
bank_type
=
""
;
private
String
total_fee
=
""
;
private
String
coupon_fee
=
""
;
private
String
fee_type
=
""
;
private
String
transaction_id
=
""
;
private
String
out_trade_no
=
""
;
private
String
attach
=
""
;
private
String
time_end
=
""
;
public
String
getReturn_code
()
{
return
return_code
;
}
public
void
setReturn_code
(
String
return_code
)
{
this
.
return_code
=
return_code
;
}
public
String
getReturn_msg
()
{
return
return_msg
;
}
public
void
setReturn_msg
(
String
return_msg
)
{
this
.
return_msg
=
return_msg
;
}
public
String
getAppid
()
{
return
appid
;
}
public
void
setAppid
(
String
appid
)
{
this
.
appid
=
appid
;
}
public
String
getMch_id
()
{
return
mch_id
;
}
public
void
setMch_id
(
String
mch_id
)
{
this
.
mch_id
=
mch_id
;
}
public
String
getDevice_info
()
{
return
device_info
;
}
public
void
setDevice_info
(
String
device_info
)
{
this
.
device_info
=
device_info
;
}
public
String
getNonce_str
()
{
return
nonce_str
;
}
public
void
setNonce_str
(
String
nonce_str
)
{
this
.
nonce_str
=
nonce_str
;
}
public
String
getSign
()
{
return
sign
;
}
public
void
setSign
(
String
sign
)
{
this
.
sign
=
sign
;
}
public
String
getResult_code
()
{
return
result_code
;
}
public
void
setResult_code
(
String
result_code
)
{
this
.
result_code
=
result_code
;
}
public
String
getErr_code
()
{
return
err_code
;
}
public
void
setErr_code
(
String
err_code
)
{
this
.
err_code
=
err_code
;
}
public
String
getErr_code_des
()
{
return
err_code_des
;
}
public
void
setErr_code_des
(
String
err_code_des
)
{
this
.
err_code_des
=
err_code_des
;
}
public
String
getOpenid
()
{
return
openid
;
}
public
void
setOpenid
(
String
openid
)
{
this
.
openid
=
openid
;
}
public
String
getIs_subscribe
()
{
return
is_subscribe
;
}
public
void
setIs_subscribe
(
String
is_subscribe
)
{
this
.
is_subscribe
=
is_subscribe
;
}
public
String
getTrade_type
()
{
return
trade_type
;
}
public
void
setTrade_type
(
String
trade_type
)
{
this
.
trade_type
=
trade_type
;
}
public
String
getBank_type
()
{
return
bank_type
;
}
public
void
setBank_type
(
String
bank_type
)
{
this
.
bank_type
=
bank_type
;
}
public
String
getTotal_fee
()
{
return
total_fee
;
}
public
void
setTotal_fee
(
String
total_fee
)
{
this
.
total_fee
=
total_fee
;
}
public
String
getCoupon_fee
()
{
return
coupon_fee
;
}
public
void
setCoupon_fee
(
String
coupon_fee
)
{
this
.
coupon_fee
=
coupon_fee
;
}
public
String
getFee_type
()
{
return
fee_type
;
}
public
void
setFee_type
(
String
fee_type
)
{
this
.
fee_type
=
fee_type
;
}
public
String
getTransaction_id
()
{
return
transaction_id
;
}
public
void
setTransaction_id
(
String
transaction_id
)
{
this
.
transaction_id
=
transaction_id
;
}
public
String
getOut_trade_no
()
{
return
out_trade_no
;
}
public
void
setOut_trade_no
(
String
out_trade_no
)
{
this
.
out_trade_no
=
out_trade_no
;
}
public
String
getAttach
()
{
return
attach
;
}
public
void
setAttach
(
String
attach
)
{
this
.
attach
=
attach
;
}
public
String
getTime_end
()
{
return
time_end
;
}
public
void
setTime_end
(
String
time_end
)
{
this
.
time_end
=
time_end
;
}
}
xxpay4spring-cloud/xxpay-service/src/main/java/org/xxpay/service/channel/tencent/protocol/pay_query_protocol/ScanPayQueryReqData.java
0 → 100755
View file @
d53783a9
package
org.xxpay.service.channel.tencent.protocol.pay_query_protocol
;
import
org.xxpay.service.channel.tencent.common.Configure
;
import
org.xxpay.service.channel.tencent.common.RandomStringGenerator
;
import
org.xxpay.service.channel.tencent.common.Signature
;
import
org.springframework.util.StringUtils
;
import
java.lang.reflect.Field
;
import
java.util.HashMap
;
import
java.util.Map
;
/**
* User: rizenguo
* Date: 2014/10/25
* Time: 13:54
*/
public
class
ScanPayQueryReqData
{
//每个字段具体的意思请查看API文档
private
String
appid
;
private
String
mch_id
;
private
String
transaction_id
;
private
String
out_trade_no
;
private
String
nonce_str
;
private
String
sign
;
/**
* 请求支付查询服务
* @param transactionID 是微信系统为每一笔支付交易分配的订单号,通过这个订单号可以标识这笔交易,它由支付订单API支付成功时返回的数据里面获取到。建议优先使用
* @param outTradeNo 商户系统内部的订单号,transaction_id 、out_trade_no 二选一,如果同时存在优先级:transaction_id>out_trade_no
* @return API返回的XML数据
* @throws Exception
*/
public
ScanPayQueryReqData
(
Configure
configure
,
String
transactionID
,
String
outTradeNo
){
//--------------------------------------------------------------------
//以下是测试数据,请商户按照自己的实际情况填写具体的值进去
//--------------------------------------------------------------------
//微信分配的公众号ID(开通公众号之后可以获取到)
setAppid
(
configure
.
getAppID
());
//微信支付分配的商户号ID(开通公众号的微信支付功能之后可以获取到)
setMch_id
(
configure
.
getMchID
());
//transaction_id是微信系统为每一笔支付交易分配的订单号,通过这个订单号可以标识这笔交易,它由支付订单API支付成功时返回的数据里面获取到。
if
(!
StringUtils
.
isEmpty
(
transactionID
))
setTransaction_id
(
transactionID
);
//商户系统自己生成的唯一的订单号
if
(!
StringUtils
.
isEmpty
(
outTradeNo
))
setOut_trade_no
(
outTradeNo
);
//随机字符串,不长于32 位
setNonce_str
(
RandomStringGenerator
.
getRandomStringByLength
(
32
));
//根据API给的签名规则进行签名
String
sign
=
Signature
.
getSign
(
toMap
(),
configure
.
getKey
());
setSign
(
sign
);
//把签名数据设置到Sign这个属性中
}
public
String
getAppid
()
{
return
appid
;
}
public
void
setAppid
(
String
appid
)
{
this
.
appid
=
appid
;
}
public
String
getMch_id
()
{
return
mch_id
;
}
public
void
setMch_id
(
String
mch_id
)
{
this
.
mch_id
=
mch_id
;
}
public
String
getTransaction_id
()
{
return
transaction_id
;
}
public
void
setTransaction_id
(
String
transaction_id
)
{
this
.
transaction_id
=
transaction_id
;
}
public
String
getOut_trade_no
()
{
return
out_trade_no
;
}
public
void
setOut_trade_no
(
String
out_trade_no
)
{
this
.
out_trade_no
=
out_trade_no
;
}
public
String
getNonce_str
()
{
return
nonce_str
;
}
public
void
setNonce_str
(
String
nonce_str
)
{
this
.
nonce_str
=
nonce_str
;
}
public
String
getSign
()
{
return
sign
;
}
public
void
setSign
(
String
sign
)
{
this
.
sign
=
sign
;
}
public
Map
<
String
,
Object
>
toMap
(){
Map
<
String
,
Object
>
map
=
new
HashMap
<
String
,
Object
>();
Field
[]
fields
=
this
.
getClass
().
getDeclaredFields
();
for
(
Field
field
:
fields
)
{
Object
obj
;
try
{
obj
=
field
.
get
(
this
);
if
(
obj
!=
null
){
map
.
put
(
field
.
getName
(),
obj
);
}
}
catch
(
IllegalArgumentException
e
)
{
e
.
printStackTrace
();
}
catch
(
IllegalAccessException
e
)
{
e
.
printStackTrace
();
}
}
return
map
;
}
}
xxpay4spring-cloud/xxpay-service/src/main/java/org/xxpay/service/channel/tencent/protocol/pay_query_protocol/ScanPayQueryResData.java
0 → 100755
View file @
d53783a9
package
org.xxpay.service.channel.tencent.protocol.pay_query_protocol
;
/**
* User: rizenguo
* Date: 2014/10/25
* Time: 13:54
*/
public
class
ScanPayQueryResData
{
//协议层
private
String
return_code
=
""
;
private
String
return_msg
=
""
;
//协议返回的具体数据(以下字段在return_code 为SUCCESS 的时候有返回)
private
String
appid
=
""
;
private
String
mch_id
=
""
;
private
String
sub_mch_id
=
""
;
//新增
private
String
nonce_str
=
""
;
private
String
sign
=
""
;
private
String
result_code
=
""
;
private
String
err_code
=
""
;
private
String
err_code_des
=
""
;
//以下字段在return_code 和result_code 都为SUCCESS 的时候有返回
private
String
trade_state
=
""
;
//trade_state的几种可能取值:
// SUCCESS--支付成功
// REFUND--转入退款
// NOTPAY--未支付
// CLOSED--已关闭
// REVOKED--已撤销
// USERPAYING--用户支付中
// NOPAY--未支付(确认支付超时)
// PAYERROR--支付失败(其他原因,
// 如银行返回失败)
//以下字段在trade_state 为SUCCESS 或者REFUND 的时候有返回
private
String
device_info
=
""
;
private
String
openid
=
""
;
private
String
is_subscribe
=
""
;
private
String
trade_type
=
""
;
private
String
bank_type
=
""
;
private
String
total_fee
=
""
;
private
String
coupon_fee
=
""
;
private
String
fee_type
=
""
;
private
String
transaction_id
=
""
;
private
String
out_trade_no
=
""
;
private
String
attach
=
""
;
private
String
time_end
=
""
;
public
String
getReturn_code
()
{
return
return_code
;
}
public
void
setReturn_code
(
String
return_code
)
{
this
.
return_code
=
return_code
;
}
public
String
getReturn_msg
()
{
return
return_msg
;
}
public
void
setReturn_msg
(
String
return_msg
)
{
this
.
return_msg
=
return_msg
;
}
public
String
getAppid
()
{
return
appid
;
}
public
void
setAppid
(
String
appid
)
{
this
.
appid
=
appid
;
}
public
String
getMch_id
()
{
return
mch_id
;
}
public
void
setMch_id
(
String
mch_id
)
{
this
.
mch_id
=
mch_id
;
}
public
String
getSub_mch_id
()
{
return
sub_mch_id
;
}
public
void
setSub_mch_id
(
String
sub_mch_id
)
{
this
.
sub_mch_id
=
sub_mch_id
;
}
public
String
getNonce_str
()
{
return
nonce_str
;
}
public
void
setNonce_str
(
String
nonce_str
)
{
this
.
nonce_str
=
nonce_str
;
}
public
String
getSign
()
{
return
sign
;
}
public
void
setSign
(
String
sign
)
{
this
.
sign
=
sign
;
}
public
String
getResult_code
()
{
return
result_code
;
}
public
void
setResult_code
(
String
result_code
)
{
this
.
result_code
=
result_code
;
}
public
String
getErr_code
()
{
return
err_code
;
}
public
void
setErr_code
(
String
err_code
)
{
this
.
err_code
=
err_code
;
}
public
String
getErr_code_des
()
{
return
err_code_des
;
}
public
void
setErr_code_des
(
String
err_code_des
)
{
this
.
err_code_des
=
err_code_des
;
}
public
String
getTrade_state
()
{
return
trade_state
;
}
public
void
setTrade_state
(
String
trade_state
)
{
this
.
trade_state
=
trade_state
;
}
public
String
getDevice_info
()
{
return
device_info
;
}
public
void
setDevice_info
(
String
device_info
)
{
this
.
device_info
=
device_info
;
}
public
String
getOpenid
()
{
return
openid
;
}
public
void
setOpenid
(
String
openid
)
{
this
.
openid
=
openid
;
}
public
String
getIs_subscribe
()
{
return
is_subscribe
;
}
public
void
setIs_subscribe
(
String
is_subscribe
)
{
this
.
is_subscribe
=
is_subscribe
;
}
public
String
getTrade_type
()
{
return
trade_type
;
}
public
void
setTrade_type
(
String
trade_type
)
{
this
.
trade_type
=
trade_type
;
}
public
String
getBank_type
()
{
return
bank_type
;
}
public
void
setBank_type
(
String
bank_type
)
{
this
.
bank_type
=
bank_type
;
}
public
String
getTotal_fee
()
{
return
total_fee
;
}
public
void
setTotal_fee
(
String
total_fee
)
{
this
.
total_fee
=
total_fee
;
}
public
String
getCoupon_fee
()
{
return
coupon_fee
;
}
public
void
setCoupon_fee
(
String
coupon_fee
)
{
this
.
coupon_fee
=
coupon_fee
;
}
public
String
getFee_type
()
{
return
fee_type
;
}
public
void
setFee_type
(
String
fee_type
)
{
this
.
fee_type
=
fee_type
;
}
public
String
getTransaction_id
()
{
return
transaction_id
;
}
public
void
setTransaction_id
(
String
transaction_id
)
{
this
.
transaction_id
=
transaction_id
;
}
public
String
getOut_trade_no
()
{
return
out_trade_no
;
}
public
void
setOut_trade_no
(
String
out_trade_no
)
{
this
.
out_trade_no
=
out_trade_no
;
}
public
String
getAttach
()
{
return
attach
;
}
public
void
setAttach
(
String
attach
)
{
this
.
attach
=
attach
;
}
public
String
getTime_end
()
{
return
time_end
;
}
public
void
setTime_end
(
String
time_end
)
{
this
.
time_end
=
time_end
;
}
}
xxpay4spring-cloud/xxpay-service/src/main/java/org/xxpay/service/channel/tencent/protocol/redpack_protocol/QueryRedpackReqData.java
0 → 100644
View file @
d53783a9
package
org.xxpay.service.channel.tencent.protocol.redpack_protocol
;
import
org.xxpay.service.channel.tencent.common.Configure
;
import
org.xxpay.service.channel.tencent.common.RandomStringGenerator
;
import
org.xxpay.service.channel.tencent.common.Signature
;
import
java.lang.reflect.Field
;
import
java.util.HashMap
;
import
java.util.Map
;
/**
* Created by dingzhiwei on 2016/6/3.
*/
public
class
QueryRedpackReqData
{
private
String
nonce_str
=
""
;
// 随机字符串
private
String
sign
=
""
;
// 签名
private
String
mch_billno
=
""
;
// 商户订单号,商户订单号(每个订单号必须唯一)组成:mch_id+yyyymmdd+10位一天内不能重复的数字
private
String
mch_id
=
""
;
// 商户号
private
String
appid
=
""
;
// 公众号ID
private
String
bill_type
=
""
;
// 订单类型,MCHT:通过商户订单号获取红包信息
/**
*
* @param mch_billno
* @param bill_type
*/
public
QueryRedpackReqData
(
Configure
configure
,
String
mch_billno
,
String
bill_type
){
//微信分配的公众号ID(开通公众号之后可以获取到)
setAppid
(
configure
.
getAppID
());
//微信支付分配的商户号ID(开通公众号的微信支付功能之后可以获取到)
setMch_id
(
configure
.
getMchID
());
setMch_billno
(
mch_billno
);
setBill_type
(
bill_type
);
//随机字符串,不长于32 位
setNonce_str
(
RandomStringGenerator
.
getRandomStringByLength
(
32
));
//根据API给的签名规则进行签名
String
sign
=
Signature
.
getSign
(
toMap
(),
configure
.
getKey
());
setSign
(
sign
);
//把签名数据设置到Sign这个属性中
}
public
String
getAppid
()
{
return
appid
;
}
public
void
setAppid
(
String
appid
)
{
this
.
appid
=
appid
;
}
public
String
getBill_type
()
{
return
bill_type
;
}
public
void
setBill_type
(
String
bill_type
)
{
this
.
bill_type
=
bill_type
;
}
public
String
getMch_billno
()
{
return
mch_billno
;
}
public
void
setMch_billno
(
String
mch_billno
)
{
this
.
mch_billno
=
mch_billno
;
}
public
String
getMch_id
()
{
return
mch_id
;
}
public
void
setMch_id
(
String
mch_id
)
{
this
.
mch_id
=
mch_id
;
}
public
String
getNonce_str
()
{
return
nonce_str
;
}
public
void
setNonce_str
(
String
nonce_str
)
{
this
.
nonce_str
=
nonce_str
;
}
public
String
getSign
()
{
return
sign
;
}
public
void
setSign
(
String
sign
)
{
this
.
sign
=
sign
;
}
public
Map
<
String
,
Object
>
toMap
(){
Map
<
String
,
Object
>
map
=
new
HashMap
<
String
,
Object
>();
Field
[]
fields
=
this
.
getClass
().
getDeclaredFields
();
for
(
Field
field
:
fields
)
{
Object
obj
;
try
{
obj
=
field
.
get
(
this
);
if
(
obj
!=
null
){
map
.
put
(
field
.
getName
(),
obj
);
}
}
catch
(
IllegalArgumentException
e
)
{
e
.
printStackTrace
();
}
catch
(
IllegalAccessException
e
)
{
e
.
printStackTrace
();
}
}
return
map
;
}
}
xxpay4spring-cloud/xxpay-service/src/main/java/org/xxpay/service/channel/tencent/protocol/redpack_protocol/QueryRedpackResData.java
0 → 100644
View file @
d53783a9
package
org.xxpay.service.channel.tencent.protocol.redpack_protocol
;
/**
* Created by dingzhiwei on 16/6/3.
*/
public
class
QueryRedpackResData
{
//协议层
private
String
return_code
=
""
;
// 返回状态码
private
String
return_msg
=
""
;
// 返回信息
//协议返回的具体数据(以下字段在return_code 为SUCCESS 的时候有返回)
private
String
sign
=
""
;
// 签名
private
String
result_code
=
""
;
// 业务结果
private
String
err_code
=
""
;
// 错误代码
private
String
err_code_des
=
""
;
// 错误代码描述
//业务返回的具体数据(以下字段在return_code 和result_code 都为SUCCESS 的时候有返回)
private
String
mch_billno
=
""
;
// 商户订单号
private
String
mch_id
=
""
;
// 商户号
private
String
detail_id
=
""
;
// 红包单号
private
String
status
=
""
;
// 状态,SENDING:发放中 SENT:已发放待领取 FAILED:发放失败 RECEIVED:已领取 REFUND:已退款
private
String
send_type
=
""
;
// 发放类型,API:通过API接口发放 UPLOAD:通过上传文件方式发放 ACTIVITY:通过活动方式发放
private
String
hb_type
=
""
;
// 红包类型,GROUP:裂变红包 NORMAL:普通红包
private
String
total_num
=
""
;
// 红包个数
private
String
total_amount
=
""
;
// 红包总金额(单位分)
private
String
reason
=
""
;
// 发送失败原因
private
String
send_time
=
""
;
// 红包发送时间
private
String
refund_time
=
""
;
// 红包退款时间
private
String
refund_amount
=
""
;
// 红包退款金额
private
String
wishing
=
""
;
// 祝福语
private
String
remark
=
""
;
// 活动描述
private
String
act_name
=
""
;
// 活动名称
private
String
hblist
=
""
;
// 裂变红包领取列表
private
String
openid
=
""
;
// 领取红包的Openid
private
String
amount
=
""
;
// 公众号appid
private
String
rcv_time
=
""
;
// 领取红包的时间
public
String
getAct_name
()
{
return
act_name
;
}
public
void
setAct_name
(
String
act_name
)
{
this
.
act_name
=
act_name
;
}
public
String
getAmount
()
{
return
amount
;
}
public
void
setAmount
(
String
amount
)
{
this
.
amount
=
amount
;
}
public
String
getDetail_id
()
{
return
detail_id
;
}
public
void
setDetail_id
(
String
detail_id
)
{
this
.
detail_id
=
detail_id
;
}
public
String
getErr_code
()
{
return
err_code
;
}
public
void
setErr_code
(
String
err_code
)
{
this
.
err_code
=
err_code
;
}
public
String
getErr_code_des
()
{
return
err_code_des
;
}
public
void
setErr_code_des
(
String
err_code_des
)
{
this
.
err_code_des
=
err_code_des
;
}
public
String
getHb_type
()
{
return
hb_type
;
}
public
void
setHb_type
(
String
hb_type
)
{
this
.
hb_type
=
hb_type
;
}
public
String
getHblist
()
{
return
hblist
;
}
public
void
setHblist
(
String
hblist
)
{
this
.
hblist
=
hblist
;
}
public
String
getMch_billno
()
{
return
mch_billno
;
}
public
void
setMch_billno
(
String
mch_billno
)
{
this
.
mch_billno
=
mch_billno
;
}
public
String
getMch_id
()
{
return
mch_id
;
}
public
void
setMch_id
(
String
mch_id
)
{
this
.
mch_id
=
mch_id
;
}
public
String
getOpenid
()
{
return
openid
;
}
public
void
setOpenid
(
String
openid
)
{
this
.
openid
=
openid
;
}
public
String
getRcv_time
()
{
return
rcv_time
;
}
public
void
setRcv_time
(
String
rcv_time
)
{
this
.
rcv_time
=
rcv_time
;
}
public
String
getReason
()
{
return
reason
;
}
public
void
setReason
(
String
reason
)
{
this
.
reason
=
reason
;
}
public
String
getRefund_amount
()
{
return
refund_amount
;
}
public
void
setRefund_amount
(
String
refund_amount
)
{
this
.
refund_amount
=
refund_amount
;
}
public
String
getRefund_time
()
{
return
refund_time
;
}
public
void
setRefund_time
(
String
refund_time
)
{
this
.
refund_time
=
refund_time
;
}
public
String
getRemark
()
{
return
remark
;
}
public
void
setRemark
(
String
remark
)
{
this
.
remark
=
remark
;
}
public
String
getResult_code
()
{
return
result_code
;
}
public
void
setResult_code
(
String
result_code
)
{
this
.
result_code
=
result_code
;
}
public
String
getReturn_code
()
{
return
return_code
;
}
public
void
setReturn_code
(
String
return_code
)
{
this
.
return_code
=
return_code
;
}
public
String
getReturn_msg
()
{
return
return_msg
;
}
public
void
setReturn_msg
(
String
return_msg
)
{
this
.
return_msg
=
return_msg
;
}
public
String
getSend_time
()
{
return
send_time
;
}
public
void
setSend_time
(
String
send_time
)
{
this
.
send_time
=
send_time
;
}
public
String
getSend_type
()
{
return
send_type
;
}
public
void
setSend_type
(
String
send_type
)
{
this
.
send_type
=
send_type
;
}
public
String
getSign
()
{
return
sign
;
}
public
void
setSign
(
String
sign
)
{
this
.
sign
=
sign
;
}
public
String
getStatus
()
{
return
status
;
}
public
void
setStatus
(
String
status
)
{
this
.
status
=
status
;
}
public
String
getTotal_amount
()
{
return
total_amount
;
}
public
void
setTotal_amount
(
String
total_amount
)
{
this
.
total_amount
=
total_amount
;
}
public
String
getTotal_num
()
{
return
total_num
;
}
public
void
setTotal_num
(
String
total_num
)
{
this
.
total_num
=
total_num
;
}
public
String
getWishing
()
{
return
wishing
;
}
public
void
setWishing
(
String
wishing
)
{
this
.
wishing
=
wishing
;
}
@Override
public
String
toString
()
{
return
"QueryRedpackResData{"
+
"act_name='"
+
act_name
+
'\''
+
", return_code='"
+
return_code
+
'\''
+
", return_msg='"
+
return_msg
+
'\''
+
", sign='"
+
sign
+
'\''
+
", result_code='"
+
result_code
+
'\''
+
", err_code='"
+
err_code
+
'\''
+
", err_code_des='"
+
err_code_des
+
'\''
+
", mch_billno='"
+
mch_billno
+
'\''
+
", mch_id='"
+
mch_id
+
'\''
+
", detail_id='"
+
detail_id
+
'\''
+
", status='"
+
status
+
'\''
+
", send_type='"
+
send_type
+
'\''
+
", hb_type='"
+
hb_type
+
'\''
+
", total_num='"
+
total_num
+
'\''
+
", total_amount='"
+
total_amount
+
'\''
+
", reason='"
+
reason
+
'\''
+
", send_time='"
+
send_time
+
'\''
+
", refund_time='"
+
refund_time
+
'\''
+
", refund_amount='"
+
refund_amount
+
'\''
+
", wishing='"
+
wishing
+
'\''
+
", remark='"
+
remark
+
'\''
+
", hblist='"
+
hblist
+
'\''
+
", openid='"
+
openid
+
'\''
+
", amount='"
+
amount
+
'\''
+
", rcv_time='"
+
rcv_time
+
'\''
+
'}'
;
}
}
xxpay4spring-cloud/xxpay-service/src/main/java/org/xxpay/service/channel/tencent/protocol/redpack_protocol/SendRedpackReqData.java
0 → 100644
View file @
d53783a9
package
org.xxpay.service.channel.tencent.protocol.redpack_protocol
;
import
org.xxpay.service.channel.tencent.common.Configure
;
import
org.xxpay.service.channel.tencent.common.RandomStringGenerator
;
import
org.xxpay.service.channel.tencent.common.Signature
;
import
java.lang.reflect.Field
;
import
java.util.HashMap
;
import
java.util.Map
;
/**
* Created by dingzhiwei on 2016/6/3.
*/
public
class
SendRedpackReqData
{
private
String
nonce_str
=
""
;
// 随机字符串
private
String
sign
=
""
;
// 签名
private
String
mch_billno
=
""
;
// 商户订单号,商户订单号(每个订单号必须唯一)组成:mch_id+yyyymmdd+10位一天内不能重复的数字
private
String
mch_id
=
""
;
// 商户号
private
String
wxappid
=
""
;
// 公众号ID
private
String
send_name
=
""
;
// 商户名称,红包发送者名称
private
String
re_openid
=
""
;
// 接受红包的用户
private
String
total_amount
=
""
;
// 付款金额
private
String
total_num
=
""
;
// 红包发放总人数
private
String
wishing
=
""
;
// 红包祝福语
private
String
client_ip
=
""
;
// 调用接口的机器Ip地址
private
String
act_name
=
""
;
// 活动名称
private
String
remark
=
""
;
// 备注
/**
*
* @param mch_billno
* @param send_name
* @param re_openid
* @param total_amount
* @param total_num
* @param wishing
* @param act_name
* @param remark
*/
public
SendRedpackReqData
(
Configure
configure
,
String
mch_billno
,
String
send_name
,
String
re_openid
,
String
total_amount
,
String
total_num
,
String
wishing
,
String
act_name
,
String
remark
){
//微信分配的公众号ID(开通公众号之后可以获取到)
setWxappid
(
configure
.
getAppID
());
//微信支付分配的商户号ID(开通公众号的微信支付功能之后可以获取到)
setMch_id
(
configure
.
getMchID
());
setMch_billno
(
mch_billno
);
setSend_name
(
send_name
);
setRe_openid
(
re_openid
);
setTotal_amount
(
total_amount
);
setTotal_num
(
total_num
);
setWishing
(
wishing
);
setClient_ip
(
configure
.
getIp
());
setAct_name
(
act_name
);
setRemark
(
remark
);
//随机字符串,不长于32 位
setNonce_str
(
RandomStringGenerator
.
getRandomStringByLength
(
32
));
//根据API给的签名规则进行签名
String
sign
=
Signature
.
getSign
(
toMap
(),
configure
.
getKey
());
setSign
(
sign
);
//把签名数据设置到Sign这个属性中
}
public
String
getNonce_str
()
{
return
nonce_str
;
}
public
void
setNonce_str
(
String
nonce_str
)
{
this
.
nonce_str
=
nonce_str
;
}
public
String
getSign
()
{
return
sign
;
}
public
void
setSign
(
String
sign
)
{
this
.
sign
=
sign
;
}
public
String
getMch_billno
()
{
return
mch_billno
;
}
public
void
setMch_billno
(
String
mch_billno
)
{
this
.
mch_billno
=
mch_billno
;
}
public
String
getMch_id
()
{
return
mch_id
;
}
public
void
setMch_id
(
String
mch_id
)
{
this
.
mch_id
=
mch_id
;
}
public
String
getWxappid
()
{
return
wxappid
;
}
public
void
setWxappid
(
String
wxappid
)
{
this
.
wxappid
=
wxappid
;
}
public
String
getSend_name
()
{
return
send_name
;
}
public
void
setSend_name
(
String
send_name
)
{
this
.
send_name
=
send_name
;
}
public
String
getRe_openid
()
{
return
re_openid
;
}
public
void
setRe_openid
(
String
re_openid
)
{
this
.
re_openid
=
re_openid
;
}
public
String
getTotal_amount
()
{
return
total_amount
;
}
public
void
setTotal_amount
(
String
total_amount
)
{
this
.
total_amount
=
total_amount
;
}
public
String
getTotal_num
()
{
return
total_num
;
}
public
void
setTotal_num
(
String
total_num
)
{
this
.
total_num
=
total_num
;
}
public
String
getWishing
()
{
return
wishing
;
}
public
void
setWishing
(
String
wishing
)
{
this
.
wishing
=
wishing
;
}
public
String
getClient_ip
()
{
return
client_ip
;
}
public
void
setClient_ip
(
String
client_ip
)
{
this
.
client_ip
=
client_ip
;
}
public
String
getAct_name
()
{
return
act_name
;
}
public
void
setAct_name
(
String
act_name
)
{
this
.
act_name
=
act_name
;
}
public
String
getRemark
()
{
return
remark
;
}
public
void
setRemark
(
String
remark
)
{
this
.
remark
=
remark
;
}
public
Map
<
String
,
Object
>
toMap
(){
Map
<
String
,
Object
>
map
=
new
HashMap
<
String
,
Object
>();
Field
[]
fields
=
this
.
getClass
().
getDeclaredFields
();
for
(
Field
field
:
fields
)
{
Object
obj
;
try
{
obj
=
field
.
get
(
this
);
if
(
obj
!=
null
){
map
.
put
(
field
.
getName
(),
obj
);
}
}
catch
(
IllegalArgumentException
e
)
{
e
.
printStackTrace
();
}
catch
(
IllegalAccessException
e
)
{
e
.
printStackTrace
();
}
}
return
map
;
}
}
xxpay4spring-cloud/xxpay-service/src/main/java/org/xxpay/service/channel/tencent/protocol/redpack_protocol/SendRedpackResData.java
0 → 100644
View file @
d53783a9
package
org.xxpay.service.channel.tencent.protocol.redpack_protocol
;
/**
* Created by dingzhiwei on 16/6/3.
*/
public
class
SendRedpackResData
{
//协议层
private
String
return_code
=
""
;
// 返回状态码
private
String
return_msg
=
""
;
// 返回信息
//协议返回的具体数据(以下字段在return_code 为SUCCESS 的时候有返回)
private
String
sign
=
""
;
// 签名
private
String
result_code
=
""
;
// 业务结果
private
String
err_code
=
""
;
// 错误代码
private
String
err_code_des
=
""
;
// 错误代码描述
//业务返回的具体数据(以下字段在return_code 和result_code 都为SUCCESS 的时候有返回)
private
String
mch_billno
=
""
;
// 商户订单号
private
String
mch_id
=
""
;
// 商户号
private
String
wxappid
=
""
;
// 公众号appid
private
String
re_openid
=
""
;
// 用户openId
private
String
total_amount
=
""
;
// 付款金额
private
String
send_time
=
""
;
// 红包发放成功时间
private
String
send_listid
=
""
;
// 微信单号
public
String
getErr_code
()
{
return
err_code
;
}
public
void
setErr_code
(
String
err_code
)
{
this
.
err_code
=
err_code
;
}
public
String
getErr_code_des
()
{
return
err_code_des
;
}
public
void
setErr_code_des
(
String
err_code_des
)
{
this
.
err_code_des
=
err_code_des
;
}
public
String
getMch_billno
()
{
return
mch_billno
;
}
public
void
setMch_billno
(
String
mch_billno
)
{
this
.
mch_billno
=
mch_billno
;
}
public
String
getMch_id
()
{
return
mch_id
;
}
public
void
setMch_id
(
String
mch_id
)
{
this
.
mch_id
=
mch_id
;
}
public
String
getRe_openid
()
{
return
re_openid
;
}
public
void
setRe_openid
(
String
re_openid
)
{
this
.
re_openid
=
re_openid
;
}
public
String
getResult_code
()
{
return
result_code
;
}
public
void
setResult_code
(
String
result_code
)
{
this
.
result_code
=
result_code
;
}
public
String
getReturn_code
()
{
return
return_code
;
}
public
void
setReturn_code
(
String
return_code
)
{
this
.
return_code
=
return_code
;
}
public
String
getReturn_msg
()
{
return
return_msg
;
}
public
void
setReturn_msg
(
String
return_msg
)
{
this
.
return_msg
=
return_msg
;
}
public
String
getSend_listid
()
{
return
send_listid
;
}
public
void
setSend_listid
(
String
send_listid
)
{
this
.
send_listid
=
send_listid
;
}
public
String
getSend_time
()
{
return
send_time
;
}
public
void
setSend_time
(
String
send_time
)
{
this
.
send_time
=
send_time
;
}
public
String
getSign
()
{
return
sign
;
}
public
void
setSign
(
String
sign
)
{
this
.
sign
=
sign
;
}
public
String
getTotal_amount
()
{
return
total_amount
;
}
public
void
setTotal_amount
(
String
total_amount
)
{
this
.
total_amount
=
total_amount
;
}
public
String
getWxappid
()
{
return
wxappid
;
}
public
void
setWxappid
(
String
wxappid
)
{
this
.
wxappid
=
wxappid
;
}
}
xxpay4spring-cloud/xxpay-service/src/main/java/org/xxpay/service/channel/tencent/protocol/refund_protocol/RefundReqData.java
0 → 100755
View file @
d53783a9
package
org.xxpay.service.channel.tencent.protocol.refund_protocol
;
import
org.xxpay.service.channel.tencent.common.Configure
;
import
org.xxpay.service.channel.tencent.common.RandomStringGenerator
;
import
org.xxpay.service.channel.tencent.common.Signature
;
import
org.xxpay.common.constant.PayConstant
;
import
java.lang.reflect.Field
;
import
java.util.HashMap
;
import
java.util.Map
;
/**
* User: rizenguo
* Date: 2014/10/25
* Time: 16:12
*/
public
class
RefundReqData
{
//每个字段具体的意思请查看API文档
private
String
appid
=
""
;
private
String
mch_id
=
""
;
private
String
device_info
=
""
;
private
String
nonce_str
=
""
;
private
String
sign
=
""
;
private
String
transaction_id
=
""
;
private
String
out_trade_no
=
""
;
private
String
out_refund_no
=
""
;
private
int
total_fee
=
0
;
private
int
refund_fee
=
0
;
private
String
refund_fee_type
=
"CNY"
;
private
String
op_user_id
=
""
;
/**
* 请求退款服务
* @param transactionID 是微信系统为每一笔支付交易分配的订单号,通过这个订单号可以标识这笔交易,它由支付订单API支付成功时返回的数据里面获取到。建议优先使用
* @param outTradeNo 商户系统内部的订单号,transaction_id 、out_trade_no 二选一,如果同时存在优先级:transaction_id>out_trade_no
* @param deviceInfo 微信支付分配的终端设备号,与下单一致
* @param outRefundNo 商户系统内部的退款单号,商户系统内部唯一,同一退款单号多次请求只退一笔
* @param totalFee 订单总金额,单位为分
* @param refundFee 退款总金额,单位为分,可以做部分退款
* @param opUserID 操作员帐号, 默认为商户号
* @param refundFeeType 货币类型,符合ISO 4217标准的三位字母代码,默认为CNY(人民币)
*/
public
RefundReqData
(
Configure
configure
,
String
transactionID
,
String
outTradeNo
,
String
deviceInfo
,
String
outRefundNo
,
int
totalFee
,
int
refundFee
,
String
opUserID
,
String
refundFeeType
){
//微信分配的公众号ID(开通公众号之后可以获取到)
setAppid
(
configure
.
getAppID
());
//微信支付分配的商户号ID(开通公众号的微信支付功能之后可以获取到)
setMch_id
(
configure
.
getMchID
());
//transaction_id是微信系统为每一笔支付交易分配的订单号,通过这个订单号可以标识这笔交易,它由支付订单API支付成功时返回的数据里面获取到。
setTransaction_id
(
transactionID
);
//商户系统自己生成的唯一的订单号
setOut_trade_no
(
outTradeNo
);
//微信支付分配的终端设备号,与下单一致
setDevice_info
(
deviceInfo
);
setOut_refund_no
(
outRefundNo
);
setTotal_fee
(
totalFee
);
setRefund_fee
(
refundFee
);
setOp_user_id
(
opUserID
);
//随机字符串,不长于32 位
setNonce_str
(
RandomStringGenerator
.
getRandomStringByLength
(
32
));
//根据API给的签名规则进行签名
String
sign
=
Signature
.
getSign
(
toMap
(),
configure
.
getKey
());
setSign
(
sign
);
//把签名数据设置到Sign这个属性中
}
public
String
getAppid
()
{
return
appid
;
}
public
void
setAppid
(
String
appid
)
{
this
.
appid
=
appid
;
}
public
String
getMch_id
()
{
return
mch_id
;
}
public
void
setMch_id
(
String
mch_id
)
{
this
.
mch_id
=
mch_id
;
}
public
String
getDevice_info
()
{
return
device_info
;
}
public
void
setDevice_info
(
String
device_info
)
{
this
.
device_info
=
device_info
;
}
public
String
getNonce_str
()
{
return
nonce_str
;
}
public
void
setNonce_str
(
String
nonce_str
)
{
this
.
nonce_str
=
nonce_str
;
}
public
String
getSign
()
{
return
sign
;
}
public
void
setSign
(
String
sign
)
{
this
.
sign
=
sign
;
}
public
String
getTransaction_id
()
{
return
transaction_id
;
}
public
void
setTransaction_id
(
String
transaction_id
)
{
this
.
transaction_id
=
transaction_id
;
}
public
String
getOut_trade_no
()
{
return
out_trade_no
;
}
public
void
setOut_trade_no
(
String
out_trade_no
)
{
this
.
out_trade_no
=
out_trade_no
;
}
public
String
getOut_refund_no
()
{
return
out_refund_no
;
}
public
void
setOut_refund_no
(
String
out_refund_no
)
{
this
.
out_refund_no
=
out_refund_no
;
}
public
int
getTotal_fee
()
{
return
total_fee
;
}
public
void
setTotal_fee
(
int
total_fee
)
{
this
.
total_fee
=
total_fee
;
}
public
int
getRefund_fee
()
{
return
refund_fee
;
}
public
void
setRefund_fee
(
int
refund_fee
)
{
this
.
refund_fee
=
refund_fee
;
}
public
String
getOp_user_id
()
{
return
op_user_id
;
}
public
void
setOp_user_id
(
String
op_user_id
)
{
this
.
op_user_id
=
op_user_id
;
}
public
String
getRefund_fee_type
()
{
return
refund_fee_type
;
}
public
void
setRefund_fee_type
(
String
refund_fee_type
)
{
this
.
refund_fee_type
=
refund_fee_type
;
}
public
Map
<
String
,
Object
>
toMap
(){
Map
<
String
,
Object
>
map
=
new
HashMap
<
String
,
Object
>();
Field
[]
fields
=
this
.
getClass
().
getDeclaredFields
();
for
(
Field
field
:
fields
)
{
Object
obj
;
try
{
obj
=
field
.
get
(
this
);
if
(
obj
!=
null
){
map
.
put
(
field
.
getName
(),
obj
);
}
}
catch
(
IllegalArgumentException
e
)
{
e
.
printStackTrace
();
}
catch
(
IllegalAccessException
e
)
{
e
.
printStackTrace
();
}
}
return
map
;
}
}
xxpay4spring-cloud/xxpay-service/src/main/java/org/xxpay/service/channel/tencent/protocol/refund_protocol/RefundResData.java
0 → 100755
View file @
d53783a9
package
org.xxpay.service.channel.tencent.protocol.refund_protocol
;
/**
* User: rizenguo
* Date: 2014/10/25
* Time: 16:12
*/
public
class
RefundResData
{
//协议层
private
String
return_code
=
""
;
private
String
return_msg
=
""
;
//协议返回的具体数据(以下字段在return_code 为SUCCESS 的时候有返回)
private
String
appid
=
""
;
private
String
mch_id
=
""
;
private
String
sub_mch_id
=
""
;
private
String
device_info
=
""
;
private
String
nonce_str
=
""
;
private
String
sign
=
""
;
private
String
result_code
=
""
;
private
String
err_code
=
""
;
private
String
err_code_des
=
""
;
private
String
transaction_id
=
""
;
private
String
out_trade_no
=
""
;
private
String
out_refund_no
=
""
;
private
String
refund_id
=
""
;
private
String
refund_fee
=
""
;
private
String
coupon_refund_fee
=
""
;
public
String
getReturn_code
()
{
return
return_code
;
}
public
void
setReturn_code
(
String
return_code
)
{
this
.
return_code
=
return_code
;
}
public
String
getReturn_msg
()
{
return
return_msg
;
}
public
void
setReturn_msg
(
String
return_msg
)
{
this
.
return_msg
=
return_msg
;
}
public
String
getAppid
()
{
return
appid
;
}
public
void
setAppid
(
String
appid
)
{
this
.
appid
=
appid
;
}
public
String
getMch_id
()
{
return
mch_id
;
}
public
void
setMch_id
(
String
mch_id
)
{
this
.
mch_id
=
mch_id
;
}
public
String
getSub_mch_id
()
{
return
sub_mch_id
;
}
public
void
setSub_mch_id
(
String
sub_mch_id
)
{
this
.
sub_mch_id
=
sub_mch_id
;
}
public
String
getDevice_info
()
{
return
device_info
;
}
public
void
setDevice_info
(
String
device_info
)
{
this
.
device_info
=
device_info
;
}
public
String
getNonce_str
()
{
return
nonce_str
;
}
public
void
setNonce_str
(
String
nonce_str
)
{
this
.
nonce_str
=
nonce_str
;
}
public
String
getSign
()
{
return
sign
;
}
public
void
setSign
(
String
sign
)
{
this
.
sign
=
sign
;
}
public
String
getResult_code
()
{
return
result_code
;
}
public
void
setResult_code
(
String
result_code
)
{
this
.
result_code
=
result_code
;
}
public
String
getErr_code
()
{
return
err_code
;
}
public
void
setErr_code
(
String
err_code
)
{
this
.
err_code
=
err_code
;
}
public
String
getErr_code_des
()
{
return
err_code_des
;
}
public
void
setErr_code_des
(
String
err_code_des
)
{
this
.
err_code_des
=
err_code_des
;
}
public
String
getTransaction_id
()
{
return
transaction_id
;
}
public
void
setTransaction_id
(
String
transaction_id
)
{
this
.
transaction_id
=
transaction_id
;
}
public
String
getOut_trade_no
()
{
return
out_trade_no
;
}
public
void
setOut_trade_no
(
String
out_trade_no
)
{
this
.
out_trade_no
=
out_trade_no
;
}
public
String
getOut_refund_no
()
{
return
out_refund_no
;
}
public
void
setOut_refund_no
(
String
out_refund_no
)
{
this
.
out_refund_no
=
out_refund_no
;
}
public
String
getRefund_id
()
{
return
refund_id
;
}
public
void
setRefund_id
(
String
refund_id
)
{
this
.
refund_id
=
refund_id
;
}
public
String
getRefund_fee
()
{
return
refund_fee
;
}
public
void
setRefund_fee
(
String
refund_fee
)
{
this
.
refund_fee
=
refund_fee
;
}
public
String
getCoupon_refund_fee
()
{
return
coupon_refund_fee
;
}
public
void
setCoupon_refund_fee
(
String
coupon_refund_fee
)
{
this
.
coupon_refund_fee
=
coupon_refund_fee
;
}
}
xxpay4spring-cloud/xxpay-service/src/main/java/org/xxpay/service/channel/tencent/protocol/refund_query_protocol/RefundOrderData.java
0 → 100755
View file @
d53783a9
package
org.xxpay.service.channel.tencent.protocol.refund_query_protocol
;
import
java.lang.reflect.Field
;
import
java.util.LinkedHashMap
;
import
java.util.Map
;
/**
* User: rizenguo
* Date: 2014/11/1
* Time: 14:09
* 用来存放退款订单数据
*/
public
class
RefundOrderData
{
private
String
outRefundNo
=
""
;
//商户退款单号
private
String
refundID
=
""
;
//微信退款单号
private
String
refundChannel
=
""
;
//退款渠道
// IGINAL--原路退款
// BALANCE--退回到余额
private
int
refundFee
=
0
;
//退款金额
private
int
couponRefundFee
=
0
;
//企业红包退款金额
private
String
refundStatus
=
""
;
//退款状态
public
String
getOutRefundNo
()
{
return
outRefundNo
;
}
public
void
setOutRefundNo
(
String
outRefundNo
)
{
this
.
outRefundNo
=
outRefundNo
;
}
public
String
getRefundID
()
{
return
refundID
;
}
public
void
setRefundID
(
String
refundID
)
{
this
.
refundID
=
refundID
;
}
public
String
getRefundChannel
()
{
return
refundChannel
;
}
public
void
setRefundChannel
(
String
refundChannel
)
{
this
.
refundChannel
=
refundChannel
;
}
public
int
getRefundFee
()
{
return
refundFee
;
}
public
void
setRefundFee
(
int
refundFee
)
{
this
.
refundFee
=
refundFee
;
}
public
int
getCouponRefundFee
()
{
return
couponRefundFee
;
}
public
void
setCouponRefundFee
(
int
couponRefundFee
)
{
this
.
couponRefundFee
=
couponRefundFee
;
}
public
String
getRefundStatus
()
{
return
refundStatus
;
}
public
void
setRefundStatus
(
String
refundStatus
)
{
this
.
refundStatus
=
refundStatus
;
}
public
String
toMap
(){
Map
<
String
,
Object
>
map
=
new
LinkedHashMap
<
String
,
Object
>();
Field
[]
fields
=
this
.
getClass
().
getDeclaredFields
();
StringBuilder
s
=
new
StringBuilder
(
"{"
);
for
(
Field
field
:
fields
)
{
Object
obj
;
try
{
obj
=
field
.
get
(
this
);
if
(
obj
!=
null
){
if
(
s
.
length
()>
0
){
s
.
append
(
" "
);
}
s
.
append
(
field
.
getName
());
s
.
append
(
"="
);
s
.
append
(
obj
.
toString
());
// map.put(field.getName(), obj);
}
}
catch
(
IllegalArgumentException
e
)
{
e
.
printStackTrace
();
}
catch
(
IllegalAccessException
e
)
{
e
.
printStackTrace
();
}
}
s
.
append
(
"}"
);
return
s
.
toString
();
}
}
xxpay4spring-cloud/xxpay-service/src/main/java/org/xxpay/service/channel/tencent/protocol/refund_query_protocol/RefundQueryReqData.java
0 → 100755
View file @
d53783a9
package
org.xxpay.service.channel.tencent.protocol.refund_query_protocol
;
import
org.xxpay.service.channel.tencent.common.Configure
;
import
org.xxpay.service.channel.tencent.common.RandomStringGenerator
;
import
org.xxpay.service.channel.tencent.common.Signature
;
import
org.xxpay.common.constant.PayConstant
;
import
java.lang.reflect.Field
;
import
java.util.HashMap
;
import
java.util.Map
;
/**
* User: rizenguo
* Date: 2014/10/25
* Time: 16:35
*/
public
class
RefundQueryReqData
{
//每个字段具体的意思请查看API文档
private
String
appid
=
""
;
private
String
mch_id
=
""
;
private
String
device_info
=
""
;
private
String
nonce_str
=
""
;
private
String
sign
=
""
;
private
String
transaction_id
=
""
;
private
String
out_trade_no
=
""
;
/**
* 请求退款查询服务
* @param transactionID 是微信系统为每一笔支付交易分配的订单号,通过这个订单号可以标识这笔交易,它由支付订单API支付成功时返回的数据里面获取到。建议优先使用
* @param outTradeNo 商户系统内部的订单号,transaction_id 、out_trade_no 二选一,如果同时存在优先级:transaction_id>out_trade_no
* @param deviceInfo 微信支付分配的终端设备号,与下单一致
* @param outRefundNo 商户系统内部的退款单号,商户系统内部唯一,同一退款单号多次请求只退一笔
* @param refundID 来自退款API的成功返回,微信退款单号refund_id、out_refund_no、out_trade_no 、transaction_id 四个参数必填一个,如果同事存在优先级为:refund_id>out_refund_no>transaction_id>out_trade_no
*/
public
RefundQueryReqData
(
Configure
configure
,
String
transactionID
,
String
outTradeNo
,
String
deviceInfo
,
String
outRefundNo
,
String
refundID
){
//微信分配的公众号ID(开通公众号之后可以获取到)
setAppid
(
configure
.
getAppID
());
//微信支付分配的商户号ID(开通公众号的微信支付功能之后可以获取到)
setMch_id
(
configure
.
getMchID
());
//transaction_id是微信系统为每一笔支付交易分配的订单号,通过这个订单号可以标识这笔交易,它由支付订单API支付成功时返回的数据里面获取到。
setTransaction_id
(
transactionID
);
//商户系统自己生成的唯一的订单号
setOut_trade_no
(
outTradeNo
);
//微信支付分配的终端设备号,与下单一致
setDevice_info
(
deviceInfo
);
setOut_refund_no
(
outRefundNo
);
//商户系统自己管理的退款号,商户自身必须保证这个号在系统内唯一
setRefund_id
(
refundID
);
//随机字符串,不长于32 位
setNonce_str
(
RandomStringGenerator
.
getRandomStringByLength
(
32
));
//根据API给的签名规则进行签名
String
sign
=
Signature
.
getSign
(
toMap
(),
configure
.
getKey
());
setSign
(
sign
);
//把签名数据设置到Sign这个属性中
}
public
String
getAppid
()
{
return
appid
;
}
public
void
setAppid
(
String
appid
)
{
this
.
appid
=
appid
;
}
public
String
getMch_id
()
{
return
mch_id
;
}
public
void
setMch_id
(
String
mch_id
)
{
this
.
mch_id
=
mch_id
;
}
public
String
getDevice_info
()
{
return
device_info
;
}
public
void
setDevice_info
(
String
device_info
)
{
this
.
device_info
=
device_info
;
}
public
String
getNonce_str
()
{
return
nonce_str
;
}
public
void
setNonce_str
(
String
nonce_str
)
{
this
.
nonce_str
=
nonce_str
;
}
public
String
getSign
()
{
return
sign
;
}
public
void
setSign
(
String
sign
)
{
this
.
sign
=
sign
;
}
public
String
getTransaction_id
()
{
return
transaction_id
;
}
public
void
setTransaction_id
(
String
transaction_id
)
{
this
.
transaction_id
=
transaction_id
;
}
public
String
getOut_trade_no
()
{
return
out_trade_no
;
}
public
void
setOut_trade_no
(
String
out_trade_no
)
{
this
.
out_trade_no
=
out_trade_no
;
}
public
String
getOut_refund_no
()
{
return
out_refund_no
;
}
public
void
setOut_refund_no
(
String
out_refund_no
)
{
this
.
out_refund_no
=
out_refund_no
;
}
public
String
getRefund_id
()
{
return
refund_id
;
}
public
void
setRefund_id
(
String
refund_id
)
{
this
.
refund_id
=
refund_id
;
}
private
String
out_refund_no
;
private
String
refund_id
;
public
Map
<
String
,
Object
>
toMap
(){
Map
<
String
,
Object
>
map
=
new
HashMap
<
String
,
Object
>();
Field
[]
fields
=
this
.
getClass
().
getDeclaredFields
();
for
(
Field
field
:
fields
)
{
Object
obj
;
try
{
obj
=
field
.
get
(
this
);
if
(
obj
!=
null
){
map
.
put
(
field
.
getName
(),
obj
);
}
}
catch
(
IllegalArgumentException
e
)
{
e
.
printStackTrace
();
}
catch
(
IllegalAccessException
e
)
{
e
.
printStackTrace
();
}
}
return
map
;
}
}
Prev
1
…
17
18
19
20
21
22
23
24
Next
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment