mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-19 04:23:55 +00:00
29 lines
906 B
PHP
29 lines
906 B
PHP
<?php
|
|
|
|
namespace App\Classes\Modules\Vouchers\Services;
|
|
|
|
use App\Classes\General\Eloquent\AbstractUpdateRelationshipRecord;
|
|
use App\Models\Transaction;
|
|
use App\Models\Voucher;
|
|
use App\Models\VoucherRedemption;
|
|
|
|
class CreatesVoucherRedemption extends AbstractUpdateRelationshipRecord
|
|
{
|
|
/**
|
|
* @param Transaction $transaction
|
|
* @param Voucher $voucher
|
|
* @param string $redemptionId
|
|
* @param float $value
|
|
* @return \Illuminate\Database\Eloquent\Model
|
|
* @throws \App\Classes\Exceptions\MalformedRequestException
|
|
*/
|
|
public function execute(Transaction $transaction, Voucher $voucher, string $redemptionId, float $value) {
|
|
$model = new VoucherRedemption();
|
|
$model->voucher_id = $voucher->id;
|
|
$model->redemption_id = $redemptionId;
|
|
$model->value = $value;
|
|
|
|
return $this->handler($transaction->voucherRedemption(), $model);
|
|
}
|
|
}
|