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

Chore: Fix Sonarqube audit error #69

Merged
merged 7 commits into from
Oct 2, 2024
4 changes: 2 additions & 2 deletions processor/src/validators/payment.validators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const validateCardToken = (cardToken: string | undefined, ctPayment: CTPayment):
};

export const validateBanktransfer = (paymentCustomFields: any, ctPayment: CTPayment): void => {
if (!paymentCustomFields?.billingAddress || !paymentCustomFields?.billingAddress?.email) {
if (!paymentCustomFields?.billingAddress?.email) {
throwError(
'validateBanktransfer',
'email is required for payment method banktransfer. Please make sure you have sent it in billingAddress.email of the custom field.',
Expand Down Expand Up @@ -192,7 +192,7 @@ export const checkValidRefundTransactionForCreate = (ctPayment: CTPayment): bool
throwError('checkValidRefundTransactionForCreate', 'No initial refund transaction found.');
}

if (!initialRefundTransaction?.amount || !initialRefundTransaction?.amount.centAmount) {
if (!initialRefundTransaction?.amount?.centAmount) {
throwError(
'checkValidRefundTransactionForCreate',
`No amount found in initial refund transaction, CommerceTools Transaction ID: ${initialRefundTransaction?.id}.`,
Expand Down