added cron
This commit is contained in:
@@ -40,11 +40,18 @@ class UpdateTransactionMaster extends Command
|
||||
public function handle()
|
||||
{
|
||||
$updateOnline = Http::arrahn()->get('/api/transaction/online/update')->json();
|
||||
|
||||
$updateOnline_Koop = Http::arrahn_koop()->get('/api/transaction/online/update')->json();
|
||||
|
||||
if($updateOnline == 'success'){
|
||||
return 0;
|
||||
}else{
|
||||
Log::error('Update transaction master failed');
|
||||
Log::error('PKB::Update transaction master failed');
|
||||
}
|
||||
|
||||
if($updateOnline_Koop == 'success'){
|
||||
return 0;
|
||||
}else{
|
||||
Log::error('KOOP::Update transaction master failed');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,9 +2,11 @@
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Models\CompanyStatus;
|
||||
use App\Models\TransactionOnlineStatus;
|
||||
use App\Services\BillplzService;
|
||||
use App\Services\OnlineTransactionLoggerService;
|
||||
use Billplz\Base\Bill;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
@@ -29,12 +31,21 @@ class UpdateUnsuccess extends Command
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function handle(BillplzService $billplzService)
|
||||
public function handle()
|
||||
{
|
||||
|
||||
$getFailedOnlineTransaction = fn() => Http::arrahn()->get('/api/transaction/online/unsuccessful')->json();
|
||||
|
||||
$getFailedOnlineTransaction_Koop = fn() => Http::arrahn_koop()->get('/api/transaction/online/unsuccessful')->json();
|
||||
|
||||
$FailedBillplzID = array_map(fn($x) => $x['billplz_id'], $getFailedOnlineTransaction());
|
||||
$FailedBillplzID_Koop = array_map(fn($x) => $x['billplz_id'], $getFailedOnlineTransaction_Koop());
|
||||
|
||||
$this->resolve_payment($FailedBillplzID,CompanyStatus::COM_PKB);
|
||||
$this->resolve_payment($FailedBillplzID_Koop,CompanyStatus::COM_KOOPPKB);
|
||||
|
||||
}
|
||||
public function resolve_payment($FailedBillplzID,$company)
|
||||
{
|
||||
$billplzService = new BillplzService($company);
|
||||
|
||||
if(sizeof($FailedBillplzID) < 0){
|
||||
return;
|
||||
@@ -59,7 +70,13 @@ class UpdateUnsuccess extends Command
|
||||
];
|
||||
|
||||
try {
|
||||
$response = Http::arrahn()->put('/api/transaction/online/unsuccesfull/update', $transactionData);
|
||||
|
||||
$CallableHttp = $company == CompanyStatus::COM_PKB
|
||||
? Http::arrahn()
|
||||
: Http::arrahn_koop();
|
||||
|
||||
$response = $CallableHttp->put('/api/transaction/online/unsuccesfull/update', $transactionData);
|
||||
|
||||
OnlineTransactionLoggerService::logs($transaction['bill_id'], $transactionData, $response, TransactionOnlineStatus::UPDATE_UNSUCCESSFUL_TRANSACTION );
|
||||
|
||||
} catch (\Exception $e) {
|
||||
|
||||
Reference in New Issue
Block a user