diff --git a/advanced_payment_cybersource/README.rst b/advanced_payment_cybersource/README.rst index 514aa066c..b4bd2da30 100644 --- a/advanced_payment_cybersource/README.rst +++ b/advanced_payment_cybersource/README.rst @@ -6,6 +6,10 @@ Odoo CyberSource Payment Gateway ================================ This module is used to make payments using Cybersource payment provider from website shop. +Installation +============ +* Install external python packages cybersource-rest-client-python. + Configuration ============= * No Additional configuration is needed. diff --git a/advanced_payment_cybersource/doc/RELEASE_NOTES.md b/advanced_payment_cybersource/doc/RELEASE_NOTES.md index 109494a32..58dfc34c5 100644 --- a/advanced_payment_cybersource/doc/RELEASE_NOTES.md +++ b/advanced_payment_cybersource/doc/RELEASE_NOTES.md @@ -5,3 +5,9 @@ ##### ADD - Initial Commit for Odoo CyberSource Payment Gateway + +#### 29.10.2024 +#### Version 17.0.1.0.1 +##### UPDT + +- Updated the code, fixed the issue while doing the payment. \ No newline at end of file diff --git a/advanced_payment_cybersource/model/payment_transaction.py b/advanced_payment_cybersource/model/payment_transaction.py index 7cce84965..10d0c117e 100644 --- a/advanced_payment_cybersource/model/payment_transaction.py +++ b/advanced_payment_cybersource/model/payment_transaction.py @@ -4,7 +4,7 @@ # Cybrosys Technologies Pvt. Ltd. # # Copyright (C) 2024-TODAY Cybrosys Technologies() -# Author: Aysha Shalin () +# Author: Cybrosys Techno Solutions() # # You can modify it under the terms of the GNU LESSER # GENERAL PUBLIC LICENSE (LGPL v3), Version 3. @@ -86,21 +86,19 @@ class PaymentTransaction(models.Model): state = notification_data['simulated_state'] if state == 'pending': self._set_pending() - elif state == 'done': + elif state == 'AUTHORIZED': if self.capture_manually and not notification_data.get( 'manual_capture'): self._set_authorized() else: self._set_done() - # Immediately post-process the transaction if it is a refund, as - # the post-processing - # will not be triggered by a customer browsing the transaction - # from the portal. if self.operation == 'refund': self.env.ref( 'payment.cron_post_process_payment_tx')._trigger() - elif state == 'cancel': - self._set_canceled() - else: # Simulate an error state. + elif state == 'DECLINED': + message = notification_data.get('message', 'No message provided') + self._set_canceled( + state_message=f"Payment canceled due to: {message}") + else: self._set_error( - _("You selected the following demo payment status: %s", state)) + _("You selected the following payment status: %s", state)) diff --git a/advanced_payment_cybersource/static/description/assets/screenshots/2.png b/advanced_payment_cybersource/static/description/assets/screenshots/2.png index 50956eb34..6947e9abc 100644 Binary files a/advanced_payment_cybersource/static/description/assets/screenshots/2.png and b/advanced_payment_cybersource/static/description/assets/screenshots/2.png differ diff --git a/advanced_payment_cybersource/static/description/assets/screenshots/3.png b/advanced_payment_cybersource/static/description/assets/screenshots/3.png index 6155ae4d1..e876d6d3e 100644 Binary files a/advanced_payment_cybersource/static/description/assets/screenshots/3.png and b/advanced_payment_cybersource/static/description/assets/screenshots/3.png differ diff --git a/advanced_payment_cybersource/static/description/assets/screenshots/3_1.png b/advanced_payment_cybersource/static/description/assets/screenshots/3_1.png new file mode 100644 index 000000000..2d93f494c Binary files /dev/null and b/advanced_payment_cybersource/static/description/assets/screenshots/3_1.png differ diff --git a/advanced_payment_cybersource/static/description/index.html b/advanced_payment_cybersource/static/description/index.html index 3c14a62b9..e6c1ff0a3 100644 --- a/advanced_payment_cybersource/static/description/index.html +++ b/advanced_payment_cybersource/static/description/index.html @@ -172,9 +172,9 @@

- Key And Secret Key.

+ To Generate Key And Secret Key.

- After creating the test account they will provide Key and Shared secret key. + After creating the test account, click on the generate new key button to create Key and Shared secret key.

@@ -188,9 +188,22 @@

- Merchant Id.

+ Select REST-Shared Secret +
+ + +
+
+
+ +
+
+

+ Merchant Id, Key And Secret Key.

- After generation of the account Merchant id will be generated. + Created Key and Secret Key of the account.

diff --git a/advanced_payment_cybersource/static/src/js/payment_form.js b/advanced_payment_cybersource/static/src/js/payment_form.js index 487e05978..957cf3b70 100644 --- a/advanced_payment_cybersource/static/src/js/payment_form.js +++ b/advanced_payment_cybersource/static/src/js/payment_form.js @@ -10,11 +10,15 @@ paymentForm.include({ if (providerCode !== 'cybersource') { return this._super(...arguments); } - var customerInputNumber = parseInt($('#customer_input_number').val()); + var customerInputNumber = $('#customer_input_number').val(); const customerInputName = $('#customer_input_name').val(); const expMonth = $('#customer_input_month').val(); const expYear = $('#customer_input_year').val(); + const cvv = $('#customer_input_cvv').val(); var self = this; + let currentDate = new Date(); + let previousMonth = new Date(); + previousMonth.setMonth(currentDate.getMonth() - 1); // Display error if card number is null if(customerInputNumber == "") { this._displayErrorDialog( @@ -23,7 +27,7 @@ paymentForm.include({ ); } // Display error if card is expired - else if(expYear <= 2022) { + else if (expYear <= previousMonth.getFullYear() && currentDate.getMonth() <= previousMonth.getMonth()) { var self = this; self._displayErrorDialog( _t("Server Error"), @@ -49,6 +53,7 @@ paymentForm.include({ 'exp_month': expMonth, 'name':customerInputName, 'card_num':customerInputNumber, + 'cvv':cvv, }, 'values':{ 'amount': processingValues.amount,