View Javadoc
1   package com.foxinmy.weixin4j.sign;
2   
3   import com.foxinmy.weixin4j.type.SignType;
4   import com.foxinmy.weixin4j.util.DigestUtil;
5   
6   /**
7    * 微信支付签名实现
8    *
9    * @className WeixinPaymentSignature
10   * @author jinyu(foxinmy@gmail.com)
11   * @date 2016年3月26日
12   * @since JDK 1.6
13   * @see <a
14   *      href="https://pay.weixin.qq.com/wiki/doc/api/external/jsapi.php?chapter=4_3">支付签名说明</a>
15   * @deprecated 迁移到子模块weixin4j-pay
16   */
17  @Deprecated
18  public class WeixinPaymentSignature extends AbstractWeixinSignature {
19  	/**
20  	 * 支付密钥
21  	 */
22  	private final String paySignKey;
23  
24  	public WeixinPaymentSignature(String paySignKey) {
25  		this.paySignKey = paySignKey;
26  	}
27  
28  	@Override
29  	public SignType getSignType() {
30  		return SignType.MD5;
31  	}
32  
33  	@Override
34  	public String sign(Object obj) {
35  		StringBuilder sb = join(obj).append("&key=").append(paySignKey);
36  		return DigestUtil.MD5(sb.toString()).toUpperCase();
37  	}
38  }