mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-19 04:23:55 +00:00
Insert voucherify order source id
This commit is contained in:
@@ -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
|
||||
*/
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user