Giter Club home page Giter Club logo

adyen-salesforce-commerce-cloud's Introduction

Salesforce Commerce Cloud Adyen Cartridge

Adyen provides a LINK cartridge to integrate with Salesforce Commerce Cloud (SFCC). This cartridge enables an SFCC storefront to use the Adyen payment service.

Compatibility with SFCC architectures

Integration

This cartridge allows you to integrate with Adyen without the need for any development work from your end. Online payments are processed on the back-end using the Checkout API, and on the client side, Adyen’s Web Components are used to render payment methods. Point of Sale (POS) payments are processed using a cloud-based Terminal API.

This cartridge contains 2 folders, /src and /cartridges. The /src folder is the origin, while the /cartridges folder contains the transpiled code.

Transpilation

Some files in the /src directory contain modern JavaScript (ES6, MobX) that Salesforce Commerce Cloud does not natively support.

To make the code compatible, we downgrade the ES6 to ES5 by transpiling, compiling, and uploading the auto-generated code to the /cartridges directory, see more in our Docs.

How to customize the cartridge

  • (Before v 23.2.1) (Recommended) If you want to modify the cartridge code and you write in JavaScript ES6, you may need to use the /src folder. Performing a transpilation on the /src folder ensures that you can later move your customizations to a new cartridge version during an upgrade. This is achieved by comparing the code in the /src folders between different releases, see GitHub instructions.
  • (Before v 23.2.1) You can add changes directly to /cartridges without transpiling if you use JavaScript ES5. These customizations will not be transpiled. This may result in a more complex upgrading process.
  • (After v 23.2.1) (Recommended) If you are able to modularize your customizations, create a new cartridge in your /cartridges directory and name it, for example, int_custom_cartridge, see more in our Docs. These customizations will not be transpiled and will be preserved when you upgrade to a new cartridge version.

Requirements

It is required to have an Adyen account to use the cartridge. You can do this here.

Installation, Usage and Configuration

Installation, Usage and Configuration is explained in Adyen's online documentation.

Apple Pay configuration for both Adyen certificate and Apple certificate using Salesforce cartridge can be found here.

Testing

End-to-End tests can be found in the adyen-salesforce-commerce-cloud/tests/e2e directory. They are run automatically via Github Actions using the E2E.yml workflow. To run the tests locally use the following command:

`npm run test:e2e`

Note: Please make sure to fill in the environment variables in the fixtures directory before running the tests locally.

As for Unit tests, they are currently only available for SFRA. Test files can be found next to the files they are testing. Mocks are kept in the jest directory. To run SFRA unit tests locally use the following command:

`npm run test`

Support & Maintenance

We provide specialized cartridge support for major versions of the plugin following the SFCC B2C Support policy, along with permanent Adyen support.

When a major cartridge version is no longer under cartridge support, it will be treated as a custom merchant integration. From version 23 onward, we do not provide any level of support for SiteGenesis integrations.

Migration and Upgrade Guide

SFCC Cartridge Support Schedule for SFRA and SiteGenesis

Contributing

We strongly encourage you to join us in contributing to this repository so everyone can benefit from:

  • New features and functionality
  • Resolved bug fixes and issues
  • Any general improvements

Read our contribution guidelines to find out how.

Platform

Read more information about the Adyen platform.

Licence

MIT license see LICENSE.

adyen-salesforce-commerce-cloud's People

Contributors

actions-user avatar adyen-gc avatar aleffio avatar amihajlovski avatar bhunter avatar cenkiravul avatar cyattilakiss avatar dcardos avatar erwinfoekema avatar grnwood avatar hasslehaas avatar hijdra avatar jkol avatar kadobot avatar lancergr avatar leandromagnabosco avatar maassenbas avatar mastadept avatar msilvagarcia avatar olga-adyen avatar renovate[bot] avatar rikterbeek avatar rkewlani avatar scottpowell14 avatar shanikantsingh avatar vmklaassens avatar wboereboom avatar xapu88 avatar zaiddreakh avatar zenit2001 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

adyen-salesforce-commerce-cloud's Issues

Bancontact support

Hello,

I am trying to implement the newest SFCC cartridge for Adyen but I am getting an unexpected behavior when trying to make a payment with Bancontact (bcmc).

Instead of being redirected to the HPP page (RedirectShopper eventCode case) I am getting an error "Invalid card number".
For reference, no card number is being transmitted in the request as nothing in the cartridge provides a card form and a logic to transmit it.

It also does not match what is happening in the live environment where the customer is redirected to https://live.adyen.com/hpp/skipDetails.shtml with the bancontact form. (in production we are using a 2 years old Adyen cartridge)

When using the SoFort method in the test environment, I am redirected as expected. So it does not seems to be a cartridge problem.

In conclusion, I am not sure what is missing in the request or the logic.

(technical logs at the bottom)

