1 <?php
2
3 namespace PayPal\Api;
4
5 use PayPal\Common\PayPalModel;
6 use PayPal\Converter\FormatConverter;
7 use PayPal\Validation\NumericValidator;
8
9 /**
10 * Class Details
11 *
12 * Additional details of the payment amount.
13 *
14 * @package PayPal\Api
15 *
16 * @property string subtotal
17 * @property string shipping
18 * @property string tax
19 * @property string handling_fee
20 * @property string shipping_discount
21 * @property string insurance
22 * @property string gift_wrap
23 * @property string fee
24 */
25 class Details extends PayPalModel
26 {
27 /**
28 * Amount of the subtotal of the items. **Required** if line items are specified. 10 characters max, with support for 2 decimal places.
29 *
30 * @param string|double $subtotal
31 *
32 * @return $this
33 */
34 public function setSubtotal($subtotal)
35 {
36 NumericValidator::validate($subtotal, "Subtotal");
37 $subtotal = FormatConverter::formatToPrice($subtotal);
38 $this->subtotal = $subtotal;
39 return $this;
40 }
41
42 /**
43 * Amount of the subtotal of the items. **Required** if line items are specified. 10 characters max, with support for 2 decimal places.
44 *
45 * @return string
46 */
47 public function getSubtotal()
48 {
49 return $this->subtotal;
50 }
51
52 /**
53 * Amount charged for shipping. 10 characters max with support for 2 decimal places.
54 *
55 * @param string|double $shipping
56 *
57 * @return $this
58 */
59 public function setShipping($shipping)
60 {
61 NumericValidator::validate($shipping, "Shipping");
62 $shipping = FormatConverter::formatToPrice($shipping);
63 $this->shipping = $shipping;
64 return $this;
65 }
66
67 /**
68 * Amount charged for shipping. 10 characters max with support for 2 decimal places.
69 *
70 * @return string
71 */
72 public function getShipping()
73 {
74 return $this->shipping;
75 }
76
77 /**
78 * Amount charged for tax. 10 characters max with support for 2 decimal places.
79 *
80 * @param string|double $tax
81 *
82 * @return $this
83 */
84 public function setTax($tax)
85 {
86 NumericValidator::validate($tax, "Tax");
87 $tax = FormatConverter::formatToPrice($tax);
88 $this->tax = $tax;
89 return $this;
90 }
91
92 /**
93 * Amount charged for tax. 10 characters max with support for 2 decimal places.
94 *
95 * @return string
96 */
97 public function getTax()
98 {
99 return $this->tax;
100 }
101
102 /**
103 * Amount being charged for the handling fee. Only supported when the `payment_method` is set to `paypal`.
104 *
105 * @param string|double $handling_fee
106 *
107 * @return $this
108 */
109 public function setHandlingFee($handling_fee)
110 {
111 NumericValidator::validate($handling_fee, "Handling Fee");
112 $handling_fee = FormatConverter::formatToPrice($handling_fee);
113 $this->handling_fee = $handling_fee;
114 return $this;
115 }
116
117 /**
118 * Amount being charged for the handling fee. Only supported when the `payment_method` is set to `paypal`.
119 *
120 * @return string
121 */
122 public function getHandlingFee()
123 {
124 return $this->handling_fee;
125 }
126
127 /**
128 * Amount being discounted for the shipping fee. Only supported when the `payment_method` is set to `paypal`.
129 *
130 * @param string|double $shipping_discount
131 *
132 * @return $this
133 */
134 public function setShippingDiscount($shipping_discount)
135 {
136 NumericValidator::validate($shipping_discount, "Shipping Discount");
137 $shipping_discount = FormatConverter::formatToPrice($shipping_discount);
138 $this->shipping_discount = $shipping_discount;
139 return $this;
140 }
141
142 /**
143 * Amount being discounted for the shipping fee. Only supported when the `payment_method` is set to `paypal`.
144 *
145 * @return string
146 */
147 public function getShippingDiscount()
148 {
149 return $this->shipping_discount;
150 }
151
152 /**
153 * Amount being charged for the insurance fee. Only supported when the `payment_method` is set to `paypal`.
154 *
155 * @param string|double $insurance
156 *
157 * @return $this
158 */
159 public function setInsurance($insurance)
160 {
161 NumericValidator::validate($insurance, "Insurance");
162 $insurance = FormatConverter::formatToPrice($insurance);
163 $this->insurance = $insurance;
164 return $this;
165 }
166
167 /**
168 * Amount being charged for the insurance fee. Only supported when the `payment_method` is set to `paypal`.
169 *
170 * @return string
171 */
172 public function getInsurance()
173 {
174 return $this->insurance;
175 }
176
177 /**
178 * Amount being charged as gift wrap fee.
179 *
180 * @param string|double $gift_wrap
181 *
182 * @return $this
183 */
184 public function setGiftWrap($gift_wrap)
185 {
186 NumericValidator::validate($gift_wrap, "Gift Wrap");
187 $gift_wrap = FormatConverter::formatToPrice($gift_wrap);
188 $this->gift_wrap = $gift_wrap;
189 return $this;
190 }
191
192 /**
193 * Amount being charged as gift wrap fee.
194 *
195 * @return string
196 */
197 public function getGiftWrap()
198 {
199 return $this->gift_wrap;
200 }
201
202 /**
203 * Fee charged by PayPal. In case of a refund, this is the fee amount refunded to the original receipient of the payment.
204 *
205 * @param string|double $fee
206 *
207 * @return $this
208 */
209 public function setFee($fee)
210 {
211 NumericValidator::validate($fee, "Fee");
212 $fee = FormatConverter::formatToPrice($fee);
213 $this->fee = $fee;
214 return $this;
215 }
216
217 /**
218 * Fee charged by PayPal. In case of a refund, this is the fee amount refunded to the original receipient of the payment.
219 *
220 * @return string
221 */
222 public function getFee()
223 {
224 return $this->fee;
225 }
226
227 }
228