@@ -28,41 +28,49 @@ Or manually update `require` block of `composer.json` and run `composer update`.
28
28
## Using
29
29
30
30
``` php
31
- namespace Helldar\CashierDriver\Sber\QrCode;
31
+ namespace Helldar\CashierDriver\Sber\QrCode\Requests ;
32
32
33
- use Helldar\Cashier\Services\Driver as BaseDriver;
34
- use Helldar\CashierDriver\Sber\Auth\DTO\Client;
35
- use Helldar\CashierDriver\Sber\Auth\Facades\Auth;
33
+ use Helldar\Cashier\Http\Request;
34
+ use Helldar\CashierDriver\Sber\Auth\Auth;
36
35
37
- class Driver extends BaseDriver
36
+ class Init extends Request
38
37
{
39
- protected function headers(string $scope): array
38
+ protected $production_host = 'https://api.sberbank.ru';
39
+
40
+ protected $dev_host = 'https://dev.api.sberbank.ru';
41
+
42
+ protected $path = '/ru/prod/creation';
43
+
44
+ protected $auth = Auth::class;
45
+
46
+ public function getRawBody(): array
40
47
{
41
48
return [
42
- 'Authorization ' => 'Bearer ' . $this->accessToken($scope ),
49
+ 'OrderId ' => $this->model->getPaymentId( ),
43
50
44
- 'X-IBM-Client-Id ' => $this->auth->getClientId (),
51
+ 'Amount ' => $this->model->getSum (),
45
52
46
- 'x-Introspect-RqUID ' => $this->resource->getUniqueId (),
53
+ 'Currency ' => $this->model->getCurrency (),
47
54
];
48
55
}
56
+ }
57
+ ```
49
58
50
- protected function accessToken(string $scope): string
51
- {
52
- $auth = $this->authDto($scope);
59
+ ``` php
60
+ namespace Helldar\CashierDriver\Sber\QrCode;
53
61
54
- return Auth::accessToken($auth);
55
- }
62
+ use Helldar\CashierDriver\Sber\Auth\Support\Auth;
63
+ use Helldar\CashierDriver\Sber\QrCode\Driver as BaseDriver;
64
+ use Helldar\CashierDriver\Sber\QrCode\Requests\Init;
65
+ use Helldar\Contracts\Cashier\Resources\Response;
56
66
57
- protected function authDto(string $scope): Client
67
+ class Driver extends BaseDriver
68
+ {
69
+ public function start(): Response
58
70
{
59
- return Client::make()
60
- ->scope($scope)
61
- ->host($this->host())
62
- ->clientId($this->auth->getClientId())
63
- ->clientSecret($this->auth->getClientSecret())
64
- ->memberId($this->resource->getMemberId())
65
- ->paymentId($this->resource->getPaymentId());
71
+ $request = Init::make($this->model);
72
+
73
+ return $this->request($request, Response::class);
66
74
}
67
75
}
68
76
```
0 commit comments