first commit

This commit is contained in:
2024-07-12 08:03:32 +07:00
commit 7f9359656d
122 changed files with 13427 additions and 0 deletions
+41
View File
@@ -0,0 +1,41 @@
<?php
namespace App\Console;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
class Kernel extends ConsoleKernel
{
/**
* The Artisan commands provided by your application.
*
* @var array
*/
protected $commands = [
//
];
/**
* Define the application's command schedule.
*
* @param \Illuminate\Console\Scheduling\Schedule $schedule
* @return void
*/
protected function schedule(Schedule $schedule)
{
// $schedule->command('inspire')->hourly();
}
/**
* Register the commands for the application.
*
* @return void
*/
protected function commands()
{
$this->load(__DIR__.'/Commands');
require base_path('routes/console.php');
}
}
+37
View File
@@ -0,0 +1,37 @@
<?php
namespace App\Exceptions;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
class Handler extends ExceptionHandler
{
/**
* A list of the exception types that are not reported.
*
* @var array
*/
protected $dontReport = [
//
];
/**
* A list of the inputs that are never flashed for validation exceptions.
*
* @var array
*/
protected $dontFlash = [
'password',
'password_confirmation',
];
/**
* Register the exception handling callbacks for the application.
*
* @return void
*/
public function register()
{
//
}
}
+17
View File
@@ -0,0 +1,17 @@
<?php
namespace App\Helpers;
class Helper
{
public static function isProduction()
{
return env('APP_ENV') === 'production';
}
public static function isStaging()
{
return env('APP_ENV') === 'staging';
}
}
+13
View File
@@ -0,0 +1,13 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Routing\Controller as BaseController;
class Controller extends BaseController
{
use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
}
+24
View File
@@ -0,0 +1,24 @@
<?php
namespace App\Http\Controllers;
class PasienController extends Controller
{
public function inquiryStatus()
{
$response = [
'responseCode' => '5047300',
'responseMessage' => 'Timeout',
];
return response()->json($response, 500);
}
public function login()
{
$response = [
'responseCode' => '5047300',
'responseMessage' => 'Timeout',
];
return response()->json($response, 500);
}
}
@@ -0,0 +1,16 @@
<?php
namespace App\Http\Controllers\Poct;
use App\Http\Controllers\Controller;
use App\Models\Poct\Driver;
use Illuminate\Http\Request;
class DriverController extends Controller
{
public function GetDriver()
{
$aa= Driver::all();
dd($aa);
}
}
@@ -0,0 +1,135 @@
<?php
namespace App\Http\Controllers\Poct;
use App\Http\Controllers\Controller;
use App\Models\Poct\Request\ListPemeriksaanRequest;
use App\Models\Poct\Request\ListPemeriksaanResponse;
use App\Services\Poct\ListPemeriksaanService;
use Illuminate\Http\Request;
use Illuminate\Support\Str;
use Illuminate\Validation\ValidationException;
class PemeriksaanController extends Controller
{
public function ListPemeriksaan(Request $request, ListPemeriksaanService $listPemeriksaanService)
{
$validator = validator($request->all(), [
'tgl_order' => ['required', 'date_format:Y-m-d'],
], [], [
'tgl_order' => 'Tgl Order',
]);
$data = new ListPemeriksaanRequest($request->all());
$result = new ListPemeriksaanResponse($request->all());
try {
$validator->validate();
$timestamp = $request->header('x-timestamp');
$signarture = $request->header('x-signature');
$token = $request->header('authorization');
if (!empty($timestamp) && !empty($signarture) && !empty($token)) {
if ($token == env('PEC_TOKEN')){
$verif_signarture = $this->generateSignature($token, $timestamp);
if ($verif_signarture == $signarture) {
$proses = $listPemeriksaanService->fetchPemeriksaan($data, $result, 'list');
$response = $proses->toArray();
} else {
$result->setresponseCode("01");
$result->setresponseMessage("Unauthorized X-Signature!");
$response = $result->toArray();
}
}else{
$result->setresponseCode("01");
$result->setresponseMessage("Unauthorized Token!");
$response = $result->toArray();
}
} else {
$result->setresponseCode("01");
$result->setresponseMessage("Invalid X-Timestamp or X-Signature or Token!");
$response = $result->toArray();
}
return response()->json($response, 200);
} catch (ValidationException $e) {
$result->setresponseCode("00");
$result->setresponseMessage($e->getMessage());
$response = $result->toArray();
return response()->json($response, 400);
}
}
public function RekapPemeriksaan(Request $request, ListPemeriksaanService $listPemeriksaanService)
{
$validator = validator($request->all(), [
'tgl_awal' => ['required', 'date_format:Y-m-d'],
'tgl_akhir' => ['required', 'date_format:Y-m-d'],
], [], [
'tgl_awal' => 'Tgl Awal',
'tgl_akhir' => 'Tgl Akhir',
]);
$data = new ListPemeriksaanRequest($request->all());
$result = new ListPemeriksaanResponse($request->all());
try {
$validator->validate();
$timestamp = $request->header('x-timestamp');
$signarture = $request->header('x-signature');
$token = $request->header('authorization');
if (!empty($timestamp) && !empty($signarture) && !empty($token)) {
if ($token == env('PEC_TOKEN')){
$verif_signarture = $this->generateSignature($token, $timestamp);
if ($verif_signarture == $signarture) {
$proses = $listPemeriksaanService->fetchPemeriksaan($data, $result, 'rekap');
$response = $proses->toArray();
return response()->json($response, 200);
} else {
$result->setresponseCode("01");
$result->setresponseMessage("Unauthorized X-Signature!");
$response = $result->toArray();
}
}else{
$result->setresponseCode("01");
$result->setresponseMessage("Unauthorized Token!");
$response = $result->toArray();
}
} else {
$result->setresponseCode("01");
$result->setresponseMessage("Invalid X-Timestamp or X-Signature or Token!");
$response = $result->toArray();
}
return response()->json($response, 200);
} catch (ValidationException $e) {
$result->setresponseCode("00");
$result->setresponseMessage($e->getMessage());
$response = $result->toArray();
return response()->json($response, 400);
}
}
public function Signature(Request $request)
{
$signature = $this->generateSignature($request->token, $request->timestamp);
$response = array(
"signature" => $signature
);
return response()->json($response, 200);
}
public function Token(Request $request)
{
$strToken = Str::random(60);
$response = array(
"token" => $strToken
);
return response()->json($response, 200);
}
public function generateSignature($token, $timestamp)
{
$strToString = env('PEC_TOKEN') . '_' . $timestamp;
$signature = hash('sha256', $strToString);
return $signature;
}
}
@@ -0,0 +1,138 @@
<?php
namespace App\Http\Controllers\Qris\v1;
use App\Http\Controllers\Controller;
use App\Models\Qris\v1\QrisJatimCheckStatusQrisRequest;
use App\Models\Qris\v1\QrisJatimGenerateRequest;
use App\Models\Qris\v1\QrisJatimGenerateResponse;
use App\Models\Qris\v1\QrisJatimPaymentRequest;
use App\Models\Qris\v1\QrisJatimPaymentResponse;
use App\Services\Qris\v1\QrisJatimService;
use Illuminate\Http\Request;
use Illuminate\Validation\ValidationException;
/**
* Created by PhpStorm.
* User: ITKOM-EFFENDY
* Date: 01/04/2024
* Time: 14:15
*/
class QrisJatimController extends Controller
{
protected $settings;
public function __construct()
{
$this->settings = array(
'apiUrl' => env('BANK_JATIM_URL', 'https://jatimva.bankjatim.co.id/'),
'merchant' => env('BANK_JATIM_MERCHANT', '9360011400001347721'),
'hashcode' => env('BANK_JATIM_HASCODE', 'Y1MACZ4B5R'),
'terminalUser' => env('BANK_JATIM_TERMINAL_USER', 'ID2024310949969'),
'username' => env('BANK_JATIM_USERNAME', 'RSUDDRSA3206'),
'password' => env('BANK_JATIM_PASSWORD', '111111'),
);
}
public function GenerateQris(QrisJatimService $qrisJatimService, Request $request)
{
$validator = validator($request->all(), [
'billNumber' => ['required', 'string', 'max:20'],
'purposetrx' => ['required', 'string', 'max:28'],
'storelabel' => ['required', 'string', 'max:100'],
'customerlabel' => ['nullable', 'string', 'max:100'],
'terminalUser' => ['nullable', 'string', 'max:30'],
'expiredDate' => ['nullable', 'string', 'max:30'],
'amount' => ['nullable', 'string'],
], [], [
'billNumber' => 'Bill Number',
'purposetrx' => 'Purpose Set Trx',
'storelabel' => 'Store Label',
'customerlabel' => 'Customer Label',
'terminalUser' => 'Terminal User',
'expiredDate' => 'Expired Date',
'amount' => 'Amount',
]);
try {
$validator->validate();
$data = new QrisJatimGenerateRequest($request->all());
$generateHashCode = $this->generateHashCode($this->settings['merchant'], $data->getbillNumber(), $data->getterminalUser(), $this->settings['hashcode']);
$data->setmerchantPan($this->settings['merchant']);
$data->sethashcodeKey('3C569A8C898FD24243CE0FABD4B6B60E30267C7409A5A06F859416C325482964');
// $data->sethashcodeKey(strtoupper($generateHashCode['hashCode']));
$response = $qrisJatimService->generateApiQris($data);
return response()->json($response, 200);
} catch (ValidationException $e) {
dd($e);
} catch (\Exception $e) {
dd($e);
}
}
public function PaymentQris(Request $request, QrisJatimService $qrisJatimService){
$validator = validator($request->all(), [
'billNumber' => ['required', 'string', 'max:20'],
'purposetrx' => ['required', 'string', 'max:28'],
'storelabel' => ['required', 'string', 'max:100'],
'customerlabel' => ['nullable', 'string', 'max:100'],
'terminalUser' => ['nullable', 'string', 'max:30'],
'amount' => ['nullable', 'string'],
'core_reference'=>['nullable', 'string'],
'customerPan'=>['nullable', 'string'],
'merchantPan'=>['nullable', 'string'],
'pjsp'=>['nullable', 'string'],
'invoice_number'=>['nullable', 'string'],
'transactionDate'=>['nullable', 'string'],
]);
try{
$validator->validate();
$data = new QrisJatimPaymentRequest($request->all());
$result = new QrisJatimPaymentResponse($request->all());
$proses = $qrisJatimService->updateQris($data, $result);
$response = $proses->toArray();
$qrisJatimService->log('bankjatim/PaymentQr', $data->toArray(), $proses->toArray());
return response()->json($response, 200);
} catch (ValidationException $e) {
dd($e);
} catch (\Exception $e) {
dd($e);
}
}
public function CheckStatusQris(QrisJatimService $qrisJatimService, Request $request)
{
$validator = validator($request->all(), [
'username' => ['required', 'string', 'max:20'],
'password' => ['required', 'string', 'max:28'],
'invoice_number' => ['required', 'string', 'max:100'],
]);
try {
$validator->validate();
$data = new QrisJatimCheckStatusQrisRequest($request->all());
$response = $qrisJatimService->checkStatusQrisPayment($data);
return response()->json($response, 200);
} catch (ValidationException $e) {
} catch (\Exception $e) {
}
}
public function generateHashCode($marchant, $billNumber, $terminalUser, $hashCode)
{
$stringToSign = $marchant . $billNumber . $terminalUser . $hashCode;
return [
'hashCode' => hash('sha256',$stringToSign)
];
}
}
@@ -0,0 +1,93 @@
<?php
namespace App\Http\Controllers\Va\v1;
use App\Http\Controllers\Controller;
use App\Models\Va\v1\VirtualAccountJatimRequest;
use App\Models\Va\v1\VirtualAccountJatimResponse;
use App\Services\Va\v1\VirtualAccountJatimService;
use Illuminate\Validation\ValidationException;
use Illuminate\Http\Request;
/**
* Created by PhpStorm.
* User: USER
* Date: 14/05/2024
* Time: 9:36
*/
class VirtualAccountController extends Controller
{
protected $settings;
public function __construct()
{
$this->settings = array(
'apiUrl' => env('BANK_JATIM_URL', 'https://jatimva.bankjatim.co.id/'),
'merchant' => env('BANK_JATIM_MERCHANT', '9360011400001347721'),
'hashcode' => env('BANK_JATIM_HASCODE', 'Y1MACZ4B5R'),
'terminalUser' => env('BANK_JATIM_TERMINAL_USER', 'ID2024310949969'),
'username' => env('BANK_JATIM_USERNAME', 'RSUDDRSA3206'),
'password' => env('BANK_JATIM_PASSWORD', '111111'),
);
}
public function CreateVirtualAccountFull(Request $request)
{
$validator = validator($request->all(), [
'VirtualAccount' => ['required', 'string', 'max:16'],
'Nama' => ['required', 'string', 'max:100'],
'TotalTagihan' => ['required', 'string'],
'TanggalExp' => ['required', 'date_format:YYYYMMDD'],
'Berita1' => ['nullable', 'string', 'max:50'],
'Berita2' => ['nullable', 'string', 'max:50'],
'Berita3' => ['nullable', 'string', 'max:50'],
'Berita4' => ['nullable', 'string', 'max:50'],
'Berita5' => ['nullable', 'string', 'max:50'],
'FlagProses' => ['nullable', 'string', 'max:1'],
], [], [
'VirtualAccount' => 'Virtual Account',
'Nama' => 'Nama',
'TotalTagihan' => 'Store Label',
'TanggalExp' => 'Tanggal Exp',
'Berita1' => 'Berita 1',
'Berita2' => 'Berita 2',
'Berita3' => 'Berita 3',
'Berita4' => 'Berita 4',
'Berita5' => 'Berita 5',
]);
}
public function CallbackVa(VirtualAccountJatimService $virtualAccountJatimService, Request $request)
{
$validator = validator($request->all(), [
'VirtualAccount' => ['required', 'string', 'max:16'],
'Nama' => ['required', 'string', 'max:100'],
'Amount' => ['required', 'numeric'],
'References' => ['required', 'string', 'max:50'],
'Tanggal' => ['required', 'date_format:Y-m-d H:i:s'],
], [], [
'VirtualAccount' => 'Virtual Account',
'Nama' => 'Nama',
'Amount' => 'Amount',
'References' => 'References',
'Tanggal' => 'Tanggal',
]);
try {
// $validator->validate();
$data = new VirtualAccountJatimRequest($request->all());
$result = new VirtualAccountJatimResponse($request->all());
$proses = $virtualAccountJatimService->updatePayment($data, $result);
$response = $proses->toArray();
$virtualAccountJatimService->log('bankjatim/callback-va', $data->toArray(), $proses->toArray());
return response()->json($response, 200);
} catch (ValidationException $e) {
dd($e);
} catch (\Exception $e) {
dd($e);
}
}
}
+66
View File
@@ -0,0 +1,66 @@
<?php
namespace App\Http;
use Illuminate\Foundation\Http\Kernel as HttpKernel;
class Kernel extends HttpKernel
{
/**
* The application's global HTTP middleware stack.
*
* These middleware are run during every request to your application.
*
* @var array
*/
protected $middleware = [
// \App\Http\Middleware\TrustHosts::class,
\App\Http\Middleware\TrustProxies::class,
\Fruitcake\Cors\HandleCors::class,
\App\Http\Middleware\PreventRequestsDuringMaintenance::class,
\Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
\App\Http\Middleware\TrimStrings::class,
\Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
];
/**
* The application's route middleware groups.
*
* @var array
*/
protected $middlewareGroups = [
'web' => [
\App\Http\Middleware\EncryptCookies::class,
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
\Illuminate\Session\Middleware\StartSession::class,
// \Illuminate\Session\Middleware\AuthenticateSession::class,
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
\App\Http\Middleware\VerifyCsrfToken::class,
\Illuminate\Routing\Middleware\SubstituteBindings::class,
],
'api' => [
'throttle:api',
\Illuminate\Routing\Middleware\SubstituteBindings::class,
],
];
/**
* The application's route middleware.
*
* These middleware may be assigned to groups or used individually.
*
* @var array
*/
protected $routeMiddleware = [
'auth' => \App\Http\Middleware\Authenticate::class,
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class,
'can' => \Illuminate\Auth\Middleware\Authorize::class,
'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
'password.confirm' => \Illuminate\Auth\Middleware\RequirePassword::class,
'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class,
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
];
}
+21
View File
@@ -0,0 +1,21 @@
<?php
namespace App\Http\Middleware;
use Illuminate\Auth\Middleware\Authenticate as Middleware;
class Authenticate extends Middleware
{
/**
* Get the path the user should be redirected to when they are not authenticated.
*
* @param \Illuminate\Http\Request $request
* @return string|null
*/
protected function redirectTo($request)
{
if (! $request->expectsJson()) {
return route('login');
}
}
}
+17
View File
@@ -0,0 +1,17 @@
<?php
namespace App\Http\Middleware;
use Illuminate\Cookie\Middleware\EncryptCookies as Middleware;
class EncryptCookies extends Middleware
{
/**
* The names of the cookies that should not be encrypted.
*
* @var array
*/
protected $except = [
//
];
}
@@ -0,0 +1,17 @@
<?php
namespace App\Http\Middleware;
use Illuminate\Foundation\Http\Middleware\PreventRequestsDuringMaintenance as Middleware;
class PreventRequestsDuringMaintenance extends Middleware
{
/**
* The URIs that should be reachable while maintenance mode is enabled.
*
* @var array
*/
protected $except = [
//
];
}
@@ -0,0 +1,31 @@
<?php
namespace App\Http\Middleware;
use App\Providers\RouteServiceProvider;
use Closure;
use Illuminate\Support\Facades\Auth;
class RedirectIfAuthenticated
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @param string[]|null ...$guards
* @return mixed
*/
public function handle($request, Closure $next, ...$guards)
{
$guards = empty($guards) ? [null] : $guards;
foreach ($guards as $guard) {
if (Auth::guard($guard)->check()) {
return redirect(RouteServiceProvider::HOME);
}
}
return $next($request);
}
}
+18
View File
@@ -0,0 +1,18 @@
<?php
namespace App\Http\Middleware;
use Illuminate\Foundation\Http\Middleware\TrimStrings as Middleware;
class TrimStrings extends Middleware
{
/**
* The names of the attributes that should not be trimmed.
*
* @var array
*/
protected $except = [
'password',
'password_confirmation',
];
}
+20
View File
@@ -0,0 +1,20 @@
<?php
namespace App\Http\Middleware;
use Illuminate\Http\Middleware\TrustHosts as Middleware;
class TrustHosts extends Middleware
{
/**
* Get the host patterns that should be trusted.
*
* @return array
*/
public function hosts()
{
return [
$this->allSubdomainsOfApplicationUrl(),
];
}
}
+23
View File
@@ -0,0 +1,23 @@
<?php
namespace App\Http\Middleware;
use Fideloper\Proxy\TrustProxies as Middleware;
use Illuminate\Http\Request;
class TrustProxies extends Middleware
{
/**
* The trusted proxies for this application.
*
* @var array|string|null
*/
protected $proxies;
/**
* The headers that should be used to detect proxies.
*
* @var int
*/
protected $headers = Request::HEADER_X_FORWARDED_ALL;
}
+18
View File
@@ -0,0 +1,18 @@
<?php
namespace App\Http\Middleware;
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as Middleware;
class VerifyCsrfToken extends Middleware
{
/**
* The URIs that should be excluded from CSRF verification.
*
* @var array
*/
protected $except = [
'bankjatim/*',
'poct/*',
];
}
+12
View File
@@ -0,0 +1,12 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Pasien extends Model
{
use HasFactory;
protected $table = 'm_pasien';
}
+14
View File
@@ -0,0 +1,14 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class PaymentBank extends Model
{
use HasFactory;
protected $table = 't_payment_bank';
}
+21
View File
@@ -0,0 +1,21 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class PaymentJatimLogs extends Model
{
use HasFactory;
protected $table = 'payment_jatim_logs';
protected $fillable = [
'type',
'request',
'response',
'response',
'created_at',
'updated_at'
];
}
+14
View File
@@ -0,0 +1,14 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class PaymentVirtualAccount extends Model
{
use HasFactory;
protected $table = 't_payment_virtualaccount';
}
@@ -0,0 +1,13 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class PaymentVirtualAccountDetail extends Model
{
use HasFactory;
protected $table = 't_payment_virtualaccount_detail';
}
+13
View File
@@ -0,0 +1,13 @@
<?php
namespace App\Models\Poct;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Driver extends Model
{
use HasFactory;
protected $connection = 'sqlsrv';
protected $table = 'Driver';
}
+13
View File
@@ -0,0 +1,13 @@
<?php
namespace App\Models\Poct;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Operators extends Model
{
use HasFactory;
protected $connection = 'sqlsrv';
protected $table = 'Operator';
}
+17
View File
@@ -0,0 +1,17 @@
<?php
namespace App\Models\Poct;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Patients extends Model
{
use HasFactory;
protected $connection = 'sqlsrv';
protected $table = 'Patient';
public function results(){
return $this->hasMany(Results::class,'_PID', 'ID');
}
}
@@ -0,0 +1,66 @@
<?php
namespace App\Models\Poct\Request;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class ListPemeriksaanRequest extends \stdClass
{
private $tgl_order = "";
private $tgl_awal = "";
private $tgl_akhir = "";
public function __construct($response)
{
$has = get_object_vars($this);
foreach ($has as $name => $oldValue) {
!array_key_exists($name, $response) ?: $this->$name = $response[$name];
}
}
public function toArray(): array
{
$has = get_object_vars($this);
$response = array();
foreach ($has as $name => $value) {
if (gettype($value) === 'object') {
$response[$name] = $value->toArray();
} else {
$response[$name] = $value;
}
}
return $response;
}
public function gettgl_order()
{
return $this->tgl_order;
}
public function settgl_order($tgl_order): void
{
$this->tgl_order = $tgl_order;
}
public function gettgl_awal()
{
return $this->tgl_awal;
}
public function settgl_akhir($tgl_akhir): void
{
$this->tgl_akhir = $tgl_akhir;
}
public function gettgl_akhir()
{
return $this->tgl_akhir;
}
public function settgl_awal($tgl_awal): void
{
$this->tgl_awal = $tgl_awal;
}
}
@@ -0,0 +1,90 @@
<?php
namespace App\Models\Poct\Request;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class ListPemeriksaanResponse extends \stdClass
{
private $responseCode = "00";
private $responseMessage = "Success";
private $countData = "0";
private $responseData = array(
"pasien_id" => "",
"pasien_norm" => "",
"pasien_ruangan" => "",
"pasien_last_up_date" => "",
"result_id" => "",
"result_test_name" => "",
"result_value" => "",
"result_unit" => "",
"result_normal_flag" => "",
"result_speciment_date" => "",
"operator_first_name" => "",
"operator_last_name" => "",
);
public function __construct($response)
{
$has = get_object_vars($this);
foreach ($has as $name => $oldValue) {
!array_key_exists($name, $response) ?: $this->$name = $response[$name];
}
}
public function toArray(): array
{
$has = get_object_vars($this);
$response = array();
foreach ($has as $name => $value) {
if (gettype($value) === 'object') {
$response[$name] = $value->toArray();
} else {
$response[$name] = $value;
}
}
return $response;
}
public function getresponseCode()
{
return $this->responseCode;
}
public function setresponseCode($responseCode): void
{
$this->responseCode = $responseCode;
}
public function getresponseMessage()
{
return $this->responseMessage;
}
public function setresponseMessage($responseMessage): void
{
$this->responseMessage = $responseMessage;
}
public function getcountData()
{
return $this->countData;
}
public function setcountData($countData): void
{
$this->countData = $countData;
}
public function getresponseData(): Collection
{
return collect($this->responseData);
}
public function setresponseData($responseData): void
{
$this->responseData = $responseData;
}
}
+17
View File
@@ -0,0 +1,17 @@
<?php
namespace App\Models\Poct;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Results extends Model
{
use HasFactory;
protected $connection = 'sqlsrv';
protected $table = 'Result';
public function operators(){
return $this->hasMany(Operators::class,'OperatorID', 'OperatorID');
}
}
@@ -0,0 +1,68 @@
<?php
/**
* Created by PhpStorm.
* User: USER
* Date: 11/05/2024
* Time: 13:07
*/
namespace App\Models\Qris\v1;
class QrisJatimCheckStatusQrisRequest extends \stdClass
{
private $username = "";
private $password = "";
private $invoice_number = "";
public function __construct($response)
{
$has = get_object_vars($this);
foreach ($has as $name => $oldValue) {
!array_key_exists($name, $response) ?: $this->$name = $response[$name];
}
}
public function toArray(): array
{
$has = get_object_vars($this);
$response = array();
foreach ($has as $name => $value) {
if (gettype($value) === 'object') {
$response[$name] = $value->toArray();
} else {
$response[$name] = $value;
}
}
return $response;
}
public function getusername()
{
return $this->username;
}
public function setusername($username): void
{
$this->username = $username;
}
public function getpassword()
{
return $this->password;
}
public function setpassword($password): void
{
$this->password = $password;
}
public function getinvoice_number()
{
return $this->invoice_number;
}
public function setinvoice_number($invoice_number): void
{
$this->invoice_number = $invoice_number;
}
}
@@ -0,0 +1,135 @@
<?php
/**
* Created by PhpStorm.
* User: ITKOM-EFFENDY
* Date: 01/04/2024
* Time: 14:48
*/
namespace App\Models\Qris\v1;
class QrisJatimGenerateRequest extends \stdClass
{
private $merchantPan = "";
private $hashcodeKey = "";
private $billNumber = "";
private $purposetrx = "";
private $storelabel = "";
private $customerlabel = "";
private $terminalUser = "";
private $amount = "";
private $expiredDate = "";
public function __construct($response)
{
$has = get_object_vars($this);
foreach ($has as $name => $oldValue) {
!array_key_exists($name, $response) ?: $this->$name = $response[$name];
}
}
public function toArray(): array
{
$has = get_object_vars($this);
$response = array();
foreach ($has as $name => $value) {
if (gettype($value) === 'object') {
$response[$name] = $value->toArray();
} else {
$response[$name] = $value;
}
}
return $response;
}
public function getmerchantPan()
{
return $this->merchantPan;
}
public function setmerchantPan($merchantPan): void
{
$this->merchantPan = $merchantPan;
}
public function gethashcodeKey()
{
return $this->hashcodeKey;
}
public function sethashcodeKey($hashcodeKey): void
{
$this->hashcodeKey = $hashcodeKey;
}
public function getbillNumber()
{
return $this->billNumber;
}
public function setbillNumber($billNumber): void
{
$this->billNumber = $billNumber;
}
public function getpurposetrx()
{
return $this->purposetrx;
}
public function setpurposetrx($purposetrx): void
{
$this->purposetrx = $purposetrx;
}
public function getstorelabel()
{
return $this->storelabel;
}
public function setstorelabel($storelabel): void
{
$this->storelabel = $storelabel;
}
public function getcustomerlabel()
{
return $this->customerlabel;
}
public function setcustomerlabel($customerlabel): void
{
$this->customerlabel = $customerlabel;
}
public function getterminalUser()
{
return $this->terminalUser;
}
public function setterminalUser($terminalUser): void
{
$this->terminalUser = $terminalUser;
}
public function getexpiredDate()
{
return $this->expiredDate;
}
public function setexpiredDate($expiredDate): void
{
$this->expiredDate = $expiredDate;
}
public function getamount()
{
return $this->amount;
}
public function setamount($amount): void
{
$this->amount = $amount;
}
}
@@ -0,0 +1,189 @@
<?php
/**
* Created by PhpStorm.
* User: ITKOM-EFFENDY
* Date: 01/04/2024
* Time: 14:48
*/
namespace App\Models\Qris\v1;
class QrisJatimGenerateResponse extends \stdClass
{
private $responseCode = '00';
private $totalAmount = '';
private $qrValue = '';
private $amount = '';
private $expiredDate = '';
private $nmid = '';
private $billNumber = '';
private $merchantPan = '';
private $invoiceNumber = '';
private $status = '';
private $merchantName = '';
public function __construct($response = null)
{
if ($response !== null) {
$has = get_object_vars($this);
foreach ($has as $name => $oldValue) {
!array_key_exists($name, $response) ?: $this->{'set' . $name}($response[$name]);
}
}
}
public function toArray()
{
$has = get_object_vars($this);
$response = array();
foreach ($has as $name => $value) {
$response[$name] = $value;
}
return $response;
}
public function getresponseCode()
{
return $this->responseCode;
}
/**
* @param mixed $responseCode
*/
public function setresponseCode($responseCode): void
{
$this->responseCode = $responseCode;
}
public function gettotalAmount()
{
return $this->totalAmount;
}
/**
* @param mixed $totalAmount
*/
public function settotalAmount($totalAmount): void
{
$this->totalAmount = $totalAmount;
}
public function getqrValue()
{
return $this->qrValue;
}
/**
* @param mixed $qrValue
*/
public function setqrValue($qrValue): void
{
$this->qrValue = $qrValue;
}
public function getamount()
{
return $this->amount;
}
/**
* @param mixed $amount
*/
public function setamount($amount): void
{
$this->amount = $amount;
}
public function getexpiredDate()
{
return $this->expiredDate;
}
/**
* @param mixed $expiredDate
*/
public function setexpiredDate($expiredDate): void
{
$this->expiredDate = $expiredDate;
}
public function getnmid()
{
return $this->nmid;
}
/**
* @param mixed $nmid
*/
public function setnmid($nmid): void
{
$this->nmid = $nmid;
}
public function getbillNumber()
{
return $this->billNumber;
}
/**
* @param mixed $billNumber
*/
public function setbillNumber($billNumber): void
{
$this->billNumber = $billNumber;
}
public function getmerchantPan()
{
return $this->merchantPan;
}
/**
* @param mixed $merchantPan
*/
public function setmerchantPan($merchantPan): void
{
$this->merchantPan = $merchantPan;
}
public function getinvoiceNumber()
{
return $this->invoiceNumber;
}
/**
* @param mixed $invoiceNumber
*/
public function setinvoiceNumber($invoiceNumber): void
{
$this->invoiceNumber = $invoiceNumber;
}
public function getstatus()
{
return $this->status;
}
/**
* @param mixed $status
*/
public function setstatus($status): void
{
$this->status = $status;
}
public function getmerchantName()
{
return $this->merchantName;
}
/**
* @param mixed $merchantName
*/
public function setmerchantName($merchantName): void
{
$this->merchantName = $merchantName;
}
}
@@ -0,0 +1,149 @@
<?php
/**
* Created by PhpStorm.
* User: USER
* Date: 13/05/2024
* Time: 10:47
*/
namespace App\Models\Qris\v1;
class QrisJatimPaymentRequest extends \stdClass
{
private $billNumber = "";
private $purposetrx = "";
private $storelabel = "";
private $customerlabel = "";
private $terminalUser = "";
private $amount = "";
private $core_reference = "";
private $merchantPan = "";
private $pjsp = "";
private $invoice_number = "";
private $transactionDate = "";
public function __construct($response)
{
$has = get_object_vars($this);
foreach ($has as $name => $oldValue) {
!array_key_exists($name, $response) ?: $this->$name = $response[$name];
}
}
public function toArray(): array
{
$has = get_object_vars($this);
$response = array();
foreach ($has as $name => $value) {
if (gettype($value) === 'object') {
$response[$name] = $value->toArray();
} else {
$response[$name] = $value;
}
}
return $response;
}
public function getbillNumber()
{
return $this->billNumber;
}
public function setbillNumber($billNumber): void
{
$this->billNumber = $billNumber;
}
public function getpurposetrx()
{
return $this->purposetrx;
}
public function setpurposetrx($purposetrx): void
{
$this->purposetrx = $purposetrx;
}
public function getstorelabel()
{
return $this->storelabel;
}
public function setstorelabel($storelabel): void
{
$this->storelabel = $storelabel;
}
public function getcustomerlabel()
{
return $this->customerlabel;
}
public function setcustomerlabel($customerlabel): void
{
$this->customerlabel = $customerlabel;
}
public function getterminalUser()
{
return $this->terminalUser;
}
public function setterminalUser($terminalUser): void
{
$this->terminalUser = $terminalUser;
}
public function getcore_reference()
{
return $this->core_reference;
}
public function setcore_reference($core_reference): void
{
$this->core_reference = $core_reference;
}
public function getcustomerPan()
{
return $this->customerPan;
}
public function setcustomerPan($customerPan): void
{
$this->customerPan = $customerPan;
}
public function getpjsp()
{
return $this->pjsp;
}
public function setpjsp($pjsp): void
{
$this->pjsp = $pjsp;
}
public function getinvoice_number()
{
return $this->invoice_number;
}
public function setinvoice_number($invoice_number): void
{
$this->invoice_number = $invoice_number;
}
public function gettransactionDate()
{
return $this->transactionDate;
}
public function settransactionDate($transactionDate): void
{
$this->transactionDate = $transactionDate;
}
}
@@ -0,0 +1,171 @@
<?php
/**
* Created by PhpStorm.
* User: USER
* Date: 13/05/2024
* Time: 10:56
*/
namespace App\Models\Qris\v1;
class QrisJatimPaymentResponse extends \stdClass
{
private $responsCode = "00";
private $responsDesc = "Success";
private $billNumber = "";
private $purposetrx = "";
private $storelabel = "";
private $customerlabel = "";
private $terminalUser = "";
private $amount = "";
private $core_reference = "";
private $customerPan = "";
private $merchantPan = "";
private $pjsp = "";
private $invoice_number = "";
private $transactionDate = "";
public function __construct($response)
{
$has = get_object_vars($this);
foreach ($has as $name => $oldValue) {
!array_key_exists($name, $response) ?: $this->$name = $response[$name];
}
}
public function toArray(): array
{
$has = get_object_vars($this);
$response = array();
foreach ($has as $name => $value) {
if (gettype($value) === 'object') {
$response[$name] = $value->toArray();
} else {
$response[$name] = $value;
}
}
return $response;
}
public function getresponsCode()
{
return $this->responsCode;
}
public function setresponsCode($responsCode): void
{
$this->responsCode = $responsCode;
}
public function getresponsDesc()
{
return $this->responsDesc;
}
public function setresponsDesc($responsDesc): void
{
$this->responsDesc = $responsDesc;
}
public function getpurposetrx()
{
return $this->purposetrx;
}
public function setpurposetrx($purposetrx): void
{
$this->purposetrx = $purposetrx;
}
public function getstorelabel()
{
return $this->storelabel;
}
public function setstorelabel($storelabel): void
{
$this->storelabel = $storelabel;
}
public function getcustomerlabel()
{
return $this->customerlabel;
}
public function setcustomerlabel($customerlabel): void
{
$this->customerlabel= $customerlabel;
}
public function getterminalUser()
{
return $this->terminalUser;
}
public function setterminalUser($terminalUser): void
{
$this->terminalUser = $terminalUser;
}
public function getamount()
{
return $this->amount;
}
public function setamount($amount): void
{
$this->amount= $amount;
}
public function gettransactionDate()
{
return $this->transactionDate;
}
public function settransactionDate($transactionDate): void
{
$this->transactionDate = $transactionDate;
}
public function getcore_reference ()
{
return $this->core_reference ;
}
public function setcore_reference ($core_reference ): void
{
$this->core_reference = $core_reference ;
}
public function getccustomerPan ()
{
return $this->customerPan ;
}
public function setcustomerPan ($customerPan ): void
{
$this->customerPan = $customerPan ;
}
public function getpjsp()
{
return $this->pjsp;
}
public function setpjsp($pjsp): void
{
$this->pjsp = $pjsp;
}
public function getinvoice_number()
{
return $this->invoice_number;
}
public function setinvoice_number($invoice_number): void
{
$this->invoice_number = $invoice_number;
}
}
+40
View File
@@ -0,0 +1,40 @@
<?php
namespace App\Models;
use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
class User extends Authenticatable
{
use HasFactory, Notifiable;
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'name', 'email', 'password',
];
/**
* The attributes that should be hidden for arrays.
*
* @var array
*/
protected $hidden = [
'password', 'remember_token',
];
/**
* The attributes that should be cast to native types.
*
* @var array
*/
protected $casts = [
'email_verified_at' => 'datetime',
];
}
@@ -0,0 +1,90 @@
<?php
/**
* Created by PhpStorm.
* User: USER
* Date: 14/05/2024
* Time: 10:00
*/
namespace App\Models\Va\v1;
class VirtualAccountJatimRequest extends \stdClass
{
private $VirtualAccount = "";
private $Nama = "";
private $Amount = "";
private $References = "";
private $Tanggal = "";
public function __construct($response)
{
$has = get_object_vars($this);
foreach ($has as $name => $oldValue) {
!array_key_exists($name, $response) ?: $this->$name = $response[$name];
}
}
public function toArray(): array
{
$has = get_object_vars($this);
$response = array();
foreach ($has as $name => $value) {
if (gettype($value) === 'object') {
$response[$name] = $value->toArray();
} else {
$response[$name] = $value;
}
}
return $response;
}
public function getVirtualAccount()
{
return $this->VirtualAccount;
}
public function setVirtualAccount($VirtualAccount): void
{
$this->VirtualAccount = $VirtualAccount;
}
public function getNama()
{
return $this->Nama;
}
public function setNama($Nama): void
{
$this->Nama = $Nama;
}
public function getAmount()
{
return $this->Amount;
}
public function setAmount($Amount): void
{
$this->Amount = $Amount;
}
public function getReferences()
{
return $this->References;
}
public function setReferences($References): void
{
$this->References = $References;
}
public function getTanggal()
{
return $this->Tanggal;
}
public function setTanggal($Tanggal): void
{
$this->Tanggal = $Tanggal;
}
}
@@ -0,0 +1,85 @@
<?php
/**
* Created by PhpStorm.
* User: USER
* Date: 14/05/2024
* Time: 10:07
*/
namespace App\Models\Va\v1;
class VirtualAccountJatimResponse extends \stdClass
{
private $VirtualAccount = "";
private $Amount = "";
private $Tanggal = "";
private $Status = array(
"IsError" => "False",
"ResponseCode" => "00",
"ErrorDesc" => "Success",
);
public function __construct($response)
{
$has = get_object_vars($this);
foreach ($has as $name => $oldValue) {
!array_key_exists($name, $response) ?: $this->$name = $response[$name];
}
}
public function toArray(): array
{
$has = get_object_vars($this);
$response = array();
foreach ($has as $name => $value) {
if (gettype($value) === 'object') {
$response[$name] = $value->toArray();
} else {
$response[$name] = $value;
}
}
return $response;
}
public function getVirtualAccount()
{
return $this->VirtualAccount;
}
public function setVirtualAccount($VirtualAccount): void
{
$this->VirtualAccount = $VirtualAccount;
}
public function getAmount()
{
return $this->Amount;
}
public function setAmount($Amount): void
{
$this->Amount = $Amount;
}
public function getTanggal()
{
return $this->Tanggal;
}
public function setTanggal($Tanggal): void
{
$this->Tanggal = $Tanggal;
}
public function getStatus(): Collection
{
return collect($this->Status);
}
public function setStatus($Staus): void
{
$this->Status = $Staus;
}
}
+28
View File
@@ -0,0 +1,28 @@
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
/**
* Register any application services.
*
* @return void
*/
public function register()
{
//
}
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
//
}
}
+30
View File
@@ -0,0 +1,30 @@
<?php
namespace App\Providers;
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
use Illuminate\Support\Facades\Gate;
class AuthServiceProvider extends ServiceProvider
{
/**
* The policy mappings for the application.
*
* @var array
*/
protected $policies = [
// 'App\Model' => 'App\Policies\ModelPolicy',
];
/**
* Register any authentication / authorization services.
*
* @return void
*/
public function boot()
{
$this->registerPolicies();
//
}
}
@@ -0,0 +1,21 @@
<?php
namespace App\Providers;
use Illuminate\Support\Facades\Broadcast;
use Illuminate\Support\ServiceProvider;
class BroadcastServiceProvider extends ServiceProvider
{
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
Broadcast::routes();
require base_path('routes/channels.php');
}
}
+32
View File
@@ -0,0 +1,32 @@
<?php
namespace App\Providers;
use Illuminate\Auth\Events\Registered;
use Illuminate\Auth\Listeners\SendEmailVerificationNotification;
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
use Illuminate\Support\Facades\Event;
class EventServiceProvider extends ServiceProvider
{
/**
* The event listener mappings for the application.
*
* @var array
*/
protected $listen = [
Registered::class => [
SendEmailVerificationNotification::class,
],
];
/**
* Register any events for your application.
*
* @return void
*/
public function boot()
{
//
}
}
+52
View File
@@ -0,0 +1,52 @@
<?php
namespace App\Providers;
use Illuminate\Cache\RateLimiting\Limit;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\RateLimiter;
use Illuminate\Support\Facades\Route;
class RouteServiceProvider extends ServiceProvider
{
/**
* The path to the "home" route for your application.
*
* This is used by Laravel authentication to redirect users after login.
*
* @var string
*/
public const HOME = '/home';
/**
* Define your route model bindings, pattern filters, etc.
*
* @return void
*/
public function boot()
{
$this->configureRateLimiting();
$this->routes(function () {
Route::middleware('web')
->group(base_path('routes/web.php'));
Route::prefix('api')
->middleware('api')
->group(base_path('routes/api.php'));
});
}
/**
* Configure the rate limiters for the application.
*
* @return void
*/
protected function configureRateLimiting()
{
RateLimiter::for('api', function (Request $request) {
return Limit::perMinute(60);
});
}
}
@@ -0,0 +1,67 @@
<?php
namespace App\Services\Poct;
use App\Models\Poct\Patients;
use App\Models\Poct\Request\ListPemeriksaanRequest;
use App\Models\Poct\Request\ListPemeriksaanResponse;
use Illuminate\Support\Facades\DB;
class ListPemeriksaanService
{
public function fetchPemeriksaan(ListPemeriksaanRequest $data, ListPemeriksaanResponse $result, $flag)
{
if ($flag == 'list') {
$list_pemeriksaan = DB::connection('sqlsrv')->table('Patient')
->select('Patient.ID as pasien_id', 'Patient.Lab_PatientID as pasien_norm', 'Patient.Location as pasien_ruangan', 'Patient.lastUpdDatetime as pasien_last_up_date', 'Result.ID as result_id',
'Result.UnivTestName as result_test_name', 'Result.RValue as result_value', 'Result.Unit as result_unit', 'Result.ANormalFlag as result_normal_flag',
'Result.TestEndDate as result_speciment_date', 'Operator.FirstName as operator_first_name', 'Operator.LastName as operator_last_name')
->leftJoin('Result', 'Result._PID', '=', 'Patient.ID')
->leftJoin('Operator', 'Operator.OperatorID', '=', 'Result.OperatiorID')
->whereNotNull('Result.RValue')
->whereRaw('LEN(Patient.Lab_PatientID) >= 10')
->where(DB::raw("(convert(date,Result.TestEndDate))"), "=", $data->gettgl_order())
->orderBy('Result.TestEndDate', 'DESC')
->orderBy('Patient.Lab_PatientID', 'DESC')
->get();
} else {
$list_pemeriksaan = DB::connection('sqlsrv')->table('Patient')
->select('Patient.ID as pasien_id', 'Patient.Lab_PatientID as pasien_norm', 'Patient.Location as pasien_ruangan', 'Patient.lastUpdDatetime as pasien_last_up_date', 'Result.ID as result_id',
'Result.UnivTestName as result_test_name', 'Result.RValue as result_value', 'Result.Unit as result_unit', 'Result.ANormalFlag as result_normal_flag',
'Result.TestEndDate as result_speciment_date', 'Operator.FirstName as operator_first_name', 'Operator.LastName as operator_last_name')
->leftJoin('Result', 'Result._PID', '=', 'Patient.ID')
->leftJoin('Operator', 'Operator.OperatorID', '=', 'Result.OperatiorID')
->whereNotNull('Result.RValue')
->whereRaw('LEN(Patient.Lab_PatientID) >= 10')
->where(DB::raw("(convert(date,Result.TestEndDate))"), ">=", $data->gettgl_awal())
->where(DB::raw("(convert(date,Result.TestEndDate))"), "<=", $data->gettgl_akhir())
->orderBy('Result.TestEndDate', 'DESC')
->orderBy('Patient.Lab_PatientID', 'DESC')
->get();
}
if (count($list_pemeriksaan) > 0) {
$result->setcountData(count($list_pemeriksaan));
$data = [];
foreach ($list_pemeriksaan as $ind => $item) {
$data[$ind]['pasien_id'] = $item->pasien_id;
$data[$ind]['pasien_norm'] = $item->pasien_norm;
$data[$ind]['pasien_ruangan'] = $item->pasien_ruangan;
$data[$ind]['pasien_last_up_date'] = $item->pasien_last_up_date;
$data[$ind]['result_id'] = $item->result_id;
$data[$ind]['result_test_name'] = $item->result_test_name;
$data[$ind]['result_value'] = $item->result_value;
$data[$ind]['result_unit'] = $item->result_unit;
$data[$ind]['result_normal_flag'] = $item->result_normal_flag;
$data[$ind]['result_speciment_date'] = $item->result_speciment_date;
$data[$ind]['operator_first_name'] = $item->operator_first_name;
$data[$ind]['operator_last_name'] = $item->operator_last_name;
}
$result->setresponseData($data);
} else {
$result->setresponseCode("01");
$result->setresponseMessage("Data Pemeriksaan Tidak Ditemukan!");
}
return $result;
}
}
+100
View File
@@ -0,0 +1,100 @@
<?php
namespace App\Services\Qris\v1;
use App\Models\PaymentBank;
use App\Models\PaymentJatimLogs;
use App\Models\Qris\v1\QrisJatimPaymentRequest;
use App\Models\Qris\v1\QrisJatimPaymentResponse;
use GuzzleHttp\Client;
use GuzzleHttp\Exception\RequestException;
class QrisJatimService
{
protected $settings;
protected $defaultHeaders = [];
public function __construct()
{
$this->settings = array(
'apiUrl' => env('BANK_JATIM_URL', 'https://jatimva.bankjatim.co.id/'),
'merchant' => env('BANK_JATIM_MERCHANT', '9360011400001347721'),
'hashcode' => env('BANK_JATIM_HASCODE', 'Y1MACZ4B5R'),
'terminalUser' => env('BANK_JATIM_TERMINAL_USER', 'ID2024310949969'),
'username' => env('BANK_JATIM_USERNAME', 'ID2024310949969'),
'password' => env('BANK_JATIM_PASSWORD', 'ID2024310949969'),
);
$this->defaultHeaders = [
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Origin' => request()->getHost(),
];
$configs = [
'base_uri' => $this->settings['apiUrl'],
'headers' => $this->defaultHeaders,
];
$this->client = new Client($configs);
}
public function generateApiQris($data)
{
$aa = "";
try {
$request = $this->client->post('/MC/Qris/Dynamic', [
'json' => $aa
]);
$response = json_decode($request->getBody()->getContents());
} catch (RequestException $e) {
dd($e);
$response = json_decode($e->getResponse()->getBody()->getContents());
// $this->log('va/status', $data, $e->getResponse()->getBody()->getContents());
}
return $response;
}
public function checkStatusQrisPayment($data)
{
try {
$request = $this->client->post('/MC/PaymentQr', [
'json' => $data
]);
$response = json_decode($request->getBody()->getContents());
} catch (RequestException $e) {
$response = json_decode($e->getResponse()->getBody()->getContents());
}
return $response;
}
public function updateQris(QrisJatimPaymentRequest $data, QrisJatimPaymentResponse $result)
{
$pembayaran = PaymentBank::where('invoice_number', $data->getinvoice_number())->first();
if (!$pembayaran){
$result->setresponsCode("01");
$result->setresponsDesc("Data Pembayaran Qris tidak ditemukan!");
}else{
if ($pembayaran->payment_status == 1) {
$pembayaran->payment_status = 2;
$pembayaran->save();
}else{
$result->setresponsCode("01");
$result->setresponsDesc("Data Pembayaran Qris telah terkonfirmasi!");
}
}
return $result;
}
public function log($type, $request, $response)
{
$log = PaymentJatimLogs::create([
'type' => $type,
'request' => json_encode($request),
'response' => json_encode($response),
]);
return $log;
}
}
+22
View File
@@ -0,0 +1,22 @@
<?php
namespace App\Services;
class RouteService
{
public function isProduction()
{
return env('APP_ENV') === 'production';
}
public function isStaging()
{
return env('APP_ENV') === 'staging';
}
public function getPaymentsSubdomain()
{
$domain = request()->getHost();
return $domain;
}
}
@@ -0,0 +1,129 @@
<?php
/**
* Created by PhpStorm.
* User: USER
* Date: 14/05/2024
* Time: 9:43
*/
namespace App\Services\Va\v1;
use App\Models\PaymentJatimLogs;
use App\Models\PaymentVirtualAccount;
use App\Models\PaymentVirtualAccountDetail;
use App\Models\Va\v1\VirtualAccountJatimRequest;
use App\Models\Va\v1\VirtualAccountJatimResponse;
use GuzzleHttp\Client;
use Illuminate\Support\Facades\DB;
class VirtualAccountJatimService
{
protected $settings;
protected $defaultHeaders = [];
public function __construct()
{
$this->settings = array(
'apiUrl' => env('BANK_JATIM_URL', 'https://jatimva.bankjatim.co.id/'),
'merchant' => env('BANK_JATIM_MERCHANT', '9360011400001347721'),
'hashcode' => env('BANK_JATIM_HASCODE', 'Y1MACZ4B5R'),
'terminalUser' => env('BANK_JATIM_TERMINAL_USER', 'ID2024310949969'),
'username' => env('BANK_JATIM_USERNAME', 'ID2024310949969'),
'password' => env('BANK_JATIM_PASSWORD', 'ID2024310949969'),
);
$this->defaultHeaders = [
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Origin' => request()->getHost(),
];
$configs = [
'base_uri' => $this->settings['apiUrl'],
'headers' => $this->defaultHeaders,
];
$this->client = new Client($configs);
}
public function updatePayment(VirtualAccountJatimRequest $data, VirtualAccountJatimResponse $result)
{
DB::beginTransaction();
try{
$pembayaran = PaymentVirtualAccount::where('virtual_account', $data->getVirtualAccount())->first();
if (!$pembayaran) {
$result->setStatus(array(
"IsError" => "True",
"ResponseCode" => "01",
"ErrorDesc" => "Virtual Account Tidak Ditemukan!"
));
} else {
if ($pembayaran->flags_lunas == "F") {
$result->setStatus(array(
"IsError" => "True",
"ResponseCode" => "01",
"ErrorDesc" => "Tagihan anda telah lunas!"
));
} else {
if ($pembayaran->endpoint == "full") {
$pembayaran->bayar = $data->getAmount();
$pembayaran->flags_lunas = "F";
$pembayaran->save();
} else {
if ($data->getAmount() > $pembayaran->totalamount) {
$result->setStatus(array(
"IsError" => "True",
"ResponseCode" => "01",
"ErrorDesc" => "Nominal bayar melebihi jumlah tagihan!"
));
} else {
$sisa = $pembayaran->totalamount - $pembayaran->bayar;
if ($data->getAmount() > $sisa) {
$result->setStatus(array(
"IsError" => "True",
"ResponseCode" => "01",
"ErrorDesc" => "Nominal bayar melebihi sisa jumlah tagihan!"
));
} else {
$pembayaran->bayar = $pembayaran->bayar + $data->getAmount();
$pembayaran->flags_lunas = ($pembayaran->bayar == $pembayaran->totalamount) ? "F" : "O";
$pembayaran->save();
if (empty($pembayaran->bayar)){
$detail_sisa = $pembayaran->totalamount - $data->getAmount();
}else{
$detail_sisa = $pembayaran->totalamount - $pembayaran->bayar;
}
//insert history pembayaran partial
$detail = new PaymentVirtualAccountDetail();
$detail->payment_virtualaccount_id = $pembayaran->id;
$detail->nomr = $pembayaran->nomr;
$detail->idxdaftar = $pembayaran->idxdaftar;
$detail->bayar = $data->getAmount();
$detail->sisabayar = $detail_sisa;
$detail->save();
}
}
}
}
}
DB::commit();
}catch (\Exception $e){
DB::rollback();
}
return $result;
}
public function log($type, $request, $response)
{
$log = PaymentJatimLogs::create([
'type' => $type,
'request' => json_encode($request),
'response' => json_encode($response),
]);
return $log;
}
}