Vourcherify

This commit is contained in:
Dillon
2023-05-30 22:02:09 +08:00
parent 44deab4542
commit 20d6ca47dc
39 changed files with 1102 additions and 35 deletions
@@ -0,0 +1,39 @@
<?php
namespace App\Classes\Modules\Vouchers\Services;
use ErrorException;
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 ErrorException
*/
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;
}
}
}