mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-19 04:23:55 +00:00
44 lines
990 B
PHP
44 lines
990 B
PHP
<?php
|
|
|
|
namespace App\Classes\Modules\Vouchers\Services\Voucherify;
|
|
|
|
use Illuminate\Support\Facades\Log;
|
|
use App\Classes\Modules\Vouchers\DataTransferObjects\UpdateVoucherifyOrderObject;
|
|
|
|
class UpdatesVoucherifyOrder
|
|
{
|
|
|
|
/** @var VoucherifyClient */
|
|
private $voucherifyClient;
|
|
|
|
|
|
/**
|
|
* UpdatesVoucherifyOrder constructor.
|
|
*
|
|
*/
|
|
public function __construct()
|
|
{
|
|
$this->voucherifyClient = createVoucherifyClient();
|
|
}
|
|
|
|
|
|
/**
|
|
* @param UpdateVoucherifyOrderObject $obj
|
|
* @return null|object
|
|
* @throws \Voucherify\ClientException
|
|
*/
|
|
public function execute(UpdateVoucherifyOrderObject $obj)
|
|
{
|
|
try {
|
|
$result = $this->voucherifyClient->orders->update([
|
|
"id" => $obj->getId(),
|
|
"status" => $obj->getStatus(),
|
|
]);
|
|
return $result;
|
|
} catch (\Voucherify\ClientException $e) {
|
|
Log::error($e);
|
|
return null;
|
|
}
|
|
}
|
|
}
|