Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ERROR TypeError: identifierForVendor.replace is not a function. (In 'identifierForVendor.replace(/-/g, '')', 'identifierForVendor.replace' is undefined) #5

Open
Marioegarcia opened this issue Jul 14, 2022 · 4 comments

Comments

@Marioegarcia
Copy link

ERROR TypeError: identifierForVendor.replace is not a function. (In 'identifierForVendor.replace(/-/g, '')', 'identifierForVendor.replace' is undefined)

@marlon07021
Copy link

Any updates on this ?

@hernancasillas
Copy link

Any updates on this ? x2

@slashweb
Copy link

Same here, how did you solve this?

@LuisEGV
Copy link

LuisEGV commented Feb 13, 2024

Got it to "almost" work by changing the package function createDeviceSessionId to by async.

let identifierForVendor = this.identifierForVendor(); returns a promise, but is not fulfilled unless you add an await.

So I made the function async like this:

 createDeviceSessionId = async () => {
        let identifierForVendor = await this.identifierForVendor() || "testing this";
        console.log("identifierForVendor",identifierForVendor)
        identifierForVendor = identifierForVendor.replace(/-/g, '');

        const uri = vsprintf('%s/oa/logo.htm?m=%s&s=%s', [
            this.props.isProductionMode ? API_URL_PRODUCTION : API_URL_SANDBOX,
            this.props.merchantId,
            sessionId,
        ]);
        const injectedJavaScript = vsprintf('var identifierForVendor = "%s";', [
            identifierForVendor,
        ]);

        this.setState(() => ({uri, injectedJavaScript}));
        this.props.deviceSession(sessionId);
    };

Not an openpay worker lol, but this fixes the crash. It still by no means fixes other validation errors that you get via interacting with the card.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants