@paypal/checkout-components 5.0.303 → 5.0.305-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/globals.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@paypal/checkout-components",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.305-alpha.0",
|
|
4
4
|
"description": "PayPal Checkout components, for integrating checkout products.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -113,7 +113,7 @@
|
|
|
113
113
|
"@paypal/common-components": "^1.0.35",
|
|
114
114
|
"@paypal/connect-loader-component": "1.1.1",
|
|
115
115
|
"@paypal/funding-components": "^1.0.31",
|
|
116
|
-
"@paypal/sdk-client": "^4.0.
|
|
116
|
+
"@paypal/sdk-client": "^4.0.184",
|
|
117
117
|
"@paypal/sdk-constants": "^1.0.141",
|
|
118
118
|
"@paypal/sdk-logos": "^2.2.6"
|
|
119
119
|
},
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
getClientID,
|
|
8
8
|
getMerchantID as getSDKMerchantID,
|
|
9
9
|
} from "@paypal/sdk-client/src";
|
|
10
|
+
import { FUNDING } from "@paypal/sdk-constants/src";
|
|
10
11
|
|
|
11
12
|
import type {
|
|
12
13
|
ButtonVariables,
|
|
@@ -208,6 +209,14 @@ export const buildHostedButtonOnApprove = ({
|
|
|
208
209
|
merchant_id: merchantId,
|
|
209
210
|
context_id: data.orderID,
|
|
210
211
|
}),
|
|
212
|
+
}).then((response) => {
|
|
213
|
+
// The "Debit or Credit Card" button does not open a popup
|
|
214
|
+
// so we need to redirect to the thank you page for buyers who complete
|
|
215
|
+
// a checkout via "Debit or Credit Card".
|
|
216
|
+
if (data.paymentSource === FUNDING.CARD) {
|
|
217
|
+
window.location = `${baseUrl}/ncp/payment/${hostedButtonId}/${data.orderID}`;
|
|
218
|
+
}
|
|
219
|
+
return response;
|
|
211
220
|
});
|
|
212
221
|
};
|
|
213
222
|
};
|
|
@@ -264,6 +264,28 @@ describe("buildHostedButtonOnApprove", () => {
|
|
|
264
264
|
);
|
|
265
265
|
expect.assertions(1);
|
|
266
266
|
});
|
|
267
|
+
|
|
268
|
+
describe("inline guest", () => {
|
|
269
|
+
const onApprove = buildHostedButtonOnApprove({
|
|
270
|
+
hostedButtonId,
|
|
271
|
+
merchantId,
|
|
272
|
+
});
|
|
273
|
+
// $FlowIssue
|
|
274
|
+
request.mockImplementation(() =>
|
|
275
|
+
// eslint-disable-next-line compat/compat
|
|
276
|
+
Promise.resolve({
|
|
277
|
+
body: {},
|
|
278
|
+
})
|
|
279
|
+
);
|
|
280
|
+
|
|
281
|
+
test("redirects from the merchant's site to a thank you page", async () => {
|
|
282
|
+
expect(window.location.href).toBe("http://localhost:3000/");
|
|
283
|
+
await onApprove({ orderID, paymentSource: "card" });
|
|
284
|
+
expect(window.location).toBe(
|
|
285
|
+
"https://example.com/ncp/payment/B1234567890/EC-1234567890"
|
|
286
|
+
);
|
|
287
|
+
});
|
|
288
|
+
});
|
|
267
289
|
});
|
|
268
290
|
|
|
269
291
|
/* eslint-enable no-restricted-globals, promise/no-native */
|
|
@@ -39,7 +39,7 @@ import {
|
|
|
39
39
|
getDisableSetCookie,
|
|
40
40
|
getExperimentation,
|
|
41
41
|
getSDKAttribute,
|
|
42
|
-
|
|
42
|
+
getJsSdkLibrary,
|
|
43
43
|
} from "@paypal/sdk-client/src";
|
|
44
44
|
import {
|
|
45
45
|
rememberFunding,
|
|
@@ -610,6 +610,13 @@ export const getButtonsComponent: () => ButtonsComponent = memoize(() => {
|
|
|
610
610
|
value: getIntent,
|
|
611
611
|
},
|
|
612
612
|
|
|
613
|
+
jsSdkLibrary: {
|
|
614
|
+
type: "string",
|
|
615
|
+
queryParam: true,
|
|
616
|
+
required: false,
|
|
617
|
+
value: getJsSdkLibrary,
|
|
618
|
+
},
|
|
619
|
+
|
|
613
620
|
locale: {
|
|
614
621
|
type: "object",
|
|
615
622
|
queryParam: true,
|
|
@@ -776,13 +783,6 @@ export const getButtonsComponent: () => ButtonsComponent = memoize(() => {
|
|
|
776
783
|
queryParam: true,
|
|
777
784
|
},
|
|
778
785
|
|
|
779
|
-
sdkIntegrationSource: {
|
|
780
|
-
type: "string",
|
|
781
|
-
queryParam: true,
|
|
782
|
-
required: false,
|
|
783
|
-
value: getSDKIntegrationSource,
|
|
784
|
-
},
|
|
785
|
-
|
|
786
786
|
sdkMeta: {
|
|
787
787
|
type: "string",
|
|
788
788
|
queryParam: true,
|