@paypal/checkout-components
Advanced tools
Comparing version 5.0.295-alpha.0 to 5.0.295-alpha.11
{ | ||
"name": "@paypal/checkout-components", | ||
"version": "5.0.295-alpha.0", | ||
"version": "5.0.295-alpha.11", | ||
"description": "PayPal Checkout components, for integrating checkout products.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -61,13 +61,2 @@ /* @flow */ | ||
export const getFundingSource = (paymentSource: string): string => { | ||
let fundingSource = paymentSource; | ||
// The SDK uses "credit" for the "Debit or Credit Card" button, but the | ||
// Hosted Buttons API expects "CARD" for the "Debit or Credit Card" button | ||
// as the `funding_source` property. | ||
if (paymentSource === FUNDING.CREDIT) { | ||
fundingSource = FUNDING.CARD; | ||
} | ||
return fundingSource.toUpperCase(); | ||
}; | ||
export const getHostedButtonDetails: HostedButtonDetailsParams = ({ | ||
@@ -137,3 +126,3 @@ hostedButtonId, | ||
entry_point: entryPoint, | ||
funding_source: getFundingSource(data.paymentSource), | ||
funding_source: data.paymentSource.toUpperCase(), | ||
merchant_id: merchantId, | ||
@@ -168,3 +157,3 @@ ...userInputs, | ||
// a checkout via "Debit or Credit Card". | ||
if (data.paymentSource === FUNDING.CREDIT) { | ||
if (data.paymentSource === FUNDING.CARD) { | ||
const url = `${baseUrl}/ncp/payment/${hostedButtonId}/${data.orderID}`; | ||
@@ -171,0 +160,0 @@ if (supportsPopups()) { |
@@ -10,3 +10,2 @@ /* @flow */ | ||
buildHostedButtonOnApprove, | ||
getFundingSource, | ||
getHostedButtonDetails, | ||
@@ -146,3 +145,3 @@ } from "./utils"; | ||
supportsPopups.mockImplementation(() => true); | ||
await onApprove({ orderID, paymentSource: "credit" }); | ||
await onApprove({ orderID, paymentSource: "card" }); | ||
expect(popup).toHaveBeenCalled(); | ||
@@ -153,3 +152,3 @@ | ||
supportsPopups.mockImplementation(() => false); | ||
await onApprove({ orderID, paymentSource: "credit" }); | ||
await onApprove({ orderID, paymentSource: "card" }); | ||
expect(window.location).toMatch( | ||
@@ -162,6 +161,1 @@ `/ncp/payment/${hostedButtonId}/${orderID}` | ||
}); | ||
test("getFundingSource", () => { | ||
expect(getFundingSource("paypal")).toEqual("PAYPAL"); | ||
expect(getFundingSource("credit")).toEqual("CARD"); | ||
}); |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
20
1161087
15134