Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/adyen error objects #1228

Open
wants to merge 3 commits into
base: feature/SFI-959-reliability-tracking
Choose a base branch
from

Conversation

shanikantsingh
Copy link
Member

Summary

Describe the changes proposed in this pull request:

  • What is the motivation for this change?
  • Refactor try catch block
  • Create custom Adyen error type
  • What existing problem does this pull request solve?
  • Refactor try catch block
  • Create custom Adyen error type

Tested scenarios

Description of tested scenarios:

  • card payment flow

Fixed issue: #SFI-1007 #SFI-1025

@shanikantsingh shanikantsingh changed the base branch from develop to feature/SFI-959-reliability-tracking December 16, 2024 09:24
Copy link
Contributor

@zenit2001 zenit2001 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, but we would need to consider the points below also, to ensure consistency:

  • None of adyenDeleteRecurringPayment and deletePayment has a try/catch logic in them, meaning that if an error is thrown during deleting a stored payment method, we will not get any insight. I think we should apply the logic there also.
  • zeroAuthPayment is inside a try catch , however it’s a helper function being used by savePayment(). Should we move try/catch logic in savePayment() instead?
  • Should we consider adding an AdyenError in updateSavedCards()?
  • Should we consider adding try/catch to notify() and remove try/catch on helper functions related to that. Instead we can replace them with AdyenError?
  • Same as the above applies to begin.js file, removing the try/catch from the helpers and adding it to the main function.

throw new Error('No Customer ID or RecurringDetailReference provided');
}
if (!(customerID && recurringDetailReference)) {
throw new Error('No Customer ID or RecurringDetailReference provided');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this one be also AdyenError?

@@ -26,12 +26,14 @@ const AdyenHelper = require('*/cartridge/adyen/utils/adyenHelper');
const AdyenConfigs = require('*/cartridge/adyen/utils/adyenConfigs');
const constants = require('*/cartridge/adyen/config/constants');
const AdyenLogs = require('*/cartridge/adyen/logs/adyenCustomLogs');
const setErrorType = require('*/cartridge/adyen/logs/setErrorType');
const { AdyenError } = require('*/cartridge/adyen/logs/adyenError');

// eslint-disable-next-line complexity
function donate(donationReference, donationAmount, orderToken) {
try {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we remove try/catch here, considering we are adding it at main function donation()?

Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
7.8% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants