Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const getNativeUrl = ({ pageUrl = initialPageUrl } = {}) : string => {
return extendUrl(`${ NATIVE_DOMAIN }${ NATIVE_CHECKOUT_URI[fundingSource] }`, {
query: { sdkMeta, sessionUID, buttonSessionID, pageUrl }
});
};
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'
}
});
};
return createOrder().then(orderID => {
if (!parentPopupBridge) {
throw new Error(`Popup bridge required`);
}
const url = extendUrl(`${ getDomain() }${ WEB_CHECKOUT_URI }`, {
query: {
fundingSource,
token: orderID,
useraction: commit ? USER_ACTION.COMMIT : USER_ACTION.CONTINUE,
redirect_uri: parentPopupBridge.nativeUrl
}
});
return parentPopupBridge.start(url);
}).then(({ opType, PayerID: payerID, paymentId: paymentID, ba_token: billingToken }) => {
if (opType === POPUP_BRIDGE_OPTYPE.PAYMENT) {
.then(query => {
let url = normalizeMockUrl(this.component.getUrl(this.props));
return extendUrl(url, { query: { ...query } });
});
}
return ZalgoPromise.try(payment, { props }).then(token => {
if (!token) {
throw new Error(`Expected props.payment to return a payment id or token`);
}
return extendUrl(determineUrl(env, FUNDING.PAYPAL), {
token,
useraction: props.commit ? 'commit' : '',
native_xo: '1'
});
});
}
const getNativePopupUrl = () : string => {
return extendUrl(`${ NATIVE_POPUP_DOMAIN }${ NATIVE_CHECKOUT_POPUP_URI[fundingSource] }`, {
query: { sdkMeta }
});
};