- Fix duplicate detection logic to prevent amount accumulation when new transactions arrive to already-processed payments - Fix status constant naming errors: STATUS_CONFIRMED_OVERPAID → STATUS_CONFIRMED_OVERPAY, STATUS_EXPIRED_REFUNDED → STATUS_LATEPAY_REFUNDED - Fix SweepRestockingFeeTests mock setup: add missing refund_confirmations, get_coin_config patches, and proper XMR client mocks - Correct overpayment test expectations: restocking fee sweep happens later after refund confirmation, not immediately - Update test assertions to match actual implementation behavior (transfer vs sweep_all for XMR) - Add comprehensive mock configurations for DOGE/XMR atomic units and balance methods All 108 crypto payment tests now pass. Fixes critical duplicate payment processing bug and aligns test expectations with production behavior.
51 lines
No EOL
1.6 KiB
SQL
51 lines
No EOL
1.6 KiB
SQL
-- SQL Migration Script: Update Crypto Payment Status Names
|
|
-- Renames state values in mps_crypto_payment table to match new code constants
|
|
-- Run this before deploying the updated codebase
|
|
|
|
BEGIN TRANSACTION;
|
|
|
|
-- Update confirmed-overpaid states to confirmed-overpay
|
|
UPDATE mps_crypto_payment
|
|
SET status = 'confirmed-overpay'
|
|
WHERE status = 'confirmed-overpaid';
|
|
|
|
UPDATE mps_crypto_payment
|
|
SET status = 'confirmed-overpay-refunded'
|
|
WHERE status = 'confirmed-overpaid-refunded';
|
|
|
|
UPDATE mps_crypto_payment
|
|
SET status = 'confirmed-overpay-refunded-complete'
|
|
WHERE status = 'confirmed-overpaid-refunded-complete';
|
|
|
|
-- Update expired-refunded states to latepay-refunded
|
|
UPDATE mps_crypto_payment
|
|
SET status = 'latepay-refunded'
|
|
WHERE status = 'expired-refunded';
|
|
|
|
UPDATE mps_crypto_payment
|
|
SET status = 'latepay-refunded-complete'
|
|
WHERE status = 'expired-refunded-complete';
|
|
|
|
-- Update any not-refunded states (if they exist)
|
|
UPDATE mps_crypto_payment
|
|
SET status = 'confirmed-overpay-not-refunded'
|
|
WHERE status = 'confirmed-overpaid-not-refunded';
|
|
|
|
UPDATE mps_crypto_payment
|
|
SET status = 'latepay-not-refunded'
|
|
WHERE status = 'expired-not-refunded';
|
|
|
|
-- Verify the changes
|
|
SELECT 'Updated status counts:' as info;
|
|
SELECT status, COUNT(*) as count
|
|
FROM mps_crypto_payment
|
|
GROUP BY status
|
|
ORDER BY status;
|
|
|
|
-- Commit the transaction
|
|
COMMIT;
|
|
|
|
-- Instructions:
|
|
-- 1. Backup your database first: cp data/make_post_sell.sqlite data/make_post_sell.sqlite.backup-$(date +%Y%m%d-%H%M%S)
|
|
-- 2. Run this script: sqlite3 data/make_post_sell.sqlite < fix_crypto_payment_statuses.sql
|
|
-- 3. Verify results by checking the status counts above |