|
| 1 | +<?php |
| 2 | +namespace bunq\Model\Generated\Endpoint; |
| 3 | + |
| 4 | +use bunq\Context\ApiContext; |
| 5 | +use bunq\Http\ApiClient; |
| 6 | +use bunq\Http\BunqResponse; |
| 7 | +use bunq\Model\Core\BunqModel; |
| 8 | + |
| 9 | +/** |
| 10 | + * View for getting the dPAN of the card. |
| 11 | + * |
| 12 | + * @generated |
| 13 | + */ |
| 14 | +class CardDigitalPrimaryAccountNumber extends BunqModel |
| 15 | +{ |
| 16 | + /** |
| 17 | + * Endpoint constants. |
| 18 | + */ |
| 19 | + const ENDPOINT_URL_LISTING = 'user/%s/card/%s/digital-primary-account-number'; |
| 20 | + |
| 21 | + /** |
| 22 | + * Object type. |
| 23 | + */ |
| 24 | + const OBJECT_TYPE_GET = 'CardDigitalPrimaryAccountNumber'; |
| 25 | + |
| 26 | + /** |
| 27 | + * The digital PAN of the card. |
| 28 | + * |
| 29 | + * @var string |
| 30 | + */ |
| 31 | + protected $digitalPrimaryAccountNumber; |
| 32 | + |
| 33 | + /** |
| 34 | + * The expiry date. |
| 35 | + * |
| 36 | + * @var string |
| 37 | + */ |
| 38 | + protected $expiryDate; |
| 39 | + |
| 40 | + /** |
| 41 | + * The sequence number. |
| 42 | + * |
| 43 | + * @var string |
| 44 | + */ |
| 45 | + protected $sequenceNumber; |
| 46 | + |
| 47 | + /** |
| 48 | + * Unique reference given by MDES. |
| 49 | + * |
| 50 | + * @var string |
| 51 | + */ |
| 52 | + protected $tokenUniqueReference; |
| 53 | + |
| 54 | + /** |
| 55 | + * Status code of the token given by MDES. |
| 56 | + * |
| 57 | + * @var string |
| 58 | + */ |
| 59 | + protected $tokenStatusCode; |
| 60 | + |
| 61 | + /** |
| 62 | + * This method is called "listing" because "list" is a restricted PHP word |
| 63 | + * and cannot be used as constants, class names, function or method names. |
| 64 | + * |
| 65 | + * @param int $cardId |
| 66 | + * @param string[] $params |
| 67 | + * @param string[] $customHeaders |
| 68 | + * |
| 69 | + * @return BunqResponseCardDigitalPrimaryAccountNumberList |
| 70 | + */ |
| 71 | + public static function listing(int $cardId, array $params = [], array $customHeaders = []): BunqResponseCardDigitalPrimaryAccountNumberList |
| 72 | + { |
| 73 | + $apiClient = new ApiClient(static::getApiContext()); |
| 74 | + $responseRaw = $apiClient->get( |
| 75 | + vsprintf( |
| 76 | + self::ENDPOINT_URL_LISTING, |
| 77 | + [static::determineUserId(), $cardId] |
| 78 | + ), |
| 79 | + $params, |
| 80 | + $customHeaders |
| 81 | + ); |
| 82 | + |
| 83 | + return BunqResponseCardDigitalPrimaryAccountNumberList::castFromBunqResponse( |
| 84 | + static::fromJsonList($responseRaw, self::OBJECT_TYPE_GET) |
| 85 | + ); |
| 86 | + } |
| 87 | + |
| 88 | + /** |
| 89 | + * The digital PAN of the card. |
| 90 | + * |
| 91 | + * @return string |
| 92 | + */ |
| 93 | + public function getDigitalPrimaryAccountNumber() |
| 94 | + { |
| 95 | + return $this->digitalPrimaryAccountNumber; |
| 96 | + } |
| 97 | + |
| 98 | + /** |
| 99 | + * @deprecated User should not be able to set values via setters, use |
| 100 | + * constructor. |
| 101 | + * |
| 102 | + * @param string $digitalPrimaryAccountNumber |
| 103 | + */ |
| 104 | + public function setDigitalPrimaryAccountNumber($digitalPrimaryAccountNumber) |
| 105 | + { |
| 106 | + $this->digitalPrimaryAccountNumber = $digitalPrimaryAccountNumber; |
| 107 | + } |
| 108 | + |
| 109 | + /** |
| 110 | + * The expiry date. |
| 111 | + * |
| 112 | + * @return string |
| 113 | + */ |
| 114 | + public function getExpiryDate() |
| 115 | + { |
| 116 | + return $this->expiryDate; |
| 117 | + } |
| 118 | + |
| 119 | + /** |
| 120 | + * @deprecated User should not be able to set values via setters, use |
| 121 | + * constructor. |
| 122 | + * |
| 123 | + * @param string $expiryDate |
| 124 | + */ |
| 125 | + public function setExpiryDate($expiryDate) |
| 126 | + { |
| 127 | + $this->expiryDate = $expiryDate; |
| 128 | + } |
| 129 | + |
| 130 | + /** |
| 131 | + * The sequence number. |
| 132 | + * |
| 133 | + * @return string |
| 134 | + */ |
| 135 | + public function getSequenceNumber() |
| 136 | + { |
| 137 | + return $this->sequenceNumber; |
| 138 | + } |
| 139 | + |
| 140 | + /** |
| 141 | + * @deprecated User should not be able to set values via setters, use |
| 142 | + * constructor. |
| 143 | + * |
| 144 | + * @param string $sequenceNumber |
| 145 | + */ |
| 146 | + public function setSequenceNumber($sequenceNumber) |
| 147 | + { |
| 148 | + $this->sequenceNumber = $sequenceNumber; |
| 149 | + } |
| 150 | + |
| 151 | + /** |
| 152 | + * Unique reference given by MDES. |
| 153 | + * |
| 154 | + * @return string |
| 155 | + */ |
| 156 | + public function getTokenUniqueReference() |
| 157 | + { |
| 158 | + return $this->tokenUniqueReference; |
| 159 | + } |
| 160 | + |
| 161 | + /** |
| 162 | + * @deprecated User should not be able to set values via setters, use |
| 163 | + * constructor. |
| 164 | + * |
| 165 | + * @param string $tokenUniqueReference |
| 166 | + */ |
| 167 | + public function setTokenUniqueReference($tokenUniqueReference) |
| 168 | + { |
| 169 | + $this->tokenUniqueReference = $tokenUniqueReference; |
| 170 | + } |
| 171 | + |
| 172 | + /** |
| 173 | + * Status code of the token given by MDES. |
| 174 | + * |
| 175 | + * @return string |
| 176 | + */ |
| 177 | + public function getTokenStatusCode() |
| 178 | + { |
| 179 | + return $this->tokenStatusCode; |
| 180 | + } |
| 181 | + |
| 182 | + /** |
| 183 | + * @deprecated User should not be able to set values via setters, use |
| 184 | + * constructor. |
| 185 | + * |
| 186 | + * @param string $tokenStatusCode |
| 187 | + */ |
| 188 | + public function setTokenStatusCode($tokenStatusCode) |
| 189 | + { |
| 190 | + $this->tokenStatusCode = $tokenStatusCode; |
| 191 | + } |
| 192 | + |
| 193 | + /** |
| 194 | + * @return bool |
| 195 | + */ |
| 196 | + public function isAllFieldNull() |
| 197 | + { |
| 198 | + if (!is_null($this->digitalPrimaryAccountNumber)) { |
| 199 | + return false; |
| 200 | + } |
| 201 | + |
| 202 | + if (!is_null($this->expiryDate)) { |
| 203 | + return false; |
| 204 | + } |
| 205 | + |
| 206 | + if (!is_null($this->sequenceNumber)) { |
| 207 | + return false; |
| 208 | + } |
| 209 | + |
| 210 | + if (!is_null($this->tokenUniqueReference)) { |
| 211 | + return false; |
| 212 | + } |
| 213 | + |
| 214 | + if (!is_null($this->tokenStatusCode)) { |
| 215 | + return false; |
| 216 | + } |
| 217 | + |
| 218 | + return true; |
| 219 | + } |
| 220 | +} |
0 commit comments