mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal.git
synced 2026-08-30 01:44:05 +00:00
58 lines
2.0 KiB
PHP
58 lines
2.0 KiB
PHP
<?php
|
|
|
|
namespace App\Classes\Jobs\Commands\V2;
|
|
|
|
use App\Classes\Modules\Jobs\DataTransferObjects\ShowBillplzPaymentStatusV2CommandObject;
|
|
use Carbon\Carbon;
|
|
use Illuminate\Bus\Queueable;
|
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
use Illuminate\Foundation\Bus\Dispatchable;
|
|
use Illuminate\Queue\InteractsWithQueue;
|
|
use Illuminate\Queue\SerializesModels;
|
|
use Illuminate\Support\Facades\Http;
|
|
use Illuminate\Support\Facades\Log;
|
|
|
|
class ShowBillplzPaymentStatusV2CommandJob implements ShouldQueue
|
|
{
|
|
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
|
|
|
|
|
/** @var ShowBillplzPaymentStatusV2CommandObject*/
|
|
private $showBillplzPaymentStatusV2CommandObject;
|
|
|
|
/**
|
|
* ShowBillplzPaymentStatusV2CommandJob constructor.
|
|
* @param ShowBillplzPaymentStatusV2CommandObject $showBillplzPaymentStatusV2CommandObject
|
|
*/
|
|
public function __construct(ShowBillplzPaymentStatusV2CommandObject $showBillplzPaymentStatusV2CommandObject)
|
|
{
|
|
$this->showBillplzPaymentStatusV2CommandObject = $showBillplzPaymentStatusV2CommandObject;
|
|
}
|
|
|
|
public function handle()
|
|
{
|
|
Log::info(Carbon::now() . ': Start job - Show Billplz payment status.');
|
|
$start = new Carbon();
|
|
|
|
// ini_set('memory_limit', '-1');
|
|
|
|
$billplz_id = $this->showBillplzPaymentStatusV2CommandObject->getBillplzId();
|
|
$billplz_id = explode(",", $billplz_id);
|
|
|
|
foreach ($billplz_id as $payment) {
|
|
$response = Http::withBasicAuth(config('billplz.api_key').':', '')->get(config('billplz.base_url').'/api/v3/bills/'.$payment);
|
|
if($response->successful()){
|
|
$data = $response->json();
|
|
dump($data);
|
|
}else{
|
|
Log::info("billplz error</br>");
|
|
}
|
|
}
|
|
|
|
|
|
$end = new Carbon();
|
|
$elapsedTime = $start->diff($end)->format('%H:%I:%S');
|
|
Log::info(Carbon::now() . ': End job - Show Billplz payment status. ElapsedTime: ' . $elapsedTime . '.');
|
|
}
|
|
}
|