Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
},
[ CARD.AMEX ]: {
eligible: true
},
[ CARD.MASTERCARD ]: {
eligible: true
}
}
}
};
createButtonHTML(fundingEligibility);
await mockSetupButton({ merchantID: [ 'XYZ12345' ], fundingEligibility });
await clickButton(FUNDING.CARD, CARD.VISA);
});
});
return renderToOriginal(...args);
});
}));
return checkoutInstance;
}));
const fundingEligibility = {
[ FUNDING.PAYPAL ]: {
eligible: true
},
[ FUNDING.CARD]: {
eligible: true,
vendors: {
[ CARD.VISA ]: {
eligible: true
},
[ CARD.AMEX ]: {
eligible: true
},
[ CARD.MASTERCARD ]: {
eligible: true
}
}
}
};
createButtonHTML(fundingEligibility);
await mockSetupButton({ merchantID: [ 'XYZ12345' ], fundingEligibility });
export async function clickButton(fundingSource? : string = FUNDING.PAYPAL, card? : string = CARD.VISA) : ZalgoPromise {
let selector = `button[data-funding-source=${ fundingSource }]`;
if (fundingSource === FUNDING.CARD) {
selector = `${ selector }[data-card=${ card }]`;
}
const button = window.document.querySelector(selector);
button.click();
await button.payPromise;
}
const fundingEligibility = {
[ FUNDING.CARD ]: {
eligible: true,
vendors: {
[ CARD.VISA ]: {
eligible: true
}
}
}
};
createButtonHTML(fundingEligibility);
await mockSetupButton({ merchantID: [ 'XYZ12345' ], fundingEligibility });
await clickButton(FUNDING.CARD, CARD.VISA);
});
});
})
}).expectCalls();
window.xprops.onApprove = mockAsyncProp(expect('onApprove', async () => {
gqlMock.done();
if (!clientConfigCalled) {
throw new Error(`Expected clientConfig mutation to be called`);
}
}));
const fundingEligibility = {
[ FUNDING.CARD ]: {
eligible: true,
vendors: {
[ CARD.VISA ]: {
eligible: true
}
}
}
};
createButtonHTML(fundingEligibility);
await mockSetupButton({ merchantID: [ 'XYZ12345' ], fundingEligibility });
await clickButton(FUNDING.CARD, CARD.VISA);
});
});
import { CARD, FUNDING, COUNTRY, COMPONENTS } from '@paypal/sdk-constants/src';
import { BUTTON_LAYOUT, BUTTON_COLOR, DEFAULT, CLASS, ATTRIBUTE } from '../../constants';
import { DEFAULT_FUNDING_CONFIG, type FundingSourceConfig, type CardConfig } from '../common';
import { Text } from '../../ui';
import { getVisaConfig } from './visa';
import { getMastercardConfig } from './mastercard';
import { getAmexConfig } from './amex';
import { getDiscoverConfig } from './discover';
import { getHiperConfig } from './hiper';
import { getEloConfig } from './elo';
import { getJCBConfig } from './jcb';
const CARD_PRIORITY : $ReadOnlyArray<$Values> = [
CARD.VISA,
CARD.MASTERCARD,
CARD.AMEX,
CARD.DISCOVER,
CARD.HIPER,
CARD.ELO,
CARD.JCB
];
function getVendorConfig() : { [$Values] : ?CardConfig } {
return {
[ CARD.VISA ]: (!__TREE_SHAKE__ || (__paypal_checkout__.serverConfig.fundingEligibility.card && __paypal_checkout__.serverConfig.fundingEligibility.card.vendors && __paypal_checkout__.serverConfig.fundingEligibility.card.vendors.visa && __paypal_checkout__.serverConfig.fundingEligibility.card.vendors.visa.eligible)) ? getVisaConfig() : null,
[ CARD.AMEX ]: (!__TREE_SHAKE__ || (__paypal_checkout__.serverConfig.fundingEligibility.card && __paypal_checkout__.serverConfig.fundingEligibility.card.vendors && __paypal_checkout__.serverConfig.fundingEligibility.card.vendors.amex && __paypal_checkout__.serverConfig.fundingEligibility.card.vendors.amex.eligible)) ? getAmexConfig() : null,
[ CARD.MASTERCARD ]: (!__TREE_SHAKE__ || (__paypal_checkout__.serverConfig.fundingEligibility.card && __paypal_checkout__.serverConfig.fundingEligibility.card.vendors && __paypal_checkout__.serverConfig.fundingEligibility.card.vendors.mastercard && __paypal_checkout__.serverConfig.fundingEligibility.card.vendors.mastercard.eligible)) ? getMastercardConfig() : null,
[ CARD.DISCOVER ]: (!__TREE_SHAKE__ || (__paypal_checkout__.serverConfig.fundingEligibility.card && __paypal_checkout__.serverConfig.fundingEligibility.card.vendors && __paypal_checkout__.serverConfig.fundingEligibility.card.vendors.discover && __paypal_checkout__.serverConfig.fundingEligibility.card.vendors.discover.eligible)) ? getDiscoverConfig() : null,
[ CARD.JCB ]: (!__TREE_SHAKE__ || (__paypal_checkout__.serverConfig.fundingEligibility.card && __paypal_checkout__.serverConfig.fundingEligibility.card.vendors && __paypal_checkout__.serverConfig.fundingEligibility.card.vendors.jcb && __paypal_checkout__.serverConfig.fundingEligibility.card.vendors.jcb.eligible)) ? getJCBConfig() : null,
[ CARD.ELO ]: (!__TREE_SHAKE__ || (__paypal_checkout__.serverConfig.fundingEligibility.card && __paypal_checkout__.serverConfig.fundingEligibility.card.vendors && __paypal_checkout__.serverConfig.fundingEligibility.card.vendors.elo && __paypal_checkout__.serverConfig.fundingEligibility.card.vendors.elo.eligible)) ? getEloConfig() : null,