1 <?php
2
3 namespace PayPal\Api;
4
5 use PayPal\Common\PayPalModel;
6 use PayPal\Validation\UrlValidator;
7
8 /**
9 * Class CurrencyConversion
10 *
11 * Object used to store the currency conversion rate.
12 *
13 * @package PayPal\Api
14 *
15 * @property string conversion_date
16 * @property string from_currency
17 * @property string from_amount
18 * @property string to_currency
19 * @property string to_amount
20 * @property string conversion_type
21 * @property bool conversion_type_changeable
22 * @property \PayPal\Api\Links[] links
23 */
24 class CurrencyConversion extends PayPalModel
25 {
26 /**
27 * Date of validity for the conversion rate.
28 *
29 * @param string $conversion_date
30 *
31 * @return $this
32 */
33 public function setConversionDate($conversion_date)
34 {
35 $this->conversion_date = $conversion_date;
36 return $this;
37 }
38
39 /**
40 * Date of validity for the conversion rate.
41 *
42 * @return string
43 */
44 public function getConversionDate()
45 {
46 return $this->conversion_date;
47 }
48
49 /**
50 * 3 letter currency code
51 *
52 * @param string $from_currency
53 *
54 * @return $this
55 */
56 public function setFromCurrency($from_currency)
57 {
58 $this->from_currency = $from_currency;
59 return $this;
60 }
61
62 /**
63 * 3 letter currency code
64 *
65 * @return string
66 */
67 public function getFromCurrency()
68 {
69 return $this->from_currency;
70 }
71
72 /**
73 * Amount participating in currency conversion, set to 1 as default
74 *
75 * @param string $from_amount
76 *
77 * @return $this
78 */
79 public function setFromAmount($from_amount)
80 {
81 $this->from_amount = $from_amount;
82 return $this;
83 }
84
85 /**
86 * Amount participating in currency conversion, set to 1 as default
87 *
88 * @return string
89 */
90 public function getFromAmount()
91 {
92 return $this->from_amount;
93 }
94
95 /**
96 * 3 letter currency code
97 *
98 * @param string $to_currency
99 *
100 * @return $this
101 */
102 public function setToCurrency($to_currency)
103 {
104 $this->to_currency = $to_currency;
105 return $this;
106 }
107
108 /**
109 * 3 letter currency code
110 *
111 * @return string
112 */
113 public function getToCurrency()
114 {
115 return $this->to_currency;
116 }
117
118 /**
119 * Amount resulting from currency conversion.
120 *
121 * @param string $to_amount
122 *
123 * @return $this
124 */
125 public function setToAmount($to_amount)
126 {
127 $this->to_amount = $to_amount;
128 return $this;
129 }
130
131 /**
132 * Amount resulting from currency conversion.
133 *
134 * @return string
135 */
136 public function getToAmount()
137 {
138 return $this->to_amount;
139 }
140
141 /**
142 * Field indicating conversion type applied.
143 * Valid Values: ["PAYPAL", "VENDOR"]
144 *
145 * @param string $conversion_type
146 *
147 * @return $this
148 */
149 public function setConversionType($conversion_type)
150 {
151 $this->conversion_type = $conversion_type;
152 return $this;
153 }
154
155 /**
156 * Field indicating conversion type applied.
157 *
158 * @return string
159 */
160 public function getConversionType()
161 {
162 return $this->conversion_type;
163 }
164
165 /**
166 * Allow Payer to change conversion type.
167 *
168 * @param bool $conversion_type_changeable
169 *
170 * @return $this
171 */
172 public function setConversionTypeChangeable($conversion_type_changeable)
173 {
174 $this->conversion_type_changeable = $conversion_type_changeable;
175 return $this;
176 }
177
178 /**
179 * Allow Payer to change conversion type.
180 *
181 * @return bool
182 */
183 public function getConversionTypeChangeable()
184 {
185 return $this->conversion_type_changeable;
186 }
187
188 /**
189 * Base URL to web applications endpoint
190 * Valid Values: ["https://www.paypal.com/{country_code}/webapps/xocspartaweb/webflow/sparta/proxwebflow", "https://www.paypal.com/{country_code}/proxflow"]
191 * @deprecated Not publicly available
192 * @param string $web_url
193 * @throws \InvalidArgumentException
194 * @return $this
195 */
196 public function setWebUrl($web_url)
197 {
198 UrlValidator::validate($web_url, "WebUrl");
199 $this->web_url = $web_url;
200 return $this;
201 }
202
203 /**
204 * Base URL to web applications endpoint
205 * @deprecated Not publicly available
206 * @return string
207 */
208 public function getWebUrl()
209 {
210 return $this->web_url;
211 }
212
213 /**
214 * Sets Links
215 *
216 * @param \PayPal\Api\Links[] $links
217 *
218 * @return $this
219 */
220 public function setLinks($links)
221 {
222 $this->links = $links;
223 return $this;
224 }
225
226 /**
227 * Gets Links
228 *
229 * @return \PayPal\Api\Links[]
230 */
231 public function getLinks()
232 {
233 return $this->links;
234 }
235
236 /**
237 * Append Links to the list.
238 *
239 * @param \PayPal\Api\Links $links
240 * @return $this
241 */
242 public function addLink($links)
243 {
244 if (!$this->getLinks()) {
245 return $this->setLinks(array($links));
246 } else {
247 return $this->setLinks(
248 array_merge($this->getLinks(), array($links))
249 );
250 }
251 }
252
253 /**
254 * Remove Links from the list.
255 *
256 * @param \PayPal\Api\Links $links
257 * @return $this
258 */
259 public function removeLink($links)
260 {
261 return $this->setLinks(
262 array_diff($this->getLinks(), array($links))
263 );
264 }
265
266 }
267