diff --git a/app/Classes/Modules/Vouchers/DataTransferObjects/RedeemVoucherifyVoucherObject.php b/app/Classes/Modules/Vouchers/DataTransferObjects/RedeemVoucherifyVoucherObject.php index 01f5431c..325df2f4 100644 --- a/app/Classes/Modules/Vouchers/DataTransferObjects/RedeemVoucherifyVoucherObject.php +++ b/app/Classes/Modules/Vouchers/DataTransferObjects/RedeemVoucherifyVoucherObject.php @@ -9,6 +9,9 @@ class RedeemVoucherifyVoucherObject implements DataTransferObject /** @var int */ private $companyId; + /** @var int */ + private $transactionId; + /** @var string */ private $promoCode; @@ -21,13 +24,15 @@ class RedeemVoucherifyVoucherObject implements DataTransferObject /** * RedeemVoucherifyVoucherObject constructor. * @param int $companyId + * @param int $transactionId * @param string $name * @param string $email * @param object $employee */ - public function __construct(int $companyId, string $promoCode, string $amount, object $employee) + public function __construct(int $companyId, int $transactionId, string $promoCode, string $amount, object $employee) { $this->companyId = $companyId; + $this->transactionId = $transactionId; $this->promoCode = $promoCode; $this->amount = $amount; $this->employee = $employee; @@ -42,6 +47,15 @@ class RedeemVoucherifyVoucherObject implements DataTransferObject } + /** + * @return int + */ + public function getTransactionId(): int + { + return $this->transactionId; + } + + /** * @return string */ diff --git a/app/Classes/Modules/Vouchers/Processors/Voucherify/BookingToVoucherifyProcessor.php b/app/Classes/Modules/Vouchers/Processors/Voucherify/BookingToVoucherifyProcessor.php index 5e31f2eb..323b2eaf 100644 --- a/app/Classes/Modules/Vouchers/Processors/Voucherify/BookingToVoucherifyProcessor.php +++ b/app/Classes/Modules/Vouchers/Processors/Voucherify/BookingToVoucherifyProcessor.php @@ -82,7 +82,7 @@ class BookingToVoucherifyProcessor $voucherify_customer_id = ""; $voucherify_order_id = ""; if($voucherCode){ - $redeemVoucherifyVoucherObject = new RedeemVoucherifyVoucherObject($companyId, $voucherCode, $amount, $user); + $redeemVoucherifyVoucherObject = new RedeemVoucherifyVoucherObject($companyId, $transaction->id, $voucherCode, $amount, $user); $redeemVoucherResult = $this->redeemsVoucherifyVoucher->execute($redeemVoucherifyVoucherObject); $redeemedVoucher = $redeemVoucherResult->voucher; $redemptionId = $redeemVoucherResult->id; diff --git a/app/Classes/Modules/Vouchers/Services/Voucherify/RedeemsVoucherifyVoucher.php b/app/Classes/Modules/Vouchers/Services/Voucherify/RedeemsVoucherifyVoucher.php index bd12e27f..3b8fe6ca 100644 --- a/app/Classes/Modules/Vouchers/Services/Voucherify/RedeemsVoucherifyVoucher.php +++ b/app/Classes/Modules/Vouchers/Services/Voucherify/RedeemsVoucherifyVoucher.php @@ -29,6 +29,7 @@ class RedeemsVoucherifyVoucher { try { $result = $this->voucherifyClient->redemptions->redeem($redeemVoucherifyVoucherObject->getPromoCode(), [ + "source_id" => $redeemVoucherifyVoucherObject->getTransactionId(), "customer" => [ "source_id" => $redeemVoucherifyVoucherObject->getEmployee()->id, "name" => $redeemVoucherifyVoucherObject->getEmployee()->name,