Commit graph

45 commits

Author SHA1 Message Date
42241d79b7 Remove jQuery dependency, convert to vanilla JavaScript 2025-12-22 18:34:35 -05:00
4bc0c67e3a Add JavaScript documentation 2025-12-22 18:29:10 -05:00
4210bc1421 Add Adyen payment integration
- Add Adyen API credentials to Shop model (api_key, merchant_account,
  client_key, hmac_key, enabled)
- Add adyen_psp_reference to Invoice model for payment tracking
- Add Adyen checkout views (create-session, complete-checkout)
- Add Adyen webhook handler with HMAC verification
- Add shop settings UI for Adyen credentials
- Add request.adyen_enabled and request.adyen_globally_enabled
- Update ADYEN.md with verification details and implementation status
- Add 21 tests (8 unit, 5 integration, 5 functional + 3 invoice)
2025-12-22 17:16:54 -05:00
a2e2092a31 Add privacy warnings to PayPal docs, create Adyen integration doc
PayPal:
- Document invasive KYC requirements (face scanning, government ID)
- Note that crypto is the privacy-preserving alternative

Adyen:
- Document integration approach (similar to Stripe)
- Include Python library usage, webhooks, credentials needed
- Status: not yet implemented
2025-12-22 16:11:54 -05:00
ac2f586453 Add Stripe payment tracking and webhook resilience
- Add stripe_payment_intent_id and stripe_charge_id columns to Invoice
- Store payment references during checkout for traceability
- Use idempotency key to prevent duplicate charges on retry
- Add Stripe webhook handler for payment_intent.succeeded, payment_failed,
  charge.refunded, and charge.dispute.created events
- Consolidate PayPal webhooks into webhooks.py
- Add stripe.webhook_secret configuration for signature verification

Tests: 8 unit, 5 integration, 7 functional tests for Stripe functionality
2025-12-22 16:03:20 -05:00
979c5117df Merge PayPal views into cart.py, delete paypal.py 2025-12-22 14:29:00 -05:00
8121772233 Rename and simplify PayPal docs 2025-12-22 14:21:24 -05:00
30c1e29aa8 Mark PayPal integration as released Dec 22, 2025 2:30 PM 2025-12-22 14:20:20 -05:00
261ad97c7b Remove PayPalPayment table, use Invoice columns instead
- Add paypal_order_id and paypal_capture_id columns to Invoice model
- Update migration to add columns to mps_invoice instead of creating separate table
- Remove PayPalPayment model (simpler architecture matching Stripe)
- Update paypal.py to store PayPal info directly on Invoice
- Update paypal_webhooks.py to query Invoice by paypal_order_id
- Update Invoice.payment_method property to detect PayPal payments
2025-12-22 12:51:07 -05:00
b5a32c797e Clean up PayPal docs: remove references to non-existent files 2025-12-22 12:43:35 -05:00
09e3873028 Update docs: single migration, tables auto-created 2025-12-22 12:41:45 -05:00
b43850d0c7 Add docs directory, CHANGELOG.rst, update README
- Create docs/ directory and move CHANGES_PAYPAL.md into it
- Add CHANGELOG.rst with unreleased section for PayPal integration
- Update README.rst to mention PayPal alongside other payment methods
2025-12-22 12:36:28 -05:00
f5d68ba267 Fix DOGE fee calculation bug and improve UI consistency
- Fix negative DOGE processing fees from estimatesmartfee RPC issues
- Add abs() protection for both DOGE and Monero fee calculations
- Reduce transaction size estimate from 0.25KB to 0.15KB (more realistic)
- Change fee multiplier from 2x to 1.5x (less excessive)
- Set reasonable fallback fee of 0.5 DOGE when RPC fails
- Add negative feerate detection with proper error handling
- Fix crypto payment status color mapping (case insensitive lookup)
- Add missing status mappings for confirmed-overpay-complete and doublepay-refund-complete
- Improve comment system UI with dark mode styling and better layout
- Add CSS preloader to prevent trans-background image flashing
- Enhance user settings page with better button organization
- Remove "View Quote" button for cancelled crypto quotes
- Fix comment form styling and authentication flow
2025-10-06 09:36:02 -04:00
3fedfeb849 Update state machine documentation to use dash-separated naming
- Convert all state names from underscore to dash format in markdown documentation
- Ensures consistency across all documentation formats (dot, svg, markdown)
- All payment states now use dashes: confirmed-complete, underpaid-refunded, etc.
- Maintains consistency with the source dot file which is the canonical reference

This completes the documentation naming convention standardization.
2025-10-04 13:02:07 -04:00
e944ab31d6 Document DOGE DOOM vulnerability discovered by walkeruin 2025-10-03 20:04:22 +00:00
a9b427e608 modified: docs/crypto-payments-state-machine.md
modified:   docs/state-machine.dot
	modified:   make_post_sell/lib/crypto_watcher/__init__.py
	modified:   make_post_sell/models/crypto_payment.py
	modified:   make_post_sell/tests/test_crypto_watcher.py
	modified:   make_post_sell/tests/test_double_spend_integration.py
	modified:   make_post_sell/tests/test_double_spend_protection.py
	modified:   make_post_sell/tests/test_invoice_deletion.py
	modified:   make_post_sell/tests/test_models.py
