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 Cost
11 *
12 * Cost as a percent or an amount. For example, to specify 10%, enter `10`. Alternatively, to specify an amount of 5, enter `5`.
13 *
14 * @package PayPal\Api
15 *
16 * @property string percent
17 * @property \PayPal\Api\Currency amount
18 */
19 class Cost extends PayPalModel
20 {
21 /**
22 * Cost in percent. Range of 0 to 100.
23 *
24 * @param string $percent
25 *
26 * @return $this
27 */
28 public function setPercent($percent)
29 {
30 NumericValidator::validate($percent, "Percent");
31 $percent = FormatConverter::formatToNumber($percent);
32 $this->percent = $percent;
33 return $this;
34 }
35
36 /**
37 * Cost in percent. Range of 0 to 100.
38 *
39 * @return string
40 */
41 public function getPercent()
42 {
43 return $this->percent;
44 }
45
46 /**
47 * The cost, as an amount. Valid range is from 0 to 1,000,000.
48 *
49 * @param \PayPal\Api\Currency $amount
50 *
51 * @return $this
52 */
53 public function setAmount($amount)
54 {
55 $this->amount = $amount;
56 return $this;
57 }
58
59 /**
60 * The cost, as an amount. Valid range is from 0 to 1,000,000.
61 *
62 * @return \PayPal\Api\Currency
63 */
64 public function getAmount()
65 {
66 return $this->amount;
67 }
68
69 }
70