adyen-web icon indicating copy to clipboard operation
adyen-web copied to clipboard

Storing the checkoutAttemptId on sessionStorage

Open ribeiroguilherme opened this issue 2 years ago • 3 comments

Summary

This PR handles the storage and usage of the checkoutAttemptId on the sessionStorage. This change aims to improve the calculation of the conversion rates, in scenarios like the shopper reloads the checkout page or comes back from a redirect payment method.

Highlights on how it works:

  • If checkoutAttemptId is passed during the initialization of AdyenCheckout, then we don't handle the storage of the ID - the PBL app or the merchant itself is handling it in this scenario
  • In case that there is no checkoutAttemptId passed, the SDK will request it and save on the sessionStorage along with a timestamp of 15 minutes - so if a redirect happens, or if the shopper decides to move out from the checkout and add another extra item to the cart, we would still use the same checkoutAttemptId if the timespan is within the 15 minutes.

Tested scenarios

  • Passing checkoutAttemptId to AdyenCheckout doesn't trigger a request to get new ID, neither use the one on the session storage
  • After saving the value in the session storage and refreshing the page, the UI will sill use the same ID
  • After 15 min passed, the UI requests another ID

Fixed issue: COWEB-1099

ribeiroguilherme avatar Sep 21 '22 11:09 ribeiroguilherme

Size Change: +395 B (0%)

Total Size: 849 kB

Filename Size Change
packages/lib/dist/adyen.js 228 kB +98 B (0%)
packages/lib/dist/cjs/index.js 193 kB +91 B (0%)
packages/lib/dist/es.modern/index.js 102 kB +112 B (0%)
packages/lib/dist/es/index.js 120 kB +94 B (0%)
ℹ️ View Unchanged
Filename Size
packages/lib/dist/es.modern/ar.js 4.64 kB
packages/lib/dist/es.modern/cs-CZ.js 4.17 kB
packages/lib/dist/es.modern/da-DK.js 3.79 kB
packages/lib/dist/es.modern/de-DE.js 4.09 kB
packages/lib/dist/es.modern/el-GR.js 5.19 kB
packages/lib/dist/es.modern/es-ES.js 3.83 kB
packages/lib/dist/es.modern/fi-FI.js 3.87 kB
packages/lib/dist/es.modern/fr-FR.js 4.03 kB
packages/lib/dist/es.modern/hr-HR.js 3.94 kB
packages/lib/dist/es.modern/hu-HU.js 4.14 kB
packages/lib/dist/es.modern/it-IT.js 3.83 kB
packages/lib/dist/es.modern/ja-JP.js 4.59 kB
packages/lib/dist/es.modern/ko-KR.js 4.2 kB
packages/lib/dist/es.modern/nl-NL.js 3.85 kB
packages/lib/dist/es.modern/no-NO.js 3.77 kB
packages/lib/dist/es.modern/pl-PL.js 4.22 kB
packages/lib/dist/es.modern/pt-BR.js 3.85 kB
packages/lib/dist/es.modern/pt-PT.js 3.99 kB
packages/lib/dist/es.modern/ro-RO.js 4.07 kB
packages/lib/dist/es.modern/ru-RU.js 4.88 kB
packages/lib/dist/es.modern/sk-SK.js 4.21 kB
packages/lib/dist/es.modern/sl-SI.js 3.86 kB
packages/lib/dist/es.modern/sv-SE.js 3.8 kB
packages/lib/dist/es.modern/zh-CN.js 4.11 kB
packages/lib/dist/es.modern/zh-TW.js 4.26 kB
packages/lib/dist/es/ar.js 4.64 kB
packages/lib/dist/es/cs-CZ.js 4.17 kB
packages/lib/dist/es/da-DK.js 3.79 kB
packages/lib/dist/es/de-DE.js 4.09 kB
packages/lib/dist/es/el-GR.js 5.19 kB
packages/lib/dist/es/es-ES.js 3.83 kB
packages/lib/dist/es/fi-FI.js 3.87 kB
packages/lib/dist/es/fr-FR.js 4.03 kB
packages/lib/dist/es/hr-HR.js 3.94 kB
packages/lib/dist/es/hu-HU.js 4.14 kB
packages/lib/dist/es/it-IT.js 3.83 kB
packages/lib/dist/es/ja-JP.js 4.59 kB
packages/lib/dist/es/ko-KR.js 4.2 kB
packages/lib/dist/es/nl-NL.js 3.85 kB
packages/lib/dist/es/no-NO.js 3.77 kB
packages/lib/dist/es/pl-PL.js 4.22 kB
packages/lib/dist/es/pt-BR.js 3.85 kB
packages/lib/dist/es/pt-PT.js 3.99 kB
packages/lib/dist/es/ro-RO.js 4.07 kB
packages/lib/dist/es/ru-RU.js 4.88 kB
packages/lib/dist/es/sk-SK.js 4.21 kB
packages/lib/dist/es/sl-SI.js 3.86 kB
packages/lib/dist/es/sv-SE.js 3.8 kB
packages/lib/dist/es/zh-CN.js 4.11 kB
packages/lib/dist/es/zh-TW.js 4.26 kB

compressed-size-action

github-actions[bot] avatar Sep 21 '22 11:09 github-actions[bot]

As discussed - is it possible to write any tests for this?

sponglord avatar Sep 23 '22 09:09 sponglord

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

sonarqubecloud[bot] avatar Sep 23 '22 14:09 sonarqubecloud[bot]