Skip to content

Commit

Permalink
refactoring sirs kemkes with curl and update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
virusphp committed Aug 2, 2024
1 parent e24f8b1 commit cff76ef
Show file tree
Hide file tree
Showing 13 changed files with 234 additions and 249 deletions.
94 changes: 17 additions & 77 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,9 @@ USER_KEY_ANTROL=xxxx
API_BPJS_APLICARE=https://new-api.bpjs-kesehatan.go.id/aplicaresws/rest/
##Configurasi .env untuk sirs kemkes
USER_ID=xxxx
PASS_ID=xxxx
USER_SIRS=xxxx
PASS_SIRS=xxxx
API_KEMKES=http://sirs.kemkes.go.id/fo/index.php/
```
Expand Down Expand Up @@ -155,24 +154,25 @@ Class SomeController
```php
<?php
// Example Controller bridging to SIRS Kemkes (Laravel 7 ke atas)
use Kemkes\Bridging\BridgingKemkes;
use Kemkes\Bridging\Sirs\BridgeSirs;

Class SomeController
{
protected $bridging;
protected $bridging;

public function __construct()
{
$this->bridging = new BridgingKemkes();
}
public function __construct()
{
$this->bridging = new BridgeSirs;
}

// Example To use get Referensi diagnosa
// Example To use get list Tempat tidur
// Name of Method example
public function getFasyankes($kode)
{
$endpoint = 'Fasyankes'. $kode;
return $this->bridging->getRequest($endpoint);
}
public function getTempatTidur()
{
$url = 'Fasyankes';
$tempattidur = $this->bridging->getRequest($url);
return $tempattidur;
}
}
```

Expand All @@ -193,66 +193,6 @@ KLIK TONTON UNTUK SUPORT (LIKE DAN KOMEN)

# Changelog

#### 2023-09-09

- v2.1.2 Add new fitur briding I-care

#### 2022-11-26

- v2.1.1 Fixed bug duplication encode string

#### 2022-10-15

- v2.0.9 Refactoring Guzzle to curl and replace all guzzle

#### 2022-10-07

- v2.0.9 fixed delete method for sep, surat kontrol, and rujukan

#### 2022-02-26

- v2.0.0 Release Mayor Refactoring all service (New Service Antrol)

#### 2022-01-29 - 2022-02-07

- v1.3.7 add support use to native php

#### 2022-01-25

- v1.3.4 bug response antrol not same vclaim and add response antrol

#### 2022-01-25

- v1.3.2 and v.13.3 fix bug response and add support php version 8

#### 2022-01-12

- v1.3.1 fix bug response json to encode

#### 2022-01-04

- v1.3 fix bug and single generate timestamp to open key

#### 2021-12-31

- v1.2 fixed bug minor

#### 2021-12-28

- v1.1 fixed bug minor

### 2021-12-27

- v1.0 Add user_key to bridging versi 2 and fix bug

### 2021-11-22

- v0.8-beta fix bug minor

### 2021-09-19

- v0.7-beta fix bug minor both briding old and new version

### 2021-09-19
#### 2024-08-02

- v0.6-beta Refactor and new fitur bridging kemkes
- v2.1.4 Add new fitur briding Sirs update
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"autoload": {
"psr-4": {
"Bpjs\\Bridging\\": "src/Bpjs/",
"Kemkes\\Bridging\\": "src/kemkes"
"Kemkes\\Bridging\\": "src/Kemkes/"
}
},
"config": {
Expand Down
1 change: 0 additions & 1 deletion src/Bpjs/Vclaim/BridgeVclaim.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ class BridgeVclaim extends CurlFactory

public function __construct()
{
// parent::__construct();
$this->config = new ConfigVclaim;
$this->response = new ResponseVclaim;
$this->header = $this->config->setHeader();
Expand Down
85 changes: 0 additions & 85 deletions src/kemkes/BridgingKemkes.php

This file was deleted.

8 changes: 4 additions & 4 deletions src/kemkes/BridgingKemkesServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ public function register()
*/
public function boot()
{
include __DIR__.'../../routes.php';
$this->publishes([
__DIR__.'../../../../config/kemkes.php' => config_path('kemkes.php'),
include __DIR__ . '../../routes.php';

$this->publishes([
__DIR__ . '../../../config/kemkes.php' => config_path('kemkes.php'),
], 'config');
}
}
49 changes: 49 additions & 0 deletions src/kemkes/CurlFactory.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?php

namespace Kemkes\Bridging;

class CurlFactory
{
public function request($endpoint, $headers, $method = "", $payload = "")
{
$headers = $this->setHeader($headers);

$optf = [
CURLOPT_VERBOSE => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_SSL_VERIFYPEER => false,
CURLOPT_SSL_VERIFYHOST => false,
CURLOPT_TIMEOUT => 5,
CURLOPT_CONNECTTIMEOUT => 5,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => $headers
];

if (!empty($method)) {
$optf[CURLOPT_CUSTOMREQUEST] = $method;
$optf[CURLOPT_POSTFIELDS] = $payload;
$optf[CURLOPT_HTTPHEADER][] = 'Content-Type: Application/x-www-form-urlencoded';
} else {
$optf[CURLOPT_HTTPHEADER][] = 'Content-Type: Application/json';
}

$ch = curl_init($endpoint);
curl_setopt_array($ch, $optf);
$result = curl_exec($ch);
$info = curl_getinfo($ch);
// dd($info);
curl_close($ch);

return $result;
}

protected function setHeader($headers)
{
$header = [];
$header[] = 'Accept: application/json';
$header[] = 'X-rs-id:' . $headers['X-rs-id'];
$header[] = 'X-timestamp:' . $headers['X-timestamp'];
$header[] = 'X-pass:' . $headers['X-pass'];
return $header;
}
}
11 changes: 0 additions & 11 deletions src/kemkes/GenerateKemkes.php

This file was deleted.

54 changes: 0 additions & 54 deletions src/kemkes/Kemkes.php

This file was deleted.

27 changes: 27 additions & 0 deletions src/kemkes/ManageService.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

namespace Kemkes\Bridging;

abstract class ManageService
{
protected $urlEndpoint;

protected $user;

protected $pass;

/**
* abstract method getUrl
*/
abstract public function setUrl();

/**
* abstract method getConsId
*/
abstract public function setUser();

/**
* abstract method getSecretKey
*/
abstract public function setPass();
}
Loading

0 comments on commit cff76ef

Please sign in to comment.