Skip to content

Commit

Permalink
update user_key briding
Browse files Browse the repository at this point in the history
  • Loading branch information
virusphp committed Dec 27, 2021
1 parent a531885 commit 0a3d1c8
Show file tree
Hide file tree
Showing 17 changed files with 40 additions and 2 deletions.
Empty file modified .gitignore
100644 → 100755
Empty file.
Empty file modified LICENSE
100644 → 100755
Empty file.
Empty file modified README.md
100644 → 100755
Empty file.
Empty file modified composer.json
100644 → 100755
Empty file.
Empty file modified config/bpjs.php
100644 → 100755
Empty file.
Empty file modified config/kemkes.php
100644 → 100755
Empty file.
Empty file modified src/kemkes/BridgingKemkes.php
100644 → 100755
Empty file.
Empty file modified src/kemkes/BridgingKemkesServiceProvider.php
100644 → 100755
Empty file.
Empty file modified src/kemkes/GenerateKemkes.php
100644 → 100755
Empty file.
Empty file modified src/kemkes/Kemkes.php
100644 → 100755
Empty file.
Empty file modified src/kemkes/TempatTidurController.php
100644 → 100755
Empty file.
Empty file modified src/routes.php
100644 → 100755
Empty file.
8 changes: 7 additions & 1 deletion src/vclaim/Bpjs.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ public function setServiceApi()
return getenv('API_BPJS');
}

public function setUserKey()
{
return getenv('USER_KEY');
}

public function setTimestamp()
{
return GenerateBpjs::bpjsTimestamp();
Expand All @@ -53,7 +58,8 @@ public function setHeader()
return [
'X-cons-id' => $this->setConsid(),
'X-timestamp' => $this->setTimestamp(),
'X-signature' => $this->setSignature()
'X-signature' => $this->setSignature(),
'user_key' => $this->setUserKey(),
];
}

Expand Down
34 changes: 33 additions & 1 deletion src/vclaim/BridgingBpjs.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,39 @@ public function postRequest($endpoint, $data)
$url = $this->setServiceApi() . $endpoint;
$response = $this->client->post($url, ['headers' => $this->setHeaders(), 'body' => $data]);
$result = GenerateBpjs::responseBpjsV2($response->getBody()->getContents(), $this->key);
return $result();
return $result;
} catch (RequestException $e) {
$result =$e->getRequest();
if ($e->hasResponse()) {
$result = $e->getResponse();
}
}
}

public function putRequest($endpoint, $data)
{
$data = file_get_contents("php://input");
try {
$url = $this->setServiceApi() . $endpoint;
$response = $this->client->put($url, ['headers' => $this->setHeaders(), 'body' => $data]);
$result = GenerateBpjs::responseBpjsV2($response->getBody()->getContents(), $this->key);
return $result;
} catch (RequestException $e) {
$result =$e->getRequest();
if ($e->hasResponse()) {
$result = $e->getResponse();
}
}
}

public function deleteRequest($endpoint, $data)
{
$data = file_get_contents("php://input");
try {
$url = $this->setServiceApi() . $endpoint;
$response = $this->client->delete($url, ['headers' => $this->setHeaders(), 'body' => $data]);
$result = GenerateBpjs::responseBpjsV2($response->getBody()->getContents(), $this->key);
return $result;
} catch (RequestException $e) {
$result =$e->getRequest();
if ($e->hasResponse()) {
Expand Down
Empty file modified src/vclaim/BridgingBpjsServiceProvider.php
100644 → 100755
Empty file.
Empty file modified src/vclaim/GenerateBpjs.php
100644 → 100755
Empty file.
Empty file modified src/vclaim/ReferensiController.php
100644 → 100755
Empty file.

0 comments on commit 0a3d1c8

Please sign in to comment.