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;
|
||||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Modules\Webstatement\Models\Atmcard;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Modules\Webstatement\Models\Atmcard;
|
||||
|
||||
class BiayaKartu implements ShouldQueue
|
||||
{
|
||||
@@ -31,6 +32,18 @@ class BiayaKartu implements ShouldQueue
|
||||
$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()
|
||||
{
|
||||
try {
|
||||
@@ -41,12 +54,15 @@ class BiayaKartu implements ShouldQueue
|
||||
while ($loop) {
|
||||
$cards = DB::connection('oracle')
|
||||
->table('IST77.VW_CMS_VCARD')
|
||||
->where('crsts', 1)
|
||||
->where('crsts', 1)
|
||||
->where('ACCFLAG','!=',null)
|
||||
->where('ACCFLAG', '>', 0)
|
||||
->skip($start)
|
||||
->take($limit)
|
||||
->get();
|
||||
|
||||
foreach ($cards as $card) {
|
||||
$accountInfo = $this->getAccountInfo($card->accflag);
|
||||
Atmcard::updateOrCreate([
|
||||
'crdno' => $card->crdno
|
||||
], [
|
||||
@@ -65,6 +81,8 @@ class BiayaKartu implements ShouldQueue
|
||||
'cttype' => $card->cttype,
|
||||
'ctdesc' => $card->ctdesc,
|
||||
'last_update' => $card->lastupdate,
|
||||
'branch' => $accountInfo->acctCompany,
|
||||
'currency' => $accountInfo->acctCurrency,
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user