src/RequestManager/RiskRequestManager.php line 35

Open in your IDE?
  1. <?php
  2. namespace App\RequestManager;
  3. use GuzzleHttp\Exception\GuzzleException;
  4. use Paynetics\Exception\ApiException;
  5. use Paynetics\HttpRequest\ApiHttpRequestService;
  6. use Psr\Http\Message\ResponseInterface;
  7. use Symfony\Component\HttpKernel\Exception\HttpException;
  8. use Symfony\Component\Serializer\Normalizer\AbstractObjectNormalizer;
  9. class RiskRequestManager extends ApiHttpRequestService
  10. {
  11.     protected const SERVICE 'RISK_SERVICE';
  12.     /**
  13.      * @return mixed|ResponseInterface|HttpException
  14.      * @throws ApiException
  15.      * @throws GuzzleException
  16.      * @throws \JsonException
  17.      */
  18.     public function checks()
  19.     {
  20.         return $this->get('/v1/company/risks/checks');
  21.     }
  22.     /**
  23.      * @param string $code
  24.      * @return mixed|ResponseInterface|HttpException
  25.      * @throws ApiException
  26.      * @throws GuzzleException
  27.      * @throws \JsonException
  28.      */
  29.     public function show(string $code)
  30.     {
  31.         return $this->get('/v1/company/risks/{code}/definitions'compact('code'));
  32.     }
  33.     /**
  34.      * @throws ApiException
  35.      * @throws GuzzleException
  36.      * @throws \JsonException
  37.      */
  38.     public function showRiskHistory(string $merchantint $from 1int $limit 20)
  39.     {
  40.         return $this->get('/v1/company/risks/list/{from}/{limit}'compact('from''limit'), compact('merchant'));
  41.     }
  42.     /**
  43.      * @throws GuzzleException
  44.      * @throws ApiException
  45.      */
  46.     public function update($data)
  47.     {
  48.         return $this->put('/v1/company/risks/definitions/{id}'$data, ['id' => $data['id']]);
  49.     }
  50.     /**
  51.      * @throws ApiException
  52.      * @throws GuzzleException
  53.      */
  54.     public function remove($id)
  55.     {
  56.         return $this->delete('/v1/company/risks/definitions/{id}', [], compact('id'));
  57.     }
  58.     /**
  59.      * @throws ApiException
  60.      * @throws GuzzleException
  61.      */
  62.     public function create($data)
  63.     {
  64.         $data $this->serialize($data, [AbstractObjectNormalizer::SKIP_NULL_VALUES => true]);
  65.         return $this->post('/v1/company/risks/definitions'$data);
  66.     }
  67.     /**
  68.      * @return mixed|ResponseInterface|HttpException
  69.      * @throws ApiException
  70.      * @throws GuzzleException
  71.      * @throws \JsonException
  72.      */
  73.     public function showLevels()
  74.     {
  75.         return $this->get('/v1/person/risks/levels');
  76.     }
  77.     /**
  78.      * @param $data
  79.      * @return mixed|ResponseInterface|HttpException|null
  80.      * @throws ApiException
  81.      * @throws GuzzleException
  82.      */
  83.     public function updateLevels($data)
  84.     {
  85.         return $this->post('/v1/person/risks/levels'$data, [], true);
  86.     }
  87.     public function showPersonRisk($type)
  88.     {
  89.         return $this->get('/v1/person/risks/{type}/definition'compact('type'));
  90.     }
  91.     public function removePerson($id)
  92.     {
  93.         return $this->delete('/v1/person/risks/definitions/{id}', [], compact('id'));
  94.     }
  95.     public function createPerson($data)
  96.     {
  97.         $data $this->serialize($data, [AbstractObjectNormalizer::SKIP_NULL_VALUES => true]);
  98.         return $this->post('/v1/person/risks/definitions'$data);
  99.     }
  100.     public function updatePerson($data$id)
  101.     {
  102.         return $this->put('/v1/person/risks/definitions/{id}'$datacompact('id'));
  103.     }
  104. }