From 1a853640df47d6ae4e729606cf0837403e6f98e9 Mon Sep 17 00:00:00 2001 From: amandeep sharma qlo Date: Tue, 28 Oct 2025 11:32:27 +0530 Subject: [PATCH 01/25] Fixed: Improper Session Invalidation --- classes/Cookie.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/classes/Cookie.php b/classes/Cookie.php index de404e6ae..ef31241ee 100644 --- a/classes/Cookie.php +++ b/classes/Cookie.php @@ -332,6 +332,14 @@ class CookieCore $this->logout(); } + if (isset($this->_content['id_customer']) && isset($this->_content['passwd']) && (int)$this->_content['id_customer']) { + if (Validate::isLoadedObject($objCustomer = new Customer((int)$this->_content['id_customer']))) { + if ($objCustomer->passwd != $this->_content['passwd']) { + $this->logout(); + } + } + } + if (!isset($this->_content['date_add'])) { $this->_content['date_add'] = date('Y-m-d H:i:s'); } From ea5ae9c3aecb91709c15b193fe6fdc625caa6f55 Mon Sep 17 00:00:00 2001 From: Amit sharma Date: Mon, 24 Nov 2025 13:37:38 +0530 Subject: [PATCH 02/25] Fixed : Need to add id elem in the callback for the start Tree --- admin/themes/default/template/helpers/tree/tree.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admin/themes/default/template/helpers/tree/tree.tpl b/admin/themes/default/template/helpers/tree/tree.tpl index c81b96460..8942abe52 100644 --- a/admin/themes/default/template/helpers/tree/tree.tpl +++ b/admin/themes/default/template/helpers/tree/tree.tpl @@ -123,7 +123,7 @@ function startTree(idElem) { if (typeof $.fn.tree === 'undefined') { - setTimeout(startTree, 100); + setTimeout(function() { startTree(idElem); }, 100); return; } From 5b1bca050e97c249d168800d5083e9b337a24566 Mon Sep 17 00:00:00 2001 From: Amit sharma Date: Thu, 27 Nov 2025 16:40:03 +0530 Subject: [PATCH 03/25] Fixed: use is_object instead of isset --- classes/controller/AdminController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/classes/controller/AdminController.php b/classes/controller/AdminController.php index 67d88e69a..65442ce7d 100644 --- a/classes/controller/AdminController.php +++ b/classes/controller/AdminController.php @@ -2387,7 +2387,7 @@ class AdminControllerCore extends Controller $must_have_module_list = file_get_contents(_PS_ROOT_DIR_.Module::CACHE_FILE_MUST_HAVE_MODULES_LIST); if (!empty($must_have_module_list) && $must_have_module_list_xml = @simplexml_load_string($must_have_module_list)) { $must_have_module_list_array = array(); - if (is_object($country_module_list_xml->module)) { + if (is_object($must_have_module_list_xml->module)) { foreach ($must_have_module_list_xml->module as $l => $mo) { $all_module_list[] = (string)$mo->name; } From 7bb61dc0948aa548acc79dd2fa383cf025e7a75d Mon Sep 17 00:00:00 2001 From: Amit sharma Date: Fri, 5 Dec 2025 15:12:47 +0530 Subject: [PATCH 04/25] Added: Refund remarks now visible in PayPay refund list --- .../admin/paypal_commerce_transaction/helpers/view/view.tpl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/qlopaypalcommerce/views/templates/admin/paypal_commerce_transaction/helpers/view/view.tpl b/modules/qlopaypalcommerce/views/templates/admin/paypal_commerce_transaction/helpers/view/view.tpl index 67e31f9ff..4efc2cd82 100644 --- a/modules/qlopaypalcommerce/views/templates/admin/paypal_commerce_transaction/helpers/view/view.tpl +++ b/modules/qlopaypalcommerce/views/templates/admin/paypal_commerce_transaction/helpers/view/view.tpl @@ -176,6 +176,7 @@ {l s='Amount' mod='qlopaypalcommerce'} {l s='Type' mod='qlopaypalcommerce'} {l s='Status' mod='qlopaypalcommerce'} + {l s='Remark' mod='qlopaypalcommerce'} {l s='Date' mod='qlopaypalcommerce'} {if $refund_data} @@ -197,6 +198,7 @@ {/if} + {$refund.refund_reason|escape:'html':'UTF-8'} {$refund.date_add|escape:'html':'UTF-8'} {/foreach} From a9b32ba0e57f17096014b2f895c191717d10e307 Mon Sep 17 00:00:00 2001 From: Amit sharma Date: Mon, 8 Dec 2025 13:05:18 +0530 Subject: [PATCH 05/25] Added: Add new payment module (Duitku payment module ) in In QloApps by default --- modules/qloduitkupayment/CHANGELOG.txt | 10 + .../qloduitkupayment/CustomizationPolicy.txt | 80 +++ modules/qloduitkupayment/LICENSE.txt | 223 ++++++++ modules/qloduitkupayment/Readme.md | 22 + .../classes/QdpDuitkuPaymentDb.php | 68 +++ .../classes/QdpDuitkuRequiredClasses.php | 28 + .../classes/QdpDuitkuServiceRequest.php | 117 ++++ .../classes/QdpDuitkuTransaction.php | 119 ++++ modules/qloduitkupayment/classes/index.php | 32 ++ .../AdminDuitkuTransactionController.php | 232 ++++++++ .../controllers/admin/index.php | 32 ++ .../controllers/front/callback.php | 180 ++++++ .../controllers/front/error.php | 42 ++ .../controllers/front/index.php | 32 ++ .../controllers/front/return.php | 151 ++++++ .../controllers/front/validate.php | 52 ++ .../qloduitkupayment/controllers/index.php | 32 ++ modules/qloduitkupayment/index.php | 32 ++ modules/qloduitkupayment/logo.gif | Bin 0 -> 521 bytes modules/qloduitkupayment/logo.png | Bin 0 -> 7747 bytes modules/qloduitkupayment/logs/index.php | 32 ++ modules/qloduitkupayment/qloduitkupayment.php | 513 ++++++++++++++++++ .../views/css/admin/duitku.css | 26 + .../views/css/admin/index.php | 32 ++ .../views/css/front/duitku_payment.css | 47 ++ .../views/css/front/index.php | 32 ++ modules/qloduitkupayment/views/css/index.php | 32 ++ .../views/img/ajax-loader.gif | Bin 0 -> 1588 bytes modules/qloduitkupayment/views/img/duitku.png | Bin 0 -> 857 bytes modules/qloduitkupayment/views/img/index.php | 32 ++ modules/qloduitkupayment/views/index.php | 32 ++ .../views/js/duitku_configuration.js | 8 + modules/qloduitkupayment/views/js/index.php | 32 ++ .../duitku_transaction/getCustomerInfo.tpl | 25 + .../admin/duitku_transaction/getOrderLink.tpl | 28 + .../duitku_transaction/getStatusBadge.tpl | 23 + .../admin/duitku_transaction/getViewIcon.tpl | 26 + .../duitku_transaction/helpers/form/form.tpl | 97 ++++ .../duitku_transaction/helpers/form/index.php | 32 ++ .../duitku_transaction/helpers/index.php | 32 ++ .../admin/duitku_transaction/index.php | 32 ++ .../views/templates/admin/index.php | 32 ++ .../views/templates/front/auth_error.tpl | 28 + .../views/templates/front/index.php | 32 ++ .../templates/front/validation_error.tpl | 32 ++ .../views/templates/hook/index.php | 32 ++ .../views/templates/hook/payment_return.tpl | 47 ++ .../templates/hook/payment_web_checkout.tpl | 68 +++ .../views/templates/index.php | 32 ++ 49 files changed, 2900 insertions(+) create mode 100644 modules/qloduitkupayment/CHANGELOG.txt create mode 100644 modules/qloduitkupayment/CustomizationPolicy.txt create mode 100644 modules/qloduitkupayment/LICENSE.txt create mode 100644 modules/qloduitkupayment/Readme.md create mode 100644 modules/qloduitkupayment/classes/QdpDuitkuPaymentDb.php create mode 100644 modules/qloduitkupayment/classes/QdpDuitkuRequiredClasses.php create mode 100644 modules/qloduitkupayment/classes/QdpDuitkuServiceRequest.php create mode 100644 modules/qloduitkupayment/classes/QdpDuitkuTransaction.php create mode 100644 modules/qloduitkupayment/classes/index.php create mode 100644 modules/qloduitkupayment/controllers/admin/AdminDuitkuTransactionController.php create mode 100644 modules/qloduitkupayment/controllers/admin/index.php create mode 100644 modules/qloduitkupayment/controllers/front/callback.php create mode 100644 modules/qloduitkupayment/controllers/front/error.php create mode 100644 modules/qloduitkupayment/controllers/front/index.php create mode 100644 modules/qloduitkupayment/controllers/front/return.php create mode 100644 modules/qloduitkupayment/controllers/front/validate.php create mode 100644 modules/qloduitkupayment/controllers/index.php create mode 100644 modules/qloduitkupayment/index.php create mode 100644 modules/qloduitkupayment/logo.gif create mode 100644 modules/qloduitkupayment/logo.png create mode 100644 modules/qloduitkupayment/logs/index.php create mode 100644 modules/qloduitkupayment/qloduitkupayment.php create mode 100644 modules/qloduitkupayment/views/css/admin/duitku.css create mode 100644 modules/qloduitkupayment/views/css/admin/index.php create mode 100644 modules/qloduitkupayment/views/css/front/duitku_payment.css create mode 100644 modules/qloduitkupayment/views/css/front/index.php create mode 100644 modules/qloduitkupayment/views/css/index.php create mode 100644 modules/qloduitkupayment/views/img/ajax-loader.gif create mode 100644 modules/qloduitkupayment/views/img/duitku.png create mode 100644 modules/qloduitkupayment/views/img/index.php create mode 100644 modules/qloduitkupayment/views/index.php create mode 100644 modules/qloduitkupayment/views/js/duitku_configuration.js create mode 100644 modules/qloduitkupayment/views/js/index.php create mode 100644 modules/qloduitkupayment/views/templates/admin/duitku_transaction/getCustomerInfo.tpl create mode 100644 modules/qloduitkupayment/views/templates/admin/duitku_transaction/getOrderLink.tpl create mode 100644 modules/qloduitkupayment/views/templates/admin/duitku_transaction/getStatusBadge.tpl create mode 100644 modules/qloduitkupayment/views/templates/admin/duitku_transaction/getViewIcon.tpl create mode 100644 modules/qloduitkupayment/views/templates/admin/duitku_transaction/helpers/form/form.tpl create mode 100644 modules/qloduitkupayment/views/templates/admin/duitku_transaction/helpers/form/index.php create mode 100644 modules/qloduitkupayment/views/templates/admin/duitku_transaction/helpers/index.php create mode 100644 modules/qloduitkupayment/views/templates/admin/duitku_transaction/index.php create mode 100644 modules/qloduitkupayment/views/templates/admin/index.php create mode 100644 modules/qloduitkupayment/views/templates/front/auth_error.tpl create mode 100644 modules/qloduitkupayment/views/templates/front/index.php create mode 100644 modules/qloduitkupayment/views/templates/front/validation_error.tpl create mode 100644 modules/qloduitkupayment/views/templates/hook/index.php create mode 100644 modules/qloduitkupayment/views/templates/hook/payment_return.tpl create mode 100644 modules/qloduitkupayment/views/templates/hook/payment_web_checkout.tpl create mode 100644 modules/qloduitkupayment/views/templates/index.php diff --git a/modules/qloduitkupayment/CHANGELOG.txt b/modules/qloduitkupayment/CHANGELOG.txt new file mode 100644 index 000000000..369034816 --- /dev/null +++ b/modules/qloduitkupayment/CHANGELOG.txt @@ -0,0 +1,10 @@ + +# V4.0.0 | COMPATIBLE:: QLOAPPS V1.7.x +--------------------------------------------------------------- ++ [CO] : Fixed compatibility issues with the QloApps 1.7.x ++ [CO] : Renamed class RoomTypeServiceProductCartDetail to ServiceProductCartDetail. + +--------------------------------------------------------------- +# V1.0.0 | COMPATIBLE:: QLOAPPS V1.6.x +--------------------------------------------------------------- +- first release \ No newline at end of file diff --git a/modules/qloduitkupayment/CustomizationPolicy.txt b/modules/qloduitkupayment/CustomizationPolicy.txt new file mode 100644 index 000000000..7a688847f --- /dev/null +++ b/modules/qloduitkupayment/CustomizationPolicy.txt @@ -0,0 +1,80 @@ +1. Definitions +-------------- +"Webkul" means Webkul Software Pvt. Ltd. +"Customization" means those services by which functionality / features are added to a product that are not included in the base installation of a product, which are aimed to suit the specific needs of the customer. +"Module" means the custom add-on module to be developed and provided by Webkul to you in accordance with this policy and the Order Form. +"Order Form" means the order form (electronic or hard copy), accepted by Webkul, through which you ordered the Module to be developed and provided by Webkul and which sets out the details, specifications and parameters of the customized Module to be provided. +"Software" means the software licensed by Webkul to you pursuant to the terms and conditions of a Webkul Software License Agreement. + + +2. Module Development +--------------------- +All customization Services and use of the Module are subject to the terms and conditions of Webkul’s Software Licence Agreement, found on Webkul’s website, and are also subject to the terms and conditions set forth in the Order Form, as well as the customization parameters. No other customization services will be provided unless expressly agreed upon by you and Webkul in writing, signed by authorized representatives of you and Webkul. + + +3. Customization Services +------------------------- +Customization Services will be provided in accordance with the terms of the Order Form and subject to the conditions set forth on the Order Form including full payment of all fees and adherence to all time limits and scheduling restrictions. +If expressly stated on the Order Form, the Customization Services and Module shall be subject to acceptance by you in accordance with the acceptance criteria set forth in the Order Form. Where there is no acceptance criteria set forth on the Order Form, acceptance shall be deemed to occur upon the earliest of: +completion of the acceptance criteria, +Webkul's completion of the Customization Services and written notification to you of such completion, +your use of the Module in other than a test environment. +Notwithstanding the foregoing, if acceptance testing, delivery or completion is delayed by thirty (30) days or more for reasons not related to Webkul’s performance, you must pay the value of any milestone that is contingent on acceptance. Such acceptance does not negate any warranty rights that you may have respecting the Module, as set forth herein. You are solely responsible for preparing your facilities and equipment for installation of the Module, where applicable. +Webkul will make reasonable efforts to accommodate your time and deadline requirements with respect to the performance of Customization Services; however, meeting such requirements is subject to availability of resources, both human and equipment at the time of your request and is dependent on your availability to provide input and to perform necessary actions. Webkul shall not be liable in any way for any delay or damage arising from Webkul’s failure to meet such of your requirements or any deadlines. +Any changes to the Customization Services or Module requirements after execution of the Order Form will be subject to a cost and delivery re-assessment, and a written change order or re-quote that has been mutually agreed upon by you and Webkul in writing. Webkul reserves the right to make changes in the design of its Software without the obligation to make equivalent changes to the Module. +If, pursuant to your request, Webkul reviews drawings and documents prepared by others in connection with the Customization Services, including your personnel and other consultants, contractors, and suppliers, Webkul’s review of such drawings and documents shall be only to confirm general compliance with the intent of the design and information given, and shall not constitute acceptance by Webkul of any responsibility for correctness of specifications or details of such drawings and documentation. Webkul shall be entitled to rely on all information provided, and decisions and approvals made, by you in connection with Webkul’s work hereunder. You agree that Webkul and its personnel shall not be subject to any liability or costs relating to the Customization Services to the extent such liability and costs are attributable to any information provided by you that is not complete, accurate or current in all material respects. +The Module, and all parts thereof, shall at all times be treated as Software licensed to you under the terms and conditions of the Licence Agreement. + + +4. Term and Termination +----------------------- +The term of the Development Services, if any, shall be as set out on the Order Form. +Customization Services may be terminated by Webkul immediately upon notice for cause if: +you materially breach any agreement entered into between you and Webkul, including Webkul’s Licence Agreement and/or any User / software license agreement relating to Webkul’s products (or you consistently fail to properly perform and observe your obligations under such agreements or any applicable Webkul Software policy), and you fail to rectify the situation within ten (10) calendar days of notice from Webkul; or +you become insolvent, or a receiver or receiver-manager is appointed for any part of your property, or you make an assignment, proposal or arrangement for the benefit of your creditors or you file an assignment in bankruptcy, or any proceedings under any bankruptcy or insolvency laws are commenced against you. +Webkul shall have the right to terminate Customization Services immediately upon notice to you, without penalty or refund, if any agreement relating to the Software is terminated for any reason. +Each party shall have the right to terminate the Development Services for convenience upon ninety (90) days’ notice to the other party. +Termination of the Customization Services or any agreement shall not affect your payment obligation for any Customization Services performed by Webkul prior to the date of termination, regardless of whether you have had, as at the date of termination, any use of the Module or part thereof. In the event that the Customization Services are terminated prior to the delivery of the Module to you, Webkul shall not be obligated to deliver any work-in-progress or any portion of the Module to you, unless otherwise expressly agreed by the parties in writing. + + +5. Fees +------- +You shall pay fees for the Customization Services and Module license in accordance with the fee schedule set forth in the Order Form. Webkul shall submit invoices to you for all fees and payments due, including applicable expenses, on a monthly basis in arrears. You shall pay to Webkul the full amount of each invoice received from Webkul within seven (7) days of receipt of the invoice. All invoices shall detail the nature of the Customization Services performed, the fees payable, and the basis on which the calculation of the fees has been made. +You are responsible for, and shall pay all taxes relating to the Customization Services and the Module. Unless otherwise indicated, all amounts payable by you under an Order Form are exclusive of any tax, duty, levy, or similar government charge that may be assessed by any jurisdiction, whether based on gross revenue, the delivery, possession or use of the Module, other Software or Customization Services, or otherwise. +If you fail to pay any amount due within thirty (30) days of such payment becoming due and payable, in addition to any other rights and remedies available to Webkul, Webkul shall be entitled to charge interest on all outstanding amounts at the lesser of 18% per annum or the maximum rate permitted by law, such interest commencing as of the due date for such payment. You shall also be responsible for paying for all reasonable fees and costs incurred by Webkul, including legal fees, in collecting any overdue amounts or enforcing any provision of any agreement entered into between you and Webkul. +Pricing is subject to Webkul’s understanding of the project requirements, the terms of this policy and the Order Form. Webkul reserves the right to invoice you for additional Customization Services requested by you, or that are required based on incomplete details or specifications provided by you, that are not specified in the Order Form but are provided by Webkul to you, provided that Webkul provides you with notice that such additional Customization Services are not included in the Order Form and are subject to Webkul’s then current time and materials fee schedule for such Customization Services. Invoices for such additional Customization Services shall be subject to payment in accordance with this Section. + + +6. Intellectual Property Rights +------------------------------- +Webkul shall own all intellectual property rights (whether or not patentable or registrable under copyright, trade-mark or similar legislation or subject to analogous protection) in and to the Module, and all work conceived, created, invented, produced, designed or reduced to practice by Webkul and its personnel as a result of or with respect to any and all Customization Services provided to you. Your rights and obligations relating to the use of the Module shall be governed by the terms of the applicable Webkul Software License Agreement regardless of whether you may have contributed to any Module in any way. The foregoing shall not be deemed to transfer ownership to Webkul of any pre-existing intellectual property rights that you may have in the materials that you provide to Webkul in order to permit Webkul to perform the Customization Services; however, to the extent that you have provided such materials to Webkul, you hereby grant Webkul a non-exclusive, non-transferable, royalty-free license to use all such materials for the purposes of performing the Customization Services and providing you with the Module. + + +7. Limited Warranty and Limitation of Liability +----------------------------------------------- +Limited Warranty: Webkul warrants that all services provided by Webkul shall be provided in a competent, professional manner by persons who are fully trained and qualified to perform the Customization Services. Webkul does not represent or warrant that the Customization Services or Module provided hereunder will be capable of achieving a particular result for your business, or that the operation of the Module will be error free or uninterrupted, or that all errors in the Module can be found or corrected, although Webkul shall use commercially reasonable efforts to do so. Without limiting the foregoing, this warranty is valid only for the six (6) months following the acceptance date as set forth in Section 3(b). The above warranty shall not apply to defects or non-conformities resulting from: +improper or inadequate maintenance or installation of the Module +use of the Module in combination with software, interfaces, or other materials that are not supplied or specifically authorized by Webkul, +unauthorized or improper use or modification of the Module, including use that is not contemplated in the Order Form or instructions provided by Webkul, +abuse, negligence, accident, or other damage from external sources, or +improper preparation of your facilities or equipment for installation and use or the Module. +Limitation of Liability: +save as otherwise provided in a written agreement between you and Webkul, and to the maximum extent permitted by applicable law, Webkul makes no warranty or condition, express or implied, statutory or otherwise, with respect to the module or the Customization services, including, without limitation, the implied warranties or conditions of merchantability and fitness for a particular purpose. +in no event shall Webkul be liable to you or any other person for any indirect, special, punitive, exemplary, consequential or incidental damages (including without limitation, damages for loss of revenues or profits, business interruption, loss of business information, and the like) arising out of the use, inability to use or the performance or non-performance of, the module or the provision of the Customization services, even if Webkul has been advised of the possibility of such damage or claim, or it is foreseeable. +in no event shall Webkul’s maximum aggregate liability to you for direct damages exceed the total amount paid by you for the Customization services performed by Webkul within the six (6) months preceding the date on which the claim arose. + + +8. General Terms and Conditions +------------------------------- +As Webkul is primarily a plugin and app development company and its main focus is on constant plugin development fulfilling various latest requirements and keeping up with the latest trends, Webkul has all the right to release the same customized plugin as a new plugin in future to be available to all its customers. The same may include few or every feature of the customisation. Webkul reserve all the rights to do the same as the customisation done for the client is Intellectual property of Webkul. +The customization undertaken by Webkul would be identical to the discussed requirements, and would not include any sort of additional changes or alterations. Any additional changes or alterations would be considered as a separate project and would be charged separately. +Webkul would be providing customization support for only one month from the delivery of the project. For any further support extended to you, the same shall be charged separately which includes specifically any further help or bug /error fix. +The cost of customization doesn’t include the cost of extension installation or exchange of the extension, if it has not been specifically quoted within the project cost. +During the project customization, you ought not to edit or change any of the files and it is also advisable to have a backup every-time a change is made. If you, on your own, are making certain changes, it is advisable to back up the files, folder and database. Before doing anything on your own, you need to inform Webkul if Webkul is working on the project or your support period is subsisting. +The customization charge will include a single template. Any time during or after the customization if you change the template, you shall be wholly and solely liable for any loss or damage emanating from the same. Webkul will not be responsible for any loss or damage done due to the same. +All the communication will take place through Webkul’s help desk system only. If the need arises, the issues can be discussed via Skype once in week or month. Webkul does not allow screen sharing and remote desktop. +Customization cost will not include any free consulting beyond the scope of the project. +If while making any changes by yourself or by your team, something gets damaged, then Webkul will not be responsible for it. This includes any issues faced by you for your own fault even during the support period of the module or project. +Webkul will not be responsible for any damages during the customization. It is advised that you must have a proper backup management system deployed. +The terms and conditions of this Policy shall be governed by Indian Laws, and the courts in Delhi alone shall only have exclusive jurisdiction to resolve/ adjudicate upon any disputes. +If any dispute arises between webkul and you/Licensee at any time, in connection with the validity, interpretation, implementation or alleged breach of any provision of this Agreement, the same shall be referred to a sole Arbitrator who shall be an independent and neutral third party appointed exclusively by Webkul. You shall not object to the appointment of the Arbitrator so appointed by Webkul. The place of arbitration shall be Delhi, India. The Arbitration & Conciliation Act, 1996 as amended by The Arbitration & Conciliation (Amendment) Act, 2015, shall govern the arbitration proceedings. The arbitration proceedings shall be held in the English language. diff --git a/modules/qloduitkupayment/LICENSE.txt b/modules/qloduitkupayment/LICENSE.txt new file mode 100644 index 000000000..44b1b399c --- /dev/null +++ b/modules/qloduitkupayment/LICENSE.txt @@ -0,0 +1,223 @@ +SOFTWARE LICENCE AGREEMENT +=============================== + +This AGREEMENT is made effective on the date of the purchase of the software between Webkul Software Pvt. Ltd.,Company incorporated under the Companies Act, 1956 (hereinafter referred to as “Licensor"), and the purchaser of the software/ product (hereinafter referred to as "Licensee"). + +Preamble +================== +Licensor is a web and mobile product based organization engaged in the business of developing and marketing software for enterprise level e-commerce businesses. It is an ISO and NSR (NASSCOM) certified organization having a team of more than 150 creative engineers which come from different backgrounds. It has developed more than 700 web extensions and apps in the past few years for open source platforms which are used and trusted globally. Licensee now wishes to obtain license, and Licensor wishes to grant a license, to allow use of the software so purchased in developing the e-commerce business website/ mobile app of the Licensee, subject to the terms and conditions set forth herein. + + +THEREFORE, with the intent to be legally bound, the parties hereby agree as follows: + + +Agreement +================ + +1.Definitions : +------------------ +As used in this Agreement, the following capitalized terms shall have the definitions set forth below: + + +"Derivative Works" are works developed by Licensee, its officers, agents, contractors or employees, which are based upon, in whole or in part, the Source Code and/or the Documentation and may also be based upon and/or incorporate one or more other preexisting works of the Licensor. Derivative Works may be any improvement, revision, modification, translation (including compilation or recapitulation by computer), abridgment, condensation, expansion, or any other form in which such a preexisting work may be recast, transformed, or adapted. For purposes hereof, a Derivative Work shall also include any compilation that incorporates such a preexisting work. + + +"Documentation" is written, printed or otherwise recorded or stored (digital or paper) material relating to the Software and/or Source Code, including technical specifications and instructions for its use including Software/ Source Code annotations and other descriptions of the principles of its operation and instructions for its use. + + +"Improvements" shall mean, with respect to the Software, all modifications and changes made, developed, acquired or conceived after the date hereof and during the entire term of this Agreement. + + +"Source Code" is the computer programming source code form of the Software in the form maintained by the Licensor, and includes all non-third-party executables, libraries, components, and Documentation created or used in the creation, development, maintenance, and support of the Software as well as all updates, error corrections and revisions thereto provided by Licensor, in whole or in part. + + +2. Software License. +------------------------- + +(a)Grant of License. For the consideration set forth below, Licensor hereby grants to Licensee, and Licensee hereby accepts the worldwide, non-exclusive, perpetual, royalty-free rights and licenses set forth below: + + +(i)The right and license to use and incorporate the software, in whole or in part, to develop its website/ mobile app (including the integration of all or part of the Licensor’s software into Licensee's own software) on one domain ( Except Joomla modules , listed on store are entitled to be used on unlimited domain as per the standard guidelines ) only, solely for the own personal or business use of the Licensee. However, the License does not authorize the Licensee to compile, copy or distribute the said Software or its Derivative Works. + + +(ii)The right and license does not authorize the Licensee to make any backup or archival copies of the Software and / or the Source Code and Documentation. + +(iii)The right and license does not authorize the Licensee to migrate the domain license to another domain. + + +(b)Scope; Rights and Responsibilities. + + +(i)Licensor shall enable the Licensee to download one complete copy of the Software. + + +(ii)The Software is intended for the sole use of the Licensee in development of its own website/ mobile app. + + +(iii)Licensee does not have the right to hand over, sell, distribute, sub-license, rent, lease or lend any portion of the Software or Documentation, whether modified or unmodified, to anyone. Licensee should not place the Software on a server so that it becomes accessible via a public network such as the Internet for distribution purposes. In case the Licensee is using any source code management system like github, it can use the code there only when it has paid subscription from such management system. + + +(iv)Licensee is not authorized to appoint, or work with, third parties to perform any development services using the Source Code, the source code to Derivative Works and/or the Documentation on behalf of, or working with, the Licensee. Release of Source Code, Derivative Work source code and/or Documentation to any third party shall be considered as violation of the Agreement, inter-alia entailing forthwith termination and legal action. + + + +(c)Ownership. + + +(i)Software and Source Code. All right, title, copyright, and interest in the Software, Source Code, Software Modifications and Error corrections will be and remain the property of Licensor. + + +(ii)Derivative Works. As creation of Derivative Works by the Licensee is prohibited, thus, all right, title, copyright, and interest in any and/or all Derivative Works and Improvements created by, or on behalf of, Licensee will also be deemed to the property of Licensor. Licensor shall be entitled to protect copyright / intellectual property in all such Derivative Works and Improvements also in any country as it may deem fit including without limitation seeking copyright and/or patent protection. + + +3.Consideration. +-------------------- + +(a)Licensee shall pay to Licensor the amount as mentioned on the website from where the order is placed, as one-time, upfront fees in consideration for the licenses and rights granted hereunder (hereinafter referred to as the "License Fee"). The License Fee to be paid by Licensee shall be paid upfront at the time of placing the order, and no credit will be allowed under any circumstances. + + +(b)Once paid, the License Fees shall be non-refundable. The Licensee has fully satisfied itself about the Software and has seen the demonstration, and only thereafter has placed the order. Thus, the License Fees or any part thereof is non-refundable. No claim for refund of the Licence Fees shall be entertained under any circumstances. + + + +4.Representations and Warranties. +------------------------------------- + +(a)Mutual. Each of the parties represents and warrants to the other as follows. + + +(i)such party is a legal entity duly organized, validly existing and in good standing; + + +(ii)such party has the power and authority to conduct its business as presently conducted and to enter into, execute, deliver and perform this Agreement. + + +(iii)This Agreement has been duly and validly accepted by such party and constitutes the legal, valid and binding obligations of such party respectively, enforceable against such party in accordance with their respective terms; + + +(iv)the acceptance, execution, delivery and performance of this Agreement does not and will not violate such party's charter or by-laws; nor require any consent, authorization, approval, exemption or other action by any third party or governmental entity. + + +(b)Licensor warrants that, at the time of purchase of the Software: + + +the Software will function materially as set forth in the website or published functionality provided by Licensor to customers and potential customers describing the Software; and + + +Software add-ons, if purchased by the Licensee from the Licensor, will not materially diminish the features or functions of or the specifications of the Software as they existed as of the execution of this Agreement. + + + +(c)Title. Licensor represents and warrants that it is the exclusive owner of all copyright/ intellectual property in the Software (including the Source Code) and has good and marketable title to the Software (including the Source Code) free and clear of all liens, claims and encumbrances of any nature whatsoever (collectively, "Liens"). Licensor's grant of license and rights to Licensee hereunder does not, and will not infringe any third party's property, intellectual property or personal rights. + + + +5.Term. +------------- + +(a)Subject to Licensee's payment obligations, this Agreement shall commence as on the date of making payment of the Software by the Licensee to the Licensor, and shall continue until terminated by either party. + + +(b)The Licensor retains the right to terminate the license at any time, if the Licensee is not abiding by any of the terms of the Agreement. The Licensee may terminate the Agreement at any time at its own discretion by uninstalling the Software and /or by destroying the said Software (or any copies thereof). However, the Licensee shall not be entitled to seek any refund of the amount paid by it to the Licensor, under any circumstances. + + +(c)Survival. In the event this Agreement is terminated for any reason, the provisions set forth in Sections 2(a), 2(b), and 2(c) shall survive. + + + + +6. Indemnification +---------------------- + +The Licensee release the Licensor from, and agree to indemnify, defend and hold harmless the Licensor (and its officers, directors, employees, agents and Affiliates) against, any claim, loss, damage, settlement, cost, taxes, expense or other liability (including, without limitation, attorneys' fees) (each, a "Claim") arising from or related to: (a) any actual or alleged breach of any obligations in this Agreement; (b) any refund, adjustment, or return of Software,(c) any claim for actual or alleged infringement of any Intellectual Property Rights made by any third party or damages related thereto; or (d) Taxes. + + +7. Limitation of Liability +------------------------------ + +The Licensor will not be liable for any direct, indirect, incidental, special, consequential or exemplary damages, including but not limited to, damages for loss of profits, goodwill, use, data or other intangible losses arising out of or in connection with the Software, whether in contract, warranty, tort etc. (including negligence, software liability, any type of civil responsibility or other theory or otherwise) to the Licensee or any other person for cost of software, cover, recovery or recoupment of any investment made by the Licensee or its affiliates in connection with this Agreement, or for any other loss of profit, revenue, business, or data or punitive or consequential damages arising out of or relating to this Agreement. Further, the aggregate liability of the Licensor, arising out of or in connection with this Agreement or the transactions contemplated hereby will not exceed at any time, or under any circumstances, the total amounts received by the Licensor from the Licensee in connection with the particular software giving rise to the claim. + + +8. Force Majeure +--------------------- + +The Licensor will not be liable for any delay or failure to perform any of its obligations under this Agreement by reasons, events or other matters beyond its reasonable control. + + +9. Relationship of Parties +------------------------------ + +The Licensor and Licensee are independent legal entities, and nothing in this Agreement will be construed to create a partnership, joint venture, association of persons, agency, franchise, sales representative, or employment relationship between the parties. The Licensee will have no authority to make or accept any offers or representations on behalf of the Licensor. The relationship between the parties is that of Licensor and Licensee only, and the rights, duties, liabilities of each party shall be governed by this Agreement. + + +10. Modification +------------------------ + +The Licensor may amend any of the terms and conditions contained in this Agreement at any time and solely at its discretion. Any changes will be effective upon the posting of such changes on the Portal/ website, and the Licensee is responsible for reviewing these changes and informing itself of all applicable changes or notices. The continued use of a software by the Licensee after posting of any changes by the Licensor, will constitute the acceptance of such changes or modifications by the Licensee. + + + +11.Miscellaneous. +----------------------- + +(a)General Provisions. This Agreement: (i) may be amended only by a writing signed by each of the parties; (ii) may be executed in several counterparts, each of which shall be deemed an original but all of which shall constitute one and the same instrument; (iii) contains the entire agreement of the parties with respect to the transactions contemplated hereby and supersedes all prior written and oral agreements, and all contemporaneous oral agreements, relating to such transactions; (iv) shall be governed by, and construed and enforced in accordance with, the laws of India; and (v) shall be binding upon, and inure to the benefit of, the parties and their respective successors and permitted assigns. Each of the parties hereby irrevocably submits to the jurisdiction of the Courts at Delhi, India, for the purposes of any action or proceeding arising out of or relating to this Agreement or the subject matter hereof and brought by any other party. + + +(b)Assignment. Licensee cannot assign, pledge or otherwise transfer, whether by operation of law or otherwise, this Agreement, or any of its obligations hereunder, without the prior written consent of Licensor, which consent shall not be unreasonably withheld. + + +(c)Notices. Unless otherwise specifically provided herein, all notices, consents, requests, demands and other communications required or permitted hereunder: + + +(i)shall be in writing; + + +(ii)shall be sent by messenger, certified or registered mail/email, or reliable express delivery service, to the appropriate address(es) set forth below; and + + +(iii)shall be deemed to have been given on the date of receipt by the addressee, as evidenced by a receipt executed by the addressee (or a responsible person in his or her office), the records of the Party delivering such communication or a notice to the effect that such addressee refused to claim or accept such communication, if sent by messenger, mail or express delivery service. + + +All such communications shall be sent to the following addresses or numbers, or to such other addresses or numbers as any party may inform the others by giving five days' prior notice: + + +If to Webkul Software Pvt. Ltd.: + + + +Webkul Software Pvt. Ltd. + +H-28, ARV Park, Sector 63, NOIDA – 201301, + +Uttar Pradesh, India + + +If to Licensee: + +At the address mentioned by the Licensee + +(at the time of placing order of generating Invoice) + + +(d)Severability. It is the intent of the parties that the provisions of this Agreement be enforced to the fullest extent permissible under the laws and public policies of India in which enforcement hereof is sought. In furtherance of the foregoing, each provision hereof shall be severable from each other provision, and any provision hereof which is/ becomes unenforceable shall be subject to the following: (i) if such provision is contrary to or conflicts with any requirement of any statute, rule or regulation in effect, then such requirement shall be incorporated into, or substituted for, such unenforceable provision to the minimum extent necessary to make such provision enforceable; (ii) the court, agency or arbitrator considering the matter is hereby authorized to (or, if such court, agency or arbitrator is unwilling or fails to do so, then the parties shall) amend such provision to the minimum extent necessary to make such provision enforceable, and the parties hereby consent to the entry of an order so amending such provision; and (iii) if any such provision cannot be or is not reformed and made enforceable pursuant to clause (i) or (ii) above, then such provision shall be ineffective to the minimum extent necessary to make the remainder of this Agreement enforceable. Any application of the foregoing provisions to any provision hereof shall not effect the validity or enforceability of any other provision hereof. + + +(e)By purchasing the Software, the Licensee acknowledge that it has read this Agreement, and that it agrees to the content of the Agreement, its terms and agree to use the Software in compliance with this Agreement. + + +(f)The Licensor holds the sole copyright of the Software. The Software or any portion thereof is a copyrightable matter and is liable to be protected by the applicable laws. Copyright infringement in any manner can lead to prosecution according to the current law. The Licensor reserves the right to revoke the license of any user who is not holding any license or is holding an invalid license. + + +(g)This Agreement gives the right to use only one copy of the Software on one domain solely for the own personal or business use of the Licensee, subject to all the terms and conditions of this Agreement. A separate License has to be purchased for each new Software installation. Any distribution of the Software without the written consent of the Licensor (including non-commercial distribution) is regarded as violation of this Agreement, and will entail immediate termination of the Agreement and may invite liability, both civil and criminal, as per applicable laws. + + +(h)The Licensor reserves the rights to publish a selected list of users/ Licensees of its Software, and no permission of any Licensee is needed in this regard. The Licensee agrees that the Licensor may, in its sole discretion, disclose or make available any information provided or submitted by the Licensee or related to it under this Agreement to any judicial, quasi-judicial, governmental, regulatory or any other authority as may be required by the Licensor to co-operate and / or comply with any of their orders, instructions or directions or to fulfill any requirements under applicable Laws. + + +(i)If the Licensee continues to use the Software even after the sending of the notice by the Licensor for termination, the Licensee agree to accept an injunction to restrain itself from its further use, and to pay all costs (including but not limited to reasonable attorney fees) to enforce injunction or to revoke the License, and any damages suffered by the Licensor because of the misuse of the Software by the Licensee. + + +12. Arbitration +----------------------- + +If any dispute arises between the Licensor and the Licensee at any time, in connection with the validity, interpretation, implementation or alleged breach of any provision of this Agreement, the same shall be referred to a sole Arbitrator who shall be an independent and neutral third party appointed exclusively by the Licensor. The Licensee shall not object to the appointment of the Arbitrator so appointed by the Licensor. The place of arbitration shall be Delhi, India. The Arbitration & Conciliation Act, 1996 as amended by The Arbitration & Conciliation (Amendment) Act, 2015, shall govern the arbitration proceedings. The arbitration proceedings shall be held in the English language. diff --git a/modules/qloduitkupayment/Readme.md b/modules/qloduitkupayment/Readme.md new file mode 100644 index 000000000..0d24686c3 --- /dev/null +++ b/modules/qloduitkupayment/Readme.md @@ -0,0 +1,22 @@ + +### Support Policy: +https://store.webkul.com/support.html + +### Store link: + + +### Explore Modules: + + +### Explore Addons: +https://qloapps.com/addons/ + + +**QloApps Duitku Payment 4.0.0** + +- Module V4.0.0 compatible with QloApps version V1.7.x. + +- Module V1.0.0 compatible with QloApps version V1.6.x. + +### Refund Policy: +https://store.webkul.com/refund-policy.html/ diff --git a/modules/qloduitkupayment/classes/QdpDuitkuPaymentDb.php b/modules/qloduitkupayment/classes/QdpDuitkuPaymentDb.php new file mode 100644 index 000000000..606e260fe --- /dev/null +++ b/modules/qloduitkupayment/classes/QdpDuitkuPaymentDb.php @@ -0,0 +1,68 @@ +execute(trim($sql))) { + return false; + } + } + + return true; + } + + public function deleteTable() + { + $sql = 'DROP TABLE IF EXISTS ' + . _DB_PREFIX_ . 'qdp_duitku_payment_transaction, ' + . _DB_PREFIX_ . 'qdp_duitku_order_lock'; + + return Db::getInstance()->execute($sql); + } +} diff --git a/modules/qloduitkupayment/classes/QdpDuitkuRequiredClasses.php b/modules/qloduitkupayment/classes/QdpDuitkuRequiredClasses.php new file mode 100644 index 000000000..4ec9d3dba --- /dev/null +++ b/modules/qloduitkupayment/classes/QdpDuitkuRequiredClasses.php @@ -0,0 +1,28 @@ + $url, + CURLOPT_RETURNTRANSFER => true, + CURLOPT_ENCODING => '', + CURLOPT_MAXREDIRS => 10, + CURLOPT_TIMEOUT => 30, + CURLOPT_FOLLOWLOCATION => true, + CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, + CURLOPT_HTTPHEADER => $headers, + ); + + if ($method == QdpDuitkuTransaction::QDP_CURL_REQUEST_TYPE_POST) { + $options[CURLOPT_POSTFIELDS] = json_encode($data); + $options[CURLOPT_CUSTOMREQUEST] = 'POST'; + } else if ($method == QdpDuitkuTransaction::QDP_CURL_REQUEST_TYPE_GET) { + $options[CURLOPT_CUSTOMREQUEST] = 'GET'; + } + + curl_setopt_array($curl, $options); + $request = curl_exec($curl); + $httpCode = curl_getinfo($curl, CURLINFO_HTTP_CODE); + curl_close($curl); + self::logResponse($request); + $response = array(); + + if ($httpCode == 200) { + $response['status'] = true; + $response['response'] = json_decode($request, true); + + } else { + $response['status'] = false; + $response['response'] = json_decode($request, true); + } + + return $response; + } + + + private static function createHeader() + { + date_default_timezone_set('Asia/Jakarta'); + + $timestamp = round(microtime(true) * 1000); + $merchantCode = Configuration::get('QDP_DUITKU_PAYMENT_MERCHANT_CODE'); + $apiKey = Configuration::get('QDP_DUITKU_PAYMENT_API_KEY'); + $signature = hash('sha256', $merchantCode . $timestamp . $apiKey); + + return array( + "x-duitku-signature: $signature", + "x-duitku-timestamp: $timestamp", + "x-duitku-merchantcode: $merchantCode" + ); + } + + + private static function getApiUrl($endpoint) + { + $environment = Configuration::get('QDP_DUITKU_PAYMENT_ENVIRONMENT'); + + if ($environment === QdpDuitkuTransaction::QDP_DUITKU_ENVIRONMENT_SANDBOX) { + return QdpDuitkuTransaction::QDP_DUITKU_HOST_SANDBOX_URL . $endpoint; + } + + if ($environment === QdpDuitkuTransaction::QDP_DUITKU_ENVIRONMENT_PRODUCTION) { + return QdpDuitkuTransaction::QDP_DUITKU_ENVIRONMENT_PRODUCTION . $endpoint; + } + + return QdpDuitkuTransaction::QDP_DUITKU_HOST_SANDBOX_URL . $endpoint; + } + + + private static function logResponse($response) + { + $module = Module::getInstanceByName('qloduitkupayment'); + $module->logger->log('Duitku Payment response:', FileLogger::DEBUG); + $module->logger->log($response, FileLogger::DEBUG); + } +} diff --git a/modules/qloduitkupayment/classes/QdpDuitkuTransaction.php b/modules/qloduitkupayment/classes/QdpDuitkuTransaction.php new file mode 100644 index 000000000..9e9d5420d --- /dev/null +++ b/modules/qloduitkupayment/classes/QdpDuitkuTransaction.php @@ -0,0 +1,119 @@ + 'qdp_duitku_payment_transaction', + 'primary' => 'id_duitku_payment_transaction', + 'fields' => array( + 'id_transaction' => array('type' => self::TYPE_STRING, 'required' => true), + 'id_cart' => array('type' => self::TYPE_INT, 'required' => true), + 'id_order' => array('type' => self::TYPE_STRING, 'required' => true), + 'cart_total' => array('type' => self::TYPE_FLOAT, 'validate' => 'isPrice'), + 'status' => array('type' => self::TYPE_INT), + 'environment' => array('type' => self::TYPE_INT), + 'id_currency' => array('type' => self::TYPE_INT), + 'date_add' => array('type' => self::TYPE_DATE, 'validate' => 'isDateFormat'), + 'date_upd' => array('type' => self::TYPE_DATE, 'validate' => 'isDateFormat'), + ), + ); + + public static function getPaymentStatuses() + { + $objDuitkuPayment = Module::getInstanceByName('qloduitkupayment'); + + return array( + self::QDP_TRANSACTION_COMPLETED => $objDuitkuPayment->l('Completed', 'QDPCashfreeTransaction'), + self::QDP_TRANSACTION_AWAITING => $objDuitkuPayment->l('Awaiting', 'QDPCashfreeTransaction'), + self::QDP_TRANSACTION_FAILED => $objDuitkuPayment->l('Failed', 'QDPCashfreeTransaction'), + ); + } + + public function checkExists($id_transaction) + { + $sql = "SELECT * FROM " . _DB_PREFIX_ . "qdp_duitku_payment_transaction + WHERE id_transaction = '" . pSQL($id_transaction) . "'"; + + return Db::getInstance()->getRow($sql); + } + + public function getCartLock($id_cart) + { + $sql = "SELECT * FROM " . _DB_PREFIX_ . "qdp_duitku_order_lock + WHERE id_cart = '" . (int) $id_cart . "'"; + + return Db::getInstance()->getRow($sql); + } + + public function addCartLock($id_cart) + { + $db = Db::getInstance(); + $db->insert( + 'qdp_duitku_order_lock', + array( + 'id_cart' => (int) $id_cart, + 'date_add' => date('Y-m-d H:i:s'), + 'date_upd' => date('Y-m-d H:i:s'), + ) + ); + + return $db->Insert_ID(); + } + + public function removeCartLock($id_cart) + { + $sql = 'DELETE FROM ' . _DB_PREFIX_ . 'qdp_duitku_order_lock + WHERE id_cart = ' . (int) $id_cart; + + return Db::getInstance()->execute($sql); + } +} diff --git a/modules/qloduitkupayment/classes/index.php b/modules/qloduitkupayment/classes/index.php new file mode 100644 index 000000000..409280877 --- /dev/null +++ b/modules/qloduitkupayment/classes/index.php @@ -0,0 +1,32 @@ +bootstrap = true; + $this->className = 'QdpDuitkuTransaction'; + $this->table = 'qdp_duitku_payment_transaction'; + $this->identifier = 'id_duitku_payment_transaction'; + // Hotel wise access + $this->context = Context::getContext(); + $this->access_select = ' SELECT a.`id_duitku_payment_transaction` FROM ' . _DB_PREFIX_ . 'qdp_duitku_payment_transaction as a'; + $this->access_join = ' INNER JOIN ' . _DB_PREFIX_ . 'orders ord ON (a.id_cart = ord.id_cart)'; + $this->access_join .= ' INNER JOIN ' . _DB_PREFIX_ . 'htl_booking_detail hbd ON (hbd.id_order = ord.id_order)'; + if ($acsHtls = HotelBranchInformation::getProfileAccessedHotels($this->context->employee->id_profile, 1, 1)) { + $this->access_where = ' WHERE hbd.id_hotel IN (' . implode(',', $acsHtls) . ')'; + } + + $this->list_no_link = true; + parent::__construct(); + + $this->_new_list_header_design = true; + + $this->_select = 'GROUP_CONCAT(distinct ord.`id_order`) as `id_orders`, ord.`reference`, ord.`id_order`, c.`email` AS email, + c.`id_customer`, CONCAT(c.`firstname`, \' \', c.`lastname`) AS `name`'; + $this->_join .= ' LEFT JOIN ' . _DB_PREFIX_ . 'orders ord on (a.`id_cart` = ord.`id_cart`)'; + $this->_join .= ' LEFT JOIN `' . _DB_PREFIX_ . 'customer` c ON (c.`id_customer` = ord.`id_customer`)'; + $this->_group = ' GROUP BY a.`id_duitku_payment_transaction`'; + $this->_orderWay = 'DESC'; + + + $paymentStatus = QdpDuitkuTransaction::getPaymentStatuses(); + $this->fields_list = array( + 'id_transaction' => array( + 'title' => $this->l('Transaction ID'), + 'align' => 'center', + 'hint' => $this->l('Duitku transaction reference of payment done by the customer.') + ), + 'reference' => array( + 'title' => $this->l('Order Reference'), + 'callback' => 'getOrderLink', + 'align' => 'center', + 'hint' => $this->l('Order reference of the Duitku payment.'), + ), + 'id_customer' => array( + 'title' => $this->l('Customer'), + 'align' => 'center', + 'callback' => 'getCustomerInfo', + 'havingFilter' => true, + 'filter_key' => 'email', + 'hint' => $this->l('Customer who paid using Duitku payment.'), + ), + 'cart_total' => array( + 'title' => $this->l('Transaction Amount'), + 'align' => 'right', + 'class' => 'fixed-width-lg', + 'callback' => 'checkCurrency', + 'hint' => $this->l('Total amount paid by the customer.') + ), + 'status' => array( + 'title' => $this->l('Status'), + 'align' => 'center', + 'type' => 'select', + 'list' => $paymentStatus, + 'filter_key' => 'a!status', + 'callback' => 'getRenderListColumnAsBadge', + 'hint' => $this->l('Current status of the transaction.') + ), + 'date_add' => array( + 'title' => $this->l('Order Date'), + 'type' => 'datetime', + 'havingFilter' => true, + 'hint' => $this->l('Transaction date.'), + ), + ); + } + + public function renderList() + { + unset($this->toolbar_btn['new']); + $this->addRowAction('edit'); + return parent::renderList(); + } + + public function getOrderLink($orderReference, $row) + { + $orders = explode(',', $row['id_orders']); + $this->context->smarty->assign( + array( + 'order_reference' => $orderReference, + 'details' => $row, + 'orders' => $orders, + 'admin_order_link' => $this->context->link->getAdminLink('AdminOrders'), + ) + ); + + return $this->createTemplate('getOrderLink.tpl')->fetch(); + } + + public function checkCurrency($val, $row) + { + $currency = new Currency($row['id_currency']); + return Tools::displayPrice($val, $currency); + } + + public function getCustomerInfo($idCustomer, $row) + { + $this->context->smarty->assign( + array( + 'id_customer' => $idCustomer, + 'details' => $row + ) + ); + + return $this->createTemplate('getCustomerInfo.tpl')->fetch(); + } + + public function getRenderListColumnAsBadge($columnValue) + { + $refundStatuses = QdpDuitkuTransaction::getPaymentStatuses(); + $badgeMap = array( + QdpDuitkuTransaction::QDP_TRANSACTION_COMPLETED => 'badge-success', + QdpDuitkuTransaction::QDP_TRANSACTION_AWAITING => 'badge-primary', + QdpDuitkuTransaction::QDP_TRANSACTION_FAILED => 'badge-danger', + ); + $this->context->smarty->assign( + array( + 'badge' => $badgeMap[$columnValue], + 'text' => $refundStatuses[$columnValue] + ) + ); + + return $this->createTemplate('getStatusBadge.tpl')->fetch(); + } + + public function displayEditLink($token, $id, $name = null) + { + $this->context->smarty->assign( + array( + 'table' => $this->table, + 'token' => $this->token, + 'current' => self::$currentIndex, + 'id_duitku_payment_transaction' => $id + ) + ); + + return $this->createTemplate('getViewIcon.tpl')->fetch(); + } + + public function renderView() + { + $this->page_header_toolbar_title = $this->l('Transaction details'); + + return parent::renderView(); + } + + public function renderForm() + { + + $this->page_header_toolbar_title = $this->l('Transaction details'); + $this->page_header_toolbar_btn['add'] = array( + 'href' => self::$currentIndex . '&token=' . $this->token, + 'desc' => $this->l('Back to list'), + 'icon' => 'process-icon-back' + ); + + if (($id = Tools::getValue('id_duitku_payment_transaction')) || ($id = Tools::getValue('id'))) { + if (Validate::isLoadedObject($objDuitkuTransaction = new QdpDuitkuTransaction((int) $id))) { + $idCart = $objDuitkuTransaction->id_cart; + if (Validate::isLoadedObject($objCart = new Cart((int) $idCart))) { + $transactionInfo = (array) $objDuitkuTransaction; + if (Validate::isLoadedObject($objOrder = new Order(Order::getOrderByCartId($idCart)))) { + $transactionInfo['reference'] = $objOrder->reference; + } else { + $transactionInfo['reference'] = $this->l('N/A'); + } + + $objCustomer = new Customer((int) $objOrder->id_customer); + $transactionInfo['customer_link'] = $this->context->link->getAdminLink( + 'AdminCustomers', + Tools::getAdminTokenLite('AdminCustomers') + ) . '&id_customer=' . (int) $objCustomer->id . '&viewcustomer'; + $transactionInfo['customer_name'] = $objCustomer->firstname . ' ' . $objCustomer->lastname; + $transactionInfo['email'] = $objCustomer->email; + $objCurrency = new Currency($objCart->id_currency); + $this->context->smarty->assign( + array( + 'QDP_DUITKU_ENVIRONMENT_SANDBOX' => + QdpDuitkuTransaction::QDP_DUITKU_ENVIRONMENT_SANDBOX, + 'currency' => $objCurrency, + 'TRANSACTION_COMPLETED' => QdpDuitkuTransaction::QDP_TRANSACTION_COMPLETED, + 'TRANSACTION_AWAITING' => QdpDuitkuTransaction::QDP_TRANSACTION_AWAITING, + 'TRANSACTION_FAILED' => QdpDuitkuTransaction::QDP_TRANSACTION_FAILED, + 'transaction_info' => $transactionInfo, + ) + ); + } + } + } + + $this->fields_form = array( + 'submit' => array( + 'title' => $this->l('Save'), + ) + ); + + return parent::renderForm(); + } +} diff --git a/modules/qloduitkupayment/controllers/admin/index.php b/modules/qloduitkupayment/controllers/admin/index.php new file mode 100644 index 000000000..409280877 --- /dev/null +++ b/modules/qloduitkupayment/controllers/admin/index.php @@ -0,0 +1,32 @@ +display_column_left = false; + $this->display_column_right = false; + parent::init(); + } + + public function postProcess() + { + $apiKey = Configuration::get('QDP_DUITKU_PAYMENT_API_KEY'); + $merchantCode = isset($_POST['merchantCode']) ? $_POST['merchantCode'] : null; + $paymentAmount = isset($_POST['amount']) ? $_POST['amount'] : null; + $merchantOrderId = isset($_POST['merchantOrderId']) ? $_POST['merchantOrderId'] : null; + $productDetail = isset($_POST['productDetail']) ? $_POST['productDetail'] : null; + $additionalParam = isset($_POST['additionalParam']) ? $_POST['additionalParam'] : null; + $paymentMethod = isset($_POST['paymentCode']) ? $_POST['paymentCode'] : null; + $resultCode = isset($_POST['resultCode']) ? $_POST['resultCode'] : null; + $merchantUserId = isset($_POST['merchantUserId']) ? $_POST['merchantUserId'] : null; + $reference = isset($_POST['reference']) ? $_POST['reference'] : null; + $signature = isset($_POST['signature']) ? $_POST['signature'] : null; + + $this->module->logger->log('Start callback transaction ', FileLogger::INFO); + $this->module->logger->log($_POST, FileLogger::INFO); + + if (!empty($merchantCode) && !empty($paymentAmount) && !empty($merchantOrderId) && !empty($signature)) { + $params = $merchantCode . $paymentAmount . $merchantOrderId . $apiKey; + $calcSignature = md5($params); + + if ($signature == $calcSignature) { + + $orderResponse = explode('_', $merchantOrderId); + $idCart = (int) end($orderResponse); + $objCart = new Cart((int) $idCart); + $objCustomer = new Customer((int) $objCart->id_customer); + $id_currency = (int) $objCart->id_currency; + $this->context->currency = new Currency($id_currency); + + $objDuitkuTransaction = new QdpDuitkuTransaction(); + $objDuitkuTransaction->id_transaction = $reference; + $objDuitkuTransaction->environment = Configuration::get('QDP_DUITKU_PAYMENT_ENVIRONMENT'); + $objDuitkuTransaction->id_cart = (int) $idCart; + $objDuitkuTransaction->id_order = $merchantOrderId; + $objDuitkuTransaction->id_currency = $id_currency; + + if ($resultCode == '00') { + if ($objCart->is_advance_payment) { + $cartTotalAmount = $objCart->getOrderTotal(true, Cart::ADVANCE_PAYMENT); + $orderStatus = Configuration::get('PS_OS_PARTIAL_PAYMENT_ACCEPTED'); + } else { + $cartTotalAmount = $objCart->getOrderTotal(true, Cart::BOTH); + $orderStatus = Configuration::get('PS_OS_PAYMENT_ACCEPTED'); + } + $transactionStatus = QdpDuitkuTransaction::QDP_TRANSACTION_COMPLETED; + } else { + if ($objCart->is_advance_payment) { + $cartTotalAmount = $objCart->getOrderTotal(true, Cart::ADVANCE_PAYMENT); + } else { + $cartTotalAmount = $objCart->getOrderTotal(true, Cart::BOTH); + } + $orderStatus = Configuration::get('PS_OS_ERROR'); + $transactionStatus = QdpDuitkuTransaction::QDP_TRANSACTION_FAILED; + } + + + $cart_amount = round($cartTotalAmount, 2); + $objDuitkuTransaction->cart_total = $cart_amount; + + $objDuitkuTransaction->status = $transactionStatus; + + $res = $objDuitkuTransaction->checkExists($objDuitkuTransaction->id_transaction); + if (!$res) { + $this->module->logger->log('Saving transaction', FileLogger::DEBUG); + $objDuitkuTransaction->save(); + } else { + $this->module->logger->log('Updating transaction', FileLogger::DEBUG); + $objDuitkuTransaction->id = $res['id_duitku_payment_transaction']; + $objDuitkuTransaction->update(); + } + + $extraVars = array(); + + $extraVars['transaction_id'] = $reference; + $lockExists = $objDuitkuTransaction->getCartLock($idCart); + if (Validate::isLoadedObject($objCart)) { + $this->module->logger->log('Callback After Cart Validation in return.', FileLogger::DEBUG); + if ($lockExists) { + $this->module->logger->log('Order already in process for cart id ' . $idCart, FileLogger::DEBUG); + + $orderCounter = 0; + while (1) { + sleep(1); + + if ($objCart->OrderExists() == true) { + $objDuitkuTransaction->removeCartLock($idCart); + $allOrders = Order::getAllOrdersByCartId($idCart); + $this->module->logger->log('Orders.', FileLogger::INFO); + foreach ($allOrders as $ord) { + if ($ord['current_state'] != Configuration::get('PS_OS_PARTIAL_PAYMENT_ACCEPTED') + && $ord['current_state'] != Configuration::get('PS_OS_PAYMENT_ACCEPTED') + ) { + $order_state = new OrderState($orderStatus); + $history = new OrderHistory(); + $history->id_order = $ord['id_order']; + $history->id_employee = 0; + $order = new Order($ord['id_order']); + + $useExistingPayment = false; + if (!$order->hasInvoice()) { + $useExistingPayment = true; + } + $history->changeIdOrderState((int) $order_state->id, $order, $useExistingPayment); + + $carrier = new Carrier($order->id_carrier, $order->id_lang); + $templateVars = array(); + + if (!($history->addWithemail())) { + $this->module->logger->log('An error occurred while changing order status, or we were unable to send an email to the customer.'); + } + } + } + break; + } + $orderCounter++; + if ($orderCounter > 5) { + $this->module->logger->log('Order not created for cart id ' . $idCart . ' after 5 seconds', FileLogger::DEBUG); + break; + } + } + } else { + $objDuitkuTransaction->addCartLock($idCart); + if ($this->module->validateOrder( + (int) $idCart, + $orderStatus, + $cart_amount, + $this->module->l('Duitku Payment', 'return'), + null, + $extraVars, + (int) $id_currency, + false, + $objCustomer->secure_key + )) { + $this->module->logger->log('Callback Process Order created.', FileLogger::DEBUG); + } else { + $this->module->logger->log('Callback Process Order already exist!!.', FileLogger::DEBUG); + } + } + } else { + $this->module->logger->log(' Invalid Cart Object', FileLogger::DEBUG); + } + } else { + $this->module->logger->log(' Bad Signature', FileLogger::DEBUG); + } + } else { + $this->module->logger->log(' Bad Parameter', FileLogger::DEBUG); + } + } +} diff --git a/modules/qloduitkupayment/controllers/front/error.php b/modules/qloduitkupayment/controllers/front/error.php new file mode 100644 index 000000000..eedd73314 --- /dev/null +++ b/modules/qloduitkupayment/controllers/front/error.php @@ -0,0 +1,42 @@ +display_column_left = false; + $this->display_column_right = false; + + parent::init(); + + if (Tools::getValue('validation_error')) { + $this->context->smarty->assign(array( + 'txn_id' => Tools::getValue('id'), + )); + $this->setTemplate('validation_error.tpl'); + } else if (Tools::getValue('auth_error')) { + $this->setTemplate('auth_error.tpl'); + } else { + Tools::redirect($this->context->link->getPageLink('order-opc', true, null) . '?duitku_err=1'); + } + } +} diff --git a/modules/qloduitkupayment/controllers/front/index.php b/modules/qloduitkupayment/controllers/front/index.php new file mode 100644 index 000000000..409280877 --- /dev/null +++ b/modules/qloduitkupayment/controllers/front/index.php @@ -0,0 +1,32 @@ +module->logger->log('Start return process.', FileLogger::INFO); + $this->module->logger->log($response, FileLogger::INFO); + + if (isset($response['resultCode'])) { + if ($response['resultCode'] == '00' || $response['resultCode'] == '01') { + $merchantOrderId = Tools::getValue("merchantOrderId"); + $reference = Tools::getValue("reference"); + $orderResponse = explode('_', $merchantOrderId); + $idCart = (int) end($orderResponse); + $objCart = new Cart((int) $idCart); + + $objCustomer = new Customer((int) $objCart->id_customer); + $id_currency = $objCart->id_currency; + if ($objCart->is_advance_payment) { + $cartTotalAmount = $objCart->getOrderTotal(true, Cart::ADVANCE_PAYMENT); + } else { + $cartTotalAmount = $objCart->getOrderTotal(true, Cart::BOTH); + } + + $cartAmount = round($cartTotalAmount, 2); + + $objDuitkuTransaction = new QdpDuitkuTransaction(); + $objDuitkuTransaction->id_transaction = $reference; + $objDuitkuTransaction->environment = Configuration::get('QDP_DUITKU_PAYMENT_ENVIRONMENT'); + $objDuitkuTransaction->id_cart = (int) $idCart; + $objDuitkuTransaction->id_order = $merchantOrderId; + $objDuitkuTransaction->id_currency = $id_currency; + $objDuitkuTransaction->cart_total = $cartAmount; + + $objDuitkuTransaction->status = QdpDuitkuTransaction::QDP_TRANSACTION_AWAITING; + $orderStatus = Configuration::get('PS_OS_AWAITING_PAYMENT'); + + $res = $objDuitkuTransaction->checkExists($objDuitkuTransaction->id_transaction); + + $extraVars['transaction_id'] = $reference; + $this->module->logger->log('Before Cart Validation in return.', FileLogger::DEBUG); + $lockExists = $objDuitkuTransaction->getCartLock((int) $idCart); + try { + if ($lockExists) { + $this->module->logger->log('Order already in process for cart id ' . $idCart, FileLogger::DEBUG); + + $orderCounter = 0; + $redirect = false; + + while (1) { + sleep(2); + + if ($objCart->OrderExists()) { + $redirect = true; + $objDuitkuTransaction->removeCartLock($idCart); + break; + } + + $orderCounter++; + if ($orderCounter > 5) { + $redirect = true; + $this->module->logger->log('Order not created for cart id ' . $idCart . ' after 5 seconds', FileLogger::DEBUG); + + break; + } + } + if ($redirect) { + $url = $this->context->link->getPageLink('order-confirmation', true, null, [ + 'id_cart' => $idCart, + 'id_module' => $this->module->id, + 'id_order' => Order::getOrderByCartId($idCart), + 'success' => 1, + 'key' => $objCustomer->secure_key, + ]); + + Tools::redirect($url); + } + } else { + + $this->module->logger->log('After Cart Validation in return.', FileLogger::DEBUG); + $objDuitkuTransaction->addCartLock((int) $idCart); + if (!$res) { + $objDuitkuTransaction->save(); + } + + if ($this->module->validateOrder( + (int) $idCart, + $orderStatus, + $cartAmount, + $this->module->l('Duitku Payment', 'return'), + null, + $extraVars, + (int) $id_currency, + false, + $objCustomer->secure_key + )) { + + $this->module->logger->log('Return Process Order created.', FileLogger::DEBUG); + + $url = $this->context->link->getPageLink('order-confirmation', true, null, [ + 'id_cart' => $idCart, + 'id_module' => $this->module->id, + 'id_order' => Order::getOrderByCartId($idCart), + 'success' => 1, + 'key' => $objCustomer->secure_key, + ]); + Tools::redirect($url); + } + } + + $this->module->logger->log('After Cart Validation in return.', FileLogger::DEBUG); + } catch (Exception $e) { + Tools::redirect($this->context->link->getModuleLink('qloduitkupayment', 'error') . '?validation_err=1&id=' . $response['merchantOrderId']); + } + } else { + $this->module->logger->log('Payment cancelled. Find POST dump below.', FileLogger::ERROR); + $this->module->logger->log($response, FileLogger::ERROR); + Tools::redirect($this->context->link->getPageLink('order-opc', true, null, array('duitku_err' => 1))); + } + } else { + $this->module->logger->log('Order transaction failed: ' . $response['reference'], FileLogger::ERROR); + Tools::redirect($this->context->link->getModuleLink('qloduitkupayment', 'error', array('auth_error' => 1))); + } + } +} diff --git a/modules/qloduitkupayment/controllers/front/validate.php b/modules/qloduitkupayment/controllers/front/validate.php new file mode 100644 index 000000000..f2ce8100c --- /dev/null +++ b/modules/qloduitkupayment/controllers/front/validate.php @@ -0,0 +1,52 @@ +display_column_left = false; + $this->display_column_right = false; + + if (Tools::getValue('ajax')) { + if (Tools::getValue('action') == 'getDuitkuTransactionToken') { + $objDuitkuPayment = Module::getInstanceByName('qloduitkupayment'); + $response = $objDuitkuPayment->getDuitkuTransactionTokenResponse(); + + if (isset($response['status']) && $response['status'] === true) { + $response['status'] = true; + } else if (isset($response['response']['statusMessage'])) { + $response['message'] = $response['response']['statusMessage']; + } elseif (isset($response['response']['title'])) { + $response['message'] = $response['response']['title']; + } else { + $response['message'] = $objDuitkuPayment->l('Unknown error'); + } + + die(json_encode($response)); + } + } + } +} diff --git a/modules/qloduitkupayment/controllers/index.php b/modules/qloduitkupayment/controllers/index.php new file mode 100644 index 000000000..409280877 --- /dev/null +++ b/modules/qloduitkupayment/controllers/index.php @@ -0,0 +1,32 @@ +YvH2et_g|9+Fh>u2Wb~mwXvd`Pc zzTNlsU3X@A`;qMGxXI1ToVn-B+%p6GcL;i1+XK;3^@f>#f#(%U0KtIZ!aCQ{>?A3bfGZ58Uyctl+VL1>yOG50Q=SU~IM^hF zyM)?o>Y4Ie5Dl#mS`cm~<{xI=Y(ta%_IDO=a>IR*2falrweotb()W>#E3knTuaG`j zAp8=fOtazTv%IJ*SH~S*5;ENO$RH3;LCy7`G~0z~*l2I|ik@T}`G$n)ai>xsks{nh zNs;xSfce2>K5=BgVXT2k0g#Zw0tv3K5)jYvH$?8Ez{R~3AndO@XcNVkm>zTLw#Nc= zwY3OUH-iKA%7*&l_Tu`4200000 LNkvXXu0mjf5oYOx literal 0 HcmV?d00001 diff --git a/modules/qloduitkupayment/logo.png b/modules/qloduitkupayment/logo.png new file mode 100644 index 0000000000000000000000000000000000000000..a13d1cb816c0b5c2d0713648500fc7ccde2f8199 GIT binary patch literal 7747 zcma)h=RX@>__h^dM<_8uf}*rms|bq3rgrU3^;=tQS|bf&6g6tprgo`SyFrX9ikdZR zRVrq!+CRVN`2(Kk#r@*G&UkTuuKPOYTqj0fSDl`QgNB5JgkDoa#gK%Al;VE_NO^;N z2WtKA0JWEfxeo~mE%W~dDM?l~~uv=@!E(y&-w@mx3kJm&4`w1+# z7Lnw|9g87XIYqjW+G=!Dy-)8!^(Bc>&j^`d;R3M+D;U32h{(hG?N)xAht`@5|Wa7Kb1kXdHT(=T7WUTnAC#kEMrZ-h< z&A_fiLDd2?NHA{v`G9wa$F!eSfj*0?x~|#kM%3bxt8uSQy)aNBqVS3=Y(k_`{T0;% z{~8OmG0q^KRhr(y4H-z(`_a1}jn(2cs2r9B9>i(8R(BV7LZl12Aky}RzHQLKaP`O% z<19AqLD$?>Sjn4(bZEbe5gpbb-ptGDb%cSs6eQ^>)9k|ju?kR=uUEHC>Tk)Nfb9oy z`qxVdupa){fB1mzQG0o&3ey^KW0;zuO5MM^Y<}}}_U_s-My4>ah6fvJ&#P=)e3Jpqu zoN8B3izZ$y^{RYA!BwY!rz!y4XpEGL2_<$ %QBoP8DRCX zPsBN@EA{v9NH%f0rZ%yi*#lbb+*O_Lw!d1hipN~QpIUHZB~#1 ze7D0-pZU9g**thz1j3Xx-X)>M<7BVb|F&uvT@~^mRM_CiI*j{(a~iFl^XC0(AXDT3Mx>cTxyV3l3V!i%60ee<62dv6d1&+Ers0lOzvn9dMaCdDcnvCn|xGpYh)8vUx=p z_~wLq;QrgJDrdhiN-N*&fig`vcCuL|uh6G1EAzivwk zy;mH(iuz8B&%)WsJwRTt*Z#WU*zC!(q+!GNca?a17^f|RGe+U`gE>WOV*UZ5)JUvi z?xU*)RJ5jOfSMF93V=lKH_Ycp>a3>H>a`hx*+iMZ3`?@j`EH@}ve(Z8w0JQXJ}<*Z zLhn7b2ueU|0pqj;Tjj*9z=n{Z!_GT&P$2vYQ;92;o1RSYb@yyu!I0 zS?q%-hO+1xPql0Fo7%+^bk?TuqXGI#bB*R0hNIc1%0PC;p!bQ)0aQnlH|-Hf%_8k| z+v%^y;Nhk{1Y;}qy19THJLi-JlH@-Ai1@yvs;tH#?Tc+wB!@f6N4*TFNw!l&$NOfR zQ$;agbkgB*hr-kh-6I;8$Y{;&5hY+u|JQrLSp}&1OZM0gU^WRRNm8qiF0BQq!%KFr zDx36k32^d*>UT23qwpJoP@U7C!Z7@a8y{so2*0NN-EWpTZLF#J7Ti=0FAYj$Mo=_b z9|+6SFe4@^O`A<3lBicifZ~su)G8vV?w#t<1`l(mnkJqmtkyXr1+;%*zPJ=`Zu}r( zyopbi-;Sr~#|+5OR+aiFlS=krok^_@W8yN-l2&7K>p^g#38RcHehxo>Y#xeUHR1H=-)i}y zmkghC@KZf%z|6qL1c0LJrL|cU(<5tI>W}-^y04Tv@Aj8Lr!(5Ea@L zC9hnlUi`Co|OF)Dg&k9Q~w5C{mmMc!FH z{m=K~(n4`BiLpuH?X__w{=B}*W}w}!$^?f>uV=tBoO!gIP5Q0^q?z-Hd@)2{MQTS*up>q;-&Se`+7zk%!kGz6T59V!`rL?)44ZxA6~&3FyA?${_SRu^^(-Cc z@O0gnATHgMQAUg%wYM+l`bU-cr?0)+3yzS~0ZP1i><|nj3CmcGqS19CfVw~Wu!7gA zZn#&G=lbI~$k5^HHx%mL3>wQ5Kx3c-=7cLP8luQzJ zb%HejO{$R9Agaigx{OMzDIeTXbWwv5zsVX|5es`02BojeYXlcYY`aK*8J}tba)R z&&a=eOM<_rntH0<^0KHou}Z60w49CLxP?Hs$N^nLN$_YX;HrSvhkzt93D}=LjltG^ zrz?4kw=1KTh%|LF*N62K-Z)5>@lbkncxL1cJpY&6sV;k^VRdc55h)R4{W0!NLceCP zxGw1LZz#-IqtK7*1rS4Fp9@>7(vm1g79;QcEJr0jj<2u&rWG2SEIyf$3S(i@1159X zC&v!Kbt2@0fSNV8;QYWrJ7egtcu z;&IN#nv{FTCT6Dn3$KQxm+et%9WFgVRW@MhaU}wumxPt`Co>IjN-M4CHnO0bNmJw_TB9z z8EEwxu}4PwJSdJyGh@)&8hy-n$XMUsHLfKRK(~&S0h9OZ``4x|>}yxWmpiwS?0#Jq3Htf7StC)a3X2 zJ=ya9Z3XnAY|p>EWF#Z4jfhx0nO=ghU(W>Or7%KYDh|b?bK8wKqWAHmM?Ni3J)9c0 z@4oFhiiwSx2qM6XvF3qP&2fvDU1D3cG+Zz=sW)}jJN-|={x)_lM(RnSm+dRpjm^w}Ru*SBD+x7Ld;52y$Ifk9* z^1WbG!v3Gcb|3yA&Gv%mB=9lExU^O?v7Uwe(@_Qe{s*eC$B(WDnjZa!3!BcdTp`~L za-6|`&0Af>{cFACaM=4mwbWbq0Sig18`;$A?@)6W7>`eUd4N+j@d`%l(fxo?maH=k zfiZNtvfp2183c?yR?9OWDJ#QlC>N$ILG=u~J)|-}?)}wy>KC}W^wF|T_O=XtJQ!1T zo28Up*!M&&Qcz^SvBF#5&cb)9g~_NOTAUBDJvAf(mQduOx=e_Fj@UTN9*3;nwR`dY z^Wm4=-U5KGi|}NSwXPm=*n>bA&-bpLi+LV$-|L+{CCpR5#+s>~avh&2@9$AYBS9ym zW~ho1ZwFg@QxKDpGMt!NNU?xutnJdYe)>l<&K3~lcf02EXYa7(DA+>P* zrD2$g;18+BCw74T$AHZ`D_)wX<3Fp(u;@#Rzo zY(sCU!$Tnf$gFJs!tvy(gvdMFQ%i^aTe~2B_G6oW6*I4njUtxL>qly^>UkERlFlT1 znjs5168}d617q%Qa6!5pH@cDW086?zXOaVoG?2x}xU&0iTJQJv2lS?lY{jvOeO@Q> zSpU}+YP#fXb7b8qJ8eo^Cqy$MQhA#gG;oz*TWg&4g0h1_fdU+Fjs`j2!{=QuJlXH{ zjJ!{2E!3`prw8`ZN25t=!!@!IQ_TIQ#Fe2xzHWC{A8u=4Q-($)wla{>FF+yQE?Jejsfs8J)iEk5bd3`vUD zW^i?wJoJ&=icaD~99^^Vvm=JnRaosmI3&zmcB!j)d!rtO&kk#LP~MztM-Vrttq?tK zYOMcMVmqhwgY*Q=BF)Hf+0n^a|DR~eh2Ma4ANdJlm9p|z_OG{RPAOhnQu=Z}8FS~s zHsD!ZFgg()f)@?q)Qo@#h3MVdHD*FRRp0&0`TA%0moF> z*6w!f&D&+ibu=!?s+BmbN`&_uujdAC{mBiS50*bi>KO|*a6rfoZM3nA=l(R^W@Zkf z)waw|!I0a);oydQ{n>8ZVrJar+?UgPkk4Y&mRx(S&I|E-Tq{hJkg%s8V7f~aidUAN zV%U%G&vxHR=sVa24tJH>~=&fk-4tC3z_Yx_e1UM+v2L zy>=z~APpBnBcn>G`Rd^cT>&iVrz15<1;{+`L5L90spPN&Z5;)?6My zv+OTHH{0E{yC|I7iBoD@I3dG6?)?-BWT60OF|F?ULCBowXvnkSGT zvf4j>ZAcjDSM%_Br1Dp}Y#M$JHEJ>w?iaNN$gkXyZ$brmqsZ1k!N4GL&DVKPImuim<7v7 z?(S}V&{gcUKTLUJ+SZes6PvvxmE`4Q1LD4N4m_FpDe8V+H!Z!8*z%lxwMp^OnaJfP z?htwMpUw)R^QScRe(ed}Yq-S zxSE?*SLpHV>(|6X>By$)f1l!7d`b~(vQp71Pbhcyk2J|=y}#19pG}8l-=23 zyWirrwn7Mxrk{txU79Zmxpz@fZ;K#Qst84U1-pNteS2H}ntlJuwDlRyt9&6RdAQkY z=QK0r&+TvkckJJS8L)uml%9}!O*cNX_%zW+}gHoIBsxdCksOKF0f;t3BA z$IlVi`tA2UW^}|1e%^z&ydIbSVuiT1gwi;ClcEjH#g`#YkR<%3{uT-$a8#oSnfW5rk%gZN;v8mvzqQ4RkCA?W`DTQ z1s>=6h+*BxcEiWxGrJou@5HlU*3$2nk_S`$d=1C5C>8w}Qr?B7+}xdLI#FLOsPA{Y z-ip|nDzSGZN^><%(L&5?ViiFe}!M=}M0H~qC1{pIzKcSpOkT46@1 z4YaCF=8nyFpchT$cc?Y*oXB(cY31%`;h<&)$xeKCyCVm}^M zk47hveOj{beP-(X^5IA8_xKg(GTpx~OozdlODzKwb`L_Md~86HP=Y!W(oG160ddlh z!F!_6O2FCz80h~O;;r$wGP@g>Hd*9QV{j{ExB`Zu6Jm*V2(=$LI3VwT_{!%XuFz~t z+Hu<-QMkaplUVyn=D)fzm+csvfKjVvv+Vjlv9B8)Hl{ZoZdBj*5wSRAEiU%+0s^$) zA?M{5zdmy5cd9LND=7cfF*$z^Axd zI{eLJk!wk$G^O(7*>v1D{uD|3vxPE0*7T`j(|m%z+&hIM0NJ8y%L}(PvmAfzM|rkp z++YqM^5$-ME+v10^tSuaY%UVfDVxJPIXZjtvC2lUzwaBIuuLY3E>!wTQd)r6zdvvI zeDN5_B0g^u@GDa!k;E?h?~nbfAAckBU~w zszQ$a`u&yP(Z^p?ZB4q}K^o~yiVSb$n{Eq@!cES8?=8rD{dd+oWLxG%^Z!0Z?`!J*@Js?Sk?zeFB z3V{%v|2=_*`(A$>Eoh(0b5|ndb5@7mUB9Zdill+s&0N;1N6Uj=dU}Lv2E&Ad%9oUw z5d4c#P&TRIwuZCYcs~~(?FY$*c5dIE29Ooi*n|u`w3^^lf~79=Dwc*Yoz;5X?+JK9 z$WP7$(WJHeCOqNBa?QESas&TD`qD*vghBYlu;lDn$QANva0&`+HZtgK&Wxq$9AA2 zfK-uWo~!9;9;P_w#!U4X&>m7E*kEeW`SU!#8L%;(3!V?>*_3WW5ro?l8aA7k9NGV8 zltaC98{VU$KeVyFp!=c&ZLwJe`KyG9IBe@Uyal#)0!rM%jgmg?J41IBrz40$j6E94 zqj`T#^^`o4X1_!GM}Z24UYM?HtAq;H%!X9tBLO>CYAw zp3QVJwwR>5pvG;B)Eh5fuV_3jqd7WUwAQ0STJ#?PoP7IG4#!+72y!m3w-DI=Ji%`L zZlN7pz6SCtEaqXMNLDTMbz{i#>l~h`)GIP2OO}&nO6E;G7f_e|8!UsFj}2lV?l>(i~G&5uR#%B~HX#?oL1VT0M~H!RRJytHK|76xOg zYyASh?#_VwnQX<1`JTzQ>6@H3FPv4E;AUCCSOyVb< zx5-Vi@1ur(t1PPIUcN&hqQPtweqNAzH$P|gwr>f+e$s}H#&?T2^1WOGkZSw1(CoM? z^lXD%?`>~orBw}xWGuh1y56^Tl5mco2wv)oaI9Yf*IYwWRqnCq4@^e5DS>1TkB_mf zQ59s~2l)q3p8u#^$iEb(+b5s$x2fw_($9M1TCKname = 'qloduitkupayment'; + $this->tab = 'payments_gateways'; + $this->author = 'Duitku'; + $this->version = '4.0.0'; + $this->bootstrap = true; + $this->ps_versions_compliancy = array('min' => '1.6', 'max' => _PS_VERSION_); + $this->payment_type = OrderPayment::PAYMENT_TYPE_ONLINE; + $this->qloapps_versions_compliancy = array('min' => '1.4', 'max' => _QLOAPPS_VERSION_); + + parent::__construct(); + + $this->displayName = $this->l('QloApps Duitku Payment'); + $this->description = $this->l('This module allows guests to pay using Duitku payment gateway.'); + $this->confirmUninstall = $this->l('Are you sure you want to uninstall?'); + $this->setLogger(); + } + + public function install() + { + $objDuitkuPaymentDb = new QdpDuitkuPaymentDb(); + if ( + !parent::install() + || !$this->callInstallTab() + || !$this->registerHooks() + || !$objDuitkuPaymentDb->createTable() + ) { + return false; + } + + return true; + } + + public function callInstallTab() + { + $this->installTab('AdminDuitkuTransaction', 'Duitku Transactions'); + + return true; + } + + public function registerHooks() + { + return $this->registerHook( + array( + 'displayBackOfficeHeader', + 'actionFrontControllerSetMedia', + 'actionAdminControllerSetMedia', + 'displayPayment', + 'displayPaymentReturn' + ) + ); + } + + public function hookDisplayBackOfficeHeader() + { + $this->context->controller->addCSS($this->local_path . 'views/css/admin/duitku.css'); + } + + public function installTab($className, $tabName, $tabParentName = False, $hiddenTab = False) + { + $tab = new Tab(); + $tab->active = 1; + $tab->class_name = $className; + $tab->name = array(); + + foreach (Language::getLanguages(true) as $lang) { + $tab->name[$lang['id_lang']] = $tabName; + } + + if ($hiddenTab) { + $tab->id_parent = -1; + } elseif ($tabParentName) { + $tab->id_parent = (int) Tab::getIdFromClassName($tabParentName); + } else { + $tab->id_parent = 0; + } + + $tab->module = $this->name; + + return $tab->add(); + } + + public function getContent() + { + if (Tools::isSubmit('submitDuitkufigForm')) { + if ($this->validateConfigurationValues()) { + $this->saveConfigurationValues(); + Configuration::updateValue('QDP_DUITKU_PAYMENT_CONFIGURED', 1); + Tools::redirectAdmin($this->context->link->getAdminLink('AdminModules', true) . '&conf=6&configure=' . $this->name); + } + } + + return $this->renderForm(); + } + + public function renderForm() + { + $helper = new HelperForm(); + $helper->show_toolbar = false; + $helper->table = $this->table; + $helper->module = $this; + $helper->default_form_language = $this->context->language->id; + $helper->identifier = $this->identifier; + $helper->submit_action = 'submitDuitkufigForm'; + $helper->currentIndex = $this->context->link->getAdminLink('AdminModules', false) + . '&configure=' . $this->name . '&tab_module=' . $this->tab . '&module_name=' . $this->name; + + $helper->token = Tools::getAdminTokenLite('AdminModules'); + $helper->tpl_vars = array( + 'fields_value' => $this->getConfigFormFieldsValue(), + 'languages' => $this->context->controller->getLanguages(), + 'id_language' => $this->context->language->id, + ); + + return $helper->generateForm(array($this->getConfigFormFields())); + } + + + public function getConfigFormFields() + { + $cashfreeEnvironmentOptions = array( + array( + 'id' => QdpDuitkuTransaction::QDP_DUITKU_ENVIRONMENT_SANDBOX, + 'value' => $this->l('Sandbox') + ), + array( + 'id' => QdpDuitkuTransaction::QDP_DUITKU_ENVIRONMENT_PRODUCTION, + 'value' => $this->l('Production') + ), + ); + + return array( + 'form' => array( + 'legend' => array( + 'title' => $this->l('Duitku Configuration'), + 'icon' => 'icon-cogs', + ), + 'input' => array( + array( + 'type' => 'select', + 'label' => $this->l('Environment'), + 'hint' => $this->l('Select current environment to use for Cashfree transaction. Select Sanbox to test configurations and production to accept payment live.'), + 'name' => 'QDP_DUITKU_PAYMENT_ENVIRONMENT', + 'class' => 'input fixed-width-lg', + 'options' => array( + 'query' => $cashfreeEnvironmentOptions, + 'id' => 'id', + 'name' => 'value', + ), + 'required' => true, + ), + array( + 'type' => 'text', + 'name' => 'QDP_DUITKU_PAYMENT_API_KEY', + 'label' => $this->l('Api Key'), + 'hint' => $this->l('Enter Api Key obtained from Duitku.'), + 'required' => true, + 'col' => '4', + ), + array( + 'type' => 'text', + 'name' => 'QDP_DUITKU_PAYMENT_MERCHANT_CODE', + 'label' => $this->l('Merchant Code'), + 'hint' => $this->l('Enter merchant code obtained from Duitku.'), + 'required' => true, + 'col' => '4', + ), + array( + 'type' => 'text', + 'label' => $this->l('Expiry Period'), + 'name' => 'QDP_DUITKU_PAYMENT_EXPIRYPERIOD', + 'required' => true, + 'col' => '4', + 'hint' => $this->l('Number in minutes. Range 10 to 180.'), + ) + ), + 'submit' => array( + 'title' => $this->l('Save'), + ), + ), + ); + } + + + public function getConfigFormFieldsValue() + { + $configKeys = array( + 'QDP_DUITKU_PAYMENT_API_KEY', + 'QDP_DUITKU_PAYMENT_MERCHANT_CODE', + 'QDP_DUITKU_PAYMENT_ENVIRONMENT', + 'QDP_DUITKU_PAYMENT_EXPIRYPERIOD' + ); + $fieldsValue = array(); + foreach ($configKeys as $key) { + $fieldsValue[$key] = Configuration::get($key) ? Configuration::get($key) : Tools::getValue($key); + } + + return $fieldsValue; + } + + + public function validateConfigurationValues() + { + $expiryPeriod = Tools::getValue('QDP_DUITKU_PAYMENT_EXPIRYPERIOD'); + if (empty(trim(Tools::getValue('QDP_DUITKU_PAYMENT_API_KEY')))) { + $this->context->controller->errors[] = $this->l('Please enter your Api Key.'); + } + + if (empty(trim(Tools::getValue('QDP_DUITKU_PAYMENT_MERCHANT_CODE')))) { + $this->context->controller->errors[] = $this->l('Please enter your Merchant Code.'); + } + + if (!Validate::isCleanHtml(Tools::getValue('QDP_DUITKU_PAYMENT_API_KEY'))) { + $this->context->controller->errors[] = $this->l('Please enter valid Api Key.'); + } + + if (!Validate::isCleanHtml(Tools::getValue('QDP_DUITKU_PAYMENT_MERCHANT_CODE'))) { + $this->context->controller->errors[] = $this->l('Please enter a valid Merchant Code.'); + } + + if (!$expiryPeriod || !Validate::isInt($expiryPeriod) || $expiryPeriod < 10 || $expiryPeriod > 180) { + $this->context->controller->errors[] = $this->l('Invalid expiry period value. The value should be in number between 10 to 180. It count in minutes.'); + } + + if (empty($this->context->controller->errors)) { + return true; + } + + return false; + } + + public function saveConfigurationValues() + { + $configKeys = array( + 'QDP_DUITKU_PAYMENT_API_KEY', + 'QDP_DUITKU_PAYMENT_MERCHANT_CODE', + 'QDP_DUITKU_PAYMENT_ENVIRONMENT', + 'QDP_DUITKU_PAYMENT_EXPIRYPERIOD' + ); + foreach ($configKeys as $key) { + $value = Tools::getValue($key); + Configuration::updateValue($key, Tools::getValue($key)); + } + return true; + } + + + + public function hookDisplayPayment($params) + { + if (Configuration::get('QDP_DUITKU_PAYMENT_CONFIGURED')) { + + if (!$this->checkCurrency($params['cart'])) { + return; + } + + $tplVars['duitkuunavailable'] = 0; + $this->context->smarty->assign($tplVars); + + return $this->display(__FILE__, 'payment_web_checkout.tpl'); + } + } + + public function checkCurrency($cart) + { + $currency_order = new Currency($cart->id_currency); + $currencies_module = $this->getCurrency($cart->id_currency); + + if (is_array($currencies_module)) { + foreach ($currencies_module as $currency_module) { + if ($currency_order->id == $currency_module['id_currency'] && $currency_order->iso_code == "IDR") { + return true; + } + } + } + return false; + } + + public function hookDisplayPaymentReturn($params) + { + if (!$this->active) { + return; + } + + $objOrder = $params['objOrder']; + $idCart = $objOrder->id_cart; + $state = $objOrder->getCurrentState(); + if ( + $state == Configuration::get('PS_OS_PARTIAL_PAYMENT_ACCEPTED') + || $state == Configuration::get('PS_OS_PAYMENT_ACCEPTED') + || $state == Configuration::get('PS_OS_AWAITING_PAYMENT') + ) { + $success = Tools::getValue('success'); + + $objCart = new Cart((int) $idCart); + + $objCustomer = new Customer((int) $objCart->id_customer); + $id_currency = $objCart->id_currency; + if ($objCart->is_advance_payment) { + $cartTotalAmount = $objCart->getOrderTotal(true, Cart::ADVANCE_PAYMENT); + } else { + $cartTotalAmount = $objCart->getOrderTotal(true, Cart::BOTH); + } + + $cartAmount = round($cartTotalAmount, 2); + + $this->smarty->assign(array( + 'total_paid' => Tools::displayPrice($cartAmount, $params['currencyObj'], false), + 'status' => $success, + 'id_order' => $objOrder->id, + )); + } else { + $this->smarty->assign('status', 'failed'); + } + + return $this->display(__FILE__, 'payment_return.tpl'); + } + + + public function hookActionFrontControllerSetMedia() + { + if ((Tools::getValue('controller') == 'orderopc') || Tools::getValue('controller') == 'quick-order') { + if (Tools::getValue('duitku_err')) { + $this->context->controller->errors[] = $this->l( + 'Some error occurred while payment with Duitku gateway. Please try again or try another payment method.' + ); + } + + Media::addJsDef( + array( + 'qdp_duitku_validate_url' => $this->context->link->getModuleLink('qloduitkupayment', 'validate') + ) + ); + $this->context->controller->addCSS($this->_path . 'views/css/front/duitku_payment.css'); + } + } + + public function hookActionAdminControllerSetMedia() + { + + if ( + Tools::getValue('controller') == 'AdminModules' + && Tools::getValue('configure') == 'qloduitkupayment' + ) { + $this->context->controller->addJs($this->_path . 'views/js/duitku_configuration.js'); + } + } + + public function getDuitkuTransactionTokenResponse() + { + $cart = new Cart((int) $this->context->cart->id); + // Validate and remove non-selected services from the cart + ServiceProductCartDetail::validateServiceProductsInCart(); + + $cartTotalAmount = $cart->is_advance_payment + ? $cart->getOrderTotal(true, Cart::ADVANCE_PAYMENT) + : $cart->getOrderTotal(true, Cart::BOTH); + $paymentAmount = (int) round($cartTotalAmount); + $merchantOrderId = QdpDuitkuTransaction::QDP_ORDER_ID_PREFIX . time() . '_' . $cart->id; + + $customer = new Customer($cart->id_customer); + $email = $customer->email; + $phone = $this->getCustomerPhone($customer, $cart->id_address_delivery); + + $callbackUrl = $this->context->link->getModuleLink('qloduitkupayment', 'callback'); + $returnUrl = $this->context->link->getModuleLink('qloduitkupayment', 'return'); + $expiryPeriod = (int) Configuration::get('QDP_DUITKU_PAYMENT_EXPIRYPERIOD'); + + $customerVaName = $customer->firstname . ' ' . $customer->lastname; + $productDetails = "Payment for " . Configuration::get('PS_SHOP_NAME'); + + $itemDetails = array( + array( + 'name' => $productDetails, + 'price' => $paymentAmount, + 'quantity' => 1 + ) + ); + + $customerDetail = array( + 'firstName' => $customer->firstname, + 'lastName' => $customer->lastname, + 'email' => $email, + 'phoneNumber' => $phone, + ); + + $params = array( + 'paymentAmount' => $paymentAmount, + 'merchantOrderId' => $merchantOrderId, + 'productDetails' => $productDetails, + 'customerDetail' => $customerDetail, + 'itemDetails' => $itemDetails, + 'customerVaName' => $customerVaName, + 'email' => $email, + 'phoneNumber' => $phone, + 'callbackUrl' => $callbackUrl, + 'returnUrl' => $returnUrl, + 'expiryPeriod' => $expiryPeriod + ); + + return QdpDuitkuServiceRequest::makeRequest( + 'createInvoice', + QdpDuitkuTransaction::QDP_CURL_REQUEST_TYPE_POST, + $params + ); + } + + private function getCustomerPhone($customer, $addressId) + { + if (!empty($customer->phone)) { + return $customer->phone; + } + + $address = new Address($addressId); + + if (!empty($address->phone)) { + return $address->phone; + } + + return $address->phone_mobile ? $address->phone_mobile : ''; + } + + + + protected function setLogger() + { + if (isset($this->debugging) && $this->debugging) { + $this->logger = new FileLogger(FileLogger::DEBUG); + } else { + $this->logger = new FileLogger(FileLogger::WARNING); + } + + $this->logger->setFilename($this->local_path . 'logs/' . date('Ymd') . '.log'); + } + + public function uninstall() + { + $objDuitkuPaymentDb = new QdpDuitkuPaymentDb(); + if ( + !parent::uninstall() + || !$objDuitkuPaymentDb->deleteTable() + || !$this->uninstallTab() + || !$this->deleteDuitkuConfigKeys() + ) { + return false; + } + + return true; + } + + public function deleteDuitkuConfigKeys() + { + $configKeys = array( + 'QDP_DUITKU_PAYMENT_API_KEY', + 'QDP_DUITKU_PAYMENT_MERCHANT_CODE', + 'QDP_DUITKU_PAYMENT_ENVIRONMENT', + 'QDP_DUITKU_PAYMENT_EXPIRYPERIOD' + ); + foreach ($configKeys as $key) { + Configuration::deleteByName($key); + } + + return true; + } + + public function uninstallTab() + { + $moduleTabs = Tab::getCollectionFromModule($this->name); + if (!empty($moduleTabs)) { + foreach ($moduleTabs as $moduleTab) { + $moduleTab->delete(); + } + } + + return true; + } +} diff --git a/modules/qloduitkupayment/views/css/admin/duitku.css b/modules/qloduitkupayment/views/css/admin/duitku.css new file mode 100644 index 000000000..bd58d1cfa --- /dev/null +++ b/modules/qloduitkupayment/views/css/admin/duitku.css @@ -0,0 +1,26 @@ +/** +* NOTICE OF LICENSE +* +* This source file is subject to the Academic Free License (AFL 3.0) +* that is bundled with this package in the file LICENSE.md +* It is also available through the world-wide-web at this URL: +* https://opensource.org/licenses/afl-3.0.php +* If you did not receive a copy of the license and are unable to +* obtain it through the world-wide-web, please send an email +* to support@qloapps.com so we can send you a copy immediately. +* +* DISCLAIMER +* +* Do not edit or add to this file if you wish to upgrade this module to a newer +* versions in the future. If you wish to customize this module for your needs +* please refer to https://store.webkul.com/customisation-guidelines for more information. +* +* @author Webkul IN +* @copyright Since 2010 Webkul +* @license https://opensource.org/licenses/afl-3.0.php Academic Free License 3.0 +*/ + +.icon-AdminDuitkuTransaction:before { + content: "\f0d6"; + font-family: FontAwesome +} diff --git a/modules/qloduitkupayment/views/css/admin/index.php b/modules/qloduitkupayment/views/css/admin/index.php new file mode 100644 index 000000000..409280877 --- /dev/null +++ b/modules/qloduitkupayment/views/css/admin/index.php @@ -0,0 +1,32 @@ +DztnwqMrsuBnU;D5*D%WQ8~!3Jk8-_^#-8jC>( zOg`f9I_S;%I{funfa@T4xR;uodwFZgN57c(K&D^;7teAxTHsXF-As7>X+)3x_`rb6 zBz+emyXM8C@AU=?RE|XQ$wD8~`jh6^<{_afhnZ(6njqxS+Qai|2Es0@Cu90VLlskQ zj-mVJ@4&8>d*b}GtRzj;+F}j$LQvD%1`zB}DYz7y*qnX6BeA%P zM6Vg;zv5^>4;8l=6}J?&AIESE6muor2)RGsKX1#)lA>BVYfHOF4dj`SLMa0J=T_nm zmOjm*;vi4=fZrD_!kE7er1AD|WWNBnSGS40{y5&tXqu>7g;ccsme6p8@6a=<#rx{4 z5zs|>;V5q#&2F3>qdOpw^$2}=JR;POF-F=MOQ~7(Zi#Tr(D?dQ^(kHJP54raJ{2uv z*p5PmyAj}EVj2{jKC-7VqUL7Hig=Sy_81f}x>zO}n`!sp+112ZVw35ymX=!FStyqd zC@43G+(Asw=R^uqn}-spCxpJv8a#Km_sdS>tliDdCk&)Z`}Lfq*cU&8tJgrKnMX#) z1M<_POPNQJs=8aaO2b!rBWCsuBEIzm^={wfE(KDdA0OQited~&6+sJ#NM=owsFl8e!^*J$JGCx1spjxcMn0TLVl!`2(lVas9Z5(Dn1`t~ruJO+9 z9d9e1NT{kW>|0k!+B#S+OEMtC@YKu%4o`@KXgP@ylz3FpKRx|MG)9TB8Xf>s|jjmc5W_n-h2;7hOxrJOw?m8G~WOz227jVHp$>4eCQ78rD~=>xX!@DPa0%#DqmBpKkgw$joOFIXvplG*NIFpy6 zbAx(R4T)krNF;*qgLi=g+gEkwJyRd!)a#ETPGYQ8H9r^OZhM}!lj!s8@Vi7D(a>n0 z6#*yG4jD#^^{vc-f0db|44>&ykBQv;)5Pfni6tzJY!09$hbaJZ5$^oA0XJ ziFKUu&EubQTo&nz^UU|a5s}qHAcd!(ih*v*zIVA!!V_;UTCb)fS8=dX=_zPwu|Di` z`r!LO`(-WQb$ChOufiwxaqKdO=hGBh!p`M{<{!^ddTh0L7yzS*eyy^=nrtd-{E+VG z^%*#Phe@NGhHdQ-Twt;8#77N%kdT~jO;--hsT~i~t(bEsZaIuAlJ)p@Q1j$iBoGQ~ z2;zez;{Hm%pB$%Ol@*_s&#Y12z-WO0fY1buP|y~%IvM%9^lWSfU5342j^xo!!^QX4 z509rKTqf0OUif6^!W5TX5JS*5D7=C5P~XbfK@={opgpu;lEuppl=p>G=Ii=SpCu#f gu7!9AZ)eplQSQ!veQ(-U8t1ylUG6?>KLxD%6X;S+F#rGn literal 0 HcmV?d00001 diff --git a/modules/qloduitkupayment/views/img/duitku.png b/modules/qloduitkupayment/views/img/duitku.png new file mode 100644 index 0000000000000000000000000000000000000000..9f5874854b040982a8e13e76c32c8657e7f10214 GIT binary patch literal 857 zcmV-f1E&0mP)V1R+#tyblAIvP4U&84(uIO9T)0qBP|$@71s4h` zrvF7=Q?^dG=_rBj_k*UpUR8C~`>0o?O(Y0{AP9mW2!bF8g5Wa(Rzba9|9m(cJ{pf9 z@)pZLAn>zXE`QR6M+PvI|Mo|D&tmBJwOXxy;qslO@;!MRBMLs~^h- z&k+NV&k+NV&k2%CN~ID#JUmdR)1k#;;n@E1@saZRJl)^lQ@7it)oNwiJ{SzDF>r4* z8noGL=oYw+04T5Doq!_G&(Es;>+7p2Pp8vL(U+H(llHg(jCU(sN5J0#kB>$prPO3H zG3BvXOvx@aGQ6CDVkn<80Eadv z!hO&l%Cf>N)1S}f6&S5pEUITHg*Lfd&KyHmG!ltWC={agdQEmX8UT~DDt`?SLCfWm zve~RE&t@}K1~3*!27^3MC=|?k-O&GnV-iFt-2z0*bUHQ5@FvQ*cDvn4dw3qp5B++* z9$gDZ10d}FH}F2^9&DlK4CEF^16*@3w;&<%JoLPwgY$(O91UQXK^dMLyu>>N5*a5a zJ0o%(pAm3b_kFbCu*Z_ra}pn@&=2G3cd*~@$qvUPI3ADH!NqPVAc0{U!=Rj~bda>( z0(I~z6ytn@d|+MYocJ=CjM|l86gUTRl#w)fhp^7yj*FH+tJP9_E?XNi42+558CSdA zR)%1Y;*NT(S(cwW&O)hk{q*s9D}%zA2Y?~q6uh(9Y^wQK-+^Pg(-HdUKfzk9b|4>6 zsZ>n8<>xT@95Dd-95H~Uyd>{)q@(rA&=2xHzx2Y%$5G=f@ZGq*BM*KYg@g6)f`T9j jf*=TjAP9mW2)^VuJWFF?ex1pD00000NkvXXu0mjfBlm(Y literal 0 HcmV?d00001 diff --git a/modules/qloduitkupayment/views/img/index.php b/modules/qloduitkupayment/views/img/index.php new file mode 100644 index 000000000..969cea7a3 --- /dev/null +++ b/modules/qloduitkupayment/views/img/index.php @@ -0,0 +1,32 @@ +getAdminLink('AdminCustomers')}&id_customer={$id_customer}&viewcustomer" target="_blank"> + {$details['name']}
{$details['email']} + diff --git a/modules/qloduitkupayment/views/templates/admin/duitku_transaction/getOrderLink.tpl b/modules/qloduitkupayment/views/templates/admin/duitku_transaction/getOrderLink.tpl new file mode 100644 index 000000000..c2005dcd4 --- /dev/null +++ b/modules/qloduitkupayment/views/templates/admin/duitku_transaction/getOrderLink.tpl @@ -0,0 +1,28 @@ +{* +* NOTICE OF LICENSE +* +* This source file is subject to the Academic Free License (AFL 3.0) +* that is bundled with this package in the file LICENSE.md +* It is also available through the world-wide-web at this URL: +* https://opensource.org/licenses/afl-3.0.php +* If you did not receive a copy of the license and are unable to +* obtain it through the world-wide-web, please send an email +* to support@qloapps.com so we can send you a copy immediately. +* +* DISCLAIMER +* +* Do not edit or add to this file if you wish to upgrade this module to a newer +* versions in the future. If you wish to customize this module for your needs +* please refer to https://store.webkul.com/customisation-guidelines for more information. +* +* @author Webkul IN +* @copyright Since 2010 Webkul +* @license https://opensource.org/licenses/afl-3.0.php Academic Free License 3.0 +*} + + +{$order_reference} +
+{foreach from=$orders item=id_order name=order} + #{$id_order}{if !$smarty.foreach.order.last},{/if} +{/foreach} diff --git a/modules/qloduitkupayment/views/templates/admin/duitku_transaction/getStatusBadge.tpl b/modules/qloduitkupayment/views/templates/admin/duitku_transaction/getStatusBadge.tpl new file mode 100644 index 000000000..f6425cb53 --- /dev/null +++ b/modules/qloduitkupayment/views/templates/admin/duitku_transaction/getStatusBadge.tpl @@ -0,0 +1,23 @@ +{* +* NOTICE OF LICENSE +* +* This source file is subject to the Academic Free License (AFL 3.0) +* that is bundled with this package in the file LICENSE.md +* It is also available through the world-wide-web at this URL: +* https://opensource.org/licenses/afl-3.0.php +* If you did not receive a copy of the license and are unable to +* obtain it through the world-wide-web, please send an email +* to support@qloapps.com so we can send you a copy immediately. +* +* DISCLAIMER +* +* Do not edit or add to this file if you wish to upgrade this module to a newer +* versions in the future. If you wish to customize this module for your needs +* please refer to https://store.webkul.com/customisation-guidelines for more information. +* +* @author Webkul IN +* @copyright Since 2010 Webkul +* @license https://opensource.org/licenses/afl-3.0.php Academic Free License 3.0 +*} + +{$text} \ No newline at end of file diff --git a/modules/qloduitkupayment/views/templates/admin/duitku_transaction/getViewIcon.tpl b/modules/qloduitkupayment/views/templates/admin/duitku_transaction/getViewIcon.tpl new file mode 100644 index 000000000..340e460b8 --- /dev/null +++ b/modules/qloduitkupayment/views/templates/admin/duitku_transaction/getViewIcon.tpl @@ -0,0 +1,26 @@ +{* +* NOTICE OF LICENSE +* +* This source file is subject to the Academic Free License (AFL 3.0) +* that is bundled with this package in the file LICENSE.md +* It is also available through the world-wide-web at this URL: +* https://opensource.org/licenses/afl-3.0.php +* If you did not receive a copy of the license and are unable to +* obtain it through the world-wide-web, please send an email +* to support@qloapps.com so we can send you a copy immediately. +* +* DISCLAIMER +* +* Do not edit or add to this file if you wish to upgrade this module to a newer +* versions in the future. If you wish to customize this module for your needs +* please refer to https://store.webkul.com/customisation-guidelines for more information. +* +* @author Webkul IN +* @copyright Since 2010 Webkul +* @license https://opensource.org/licenses/afl-3.0.php Academic Free License 3.0 +*} + + + + {l s='View' mod='qloduitkupayment'} + \ No newline at end of file diff --git a/modules/qloduitkupayment/views/templates/admin/duitku_transaction/helpers/form/form.tpl b/modules/qloduitkupayment/views/templates/admin/duitku_transaction/helpers/form/form.tpl new file mode 100644 index 000000000..09a817de8 --- /dev/null +++ b/modules/qloduitkupayment/views/templates/admin/duitku_transaction/helpers/form/form.tpl @@ -0,0 +1,97 @@ +{* +* NOTICE OF LICENSE +* +* This source file is subject to the Academic Free License (AFL 3.0) +* that is bundled with this package in the file LICENSE.md +* It is also available through the world-wide-web at this URL: +* https://opensource.org/licenses/afl-3.0.php +* If you did not receive a copy of the license and are unable to +* obtain it through the world-wide-web, please send an email +* to support@qloapps.com so we can send you a copy immediately. +* +* DISCLAIMER +* +* Do not edit or add to this file if you wish to upgrade this module to a newer +* versions in the future. If you wish to customize this module for your needs +* please refer to https://store.webkul.com/customisation-guidelines for more information. +* +* @author Webkul IN +* @copyright Since 2010 Webkul +* @license https://opensource.org/licenses/afl-3.0.php Academic Free License 3.0 +*} + + +
+
+ + {l s='Duitku Transaction Details' mod='qloduitkupayment'} +
+
+
+ {if isset($transaction_info) && $transaction_info} + + {if $transaction_info} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {/if} +
{l s='Payment Environment' mod='qloduitkupayment'} + {if $transaction_info['environment'] == $QDP_DUITKU_ENVIRONMENT_SANDBOX} + {l s='Sandbox' mod='qloduitkupayment'} + {else} + {l s='Production' mod='qloduitkupayment'} + {/if} +
{l s='Duitku Transaction ID' mod='qloduitkupayment'}{$transaction_info['id_transaction']|escape:'html':'UTF-8'}
{l s='Order Reference' mod='qloduitkupayment'}{$transaction_info['reference']|escape:'htmlall':'UTF-8'}
{l s='Transaction Amount' mod='qloduitkupayment'}{displayPrice price=$transaction_info['cart_total'] currency=$currency->id} +
{l s='Customer Name' mod='qloduitkupayment'} + {$transaction_info['customer_name']|escape:'html':'UTF-8'} + + + {l s='View' mod='qloduitkupayment'} + +
{l s='Payment Status' mod='qloduitkupayment'} + {if $transaction_info.status == $TRANSACTION_COMPLETED} + + {elseif $transaction_info.status == $TRANSACTION_AWAITING} + + {elseif $transaction_info.status == $TRANSACTION_FAILED} +
+ +
+ {/if} +
{l s='Payment Date' mod='qloduitkupayment'}{$transaction_info['date_add']|escape:'html':'UTF-8'}
+ {else} +
+ {l s='Transaction information not found. Please try again.' mod='qloduitkupayment'} +
+ {/if} +
+
+
\ No newline at end of file diff --git a/modules/qloduitkupayment/views/templates/admin/duitku_transaction/helpers/form/index.php b/modules/qloduitkupayment/views/templates/admin/duitku_transaction/helpers/form/index.php new file mode 100644 index 000000000..409280877 --- /dev/null +++ b/modules/qloduitkupayment/views/templates/admin/duitku_transaction/helpers/form/index.php @@ -0,0 +1,32 @@ +{l s='Error' mod='qloduitkupayment'} +

+ {l s='Your payment has failed. Please contact admin regarding this issue from' mod='qloduitkupayment'} + {l s='Contact us' mod='qloduitkupayment'} + {l s='page.' mod='qloduitkupayment'} +

\ No newline at end of file diff --git a/modules/qloduitkupayment/views/templates/front/index.php b/modules/qloduitkupayment/views/templates/front/index.php new file mode 100644 index 000000000..409280877 --- /dev/null +++ b/modules/qloduitkupayment/views/templates/front/index.php @@ -0,0 +1,32 @@ +{l s='Order Error' mod='qloduitkupayment'} +

+ {l s='Somthing went wrong during order creation. Contact admin from ' mod='qloduitkupayment'} + {l s='contact us' mod='qloduitkupayment'} + {l s='page.' mod='qloduitkupayment'} +
+ {l s='Please Quote following trasaction id during conversation.' mod='qloduitkupayment'} +
+ {l s='Trasaction Id: ' mod='qloduitkupayment'}{$txn_id|escape:'html':'UTF-8'} +

\ No newline at end of file diff --git a/modules/qloduitkupayment/views/templates/hook/index.php b/modules/qloduitkupayment/views/templates/hook/index.php new file mode 100644 index 000000000..409280877 --- /dev/null +++ b/modules/qloduitkupayment/views/templates/hook/index.php @@ -0,0 +1,32 @@ + + {l s='Your order on %s is complete.' sprintf=$shop_name mod='qloduitkupayment'} +

+
+

- {l s='Total Amount Paid: ' mod='qloduitkupayment'} {$total_paid|escape:'html':'UTF-8'} +
- {l s='An email has been sent with this information.' mod='qloduitkupayment'} +
- {l s='If you have questions, comments or concerns, please contact our' mod='qloduitkupayment'} {l s='expert customer support team' mod='qloduitkupayment'}. +

+
+{else if isset($status) && $status == '2'} +

+ {l s='Your payment on %s is under processing.' sprintf=$shop_name mod='qloduitkupayment'} +

+
+

- {l s='An email has been sent with this information.' mod='qloduitkupayment'} +
- {l s='If you have questions, comments or concerns, please contact our' mod='qloduitkupayment'} {l s='expert customer support team' mod='qloduitkupayment'}. +

+
+{else} +

+ {l s='We noticed a problem with your payment.' mod='qloduitkupayment'} + {l s='expert customer support team' mod='qloduitkupayment'}. +

+{/if} diff --git a/modules/qloduitkupayment/views/templates/hook/payment_web_checkout.tpl b/modules/qloduitkupayment/views/templates/hook/payment_web_checkout.tpl new file mode 100644 index 000000000..852bd9db9 --- /dev/null +++ b/modules/qloduitkupayment/views/templates/hook/payment_web_checkout.tpl @@ -0,0 +1,68 @@ +{* +* NOTICE OF LICENSE +* +* This source file is subject to the Academic Free License (AFL 3.0) +* that is bundled with this package in the file LICENSE.md +* It is also available through the world-wide-web at this URL: +* https://opensource.org/licenses/afl-3.0.php +* If you did not receive a copy of the license and are unable to +* obtain it through the world-wide-web, please send an email +* to support@qloapps.com so we can send you a copy immediately. +* +* DISCLAIMER +* +* Do not edit or add to this file if you wish to upgrade this module to a newer +* versions in the future. If you wish to customize this module for your needs +* please refer to https://store.webkul.com/customisation-guidelines for more information. +* +* @author Webkul IN +* @copyright Since 2010 Webkul +* @license https://opensource.org/licenses/afl-3.0.php Academic Free License 3.0 +*} + + + \ No newline at end of file diff --git a/modules/qloduitkupayment/views/templates/index.php b/modules/qloduitkupayment/views/templates/index.php new file mode 100644 index 000000000..409280877 --- /dev/null +++ b/modules/qloduitkupayment/views/templates/index.php @@ -0,0 +1,32 @@ + Date: Tue, 9 Dec 2025 16:18:24 +0530 Subject: [PATCH 06/25] Fixed: fix transaction status update issue --- .../controllers/front/callback.php | 23 +++++++++++-------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/modules/qloduitkupayment/controllers/front/callback.php b/modules/qloduitkupayment/controllers/front/callback.php index 851f64f06..6cab5f48e 100644 --- a/modules/qloduitkupayment/controllers/front/callback.php +++ b/modules/qloduitkupayment/controllers/front/callback.php @@ -59,6 +59,17 @@ class QloDuitkuPaymentCallBackModuleFrontController extends ModuleFrontControlle $this->context->currency = new Currency($id_currency); $objDuitkuTransaction = new QdpDuitkuTransaction(); + + $res = $objDuitkuTransaction->checkExists($reference); + $this->module->logger->log('Fetch transaction', FileLogger::DEBUG); + $this->module->logger->log($res, FileLogger::DEBUG); + + if (is_array($res) && !empty($res['id_duitku_payment_transaction'])) { + $objDuitkuTransaction = new QdpDuitkuTransaction((int)$res['id_duitku_payment_transaction']); + } else { + $objDuitkuTransaction = new QdpDuitkuTransaction(); + } + $objDuitkuTransaction->id_transaction = $reference; $objDuitkuTransaction->environment = Configuration::get('QDP_DUITKU_PAYMENT_ENVIRONMENT'); $objDuitkuTransaction->id_cart = (int) $idCart; @@ -90,15 +101,7 @@ class QloDuitkuPaymentCallBackModuleFrontController extends ModuleFrontControlle $objDuitkuTransaction->status = $transactionStatus; - $res = $objDuitkuTransaction->checkExists($objDuitkuTransaction->id_transaction); - if (!$res) { - $this->module->logger->log('Saving transaction', FileLogger::DEBUG); - $objDuitkuTransaction->save(); - } else { - $this->module->logger->log('Updating transaction', FileLogger::DEBUG); - $objDuitkuTransaction->id = $res['id_duitku_payment_transaction']; - $objDuitkuTransaction->update(); - } + $objDuitkuTransaction->save(); $extraVars = array(); @@ -113,7 +116,7 @@ class QloDuitkuPaymentCallBackModuleFrontController extends ModuleFrontControlle while (1) { sleep(1); - if ($objCart->OrderExists() == true) { + if ($objCart->OrderExists()) { $objDuitkuTransaction->removeCartLock($idCart); $allOrders = Order::getAllOrdersByCartId($idCart); $this->module->logger->log('Orders.', FileLogger::INFO); From e8c59db55803db2fe64994dd7f02162877d825a0 Mon Sep 17 00:00:00 2001 From: Amit sharma Date: Tue, 9 Dec 2025 18:25:53 +0530 Subject: [PATCH 07/25] Fixed: Warning error when trying to set an invalid ID or modify the id_paypal_commerce_order parameter name. --- ...minPaypalCommerceTransactionController.php | 62 ++++++++++--------- 1 file changed, 34 insertions(+), 28 deletions(-) diff --git a/modules/qlopaypalcommerce/controllers/admin/AdminPaypalCommerceTransactionController.php b/modules/qlopaypalcommerce/controllers/admin/AdminPaypalCommerceTransactionController.php index 8de5e39e3..002edbe85 100644 --- a/modules/qlopaypalcommerce/controllers/admin/AdminPaypalCommerceTransactionController.php +++ b/modules/qlopaypalcommerce/controllers/admin/AdminPaypalCommerceTransactionController.php @@ -137,39 +137,45 @@ class AdminPaypalCommerceTransactionController extends ModuleAdminController $smartyVars = array(); $refundData = array(); $totalRefunded = 0; - $transactionData = WKPayPalCommerceOrder::getTransactionDetails((int)$idTrans); - $orderCurrency = new Currency((int)$transactionData['id_currency']); - $refundData = WkPaypalCommerceRefund::getRefundListByTransID((int)$idTrans); - $totalRefundedFormatted = WkPaypalCommerceRefund::getTotalRefundedAmount((int)$idTrans, true); + if ($transactionData = WKPayPalCommerceOrder::getTransactionDetails((int)$idTrans)) { + $orderCurrency = new Currency((int)$transactionData['id_currency']); + $refundData = WkPaypalCommerceRefund::getRefundListByTransID((int)$idTrans); + $totalRefundedFormatted = WkPaypalCommerceRefund::getTotalRefundedAmount((int)$idTrans, true); - $totalRefunded = WkPaypalCommerceRefund::getTotalRefundedAmount((int)$idTrans, false); - $remainingRefund = (float)($transactionData['pp_paid_total'] - $totalRefunded); - $response = Tools::jsonDecode($transactionData['response'], true); + $totalRefunded = WkPaypalCommerceRefund::getTotalRefundedAmount((int)$idTrans, false); + $remainingRefund = (float)($transactionData['pp_paid_total'] - $totalRefunded); + $response = Tools::jsonDecode($transactionData['response'], true); - // Buyer making a payment in a different currency (ex: EUR) which is different from the default currency of merchant (Ex: USD), In all those cross currency cases, After Capture, transaction will fall into Pending state and will require merchant to manually go to his PayPal account and accept the payment. - $objPPOrder = new WKPayPalCommerceOrder(); - if (isset($response['data']['purchase_units'][0]['payments']['captures'][0]['status_details']['reason']) - && ($transactionData['pp_payment_status'] == 'PENDING' || $transactionData['pp_payment_status'] == 'DENIED') - && isset($response['data']['purchase_units'][0]['payments']['captures'][0]['status_details']['reason']) - ) { - if (isset($objPPOrder->ppStatusDetail[$response['data']['purchase_units'][0]['payments']['captures'][0]['status_details']['reason']])) { - $smartyVars['ppstatusDetailMsg'] = $objPPOrder->ppStatusDetail[$response['data']['purchase_units'][0]['payments']['captures'][0]['status_details']['reason']]; + // Buyer making a payment in a different currency (ex: EUR) which is different from the default currency of merchant (Ex: USD), In all those cross currency cases, After Capture, transaction will fall into Pending state and will require merchant to manually go to his PayPal account and accept the payment. + $objPPOrder = new WKPayPalCommerceOrder(); + if ( + isset($response['data']['purchase_units'][0]['payments']['captures'][0]['status_details']['reason']) + && ($transactionData['pp_payment_status'] == 'PENDING' || $transactionData['pp_payment_status'] == 'DENIED') + && isset($response['data']['purchase_units'][0]['payments']['captures'][0]['status_details']['reason']) + ) { + if (isset($objPPOrder->ppStatusDetail[$response['data']['purchase_units'][0]['payments']['captures'][0]['status_details']['reason']])) { + $smartyVars['ppstatusDetailMsg'] = $objPPOrder->ppStatusDetail[$response['data']['purchase_units'][0]['payments']['captures'][0]['status_details']['reason']]; + } } + + $smartyVars['transaction_data'] = $transactionData; + $smartyVars['refund_data'] = $refundData; + $smartyVars['refunded_amount'] = $totalRefundedFormatted; + $smartyVars['remaining_refund'] = $remainingRefund; + $smartyVars['remaining_refund_format'] = Tools::displayPrice($remainingRefund, $orderCurrency); + $smartyVars['currency'] = $orderCurrency; + $smartyVars['WK_PAYPAL_COMMERCE_REFUND_TYPE_FULL'] = WkPaypalCommerceRefund::WK_PAYPAL_COMMERCE_REFUND_TYPE_FULL; + $smartyVars['WK_PAYPAL_COMMERCE_REFUND_TYPE_PARTIAL'] = WkPaypalCommerceRefund::WK_PAYPAL_COMMERCE_REFUND_TYPE_PARTIAL; + + $this->context->smarty->assign($smartyVars); + $this->base_tpl_view = 'view.tpl'; + return parent::renderView(); + } else { + Tools::redirectAdmin(self::$currentIndex . '&token=' . $this->token); } - - $smartyVars['transaction_data'] = $transactionData; - $smartyVars['refund_data'] = $refundData; - $smartyVars['refunded_amount'] = $totalRefundedFormatted; - $smartyVars['remaining_refund'] = $remainingRefund; - $smartyVars['remaining_refund_format'] = Tools::displayPrice($remainingRefund, $orderCurrency); - $smartyVars['currency'] = $orderCurrency; - $smartyVars['WK_PAYPAL_COMMERCE_REFUND_TYPE_FULL'] = WkPaypalCommerceRefund::WK_PAYPAL_COMMERCE_REFUND_TYPE_FULL; - $smartyVars['WK_PAYPAL_COMMERCE_REFUND_TYPE_PARTIAL'] = WkPaypalCommerceRefund::WK_PAYPAL_COMMERCE_REFUND_TYPE_PARTIAL; - - $this->context->smarty->assign($smartyVars); + } else { + Tools::redirectAdmin(self::$currentIndex . '&token=' . $this->token); } - $this->base_tpl_view = 'view.tpl'; - return parent::renderView(); } public function postProcess() From a13781d57d69e0e56218cf027f8e7695c5df1998 Mon Sep 17 00:00:00 2001 From: Amit sharma Date: Thu, 11 Dec 2025 12:30:36 +0530 Subject: [PATCH 08/25] Fixed: notices in the admin stats (Sales and orders tab ) while trying to export the data using the CSV export. --- modules/statssales/statssales.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/modules/statssales/statssales.php b/modules/statssales/statssales.php index 0b89b0d0d..de828d507 100644 --- a/modules/statssales/statssales.php +++ b/modules/statssales/statssales.php @@ -310,10 +310,14 @@ class StatsSales extends ModuleGraph { $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($this->query.$this->getDate().$this->query_group_by.$this->query_having_filter); foreach ($result as $row) { + $days = (int)substr($row['invoice_date'], 8, 2); + if (!isset($this->_values[$days])) { + $this->_values[$days] = 0; + } if ($this->option == 1) { - $this->_values[(int)substr($row['invoice_date'], 8, 2)] += 1; + $this->_values[$days] += 1; } else { - $this->_values[(int)substr($row['invoice_date'], 8, 2)] += $row['total_revenue']; + $this->_values[$days] += $row['total_revenue']; } } } From 337d182baf8bc2d7decea3138cee0e025b52acca Mon Sep 17 00:00:00 2001 From: Amit sharma Date: Tue, 16 Dec 2025 15:44:13 +0530 Subject: [PATCH 09/25] Fixed: Trying to access array offset on false in admin order details when trying to update service products in existing order. --- controllers/admin/AdminOrdersController.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/controllers/admin/AdminOrdersController.php b/controllers/admin/AdminOrdersController.php index cd2874dba..9f28a730c 100644 --- a/controllers/admin/AdminOrdersController.php +++ b/controllers/admin/AdminOrdersController.php @@ -7486,7 +7486,7 @@ class AdminOrdersControllerCore extends AdminController $response['hasError'] = true; $response['errors'][] = Tools::displayError('Invalid quantity provided for service').': '.$objServiceProductOrderDetail->name; } - } elseif ($serviceQuantities[$idRoomTypeServiceProductOrderDetail] > 1) { + } elseif (is_array($serviceQuantities) && isset($serviceQuantities[$idRoomTypeServiceProductOrderDetail]) && $serviceQuantities[$idRoomTypeServiceProductOrderDetail] > 1) { $response['hasError'] = true; $response['errors'][] = Tools::displayError('Can not order multiple quanitity for service').': '.$objServiceProductOrderDetail->name; } @@ -7507,7 +7507,11 @@ class AdminOrdersControllerCore extends AdminController $result = true; foreach ($selectedServicesOrderDetails as $idRoomTypeServiceProductOrderDetail) { $objServiceProductOrderDetail = new ServiceProductOrderDetail($idRoomTypeServiceProductOrderDetail); - $quantity = $serviceQuantities[$idRoomTypeServiceProductOrderDetail]; + if(is_array($serviceQuantities) && isset($serviceQuantities[$idRoomTypeServiceProductOrderDetail])) { + $quantity = (int)$serviceQuantities[$idRoomTypeServiceProductOrderDetail]; + } else { + $quantity = 1; + } $unitPrice = $serviceUnitPrices[$idRoomTypeServiceProductOrderDetail]; $objHotelBookingDetail = new HotelBookingDetail($objServiceProductOrderDetail->id_htl_booking_detail); From a11eae75925721c3eb335fbd0501d0f8d39e9133 Mon Sep 17 00:00:00 2001 From: Amit sharma Date: Wed, 17 Dec 2025 16:59:20 +0530 Subject: [PATCH 10/25] Fixed: getting fatal error when , try to delete the installed theme. --- controllers/admin/AdminThemesController.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/controllers/admin/AdminThemesController.php b/controllers/admin/AdminThemesController.php index 9781d25ef..abab7d6fd 100644 --- a/controllers/admin/AdminThemesController.php +++ b/controllers/admin/AdminThemesController.php @@ -714,8 +714,11 @@ class AdminThemesControllerCore extends AdminController } $ids_themes = Tools::unSerialize(Configuration::get('PS_ADDONS_THEMES_IDS')); - if (array_key_exists($obj->directory, $ids_themes)) { - unset($ids_themes[$obj->directory]); + + if(is_array($ids_themes)) { + if (array_key_exists($obj->directory, $ids_themes)) { + unset($ids_themes[$obj->directory]); + } } $obj->removeMetas(); From 3005a262905861121e3e77e9de8173dae9e55657 Mon Sep 17 00:00:00 2001 From: Amit sharma Date: Fri, 19 Dec 2025 17:33:57 +0530 Subject: [PATCH 11/25] Fixed: Add New Service button is hidden when service products are unavailable, even if additional facilities exist, while creating a booking from BO. --- .../template/controllers/orders/_cart_booking_demands.tpl | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/admin/themes/default/template/controllers/orders/_cart_booking_demands.tpl b/admin/themes/default/template/controllers/orders/_cart_booking_demands.tpl index c07968f9d..fad6ca46e 100644 --- a/admin/themes/default/template/controllers/orders/_cart_booking_demands.tpl +++ b/admin/themes/default/template/controllers/orders/_cart_booking_demands.tpl @@ -32,9 +32,7 @@ {if isset($selectedRoomDemands) && $selectedRoomDemands} {/if} - {if isset($serviceProducts) && $serviceProducts} -
  • {l s='Services'}
  • - {/if} +
  • {l s='Services'}
  • {if isset($selectedRoomDemands) && $selectedRoomDemands} From f3ec5908477140676888e4123e675bd9de3e4e6c Mon Sep 17 00:00:00 2001 From: Amit sharma Date: Fri, 26 Dec 2025 17:33:33 +0530 Subject: [PATCH 12/25] Fixed: Issue faced while adding an order message during back office order placement. --- controllers/admin/AdminOrdersController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/controllers/admin/AdminOrdersController.php b/controllers/admin/AdminOrdersController.php index cd2874dba..eee3c18b8 100644 --- a/controllers/admin/AdminOrdersController.php +++ b/controllers/admin/AdminOrdersController.php @@ -3593,7 +3593,7 @@ class AdminOrdersControllerCore extends AdminController $messages = array_merge($customerMessages, $messages); usort($messages, function ($a, $b) { - return strtotime($a['date_add']) < strtotime($b['date_add']); + return (strtotime($a['date_add']) < strtotime($b['date_add'])) ? 1 : -1; }); } From 05809592fc975eb6440bdcd83fbb4fcce4069580 Mon Sep 17 00:00:00 2001 From: azhar bhat Date: Mon, 29 Dec 2025 16:59:45 +0530 Subject: [PATCH 13/25] Padding will be only added where there are child elements of #center_column --- themes/hotel-reservation-theme/css/global.css | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/themes/hotel-reservation-theme/css/global.css b/themes/hotel-reservation-theme/css/global.css index 1c8ecf2e3..7fb667b55 100644 --- a/themes/hotel-reservation-theme/css/global.css +++ b/themes/hotel-reservation-theme/css/global.css @@ -5776,10 +5776,13 @@ textarea { background: #fff; } #columns { + padding: 0; +} +#columns:has(#center_column > *) { position: relative; padding-bottom: 50px; - padding-top: 15px; } - + padding-top: 15px; +} #index .tab-content { margin-top: 35px; margin-bottom: 34px; } From 01376d81fc5849fa2b23d54e9fd5c0439b3931d4 Mon Sep 17 00:00:00 2001 From: Amit sharma Date: Wed, 31 Dec 2025 15:57:19 +0530 Subject: [PATCH 14/25] Fixed: add more condition to check messages --- controllers/admin/AdminOrdersController.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/controllers/admin/AdminOrdersController.php b/controllers/admin/AdminOrdersController.php index eee3c18b8..de1e9eaa6 100644 --- a/controllers/admin/AdminOrdersController.php +++ b/controllers/admin/AdminOrdersController.php @@ -3591,10 +3591,11 @@ class AdminOrdersControllerCore extends AdminController } } - $messages = array_merge($customerMessages, $messages); - usort($messages, function ($a, $b) { - return (strtotime($a['date_add']) < strtotime($b['date_add'])) ? 1 : -1; - }); + if($messages = array_merge($customerMessages, $messages)){ + usort($messages, function ($a, $b) { + return (strtotime($a['date_add']) < strtotime($b['date_add'])) ? 1 : -1; + }); + } } // send hotel standalone and standalone products From 6690f4a79838ceef52e7758f4bfabe7c4e13cb2b Mon Sep 17 00:00:00 2001 From: Amit sharma Date: Mon, 5 Jan 2026 11:49:34 +0530 Subject: [PATCH 15/25] Fixed:Order status issue during reallocation when the admin upgrades the room category. --- .../classes/HotelBookingDetail.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/modules/hotelreservationsystem/classes/HotelBookingDetail.php b/modules/hotelreservationsystem/classes/HotelBookingDetail.php index fbf4ba1c6..8bdbbfdeb 100644 --- a/modules/hotelreservationsystem/classes/HotelBookingDetail.php +++ b/modules/hotelreservationsystem/classes/HotelBookingDetail.php @@ -2317,6 +2317,23 @@ class HotelBookingDetail extends ObjectModel OrderReturnDetail::deleteReturnDetailByIdBookingDetail($objOldHotelBooking->id_order, $idHotelBooking); } + $totalPaid = (float)$objOrder->getTotalPaid(); + $orderTotal = (float)$objOrder->getOrderTotal(); + $currentState = $objOrder->getCurrentOrderState(); + if (Validate::isLoadedObject($currentState)) { + $idEmployee = (int) $context->employee->id; + if ($totalPaid < $orderTotal && $currentState->id == Configuration::get('PS_OS_PAYMENT_ACCEPTED')) { + $objOrder->setCurrentState( + Configuration::get('PS_OS_PARTIAL_PAYMENT_ACCEPTED'), + $idEmployee + ); + } elseif ($totalPaid >= $orderTotal && $currentState->id == Configuration::get('PS_OS_PARTIAL_PAYMENT_ACCEPTED')) { + $objOrder->setCurrentState( + Configuration::get('PS_OS_PAYMENT_ACCEPTED'), + $idEmployee + ); + } + } // =============================================================== // END Delete Process of the old booking // =============================================================== From cec5fb73900cf6f0a763cdf9a23b4a136170cf94 Mon Sep 17 00:00:00 2001 From: aradhana kumari Date: Mon, 5 Jan 2026 19:06:51 +0530 Subject: [PATCH 16/25] Update the text of the 'view room' to the 'View property' at our properties page in the front-office --- themes/hotel-reservation-theme/our-properties.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/hotel-reservation-theme/our-properties.tpl b/themes/hotel-reservation-theme/our-properties.tpl index 094f83dff..88f46e6ac 100644 --- a/themes/hotel-reservation-theme/our-properties.tpl +++ b/themes/hotel-reservation-theme/our-properties.tpl @@ -74,7 +74,7 @@ {$hotel['email']}

    - {l s='View Rooms'} + {l s='View Property'} {if ($hotel['latitude'] != 0 || $hotel['longitude'] != 0) && $viewOnMap} {l s='View on map'} {/if} From 5531ca62ce394a65574c7df90bcef62d11a1e82f Mon Sep 17 00:00:00 2001 From: Amit sharma Date: Thu, 8 Jan 2026 15:29:13 +0530 Subject: [PATCH 17/25] Fixed: tax calculation issue when the room type price is 0 --- .../classes/HotelRoomTypeFeaturePricing.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/hotelreservationsystem/classes/HotelRoomTypeFeaturePricing.php b/modules/hotelreservationsystem/classes/HotelRoomTypeFeaturePricing.php index 66c23e044..dd4f7da37 100644 --- a/modules/hotelreservationsystem/classes/HotelRoomTypeFeaturePricing.php +++ b/modules/hotelreservationsystem/classes/HotelRoomTypeFeaturePricing.php @@ -284,11 +284,11 @@ class HotelRoomTypeFeaturePricing extends ObjectModel $featureImpactPriceTI = 0; $productPriceTI = Product::getPriceStatic((int) $id_product, 1, 0, 6, null, 0, $use_reduc, 1, 0, null, null, null, $nothing, 1, 1, null, 1, 0, 0, $id_group); $productPriceTE = Product::getPriceStatic((int) $id_product, 0, 0, 6, null, 0, $use_reduc, 1, 0, null, null, null, $nothing, 1, 1, null, 1, 0, 0, $id_group); - if ($productPriceTE) { - $taxRate = (($productPriceTI-$productPriceTE)/$productPriceTE)*100; - } else { - $taxRate = 0; - } + $id_address = HotelRoomType::getHotelIdAddressByIdProduct($id_product); + $objAddress = new Address($id_address); + $id_tax_rule_group = Product::getIdTaxRulesGroupByIdProduct((int)$id_product); + $tax_calculator = TaxManagerFactory::getManager($objAddress, $id_tax_rule_group)->getTaxCalculator(); + $taxRate = $tax_calculator->getTotalRate(); if (is_array($occupancy) && count($occupancy)) { $quantity = count($occupancy); From fc298af2059d1b3c1dc81356a7fa7219bc85c173 Mon Sep 17 00:00:00 2001 From: Amit sharma Date: Thu, 8 Jan 2026 15:47:15 +0530 Subject: [PATCH 18/25] Fixed: Export option is not working correctly in case of filter data --- classes/controller/AdminController.php | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/classes/controller/AdminController.php b/classes/controller/AdminController.php index 67d88e69a..d9e3657ab 100644 --- a/classes/controller/AdminController.php +++ b/classes/controller/AdminController.php @@ -876,13 +876,9 @@ class AdminControllerCore extends Controller $filters = array(); if (isset($this->list_id)) { foreach ($_POST as $key => $value) { - // only process the filter fields. - if (stripos($key, $this->list_id.'Filter_') !== 0) { - continue; - } if (is_array($value)) { - if ($value[0] === '' && $value[1] === '') { + if (isset($value[0], $value[1]) && $value[0] === '' && $value[1] === '') { $value = ''; } else { $value = json_encode($value); @@ -899,13 +895,9 @@ class AdminControllerCore extends Controller } foreach ($_GET as $key => $value) { - // only process the filter fields. - if (stripos($key, $this->list_id.'Filter_') !== 0) { - continue; - } if (is_array($value)) { - if ($value[0] === '' && $value[1] === '') { + if (isset($value[0], $value[1]) && $value[0] === '' && $value[1] === '') { $value = ''; } else { $value = json_encode($value); From 21d8abb68c5ef57f3c37877f023bbd7cbbc6d425 Mon Sep 17 00:00:00 2001 From: aradhana kumari Date: Thu, 15 Jan 2026 15:11:25 +0530 Subject: [PATCH 19/25] Update Name field in Manager Room Type form --- .../default/template/controllers/products/informations.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admin/themes/default/template/controllers/products/informations.tpl b/admin/themes/default/template/controllers/products/informations.tpl index fdfa02ee0..0e9c5c676 100644 --- a/admin/themes/default/template/controllers/products/informations.tpl +++ b/admin/themes/default/template/controllers/products/informations.tpl @@ -104,7 +104,7 @@
    {include file="controllers/products/multishop/checkbox.tpl" field="name" type="default" multilang="true"}
    From bd80ce244937839e100a67b3cd2deeec23936cc6 Mon Sep 17 00:00:00 2001 From: aradhana kumari Date: Thu, 15 Jan 2026 17:25:31 +0530 Subject: [PATCH 20/25] Option to add VAT number in invoice --- pdf/invoice.summary-tab.tpl | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pdf/invoice.summary-tab.tpl b/pdf/invoice.summary-tab.tpl index 8f3fdae04..064af953a 100644 --- a/pdf/invoice.summary-tab.tpl +++ b/pdf/invoice.summary-tab.tpl @@ -28,11 +28,19 @@ {l s='Invoice Date' pdf='true'} {l s='Order Reference' pdf='true'} {l s='Order date' pdf='true'} + {if $addresses.invoice->vat_number} + {l s='VAT Number' pdf='true'} + {/if} {$title|escape:'html':'UTF-8'} {dateFormat date=$order->invoice_date full=0} {$order->getUniqReference()} {dateFormat date=$order->date_add full=0} + {if $addresses.invoice->vat_number} + + {$addresses.invoice->vat_number} + + {/if} From 1d046d881128f608f3acde4288fccf7e56110178 Mon Sep 17 00:00:00 2001 From: Amit sharma Date: Fri, 6 Feb 2026 12:12:18 +0530 Subject: [PATCH 21/25] fixed: unable to add more links from modules --- controllers/admin/AdminOrdersController.php | 98 ++++++++++----------- 1 file changed, 49 insertions(+), 49 deletions(-) diff --git a/controllers/admin/AdminOrdersController.php b/controllers/admin/AdminOrdersController.php index 30026bcca..ded8240de 100644 --- a/controllers/admin/AdminOrdersController.php +++ b/controllers/admin/AdminOrdersController.php @@ -368,6 +368,54 @@ class AdminOrdersControllerCore extends AdminController 'icon' => 'process-icon-new' ); } + if ($this->display == 'view') { + /** @var Order $order */ + if (Validate::isLoadedObject($order = $this->loadObject())) { + // hotel link in header + if ($idHotel = HotelBookingDetail::getIdHotelByIdOrder($order->id)) { + $this->page_header_toolbar_btn['hotel'] = array( + 'href' => $this->context->link->getAdminLink('AdminAddHotel').'&id='.$idHotel.'&updatehtl_branch_info', + 'desc' => $this->l('View Hotel'), + 'class' => 'icon-building', + 'target' => true, + ); + } + + if (Configuration::get('PS_INVOICE') && $order->hasInvoice() && !$this->lite_display) { + $this->page_header_toolbar_btn['file'] = array( + 'short' => $this->l('Invoice'), + 'href' => $this->context->link->getAdminLink('AdminPdf').'&submitAction=generateInvoicePDF&id_order='.$order->id, + 'desc' => $this->l('View invoice'), + 'class' => 'icon-file-text', + 'target' => true, + ); + } + + $this->page_header_toolbar_btn['print'] = array( + 'short' => $this->l('Print'), + 'href' => 'javascript:window.print()', + 'desc' => $this->l('Print order'), + 'class' => 'icon-print', + ); + + if ($this->tabAccess['edit'] === 1) { + if (((int) $order->isReturnable()) + && !$order->hasCompletelyRefunded(Order::ORDER_COMPLETE_CANCELLATION_OR_REFUND_REQUEST_FLAG, 0, 0) + ) { + $orderTotalPaid = $order->getTotalPaid(); + $orderDiscounts = $order->getCartRules(); + $hasOrderDiscountOrPayment = ((float)$orderTotalPaid > 0 || $orderDiscounts) ? true : false; + $this->page_header_toolbar_btn['cancel'] = array( + 'short' => ($hasOrderDiscountOrPayment) ? $this->l('Refund') : $this->l('Cancel'), + 'id' => 'desc-order-standard_refund', + 'desc' => ($hasOrderDiscountOrPayment) ? $this->l('Initiate refund') : $this->l('Cancel bookings'), + 'class' => 'icon-exchange', + 'target' => true, + ); + } + } + } + } parent::initPageHeaderToolbar(); } @@ -476,55 +524,6 @@ class AdminOrdersControllerCore extends AdminController public function initToolbar() { - if ($this->display == 'view') { - /** @var Order $order */ - if (Validate::isLoadedObject($order = $this->loadObject())) { - // hotel link in header - if ($idHotel = HotelBookingDetail::getIdHotelByIdOrder($order->id)) { - $this->toolbar_btn['hotel'] = array( - 'href' => $this->context->link->getAdminLink('AdminAddHotel').'&id='.$idHotel.'&updatehtl_branch_info', - 'desc' => $this->l('View Hotel'), - 'class' => 'icon-building', - 'target' => true, - ); - } - - if (Configuration::get('PS_INVOICE') && $order->hasInvoice() && !$this->lite_display) { - $this->toolbar_btn['file'] = array( - 'short' => $this->l('Invoice'), - 'href' => $this->context->link->getAdminLink('AdminPdf').'&submitAction=generateInvoicePDF&id_order='.$order->id, - 'desc' => $this->l('View invoice'), - 'class' => 'icon-file-text', - 'target' => true, - ); - } - - $this->toolbar_btn['print'] = array( - 'short' => $this->l('Print'), - 'href' => 'javascript:window.print()', - 'desc' => $this->l('Print order'), - 'class' => 'icon-print', - ); - - if ($this->tabAccess['edit'] === 1) { - if (((int) $order->isReturnable()) - && !$order->hasCompletelyRefunded(Order::ORDER_COMPLETE_CANCELLATION_OR_REFUND_REQUEST_FLAG, 0, 0) - ) { - $orderTotalPaid = $order->getTotalPaid(); - $orderDiscounts = $order->getCartRules(); - $hasOrderDiscountOrPayment = ((float)$orderTotalPaid > 0 || $orderDiscounts) ? true : false; - $this->toolbar_btn['cancel'] = array( - 'short' => ($hasOrderDiscountOrPayment) ? $this->l('Refund') : $this->l('Cancel'), - 'id' => 'desc-order-standard_refund', - 'desc' => ($hasOrderDiscountOrPayment) ? $this->l('Initiate refund') : $this->l('Cancel bookings'), - 'class' => 'icon-exchange', - 'target' => true, - ); - } - } - } - } - $res = parent::initToolbar(); if (Context::getContext()->shop->getContext() != Shop::CONTEXT_SHOP && isset($this->toolbar_btn['new']) && Shop::isFeatureActive()) { unset($this->toolbar_btn['new']); @@ -3710,6 +3709,7 @@ class AdminOrdersControllerCore extends AdminController 'ROOM_STATUS_CHECKED_OUT' => HotelBookingDetail::STATUS_CHECKED_OUT, 'ALLOTMENT_MANUAL' => HotelBookingDetail::ALLOTMENT_MANUAL, 'order_convenience_fee_services' => $orderConvenienceFeeServices, + 'page_header_toolbar_btn' => $this->page_header_toolbar_btn, ); return parent::renderView(); From 38514f37a23e24a7378c59c004fab054104003ef Mon Sep 17 00:00:00 2001 From: aradhana kumari Date: Tue, 17 Feb 2026 17:16:53 +0530 Subject: [PATCH 22/25] Fixed occupancy issue in the Book now page back-office --- .../helpers/view/_partials/booking-rooms.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/hotelreservationsystem/views/templates/admin/hotel_rooms_booking/helpers/view/_partials/booking-rooms.tpl b/modules/hotelreservationsystem/views/templates/admin/hotel_rooms_booking/helpers/view/_partials/booking-rooms.tpl index 7c68db350..710d60348 100644 --- a/modules/hotelreservationsystem/views/templates/admin/hotel_rooms_booking/helpers/view/_partials/booking-rooms.tpl +++ b/modules/hotelreservationsystem/views/templates/admin/hotel_rooms_booking/helpers/view/_partials/booking-rooms.tpl @@ -261,7 +261,7 @@ {/if} {HotelRoomInformation::getRoomStatusTitle($unavail_dtl_v['id_status'])|escape:'htmlall':'UTF-8'} - {if $unavail_dtl_v['date_from'] && $unavail_dtl_v['date_to']} + {if isset($unavail_dtl_v['date_from']) && isset($unavail_dtl_v['date_to'])} {dateFormat date=$unavail_dtl_v['date_from']} - {dateFormat date=$unavail_dtl_v['date_to']} {else} -- From 77fb10f4a2600978eca24c9642066655ea087896 Mon Sep 17 00:00:00 2001 From: Rohit Jain Date: Fri, 27 Feb 2026 21:03:50 +0530 Subject: [PATCH 23/25] feat(ai): add agent.md (AI guidelines) for QloApps --- AGENTS.md | 225 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 225 insertions(+) create mode 100644 AGENTS.md diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 000000000..87643113d --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,225 @@ +# AGENTS.md + +## Project Overview + +QloApps is an open-source hotel reservation and property management platform. It enables hotels to manage rooms, bookings, guests, and payments through a web-based system. + +## Purpose of this File + +This document provides guidance for AI coding agents contributing to the QloApps project. It defines conventions, safety rules, and workflows to ensure consistent and secure code generation. + +## Technology Stack + +- **Language:** PHP 8.1–8.4 (backend), Smarty 3.x (templates), JavaScript/jQuery (frontend) +- **Database:** MySQL 5.7, 8.0+; MariaDB 10.5, 10.6, 10.11, 11.0, 11.2, 11.4 +- **Architecture:** MVC with hook-based module system +- **License:** OSL-3.0 (core), AFL-3.0 (modules) +- **Required PHP Extensions:** PDO_MySQL, cURL, OpenSSL, SOAP, GD, SimpleXML, DOM, Zip, Phar + +## Environment Setup + +Install dependencies: +```bash +composer install +``` + +Clear caches: +```bash +rm -rf cache/smarty/compile/* cache/smarty/cache/* +rm -f cache/class_index.php +``` + +Clear class cache after adding or modifying overrides. + +## Project Structure + +``` +. +├── classes/ # Core models extending ObjectModel +├── controllers/ # Front and admin controllers +│ ├── admin/ +│ └── front/ +├── modules/ # Feature modules with isolated functionality +├── override/ # Core class and controller overrides +├── themes/ # Smarty templates (.tpl files) +├── config/ # Configuration files (settings.inc.php contains secrets) +├── cache/ # Generated cache files +├── tests/ # PHPUnit test suite +``` + +**QloApps Agent Skills:** Install reusable development skills using: +```bash +npx skills add Qloapps/agent-skills +``` +Available skills: module-development, payment-module-development, stats-module-development. Check installed skills before implementing new functionality. + +## Architecture Overview + +**MVC Pattern** +- Models: classes/ extending ObjectModel +- Controllers: FrontController or AdminController +- Views: Smarty templates (.tpl) + +**Modules** +- Located in modules// +- Provide isolated functionality +- Integrate using hooks + +**Overrides** +- Located in override/ +- Extend core classes using the Core suffix +- Clear class cache after creating overrides + +**Context** +- Access runtime objects using Context::getContext() + +## Core vs Module Development Rules + +**When working on a module:** +1. Never modify core files directly +2. Use **hooks** to integrate module functionality into core features +3. If no suitable hook exists, create a **custom hook** — but only if the hook placement is generic and useful for other modules too +4. Use **overrides** only as a last resort — overrides can conflict with other module override files and require manual resolution + +**When working on a core feature:** +- Make changes directly in core files +- Do not use hooks or overrides for core-to-core changes + +## Coding Conventions + +**Classes:** PascalCase — `HotelBookingData` +**Methods:** camelCase — `getBookingDetails()` +**Variables:** camelCase — `$hotelId` +**Constants:** UPPER_SNAKE_CASE — `BOOKING_STATUS_CONFIRMED` +**Database Tables:** _DB_PREFIX_ + lowercase_snake — `qlo_hotel_booking` +**Config Keys:** MODULENAME_SETTING — `HOTELRESERVATION_ENABLED` +**Files:** One class per file, filename matches class name +**Templates:** lowercase-hyphens.tpl — `booking-form.tpl` + +Add PHPDoc blocks to all classes and methods. + +## Translation + +Never hardcode user-facing English strings — always wrap them in the appropriate translation method. + +| Context | Method | +|---------|--------| +| Module main file | `$this->l('string')` | +| Module admin controller | `$this->l('string')` | +| Module front controller | `$this->module->l('string', 'controllerName')` | +| Module classes | `$objModule->l('string', 'ClassName')` | +| Core admin controller | `$this->l('string')` | +| Core front controller | `Tools::displayError('string')` | +| Smarty template (core) | `{l s='string'}` | +| Smarty template (module) | `{l s='string' mod='modulename'}` | + +## Multi-language + +- Always include `id_lang` in queries that return translatable content +- Use `Context::getContext()->language->id` for the current language + +## Module Development Guidelines + +**Module Location:** modules// + +**Required Files:** +- .php — Main class extending Module +- config.xml — Module metadata + +**Optional Directories:** +- classes/ — Module-specific models +- controllers/ — Module controllers +- views/templates/ — Smarty templates +- upgrade/ — Version migration scripts + +**Hook Integration:** +- Register hooks in install() method +- Unregister hooks in uninstall() method +- Keep hook handlers lightweight + +**Configuration:** +- Store settings using Configuration::updateValue() +- Retrieve settings using Configuration::get() +- Prefix config keys with module name + +## Database Rules + +**Table Prefix:** Always use _DB_PREFIX_ constant instead of hardcoding the table prefix + +**Escaping:** +- Strings: pSQL($value) +- Integers: (int)$value +- Table/column names: bqSQL($name) + +**Preferred Access:** Use ObjectModel for CRUD operations instead of raw SQL queries + +**Prohibited:** Never concatenate raw user input into SQL queries. + +## Security Guidelines + +**Input Handling** +- Use Tools::getValue() for request parameters +- Cast numeric values to (int) +- Escape strings using pSQL() +- Validate input using Validate class methods + +**Output Escaping** +- Use Tools::safeOutput() in PHP +- Use Smarty escape modifiers in templates + +**Sensitive Data** +- Never expose config/settings.inc.php +- Never commit API keys, passwords, or tokens + +**Authorization** +- Verify permissions before performing admin operations + +## Testing + +Testing infrastructure is being configured. Check tests/ directory for available tests before running. + +## AI Agent Workflow + +1. Check installed agent skills before implementing new functionality +2. Search codebase for similar implementations before creating new code +3. Extend existing classes rather than duplicating functionality +4. Follow patterns established in surrounding code +5. Reuse existing utilities: Tools, Validate, Db, Configuration classes +6. Prioritize consistency with existing codebase over new approaches + +After making changes: +- Clear caches if modifying templates or overrides +- Add PHPDoc to new methods + +## Safety Rules + +**Agents must not:** +- Delete files unless explicitly instructed +- Run git commands automatically +- Modify composer.json without approval +- Modify config/settings.inc.php +- Execute DROP, TRUNCATE, or destructive SQL +- Modify core files directly when working on a module (use hooks or override system) + +**Agents must:** +- Use pSQL() for strings and (int) for IDs in SQL +- Use Tools::getValue() for request parameters +- Escape all output +- Check installed agent skills before implementing new functionality +- Follow project naming conventions +- Validate inputs before processing + +**Agents should ask before:** +- Deleting any files +- Running git commands +- Changing dependencies +- Modifying database schema +- Altering payment or booking logic + +--- + +**Resources:** +- Documentation: https://docs.qloapps.com +- Forum: https://forums.qloapps.com +- GitHub: https://github.com/Qloapps/QloApps +- Security Issues: support@qloapps.com From 99df3599755eafbcaf9ee5993b48b0d3fc5f6dcc Mon Sep 17 00:00:00 2001 From: aradhana kumari Date: Wed, 25 Mar 2026 16:26:37 +0530 Subject: [PATCH 24/25] Add VAT Number to invoice summary PDF when available --- pdf/invoice.summary-tab.tpl | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pdf/invoice.summary-tab.tpl b/pdf/invoice.summary-tab.tpl index 064af953a..74491ba40 100644 --- a/pdf/invoice.summary-tab.tpl +++ b/pdf/invoice.summary-tab.tpl @@ -29,8 +29,8 @@ {l s='Order Reference' pdf='true'} {l s='Order date' pdf='true'} {if $addresses.invoice->vat_number} - {l s='VAT Number' pdf='true'} - {/if} + {l s='VAT Number' pdf='true'} + {/if} {$title|escape:'html':'UTF-8'} @@ -38,9 +38,9 @@ {$order->getUniqReference()} {dateFormat date=$order->date_add full=0} {if $addresses.invoice->vat_number} - - {$addresses.invoice->vat_number} - - {/if} + + {$addresses.invoice->vat_number|escape:'html':'UTF-8'} + + {/if} From b9e63614e4f25f2616d587e66a73afdb44889bdf Mon Sep 17 00:00:00 2001 From: Amit sharma Date: Fri, 27 Mar 2026 14:55:18 +0530 Subject: [PATCH 25/25] Fixed: update readme and fix variable data type issue --- modules/qloduitkupayment/Readme.md | 5 +---- modules/qloduitkupayment/classes/QdpDuitkuServiceRequest.php | 2 +- .../views/templates/hook/payment_web_checkout.tpl | 1 - 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/modules/qloduitkupayment/Readme.md b/modules/qloduitkupayment/Readme.md index 0d24686c3..66bb3351a 100644 --- a/modules/qloduitkupayment/Readme.md +++ b/modules/qloduitkupayment/Readme.md @@ -3,10 +3,7 @@ https://store.webkul.com/support.html ### Store link: - - -### Explore Modules: - +https://store.webkul.com/qloapps-duitku-payment-3848.html ### Explore Addons: https://qloapps.com/addons/ diff --git a/modules/qloduitkupayment/classes/QdpDuitkuServiceRequest.php b/modules/qloduitkupayment/classes/QdpDuitkuServiceRequest.php index 091bae6df..4e9c94161 100644 --- a/modules/qloduitkupayment/classes/QdpDuitkuServiceRequest.php +++ b/modules/qloduitkupayment/classes/QdpDuitkuServiceRequest.php @@ -94,7 +94,7 @@ class QdpDuitkuServiceRequest private static function getApiUrl($endpoint) { - $environment = Configuration::get('QDP_DUITKU_PAYMENT_ENVIRONMENT'); + $environment = (int) Configuration::get('QDP_DUITKU_PAYMENT_ENVIRONMENT'); if ($environment === QdpDuitkuTransaction::QDP_DUITKU_ENVIRONMENT_SANDBOX) { return QdpDuitkuTransaction::QDP_DUITKU_HOST_SANDBOX_URL . $endpoint; diff --git a/modules/qloduitkupayment/views/templates/hook/payment_web_checkout.tpl b/modules/qloduitkupayment/views/templates/hook/payment_web_checkout.tpl index 852bd9db9..161f829d3 100644 --- a/modules/qloduitkupayment/views/templates/hook/payment_web_checkout.tpl +++ b/modules/qloduitkupayment/views/templates/hook/payment_web_checkout.tpl @@ -52,7 +52,6 @@ $(document).ready(function() { }, success: function(jsonResponse) { $(".duitku_loading_overlay").hide(); - console.log(jsonResponse); if (jsonResponse.status) { window.location.href = jsonResponse.response.paymentUrl; } else {