View Javadoc
1   package com.foxinmy.weixin4j.pay.payment.mch;
2   
3   import com.foxinmy.weixin4j.pay.model.WeixinPayAccount;
4   import com.foxinmy.weixin4j.pay.payment.PayRequest;
5   import com.foxinmy.weixin4j.pay.type.TradeType;
6   
7   /**
8    * NATIVE扫码支付(模式二)
9    * 
10   * @className NATIVEPayRequest
11   * @author jinyu(foxinmy@gmail.com)
12   * @date 2015年12月25日
13   * @since JDK 1.6
14   * @see PrePay
15   * @see PayRequest
16   * @see <a
17   *      href="https://pay.weixin.qq.com/wiki/doc/api/native.php?chapter=6_1">NATIVE扫码支付(模式二)</a>
18   */
19  public class NATIVEPayRequest extends AbstractPayRequest {
20  
21  	private final String codeUrl;
22  
23  	public NATIVEPayRequest(String prePayId, String codeUrl,
24  			WeixinPayAccount payAccount) {
25  		super(prePayId, payAccount);
26  		this.codeUrl = codeUrl;
27  	}
28  
29  	@Override
30  	public TradeType getPaymentType() {
31  		return TradeType.NATIVE;
32  	}
33  
34  	/**
35  	 * <font color="red">只做查看之用,请不要尝试作为支付请求</font>
36  	 */
37  	@Override
38  	public PayRequest toRequestObject() {
39  		return new PayRequest(getPaymentAccount().getId(), "code_url=" + codeUrl);
40  	}
41  
42  	@Override
43  	public String toRequestString() {
44  		return this.codeUrl;
45  	}
46  }