/home/desid573/public_html/gcdriver/square/lib/Api
Edit: /home/desid573/public_html/gcdriver/square/lib/Api/ApplePayApi.php (5172B)
getConfig()->setHost('https://connect.squareup.com');
}
$this->apiClient = $apiClient;
}
/**
* Get API client
* @return \SquareConnect\ApiClient get the API client
*/
public function getApiClient()
{
return $this->apiClient;
}
/**
* Set the API client
* @param \SquareConnect\ApiClient $apiClient set the API client
* @return ApplePayApi
*/
public function setApiClient(ApiClient $apiClient)
{
$this->apiClient = $apiClient;
return $this;
}
/**
* registerDomain
*
* RegisterDomain
*
* @param \SquareConnect\Model\RegisterDomainRequest $body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return \SquareConnect\Model\RegisterDomainResponse
* @throws \SquareConnect\ApiException on non-2xx response
*/
public function registerDomain($body)
{
list($response, $statusCode, $httpHeader) = $this->registerDomainWithHttpInfo ($body);
return $response;
}
/**
* registerDomainWithHttpInfo
*
* RegisterDomain
*
* @param \SquareConnect\Model\RegisterDomainRequest $body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return Array of \SquareConnect\Model\RegisterDomainResponse, HTTP status code, HTTP response headers (array of strings)
* @throws \SquareConnect\ApiException on non-2xx response
*/
public function registerDomainWithHttpInfo($body)
{
// verify the required parameter 'body' is set
if ($body === null) {
throw new \InvalidArgumentException('Missing the required parameter $body when calling registerDomain');
}
// parse inputs
$resourcePath = "/v2/apple-pay/domains";
$httpBody = '';
$queryParams = array();
$headerParams = array();
$formParams = array();
$_header_accept = ApiClient::selectHeaderAccept(array('application/json'));
if (!is_null($_header_accept)) {
$headerParams['Accept'] = $_header_accept;
}
$headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array('application/json'));
$headerParams['Square-Version'] = "2019-08-14";
// default format to json
$resourcePath = str_replace("{format}", "json", $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
} elseif (count($formParams) > 0) {
$httpBody = $formParams; // for HTTP post (form)
}
// this endpoint requires OAuth (access token)
if (strlen($this->apiClient->getConfig()->getAccessToken()) !== 0) {
$headerParams['Authorization'] = 'Bearer ' . $this->apiClient->getConfig()->getAccessToken();
}
// make the API Call
try {
list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(
$resourcePath, 'POST',
$queryParams, $httpBody,
$headerParams, '\SquareConnect\Model\RegisterDomainResponse'
);
if (!$response) {
return array(null, $statusCode, $httpHeader);
}
return array(\SquareConnect\ObjectSerializer::deserialize($response, '\SquareConnect\Model\RegisterDomainResponse', $httpHeader), $statusCode, $httpHeader);
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = \SquareConnect\ObjectSerializer::deserialize($e->getResponseBody(), '\SquareConnect\Model\RegisterDomainResponse', $e->getResponseHeaders());
$e->setResponseObject($data);
break;
}
throw $e;
}
}
}