View Javadoc
1   package com.foxinmy.weixin4j.payment.mch;
2   
3   import com.foxinmy.weixin4j.model.WeixinPayAccount;
4   import com.foxinmy.weixin4j.payment.PayRequest;
5   import com.foxinmy.weixin4j.type.TradeType;
6   
7   /**
8    * WAP支付
9    * 
10   * @className WAPPayRequest
11   * @author jinyu(foxinmy@gmail.com)
12   * @date 2015年12月25日
13   * @since JDK 1.6
14   * @see com.foxinmy.weixin4j.payment.mch.PrePay
15   * @see com.foxinmy.weixin4j.payment.PayRequest
16   * @see <a
17   *      href="https://pay.weixin.qq.com/wiki/doc/api/wap.php?chapter=15_1">WAP支付</a>
18   */
19  @Deprecated
20  public class WAPPayRequest extends AbstractPayRequest {
21  	/**
22  	 * 微信支付URL
23  	 */
24  	private final String payUrl;
25  
26  	public WAPPayRequest(String prePayId, String payUrl,
27  			WeixinPayAccount payAccount) {
28  		super(prePayId, payAccount);
29  		this.payUrl = payUrl;
30  
31  	}
32  
33  	@Override
34  	public TradeType getPaymentType() {
35  		return TradeType.MWEB;
36  	}
37  
38  	/**
39  	 * <font color="red">只做查看之用,请不要尝试作为支付请求</font>
40  	 */
41  	@Override
42  	public PayRequest toRequestObject() {
43  		PayRequest payRequest = new PayRequest(getPaymentAccount().getId(),
44  				getPaymentType().name());
45  		payRequest.setPrepayId(getPrePayId());
46  		return payRequest;
47  	}
48  
49  	@Override
50  	public String toRequestString() {
51  		// PayRequest payRequest = toRequestObject();
52  		// String original = MapUtil.toJoinString(payRequest, true, true);
53  		// String sign = DigestUtil.MD5(
54  		// String.format("%s&key=%s", original, getPaymentAccount()
55  		// .getPaySignKey())).toUpperCase();
56  		// return String.format("weixin://wap/pay?%s",
57  		// URLEncodingUtil.encoding(
58  		// String.format("%s&sign=%s", original, sign),
59  		// Consts.UTF_8, true));
60  		return this.payUrl;
61  	}
62  }