1 <?php
2
3 namespace PayPal\Api;
4
5 use PayPal\Common\PayPalModel;
6
7 /**
8 * Class PaymentDefinition
9 *
10 * Resource representing payment definition scheduling information.
11 *
12 * @package PayPal\Api
13 *
14 * @property string id
15 * @property string name
16 * @property string type
17 * @property string frequency_interval
18 * @property string frequency
19 * @property string cycles
20 * @property \PayPal\Api\Currency amount
21 * @property \PayPal\Api\ChargeModel[] charge_models
22 */
23 class PaymentDefinition extends PayPalModel
24 {
25 /**
26 * Identifier of the payment_definition. 128 characters max.
27 *
28 * @param string $id
29 *
30 * @return $this
31 */
32 public function setId($id)
33 {
34 $this->id = $id;
35 return $this;
36 }
37
38 /**
39 * Identifier of the payment_definition. 128 characters max.
40 *
41 * @return string
42 */
43 public function getId()
44 {
45 return $this->id;
46 }
47
48 /**
49 * Name of the payment definition. 128 characters max.
50 *
51 * @param string $name
52 *
53 * @return $this
54 */
55 public function setName($name)
56 {
57 $this->name = $name;
58 return $this;
59 }
60
61 /**
62 * Name of the payment definition. 128 characters max.
63 *
64 * @return string
65 */
66 public function getName()
67 {
68 return $this->name;
69 }
70
71 /**
72 * Type of the payment definition. Allowed values: `TRIAL`, `REGULAR`.
73 *
74 * @param string $type
75 *
76 * @return $this
77 */
78 public function setType($type)
79 {
80 $this->type = $type;
81 return $this;
82 }
83
84 /**
85 * Type of the payment definition. Allowed values: `TRIAL`, `REGULAR`.
86 *
87 * @return string
88 */
89 public function getType()
90 {
91 return $this->type;
92 }
93
94 /**
95 * How frequently the customer should be charged.
96 *
97 * @param string $frequency_interval
98 *
99 * @return $this
100 */
101 public function setFrequencyInterval($frequency_interval)
102 {
103 $this->frequency_interval = $frequency_interval;
104 return $this;
105 }
106
107 /**
108 * How frequently the customer should be charged.
109 *
110 * @return string
111 */
112 public function getFrequencyInterval()
113 {
114 return $this->frequency_interval;
115 }
116
117 /**
118 * Frequency of the payment definition offered. Allowed values: `WEEK`, `DAY`, `YEAR`, `MONTH`.
119 *
120 * @param string $frequency
121 *
122 * @return $this
123 */
124 public function setFrequency($frequency)
125 {
126 $this->frequency = $frequency;
127 return $this;
128 }
129
130 /**
131 * Frequency of the payment definition offered. Allowed values: `WEEK`, `DAY`, `YEAR`, `MONTH`.
132 *
133 * @return string
134 */
135 public function getFrequency()
136 {
137 return $this->frequency;
138 }
139
140 /**
141 * Number of cycles in this payment definition.
142 *
143 * @param string $cycles
144 *
145 * @return $this
146 */
147 public function setCycles($cycles)
148 {
149 $this->cycles = $cycles;
150 return $this;
151 }
152
153 /**
154 * Number of cycles in this payment definition.
155 *
156 * @return string
157 */
158 public function getCycles()
159 {
160 return $this->cycles;
161 }
162
163 /**
164 * Amount that will be charged at the end of each cycle for this payment definition.
165 *
166 * @param \PayPal\Api\Currency $amount
167 *
168 * @return $this
169 */
170 public function setAmount($amount)
171 {
172 $this->amount = $amount;
173 return $this;
174 }
175
176 /**
177 * Amount that will be charged at the end of each cycle for this payment definition.
178 *
179 * @return \PayPal\Api\Currency
180 */
181 public function getAmount()
182 {
183 return $this->amount;
184 }
185
186 /**
187 * Array of charge_models for this payment definition.
188 *
189 * @param \PayPal\Api\ChargeModel[] $charge_models
190 *
191 * @return $this
192 */
193 public function setChargeModels($charge_models)
194 {
195 $this->charge_models = $charge_models;
196 return $this;
197 }
198
199 /**
200 * Array of charge_models for this payment definition.
201 *
202 * @return \PayPal\Api\ChargeModel[]
203 */
204 public function getChargeModels()
205 {
206 return $this->charge_models;
207 }
208
209 /**
210 * Append ChargeModels to the list.
211 *
212 * @param \PayPal\Api\ChargeModel $chargeModel
213 * @return $this
214 */
215 public function addChargeModel($chargeModel)
216 {
217 if (!$this->getChargeModels()) {
218 return $this->setChargeModels(array($chargeModel));
219 } else {
220 return $this->setChargeModels(
221 array_merge($this->getChargeModels(), array($chargeModel))
222 );
223 }
224 }
225
226 /**
227 * Remove ChargeModels from the list.
228 *
229 * @param \PayPal\Api\ChargeModel $chargeModel
230 * @return $this
231 */
232 public function removeChargeModel($chargeModel)
233 {
234 return $this->setChargeModels(
235 array_diff($this->getChargeModels(), array($chargeModel))
236 );
237 }
238
239 }
240