View Javadoc
1   package com.foxinmy.weixin4j.payment.coupon;
2   
3   import java.io.Serializable;
4   
5   import javax.xml.bind.annotation.XmlAccessType;
6   import javax.xml.bind.annotation.XmlAccessorType;
7   import javax.xml.bind.annotation.XmlElement;
8   import javax.xml.bind.annotation.XmlRootElement;
9   
10  import com.alibaba.fastjson.annotation.JSONField;
11  import com.foxinmy.weixin4j.type.mch.CouponType;
12  
13  /**
14   * 订单代金券信息
15   * 
16   * @className OrderCouponInfo
17   * @author jinyu(foxinmy@gmail.com)
18   * @date 2015年3月24日
19   * @since JDK 1.6
20   * @see
21   * @deprecated 迁移到子模块weixin4j-pay
22   */
23  @Deprecated
24  @XmlRootElement
25  @XmlAccessorType(XmlAccessType.FIELD)
26  public class OrderCouponInfo implements Serializable {
27  
28  	private static final long serialVersionUID = -8744999305258786901L;
29  
30  	/**
31  	 * 代金券或立减优惠批次ID
32  	 */
33  	@XmlElement(name = "coupon_batch_id")
34  	@JSONField(name = "coupon_batch_id")
35  	private String couponBatchId;
36  	/**
37  	 * 代金券类型
38  	 * 
39  	 * @see com.foxinmy.weixin4j.type.mch.CouponType
40  	 */
41  	@XmlElement(name = "coupon_type")
42  	@JSONField(name = "coupon_type")
43  	private String couponType;
44  	/**
45  	 * 代金券或立减优惠ID
46  	 */
47  	@XmlElement(name = "coupon_id")
48  	@JSONField(name = "coupon_id")
49  	private String couponId;
50  	/**
51  	 * 单个代金券或立减优惠支付金额
52  	 */
53  	@XmlElement(name = "coupon_fee")
54  	@JSONField(name = "coupon_fee")
55  	private Integer couponFee;
56  
57  	protected OrderCouponInfo() {
58  		// jaxb requried
59  	}
60  
61  	public String getCouponBatchId() {
62  		return couponBatchId;
63  	}
64  
65  	public String getCouponType() {
66  		return couponType;
67  	}
68  
69  	@JSONField(serialize = false)
70  	public CouponType getFormatCouponType() {
71  		return couponType != null ? CouponType
72  				.valueOf(couponType.toUpperCase()) : null;
73  	}
74  
75  	public String getCouponId() {
76  		return couponId;
77  	}
78  
79  	public Integer getCouponFee() {
80  		return couponFee;
81  	}
82  
83  	/**
84  	 * <font color="red">调用接口获取单位为分,get方法转换为元方便使用</font>
85  	 * 
86  	 * @return 元单位
87  	 */
88  	@JSONField(serialize = false)
89  	public double getFormatCouponFee() {
90  		return couponFee != null ? couponFee.doubleValue() / 100d : 0d;
91  	}
92  
93  	@Override
94  	public String toString() {
95  		return "couponBatchId=" + couponBatchId + ", couponType=" + couponType
96  				+ ", couponId=" + couponId + ", couponFee=" + couponFee;
97  	}
98  }