Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
label
}
}
});
}
for (const fundingSource of Object.values(FUNDING)) {
buttonConfigs.push({
fundingEligibility: {
paypal: {
eligible: true
},
// $FlowFixMe
[ fundingSource ]: {
eligible: true,
vendors: fundingSource === FUNDING.CARD
? {
visa: {
eligible: true
},
amex: {
eligible: true
},
mastercard: {
eligible: true
}
}
: null
}
},
rememberedFunding: fundingSource === FUNDING.VENMO
// $FlowFixMe
if (isDefined(basicCardEligibility[card].eligible)) {
delete vendorsQuery[card].eligible;
}
// if (isDefined(basicCardEligibility[card].vaultable)) {
// delete vendorsQuery[card].vaultable;
// }
if (!Object.keys(vendorsQuery[card]).length) {
delete vendorsQuery[card];
}
}
}
if (!Object.keys(vendorsQuery).length) {
delete fundingQuery[FUNDING.CARD].vendors;
}
for (const fundingSource of values(FUNDING)) {
if ([ FUNDING.VENMO, FUNDING.ITAU ].includes(fundingSource)) {
continue;
}
if (basicFundingEligibility[fundingSource] && fundingQuery[fundingSource]) {
if (isDefined(basicFundingEligibility[fundingSource].eligible)) {
delete fundingQuery[fundingSource].eligible;
}
// if (isDefined(basicFundingEligibility[fundingSource].vaultable)) {
// delete fundingQuery[fundingSource].vaultable;
// }
export function shouldRenderFraudnet({ fundingEligibility } : { fundingEligibility : FundingEligibility }) : boolean {
for (const fundingSource of Object.values(FUNDING)) {
// $FlowFixMe
const fundingConfig = fundingEligibility[fundingSource];
if (fundingConfig && fundingConfig.vaultedInstruments && fundingConfig.vaultedInstruments.length) {
return true;
}
if (fundingSource === FUNDING.CARD && fundingConfig && fundingConfig.vendors) {
for (const card of Object.values(CARD)) {
const cardConfig = fundingConfig.vendors[card];
if (cardConfig && cardConfig.vaultedInstruments && cardConfig.vaultedInstruments.length) {
return true;
}
}
}
}
return false;
}
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;
}
vaultable: types.boolean,
vaultedInstruments: getVaultedInstrumentQuery()
};
};
const getCardQuery = () => {
return {
eligible: types.boolean,
branded: types.boolean,
vendors: getVendorQuery()
};
};
const fundingQuery = {
[ FUNDING.PAYPAL ]: getPayPalQuery(),
[ FUNDING.CARD ]: getCardQuery(),
[ FUNDING.VENMO ]: getBasicFundingEligibilityQuery(),
[ FUNDING.ITAU ]: getBasicFundingEligibilityQuery(),
[ FUNDING.CREDIT ]: getBasicFundingEligibilityQuery(),
[ FUNDING.SEPA ]: getBasicFundingEligibilityQuery(),
[ FUNDING.IDEAL ]: getBasicFundingEligibilityQuery(),
[ FUNDING.BANCONTACT ]: getBasicFundingEligibilityQuery(),
[ FUNDING.GIROPAY ]: getBasicFundingEligibilityQuery(),
[ FUNDING.EPS ]: getBasicFundingEligibilityQuery(),
[ FUNDING.SOFORT ]: getBasicFundingEligibilityQuery(),
[ FUNDING.MYBANK ]: getBasicFundingEligibilityQuery(),
[ FUNDING.P24 ]: getBasicFundingEligibilityQuery(),
[ FUNDING.ZIMPLER ]: getBasicFundingEligibilityQuery(),
[ FUNDING.WECHATPAY ]: getBasicFundingEligibilityQuery(),
[ FUNDING.PAYU ]: getBasicFundingEligibilityQuery(),
[ FUNDING.BLIK ]: getBasicFundingEligibilityQuery(),
[ FUNDING.TRUSTLY ]: getBasicFundingEligibilityQuery(),