From ccacd9b1428e2145941bde655dcef75a2c5e031f Mon Sep 17 00:00:00 2001 From: Kevin Hellemun Date: Wed, 25 Oct 2017 15:34:55 +0200 Subject: [PATCH] Added cvc_endpoint. #61 --- .../BunqResponseCardGeneratedCvc2.php | 17 ++ .../BunqResponseCardGeneratedCvc2List.php | 17 ++ src/Model/Generated/Endpoint/Card.php | 25 +++ src/Model/Generated/Endpoint/CardDebit.php | 25 +++ .../Generated/Endpoint/CardGeneratedCvc2.php | 190 ++++++++++++++++++ src/Model/Generated/Endpoint/CashRegister.php | 11 +- .../Endpoint/MonetaryAccountBank.php | 2 +- src/Model/Generated/Endpoint/UserCompany.php | 5 +- src/Model/Generated/Endpoint/UserPerson.php | 5 +- 9 files changed, 291 insertions(+), 6 deletions(-) create mode 100644 src/Model/Generated/Endpoint/BunqResponseCardGeneratedCvc2.php create mode 100644 src/Model/Generated/Endpoint/BunqResponseCardGeneratedCvc2List.php create mode 100644 src/Model/Generated/Endpoint/CardGeneratedCvc2.php diff --git a/src/Model/Generated/Endpoint/BunqResponseCardGeneratedCvc2.php b/src/Model/Generated/Endpoint/BunqResponseCardGeneratedCvc2.php new file mode 100644 index 00000000..81e4463b --- /dev/null +++ b/src/Model/Generated/Endpoint/BunqResponseCardGeneratedCvc2.php @@ -0,0 +1,17 @@ +publicUuid = $publicUuid; } + /** + * The type of the card. Can be MAESTRO, MASTERCARD. + * + * @return string + */ + public function getType() + { + return $this->type; + } + + /** + * @param string $type + */ + public function setType($type) + { + $this->type = $type; + } + /** * The second line of text on the card * diff --git a/src/Model/Generated/Endpoint/CardDebit.php b/src/Model/Generated/Endpoint/CardDebit.php index e3132509..2d386753 100644 --- a/src/Model/Generated/Endpoint/CardDebit.php +++ b/src/Model/Generated/Endpoint/CardDebit.php @@ -69,6 +69,13 @@ class CardDebit extends BunqModel */ protected $publicUuid; + /** + * The type of the card. Can be MAESTRO, MASTERCARD. + * + * @var string + */ + protected $type; + /** * The second line of text on the card * @@ -266,6 +273,24 @@ public function setPublicUuid($publicUuid) $this->publicUuid = $publicUuid; } + /** + * The type of the card. Can be MAESTRO, MASTERCARD. + * + * @return string + */ + public function getType() + { + return $this->type; + } + + /** + * @param string $type + */ + public function setType($type) + { + $this->type = $type; + } + /** * The second line of text on the card * diff --git a/src/Model/Generated/Endpoint/CardGeneratedCvc2.php b/src/Model/Generated/Endpoint/CardGeneratedCvc2.php new file mode 100644 index 00000000..2b105a94 --- /dev/null +++ b/src/Model/Generated/Endpoint/CardGeneratedCvc2.php @@ -0,0 +1,190 @@ +enableEncryption(); + $responseRaw = $apiClient->post( + vsprintf( + self::ENDPOINT_URL_CREATE, + [$userId, $cardId] + ), + $requestMap, + $customHeaders + ); + + return BunqResponseCardGeneratedCvc2::castFromBunqResponse( + static::fromJson($responseRaw, self::OBJECT_TYPE) + ); + } + + /** + * Get the details for a specific generated CVC2 code. + * + * @param ApiContext $apiContext + * @param int $userId + * @param int $cardId + * @param int $cardGeneratedCvc2Id + * @param string[] $customHeaders + * + * @return BunqResponseCardGeneratedCvc2 + */ + public static function get(ApiContext $apiContext, int $userId, int $cardId, int $cardGeneratedCvc2Id, array $customHeaders = []): BunqResponseCardGeneratedCvc2 + { + $apiClient = new ApiClient($apiContext); + $responseRaw = $apiClient->get( + vsprintf( + self::ENDPOINT_URL_READ, + [$userId, $cardId, $cardGeneratedCvc2Id] + ), + [], + $customHeaders + ); + + return BunqResponseCardGeneratedCvc2::castFromBunqResponse( + static::fromJson($responseRaw, self::OBJECT_TYPE) + ); + } + + /** + * Get all generated CVC2 codes for a card. + * + * This method is called "listing" because "list" is a restricted PHP word + * and cannot be used as constants, class names, function or method names. + * + * @param ApiContext $apiContext + * @param int $userId + * @param int $cardId + * @param string[] $params + * @param string[] $customHeaders + * + * @return BunqResponseCardGeneratedCvc2List + */ + public static function listing(ApiContext $apiContext, int $userId, int $cardId, array $params = [], array $customHeaders = []): BunqResponseCardGeneratedCvc2List + { + $apiClient = new ApiClient($apiContext); + $responseRaw = $apiClient->get( + vsprintf( + self::ENDPOINT_URL_LISTING, + [$userId, $cardId] + ), + $params, + $customHeaders + ); + + return BunqResponseCardGeneratedCvc2List::castFromBunqResponse( + static::fromJsonList($responseRaw, self::OBJECT_TYPE) + ); + } + + /** + * The cvc2 code. + * + * @return string + */ + public function getCvc2() + { + return $this->cvc2; + } + + /** + * @param string $cvc2 + */ + public function setCvc2($cvc2) + { + $this->cvc2 = $cvc2; + } + + /** + * The status of the cvc2. Can be AVAILABLE, USED, EXPIRED, BLOCKED. + * + * @return string + */ + public function getStatus() + { + return $this->status; + } + + /** + * @param string $status + */ + public function setStatus($status) + { + $this->status = $status; + } + + /** + * Expiry time of the cvc2. + * + * @return string + */ + public function getExpiryTime() + { + return $this->expiryTime; + } + + /** + * @param string $expiryTime + */ + public function setExpiryTime($expiryTime) + { + $this->expiryTime = $expiryTime; + } +} diff --git a/src/Model/Generated/Endpoint/CashRegister.php b/src/Model/Generated/Endpoint/CashRegister.php index 89221253..d941f4ae 100644 --- a/src/Model/Generated/Endpoint/CashRegister.php +++ b/src/Model/Generated/Endpoint/CashRegister.php @@ -11,9 +11,14 @@ use bunq\Model\Generated\Object\TabTextWaitingScreen; /** - * CashRegisters act as an point of sale. They have a specific name and - * avatar, and optionally a location. A CashRegister is used to create Tabs. - * A CashRegister can have an QR code that links to one of its Tabs. + * CashRegisters are virtual points of sale. They have a specific name and + * avatar, and optionally, a location.
With a CashRegister you can + * create a Tab and then use a QR code to receive payments.
Check out + * our Quickstart example to learn how you can easily create Tab + * payments.

