fix: prevent duplicate homepage financing records and update API and login configuration

This commit is contained in:
nurafrinaalimi16
2026-09-22 10:55:45 +08:00
parent a966026036
commit 602bd4cd02
8 changed files with 484 additions and 42 deletions
+4 -28
View File
@@ -3,9 +3,9 @@
namespace App\Http\Controllers;
use App\Services\PembiayaanService;
use App\Services\CustomerInfoService;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Http;
class HomeController extends Controller
{
@@ -31,16 +31,7 @@ class HomeController extends Controller
$homeUrl = route('home');
$authUser = Auth::user();
$responses = Http::pool(fn ($pool) => [
$pool->withOptions(['verify' => config('app.api_verify')])
->get(config('api.url') . '/portal/customer/info', ['ic' => $authUser['icno']]),
$pool->withOptions(['verify' => config('app.api_verify')])
->get(config('api.url_koop') . '/portal/customer/info', ['ic' => $authUser['icno']]),
]);
$customer_pkb = $responses[0]->json();
$customer_koop = $responses[1]->json();
[$customer_pkb, $customer_koop] = CustomerInfoService::get($authUser['icno']);
$customerLelong = $this->getCustomerInfoLelong($authUser['icno']);
@@ -82,16 +73,7 @@ class HomeController extends Controller
$authUser = Auth::user();
$responses = Http::pool(fn ($pool) => [
$pool->withOptions(['verify' => config('app.api_verify')])
->get(config('api.url') . '/portal/customer/info', ['ic' => $authUser['icno']]),
$pool->withOptions(['verify' => config('app.api_verify')])
->get(config('api.url_koop') . '/portal/customer/info', ['ic' => $authUser['icno']]),
]);
$customer_pkb = $responses[0]->json();
$customer_koop = $responses[1]->json();
[$customer_pkb, $customer_koop] = CustomerInfoService::get($authUser['icno']);
$customerLelong = $this->getCustomerInfoLelong($authUser['icno']);
@@ -124,13 +106,7 @@ class HomeController extends Controller
}
private function getCustomerInfoLelong($icno){
$customerLelong = Http::withOptions(['verify' => config('app.api_verify')])
->get(config('api.url') . '/portal/customer/info/lelong', ['ic' => $icno])
->json();
$customerLelongKoop = Http::withOptions(['verify' => config('app.api_verify')])
->get(config('api.url_koop') . '/portal/customer/info/lelong', ['ic' => $icno])
->json();
[$customerLelong, $customerLelongKoop] = CustomerInfoService::get($icno, '/portal/customer/info/lelong');
// Extract data with null safety
$bakiLelong = isset($customerLelong['success']) && $customerLelong['success']
@@ -3,6 +3,7 @@
namespace App\Http\Controllers;
use App\Models\CompanyStatus;
use App\Services\CustomerInfoService;
use App\Models\LelongBid;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
@@ -31,8 +32,7 @@ class InformationController extends Controller
{
$auth_user = Auth::User();
$customer_pkb = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') .'/portal/customer/info',['ic' => $auth_user['icno']])->json();
$customer_koop = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url_koop') .'/portal/customer/info',['ic' => $auth_user['icno']])->json();
[$customer_pkb, $customer_koop] = CustomerInfoService::get($auth_user['icno']);
$pembiayaansemasa = [];
if(isset($customer_pkb['gadai'])){
@@ -98,8 +98,7 @@ class InformationController extends Controller
{
$auth_user = Auth::User();
$customer_pkb = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') .'/portal/customer/info',['ic' => $auth_user['icno']])->json();
$customer_koop = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url_koop') .'/portal/customer/info',['ic' => $auth_user['icno']])->json();
[$customer_pkb, $customer_koop] = CustomerInfoService::get($auth_user['icno']);
$melebihi6bulan = [];
@@ -138,8 +137,7 @@ class InformationController extends Controller
{
$auth_user = Auth::User();
$customer_pkb = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') .'/portal/customer/info',['ic' => $auth_user['icno']])->json();
$customer_koop = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url_koop') .'/portal/customer/info',['ic' => $auth_user['icno']])->json();
[$customer_pkb, $customer_koop] = CustomerInfoService::get($auth_user['icno']);
$lelong = [];
if(isset($customer_pkb['lelong'])){
+1 -1
View File
@@ -133,7 +133,7 @@ class TacController extends Controller
$mobileno = '6' . $customer['telefon'];
$messages = 'AR-RAHN PKB PORTAL : TAC: ' . $tac_token . ' ' . $currentDateTime . '. HUBUNGI AR-RAHN CARELINE CENTRE';
$messages = 'E-RAHN CLICK : TAC: ' . $tac_token . ' ' . $currentDateTime . '. HUBUNGI AR-RAHN CARELINE CENTRE';
$status = Http::get('http://gateway.onewaysms.com.my:10001/api.aspx',[
'apiusername' => 'APIUK330HDAFO',
+31
View File
@@ -0,0 +1,31 @@
<?php
namespace App\Services;
use Illuminate\Support\Facades\Http;
class CustomerInfoService
{
public static function get($icno, $endpoint = '/portal/customer/info')
{
$pkbUrl = rtrim(config('api.url'), '/');
$koopUrl = rtrim(config('api.url_koop'), '/');
// A shared API must only contribute once to the combined customer data.
$responses = Http::pool(function ($pool) use ($pkbUrl, $koopUrl, $icno, $endpoint) {
$requests = [
$pool->withOptions(['verify' => config('app.api_verify')])
->get($pkbUrl . $endpoint, ['ic' => $icno]),
];
if ($koopUrl !== $pkbUrl) {
$requests[] = $pool->withOptions(['verify' => config('app.api_verify')])
->get($koopUrl . $endpoint, ['ic' => $icno]);
}
return $requests;
});
return [$responses[0]->json(), isset($responses[1]) ? $responses[1]->json() : []];
}
}
Generated
+439 -2
View File
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "6f2f88da23604d0221c0bc1cfda5a55e",
"content-hash": "f9f41b5e43bf0d75aaf10acd9763feb5",
"packages": [
{
"name": "asm89/stack-cors",
@@ -62,6 +62,83 @@
},
"time": "2023-11-14T13:51:46+00:00"
},
{
"name": "barryvdh/laravel-dompdf",
"version": "v2.2.0",
"source": {
"type": "git",
"url": "https://github.com/barryvdh/laravel-dompdf.git",
"reference": "c96f90c97666cebec154ca1ffb67afed372114d8"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/barryvdh/laravel-dompdf/zipball/c96f90c97666cebec154ca1ffb67afed372114d8",
"reference": "c96f90c97666cebec154ca1ffb67afed372114d8",
"shasum": ""
},
"require": {
"dompdf/dompdf": "^2.0.7",
"illuminate/support": "^6|^7|^8|^9|^10|^11",
"php": "^7.2 || ^8.0"
},
"require-dev": {
"larastan/larastan": "^1.0|^2.7.0",
"orchestra/testbench": "^4|^5|^6|^7|^8|^9",
"phpro/grumphp": "^1 || ^2.5",
"squizlabs/php_codesniffer": "^3.5"
},
"type": "library",
"extra": {
"laravel": {
"aliases": {
"PDF": "Barryvdh\\DomPDF\\Facade\\Pdf",
"Pdf": "Barryvdh\\DomPDF\\Facade\\Pdf"
},
"providers": [
"Barryvdh\\DomPDF\\ServiceProvider"
]
},
"branch-alias": {
"dev-master": "2.0-dev"
}
},
"autoload": {
"psr-4": {
"Barryvdh\\DomPDF\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Barry vd. Heuvel",
"email": "barryvdh@gmail.com"
}
],
"description": "A DOMPDF Wrapper for Laravel",
"keywords": [
"dompdf",
"laravel",
"pdf"
],
"support": {
"issues": "https://github.com/barryvdh/laravel-dompdf/issues",
"source": "https://github.com/barryvdh/laravel-dompdf/tree/v2.2.0"
},
"funding": [
{
"url": "https://fruitcake.nl",
"type": "custom"
},
{
"url": "https://github.com/barryvdh",
"type": "github"
}
],
"time": "2024-04-25T13:16:04+00:00"
},
{
"name": "brick/math",
"version": "0.9.3",
@@ -499,6 +576,68 @@
],
"time": "2022-02-28T11:07:21+00:00"
},
{
"name": "dompdf/dompdf",
"version": "v2.0.8",
"source": {
"type": "git",
"url": "https://github.com/dompdf/dompdf.git",
"reference": "c20247574601700e1f7c8dab39310fca1964dc52"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/dompdf/dompdf/zipball/c20247574601700e1f7c8dab39310fca1964dc52",
"reference": "c20247574601700e1f7c8dab39310fca1964dc52",
"shasum": ""
},
"require": {
"ext-dom": "*",
"ext-mbstring": "*",
"masterminds/html5": "^2.0",
"phenx/php-font-lib": ">=0.5.4 <1.0.0",
"phenx/php-svg-lib": ">=0.5.2 <1.0.0",
"php": "^7.1 || ^8.0"
},
"require-dev": {
"ext-json": "*",
"ext-zip": "*",
"mockery/mockery": "^1.3",
"phpunit/phpunit": "^7.5 || ^8 || ^9",
"squizlabs/php_codesniffer": "^3.5"
},
"suggest": {
"ext-gd": "Needed to process images",
"ext-gmagick": "Improves image processing performance",
"ext-imagick": "Improves image processing performance",
"ext-zlib": "Needed for pdf stream compression"
},
"type": "library",
"autoload": {
"psr-4": {
"Dompdf\\": "src/"
},
"classmap": [
"lib/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"LGPL-2.1"
],
"authors": [
{
"name": "The Dompdf Community",
"homepage": "https://github.com/dompdf/dompdf/blob/master/AUTHORS.md"
}
],
"description": "DOMPDF is a CSS 2.1 compliant HTML to PDF converter",
"homepage": "https://github.com/dompdf/dompdf",
"support": {
"issues": "https://github.com/dompdf/dompdf/issues",
"source": "https://github.com/dompdf/dompdf/tree/v2.0.8"
},
"time": "2024-04-29T13:06:17+00:00"
},
{
"name": "dragonmantank/cron-expression",
"version": "v3.3.3",
@@ -2380,6 +2519,148 @@
],
"time": "2024-01-28T23:22:08+00:00"
},
{
"name": "masterminds/html5",
"version": "2.10.0",
"source": {
"type": "git",
"url": "https://github.com/Masterminds/html5-php.git",
"reference": "fcf91eb64359852f00d921887b219479b4f21251"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Masterminds/html5-php/zipball/fcf91eb64359852f00d921887b219479b4f21251",
"reference": "fcf91eb64359852f00d921887b219479b4f21251",
"shasum": ""
},
"require": {
"ext-dom": "*",
"php": ">=5.3.0"
},
"require-dev": {
"phpunit/phpunit": "^4.8.35 || ^5.7.21 || ^6 || ^7 || ^8 || ^9"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.7-dev"
}
},
"autoload": {
"psr-4": {
"Masterminds\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Matt Butcher",
"email": "technosophos@gmail.com"
},
{
"name": "Matt Farina",
"email": "matt@mattfarina.com"
},
{
"name": "Asmir Mustafic",
"email": "goetas@gmail.com"
}
],
"description": "An HTML5 parser and serializer.",
"homepage": "http://masterminds.github.io/html5-php",
"keywords": [
"HTML5",
"dom",
"html",
"parser",
"querypath",
"serializer",
"xml"
],
"support": {
"issues": "https://github.com/Masterminds/html5-php/issues",
"source": "https://github.com/Masterminds/html5-php/tree/2.10.0"
},
"time": "2025-07-25T09:04:22+00:00"
},
{
"name": "milon/barcode",
"version": "v12.0.0",
"source": {
"type": "git",
"url": "https://github.com/milon/barcode.git",
"reference": "252dc9a530c72454bc6cefb8d274c2acaba24f15"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/milon/barcode/zipball/252dc9a530c72454bc6cefb8d274c2acaba24f15",
"reference": "252dc9a530c72454bc6cefb8d274c2acaba24f15",
"shasum": ""
},
"require": {
"ext-gd": "*",
"illuminate/support": "^7.0|^8.0|^9.0|^10.0 | ^11.0 | ^12.0",
"php": "^7.3 | ^8.0"
},
"type": "library",
"extra": {
"laravel": {
"aliases": {
"DNS1D": "Milon\\Barcode\\Facades\\DNS1DFacade",
"DNS2D": "Milon\\Barcode\\Facades\\DNS2DFacade"
},
"providers": [
"Milon\\Barcode\\BarcodeServiceProvider"
]
}
},
"autoload": {
"psr-0": {
"Milon\\Barcode": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"LGPL-3.0"
],
"authors": [
{
"name": "Nuruzzaman Milon",
"email": "contact@milon.im"
}
],
"description": "Barcode generator like Qr Code, PDF417, C39, C39+, C39E, C39E+, C93, S25, S25+, I25, I25+, C128, C128A, C128B, C128C, 2-Digits UPC-Based Extention, 5-Digits UPC-Based Extention, EAN 8, EAN 13, UPC-A, UPC-E, MSI (Variation of Plessey code)",
"keywords": [
"CODABAR",
"CODE 128",
"CODE 39",
"barcode",
"datamatrix",
"ean",
"laravel",
"pdf417",
"qr code",
"qrcode"
],
"support": {
"issues": "https://github.com/milon/barcode/issues",
"source": "https://github.com/milon/barcode/tree/v12.0.0"
},
"funding": [
{
"url": "https://paypal.me/nuruzzamanmilon",
"type": "custom"
},
{
"url": "https://github.com/milon",
"type": "github"
}
],
"time": "2025-02-24T18:09:25+00:00"
},
{
"name": "moneyphp/money",
"version": "v3.3.3",
@@ -2946,6 +3227,96 @@
},
"time": "2022-01-27T09:35:39+00:00"
},
{
"name": "phenx/php-font-lib",
"version": "0.5.6",
"source": {
"type": "git",
"url": "https://github.com/dompdf/php-font-lib.git",
"reference": "a1681e9793040740a405ac5b189275059e2a9863"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/dompdf/php-font-lib/zipball/a1681e9793040740a405ac5b189275059e2a9863",
"reference": "a1681e9793040740a405ac5b189275059e2a9863",
"shasum": ""
},
"require": {
"ext-mbstring": "*"
},
"require-dev": {
"symfony/phpunit-bridge": "^3 || ^4 || ^5 || ^6"
},
"type": "library",
"autoload": {
"psr-4": {
"FontLib\\": "src/FontLib"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"LGPL-2.1-or-later"
],
"authors": [
{
"name": "Fabien Ménager",
"email": "fabien.menager@gmail.com"
}
],
"description": "A library to read, parse, export and make subsets of different types of font files.",
"homepage": "https://github.com/PhenX/php-font-lib",
"support": {
"issues": "https://github.com/dompdf/php-font-lib/issues",
"source": "https://github.com/dompdf/php-font-lib/tree/0.5.6"
},
"time": "2024-01-29T14:45:26+00:00"
},
{
"name": "phenx/php-svg-lib",
"version": "0.5.4",
"source": {
"type": "git",
"url": "https://github.com/dompdf/php-svg-lib.git",
"reference": "46b25da81613a9cf43c83b2a8c2c1bdab27df691"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/dompdf/php-svg-lib/zipball/46b25da81613a9cf43c83b2a8c2c1bdab27df691",
"reference": "46b25da81613a9cf43c83b2a8c2c1bdab27df691",
"shasum": ""
},
"require": {
"ext-mbstring": "*",
"php": "^7.1 || ^8.0",
"sabberworm/php-css-parser": "^8.4"
},
"require-dev": {
"phpunit/phpunit": "^7.5 || ^8.5 || ^9.5"
},
"type": "library",
"autoload": {
"psr-4": {
"Svg\\": "src/Svg"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"LGPL-3.0-or-later"
],
"authors": [
{
"name": "Fabien Ménager",
"email": "fabien.menager@gmail.com"
}
],
"description": "A library to read, parse and export to PDF SVG files.",
"homepage": "https://github.com/PhenX/php-svg-lib",
"support": {
"issues": "https://github.com/dompdf/php-svg-lib/issues",
"source": "https://github.com/dompdf/php-svg-lib/tree/0.5.4"
},
"time": "2024-04-08T12:52:34+00:00"
},
{
"name": "php-http/client-common",
"version": "2.7.1",
@@ -4301,6 +4672,72 @@
},
"time": "2024-03-20T08:49:53+00:00"
},
{
"name": "sabberworm/php-css-parser",
"version": "v8.9.0",
"source": {
"type": "git",
"url": "https://github.com/MyIntervals/PHP-CSS-Parser.git",
"reference": "d8e916507b88e389e26d4ab03c904a082aa66bb9"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/MyIntervals/PHP-CSS-Parser/zipball/d8e916507b88e389e26d4ab03c904a082aa66bb9",
"reference": "d8e916507b88e389e26d4ab03c904a082aa66bb9",
"shasum": ""
},
"require": {
"ext-iconv": "*",
"php": "^5.6.20 || ^7.0.0 || ~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.0"
},
"require-dev": {
"phpunit/phpunit": "5.7.27 || 6.5.14 || 7.5.20 || 8.5.41",
"rawr/cross-data-providers": "^2.0.0"
},
"suggest": {
"ext-mbstring": "for parsing UTF-8 CSS"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "9.0.x-dev"
}
},
"autoload": {
"psr-4": {
"Sabberworm\\CSS\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Raphael Schweikert"
},
{
"name": "Oliver Klee",
"email": "github@oliverklee.de"
},
{
"name": "Jake Hotson",
"email": "jake.github@qzdesign.co.uk"
}
],
"description": "Parser for CSS Files written in PHP",
"homepage": "https://www.sabberworm.com/blog/2010/6/10/php-css-parser",
"keywords": [
"css",
"parser",
"stylesheet"
],
"support": {
"issues": "https://github.com/MyIntervals/PHP-CSS-Parser/issues",
"source": "https://github.com/MyIntervals/PHP-CSS-Parser/tree/v8.9.0"
},
"time": "2025-07-11T13:20:48+00:00"
},
{
"name": "swiftmailer/swiftmailer",
"version": "v6.3.0",
@@ -9349,5 +9786,5 @@
"php": "^7.3|^8.0"
},
"platform-dev": [],
"plugin-api-version": "2.1.0"
"plugin-api-version": "2.3.0"
}
+2 -2
View File
@@ -1,5 +1,5 @@
<?php
return [
'url' => env('API_URL', 'https://api2.arrahn.com.my'),
'url_koop' => env('API_URL_KOOP', 'https://api3.arrahn.com.my'),
'url' => env('API_URL', 'http://api-annurv3.test'),
'url_koop' => env('API_URL_KOOP', 'http://api-annurv2.test'),
];
+2 -2
View File
@@ -38,13 +38,13 @@
}
</style>
<div class="marquee-div-container">
{{-- <div class="marquee-div-container">
<div class="marquee-container" style="overflow: hidden; white-space: nowrap;">
<div class="marquee-text marquee-text-display">
⚠️ Tuan/Puan diminta hadir ke cawangan Ar-Rahn bagi pembayaran keuntungan SAG terpilih kerana transaksi tidak dapat dilakukan melalui ArRahnPay buat sementara waktu susulan kerja penaiktarafan sistem ⚠️
</div>
</div>
</div>
</div> --}}
<div id="load-arrahn" class="d-none">
<div class="overlay-arrahn"></div>
@@ -39,7 +39,7 @@
<body class="sign-in-basic">
<div class="page-header align-items-start min-vh-100" style="background-color: #f4f6f9;" loading="lazy">
<div class="page-header align-items-start min-vh-100" style="background: linear-gradient(135deg, #1f9bb6, #5fc3d6, #a8e6f0);" loading="lazy">
<span class="mask bg-gradient-dark opacity-6"></span>
<div class="container my-auto">
<div class="row">