Skip to content

Commit ae665f0

Browse files
Fixing Sonarcloud complains about ApplePayService (#2846)
* sonarcloud reliability issues fix * changeset
1 parent 08102bd commit ae665f0

File tree

2 files changed

+24
-8
lines changed

2 files changed

+24
-8
lines changed

.changeset/tough-carrots-jog.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@adyen/adyen-web': patch
3+
---
4+
5+
Fixing reliability Sonarcloud issues related to ApplePayService

packages/lib/src/components/ApplePay/ApplePayService.ts

+19-8
Original file line numberDiff line numberDiff line change
@@ -23,23 +23,34 @@ class ApplePayService {
2323
this.options = options;
2424

2525
this.session = new ApplePaySession(options.version, paymentRequest);
26-
/* eslint-disable @typescript-eslint/no-misused-promises */
27-
this.session.onvalidatemerchant = event => this.onvalidatemerchant(event, options.onValidateMerchant);
28-
this.session.onpaymentauthorized = event => this.onpaymentauthorized(event, options.onPaymentAuthorized);
29-
this.session.oncancel = event => this.oncancel(event, options.onCancel);
26+
this.session.onvalidatemerchant = event => {
27+
void this.onvalidatemerchant(event, options.onValidateMerchant);
28+
};
29+
this.session.onpaymentauthorized = event => {
30+
void this.onpaymentauthorized(event, options.onPaymentAuthorized);
31+
};
32+
33+
this.session.oncancel = event => {
34+
this.oncancel(event, options.onCancel);
35+
};
3036

3137
if (typeof options.onPaymentMethodSelected === 'function') {
32-
this.session.onpaymentmethodselected = event => this.onpaymentmethodselected(event, options.onPaymentMethodSelected);
38+
this.session.onpaymentmethodselected = event => {
39+
void this.onpaymentmethodselected(event, options.onPaymentMethodSelected);
40+
};
3341
}
3442

3543
if (typeof options.onShippingContactSelected === 'function') {
36-
this.session.onshippingcontactselected = event => this.onshippingcontactselected(event, options.onShippingContactSelected);
44+
this.session.onshippingcontactselected = event => {
45+
void this.onshippingcontactselected(event, options.onShippingContactSelected);
46+
};
3747
}
3848

3949
if (typeof options.onShippingMethodSelected === 'function') {
40-
this.session.onshippingmethodselected = event => this.onshippingmethodselected(event, options.onShippingMethodSelected);
50+
this.session.onshippingmethodselected = event => {
51+
void this.onshippingmethodselected(event, options.onShippingMethodSelected);
52+
};
4153
}
42-
/* eslint-enable @typescript-eslint/no-misused-promises */
4354
}
4455

4556
/**

0 commit comments

Comments
 (0)