-
Notifications
You must be signed in to change notification settings - Fork 29
Include USDT payments #400
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
Conversation
|
There is another issue. After completing USDT payment in MetaMask, users are redirected to an error page instead of order confirmation:
This is a direct consequence of earlier bug. Here's the failure chain:
|
| blockonomics_create_payment_page(); | ||
| } | ||
|
|
||
| function blockonomics_update_primary_key() { |
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.
Existing installations upgrading from < v1.5 may have BTC/BCH orders with txid = NULL. The migration tries to add txid to the PRIMARY KEY, which fails silently and as a result db stays in old schema while blockonomics_db_version claims "1.5".
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.
Updated function to replace NULL txid with empty string before altering the primary key: 405a638
| SELECT 1 FROM $table_name | ||
| WHERE (crypto = 'BTC' AND address = %s) | ||
| OR (crypto = 'USDT' AND txid <> '' AND txid = %s) |
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 check never prevents duplicate USDT addresses with empty txids. Thus, for same USDT wallet on server, attempting USDT checkout produces duplicate key error. For ex.
WordPress database error: [Duplicate entry '0x8f8210db9eEADD080Bbf45108f15106a3C4636A2' for key 'PRIMARY']
INSERT INTO wp_blockonomics_payments (order_id, crypto, address, txid, payment_status, currency, expected_fiat, expected_satoshi)
SELECT 68, 'usdt', '0x8f8210db9eEADD080Bbf45108f15106a3C4636A2', '', 0, 'USD', 0, 99906
FROM DUAL WHERE NOT EXISTS (...)
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 error also looks related to the primary key not being updated. Should be resolved now, but included error handling for insert_order() to avoid cases like this in the future: 01454a2
|
USDT Checkout shows amounts like $0.999006 instead of $1 creating bad UX. We can add USDT specific 2 decimal rounding to |
We should not round the values passed to the web3 payment component, as this will lead to the incorrect amount being paid. We can round values for display purposes, but this should be done in the web3 payment itself. |
| $error_messages = []; | ||
|
|
||
| foreach ($enabled_cryptos as $code) { | ||
| $response = $this->new_address($code, true); |
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.
We are using the reset=1 param when doing test setup, this has problems with BTC:
- Primary key error on subsequent checkout
- Test setup resulting in false positives (say, instead of displaying gap limit error)
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.
|
Additional things we need fix before merging this PR:
|
|


Includes USDT payments.
Done:
Still todo: