Browse Source

Nov 18: [FIX] Bug Fixed 'advanced_payment_cybersource'

pull/351/merge
Cybrosys Technologies 5 months ago
parent
commit
9ce6088143
  1. 4
      advanced_payment_cybersource/README.rst
  2. 6
      advanced_payment_cybersource/doc/RELEASE_NOTES.md
  3. 18
      advanced_payment_cybersource/model/payment_transaction.py
  4. BIN
      advanced_payment_cybersource/static/description/assets/screenshots/2.png
  5. BIN
      advanced_payment_cybersource/static/description/assets/screenshots/3.png
  6. BIN
      advanced_payment_cybersource/static/description/assets/screenshots/3_1.png
  7. 21
      advanced_payment_cybersource/static/description/index.html
  8. 9
      advanced_payment_cybersource/static/src/js/payment_form.js

4
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.

6
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.

18
advanced_payment_cybersource/model/payment_transaction.py

@ -4,7 +4,7 @@
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>)
# Author: Aysha Shalin (<odoo@cybrosys.com>)
# Author: Cybrosys Techno Solutions(<https://www.cybrosys.com>)
#
# 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))

BIN
advanced_payment_cybersource/static/description/assets/screenshots/2.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 145 KiB

After

Width:  |  Height:  |  Size: 142 KiB

BIN
advanced_payment_cybersource/static/description/assets/screenshots/3.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 89 KiB

After

Width:  |  Height:  |  Size: 121 KiB

BIN
advanced_payment_cybersource/static/description/assets/screenshots/3_1.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 85 KiB

21
advanced_payment_cybersource/static/description/index.html

@ -172,9 +172,9 @@
<div class="px-3">
<h4 class="mt-2"
style=" font-weight:600 !important; color:#282F33 !important; font-size:1.3rem !important">
Key And Secret Key.</h4>
To Generate Key And Secret Key.</h4>
<p style="font-weight: 400; font-family: 'Montserrat', sans-serif; font-size: 14px;">
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.
</p>
</div>
</div>
@ -188,9 +188,22 @@
<div class="px-3">
<h4 class="mt-2"
style=" font-weight:600 !important; color:#282F33 !important; font-size:1.3rem !important">
Merchant Id.</h4>
Select REST-Shared Secret</h4>
</div>
</div>
</div>
<div class="col-lg-12 py-2" style="padding: 1rem 4rem !important;">
<div
style="border: 1px solid #d8d6d6; border-radius: 4px; background: #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);">
<div class="row justify-content-center p-3 w-100 m-0">
<img src="assets/screenshots/3_1.png" class="img-responsive" width="100%" height="auto">
</div>
<div class="px-3">
<h4 class="mt-2"
style=" font-weight:600 !important; color:#282F33 !important; font-size:1.3rem !important">
Merchant Id, Key And Secret Key.</h4>
<p style="font-weight: 400; font-family: 'Montserrat', sans-serif; font-size: 14px;">
After generation of the account Merchant id will be generated.
Created Key and Secret Key of the account.
</p>
</div>
</div>

9
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,

Loading…
Cancel
Save