Skip to content

Commit

Permalink
Merge pull request #39 from Dwolla/1.2.0
Browse files Browse the repository at this point in the history
1.2.0 update
  • Loading branch information
ShreyaThapa authored Oct 14, 2019
2 parents 37d5e7e + d32c3c5 commit 30149f9
Show file tree
Hide file tree
Showing 11 changed files with 686 additions and 16 deletions.
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ The new Dwolla API V2 SDK, as generated by [this fork of swagger-codegen](https:

## Version

1.1.0
1.2.0

## Installation

Expand Down Expand Up @@ -91,6 +91,7 @@ Each API module is named in accordance to ([Dwolla's API Spec](http://docsv2.dwo
* `DocumentsApi`
* `EventsApi`
* `FundingsourcesApi`
* `KbaApi`
* `LabelsApi`
* `LabelreallocationsApi`
* `LedgerentriesApi`
Expand Down Expand Up @@ -154,6 +155,12 @@ Each model represents the different kinds of requests and responses that can be

## Changelog

1.2.0
* API schema updated, `CustomersApi` updated to support KBA related endpoint.
* New `KbaApi`.
* Existing `Document` model updated.
* New `AnswerKbaQuestionsRequest`, `AnswerKbaQuestionsResponse`, `AnsweredKbaQuestion`, `KbaQuestion.php`, `KbaAnswer` models.

1.1.0
* API schema updated, `CustomersApi` updated to support Labels related endpoints.
* New `LabelsApi`, `LabelreallocationsApi`, and `LedgerentriesApi`.
Expand Down
26 changes: 13 additions & 13 deletions lib/ApiClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class ApiClient {
public static $GET = "GET";
public static $PUT = "PUT";
public static $DELETE = "DELETE";

private static $default_header = array();

/*
Expand All @@ -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.1.0";
protected $user_agent = "php-swagger-1.2.0";

/**
* @param string $host Base url of the API server (optional)
Expand All @@ -49,20 +49,20 @@ function __construct($host = null) {
}

/**
* add default header
* add default header
*
* @param string $header_name header name (e.g. Token)
* @param string $header_value header value (e.g. 1z8wp3)
*/
public function addDefaultHeader($header_name, $header_value) {
if (!is_string($header_name))
if (!is_string($header_name))
throw new \InvalidArgumentException('Header name must be a string.');

self::$default_header[$header_name] = $header_value;
}

/**
* get the default header
* get the default header
*
* @return array default header
*/
Expand Down Expand Up @@ -129,7 +129,7 @@ public function setUserAgent($user_agent) {

/**
* get the user agent of the api client
*
*
* @return string user agent
*/
public function getUserAgent($user_agent) {
Expand Down Expand Up @@ -175,7 +175,7 @@ public function getApiKeyWithPrefix($apiKey) {

/**
* update hearder and query param based on authentication setting
*
*
* @param array $headerParams header parameters (by ref)
* @param array $queryParams query parameters (by ref)
* @param array $authSettings array of authentication scheme (e.g ['api_key'])
Expand All @@ -189,18 +189,18 @@ public function updateParamsForAuth(&$headerParams, &$queryParams, $authSettings
foreach($authSettings as $auth) {
// determine which one to use
switch($auth) {

case 'oauth2':
$headerParams['Authorization'] = 'Bearer ' . Configuration::$access_token;

$headerParams['Authorization'] = 'Bearer ' . Configuration::$access_token;
break;

default:
//TODO show warning about security definition not found
}
}
}

/**
* @param string $resourcePath path to method endpoint
* @param string $method method to call
Expand Down Expand Up @@ -430,7 +430,7 @@ public static function deserialize($data, $class)
$subClass = $subClass_array[1];
foreach ($data as $key => $value) {
$deserialized[$key] = self::deserialize($value, $subClass);
}
}
}
} elseif (strcasecmp(substr($class, 0, 6),'array[') == 0) {
$subClass = substr($class, 6, -1);
Expand Down
66 changes: 66 additions & 0 deletions lib/CustomersApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -852,6 +852,72 @@ public function getCustomerIavToken($id) {
return $response[0] == 201 ? $response[1] : $this->apiClient->deserialize($response[1],'IavToken');
}

/**
* initiateKba
*
* Initiate a KBA session for a customer.
*
* @param string $id Customer id to initiate kba for. (required)
* @return Unit
*/
public function initiateKba($id) {

// verify the required parameter 'id' is set
if ($id === null) {
throw new \InvalidArgumentException('Missing the required parameter $id when calling initiateKba');
}


// parse inputs
$resourcePath = "/customers/{id}/kba";
$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('application/vnd.dwolla.v1.hal+json'));




// 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],'Unit');
}

/**
* createLabel
*
Expand Down
198 changes: 198 additions & 0 deletions lib/KbaApi.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,198 @@
<?php
/**
* Copyright 2015 SmartBear Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/**
*
* NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually.
*/

namespace DwollaSwagger;

class KbaApi {

function __construct($apiClient = null) {
if (null === $apiClient) {
if (Configuration::$apiClient === null) {
Configuration::$apiClient = new ApiClient(); // create a new API client if not present
$this->apiClient = Configuration::$apiClient;
}
else
$this->apiClient = Configuration::$apiClient; // use the default one
} else {
$this->apiClient = $apiClient; // use the one provided by the user
}

// Authentication methods
$this->authSettings = array('oauth2');
}

private $apiClient; // instance of the ApiClient

/**
* get the API client
*/
public function getApiClient() {
return $this->apiClient;
}

/**
* set the API client
*/
public function setApiClient($apiClient) {
$this->apiClient = $apiClient;
}


/**
* getKbaQuestions
*
* Get KBA questions by session id
*
* @param string $id ID of KBA session to get. (required)
* @return KbaQuestions
*/
public function getKbaQuestions($id) {

// verify the required parameter 'id' is set
if ($id === null) {
throw new \InvalidArgumentException('Missing the required parameter $id when calling getKbaQuestions');
}


// parse inputs
$resourcePath = "/kba/{id}";
$resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "GET";
$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());




// 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],'KbaQuestions');
}

/**
* answerKbaQuestions
*
* Attempt to answer KBA questions
*
* @param AnswerKbaQuestionsRequest $body KBA answers (required)
* @param string $id Id of KBA session to answer (required)
* @return AnswerKbaQuestionsResponse
*/
public function answerKbaQuestions($body, $id) {

// verify the required parameter 'id' is set
if ($id === null) {
throw new \InvalidArgumentException('Missing the required parameter $id when calling answerQuestions');
}


// parse inputs
$resourcePath = "/kba/{id}";
$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());




// 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);
}

// body params
$_tempBody = null;
if (isset($body)) {
$_tempBody = $body;
}

// 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],'AnswerKbaQuestionsResponse');
}


}
Loading

0 comments on commit 30149f9

Please sign in to comment.