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 Amount
11 *
12 * payment amount with break-ups.
13 *
14 * @package PayPal\Api
15 *
16 * @property string currency
17 * @property string total
18 * @property \PayPal\Api\Details details
19 */
20 class Amount extends PayPalModel
21 {
22 /**
23 * 3-letter [currency code](https://developer.paypal.com/docs/integration/direct/rest_api_payment_country_currency_support/). PayPal does not support all currencies.
24 *
25 * @param string $currency
26 *
27 * @return $this
28 */
29 public function setCurrency($currency)
30 {
31 $this->currency = $currency;
32 return $this;
33 }
34
35 /**
36 * 3-letter [currency code](https://developer.paypal.com/docs/integration/direct/rest_api_payment_country_currency_support/). PayPal does not support all currencies.
37 *
38 * @return string
39 */
40 public function getCurrency()
41 {
42 return $this->currency;
43 }
44
45 /**
46 * Total amount charged from the payer to the payee. In case of a refund, this is the refunded amount to the original payer from the payee. 10 characters max with support for 2 decimal places.
47 *
48 * @param string|double $total
49 *
50 * @return $this
51 */
52 public function setTotal($total)
53 {
54 NumericValidator::validate($total, "Total");
55 $total = FormatConverter::formatToPrice($total, $this->getCurrency());
56 $this->total = $total;
57 return $this;
58 }
59
60 /**
61 * Total amount charged from the payer to the payee. In case of a refund, this is the refunded amount to the original payer from the payee. 10 characters max with support for 2 decimal places.
62 *
63 * @return string
64 */
65 public function getTotal()
66 {
67 return $this->total;
68 }
69
70 /**
71 * Additional details of the payment amount.
72 *
73 * @param \PayPal\Api\Details $details
74 *
75 * @return $this
76 */
77 public function setDetails($details)
78 {
79 $this->details = $details;
80 return $this;
81 }
82
83 /**
84 * Additional details of the payment amount.
85 *
86 * @return \PayPal\Api\Details
87 */
88 public function getDetails()
89 {
90 return $this->details;
91 }
92
93 }
94