PluginProbe
GiveWP – Donation Plugin and Fundraising Platform / 4.18.0
GiveWP – Donation Plugin and Fundraising Platform v4.18.0
4.18.0 4.17.0 4.16.9 4.16.8.1 4.16.8 4.16.7.2 4.16.7.1 4.16.7 4.16.6.1 4.16.6 4.16.5.1 4.16.5 4.16.4 4.16.3 4.16.2 4.16.1 4.16.0 4.15.5 4.15.4 4.15.3 4.15.2 4.15.1 4.15.0 2.3.0 2.3.1 All 257 releases
give / src / Framework / PaymentGateways / Commands / PaymentCommand.php

PaymentCommand.php in GiveWP – Donation Plugin and Fundraising Platform 4.18.0, at src/Framework/PaymentGateways/Commands/PaymentCommand.php

73 lines 1.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Give\Framework\PaymentGateways\Commands;
4
5 /***
6 * @since 2.18.0
7 */
8 abstract class PaymentCommand implements GatewayCommand
9 {
10 /**
11 * The Gateway Transaction / Charge Record ID
12 *
13 * @var string|null
14 */
15 public $gatewayTransactionId;
16
17 /**
18 * Notes to be added to the payment.
19 *
20 * @var array|string[]
21 */
22 public $paymentNotes = [];
23
24 /**
25 * @param string|null $gatewayTransactionId
26 *
27 * @return static
28 * @since 4.17.0 Declare the nullable parameter explicitly.
29 */
30 public static function make(?string $gatewayTransactionId = null): PaymentCommand
31 {
32 return new static($gatewayTransactionId);
33 }
34
35 /**
36 * @since 4.17.0 Declare the nullable parameter explicitly.
37 * @since 2.18.0
38 * @since 2.23.1 Make constructor final to avoid unsafe usage of `new static()`.
39 *
40 * @param string|null $gatewayTransactionId
41 */
42 final public function __construct(?string $gatewayTransactionId = null)
43 {
44 $this->gatewayTransactionId = $gatewayTransactionId;
45 }
46
47 /**
48 * @since 2.22.0 add type, so it is typesafe
49 *
50 * @param string|string[] ...$paymentNotes
51 *
52 * @return $this
53 */
54 public function setPaymentNotes(string ...$paymentNotes): PaymentCommand
55 {
56 $this->paymentNotes = $paymentNotes;
57
58 return $this;
59 }
60
61 /**
62 * @param string $gatewayTransactionId
63 *
64 * @return $this
65 */
66 public function setTransactionId(string $gatewayTransactionId): PaymentCommand
67 {
68 $this->gatewayTransactionId = $gatewayTransactionId;
69
70 return $this;
71 }
72 }
73