1: <?php
2: namespace Hyperwallet\Model;
3:
4: /**
5: * Represents a V4 Payment
6: *
7: * @property string $token The payment token
8: * @property string $status The status
9: * @property \DateTime $createdOn The payment creation date
10: *
11: * @property string $clientPaymentId The client payment id
12: * @property string $amount The payment amount
13: * @property string $currency The payment currency
14: *
15: * @property string $description The payment description
16: * @property string $notes The payment notes
17: * @property string $memo The payment memo
18: * @property string $purpose The payment purpose
19: * @property \DateTime $releaseOn The payment release date
20: * @property \DateTime $expiresOn The payment expiry date
21: *
22: * @property string $destinationToken The payment destination token
23: * @property string $programToken The payment program token
24: *
25: * @package Hyperwallet\Model
26: */
27: class Payment extends BaseModel implements IProgramAware {
28:
29: /**
30: * @internal
31: *
32: * Read only fields
33: *
34: * @var string[]
35: */
36: private static $READ_ONLY_FIELDS = array('token', 'createdOn');
37:
38: public static function FILTERS_ARRAY() {
39: return array('clientPaymentId', 'releaseDate', 'createdBefore', 'createdAfter', 'sortBy', 'limit');
40: }
41:
42: /**
43: * Creates a instance of Payment
44: *
45: * @param string[] $properties The default properties
46: */
47: public function __construct(array $properties = array()) {
48: parent::__construct(self::$READ_ONLY_FIELDS, $properties);
49: }
50:
51: /**
52: * Get the payment token
53: *
54: * @return string
55: */
56: public function getToken() {
57: return $this->token;
58: }
59:
60: /**
61: * Set the payment token
62: *
63: * @param string $token
64: * @return Payment
65: */
66: public function setToken($token) {
67: $this->token = $token;
68: return $this;
69: }
70:
71: /**
72: * Get the status
73: *
74: * @return string
75: */
76: public function getStatus() {
77: return $this->status;
78: }
79:
80: /**
81: * Set the status
82: *
83: * @param string $status
84: * @return Payment
85: */
86: public function setStatus($status) {
87: $this->status = $status;
88: return $this;
89: }
90:
91: /**
92: * Get the payment creation date
93: *
94: * @return \DateTime
95: */
96: public function getCreatedOn() {
97: return $this->createdOn ? new \DateTime($this->createdOn) : null;
98: }
99:
100: /**
101: * Get the client payment id
102: *
103: * @return string
104: */
105: public function getClientPaymentId() {
106: return $this->clientPaymentId;
107: }
108:
109: /**
110: * Set the client payment id
111: *
112: * @param string $clientPaymentId
113: * @return Payment
114: */
115: public function setClientPaymentId($clientPaymentId) {
116: $this->clientPaymentId = $clientPaymentId;
117: return $this;
118: }
119:
120: /**
121: * Get the payment amount
122: *
123: * @return string
124: */
125: public function getAmount() {
126: return $this->amount;
127: }
128:
129: /**
130: * Set the payment amount
131: *
132: * @param string $amount
133: * @return Payment
134: */
135: public function setAmount($amount) {
136: $this->amount = $amount;
137: return $this;
138: }
139:
140: /**
141: * Get the payment currency
142: *
143: * @return string
144: */
145: public function getCurrency() {
146: return $this->currency;
147: }
148:
149: /**
150: * Set the payment currency
151: *
152: * @param string $currency
153: * @return Payment
154: */
155: public function setCurrency($currency) {
156: $this->currency = $currency;
157: return $this;
158: }
159:
160: /**
161: * Retrieves the legacy payment description.
162: *
163: * @deprecated Use getNotes() instead.
164: * @return string
165: */
166: public function getDescription() {
167: return $this->notes;
168: }
169:
170: /**
171: * Set the payment description
172:
173: * @deprecated Use setNotes(string $notes) instead.
174: * @param string $description
175: * @return Payment
176: */
177: public function setDescription($description) {
178: $this->notes = $description;
179: return $this;
180: }
181:
182: /**
183: * Get the payment notes
184: *
185: * @return string
186: */
187: public function getNotes() {
188: return $this->notes;
189: }
190:
191: /**
192: * Set the payment notes
193: *
194: * @param string $notes
195: * @return notes
196: */
197: public function setNotes($notes) {
198: $this->notes = $notes;
199: return $this;
200: }
201:
202: /**
203: * Get the payment memo
204: *
205: * @return string
206: */
207: public function getMemo() {
208: return $this->memo;
209: }
210:
211: /**
212: * Set the payment memo
213: *
214: * @param string $memo
215: * @return Payment
216: */
217: public function setMemo($memo) {
218: $this->memo = $memo;
219: return $this;
220: }
221:
222: /**
223: * Get the payment purpose
224: *
225: * @return string
226: */
227: public function getPurpose() {
228: return $this->purpose;
229: }
230:
231: /**
232: * Set the paymeny purpose
233: *
234: * @param string $purpose
235: * @return Payment
236: */
237: public function setPurpose($purpose) {
238: $this->purpose = $purpose;
239: return $this;
240: }
241:
242: /**
243: * Get the payment release date
244: * @return \DateTime
245: */
246: public function getReleaseOn() {
247: return $this->releaseOn ? new \DateTime($this->releaseOn) : null;
248: }
249:
250: /**
251: * Set the payment release date
252: *
253: * @param \DateTime $releaseOn
254: * @return Payment
255: */
256: public function setReleaseOn(\DateTime $releaseOn = null) {
257: $this->releaseOn = $releaseOn == null ? null : $releaseOn->format('Y-m-d\TH:i:s');
258: return $this;
259: }
260:
261: /**
262: * Get the payment expiry date
263: * @return \DateTime
264: */
265: public function getExpiresOn() {
266: return $this->expiresOn ? new \DateTime($this->expiresOn) : null;
267: }
268:
269: /**
270: * Set the payment expiry date
271: *
272: * @param \DateTime $expiresOn
273: * @return Payment
274: */
275: public function setExpiresOn(\DateTime $expiresOn = null) {
276: $this->expiresOn = $expiresOn == null ? null : $expiresOn->format('Y-m-d\TH:i:s');
277: return $this;
278: }
279:
280: /**
281: * Get the payment destination token
282: *
283: * @return string
284: */
285: public function getDestinationToken() {
286: return $this->destinationToken;
287: }
288:
289: /**
290: * Set the payment destination token
291: *
292: * @param string $destinationToken
293: * @return Payment
294: */
295: public function setDestinationToken($destinationToken) {
296: $this->destinationToken = $destinationToken;
297: return $this;
298: }
299:
300: /**
301: * Get the payment program token
302: *
303: * @return string
304: */
305: public function getProgramToken() {
306: return $this->programToken;
307: }
308:
309: /**
310: * Set the payment program token
311: *
312: * @param string $programToken
313: * @return Payment
314: */
315: public function setProgramToken($programToken) {
316: $this->programToken = $programToken;
317: return $this;
318: }
319:
320: }
321: