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

Avoid wrong use of secret key with multiple paymongo account on the same application runtime #54

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

shlowmo
Copy link

@shlowmo shlowmo commented Mar 1, 2024

Double check existing instance API key in constructor

Resolves #50

qdekussche and others added 2 commits March 1, 2024 17:35
if (!secret) throw new Error('API key is required!');

if (Paymongo.instance instanceof Paymongo) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be done in a single if for cleaner code.

if (Paymongo.instance instanceof Paymongo && Paymongo.instance.secret === secret)

Kindly update, thanks.

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

Successfully merging this pull request may close these issues.

Using the same library to process payment with 2 paymongo account
2 participants