Skip to content

Commit 3da9e73

Browse files
author
Andrey Helldar
committed
Added certificate handling
1 parent e6917fd commit 3da9e73

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

src/Http/Request.php

+15
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
namespace Helldar\CashierDriver\Sber\Auth\Http;
2121

22+
use Helldar\Cashier\Facades\Config\Main;
2223
use Helldar\Cashier\Http\Request as BaseRequest;
2324
use Helldar\Contracts\Cashier\Resources\Model;
2425

@@ -71,6 +72,20 @@ public function getRawBody(): array
7172
];
7273
}
7374

75+
public function getHttpOptions(): array
76+
{
77+
if (Main::isProduction()) {
78+
return [
79+
'cert' => [
80+
$this->model->getCertificatePath(),
81+
$this->model->getCertificatePassword(),
82+
],
83+
];
84+
}
85+
86+
return [];
87+
}
88+
7489
protected function authorization(): string
7590
{
7691
return base64_encode($this->model->getClientId() . ':' . $this->model->getClientSecret());

tests/Fixtures/ModelResource.php

+10
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,16 @@
2525

2626
class ModelResource extends Model
2727
{
28+
public function getCertificatePath(): ?string
29+
{
30+
return null;
31+
}
32+
33+
public function getCertificatePassword(): ?string
34+
{
35+
return null;
36+
}
37+
2838
protected function clientId(): string
2939
{
3040
return config('cashier.drivers.sber_qr.client_id');

0 commit comments

Comments
 (0)