Notification filters can be set on a CashRegister + * to receive callbacks. For more information check the dedicated callbacks page. * * @generated */ diff --git a/src/Model/Generated/Endpoint/MonetaryAccountBank.php b/src/Model/Generated/Endpoint/MonetaryAccountBank.php index 5ae43c50..50acf88f 100644 --- a/src/Model/Generated/Endpoint/MonetaryAccountBank.php +++ b/src/Model/Generated/Endpoint/MonetaryAccountBank.php @@ -18,7 +18,7 @@ * that can be updated are the description, the daily limit and the avatar * of the account.

Notification filters can be set on a monetary * account level to receive callbacks. For more information check the dedicated callbacks page. + * href="/api/1/page/callbacks">dedicated callbacks page. * * @generated */ diff --git a/src/Model/Generated/Endpoint/UserCompany.php b/src/Model/Generated/Endpoint/UserCompany.php index 474b0114..456f7f7c 100644 --- a/src/Model/Generated/Endpoint/UserCompany.php +++ b/src/Model/Generated/Endpoint/UserCompany.php @@ -14,7 +14,10 @@ use bunq\Model\Generated\Object\Ubo; /** - * Show the authenticated user, if it is a company. + * With UserCompany you can retrieve information regarding the authenticated + * UserCompany and update specific fields.

Notification filters can + * be set on a UserCompany level to receive callbacks. For more information + * check the dedicated callbacks page. * * @generated */ diff --git a/src/Model/Generated/Endpoint/UserPerson.php b/src/Model/Generated/Endpoint/UserPerson.php index cd854a00..0a972e7f 100644 --- a/src/Model/Generated/Endpoint/UserPerson.php +++ b/src/Model/Generated/Endpoint/UserPerson.php @@ -13,7 +13,10 @@ use bunq\Model\Generated\Object\TaxResident; /** - * Show the authenticated user, if it is a person. + * With UserPerson you can retrieve information regarding the authenticated + * UserPerson and update specific fields.

Notification filters can + * be set on a UserPerson level to receive callbacks. For more information + * check the dedicated callbacks page. * * @generated */