Skip to content

Commit

Permalink
Stop calling sanitizeResponse twice during the payment response handl… (
Browse files Browse the repository at this point in the history
#3015)

* Stop calling sanitizeResponse twice during the payment response handling process

* Added changeset file
  • Loading branch information
sponglord authored Jan 13, 2025
1 parent 542448f commit eefef5a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
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

0 comments on commit eefef5a

Please sign in to comment.