Skip to content

Commit eefef5a

Browse files
authored
Stop calling sanitizeResponse twice during the payment response handl… (#3015)
* Stop calling sanitizeResponse twice during the payment response handling process * Added changeset file
1 parent 542448f commit eefef5a

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

.changeset/green-bobcats-act.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@adyen/adyen-web': patch
3+
---
4+
5+
Internal improvement to avoid unnecessary second call of sanitizeResponse during the payment response handling process

packages/lib/src/components/internal/UIElement/UIElement.tsx

+5-6
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ import type {
1919
PaymentAmount,
2020
PaymentData,
2121
PaymentMethodsResponse,
22-
PaymentResponseData,
23-
RawPaymentResponse
22+
PaymentResponseData
2423
} from '../../../types/global-types';
2524
import type { IDropin } from '../../Dropin/types';
2625
import type { NewableComponent } from '../../../core/core.registry';
@@ -397,11 +396,11 @@ export abstract class UIElement<P extends UIElementProps = UIElementProps> exten
397396
* Handles a /payments or /payments/details response.
398397
* The component will handle automatically actions, orders, and final results.
399398
*
400-
* @param rawResponse -
399+
* Expected to be called after sanitizeResponse has been run on the raw payment response
400+
*
401+
* @param response -
401402
*/
402-
protected handleResponse(rawResponse: RawPaymentResponse): void {
403-
const response = sanitizeResponse(rawResponse);
404-
403+
protected handleResponse(response: PaymentResponseData): void {
405404
if (response.action) {
406405
this.elementRef.handleAction(response.action);
407406
return;

0 commit comments

Comments
 (0)