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

Stop calling sanitizeResponse twice during the payment response handl… #3015

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/green-bobcats-act.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@adyen/adyen-web': patch
---

Internal improvement to avoid unnecessary second call of sanitizeResponse during the payment response handling process
11 changes: 5 additions & 6 deletions packages/lib/src/components/internal/UIElement/UIElement.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ import type {
PaymentAmount,
PaymentData,
PaymentMethodsResponse,
PaymentResponseData,
RawPaymentResponse
PaymentResponseData
} from '../../../types/global-types';
import type { IDropin } from '../../Dropin/types';
import type { NewableComponent } from '../../../core/core.registry';
Expand Down Expand Up @@ -397,11 +396,11 @@ export abstract class UIElement<P extends UIElementProps = UIElementProps> exten
* Handles a /payments or /payments/details response.
* The component will handle automatically actions, orders, and final results.
*
* @param rawResponse -
* Expected to be called after sanitizeResponse has been run on the raw payment response
*
* @param response -
*/
protected handleResponse(rawResponse: RawPaymentResponse): void {
const response = sanitizeResponse(rawResponse);

protected handleResponse(response: PaymentResponseData): void {
if (response.action) {
this.elementRef.handleAction(response.action);
return;
Expand Down
Loading