How to use the @paypal/sdk-constants/src.FPTI_KEY.TOKEN function in @paypal/sdk-constants

To help you get started, we’ve selected a few @paypal/sdk-constants examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github paypal / paypal-checkout-components / src / lib / logger.js View on Github external
getLogger().addTrackingBuilder(() => {
        const orderID = getOrderID();
        const buttonSessionID = getButtonSessionID();

        return {
            [FPTI_KEY.CONTEXT_TYPE]:       orderID ? FPTI_CONTEXT_TYPE.ORDER_ID : FPTI_CONTEXT_TYPE.BUTTON_SESSION_ID,
            [FPTI_KEY.CONTEXT_ID]:         orderID ? orderID : buttonSessionID,
            [FPTI_KEY.BUTTON_SESSION_UID]: buttonSessionID,
            [FPTI_KEY.TOKEN]:              orderID,
            [FPTI_KEY.REFERER]:            getRefererDomain()
        };
    });
}
github paypal / paypal-sdk-client / src / api.js View on Github external
}).then(({ body }) : string => {

        if (!body || !body.id) {
            throw new Error(`Order Api response error:\n\n${ JSON.stringify(body, null, 4) }`);
        }

        getLogger().track({
            [FPTI_KEY.STATE]:        fptiState,
            [FPTI_KEY.TRANSITION]:   FPTI_TRANSITION.CREATE_ORDER,
            [FPTI_KEY.CONTEXT_TYPE]: FPTI_CONTEXT_TYPE.ORDER_ID,
            [FPTI_KEY.TOKEN]:        body.id,
            [FPTI_KEY.CONTEXT_ID]:   body.id
        });

        return body.id;
    });
}
github paypal / paypal-smart-payment-buttons / src / button / props / onApprove.js View on Github external
}).then(orderID => {

            getLogger()
                .info('button_approve')
                .track({
                    [FPTI_KEY.TRANSITION]: FPTI_TRANSITION.CHECKOUT_AUTHORIZE,
                    [FPTI_KEY.TOKEN]:      orderID
                }).flush();

            const data = { orderID, payerID, paymentID, billingToken, subscriptionID, facilitatorAccessToken };
            const actions = buildXApproveActions({ orderID, paymentID, payerID, intent, restart, subscriptionID, facilitatorAccessToken, buyerAccessToken, partnerAttributionID, forceRestAPI });

            return onApprove(data, actions).catch(err => {
                return ZalgoPromise.try(() => {
                    return onError(err);
                }).then(() => {
                    throw err;
                });
            });
        });
    });
github paypal / paypal-smart-payment-buttons / src / button / props / onShippingChange.js View on Github external
return createOrder().then(orderID => {
                getLogger()
                    .info('button_shipping_change')
                    .track({
                        [FPTI_KEY.TRANSITION]: FPTI_TRANSITION.CHECKOUT_SHIPPING_CHANGE,
                        [FPTI_KEY.TOKEN]:      orderID
                    }).flush();

                return onShippingChange(buildXOnShippingChangeData(data), buildXShippingChangeActions({ orderID, facilitatorAccessToken, buyerAccessToken, actions, partnerAttributionID }));
            });
        };
github paypal / paypal-smart-payment-buttons / src / api / order.js View on Github external
}).then((body) : string => {

        const orderID = body && body.id;

        if (!orderID) {
            throw new Error(`Order Api response error:\n\n${ JSON.stringify(body, null, 4) }`);
        }

        getLogger().track({
            [FPTI_KEY.TRANSITION]:   FPTI_TRANSITION.CREATE_ORDER,
            [FPTI_KEY.CONTEXT_TYPE]: FPTI_CONTEXT_TYPE.ORDER_ID,
            [FPTI_KEY.TOKEN]:        orderID,
            [FPTI_KEY.CONTEXT_ID]:   orderID
        });

        return orderID;
    });
}
github paypal / paypal-smart-payment-buttons / src / button / props / onCancel.js View on Github external
return createOrder().then(orderID => {
            getLogger()
                .info('button_cancel')
                .track({
                    [FPTI_KEY.TRANSITION]: FPTI_TRANSITION.CHECKOUT_CANCEL,
                    [FPTI_KEY.TOKEN]:      orderID
                }).flush();

            return onCancel(buildXOnCancelData({ orderID }), buildXOnCancelActions());
        }).catch(err => {
            return onError(err);
github paypal / paypal-smart-payment-buttons / src / button / props / createOrder.js View on Github external
if (!orderID || typeof orderID !== 'string') {
                throw new Error(`Expected an order id to be passed`);
            }
    
            if (orderID.indexOf('PAY-') === 0 || orderID.indexOf('PAYID-') === 0) {
                throw new Error(`Do not pass PAY-XXX or PAYID-XXX directly into createOrder. Pass the EC-XXX token instead`);
            }

            const duration = Date.now() - startTime;
    
            getLogger().track({
                [FPTI_KEY.STATE]:              FPTI_STATE.BUTTON,
                [FPTI_KEY.TRANSITION]:         FPTI_TRANSITION.RECEIVE_ORDER,
                [FPTI_KEY.CONTEXT_TYPE]:       FPTI_CONTEXT_TYPE.ORDER_ID,
                [FPTI_KEY.CONTEXT_ID]:         orderID,
                [FPTI_KEY.TOKEN]:              orderID,
                [FPTI_KEY.BUTTON_SESSION_UID]: buttonSessionID,
                [FPTI_KEY.RESPONSE_DURATION]:  duration.toString()
            }).flush();
    
            return orderID;
        });
    });
github paypal / paypal-smart-payment-buttons / src / api / payment.js View on Github external
}).then(body => {

        const paymentID = body && body.id;

        if (!paymentID) {
            throw new Error(`Payment Api response error:\n\n${ JSON.stringify(body, null, 4) }`);
        }

        getLogger().track({
            [FPTI_KEY.TRANSITION]:   FPTI_TRANSITION.CREATE_PAYMENT,
            [FPTI_KEY.CONTEXT_TYPE]: FPTI_CONTEXT_TYPE.PAYMENT_ID,
            [FPTI_KEY.TOKEN]:        paymentID,
            [FPTI_KEY.CONTEXT_ID]:   paymentID
        });

        return body;
    });
}