mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-24 15:04:19 +00:00
API for Sales Invoice Report (autocount middleware)
This commit is contained in:
+16
-1
@@ -46,6 +46,9 @@ class UpdateRefundTransactionStatusProcessor
|
||||
/** @var CanUpdateRefundTransactionStatus */
|
||||
private $canUpdateRefundTransactionStatus;
|
||||
|
||||
/** @var CreateInvoiceTransactionV2Processor */
|
||||
private $createInvoiceTransactionV2Processor;
|
||||
|
||||
/**
|
||||
* UpdateRefundTransactionStatusProcessor constructor.
|
||||
* @param FetchesCompany $fetchesCompany
|
||||
@@ -57,8 +60,9 @@ class UpdateRefundTransactionStatusProcessor
|
||||
* @param CalculatesBookingRefundAmount $calculatesBookingRefundAmount
|
||||
* @param UpdateBookingAmountLogic $updateBookingAmountLogic
|
||||
* @param CanUpdateRefundTransactionStatus $canUpdateRefundTransactionStatus
|
||||
* @param CreateInvoiceTransactionV2Processor $createInvoiceTransactionV2Processor
|
||||
*/
|
||||
public function __construct(FetchesCompany $fetchesCompany, FetchesTransaction $fetchesTransaction, UpdatesTransactionStatus $updatesTransactionStatus, DeletesDocument $deletesDocument, CreditWalletProcessor $creditWalletProcessor, CalculatesBookingPayableAmount $calculatesBookingPayableAmount, CalculatesBookingRefundAmount $calculatesBookingRefundAmount, UpdateBookingAmountLogic $updateBookingAmountLogic, CanUpdateRefundTransactionStatus $canUpdateRefundTransactionStatus)
|
||||
public function __construct(FetchesCompany $fetchesCompany, FetchesTransaction $fetchesTransaction, UpdatesTransactionStatus $updatesTransactionStatus, DeletesDocument $deletesDocument, CreditWalletProcessor $creditWalletProcessor, CalculatesBookingPayableAmount $calculatesBookingPayableAmount, CalculatesBookingRefundAmount $calculatesBookingRefundAmount, UpdateBookingAmountLogic $updateBookingAmountLogic, CanUpdateRefundTransactionStatus $canUpdateRefundTransactionStatus, CreateInvoiceTransactionV2Processor $createInvoiceTransactionV2Processor)
|
||||
{
|
||||
$this->fetchesCompany = $fetchesCompany;
|
||||
$this->fetchesTransaction = $fetchesTransaction;
|
||||
@@ -69,6 +73,7 @@ class UpdateRefundTransactionStatusProcessor
|
||||
$this->calculatesBookingRefundAmount = $calculatesBookingRefundAmount;
|
||||
$this->updateBookingAmountLogic = $updateBookingAmountLogic;
|
||||
$this->canUpdateRefundTransactionStatus = $canUpdateRefundTransactionStatus;
|
||||
$this->createInvoiceTransactionV2Processor = $createInvoiceTransactionV2Processor;
|
||||
}
|
||||
|
||||
|
||||
@@ -125,5 +130,15 @@ class UpdateRefundTransactionStatusProcessor
|
||||
if (!$paidAmount > 0) {
|
||||
$this->updatesTransactionStatus->execute($paymentTransaction, ApprovalStatus::REFUNDED);
|
||||
}
|
||||
|
||||
//A full refund will need invoice generated
|
||||
if($refundAmount === $booking->fix_amount){
|
||||
$this->createInvoiceTransactionV2Processor->execute($booking, "", null, [
|
||||
'generateEInvoice' => false,
|
||||
'generateEInvoiceWithNormalInvoiceTemplate' => false,
|
||||
'generateEInvoiceRefund' => true,
|
||||
'bookingOriginalStatus' => $booking->status
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user