Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
docs: add NowPayments integration plan (v1 top-ups) #376
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
base: main
Are you sure you want to change the base?
Uh oh!
There was an error while loading. Please reload this page.
docs: add NowPayments integration plan (v1 top-ups) #376
Changes from 1 commit
d551fab622eb4aFile filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The plan should explicitly mention that the
pay_currencywhitelist in thePOST /v1/invoicecall should be populated using theNOWPAYMENTS_PAY_CURRENCIESenvironment variable defined in section 8.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To ensure idempotency, the webhook handler must verify that the transaction hasn't already been processed before calling
increment_user_credits. Since webhooks can be redelivered, checking if the existing record'smetadata.statusis alreadyfinishedis necessary to prevent duplicate credit grants.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The update to the
credit_transactionstable and the call to theincrement_user_creditsRPC should be performed within a single database transaction. This ensures that credits are not granted without a corresponding record update, and vice versa, maintaining data consistency in case of partial failures.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line contradicts the earlier statement in line 45 which suggests credits might be granted for
partially_paidif the amount meets the expected value. The integration plan should define a consistent policy for handling underpayments.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The HMAC calculation depends on the exact string representation of the JSON. The plan should specify the serialization rules (e.g., no whitespace, specific character encoding) to ensure the generated hash matches the one sent by NowPayments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
crypto.timingSafeEqualrequires both inputs to beBufferobjects of the same length. The implementation should convert the hex strings to Buffers and handle potential length mismatches to avoid runtime errors.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The plan should specify that the
decrement_user_creditsRPC must be invoked when a refund is processed. Simply logging the transaction incredit_transactionswill not update the user's balance in thecreditstable, leading to a state mismatch.Uh oh!
There was an error while loading. Please reload this page.