Skip to content

Commit

Permalink
Added cvc_endpoint. #61
Browse files Browse the repository at this point in the history
  • Loading branch information
OGKevin committed Oct 25, 2017
1 parent 816f0fa commit ccacd9b
Show file tree
Hide file tree
Showing 9 changed files with 291 additions and 6 deletions.
17 changes: 17 additions & 0 deletions src/Model/Generated/Endpoint/BunqResponseCardGeneratedCvc2.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php
namespace bunq\Model\Generated\Endpoint;

use bunq\Http\BunqResponse;

/**
*/
class BunqResponseCardGeneratedCvc2 extends BunqResponse
{
/**
* @return CardGeneratedCvc2
*/
public function getValue(): CardGeneratedCvc2
{
return parent::getValue();
}
}
17 changes: 17 additions & 0 deletions src/Model/Generated/Endpoint/BunqResponseCardGeneratedCvc2List.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php
namespace bunq\Model\Generated\Endpoint;

use bunq\Http\BunqResponse;

/**
*/
class BunqResponseCardGeneratedCvc2List extends BunqResponse
{
/**
* @return CardGeneratedCvc2[]
*/
public function getValue(): array
{
return parent::getValue();
}
}
25 changes: 25 additions & 0 deletions src/Model/Generated/Endpoint/Card.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,13 @@ class Card 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
*
Expand Down Expand Up @@ -338,6 +345,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
*
Expand Down
25 changes: 25 additions & 0 deletions src/Model/Generated/Endpoint/CardDebit.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand Down Expand Up @@ -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
*
Expand Down
190 changes: 190 additions & 0 deletions src/Model/Generated/Endpoint/CardGeneratedCvc2.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,190 @@
<?php
namespace bunq\Model\Generated\Endpoint;

use bunq\Context\ApiContext;
use bunq\Http\ApiClient;
use bunq\Http\BunqResponse;
use bunq\Model\Core\BunqModel;

/**
* Endpoint for generating and retrieving a new CVC2 code.
*
* @generated
*/
class CardGeneratedCvc2 extends BunqModel
{
/**
* Endpoint constants.
*/
const ENDPOINT_URL_CREATE = 'user/%s/card/%s/generated-cvc2';
const ENDPOINT_URL_READ = 'user/%s/card/%s/generated-cvc2/%s';
const ENDPOINT_URL_LISTING = 'user/%s/card/%s/generated-cvc2';

/**
* Object type.
*/
const OBJECT_TYPE = 'CardGeneratedCvc2';

/**
* The cvc2 code.
*
* @var string
*/
protected $cvc2;

/**
* The status of the cvc2. Can be AVAILABLE, USED, EXPIRED, BLOCKED.
*
* @var string
*/
protected $status;

/**
* Expiry time of the cvc2.
*
* @var string
*/
protected $expiryTime;

/**
* Generate a new CVC2 code for a card.
*
* @param ApiContext $apiContext
* @param mixed[] $requestMap
* @param int $userId
* @param int $cardId
* @param string[] $customHeaders
*
* @return BunqResponseCardGeneratedCvc2
*/
public static function create(ApiContext $apiContext, array $requestMap, int $userId, int $cardId, array $customHeaders = []): BunqResponseCardGeneratedCvc2
{
$apiClient = new ApiClient($apiContext);
$apiClient->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;
}
}
11 changes: 8 additions & 3 deletions src/Model/Generated/Endpoint/CashRegister.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.<br/>With a CashRegister you can
* create a Tab and then use a QR code to receive payments.<br/>Check out
* our Quickstart example to learn how you can easily <a
* href="/api/1/page/usecase-tab-payment">create Tab
* payments</a>.<br/><br/>Notification filters can be set on a CashRegister
* to receive callbacks. For more information check the <a
* href="/api/1/page/callbacks">dedicated callbacks page</a>.
*
* @generated
*/
Expand Down
2 changes: 1 addition & 1 deletion src/Model/Generated/Endpoint/MonetaryAccountBank.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* that can be updated are the description, the daily limit and the avatar
* of the account.<br/><br/>Notification filters can be set on a monetary
* account level to receive callbacks. For more information check the <a
* href="/api/2/page/callbacks">dedicated callbacks page</a>.
* href="/api/1/page/callbacks">dedicated callbacks page</a>.
*
* @generated
*/
Expand Down
5 changes: 4 additions & 1 deletion src/Model/Generated/Endpoint/UserCompany.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.<br/><br/>Notification filters can
* be set on a UserCompany level to receive callbacks. For more information
* check the <a href="/api/1/page/callbacks">dedicated callbacks page</a>.
*
* @generated
*/
Expand Down
5 changes: 4 additions & 1 deletion src/Model/Generated/Endpoint/UserPerson.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.<br/><br/>Notification filters can
* be set on a UserPerson level to receive callbacks. For more information
* check the <a href="/api/1/page/callbacks">dedicated callbacks page</a>.
*
* @generated
*/
Expand Down

0 comments on commit ccacd9b

Please sign in to comment.