charitable
/
vendor
/
square
/
square
/
src
/
Legacy
/
Models
/
CheckoutMerchantSettingsPaymentMethods.php
CheckoutMerchantSettingsPaymentMethods.php in Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) 1.8.13, at vendor/square/square/src/Legacy/Models/CheckoutMerchantSettingsPaymentMethods.php
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace Square\Legacy\Models; |
| 6 | |
| 7 | use stdClass; |
| 8 | |
| 9 | class CheckoutMerchantSettingsPaymentMethods implements \JsonSerializable |
| 10 | { |
| 11 | /** |
| 12 | * @var CheckoutMerchantSettingsPaymentMethodsPaymentMethod|null |
| 13 | */ |
| 14 | private $applePay; |
| 15 | |
| 16 | /** |
| 17 | * @var CheckoutMerchantSettingsPaymentMethodsPaymentMethod|null |
| 18 | */ |
| 19 | private $googlePay; |
| 20 | |
| 21 | /** |
| 22 | * @var CheckoutMerchantSettingsPaymentMethodsPaymentMethod|null |
| 23 | */ |
| 24 | private $cashApp; |
| 25 | |
| 26 | /** |
| 27 | * @var CheckoutMerchantSettingsPaymentMethodsAfterpayClearpay|null |
| 28 | */ |
| 29 | private $afterpayClearpay; |
| 30 | |
| 31 | /** |
| 32 | * Returns Apple Pay. |
| 33 | * The settings allowed for a payment method. |
| 34 | */ |
| 35 | public function getApplePay(): ?CheckoutMerchantSettingsPaymentMethodsPaymentMethod |
| 36 | { |
| 37 | return $this->applePay; |
| 38 | } |
| 39 | |
| 40 | /** |
| 41 | * Sets Apple Pay. |
| 42 | * The settings allowed for a payment method. |
| 43 | * |
| 44 | * @maps apple_pay |
| 45 | */ |
| 46 | public function setApplePay(?CheckoutMerchantSettingsPaymentMethodsPaymentMethod $applePay): void |
| 47 | { |
| 48 | $this->applePay = $applePay; |
| 49 | } |
| 50 | |
| 51 | /** |
| 52 | * Returns Google Pay. |
| 53 | * The settings allowed for a payment method. |
| 54 | */ |
| 55 | public function getGooglePay(): ?CheckoutMerchantSettingsPaymentMethodsPaymentMethod |
| 56 | { |
| 57 | return $this->googlePay; |
| 58 | } |
| 59 | |
| 60 | /** |
| 61 | * Sets Google Pay. |
| 62 | * The settings allowed for a payment method. |
| 63 | * |
| 64 | * @maps google_pay |
| 65 | */ |
| 66 | public function setGooglePay(?CheckoutMerchantSettingsPaymentMethodsPaymentMethod $googlePay): void |
| 67 | { |
| 68 | $this->googlePay = $googlePay; |
| 69 | } |
| 70 | |
| 71 | /** |
| 72 | * Returns Cash App. |
| 73 | * The settings allowed for a payment method. |
| 74 | */ |
| 75 | public function getCashApp(): ?CheckoutMerchantSettingsPaymentMethodsPaymentMethod |
| 76 | { |
| 77 | return $this->cashApp; |
| 78 | } |
| 79 | |
| 80 | /** |
| 81 | * Sets Cash App. |
| 82 | * The settings allowed for a payment method. |
| 83 | * |
| 84 | * @maps cash_app |
| 85 | */ |
| 86 | public function setCashApp(?CheckoutMerchantSettingsPaymentMethodsPaymentMethod $cashApp): void |
| 87 | { |
| 88 | $this->cashApp = $cashApp; |
| 89 | } |
| 90 | |
| 91 | /** |
| 92 | * Returns Afterpay Clearpay. |
| 93 | * The settings allowed for AfterpayClearpay. |
| 94 | */ |
| 95 | public function getAfterpayClearpay(): ?CheckoutMerchantSettingsPaymentMethodsAfterpayClearpay |
| 96 | { |
| 97 | return $this->afterpayClearpay; |
| 98 | } |
| 99 | |
| 100 | /** |
| 101 | * Sets Afterpay Clearpay. |
| 102 | * The settings allowed for AfterpayClearpay. |
| 103 | * |
| 104 | * @maps afterpay_clearpay |
| 105 | */ |
| 106 | public function setAfterpayClearpay( |
| 107 | ?CheckoutMerchantSettingsPaymentMethodsAfterpayClearpay $afterpayClearpay |
| 108 | ): void { |
| 109 | $this->afterpayClearpay = $afterpayClearpay; |
| 110 | } |
| 111 | |
| 112 | /** |
| 113 | * Encode this object to JSON |
| 114 | * |
| 115 | * @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields |
| 116 | * are set. (default: false) |
| 117 | * |
| 118 | * @return array|stdClass |
| 119 | */ |
| 120 | #[\ReturnTypeWillChange] // @phan-suppress-current-line PhanUndeclaredClassAttribute for (php < 8.1) |
| 121 | public function jsonSerialize(bool $asArrayWhenEmpty = false) |
| 122 | { |
| 123 | $json = []; |
| 124 | if (isset($this->applePay)) { |
| 125 | $json['apple_pay'] = $this->applePay; |
| 126 | } |
| 127 | if (isset($this->googlePay)) { |
| 128 | $json['google_pay'] = $this->googlePay; |
| 129 | } |
| 130 | if (isset($this->cashApp)) { |
| 131 | $json['cash_app'] = $this->cashApp; |
| 132 | } |
| 133 | if (isset($this->afterpayClearpay)) { |
| 134 | $json['afterpay_clearpay'] = $this->afterpayClearpay; |
| 135 | } |
| 136 | $json = array_filter($json, function ($val) { |
| 137 | return $val !== null; |
| 138 | }); |
| 139 | |
| 140 | return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; |
| 141 | } |
| 142 | } |
| 143 |