Skip to content
This repository was archived by the owner on May 5, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/UlozenkaLib/APIv3/Api.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ class Api
private $apiKey;
private $appId;
private $appVersion;
private $certificatePath;

/**
* Api constructor.
Expand All @@ -47,14 +48,17 @@ class Api
* @param string|null $appId
* @param string|null $appVersion
*/
public function __construct($endpoint = Endpoint::PRODUCTION, $shopId = null, $apiKey = null, $appId = null, $appVersion = null)
public function __construct($endpoint = Endpoint::PRODUCTION, $shopId = null, $apiKey = null, $appId = null, $appVersion = null, $certificatePath = null)
{
$this->connector = new Connector($endpoint);
$this->shopId = $shopId;
$this->apiKey = $apiKey;
$this->appId = $appId;
$this->appVersion = $appVersion;
$this->formatter = new JsonFormatter();
if ($certificatePath != null) {
$this->connector->setCertificate($certificatePath);
}
}

/**
Expand Down
5 changes: 5 additions & 0 deletions src/UlozenkaLib/APIv3/Connector.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ public function disableSslVerification()
$this->curlOptions[CURLOPT_SSL_VERIFYPEER] = false;
}

public function setCertificate($certificatePath)
{
$this->curlOptions[CURLOPT_CAINFO] = $certificatePath;
}

/**
*
* @return string
Expand Down