View Javadoc
1   package com.foxinmy.weixin4j.payment.mch;
2   
3   import javax.xml.bind.annotation.XmlAccessType;
4   import javax.xml.bind.annotation.XmlAccessorType;
5   import javax.xml.bind.annotation.XmlElement;
6   import javax.xml.bind.annotation.XmlRootElement;
7   
8   import com.alibaba.fastjson.annotation.JSONField;
9   import com.foxinmy.weixin4j.type.mch.CorpPaymentCheckNameType;
10  import com.foxinmy.weixin4j.util.DateUtil;
11  
12  /**
13   * 企业付款
14   * 
15   * @className CorpPayment
16   * @author jinyu(foxinmy@gmail.com)
17   * @date 2015年4月1日
18   * @since JDK 1.6
19   * @see
20   * @deprecated 迁移到子模块weixin4j-pay
21   */
22  @Deprecated
23  @XmlRootElement
24  @XmlAccessorType(XmlAccessType.FIELD)
25  public class CorpPayment extends MerchantResult {
26  
27  	private static final long serialVersionUID = 3734639674346425312L;
28  	/**
29  	 * 商户订单号
30  	 */
31  	@XmlElement(name = "partner_trade_no")
32  	@JSONField(name = "partner_trade_no")
33  	private String outTradeNo;
34  	/**
35  	 * 接收红包的用户的openid
36  	 */
37  	@JSONField(name = "openid")
38  	@XmlElement(name = "openid")
39  	private String openId;
40  	/**
41  	 * 校验用户姓名选项
42  	 * 
43  	 * @see com.foxinmy.weixin4j.type.mch.CorpPaymentCheckNameType.type.MPPaymentCheckNameType
44  	 */
45  	@XmlElement(name = "check_name")
46  	@JSONField(name = "check_name")
47  	private CorpPaymentCheckNameType checkNameType;
48  	/**
49  	 * 收款用户真实姓名。 如果check_name设置为FORCE_CHECK或OPTION_CHECK,则必填用户真实姓名 可选
50  	 */
51  	@XmlElement(name = "re_user_name")
52  	@JSONField(name = "re_user_name")
53  	private String userName;
54  	/**
55  	 * 企业付款描述信息
56  	 */
57  	private String desc;
58  	/**
59  	 * 付款金额 单位分
60  	 */
61  	private int amount;
62  	/**
63  	 * 调用接口的机器Ip地址
64  	 */
65  	@XmlElement(name = "spbill_create_ip")
66  	@JSONField(name = "spbill_create_ip")
67  	private String clientIp;
68  
69  	protected CorpPayment() {
70  		// jaxb required
71  	}
72  
73  	/**
74  	 * 企业付款
75  	 * 
76  	 * @param outTradeNo
77  	 *            商户的订单号
78  	 * @param openId
79  	 *            用户的openid
80  	 * @param checkNameType
81  	 *            校验用户姓名选项
82  	 * @param desc
83  	 *            描述
84  	 * @param amount
85  	 *            金额 单位元
86  	 * @param clientIp
87  	 *            调用接口IP
88  	 */
89  	public CorpPayment(String outTradeNo, String openId,
90  			CorpPaymentCheckNameType checkNameType, String desc, double amount,
91  			String clientIp) {
92  		this.outTradeNo = outTradeNo;
93  		this.openId = openId;
94  		this.checkNameType = checkNameType;
95  		this.desc = desc;
96  		this.amount = DateUtil.formatYuan2Fen(amount);
97  		this.clientIp = clientIp;
98  	}
99  
100 	public String getOutTradeNo() {
101 		return outTradeNo;
102 	}
103 
104 	public String getOpenId() {
105 		return openId;
106 	}
107 
108 	public CorpPaymentCheckNameType getCheckNameType() {
109 		return checkNameType;
110 	}
111 
112 	public String getUserName() {
113 		return userName;
114 	}
115 
116 	public String getDesc() {
117 		return desc;
118 	}
119 
120 	public int getAmount() {
121 		return amount;
122 	}
123 	
124 	/**
125 	 * <font color="red">调用接口获取单位为分,get方法转换为元方便使用</font>
126 	 * 
127 	 * @return 元单位
128 	 */
129 	@JSONField(serialize = false)
130 	public double getFormatAmount() {
131 		return amount / 100d;
132 	}
133 
134 	public String getClientIp() {
135 		return clientIp;
136 	}
137 
138 	public void setUserName(String userName) {
139 		this.userName = userName;
140 	}
141 
142 	@Override
143 	public String toString() {
144 		return "CorpPayment [outTradeNo=" + outTradeNo + ", openId=" + openId
145 				+ ", checkNameType=" + checkNameType + ", userName=" + userName
146 				+ ", desc=" + desc + ", amount=" + amount + ", clientIp="
147 				+ clientIp + ", " + super.toString() + "]";
148 	}
149 }