forked from AuthorizeNet/sdk-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOrderItem.java
More file actions
156 lines (130 loc) · 3.34 KB
/
OrderItem.java
File metadata and controls
156 lines (130 loc) · 3.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
package net.authorize.data;
import java.io.Serializable;
import java.math.BigDecimal;
import javax.xml.bind.annotation.XmlRootElement;
import net.authorize.aim.Transaction;
import net.authorize.util.StringUtils;
@XmlRootElement
/**
* Itemized order information.
*
*/
public class OrderItem implements Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
public static final int MAX_ITEM_ID_LENGTH = 31;
public static final int MAX_ITEM_NAME_LENGTH = 31;
public static final int MAX_ITEM_DESCRIPTION_LENGTH = 255;
protected String itemId;
protected String itemName;
protected String itemDescription;
protected BigDecimal itemQuantity = new BigDecimal(0.00);
protected BigDecimal itemPrice = new BigDecimal(0.00);
protected boolean itemTaxable = false;
protected OrderItem() { }
public static OrderItem createOrderItem() {
OrderItem orderItem = new OrderItem();
return orderItem;
}
/**
* @return the itemId
*/
public String getItemId() {
return itemId;
}
/**
* @param itemId the itemId to set
*/
public void setItemId(String itemId) {
this.itemId = itemId;
}
/**
* @return the itemName
*/
public String getItemName() {
return itemName;
}
/**
* @param itemName the itemName to set
*/
public void setItemName(String itemName) {
this.itemName = itemName;
}
/**
* @return the itemDescription
*/
public String getItemDescription() {
return itemDescription;
}
/**
* @param itemDescription the itemDescription to set
*/
public void setItemDescription(String itemDescription) {
this.itemDescription = itemDescription;
}
/**
* @return the itemQuantity
*/
public BigDecimal getItemQuantity() {
return itemQuantity;
}
/**
* @param itemQuantity the itemQuantity to set
*/
public void setItemQuantity(BigDecimal itemQuantity) {
this.itemQuantity = itemQuantity;
if(this.itemQuantity != null) {
this.itemQuantity.setScale(Transaction.QUANTITY_DECIMAL_PLACES, BigDecimal.ROUND_HALF_UP);
}
}
/**
* @param itemQuantity the itemQuantity to set
*/
public void setItemQuantity(String itemQuantity) {
if(StringUtils.isNotEmpty(itemQuantity)) {
this.itemQuantity = new BigDecimal(itemQuantity).setScale(Transaction.QUANTITY_DECIMAL_PLACES, BigDecimal.ROUND_HALF_UP);
}
}
/**
* @return the itemPrice
*/
public BigDecimal getItemPrice() {
return itemPrice;
}
/**
* @param itemPrice the itemPrice to set
*/
public void setItemPrice(BigDecimal itemPrice) {
this.itemPrice = itemPrice;
}
/**
* @param itemPrice the itemPrice to set
*/
public void setItemPrice(String itemPrice) {
if(StringUtils.isNotEmpty(itemPrice)) {
this.itemPrice = new BigDecimal(itemPrice).setScale(Transaction.CURRENCY_DECIMAL_PLACES, BigDecimal.ROUND_HALF_UP);
}
}
/**
* @return the itemTaxable
*/
public boolean isItemTaxable() {
return itemTaxable;
}
/**
* @param itemTaxable the itemTaxable to set
*/
public void setItemTaxable(boolean itemTaxable) {
this.itemTaxable = itemTaxable;
}
/**
* @param itemTaxable the itemTaxable to set
*/
public void setItemTaxable(String itemTaxable) {
if(StringUtils.isNotEmpty(itemTaxable)) {
this.itemTaxable = Boolean.valueOf(itemTaxable);
}
}
}