PluginProbe
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) / 1.8.13
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) v1.8.13
1.8.13 1.8.12.3 1.8.12.2 1.8.12.1 1.8.12 1.8.11.3 1.8.11.2 1.8.11.1 1.8.11 1.6.6 1.6.60 1.6.7 1.6.8 1.6.9 1.7.0 1.7.0.1 1.7.0.11 1.7.0.12 1.7.0.14 1.7.0.2 1.7.0.3 1.7.0.5 1.7.0.6 1.7.0.7 1.7.0.9 All 211 releases
charitable / vendor / square / square / src / Legacy / Models / CardPaymentDetails.php

CardPaymentDetails.php in Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) 1.8.13, at vendor/square/square/src/Legacy/Models/CardPaymentDetails.php

676 lines 18.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 declare(strict_types=1);
4
5 namespace Square\Legacy\Models;
6
7 use stdClass;
8
9 /**
10 * Reflects the current status of a card payment. Contains only non-confidential information.
11 */
12 class CardPaymentDetails implements \JsonSerializable
13 {
14 /**
15 * @var array
16 */
17 private $status = [];
18
19 /**
20 * @var Card|null
21 */
22 private $card;
23
24 /**
25 * @var array
26 */
27 private $entryMethod = [];
28
29 /**
30 * @var array
31 */
32 private $cvvStatus = [];
33
34 /**
35 * @var array
36 */
37 private $avsStatus = [];
38
39 /**
40 * @var array
41 */
42 private $authResultCode = [];
43
44 /**
45 * @var array
46 */
47 private $applicationIdentifier = [];
48
49 /**
50 * @var array
51 */
52 private $applicationName = [];
53
54 /**
55 * @var array
56 */
57 private $applicationCryptogram = [];
58
59 /**
60 * @var array
61 */
62 private $verificationMethod = [];
63
64 /**
65 * @var array
66 */
67 private $verificationResults = [];
68
69 /**
70 * @var array
71 */
72 private $statementDescription = [];
73
74 /**
75 * @var DeviceDetails|null
76 */
77 private $deviceDetails;
78
79 /**
80 * @var CardPaymentTimeline|null
81 */
82 private $cardPaymentTimeline;
83
84 /**
85 * @var array
86 */
87 private $refundRequiresCardPresence = [];
88
89 /**
90 * @var array
91 */
92 private $errors = [];
93
94 /**
95 * Returns Status.
96 * The card payment's current state. The state can be AUTHORIZED, CAPTURED, VOIDED, or
97 * FAILED.
98 */
99 public function getStatus(): ?string
100 {
101 if (count($this->status) == 0) {
102 return null;
103 }
104 return $this->status['value'];
105 }
106
107 /**
108 * Sets Status.
109 * The card payment's current state. The state can be AUTHORIZED, CAPTURED, VOIDED, or
110 * FAILED.
111 *
112 * @maps status
113 */
114 public function setStatus(?string $status): void
115 {
116 $this->status['value'] = $status;
117 }
118
119 /**
120 * Unsets Status.
121 * The card payment's current state. The state can be AUTHORIZED, CAPTURED, VOIDED, or
122 * FAILED.
123 */
124 public function unsetStatus(): void
125 {
126 $this->status = [];
127 }
128
129 /**
130 * Returns Card.
131 * Represents the payment details of a card to be used for payments. These
132 * details are determined by the payment token generated by Web Payments SDK.
133 */
134 public function getCard(): ?Card
135 {
136 return $this->card;
137 }
138
139 /**
140 * Sets Card.
141 * Represents the payment details of a card to be used for payments. These
142 * details are determined by the payment token generated by Web Payments SDK.
143 *
144 * @maps card
145 */
146 public function setCard(?Card $card): void
147 {
148 $this->card = $card;
149 }
150
151 /**
152 * Returns Entry Method.
153 * The method used to enter the card's details for the payment. The method can be
154 * `KEYED`, `SWIPED`, `EMV`, `ON_FILE`, or `CONTACTLESS`.
155 */
156 public function getEntryMethod(): ?string
157 {
158 if (count($this->entryMethod) == 0) {
159 return null;
160 }
161 return $this->entryMethod['value'];
162 }
163
164 /**
165 * Sets Entry Method.
166 * The method used to enter the card's details for the payment. The method can be
167 * `KEYED`, `SWIPED`, `EMV`, `ON_FILE`, or `CONTACTLESS`.
168 *
169 * @maps entry_method
170 */
171 public function setEntryMethod(?string $entryMethod): void
172 {
173 $this->entryMethod['value'] = $entryMethod;
174 }
175
176 /**
177 * Unsets Entry Method.
178 * The method used to enter the card's details for the payment. The method can be
179 * `KEYED`, `SWIPED`, `EMV`, `ON_FILE`, or `CONTACTLESS`.
180 */
181 public function unsetEntryMethod(): void
182 {
183 $this->entryMethod = [];
184 }
185
186 /**
187 * Returns Cvv Status.
188 * The status code returned from the Card Verification Value (CVV) check. The code can be
189 * `CVV_ACCEPTED`, `CVV_REJECTED`, or `CVV_NOT_CHECKED`.
190 */
191 public function getCvvStatus(): ?string
192 {
193 if (count($this->cvvStatus) == 0) {
194 return null;
195 }
196 return $this->cvvStatus['value'];
197 }
198
199 /**
200 * Sets Cvv Status.
201 * The status code returned from the Card Verification Value (CVV) check. The code can be
202 * `CVV_ACCEPTED`, `CVV_REJECTED`, or `CVV_NOT_CHECKED`.
203 *
204 * @maps cvv_status
205 */
206 public function setCvvStatus(?string $cvvStatus): void
207 {
208 $this->cvvStatus['value'] = $cvvStatus;
209 }
210
211 /**
212 * Unsets Cvv Status.
213 * The status code returned from the Card Verification Value (CVV) check. The code can be
214 * `CVV_ACCEPTED`, `CVV_REJECTED`, or `CVV_NOT_CHECKED`.
215 */
216 public function unsetCvvStatus(): void
217 {
218 $this->cvvStatus = [];
219 }
220
221 /**
222 * Returns Avs Status.
223 * The status code returned from the Address Verification System (AVS) check. The code can be
224 * `AVS_ACCEPTED`, `AVS_REJECTED`, or `AVS_NOT_CHECKED`.
225 */
226 public function getAvsStatus(): ?string
227 {
228 if (count($this->avsStatus) == 0) {
229 return null;
230 }
231 return $this->avsStatus['value'];
232 }
233
234 /**
235 * Sets Avs Status.
236 * The status code returned from the Address Verification System (AVS) check. The code can be
237 * `AVS_ACCEPTED`, `AVS_REJECTED`, or `AVS_NOT_CHECKED`.
238 *
239 * @maps avs_status
240 */
241 public function setAvsStatus(?string $avsStatus): void
242 {
243 $this->avsStatus['value'] = $avsStatus;
244 }
245
246 /**
247 * Unsets Avs Status.
248 * The status code returned from the Address Verification System (AVS) check. The code can be
249 * `AVS_ACCEPTED`, `AVS_REJECTED`, or `AVS_NOT_CHECKED`.
250 */
251 public function unsetAvsStatus(): void
252 {
253 $this->avsStatus = [];
254 }
255
256 /**
257 * Returns Auth Result Code.
258 * The status code returned by the card issuer that describes the payment's
259 * authorization status.
260 */
261 public function getAuthResultCode(): ?string
262 {
263 if (count($this->authResultCode) == 0) {
264 return null;
265 }
266 return $this->authResultCode['value'];
267 }
268
269 /**
270 * Sets Auth Result Code.
271 * The status code returned by the card issuer that describes the payment's
272 * authorization status.
273 *
274 * @maps auth_result_code
275 */
276 public function setAuthResultCode(?string $authResultCode): void
277 {
278 $this->authResultCode['value'] = $authResultCode;
279 }
280
281 /**
282 * Unsets Auth Result Code.
283 * The status code returned by the card issuer that describes the payment's
284 * authorization status.
285 */
286 public function unsetAuthResultCode(): void
287 {
288 $this->authResultCode = [];
289 }
290
291 /**
292 * Returns Application Identifier.
293 * For EMV payments, the application ID identifies the EMV application used for the payment.
294 */
295 public function getApplicationIdentifier(): ?string
296 {
297 if (count($this->applicationIdentifier) == 0) {
298 return null;
299 }
300 return $this->applicationIdentifier['value'];
301 }
302
303 /**
304 * Sets Application Identifier.
305 * For EMV payments, the application ID identifies the EMV application used for the payment.
306 *
307 * @maps application_identifier
308 */
309 public function setApplicationIdentifier(?string $applicationIdentifier): void
310 {
311 $this->applicationIdentifier['value'] = $applicationIdentifier;
312 }
313
314 /**
315 * Unsets Application Identifier.
316 * For EMV payments, the application ID identifies the EMV application used for the payment.
317 */
318 public function unsetApplicationIdentifier(): void
319 {
320 $this->applicationIdentifier = [];
321 }
322
323 /**
324 * Returns Application Name.
325 * For EMV payments, the human-readable name of the EMV application used for the payment.
326 */
327 public function getApplicationName(): ?string
328 {
329 if (count($this->applicationName) == 0) {
330 return null;
331 }
332 return $this->applicationName['value'];
333 }
334
335 /**
336 * Sets Application Name.
337 * For EMV payments, the human-readable name of the EMV application used for the payment.
338 *
339 * @maps application_name
340 */
341 public function setApplicationName(?string $applicationName): void
342 {
343 $this->applicationName['value'] = $applicationName;
344 }
345
346 /**
347 * Unsets Application Name.
348 * For EMV payments, the human-readable name of the EMV application used for the payment.
349 */
350 public function unsetApplicationName(): void
351 {
352 $this->applicationName = [];
353 }
354
355 /**
356 * Returns Application Cryptogram.
357 * For EMV payments, the cryptogram generated for the payment.
358 */
359 public function getApplicationCryptogram(): ?string
360 {
361 if (count($this->applicationCryptogram) == 0) {
362 return null;
363 }
364 return $this->applicationCryptogram['value'];
365 }
366
367 /**
368 * Sets Application Cryptogram.
369 * For EMV payments, the cryptogram generated for the payment.
370 *
371 * @maps application_cryptogram
372 */
373 public function setApplicationCryptogram(?string $applicationCryptogram): void
374 {
375 $this->applicationCryptogram['value'] = $applicationCryptogram;
376 }
377
378 /**
379 * Unsets Application Cryptogram.
380 * For EMV payments, the cryptogram generated for the payment.
381 */
382 public function unsetApplicationCryptogram(): void
383 {
384 $this->applicationCryptogram = [];
385 }
386
387 /**
388 * Returns Verification Method.
389 * For EMV payments, the method used to verify the cardholder's identity. The method can be
390 * `PIN`, `SIGNATURE`, `PIN_AND_SIGNATURE`, `ON_DEVICE`, or `NONE`.
391 */
392 public function getVerificationMethod(): ?string
393 {
394 if (count($this->verificationMethod) == 0) {
395 return null;
396 }
397 return $this->verificationMethod['value'];
398 }
399
400 /**
401 * Sets Verification Method.
402 * For EMV payments, the method used to verify the cardholder's identity. The method can be
403 * `PIN`, `SIGNATURE`, `PIN_AND_SIGNATURE`, `ON_DEVICE`, or `NONE`.
404 *
405 * @maps verification_method
406 */
407 public function setVerificationMethod(?string $verificationMethod): void
408 {
409 $this->verificationMethod['value'] = $verificationMethod;
410 }
411
412 /**
413 * Unsets Verification Method.
414 * For EMV payments, the method used to verify the cardholder's identity. The method can be
415 * `PIN`, `SIGNATURE`, `PIN_AND_SIGNATURE`, `ON_DEVICE`, or `NONE`.
416 */
417 public function unsetVerificationMethod(): void
418 {
419 $this->verificationMethod = [];
420 }
421
422 /**
423 * Returns Verification Results.
424 * For EMV payments, the results of the cardholder verification. The result can be
425 * `SUCCESS`, `FAILURE`, or `UNKNOWN`.
426 */
427 public function getVerificationResults(): ?string
428 {
429 if (count($this->verificationResults) == 0) {
430 return null;
431 }
432 return $this->verificationResults['value'];
433 }
434
435 /**
436 * Sets Verification Results.
437 * For EMV payments, the results of the cardholder verification. The result can be
438 * `SUCCESS`, `FAILURE`, or `UNKNOWN`.
439 *
440 * @maps verification_results
441 */
442 public function setVerificationResults(?string $verificationResults): void
443 {
444 $this->verificationResults['value'] = $verificationResults;
445 }
446
447 /**
448 * Unsets Verification Results.
449 * For EMV payments, the results of the cardholder verification. The result can be
450 * `SUCCESS`, `FAILURE`, or `UNKNOWN`.
451 */
452 public function unsetVerificationResults(): void
453 {
454 $this->verificationResults = [];
455 }
456
457 /**
458 * Returns Statement Description.
459 * The statement description sent to the card networks.
460 *
461 * Note: The actual statement description varies and is likely to be truncated and appended with
462 * additional information on a per issuer basis.
463 */
464 public function getStatementDescription(): ?string
465 {
466 if (count($this->statementDescription) == 0) {
467 return null;
468 }
469 return $this->statementDescription['value'];
470 }
471
472 /**
473 * Sets Statement Description.
474 * The statement description sent to the card networks.
475 *
476 * Note: The actual statement description varies and is likely to be truncated and appended with
477 * additional information on a per issuer basis.
478 *
479 * @maps statement_description
480 */
481 public function setStatementDescription(?string $statementDescription): void
482 {
483 $this->statementDescription['value'] = $statementDescription;
484 }
485
486 /**
487 * Unsets Statement Description.
488 * The statement description sent to the card networks.
489 *
490 * Note: The actual statement description varies and is likely to be truncated and appended with
491 * additional information on a per issuer basis.
492 */
493 public function unsetStatementDescription(): void
494 {
495 $this->statementDescription = [];
496 }
497
498 /**
499 * Returns Device Details.
500 * Details about the device that took the payment.
501 */
502 public function getDeviceDetails(): ?DeviceDetails
503 {
504 return $this->deviceDetails;
505 }
506
507 /**
508 * Sets Device Details.
509 * Details about the device that took the payment.
510 *
511 * @maps device_details
512 */
513 public function setDeviceDetails(?DeviceDetails $deviceDetails): void
514 {
515 $this->deviceDetails = $deviceDetails;
516 }
517
518 /**
519 * Returns Card Payment Timeline.
520 * The timeline for card payments.
521 */
522 public function getCardPaymentTimeline(): ?CardPaymentTimeline
523 {
524 return $this->cardPaymentTimeline;
525 }
526
527 /**
528 * Sets Card Payment Timeline.
529 * The timeline for card payments.
530 *
531 * @maps card_payment_timeline
532 */
533 public function setCardPaymentTimeline(?CardPaymentTimeline $cardPaymentTimeline): void
534 {
535 $this->cardPaymentTimeline = $cardPaymentTimeline;
536 }
537
538 /**
539 * Returns Refund Requires Card Presence.
540 * Whether the card must be physically present for the payment to
541 * be refunded. If set to `true`, the card must be present.
542 */
543 public function getRefundRequiresCardPresence(): ?bool
544 {
545 if (count($this->refundRequiresCardPresence) == 0) {
546 return null;
547 }
548 return $this->refundRequiresCardPresence['value'];
549 }
550
551 /**
552 * Sets Refund Requires Card Presence.
553 * Whether the card must be physically present for the payment to
554 * be refunded. If set to `true`, the card must be present.
555 *
556 * @maps refund_requires_card_presence
557 */
558 public function setRefundRequiresCardPresence(?bool $refundRequiresCardPresence): void
559 {
560 $this->refundRequiresCardPresence['value'] = $refundRequiresCardPresence;
561 }
562
563 /**
564 * Unsets Refund Requires Card Presence.
565 * Whether the card must be physically present for the payment to
566 * be refunded. If set to `true`, the card must be present.
567 */
568 public function unsetRefundRequiresCardPresence(): void
569 {
570 $this->refundRequiresCardPresence = [];
571 }
572
573 /**
574 * Returns Errors.
575 * Information about errors encountered during the request.
576 *
577 * @return Error[]|null
578 */
579 public function getErrors(): ?array
580 {
581 if (count($this->errors) == 0) {
582 return null;
583 }
584 return $this->errors['value'];
585 }
586
587 /**
588 * Sets Errors.
589 * Information about errors encountered during the request.
590 *
591 * @maps errors
592 *
593 * @param Error[]|null $errors
594 */
595 public function setErrors(?array $errors): void
596 {
597 $this->errors['value'] = $errors;
598 }
599
600 /**
601 * Unsets Errors.
602 * Information about errors encountered during the request.
603 */
604 public function unsetErrors(): void
605 {
606 $this->errors = [];
607 }
608
609 /**
610 * Encode this object to JSON
611 *
612 * @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields
613 * are set. (default: false)
614 *
615 * @return array|stdClass
616 */
617 #[\ReturnTypeWillChange] // @phan-suppress-current-line PhanUndeclaredClassAttribute for (php < 8.1)
618 public function jsonSerialize(bool $asArrayWhenEmpty = false)
619 {
620 $json = [];
621 if (!empty($this->status)) {
622 $json['status'] = $this->status['value'];
623 }
624 if (isset($this->card)) {
625 $json['card'] = $this->card;
626 }
627 if (!empty($this->entryMethod)) {
628 $json['entry_method'] = $this->entryMethod['value'];
629 }
630 if (!empty($this->cvvStatus)) {
631 $json['cvv_status'] = $this->cvvStatus['value'];
632 }
633 if (!empty($this->avsStatus)) {
634 $json['avs_status'] = $this->avsStatus['value'];
635 }
636 if (!empty($this->authResultCode)) {
637 $json['auth_result_code'] = $this->authResultCode['value'];
638 }
639 if (!empty($this->applicationIdentifier)) {
640 $json['application_identifier'] = $this->applicationIdentifier['value'];
641 }
642 if (!empty($this->applicationName)) {
643 $json['application_name'] = $this->applicationName['value'];
644 }
645 if (!empty($this->applicationCryptogram)) {
646 $json['application_cryptogram'] = $this->applicationCryptogram['value'];
647 }
648 if (!empty($this->verificationMethod)) {
649 $json['verification_method'] = $this->verificationMethod['value'];
650 }
651 if (!empty($this->verificationResults)) {
652 $json['verification_results'] = $this->verificationResults['value'];
653 }
654 if (!empty($this->statementDescription)) {
655 $json['statement_description'] = $this->statementDescription['value'];
656 }
657 if (isset($this->deviceDetails)) {
658 $json['device_details'] = $this->deviceDetails;
659 }
660 if (isset($this->cardPaymentTimeline)) {
661 $json['card_payment_timeline'] = $this->cardPaymentTimeline;
662 }
663 if (!empty($this->refundRequiresCardPresence)) {
664 $json['refund_requires_card_presence'] = $this->refundRequiresCardPresence['value'];
665 }
666 if (!empty($this->errors)) {
667 $json['errors'] = $this->errors['value'];
668 }
669 $json = array_filter($json, function ($val) {
670 return $val !== null;
671 });
672
673 return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json;
674 }
675 }
676