2025-10-01 19:02:39 -04:00
2f5a1c0c34 Fix payment UI documentation - buttons are REMOVED not disabled
Payment buttons and QR codes are completely removed from the page
once payment is received, not just disabled
2025-09-30 22:54:22 -04:00
078fe1fe99 Document actual payment UI behavior in CRYPTO_PROBLEMS.rst
- Add section explaining real-time status updates on quote page
- Document automatic redirects to invoice/download upon confirmation
- Clarify that payment buttons are disabled once payment received
- Note that confirmations can be as fast as 2 for digital goods
2025-09-30 22:53:45 -04:00
6157cb415f Remove incorrect UI status check from remaining solutions
The quote page already disables payment buttons and updates status
from pending to received when payment is detected, preventing duplicates
2025-09-30 22:50:30 -04:00
3a205c99a0 Update CRYPTO_PROBLEMS.rst with MONERO DOOM learnings
- Document resolved multiple duplicate payment scenario
- Explain min(balance, expected_fee) restocking fee solution
- Clarify auto-sweep uses exact amounts, not sweep_all
- Add details about fund theft prevention mechanisms
2025-09-30 22:47:45 -04:00
edb236be60 Remove redundant Dogecoin configuration examples
- Remove duplicate dogecoin.conf examples from Advanced Configuration
- Simplify to reference make dogecoin-config command
- Keep only essential full node vs pruned mode trade-offs
2025-09-30 22:43:58 -04:00
9d06903633 Remove database implementation details from crypto docs
- Remove incorrect SQL index examples from DOGECOIN.md and MONERO.rst
- Simplify Dogecoin node security section to reference make command
- Stop leaking database schema details in user-facing documentation
2025-09-30 22:40:10 -04:00
1e988b8553 Update Dogecoin blockchain size to reflect 2025 reality
- Change from 50GB to 200GB+ for full blockchain size
- Update space savings calculation from 96% to 99%
- Based on growth from 110GB in early 2024 to likely 200GB+ in 2025
2025-09-30 22:34:33 -04:00
92ffb0630b Fix Dogecoin prune size to match actual configuration
- Update prune size from 2GB to 2.2GB throughout docs
- Change prune=2000 to prune=2200 to match make dogecoin-config
- Update wallet name to mps_wallet to match actual configuration
2025-09-30 22:32:11 -04:00
18a9dfae4c Simplify Monero recovery procedures and remove automated health checks
- Remove 'Automated Health Checks' section - redundant with make commands
- Simplify recovery procedures to match Dogecoin documentation style
- Remove bash script examples and implementation details
- Keep focus on essential backup/recovery information
2025-09-30 22:28:44 -04:00
dc01348782 Remove address validation code from documentation
- Replace Python validation functions with simple descriptions
- Keep validation rules (D prefix, 34 chars for DOGE; 4 prefix, 95/106 chars for XMR)
- Documentation should describe what, not show implementation how
2025-09-30 22:22:32 -04:00
7c9796c56c Simplify Dogecoin setup to use Makefile targets
- Replace manual installation steps with make install-dogecoin
- Replace manual configuration with make dogecoin-config
- Remove raw dogecoin-cli commands in favor of make targets
- Keep documentation focused on what users need to do, not implementation details
2025-09-30 22:18:11 -04:00
cb0676e701 Remove broken multi-node setup from Monero documentation
- Multi-node setups would cause account index mismatches
- Monero wallets can't be sharded or load balanced
- Replace with honest scaling limitations and realistic options
- Single wallet file is a fundamental architectural constraint
2025-09-30 22:14:39 -04:00
51ec71a9f9 Update crypto documentation with accurate configuration and remove tutorials
- Document actual resource requirements from production systems
- Fix fee documentation: fee buffers are for quotes, not wallet reserves
- Clarify perfect accounting to quote amounts in atomic units
- Remove generic curl/API tutorials, keep Make commands
- Add dust prevention benefit of exact amount sweeping
- Update Makefile targets to match what actually exists
2025-09-30 22:03:08 -04:00
7c8a0065cf modified: docs/CRYPTO.rst
new file:   docs/CRYPTO_PERFORMANCE.rst
	modified:   docs/DOGECOIN.md
	modified:   docs/MONERO.rst
2025-09-30 21:39:35 -04:00
04583ace53 Clean up Makefile sweep commands and documentation
- Remove error messages from sweep/sweep-check Makefile targets
- Keep commands functional for developers/admins in local environments
- Simplify documentation to focus on automatic sweeping behavior
- Maintain separation between end-user docs and dev tools
2025-09-30 20:54:50 -04:00
ed98674c48 Remove untested sweep_to_cold script and references
- Delete make_post_sell/lib/sweep_to_cold.py (untested, risky for production)
- Remove sweep_to_cold console script entry from setup.py
- Update Makefile to deprecate sweep/sweep-check, recommend tested alternatives
- Update CRYPTO.rst documentation to promote sweep-all and sweep-all-doge
- Reduce technical debt by eliminating dangerous untested code path
- Users should use properly tested sweep-all/sweep-all-doge commands instead
2025-09-30 20:54:50 -04:00
f2227199c9 Delete MONERO_DEFECTS.rst 2025-10-01 00:41:12 +00:00
86fdab0f3a Delete CRYPTO_WATCHER_FLOW.md 2025-10-01 00:40:29 +00:00
6ceb9375de modified: Makefile
new file:   docs/state-machine.dot
	new file:   docs/state-machine.dot.svg
	renamed:    state-machine.svg -> docs/state-machine.svg
