Giter Club home page Giter Club logo

Comments (9)

maassenbas avatar maassenbas commented on May 30, 2024

Hi @BilalDev ,

Thanks for reaching out.
Which version of the cartridge are you using? Did you do any customisations?

Are you able to reproduce this issue?
Can you verify that you execute OrderMgr.failOrder() for the first transaction?
This should fail the initial order, reopen the basket and create a new order with new order no.

Thanks,
Bas Maassen
Adyen

from adyen-salesforce-commerce-cloud.

YanP-Adyen avatar YanP-Adyen commented on May 30, 2024

Hey @maassenbas , this is related to ticket #1726972

from adyen-salesforce-commerce-cloud.

BilalDev avatar BilalDev commented on May 30, 2024

Hello @maassenbas,

Thank you for you quick answer.

We are using a custom version of the cartridges version 19.2.2.

Unfortunately I cannot reproduce this issue. It seems that it happens randomly.

Cheers,
Bilal

from adyen-salesforce-commerce-cloud.

maassenbas avatar maassenbas commented on May 30, 2024

Hi @BilalDev ,
Checking the logs, I see multiple requests coming in for the same order.
This will be processed accordingly and send back the result for both payments.

Could you verify whether your customised code handles the resultCode correctly after a payment request?
See the default code here:
https://github.com/Adyen/adyen-salesforce-commerce-cloud/blob/19.2.2/cartridges/int_adyen_SFRA/cartridge/controllers/Adyen.js#L274

Also, if the initial payment was not successful, could you verify whether that order gets failed with OrderMgr.failOrder()?
https://github.com/Adyen/adyen-salesforce-commerce-cloud/blob/19.2.2/cartridges/int_adyen_SFRA/cartridge/controllers/Adyen.js#L299

This should reopen the basket and create a new orderNo.
This way it would not be possible to initiate two payment requests with the same orderNo.

Kind regards,
Bas Maassen
Adyen

from adyen-salesforce-commerce-cloud.

BilalDev avatar BilalDev commented on May 30, 2024

@maassenbas no customisation has been done to this file.

The resultCode is handled correctly :
if (result.resultCode == "Authorised" || result.resultCode == 'Pending' || result.resultCode == 'Received')

And the failOrder is being called line 299 when payment is not successful.

We changed this file though : cartridges/int_adyen_overlay/cartridge/scripts/job/notifications.js.

function submitOrder(order) {
 	var COHelpers = require('*/cartridge/scripts/checkout/checkoutHelpers');

 	//custom fraudDetection
 	var fraudDetectionStatus = {
 		status: 'success'
 	};
 	// Places the order
 	var placeOrderResult = COHelpers.placeOrder(order, fraudDetectionStatus);
 	if (placeOrderResult.error) {
 		Transaction.wrap(function () {
 			OrderMgr.failOrder(order);
 		});
 		return {
 			Order: order,
 			order_created: false,
 			error: placeOrderResult.error
 		};
 	}
 	try {
 		COHelpers.sendConfirmationEmail(order, order.customerLocaleID);

 		Transaction.wrap(function () {
 			order.custom.Adyen_CustomerEmail = null;
 		});
 	} catch (e) {
 		logger.warn("confirmation email not sent {0}", order.orderNo.toString());
 	}

 	//var adyenService = require('*/cartridge/scripts/adyenService');
 	//adyenService.submit(order);

 	return {
 		Order: order,
 		order_created: true
 	};
 }

Cheers,
Bilal

from adyen-salesforce-commerce-cloud.

BilalDev avatar BilalDev commented on May 30, 2024

Hello @maassenbas,

It's still happening on our website as of today. Can we debug it together maybe?

Cheers,
Bilal

from adyen-salesforce-commerce-cloud.

BilalDev avatar BilalDev commented on May 30, 2024

Hello @maassenbas, I was able to reproduce the issue on dev sandbox.

There is a double execution of this hook : https://github.com/Adyen/adyen-salesforce-commerce-cloud/blob/19.2.2/cartridges/int_adyen_SFRA/cartridge/scripts/checkout/adyenHelpers.js#L42

I am very confused as there is only one execution of the for loop (only one paymentInstruments).

Cheers,
Bilal

from adyen-salesforce-commerce-cloud.

BilalDev avatar BilalDev commented on May 30, 2024

I think I found the problem. Our integrator added two hooks.json in our code base. One from your cartridge (int_adyen_SFRA) and another one from our custom cartridge (app_custom_lesgeorgettes) where he added another payment hook.

Do you recommend to delete hooks.json from your cartridge and add all the payment hooks on our custom cartridge?

Or let Adyen payment hooks in int_adyen_SFRA/hooks.json and add our custom payment hooks in app_custom_lesgeorgettes/hooks.json?

Cheers,
Bilal

from adyen-salesforce-commerce-cloud.

maassenbas avatar maassenbas commented on May 30, 2024

Hi @BilalDev ,

Thanks for the investigation.
I would recommend to use the payments hooks from the Adyen cartridge rather than the custom one.

Kind regards,
Bas Maassen
Adyen

from adyen-salesforce-commerce-cloud.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.