Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return await wrapPromise(async ({ expect }) => {
window.xprops.remember = mockAsyncProp(expect('remember', (sources) => {
if (!sources || sources.indexOf(FUNDING.VENMO) === -1) {
throw new Error(`Expected venmo to be remembered`);
}
}));
await mockSetupButton({
merchantID: [ 'XYZ12345' ],
fundingEligibility: {
[ FUNDING.VENMO ]: {
eligible: true
}
}
});
});
});
window.xprops.remember = mockAsyncProp(expect('remember', (sources) => {
if (!sources || sources.indexOf(FUNDING.VENMO) === -1) {
throw new Error(`Expected venmo to be remembered`);
}
}));
});
createButtonHTML({
venmo: {
eligible: true
}
});
await mockSetupButton({
eligibility: {
cardFields: false,
native: true
}
});
await clickButton(FUNDING.VENMO);
gqlMock.done();
firebaseScripts.done();
});
});
return await wrapPromise(async ({ expect }) => {
const fundingSource = FUNDING.VENMO;
let clientConfigCalled = false;
const gqlMock = getGraphQLApiMock({
handler: expect('clientConfigCall', ({ data }) => {
if (!data.query.includes('mutation UpdateClientConfig')) {
return {};
}
if (data.variables.fundingSource !== fundingSource) {
throw new Error(`Expected fundingSource to be ${ fundingSource }, got ${ data.variables.fundingSource }`);
}
clientConfigCalled = true;
return {};
})
}).expectCalls();
return inlineMemoize(getFundingConfig, () => {
return {
[ FUNDING.PAYPAL ]: (!__TREE_SHAKE__ || (__paypal_checkout__.serverConfig.fundingEligibility.paypal && __paypal_checkout__.serverConfig.fundingEligibility.paypal.eligible)) ? getPayPalConfig() : null,
[ FUNDING.VENMO ]: (!__TREE_SHAKE__ || (__paypal_checkout__.serverConfig.fundingEligibility.venmo && __paypal_checkout__.serverConfig.fundingEligibility.venmo.eligible)) ? getVenmoConfig() : null,
[ FUNDING.ITAU ]: (!__TREE_SHAKE__ || (__paypal_checkout__.serverConfig.fundingEligibility.itau && __paypal_checkout__.serverConfig.fundingEligibility.itau.eligible)) ? getItauConfig() : null,
[ FUNDING.CREDIT ]: (!__TREE_SHAKE__ || (__paypal_checkout__.serverConfig.fundingEligibility.credit && __paypal_checkout__.serverConfig.fundingEligibility.credit.eligible)) ? getCreditConfig() : null,
[ FUNDING.CARD ]: (!__TREE_SHAKE__ || (__paypal_checkout__.serverConfig.fundingEligibility.card && __paypal_checkout__.serverConfig.fundingEligibility.card.eligible)) ? getCardConfig() : null,
[ FUNDING.IDEAL ]: (!__TREE_SHAKE__ || (__paypal_checkout__.serverConfig.fundingEligibility.ideal && __paypal_checkout__.serverConfig.fundingEligibility.ideal.eligible)) ? getIdealConfig() : null,
[ FUNDING.SEPA ]: (!__TREE_SHAKE__ || (__paypal_checkout__.serverConfig.fundingEligibility.sepa && __paypal_checkout__.serverConfig.fundingEligibility.sepa.eligible)) ? getSepaConfig() : null,
[ FUNDING.BANCONTACT ]: (!__TREE_SHAKE__ || (__paypal_checkout__.serverConfig.fundingEligibility.bancontact && __paypal_checkout__.serverConfig.fundingEligibility.bancontact.eligible)) ? getBancontactConfig() : null,
[ FUNDING.GIROPAY ]: (!__TREE_SHAKE__ || (__paypal_checkout__.serverConfig.fundingEligibility.giropay && __paypal_checkout__.serverConfig.fundingEligibility.giropay.eligible)) ? getGiropayConfig() : null,
[ FUNDING.SOFORT ]: (!__TREE_SHAKE__ || (__paypal_checkout__.serverConfig.fundingEligibility.sofort && __paypal_checkout__.serverConfig.fundingEligibility.sofort.eligible)) ? getSofortConfig() : null,
[ FUNDING.EPS ]: (!__TREE_SHAKE__ || (__paypal_checkout__.serverConfig.fundingEligibility.eps && __paypal_checkout__.serverConfig.fundingEligibility.eps.eligible)) ? getEpsConfig() : null,
[ FUNDING.MYBANK ]: (!__TREE_SHAKE__ || (__paypal_checkout__.serverConfig.fundingEligibility.mybank && __paypal_checkout__.serverConfig.fundingEligibility.mybank.eligible)) ? getMybankConfig() : null,
[ FUNDING.P24 ]: (!__TREE_SHAKE__ || (__paypal_checkout__.serverConfig.fundingEligibility.p24 && __paypal_checkout__.serverConfig.fundingEligibility.p24.eligible)) ? getP24Config() : null,
[ FUNDING.PAYU ]: (!__TREE_SHAKE__ || (__paypal_checkout__.serverConfig.fundingEligibility.payu && __paypal_checkout__.serverConfig.fundingEligibility.payu.eligible)) ? getPayuConfig() : null,
[ FUNDING.VERKKOPANKKI ]: (!__TREE_SHAKE__ || (__paypal_checkout__.serverConfig.fundingEligibility.verkkopankki && __paypal_checkout__.serverConfig.fundingEligibility.verkkopankki.eligible)) ? getVerkkopankkiConfig() : null,
[ FUNDING.BLIK ]: (!__TREE_SHAKE__ || (__paypal_checkout__.serverConfig.fundingEligibility.blik && __paypal_checkout__.serverConfig.fundingEligibility.blik.eligible)) ? getBlikConfig() : null,
[ FUNDING.TRUSTLY ]: (!__TREE_SHAKE__ || (__paypal_checkout__.serverConfig.fundingEligibility.truslty && __paypal_checkout__.serverConfig.fundingEligibility.trustly.eligible)) ? getTrustlyConfig() : null,
[ FUNDING.ZIMPLER ]: (!__TREE_SHAKE__ || (__paypal_checkout__.serverConfig.fundingEligibility.zimpler && __paypal_checkout__.serverConfig.fundingEligibility.zimpler.eligible)) ? getZimplerConfig() : null,
tasks.remember = ZalgoPromise.try(() => {
if (fundingEligibility && fundingEligibility.venmo && fundingEligibility.venmo.eligible) {
return window.xprops.remember([ FUNDING.VENMO ]);
}
});
const getWebCheckoutUrl = ({ orderID }) : string => {
return extendUrl(`${ getDomain() }${ WEB_CHECKOUT_URI }`, {
query: {
fundingSource,
facilitatorAccessToken,
token: orderID,
useraction: commit ? USER_ACTION.COMMIT : USER_ACTION.CONTINUE,
native_xo: '1',
venmoOverride: (fundingSource === FUNDING.VENMO) ? '1' : '0'
}
});
};
export const BASE_SMART_API_URL = '/smart/api';
export const SMART_API_URI = {
AUTH: `${ BASE_SMART_API_URL }/auth`,
CHECKOUT: `${ BASE_SMART_API_URL }/checkout`,
ORDER: `${ BASE_SMART_API_URL }/order`,
PAYMENT: `${ BASE_SMART_API_URL }/payment`,
SUBSCRIPTION: `${ BASE_SMART_API_URL }/billagmt/subscriptions`
};
export const GRAPHQL_URI = '/graphql';
export const WEB_CHECKOUT_URI = '/checkoutnow';
export const NATIVE_CHECKOUT_URI : { [ $Values ] : string } = {
[ FUNDING.PAYPAL ]: '/smart/checkout/native',
[ FUNDING.VENMO ]: '/smart/checkout/venmo'
};
export const NATIVE_CHECKOUT_POPUP_URI : { [$Values ] : string } = {
[ FUNDING.PAYPAL ]: '/smart/checkout/native/popup',
[ FUNDING.VENMO ]: '/smart/checkout/venmo/popup'
};
export const NATIVE_DETECTION_URL = 'http://127.0.0.1:8765/hello';
export const CLIENT_ID_PAYEE_NO_MATCH = [
'Af3YaeRfoJGtncwLeiahT93xTYT0-wldEEaiGehhGspP333r6tADvHeVCwZPR022F4d0YQquv7Lik_PT',
'AbHo6hBEDmCHulDhRMkCVk7FDed5zE1-mNo7SQvo_yxeLvGylM5mGh5IOjx0AV9sTHhHDjD4A443Dybb',
'AcjM7hAZjUAqIgU0Lvzneb9-_rWs7qAEl6PoPVHtQV5PNmWBihQWsu_SglKO',
'Af_pMiA6ikCtlsNB8dJW1oG1ZI7FirXbRU43rDRfq_i_iQAPbYsojeI9Q2VzZvD1u2wKEPuaokZaNWyC',
'AQAZZuAP5V0b8Wzs1t3KJM3opK8ueK6Txnlm7pw6kMFHrcAdFogBw3pBmeNP-234aHAZ2BlHeijkU2Tt',