I asked the Adyen support (#887692) and they replied:

The latest version of the SFCC plug-in (with the 3DS2 functionality) uses our checkout solution, and not the Hosted Payment Page solution anymore. So it is indeed correct that the flow for certain payment methods is different compared to the live-environment.

For the BCMC transaction it looks like we are not receiving the encrypted card details in the payment request, so it looks like the encryptedCard details are not correctly passed on in a request to Adyen.
Could you please verify if you are seeing anything unusual happening with the encrypted details in SFCC before these are sent to Adyen?

Could you please share some light on this mess?

Regards,
Guillaume


Request:
{"merchantAccount":"VBQ-EU","reference":"SB4_00003201","browserInfo":{"acceptHeader":"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,/;q=0.8,application/signed-exchange;v=b3gzip, deflate, br","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 Safari/537.36"},"applicationInfo":{"adyenPaymentSource":{"name":"adyen-salesforce-commerce-cloud","version":"19.1.0"},"externalPlatform":{"name":"SalesforceCommerceCloud","version":"SiteGenesis"}},"returnUrl":"https://www-sb4.vilebrequin.com/on/demandware.store/Sites-VBQ-EU-Site/en_GB/Adyen-ShowConfirmation","amount":{"currency":"EUR","value":9500},"countryCode":"BE","deliveryAddress":{"city":"Bruxelles","country":"BE","houseNumberOrName":"","postalCode":"1000","stateOrProvince":"","street":"Rue de la Vierge Noire 16-24"},"billingAddress":{"city":"Bruxelles","country":"BE","houseNumberOrName":"","postalCode":"1000","stateOrProvince":"","street":"Rue de la Vierge Noire 16-24"},"paymentMethod":{"type":"bcmc"},"telephoneNumber":"+3225149868","shopperEmail":"[email protected]","shopperName":{"firstName":"Gui","gender":"UNKNOWN","infix":"","lastName":"Mou"},"shopperReference":"00015003","shopperIP":"194.158.19.228","shopperLocale":"en_GB"}

Response:
{"status":422,"errorCode":"101","message":"Invalid card number","errorType":"validation"}

full SFCC log:
[2019-07-29 06:31:58.420 GMT] INFO PipelineCallServlet|7674974|Sites-VBQ-EU-Site|COShipping-SingleShipping|PipelineCall|rO3-CxXgTg custom.service.AdyenOriginKeys.COMM [] Request:
{"originDomains":["https://www-sb4.vilebrequin.com"]}
[2019-07-29 06:31:58.420 GMT] INFO PipelineCallServlet|7674974|Sites-VBQ-EU-Site|COShipping-SingleShipping|PipelineCall|rO3-CxXgTg custom.service.AdyenOriginKeys.COMM [] Response:
{"originKeys":{"https://www-sb4.vilebrequin.com":"pub.v2.7814701236820044.aHR0cHM6Ly93d3ctc2I0LnZpbGVicmVxdWluLmNvbQ.wpOg4nYBp-Pp0vTJSdHgzIS5xNyHVrnL5_QZS-KetqE"}}
[2019-07-29 06:31:58.430 GMT] INFO PipelineCallServlet|7674974|Sites-VBQ-EU-Site|COShipping-SingleShipping|PipelineCall|rO3-CxXgTg custom.service.AdyenOriginKeys.HEAD [] service=AdyenOriginKeys status=OK
[2019-07-29 06:32:04.269 GMT] DEBUG PipelineCallServlet|2867150|Sites-VBQ-EU-Site|COBilling-UpdateHppMethods|PipelineCall|rO3-CxXgTg custom.service.AdyenCheckoutPaymentMethods.LOG [] Created local HTTP service AdyenCheckoutPaymentMethods from int_adyen_overlay
[2019-07-29 06:32:04.355 GMT] INFO PipelineCallServlet|2867150|Sites-VBQ-EU-Site|COBilling-UpdateHppMethods|PipelineCall|rO3-CxXgTg custom.service.AdyenCheckoutPaymentMethods.COMM [] Webservice Communication: AdyenCheckoutPaymentMethods (POST https://checkout-test.adyen.com/v41/paymentMethods), 67 ms
[2019-07-29 06:32:04.356 GMT] INFO PipelineCallServlet|2867150|Sites-VBQ-EU-Site|COBilling-UpdateHppMethods|PipelineCall|rO3-CxXgTg custom.service.AdyenCheckoutPaymentMethods.COMM [] Request:
{"merchantAccount":"VBQ-EU","amount":{"currency":"EUR","value":9500},"countryCode":"BE"}
[2019-07-29 06:32:04.356 GMT] INFO PipelineCallServlet|2867150|Sites-VBQ-EU-Site|COBilling-UpdateHppMethods|PipelineCall|rO3-CxXgTg custom.service.AdyenCheckoutPaymentMethods.COMM [] Response:
{"groups":[{"name":"Credit Card","types":["bcmc","mc","visa","maestro","amex","diners","discover"]}],"paymentMethods":[{"details":[{"key":"number","type":"text"},{"key":"expiryMonth","type":"text"},{"key":"expiryYear","type":"text"},{"key":"holderName","optional":true,"type":"text"}],"name":"Bancontact card","supportsRecurring":false,"type":"bcmc"},{"details":[{"key":"number","type":"text"},{"key":"expiryMonth","type":"text"},{"key":"expiryYear","type":"text"},{"key":"cvc","type":"text"},{"key":"holderName","optional":true,"type":"text"}],"name":"Credit Card","type":"scheme"},{"name":"Online bank transfer.","supportsRecurring":true,"type":"directEbanking"},{"name":"SEPA Bank Transfer","supportsRecurring":true,"type":"bankTransfer_IBAN"}]}
[2019-07-29 06:32:04.366 GMT] INFO PipelineCallServlet|2867150|Sites-VBQ-EU-Site|COBilling-UpdateHppMethods|PipelineCall|rO3-CxXgTg custom.service.AdyenCheckoutPaymentMethods.HEAD [] service=AdyenCheckoutPaymentMethods status=OK
[2019-07-29 06:32:39.317 GMT] DEBUG PipelineCallServlet|31819376|Sites-VBQ-EU-Site|COBilling-Billing|PipelineCall|rO3-CxXgTg custom.service.AdyenPayment.LOG [] Created local HTTP service AdyenPayment from int_adyen_overlay
[2019-07-29 06:32:39.609 GMT] INFO PipelineCallServlet|31819376|Sites-VBQ-EU-Site|COBilling-Billing|PipelineCall|rO3-CxXgTg custom.service.AdyenPayment.COMM [] Webservice Communication: AdyenPayment (POST https://checkout-test.adyen.com/checkout/v41/payments), 282 ms
[2019-07-29 06:32:39.609 GMT] INFO PipelineCallServlet|31819376|Sites-VBQ-EU-Site|COBilling-Billing|PipelineCall|rO3-CxXgTg custom.service.AdyenPayment.COMM [] Request:
{"merchantAccount":"VBQ-EU","reference":"SB4_00003201","browserInfo":{"acceptHeader":"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,/;q=0.8,application/signed-exchange;v=b3gzip, deflate, br","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 Safari/537.36"},"applicationInfo":{"adyenPaymentSource":{"name":"adyen-salesforce-commerce-cloud","version":"19.1.0"},"externalPlatform":{"name":"SalesforceCommerceCloud","version":"SiteGenesis"}},"returnUrl":"https://www-sb4.vilebrequin.com/on/demandware.store/Sites-VBQ-EU-Site/en_GB/Adyen-ShowConfirmation","amount":{"currency":"EUR","value":9500},"countryCode":"BE","deliveryAddress":{"city":"Bruxelles","country":"BE","houseNumberOrName":"","postalCode":"1000","stateOrProvince":"","street":"Rue de la Vierge Noire 16-24"},"billingAddress":{"city":"Bruxelles","country":"BE","houseNumberOrName":"","postalCode":"1000","stateOrProvince":"","street":"Rue de la Vierge Noire 16-24"},"paymentMethod":{"type":"bcmc"},"telephoneNumber":"+3225149868","shopperEmail":"[email protected]","shopperName":{"firstName":"Gui","gender":"UNKNOWN","infix":"","lastName":"Mou"},"shopperReference":"00015003","shopperIP":"194.158.19.228","shopperLocale":"en_GB"}
[2019-07-29 06:32:39.609 GMT] INFO PipelineCallServlet|31819376|Sites-VBQ-EU-Site|COBilling-Billing|PipelineCall|rO3-CxXgTg custom.service.AdyenPayment.COMM [] Response:
{"status":422,"errorCode":"101","message":"Invalid card number","errorType":"validation"}
[2019-07-29 06:32:39.619 GMT] ERROR PipelineCallServlet|31819376|Sites-VBQ-EU-Site|COBilling-Billing|PipelineCall|rO3-CxXgTg custom.service.AdyenPayment.HEAD [] service=AdyenPayment status=ERROR errorCode=422 errorMessage={"status":422,"errorCode":"101","message":"Invalid card number","errorType":"validation"}

Is the cartridge path intended?

In the below image we see the overlay cartridge in the path after the SFRA cartridge. Am I just getting the naming convention mixed up? normally the intended pathing is "override cartridge:SFRA cartridge: Base cartridge". Is this intended?

image

depedency on sitegenesis for SFRA cartridge

There are many places in the code that is supposed to be SFRA compatible that is relying on sitegenesis

ie line 13 in adyen-salesforce-commerce-cloud\cartridges\int_adyen_overlay\cartridge\scripts\job\notifications.js

/*

  • Script to run Adyen notification related jobs
    */

/* API Includes */
var Order = require('dw/order/Order');
var OrderMgr = require('dw/order/OrderMgr');
var Resource = require('dw/web/Resource');
var Status = require('dw/system/Status');
var Transaction = require('dw/system/Transaction');
var CustomObjectMgr = require('dw/object/CustomObjectMgr');
var logger = require('dw/system/Logger').getLogger('Adyen', 'adyen');
var Email = require('app_storefront_controllers/cartridge/scripts/models/EmailModel');

This causes the following error when job is run;

Caused by: com.demandware.core.script.capi.ScriptingException: Error: Module "app_storefront_controllers/cartridge/scripts/models/EmailModel" not found. (int_adyen_overlay/cartridge/scripts/job/notifications.js#13)
at com.demandware.core.script.capi.RhinoEvalScope.createScriptingException(RhinoEvalScope.java:619)
at com.demandware.core.script.capi.RhinoEvalScope.getExport(RhinoEvalScope.java:598)
at com.demandware.core.script.capi.EvalScope.getExport(EvalScope.java:193)
at com.demandware.beehive.core.internal.scripting2.ExecutableScriptModuleProvider.doGetExecutableScriptModule(ExecutableScriptModuleProvider.java:316)
at com.demandware.beehive.core.internal.scripting2.ExecutableScriptModuleProvider.getExecutableScriptModule(ExecutableScriptModuleProvider.java:278)
... 77 more

proposed solution

change cartridge path in installation guide or refactor code.

"THIS_SCRIPT" is not defined.

We've got folowing fatal error on our SFCC instance

[2020-05-14 20:46:30.719 GMT] FATAL PipelineCallServlet|447546246|Sites-*-Site|Checkout-Begin|PipelineCall|LtfWNIzrLS custom.Adyen [] Adyen: ReferenceError: "THIS_SCRIPT" is not defined. in int_adyen_overlay/cartridge/scripts/adyenGetOriginKey.ds:47

so ti looks like it is missing definition of the variable like it's done in others files.

Fix notification Delay

Fix notification delay calculation
This is causing date exceptions. The date is now generated incorrect.

Order status changes to PAID whereas capture is not done

Environment

  • Adyen Payment 18.3.0
  • SiteGenesis v104.1.3

Setup

We have installed vanilla SiteGenesis and Adyen cartridge by following the documentation available here : https://docs.adyen.com/plugins/salesforce-commerce-cloud/

We configure Adyen directly on Adyen platform to only make an authorization when shopper paid and then manually do a capture when logistics send articles.

Issue

After an authorization with a delayed manual capture, order payement status is set to PAID where as capture is not done yet.

Directory Lookup leads to unhandled Invalid Request response

Environment

  • Adyen Payment 18.3.0
  • SiteGenesis v104.1.3

Setup

We have installed vanilla SiteGenesis and Adyen cartridge by following the documentation available here : https://docs.adyen.com/plugins/salesforce-commerce-cloud/

Issue

After following Adyen online documentation, we face to an issue.

When Directory Lookup is enabled, it leads to an SyntaxError: Unexpected token: < (int_adyen_overlay/cartridge/scripts/getPaymentMethodsSHA256.ds#128

Directory Lookup seems to parse as JSON a XML response.
After investigation we got an Invalid Request response whereas we followed the documentation to integrate the cartridge

Invalid order ID in process job

In customObject notifications processing job the order ID is obtained in wrong way. For example, if the order ID looks like ORDER-42, the customObj.custom.orderId will be similar to ORDER-42-123456, the referenced code will return just ORDER

const orderId = customObj.custom.orderId.split("-", 1);
const order = OrderMgr.getOrder(orderId[0]);

CheckComponentDetails: if issuer selected code > issuerList selected option not set

Hi!
I am currently using the adyenCheckout.js on frontend.
I see my hidden input with id '#selectedIssuer ' and '#adyenIssuerName' gets overwritten because I think the following code does not work properly:

// if issuer is selected
    if (selectedMethod.closest('li').find('.additionalFields #issuerList').val()) {
        $('#selectedIssuer').val(selectedMethod.closest('li').find('.additionalFields #issuerList').val());
        $('#adyenIssuerName').val(selectedMethod.closest('li').find('.additionalFields #issuerList').find('option:selected').attr('label'));
    } 

if I select iDeal and for example 'test issuer 4' in the dropdown (like the 4th element or so). the code selectedMethod.closest('li').find('.additionalFields #issuerList').val() still says the first option is selected.

What works correctly is that a few lines before it does already set the '#selectedIssuer' by:

if (selectedMethod.val() == "ideal") {
        if (idealComponent.componentRef.state.isValid) {
            $('#selectedIssuer').val(idealComponent.componentRef.state.data.issuer);
            $('#adyenIssuerName').val(idealComponent.componentRef.props.items.find(x => x.id == idealComponent.componentRef.state.data.issuer).name);
        }
        return idealComponent.componentRef.state.isValid;
    }

This code sets the correct issue value and name on the hidden input. The code on top just overwrites it with the wrong values.
I suspect Adyens JS is not setting the correct value in the selectbox when clicking on a bank/issuer (li.adyen-checkout__dropdown__element).

Anyone else also sees this happing?

Missing images for FINNISH E-BANKING

There are missing images for the payment method FINNISH E-BANKING.
In the folder demandware-master\cartridges\int_adyen\cartridge\static\default\images there are 527 images.

When I look at the magento plugin, there are 545 images in the folder magento-develop\skin\frontend\base\default\images\adyen

The problem can probably be fixed by copying the images, and changing the image names from the magento plugin.

Example: In magento the image for nordea is called ebanking_FI_nordea.png
The demandware cartridge requires the name NORDEA.png

Controllers

Do you have any plan to convert your pipelines to controllers? If so, could you please share the timeframe?

Thanks

Source link for payment method images

It looks like the old HPP format for images is being used rather than Checkout-shopper format described here: https://docs.adyen.com/checkout/api-only/downloading-logos.

Not sure if the HPP format is being updated as Sofort and Klarna both return images that say simply Klarna, rather than displaying a unique image for each payment method.

Google Pay does not work in LIVE mode

Describe the bug
We found that in the code of your cartridge a bug. In Live mode, you do not pass the mandatory merchantId attribute.
Screen Shot 2020-11-16 at 16 24 57

To Reproduce

  1. According to the Checkout.js : 26 line value of "environment" property is changed to LowerCase and later in adyenCheckout.js : 158 line it doesn't pass the condition as 'live' !== 'LIVE'

Screen Shot 2020-11-16 at 16 23 02

Screen Shot 2020-11-16 at 16 21 54

  1. The second issue is that in adyenCheckout.js : 159 line (when we will pass condition described in 158) MerchantID should be set to 'checkoutConfiguration.paymentMethodsConfiguration.paywithgoogle.merchantIdentifier' when MerchantID should be set to 'checkoutConfiguration.paymentMethodsConfiguration.paywithgoogle.configuration.merchantIdentifier' because it is used by the function:

Screen Shot 2020-11-16 at 16 28 06

Expected behavior
The MerchantID must be passed to GooglePay and to issue the customer the correct invoice for payment.

Desktop:

  • OS: Mac OS
  • Browser: Chrome
  • Version: 86.0.4240.183

Additional context
After the fix, please test the code in production mode.

Transaction fail when customer checkout with creditcard stored in Salesforce with CSE

This is a bug.

If customer pick a pre-saved credit card (saved in Salesforce not Adyen) and with CSE enabled, the transaction will always fail.

That's because CSE encryption doesn't encrypt Card Number and Card Holder if the card is stored in Salesforce. And Card Number and Card Holder are not included in 'card' object when making authorize request.

Fix in AdyenHelper.ds, starting line #189

if (__AdyenHelper.getAdyenCseEnabled() && !empty(encryptedData)) {
cardObject['additionalData'] = {
'card.encrypted.json': encryptedData
};
// card was picked from stored cc card, thus card number and owner are not encrypted
if (card.selectedCardID.value) {
cardObject['card'] = {
'number': card.number.value,
'holderName': card.owner.value
};
}
} else {
cardObject['card'] = {
'number': card.number.value,
'expiryMonth': card.month.value,
'expiryYear': card.year.value,
'cvc': card.cvn.value,
'holderName': card.owner.value
};
}
break;

Salesforce certification for SFRA?

Hello,

Please excuse me if this is not the right place to ask this.

I see the SFRA version of the cartridge is under active development, do you know approximately when it is expected to reach a stable state? And do you plan to submit it to Salesforce for certification?

I'm asking because we're currently using it, however there are a few issues that we ended up fixing ourselves, yet I see in the recent commits Adyen has also fixed them. So I'm wondering if we should wait a while before merging the code?

Thank you!

Utilize lowercase for cartridge names

Typically SFCC B2C cartridge names are all in lowercase.

Renaming int_adyen_SFRA to int_adyen_sfra would keep in line with standard cartridge naming conventions.

Not defined variable "endpoint"

Environment

  • Adyen Payment 18.3.0
  • SiteGenesis v104.1.3

Setup

We have installed vanilla SiteGenesis and Adyen cartridge by following the documentation available here : https://docs.adyen.com/plugins/salesforce-commerce-cloud/

Issue

After following Adyen online documentation, we face to an issue.

endpoint is never defined and lead to an not defined variable error.

Remove these lines of code seems to resolve the issue.

Transactions created twice

Hello,

Our merchant account experiences an issue with transactions that are created twice, one remaining as open offer and the second converts correctly into a received transaction.

We already contact the support team and they asked us to create a bug report.

Cheers,
Bilal

Card Owner Name Length Validation

I am on version 19.1 so I am not sure if this is still an issue. The credit card form field "cardOwner" has a max-length of 22. The field is hidden on the checkout and the Adyen Card Owner field has no client-side validation for limiting the length to 22. Therefore when you click review order, the credit card form fails validation on the server but the error is never pushed to the customer. Also, Adyen calls a full validation of the billing form but the field is missing a range-error so this field error is never placed on the response. This took forever to find out why validation was failing for the billing form with some 100 fields.

Adyen capture use authorization service url

Environment

  • Adyen Payment 18.3.0
  • SiteGenesis v104.1.3

Setup

We have installed vanilla SiteGenesis and Adyen cartridge by following the documentation available here : https://docs.adyen.com/plugins/salesforce-commerce-cloud/

Issue

When capturing with a previously authorized order using adyenCapture.ds and fix bug referenced here by removing bad code part.

Service use authorise url https://pal-test.adyen.com/pal/servlet/Payment/authorise instead of https://pal-test.adyen.com/pal/servlet/Payment/capture

Missing formal parameter error after update to 20.1.2

After update of the cartridge to 20.1.2 version (our current stable branch is release-19.2.2) our sandbox failed on the the page with the list of payment methods with the error "missing formal parameter" pointing to the code line with the trailing comma after the last function argument here

function getSelectedPaymentInstruments(selectedPaymentInstruments) { return collections.map( selectedPaymentInstruments, createSelectedPaymentInstruments, ); }

After research it was found that our sandbox Rhino engine does not support this javascript syntax (I mean trailing commas in the function arguments).

Sandbox version: Version: 20.10 Last Updated: Oct 22, 2020 (Compatibility Mode: 19.10)

Credit Card not saving on checkout

We're integrating using SFRA cartridge. On checkout we use adyen card form as provided in client js in int_adyen_SFRA cartridge. The code sets saveCardAdyen form property and submits the correct request to API. However, the code in adyen_credit_form_processor.js fails to save paymentInstrument in the following line.

var saveCardResult = COHelpers.savePaymentInstrumentToWallet( billingData, basket, customer );

The reason is because there are no expiry month and year provided since there are only encrypted fields (adyenEncryptedExpiryMonth, adyenEncryptedExpiryYear) available on UI.

Please confirm whether this is correct behaviour and if there are any workarounds for the issue.

Using version 19.2.3.

Fatal errors appear when trying to save a card in 'My Account'

Description
When a user saves cart in 'My Account', the ID of AdyenNotification starts with recurringPayment-account. On the 51st line they split by '-', after it orderId contains ['recurringPayment'].
https://github.com/Adyen/adyen-salesforce-commerce-cloud/blob/develop/src/cartridges/int_adyen_overlay/cartridge/scripts/handleCustomObject.ds#L51
Then on the 52nd line order is null.
https://github.com/Adyen/adyen-salesforce-commerce-cloud/blob/develop/src/cartridges/int_adyen_overlay/cartridge/scripts/handleCustomObject.ds#L52
On the 57th line orderId.indexOf('recurringPayment-') is always false because orderId contains ['recurringPayment'] without dash. It was cut on the 51st line.
https://github.com/Adyen/adyen-salesforce-commerce-cloud/blob/develop/src/cartridges/int_adyen_overlay/cartridge/scripts/handleCustomObject.ds#L57

Steps to reproduce:

  1. Set up the cartridge for the production environment.
  2. Go to 'My Account' and try to save a new card.
  3. Set your email for fatal errors in Business Manager.

Expected behavior
The card is saved without errors

Screenshots
https://vitalii-ewave.tinytake.com/tt/NDMyNjM4OV8xMzYyODEyMg
https://vitalii-ewave.tinytake.com/tt/NDMyNjM5OV8xMzYyODEzNA

floating point math issue

The issue has no effect on order total = 7.95. The root cause is related to a floating point math issue. For the example below you could expecting the following:

0.1 + 0.2 = 0.3

That’s a floating point math operation which the computer will calculate as follows:

0.1 + 0.2 = 0.30000000000000004 (which differs from your expectations)

In our case we have 8.95 * 100, because an integer value have to be sent to Adyen for the order amount. We are expecting the result to be 895, but instead the computer calculates it as 894.9999999999999.

The calculation issue in AdyenHelper.ds script. The issue is with the following line of code:

getCurrencyValueForApi : function ( amount ) : String {
var digitsNumber : Number = dwutil.Currency.getCurrency(amount.currencyCode).getDefaultFractionDigits();
if ( digitsNumber <= 0 ) return amount.value;
if ( digitsNumber == 2 ) return amount.value * 100;
if ( digitsNumber > 2 ) return amount.value * 1000;
}

amount.value returns a Number object which is floating point value. As a result when it’s multiplied by 100 (see the row marked in red) the result returned is 894.9999999999999 (as per my explanation above). Usually when we are dealing with Money in SFCC we are using the Money object multiply() method to avoid such an issue. So the correct syntax should be:

amount.multiply(100).value

Adyen alternative payment failed for orders with many porducts and quantity

Hello

The error regarding this is :

[2020-06-19 05:24:38.343 GMT] ERROR PipelineCallServlet|3286816|Sites-EU-Site|CheckoutServices-PlaceOrder|PipelineCall|k2fWU7R-v3 custom [] Error while executing script 'int_payflow_sfra/cartridge/controllers/CheckoutServices.js': Wrapped java.lang.IllegalArgumentException: Data size 10702 exceeds the limit of 10240 bytes. (int_adyen_overlay/cartridge/scripts/util/AdyenHelper.ds#177)at int_adyen_overlay/cartridge/scripts/util/AdyenHelper.ds:177at int_adyen_SFRA/cartridge/scripts/hooks/payment/processor/adyen.js:89 (Authorize)at int_adyen_SFRA/cartridge/scripts/checkout/adyenHelpers.js:45 (handlePayments)at int_adyen_SFRA/cartridge/controllers/CheckoutServices.js:171at modules/server/route.js:79 (next)at modules/server/middleware.js:42 (https)at modules/server/route.js:87

This is in the Adyen OOB code the cartridge (int_adyen_overlay/cartridge/scripts/util/AdyenHelper.ds#177). Here Adyen returns two parameters from service call and they are with relation with product quantity and numbers on product in cart. The bigger cart is (number of products and their quantity), the bigger these params are. (longer in term of String class). And if these parameters are big enough the error appears.

The code content is :

getAdyenHash: function(value, salt){
var data = value + salt;
var signature = new
dw.crypto.MessageDigest(dw.crypto.MessageDigest.DIGEST_SHA_512).digest(data);
return signature;
},
Here on the row 4, Adyen uses some depricated method digest(string) which causes the problem.

Here is SFCC documentation regarding this class:

https://documentation.b2c.commercecloud.salesforce.com/DOC3/topic/com.demandware.dochelp/DWAPI/scriptapi/html/api/class_dw_crypto_MessageDigest.html?resultof="MessageDigest" "messagedigest"

Infact the conversion from String to Bytes failed because of big String. This String is also received through call to Adyen services. So in conclusion this is existing bug in Adyen code for payment with redirect (in our case all Adyen alternative payment methods)

AdyenCSE display shipping form twice on SiteGenesis

Environment

  • Adyen Payment 18.3.0
  • SiteGenesis v104.1.3

Setup

We have installed vanilla SiteGenesis and Adyen cartridge by following the documentation available here : https://docs.adyen.com/plugins/salesforce-commerce-cloud/

Issue

After following Adyen online documentation about templates/default/checkout/billing/paymentmethods.isml, we face to an issue.

When CSE is enabled, shipping form is diplayed twice as described in the followed screenshot.
Is this an expected behavior ?

image

Floating point math issue

We are having problems with floating point math.

File: int_adyen_overlay/cartridge/scripts/getPaymentMethodsSHA256.ds
Line: # 54

var paymentAmount: Number = basket.getTotalGrossPrice() ? AdyenHelper.getCurrencyValueForApi(basket.getTotalGrossPrice()) : 1000;
Ex: 288.15 * 100 = 28814.999999999996

There will be an error if requesting that value with Adyen's API.

I found the document on this issue here:
https://0.30000000000000004.com/
https://stackoverflow.com/questions/588004/is-floating-point-math-broken

order.custom.Adyen_value getting set as float with a decimal

I put in Pull Request #207 regarding this. Thank you!

Looks like you have wrestled with this in the past ...
In AdyenHelper ~#667

if ('AdyenAmount' in result && !empty(result.AdyenAmount)) {
           order.custom.Adyen_value = result.AdyenAmount;
       }

Is confusing in Business Manager and can cause (downstream) notification processing errors. Better would be:

 if ('AdyenAmount' in result && !empty(result.AdyenAmount)) {
            order.custom.Adyen_value = result.AdyenAmount.toFixed(0);
        }

Problems with saved card - Adyen for Platforms

Hello, we changed the "account holder" transactions on the SFCC plugin, so... the transaction is not approved with a saved card, just with new cards.

The error is
{"status":422,"errorCode":"800","message":"Contract not found","errorType":"validation","pspReference":"881601406845996E"}

the transaction was created on SFCC but don't generate PSP number

Uploading image.png…

Orders/payments to fail on open invoice payment options as Klarna and AfterpayTouch - error in the SFCC/Adyen cartridge

Describe the bug
Issue with open invoice data for orders with order-level discounts.

There is an issue with the line item price values sent to adyen, via the SFCC-adyen cartridge, for open invoices when an order has order-level discounts. The issue results in adyen failing the auth request and the customer is not able to use the open invoice payment method.
The problem is present in cartridge version 19.1 which is the version we are currently using. I have also looked at the code for the newest cartridge (19.2.2) and it looks like the problem is also present there, but I haven’t tested it.
The issue is in the following script, where line item data is collected and added to the adyen request object:
• /int_adyen_overlay/cartridge/scripts/adyenGetOpenInvoiceData.ds.
The below is part of the JSON the script generates. To better illustrate what data is being sent to adyen I have inserted the commerce cloud functions that the script uses to fetch the required data:
image

Below are two examples of data being fetched from commerce cloud and sent to adyen via the cartridge. Scenario 1 works fine, but scenario 2 is where the issue occurs.

  1. Data for a line item without order-level discount:
    image
  2. Data for the same line item, but with a 10% order level discount:
    image

As you can see in scenario 2, the amountExcludingTax (adjustedNetPrice) is higher than in scenario 1, which doesn't make sense since it includes 10% discount. One would assume that the adjustedNetPrice would be lower in case 2.
The reason for this is that commerce cloud includes the 10% discount in the adjustedTax (taxAmount), but the gross price does not include the discount.

When commerce cloud calculates adjustedNetPrice, they take the adjustedGrossPrice 995 (not including 10% discount) and subtracts the adjustedTax 179,1 (including the 10% discount), resulting in an adjustedNetPrice of 815,9.
When data in scenario 2 is sent to adyen, adyen fails the request because the calculation of the taxAmount does not add up. The calculation adyen uses is: 815,90 (amountExcludingTax) * 0,25 (taxPercentage) = 203,97.. this result does not match the taxAmount 179,1 and therefore the request fails.

The conclusion is that the adyen cartridge should handle situations where an order-level discount has been applied for open invoice orders. Currently the values collected from commerce cloud, does not go through the adyen validation because of the above-mentioned discrepancies.

Exception occurred during request processing: ScriptingException TypeError: Cannot set property "value" of undefined to "123" (app_storefront_base/cartridge/controllers/CheckoutServices.js#235)

This is happening as CheckoutServices-SubmitPayment in LINK_adyen cartridge is modifying viewData.paymentInformation which doesn't contain securityCode that was set at line no. 91 in CheckoutServices.js in base cartridge. This is accessed again at line no. 235 in base cartridge which is executed after the code in LINK_adyen cartridge as the code snippet is executed inside 'route:BeforeComplete'.

Service call to AdyenOriginKeys returns 403 forbiden

I am using the develop version for SFRA 4.0 compatibility per suggestion in #155

However on Billing Page no card fields appear do to a javascript error.
"Cannot convert undefined or null to object" in adyenCheckout.js:31
This appears to be caused by the fact that the AdyenOriginKeys is failing with error message of
{
"error": {
"code": 403,
"message": "Forbidden",
"requested URI": "/checkout//v1/originKeys"
}
}
The API key is set in the BM and i tried setting the service credentials to that of the web service user however nothing works.
Only this service returns error 403

Apple Pay support

It seems the support for Apple Pay payments is missing from the cartridge.

I will try to find what to add/change and where so it can work but it would be great if that was somehow documented or even part of the cartridge.

Not Defined Variable 'view' on handlePayment

Environment

  • Adyen Payment 18.3.0
  • SiteGenesis v104.1.3

Setup

We have installed vanilla SiteGenesis and Adyen cartridge by following the documentation available here : https://docs.adyen.com/plugins/salesforce-commerce-cloud/

Issue

After following Adyen online documentation about handlePayments step 3, we face to an issue.

if(show3dSecureForm) {

  return{view : view};

}

Is also called when payment method is not Adyen and it make it crash because view is never defined.

We think theses lines are not usefull and could be removed as we already process 3DSecure lines above.

Lot of syntax issues inside codebase.

Inside Adyen.js, there are large number of syntax errors in the stable version released. Please have a look and release the cartridge after removing syntax errors.
There is possibility of syntax errors inside other files as well.

Common syntax errors:
Extra commas at large number of places due to which functionality is breaking, like Adyen callback.

Error: Wrapped object may not be null due to a missing form element

Environment

  • Adyen Payment 18.3.0
  • SiteGenesis v104.1.3

Setup

We have installed vanilla SiteGenesis and Adyen cartridge by following the documentation available here : https://docs.adyen.com/plugins/salesforce-commerce-cloud/

Issue

After following Adyen online documentation, we face to an issue.

The form field billing.paymentMethods.creditCard.encrypteddata is mentionned multiple time in code but never exist. It leads to an Error: Wrapped object may not be null.

Adds

<field formid="encrypteddata" type="string" mandatory="false" binding="encrypteddata"/>

to app_storefront_core\cartridge\forms\default\creditcard.xml seems to resolve the issue.
But this step is missing from documentation

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.