From ed0f4de191cc4f158f60dd01c7218ab111d7198d Mon Sep 17 00:00:00 2001 From: Spencer Hunter Date: Fri, 16 Apr 2021 13:33:27 -0500 Subject: [PATCH] 1.7.0 update (#49) --- README.md | 5 +++- lib/ApiClient.php | 2 +- lib/CustomersApi.php | 69 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 74 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 15d3112..a25f80d 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ Additionally, temporary PHP 7.4 support was added using these replaces: ## Version -1.6.0 +1.7.0 ## Installation @@ -166,6 +166,9 @@ Each model represents the different kinds of requests and responses that can be ## Changelog +1.7.0 +* New `getCustomerCardToken` method added to `CustomersAPI` for creating a card funding sources token for a customer. + 1.6.0 * New `TokenApi` adding support for application access token and client token requests. diff --git a/lib/ApiClient.php b/lib/ApiClient.php index c6c43ea..34c4673 100644 --- a/lib/ApiClient.php +++ b/lib/ApiClient.php @@ -35,7 +35,7 @@ class ApiClient { /* * @var string user agent of the HTTP request, set to "PHP-Swagger" by default */ - protected $user_agent = "php-swagger-1.6.0"; + protected $user_agent = "php-swagger-1.7.0"; /** * @param string $host Base url of the API server (optional) diff --git a/lib/CustomersApi.php b/lib/CustomersApi.php index 2f7902f..99c6f68 100644 --- a/lib/CustomersApi.php +++ b/lib/CustomersApi.php @@ -823,6 +823,75 @@ public function createFundingSourcesTokenForCustomer($id, $headers = null) { return $response[0] == 201 ? $response[1] : $this->apiClient->deserialize($response[1],'CustomerOAuthToken'); } + /** + * getCustomerCardToken + * + * Create a token that is capable of adding a debit card for the given customer. + * + * @param string $id ID of customer. (required) + * @return CustomerOAuthToken + */ + public function getCustomerCardToken($id, $headers = null) { + + // verify the required parameter 'id' is set + if ($id === null) { + throw new \InvalidArgumentException('Missing the required parameter $id when calling getCustomerCardToken'); + } + + + // parse inputs + $resourcePath = "/customers/{id}/card-funding-sources-token"; + $resourcePath = str_replace("{format}", "json", $resourcePath); + $method = "POST"; + $httpBody = ''; + $queryParams = array(); + $headerParams = array(); + $formParams = array(); + $_header_accept = $this->apiClient->selectHeaderAccept(array('application/vnd.dwolla.v1.hal+json')); + if (!is_null($_header_accept)) { + $headerParams['Accept'] = $_header_accept; + } + $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(array()); + + if (!is_null($headers)){ + $headerParams = array_merge($headerParams, $headers); + } + + + + // Entire URL for ID + if (filter_var($id, FILTER_VALIDATE_URL)) { + $split = explode('/', $id); + $id = end($split); + } + // path params + if($id !== null) { + $resourcePath = str_replace("{" . "id" . "}", + $this->apiClient->toPathValue($id), $resourcePath); + } + + + + // for model (json/xml) + if (isset($_tempBody)) { + $httpBody = $_tempBody; // $_tempBody is the method argument, if present + } else if (count($formParams) > 0) { + // for HTTP post (form) + $httpBody = $formParams; + } + + // make the API Call + $response = $this->apiClient->callAPI($resourcePath, $method, + $queryParams, $httpBody, + $headerParams, $this->authSettings); + + if(!$response[1]) { + return null; + } + + return $response[0] == 201 ? $response[1] : $this->apiClient->deserialize($response[1],'CustomerOAuthToken'); +} + /** * getCustomerIavToken *