How to use the @paypal/sdk-constants/src.COUNTRY.US 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 / zoid / buttons / props.js View on Github external
clientAccessToken? : string,
    csp? : {
        nonce? : string
    },
    cardButtonExperiment? : boolean
|};

export const DEFAULT_STYLE = {
    LAYOUT: BUTTON_LAYOUT.VERTICAL,
    COLOR:  BUTTON_COLOR.GOLD,
    SHAPE:  BUTTON_SHAPE.RECT
};

export const DEFAULT_PROPS = {
    LOCALE:   {
        country: COUNTRY.US,
        lang:    LANG.EN
    },
    COMMIT:   COMMIT.TRUE,
    VAULT:    VAULT.FALSE,
    INTENT:   INTENT.CAPTURE,
    ENV:      ENV.PRODUCTION,
    PLATFORM: PLATFORM.DESKTOP
};

// $FlowFixMe
export function normalizeButtonStyle(style : ButtonStyleInputs) : ButtonStyle {

    if (!style) {
        throw new Error(`Expected props.style to be set`);
    }
github paypal / paypal-checkout-components / src / zoid / buttons / props.js View on Github external
clientAccessToken? : string,
    csp? : {
        nonce? : string
    },
    content? : { [string] : string }
|};

export const DEFAULT_STYLE = {
    LAYOUT: BUTTON_LAYOUT.VERTICAL,
    COLOR:  BUTTON_COLOR.GOLD,
    SHAPE:  BUTTON_SHAPE.RECT
};

export const DEFAULT_PROPS = {
    LOCALE:   {
        country: COUNTRY.US,
        lang:    LANG.EN
    },
    COMMIT:   COMMIT.TRUE,
    VAULT:    VAULT.FALSE,
    INTENT:   INTENT.CAPTURE,
    ENV:      ENV.PRODUCTION,
    PLATFORM: PLATFORM.DESKTOP
};

// $FlowFixMe
export function normalizeButtonStyle(style : ButtonStyleInputs) : ButtonStyle {

    if (!style) {
        throw new Error(`Expected props.style to be set`);
    }
github paypal / paypal-sdk-client / src / script.js View on Github external
// $FlowFixMe
            return { country, lang };
        }
    }

    for (const { country } of getBrowserLocales()) {
        // $FlowFixMe
        if (COUNTRY_LANGS.hasOwnProperty(country)) {
            // $FlowFixMe
            return { country, lang: COUNTRY_LANGS[country][0] };
        }
    }

    return {
        lang:    LANG.EN,
        country: COUNTRY.US
    };
}
github paypal / paypal-smart-payment-buttons / test / client / actions.js View on Github external
}

                        return renderToOriginal(...args);
                    });
                }));

                return checkoutInstance;
            }));

            createButtonHTML();

            await mockSetupButton({
                merchantID:                    [ 'XYZ12345' ],
                fundingEligibility:            DEFAULT_FUNDING_ELIGIBILITY,
                personalization:               {},
                buyerCountry:                  COUNTRY.US,
                isCardFieldsExperimentEnabled: false
            });

            await clickButton(FUNDING.PAYPAL);
        });
    });
github paypal / paypal-smart-payment-buttons / test / client / actions.js View on Github external
}

                        return renderToOriginal(...args);
                    });
                }));

                return checkoutInstance;
            }));

            createButtonHTML();

            await mockSetupButton({
                merchantID:                    [ 'XYZ12345' ],
                fundingEligibility:            DEFAULT_FUNDING_ELIGIBILITY,
                personalization:               {},
                buyerCountry:                  COUNTRY.US,
                isCardFieldsExperimentEnabled: false
            });

            await clickButton(FUNDING.PAYPAL);

            gqlMock.done();
        });
    });
github paypal / paypal-smart-payment-buttons / test / client / mocks.js View on Github external
export async function mockSetupButton(overrides? : Object = {}) : ZalgoPromise {
    await setupButton({
        facilitatorAccessToken:        'QQQ123000',
        merchantID:                    [ 'XYZ12345' ],
        fundingEligibility:            DEFAULT_FUNDING_ELIGIBILITY,
        personalization:               {},
        buyerCountry:                  COUNTRY.US,
        isCardFieldsExperimentEnabled: false,
        firebaseConfig:                MOCK_FIREBASE_CONFIG,
        eligibility:                   {
            cardFields: false,
            native:     false
        },
        sdkMeta: MOCK_SDK_META,
        ...overrides
    });
}
github paypal / paypal-smart-payment-buttons / src / button / props / props.js View on Github external
export function getServiceData({ facilitatorAccessToken, sdkMeta, buyerGeoCountry, fundingEligibility, personalization, serverMerchantID, eligibility } : ServiceDataOptions) : ServiceData {
    return {
        merchantID:   serverMerchantID,
        buyerCountry: buyerGeoCountry || COUNTRY.US,
        fundingEligibility,
        sdkMeta,
        personalization,
        facilitatorAccessToken,
        eligibility
    };
}
github paypal / paypal-smart-payment-buttons / src / button.js View on Github external
export function setupButton(fundingEligibility : Object) : ZalgoPromise {

    if (!window.paypal) {
        throw new Error(`PayPal library not loaded`);
    }

    setupLogger();

    const buyerCountry = window.xprops.buyerCountry || fundingEligibility.buyerCountry || COUNTRY.US;

    if (fundingEligibility.fundingEligibility) {
        fundingEligibility = fundingEligibility.fundingEligibility;
    }

    let buttonEnabled = true;

    const checkout = ({ win, fundingSource, card, paymentMethodID } : { win? : ProxyWindow, fundingSource : $Values, card : ?$Values, paymentMethodID? : ?string }) => {
        const validationPromise = onClickValidate({ fundingSource, card });

        if (!buttonEnabled) {
            return ZalgoPromise.try(() => {
                if (win) {
                    return win.close();
                }
            });