Skip to content

Commit cebc545

Browse files
ppcp wallet pay shipping issue (#11)
Co-authored-by: shagufa-ali <80478231+shagufa-ali@users.noreply.github.com>
1 parent 665f4bc commit cebc545

File tree

2 files changed

+3
-8
lines changed

2 files changed

+3
-8
lines changed

src/paypal/ppcp_buttons/ppcpOnShippingChange.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {
33
IWalletPayOnShippingRequest,
44
walletPayOnShipping
55
} from '@boldcommerce/checkout-frontend-library';
6-
import {API_RETRY, displayError,} from 'src';
6+
import {API_RETRY} from 'src';
77

88

99
export async function ppcpOnShippingChange(data: OnShippingChangeData, actions: OnShippingChangeActions): Promise<void> {
@@ -20,7 +20,6 @@ export async function ppcpOnShippingChange(data: OnShippingChangeData, actions:
2020

2121
const res = await walletPayOnShipping(body, API_RETRY);
2222
if (!res.success) {
23-
displayError('There was an unknown error while getting the shipping details.', 'payment_gateway', 'unknown_error');
2423
return actions.reject();
2524
}
2625

tests/paypal/ppcp_buttons/ppcpOnShippingChange.test.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,11 @@ import {
55
walletPayOnShipping
66
} from '@boldcommerce/checkout-frontend-library';
77
import {applicationStateMock} from '@boldcommerce/checkout-frontend-library/lib/variables/mocks';
8-
import {displayError} from 'src';
98
import {ppcpOnShippingChange} from 'src/paypal/ppcp_buttons/ppcpOnShippingChange';
109
import {OnShippingChangeActions, OnShippingChangeData} from '@paypal/paypal-js/types/components/buttons';
1110

1211
jest.mock('@boldcommerce/checkout-frontend-library/lib/walletPay/walletPayOnShipping');
13-
jest.mock('src/actions/displayError');
1412
const walletPayOnShippingMock = mocked(walletPayOnShipping, true);
15-
const displayErrorMock = mocked(displayError, true);
1613

1714
describe('testing ppcpOnShippingChange function', () => {
1815

@@ -52,7 +49,7 @@ describe('testing ppcpOnShippingChange function', () => {
5249

5350
await ppcpOnShippingChange(dataMock, actionMock);
5451
expect(walletPayOnShippingMock).toHaveBeenCalledTimes(1);
55-
expect(displayErrorMock).toHaveBeenCalledTimes(0);
52+
expect(actionMock.reject).toHaveBeenCalledTimes(0);
5653
});
5754

5855

@@ -62,8 +59,7 @@ describe('testing ppcpOnShippingChange function', () => {
6259
walletPayOnShippingMock.mockReturnValue(Promise.resolve(paymentReturn));
6360

6461
await ppcpOnShippingChange(dataMock, actionMock);
65-
expect(displayErrorMock).toHaveBeenCalledTimes(1);
66-
expect(displayErrorMock).toHaveBeenCalledWith('There was an unknown error while getting the shipping details.', 'payment_gateway', 'unknown_error');
62+
expect(walletPayOnShippingMock).toHaveBeenCalledTimes(1);
6763
expect(actionMock.reject).toHaveBeenCalledTimes(1);
6864
});
6965

0 commit comments

Comments
 (0)