mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-26 07:53:58 +00:00
Voucherify Phase 2 minor update
This commit is contained in:
@@ -14,6 +14,9 @@ class CreateVoucherifyOrderObject implements DataTransferObject
|
||||
/** @var int */
|
||||
private $companyId;
|
||||
|
||||
/** @var int */
|
||||
private $transactionId;
|
||||
|
||||
/** @var float */
|
||||
private $amount;
|
||||
|
||||
@@ -27,14 +30,16 @@ class CreateVoucherifyOrderObject implements DataTransferObject
|
||||
* CreateVoucherifyOrderObject constructor.
|
||||
* @param User $employee
|
||||
* @param int $companyId
|
||||
* @param int $transactionId
|
||||
* @param float $amount
|
||||
* @param bool $isNoVoucher
|
||||
* @param bool $isTopUpWallet
|
||||
*/
|
||||
public function __construct(User $employee, int $companyId, float $amount, bool $isNoVoucher, bool $isTopUpWallet)
|
||||
public function __construct(User $employee, int $companyId, int $transactionId, float $amount, bool $isNoVoucher, bool $isTopUpWallet)
|
||||
{
|
||||
$this->employee = $employee;
|
||||
$this->companyId = $companyId;
|
||||
$this->transactionId = $transactionId;
|
||||
$this->amount = $amount;
|
||||
$this->isNoVoucher = $isNoVoucher;
|
||||
$this->isTopUpWallet = $isTopUpWallet;
|
||||
@@ -48,6 +53,14 @@ class CreateVoucherifyOrderObject implements DataTransferObject
|
||||
return $this->companyId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getTransactionId(): int
|
||||
{
|
||||
return $this->transactionId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return float
|
||||
*/
|
||||
|
||||
@@ -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;
|
||||
@@ -100,7 +100,7 @@ class BookingToVoucherifyProcessor
|
||||
$this->recordVoucherForUserInfo($user, $voucher);
|
||||
}
|
||||
else{
|
||||
$createVoucherifyOrderObject = new CreateVoucherifyOrderObject($user, $companyId, $amount, true, $transaction->type == TransactionType::TOP_UP);
|
||||
$createVoucherifyOrderObject = new CreateVoucherifyOrderObject($user, $companyId, $transaction->id, $amount, true, $transaction->type == TransactionType::TOP_UP);
|
||||
$createVoucherufyOrderResult = $this->createsVoucherifyOrder->execute($createVoucherifyOrderObject);
|
||||
|
||||
if($createVoucherufyOrderResult && isset($createVoucherufyOrderResult->id)){
|
||||
|
||||
@@ -31,6 +31,7 @@ class CreatesVoucherifyOrder
|
||||
{
|
||||
try {
|
||||
$orderObj = [
|
||||
"source_id" => $obj->getTransactionId(),
|
||||
"customer" => [
|
||||
"source_id" => $obj->getEmployee()->id,
|
||||
"name" => $obj->getEmployee()->name,
|
||||
|
||||
@@ -39,6 +39,7 @@ class RedeemsVoucherifyVoucher
|
||||
]
|
||||
],
|
||||
"order" => [
|
||||
"source_id" => $redeemVoucherifyVoucherObject->getTransactionId(),
|
||||
"amount" => $redeemVoucherifyVoucherObject->getAmount() * 100 //converting it to cents
|
||||
]
|
||||
]);
|
||||
|
||||
Reference in New Issue
Block a user