diff --git a/app/Classes/Modules/Accounting/ControllersLogic/UpdateBankStatementDetailLogic.php b/app/Classes/Modules/Accounting/ControllersLogic/UpdateBankStatementDetailLogic.php index 71e8ba41..d9eab3db 100644 --- a/app/Classes/Modules/Accounting/ControllersLogic/UpdateBankStatementDetailLogic.php +++ b/app/Classes/Modules/Accounting/ControllersLogic/UpdateBankStatementDetailLogic.php @@ -93,6 +93,10 @@ class UpdateBankStatementDetailLogic extends AbstractControllerLogic if (in_array($systemReference, ['exchange', 'izyim'])) { $transaction = $this->checksBillNumber->execute($transactionReference, $systemReference); + if (is_array($transaction) && empty($transaction)) { + throw new MalformedRequestException('Transaction Not Found.'); + } + if($systemReference === 'exchange') { $owner_type = Transaction::class; $owner_id = $transaction->id; @@ -112,8 +116,8 @@ class UpdateBankStatementDetailLogic extends AbstractControllerLogic $transactionType = $transaction['type']; if (($payFor === 'sales' && !in_array($transactionType, [ShippingTransactionType::PAYMENT, ShippingTransactionType::GROUP_PAYMENT])) - || ($payFor === 'top_up' && !in_array($transactionType, [ShippingTransactionType::TOP_UP]))) { - throw new Exception("Transaction Type does not match"); + || ($payFor === 'top_up' && !in_array($transactionType, [ShippingTransactionType::TOP_UP, ShippingTransactionType::GROUP_PAYMENT]))) { + throw new MalformedRequestException('Transaction Type does not match.'); } $owner_type = Transaction::class; diff --git a/app/Classes/Modules/Accounting/Processors/ChecksBillNumber.php b/app/Classes/Modules/Accounting/Processors/ChecksBillNumber.php index 0ac72cd2..adc5c7b1 100644 --- a/app/Classes/Modules/Accounting/Processors/ChecksBillNumber.php +++ b/app/Classes/Modules/Accounting/Processors/ChecksBillNumber.php @@ -20,11 +20,7 @@ class ChecksBillNumber $payload = $data['payload']; return $payload['data']; } catch (\Exception $exception) { - dd($exception->getMessage()); -// preg_match('/\{.*\}/s', $exception->getMessage(), $matches); -// $jsonError = json_decode($matches[0]); - // Retrieved Transactions failed -// throw new MalformedRequestException($jsonError->title); + throw new MalformedRequestException($exception->getMessage()); } } diff --git a/app/Classes/Modules/Exports/Services/ExportsInvoiceTransactions.php b/app/Classes/Modules/Exports/Services/ExportsInvoiceTransactions.php index eebcaad9..90780750 100644 --- a/app/Classes/Modules/Exports/Services/ExportsInvoiceTransactions.php +++ b/app/Classes/Modules/Exports/Services/ExportsInvoiceTransactions.php @@ -17,6 +17,7 @@ use Carbon\Carbon; use App\Classes\Modules\Accounting\Processors\ListShippingPortalTransactions; use App\Classes\ValueObjects\Constants\ShippingTransactionType; use App\Classes\ValueObjects\Constants\TransactionType; +use Illuminate\Support\Facades\Log; class ExportsInvoiceTransactions implements FromQuery, WithHeadings, WithHeadingRow, WithMapping, ShouldAutoSize { @@ -113,12 +114,15 @@ class ExportsInvoiceTransactions implements FromQuery, WithHeadings, WithHeading $textToAppend = Carbon::now()->format('[Y-m-d H:i:s]') . ' Fetch Shipping Transaction Fail ' . json_encode([ 'id' => $transaction->owner_id, 'with_company' => true, + 'StatementTransactionOwner_id' => $transaction->id, ]) . PHP_EOL; file_put_contents($errorFilePath, $textToAppend, FILE_APPEND); $textToAppend = Carbon::now()->format('[Y-m-d H:i:s]') . ' Shipping Portal Respnose ' . json_encode($row) . PHP_EOL; file_put_contents($errorFilePath, $textToAppend, FILE_APPEND); + Log::info('Error in Exports Invoice Transactions ' . $this->counter); + return []; } @@ -126,7 +130,7 @@ class ExportsInvoiceTransactions implements FromQuery, WithHeadings, WithHeading return [ '<>', - $row['updated_at'], + Carbon::parse($row['updated_at'])->format('m/d/Y H:m'), $row['debtor_code'], $row['type'] === ShippingTransactionType::PAYMENT ? $row['order_reference'] : $row['marking'], '', diff --git a/app/Classes/Modules/Vouchers/DataTransferObjects/CreateVoucherifyOrderObject.php b/app/Classes/Modules/Vouchers/DataTransferObjects/CreateVoucherifyOrderObject.php index 92dfd592..c483d45e 100644 --- a/app/Classes/Modules/Vouchers/DataTransferObjects/CreateVoucherifyOrderObject.php +++ b/app/Classes/Modules/Vouchers/DataTransferObjects/CreateVoucherifyOrderObject.php @@ -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 */ diff --git a/app/Classes/Modules/Vouchers/Processors/Voucherify/BookingToVoucherifyProcessor.php b/app/Classes/Modules/Vouchers/Processors/Voucherify/BookingToVoucherifyProcessor.php index 3df08a4c..5e31f2eb 100644 --- a/app/Classes/Modules/Vouchers/Processors/Voucherify/BookingToVoucherifyProcessor.php +++ b/app/Classes/Modules/Vouchers/Processors/Voucherify/BookingToVoucherifyProcessor.php @@ -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)){ diff --git a/app/Classes/Modules/Vouchers/Services/Voucherify/CreatesVoucherifyOrder.php b/app/Classes/Modules/Vouchers/Services/Voucherify/CreatesVoucherifyOrder.php index e5e6d404..90e5d682 100644 --- a/app/Classes/Modules/Vouchers/Services/Voucherify/CreatesVoucherifyOrder.php +++ b/app/Classes/Modules/Vouchers/Services/Voucherify/CreatesVoucherifyOrder.php @@ -31,6 +31,7 @@ class CreatesVoucherifyOrder { try { $orderObj = [ + "source_id" => $obj->getTransactionId(), "customer" => [ "source_id" => $obj->getEmployee()->id, "name" => $obj->getEmployee()->name, diff --git a/resources/assets/vue/components/accounting/elements/EditSingleItemInListComponent.vue b/resources/assets/vue/components/accounting/elements/EditSingleItemInListComponent.vue index ed3f8388..b3d50d7b 100644 --- a/resources/assets/vue/components/accounting/elements/EditSingleItemInListComponent.vue +++ b/resources/assets/vue/components/accounting/elements/EditSingleItemInListComponent.vue @@ -53,6 +53,7 @@ +

{{ error }}

@@ -60,7 +61,7 @@
Cancel
-
Update
+
Update
@@ -71,7 +72,7 @@ diff --git a/resources/assets/vue/components/bookings/elements/ListVouchers.vue b/resources/assets/vue/components/bookings/elements/AvailableVouchersComponent.vue similarity index 90% rename from resources/assets/vue/components/bookings/elements/ListVouchers.vue rename to resources/assets/vue/components/bookings/elements/AvailableVouchersComponent.vue index e59ff653..45722aaf 100644 --- a/resources/assets/vue/components/bookings/elements/ListVouchers.vue +++ b/resources/assets/vue/components/bookings/elements/AvailableVouchersComponent.vue @@ -1,7 +1,6 @@