Files
exchange-2.0/app/Classes/Modules/Vouchers/Services/RollbacksRedemption.php
T
2023-07-17 21:29:19 +08:00

39 lines
817 B
PHP

<?php
namespace App\Classes\Modules\Vouchers\Services;
use Illuminate\Support\Facades\Log;
class RollbacksRedemption
{
/** @var VoucherifyClient */
private $voucherifyClient;
/**
* RollbacksRedemption constructor.
*
*/
public function __construct()
{
$this->voucherifyClient = createVoucherifyClient();
}
/**
* @param string $redemptionId
* @return null|object
* @throws \Voucherify\ClientException
*/
public function execute(string $redemptionId)
{
try {
$result = $this->voucherifyClient->redemptions->rollback($redemptionId);
return $result;
} catch (\Voucherify\ClientException $e) {
Log::error('RollbacksRedemption error:' . $e);
return null;
}
}
}