feat(job): tambahkan fungsi untuk mendapatkan informasi akun
- Menambahkan metode getAccountInfo untuk mengambil informasi saldo akun dari layanan eksternal. - Memperbarui metode syncAtmCards untuk menyertakan informasi cabang dan mata uang dari akun yang disinkronkan.
This commit is contained in:
@@ -3,12 +3,13 @@
|
|||||||
namespace Modules\Webstatement\Jobs;
|
namespace Modules\Webstatement\Jobs;
|
||||||
|
|
||||||
use Illuminate\Bus\Queueable;
|
use Illuminate\Bus\Queueable;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
use Illuminate\Support\Facades\Http;
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
use Illuminate\Queue\InteractsWithQueue;
|
use Illuminate\Queue\InteractsWithQueue;
|
||||||
|
use Modules\Webstatement\Models\Atmcard;
|
||||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||||
use Illuminate\Foundation\Bus\Dispatchable;
|
use Illuminate\Foundation\Bus\Dispatchable;
|
||||||
use Illuminate\Support\Facades\DB;
|
|
||||||
use Modules\Webstatement\Models\Atmcard;
|
|
||||||
|
|
||||||
class BiayaKartu implements ShouldQueue
|
class BiayaKartu implements ShouldQueue
|
||||||
{
|
{
|
||||||
@@ -31,6 +32,18 @@ class BiayaKartu implements ShouldQueue
|
|||||||
$this->syncAtmCards();
|
$this->syncAtmCards();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getAccountInfo($accountNumber){
|
||||||
|
$url = $_ENV['FIORANO_URL'].'/restgateway/services/IGATEToCoreBankingServices';
|
||||||
|
$path = '/InquiryBalanceService';
|
||||||
|
$data = [
|
||||||
|
'accountNo' => $accountNumber
|
||||||
|
];
|
||||||
|
|
||||||
|
$response = Http::post($url.$path, $data);
|
||||||
|
|
||||||
|
return $response->json();
|
||||||
|
}
|
||||||
|
|
||||||
function syncAtmCards()
|
function syncAtmCards()
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
@@ -41,12 +54,15 @@ class BiayaKartu implements ShouldQueue
|
|||||||
while ($loop) {
|
while ($loop) {
|
||||||
$cards = DB::connection('oracle')
|
$cards = DB::connection('oracle')
|
||||||
->table('IST77.VW_CMS_VCARD')
|
->table('IST77.VW_CMS_VCARD')
|
||||||
->where('crsts', 1)
|
->where('crsts', 1)
|
||||||
|
->where('ACCFLAG','!=',null)
|
||||||
|
->where('ACCFLAG', '>', 0)
|
||||||
->skip($start)
|
->skip($start)
|
||||||
->take($limit)
|
->take($limit)
|
||||||
->get();
|
->get();
|
||||||
|
|
||||||
foreach ($cards as $card) {
|
foreach ($cards as $card) {
|
||||||
|
$accountInfo = $this->getAccountInfo($card->accflag);
|
||||||
Atmcard::updateOrCreate([
|
Atmcard::updateOrCreate([
|
||||||
'crdno' => $card->crdno
|
'crdno' => $card->crdno
|
||||||
], [
|
], [
|
||||||
@@ -65,6 +81,8 @@ class BiayaKartu implements ShouldQueue
|
|||||||
'cttype' => $card->cttype,
|
'cttype' => $card->cttype,
|
||||||
'ctdesc' => $card->ctdesc,
|
'ctdesc' => $card->ctdesc,
|
||||||
'last_update' => $card->lastupdate,
|
'last_update' => $card->lastupdate,
|
||||||
|
'branch' => $accountInfo->acctCompany,
|
||||||
|
'currency' => $accountInfo->acctCurrency,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user