2025-09-30 15:43:54 -04:00
0b5554e431 modified: docs/crypto-payments-state-machine.md
modified:   state-machine.svg
2025-09-30 14:46:47 -04:00
c7caae8d4a Fix crypto payment state machine logic and naming consistency
Major fixes:
1. Remove invalid received→expired transition
   - Payments that reach 'received' state cannot expire
   - Only pending payments can expire
   - Updated VALID_TRANSITIONS and tests accordingly

2. Rename STATUS_DOUBLEPAY_REFUND to STATUS_DOUBLEPAY_REFUNDED
   - Maintains consistency with all other past-tense status names
   - Updated all references across codebase and tests

3. Add INITIAL_WAITING_STATUSES semantic group
   - Groups states that are entry points: pending, latepay_refunded, doublepay_refunded
   - These states don't transition from 'received' - they represent initial states
   - Added is_initial_waiting_state() helper method

4. Update semantic groups
   - Removed latepay_refunded and doublepay_refunded from FAILED_PAYMENT_STATUSES
   - These are now in INITIAL_WAITING_STATUSES as they represent entry points

5. Fix mermaid diagram label
   - confirmed_overpay_not_refunded now correctly labeled as "Terminal Success (Not Refunded)"
   - Remove invalid received→expired transition from documentation

This improves the logical consistency of the state machine and aligns
the naming conventions across all status constants.
2025-09-30 14:34:11 -04:00
5c67b9ca4c Fix all crypto payment test failures and status constant issues
- 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.
2025-09-30 13:56:42 -04:00
923bd873f2 Add comprehensive crypto payment state transition validation
* Implement complete state machine with 17 test scenarios
* Add priority-based processing order validation
* Include property-based testing for state transitions
* Add graph analysis for state machine integrity
* Validate all payment lifecycle paths
* Ensure robust error handling and logging
* Remove temporary debug files and consolidate test structure
2025-09-30 11:26:44 -04:00
c1a936539e deleted: debug_auth_headers.py
deleted:    debug_digest_details.py
	deleted:    debug_monero_auth.py
	renamed:    CRYPTO_WATCHER_FLOW.md -> docs/CRYPTO_WATCHER_FLOW.md
	deleted:    test_digest_auth_local.py
	deleted:    test_dogecoin_client.py
	deleted:    test_monero_auth.py
	deleted:    test_monero_client.py
	deleted:    test_requests_lib.py
	deleted:    test_urllib_variants.py
2025-09-28 15:26:42 -04:00
c3c05796da Remove pooled sweep behavior and implement individual payment sweeping
- Remove pooled_sweep logic from both Monero and Dogecoin sweep functions
- Each payment now swept individually for better accounting and audit trail
- Insufficient balance now returns False to retry later instead of fake pooled_sweep
- Update all tests to expect new behavior (False for insufficient balance)
- Update documentation to reflect 1:1 payment-to-sweep mapping
- Add link to refund address configuration in crypto checkout template
- All crypto watcher tests now passing with new individual sweep logic
2025-09-24 16:03:50 -04:00
e4990a5462 Document Monero RPC get_transfers unlocked field defect
- Add comprehensive documentation of RPC inconsistency
- Include symptoms, impact, workarounds, and references
- Establishes framework for documenting future Monero RPC issues
2025-09-24 15:03:31 -04:00
c4d9192540 Improve crypto payment handling and out-of-stock refunds
- Add proper inventory checking before crypto payment completion
- Implement sequential (FIFO) crypto payment processing to prevent race conditions
- Add comprehensive out-of-stock refund handling with two statuses:
  - STATUS_OUT_OF_STOCK_REFUNDED: Full refund to customer (no restocking fee)
  - STATUS_OUT_OF_STOCK_NO_REFUND: Sweep to shop when no refund address
- Use sweep_all with subaddr_indices for Monero to ensure complete fund recovery
- Use sendtoaddress with subtractfeefromamount for Dogecoin fee handling
- Add refund tracking fields (refund_reason, refund_tx_hash, refund_amount)
- Update MONERO.rst with subaddress isolation and refund processing documentation
- Ensure action buttons are removed for non-pending crypto quotes to prevent double payments
2025-09-24 09:35:07 -04:00
b2a47f6789 Move crypto documentation to docs directory
- Move CRYPTO.rst to docs/CRYPTO.rst
- Move CRYPTO_PROBLEMS.rst to docs/CRYPTO_PROBLEMS.rst

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-23 13:21:15 -04:00
68d4ccfc25 Dogecoin payment support 2025-09-23 11:17:05 +00:00