Skip to content

Commit

Permalink
Fixed encoding issues with Saferpay credentials
Browse files Browse the repository at this point in the history
  • Loading branch information
aschempp committed Jun 26, 2023
1 parent 62cbb04 commit 8a48dde
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,11 @@ private function sendJsonRequest($script, array $data)
$objRequest->setHeader('Accept', 'application/json');
$objRequest->setHeader('Content-Type', 'application/json; charset=utf-8');

if ($this->saferpay_username) {
$objRequest->username = $this->saferpay_username;
$objRequest->password = $this->saferpay_password;
}

$objRequest->send($this->getApiUrl($script), json_encode($data), 'POST');

if ($objRequest->code !== 200) {
Expand Down Expand Up @@ -469,9 +474,7 @@ private function getApiUrl($script)
}

return sprintf(
'https://%s:%s@%s.saferpay.com/api/%s',
$this->saferpay_username,
$this->saferpay_password,
'https://%s.saferpay.com/api/%s',
$this->debug ? 'test' : 'www',
ltrim($script, '/')
);
Expand Down

0 comments on commit 8a48dde

Please sign in to comment.