Commit graph

573 commits

Author SHA1 Message Date
8faec3256c Delete THEME_AUDIT.md 2025-10-04 21:18:41 +00:00
8a014a6e61 Merge branch 'dark-fucking-mode' into 'master'
Implement comprehensive dark mode functionality

See merge request engineering/make-post-sell/make_post_sell!54
2025-10-04 21:09:51 +00:00
045868c3d0 Implement comprehensive dark mode functionality 2025-10-04 21:09:51 +00:00
9cb6ea5fd0 Remove remaining static inline styles from user crypto settings
Convert two remaining style="width: 100%;" declarations to use existing
full-width-input CSS class. This completes the cleanup of all static
inline styles, leaving only 2 dynamic inline styles remaining across
the entire template codebase.

File updated:
- user_crypto_settings.j2: Crypto address and label input fields

Remaining inline styles: 2 (both dynamic/business-critical)
2025-10-04 13:52:40 -04:00
618f7f257b Phase 2: Convert crypto history and invoice inline styles to CSS classes
Completed conversion of static inline styles in crypto_quotes_history.j2 and invoice.j2:

- Added comprehensive CSS classes for crypto history layout, status notices, and invoice components
- Converted 22 inline style instances to semantic CSS classes
- Improved maintainability while preserving all functionality
- Added status color classes for consistent semantic meaning across templates

Templates updated:
- crypto_quotes_history.j2: Payment cards, status notices, help sections
- invoice.j2: Discount sections, payment status indicators, layout components

CSS classes added: crypto-history-container, crypto-payment-card, status-*-notice,
invoice-*-section, status-success/warning/info/error, and utility classes.
2025-10-04 13:46:37 -04:00
252d2d056d Phase 1: Convert static inline styles to CSS classes (40% of remaining styles)
Added CSS classes for static styling patterns:
- .no-bottom-margin, .no-top-margin - Standard margin controls
- .bold-text - Font weight styling
- .inline-label - Display inline for labels (reusing existing class)
- .hidden-form - Display none for forms
- .subtitle-text - Product/content subtitle styling
- .stripe-* classes - Stripe component styling
- .comment-* classes - Comment system styling
- .coupon-* classes - Coupon display styling
- .original-comment-box - Comment editing box styling
- .table-* classes - Table layout controls
- .sold-out-button - Disabled button styling

Updated 16 template files to use CSS classes instead of inline styles:
- snippets/search.j2, snippets/stripe.j2, snippets/comments.j2
- product.j2, content.j2, product_edit.j2
- user_settings.j2, shop_location_form.j2
- coupons.j2, coupon.j2, update-card.j2
- base.j2, shop_products.j2
- comments/reply_comment.j2, comments/edit_comment.j2

Converted approximately 40% of remaining inline styles targeting:
- Static margins and spacing
- Font weights and sizing
- Display properties
- Form visibility
- Button states
- Table layouts

Remaining inline styles are dynamic/functional and require Phase 2 implementation.
2025-10-04 13:30:50 -04:00
10e0e83adf Replace inline styles with CSS classes across template files
- Add comprehensive CSS classes to common.css for status messages, layouts, and styling
- Remove all inline styles from shop_settings.j2 (16 instances)
- Remove all inline styles from crypto_checkout.j2 (25 instances)
- Remove all inline styles from cart_checkout.j2 (18 instances)
- Remove all inline styles from cart.j2 (16 instances)

New CSS classes added:
- Status indicators: .status-message, .success-indicator, .error-indicator
- Layout helpers: .inline-label, .full-width-input, .disabled-input
- Crypto checkout: .crypto-logo, .payment-grid, .payment-buttons, .status-box
- Cart styles: .cart-float-right, .cart-shop-name, .cart-total-amount
- Notice boxes: .success-notice, .warning-notice, .warning-banner

This improves maintainability, consistency, and enables better theming support.
All conditional styling preserved using dynamic CSS class application.
2025-10-04 13:20:45 -04:00
6b222bbc6b modified: .gitignore 2025-10-04 13:06:28 -04:00
a3826d15c8 modified: setup.py 2025-10-04 13:05:01 -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
fde7e2b2d0 Fix CSS image sizing specificity issue
Change global img rule from width: 100% to max-width: 100% to allow
more specific image sizing rules to work properly. This prevents the
global rule from overriding thumbnail sizes, icons, and other specific
image dimensions while maintaining responsive behavior.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-04 12:49:37 -04:00
baa8dffc02 Enhance payment settings UX with consistent styling and persistent state
- Add new payment-toggle-button CSS class derived from comment button styles
- Apply consistent styling to all Stripe, Monero, and Dogecoin disable/re-enable buttons
- Consolidate crypto wallet disclaimers into single always-visible section
- Update help text to clarify re-enabling payments allows address updates
- Implement localStorage persistence for both crypto and Stripe toggle states
- Ensure graceful degradation for non-JavaScript users
- Remove redundant disclaimer text from individual currency forms

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-04 12:37:32 -04:00
fd3ffc26f0 Improve shop settings crypto wallet and Stripe configuration UX
- Move crypto wallet verification disclaimer to top of section for better visibility
- Remove redundant Dogecoin address display message
- Ensure crypto wallet checkbox is always unchecked on page refresh
- Update disclaimer to use plural form for multiple wallet addresses
- Fix checkbox label alignment to display inline
- Update Stripe toggle label to be more descriptive
- Add JavaScript progressive enhancement for Stripe API key fields
- Ensure both crypto and Stripe forms are hidden by default with graceful degradation

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-04 12:26:24 -04:00
c218ec7073 Fix mobile layout ordering for product and content pages
- **Mobile Layout Fix**: Restructured product/content templates to use direct grid children
- **Grid Areas**: Added proper grid-template-areas for desktop layout
- **Mobile Ordering**: Purchase/download buttons now appear after images on mobile
- **Template Structure**: Split sections into product-images, product-right, product-description, product-comments
- **CSS Grid**: Unified layout system using order properties for mobile and grid areas for desktop
- **UX Improvement**: Logical mobile flow - images, purchase, description, comments
2025-10-04 12:02:04 -04:00
6745824fc3 Improve comment system UX and product page layout
- **Comment Form Styling**: Unified button styling across reply/edit forms with new CSS classes
- **Comment Actions**: Improved spacing, consistent button styling, and proper grid layout
- **Comment Navigation**: Added anchor redirects for delete/approve/unapprove actions
- **Product Layout**: Enhanced desktop two-column grid (2fr 1fr) with better proportions
- **Mobile Optimization**: Fixed button width and section ordering for mobile view
- **Template Consolidation**: Moved comments and description into main grid layout
- **Auto-refresh Removal**: Removed disruptive timers from content pages
2025-10-04 11:45:35 -04:00
e67178abdb Fix comment deletion display and improve comment spacing
## Bug Fixes:
- **Comment Deletion**: Fixed deleted comments still showing in frontend
  - Added `enabled_children` property to Comment model to filter disabled comments
  - Updated template to use `enabled_children` instead of `children` for replies
  - Ensures soft-deleted comments (and their replies) properly disappear from view

## UI Improvements:
- **Comment Spacing**: Added 20px margin-bottom to all comments for better readability
- **Form Styling**: Removed unwanted `mps-submit` class from "Post Comment" button
  - Eliminates `float: right` styling that was misaligning the button

## Technical Details:
- Root comments already filtered by database query (`Comment.disabled == False`)
- Child comments now properly filtered through `enabled_children` property
- Comment deletion uses soft delete (`comment.disable()`) preserving data integrity
- Black code formatting applied to maintain style consistency

The comment system now properly handles deletions and provides better visual hierarchy.
2025-10-04 10:55:54 -04:00
619aca286a Implement Stripe disable/enable functionality and improve checkout UX
## Major Features Added:
- **Stripe Disable/Enable**: Added per-shop Stripe enable/disable functionality similar to crypto currencies
- **Shop-themed Link Styling**: Implemented comprehensive link theming system using CSS classes
- **Responsive Checkout Layout**: Simplified checkout page to always use single-column responsive design

## Database Changes:
- Added `stripe_enabled` column to `mps_shop` table (defaults to enabled)
- Created Alembic migration with proper SQLite `server_default="1"` handling

## Template Updates:
- **Shop Settings**: Added Stripe disable/re-enable buttons with proper conditional logic
- **Checkout Page**: Simplified to single-column responsive layout (640px max, mobile-friendly)
- **Link Theming**: Added `shop-theme-link-color` class to all product/shop links across templates
- **Button Consistency**: Standardized all "Update" buttons to "Save" in shop settings

## Code Architecture:
- **Request Methods**: Added `request.stripe_globally_enabled` for clean separation of global vs per-shop settings
- **DRY Refactor**: Made `request.stripe_enabled` use `request.stripe_globally_enabled` to eliminate code duplication
- **CSS Grid Only**: Removed flexbox usage, enforced CSS Grid for all layouts per project standards

## Bug Fixes:
- Fixed "refund pending" messages showing incorrectly for `underpaid-not-refunded` status
- Fixed economically unviable refund emails showing incorrect "no fees deducted" messages
- Fixed checkout page horizontal scrolling issues on mobile/desktop
- Fixed CSS specificity issues with global link styles overriding shop themes

## Documentation:
- **CLAUDE.md**: Added comprehensive database migration guide with SQLite best practices
- **CSS Requirements**: Documented CSS Grid-only layout policy
- **Migration Examples**: Added server_default examples for SQLite column additions

## Templates Modified:
- cart.j2, cart_checkout.j2, shop_settings.j2, crypto_quotes_history.j2
- All template files updated with consistent shop-theme-link-color classes
- Ribbon snippet updated with proper CSS class definitions

This update provides shop owners full control over their Stripe payment acceptance
while maintaining backwards compatibility and improving overall user experience.
2025-10-04 10:41:20 -04:00
7610632f41 Update setup.py 2025-10-04 11:01:26 +00:00
8038f8cf08 Fix incorrect refund messaging for economically unviable payments
- Fix history page showing "refund pending" for underpaid-not-refunded status
- Add specific condition for -not-refunded statuses before -refunded condition
- Fix email templates to not show fee messages for no-refund cases
- Economically unviable refunds now show payment details only, not refund details
- Remove misleading "no fees deducted" message from no-refund scenarios
2025-10-03 18:48:29 -04:00
801cd7e595 Add dedicated CSS class for Continue shopping button
- Created .cart-continue-shopping-button class with blue styling
- Replaced product-edit-button class with cart-continue-shopping-button
- Button now has consistent styling across desktop and mobile
2025-10-03 18:25:32 -04:00
973f82ba59 Merge branch 'fix/localhost-domain-in-refund-emails' into 'master'
Fix localhost domain issue in economically unviable refund emails

See merge request engineering/make-post-sell/make_post_sell!53
2025-10-03 21:57:12 +00:00
94c6b65cd2 Fix localhost domain issue in economically unviable refund emails
Updated economically unviable refund email notifications to use
create_shop_context_request() instead of passing env_request directly
or creating DummyRequest objects. This ensures emails are sent from
the proper shop domain instead of localhost.

Fixed in:
- Expired payment processing (line ~2147)
- Underpayment processing (line ~2911)
- Passive monitoring refund retries (line ~3290)

Note: Duplicate payment processing was already correct.
2025-10-03 17:51:43 -04:00
b0dc15b06a Merge branch 'feature/economically-unviable-refund-emails' into 'master'
Add email notifications for economically unviable refunds

See merge request engineering/make-post-sell/make_post_sell!52
2025-10-03 20:54:16 +00:00
7ff744e0df Remove all 'contact support' references from refund emails
Removed support contact messages from:
- No refund address scenario emails
- Both text and HTML email templates

This is consistent with the policy that no support is offered for refunds.
2025-10-03 16:46:09 -04:00
125d8726bb Remove support contact message from economically unviable refund emails
The message 'Please contact support if you have questions' has been
removed since no support is offered for refunds.
2025-10-03 16:44:46 -04:00
59963a62cd Add email notifications for economically unviable refunds
Enhanced the refund email system to properly notify users when their
cryptocurrency refunds cannot be processed due to being economically
unviable (too small to cover network transaction fees).

Changes:
- Updated send_refund_email() to differentiate between "no refund address"
  and "economically unviable" scenarios with appropriate messaging
- Added email notifications in crypto watcher for all NOT_REFUNDED status
  transitions due to economic viability:
  * Duplicate payment processing (line ~1770)
  * Expired payment processing (line ~2145)
  * Underpayment processing (line ~2905)
  * Passive monitoring refund retries (line ~3280)
- Added proper error handling for email sending to prevent disruption
- All economically unviable refund tests pass with no regressions

Users now receive clear explanations when refunds are too small to send
rather than being left without notification.
2025-10-03 16:40:41 -04:00
cb317b1015 Merge branch 'feature/doge-doom-vulnerability' into 'master'
Document DOGE DOOM vulnerability discovered by walkeruin

See merge request engineering/make-post-sell/make_post_sell!50
2025-10-03 20:04:22 +00:00
e944ab31d6 Document DOGE DOOM vulnerability discovered by walkeruin 2025-10-03 20:04:22 +00:00
28952a05a3 Update setup.py 2025-10-03 16:07:01 +00:00
11aad019e0 Update setup.py 2025-10-03 16:04:18 +00:00
53ab104f95 Update README.rst 2025-10-03 16:03:47 +00:00
b82c6269bc Merge branch 'feature/multi-output-refunds' into 'master'
Add comprehensive tests for multi-output transaction tracking defect fix

See merge request engineering/make-post-sell/make_post_sell!49
2025-10-03 15:44:59 +00:00
819c6debf2 Add comprehensive tests for multi-output transaction tracking defect fix 2025-10-03 15:44:59 +00:00
ef7b520245 Update setup.py 2025-10-03 15:17:18 +00:00
5fb40ba3d2 Delete q 2025-10-03 15:16:05 +00:00
fd267aec0f Merge branch 'feature/multi-output-refunds' into 'master'
Fix Dogecoin & Monero multi-output refunds with proper fee handling

See merge request engineering/make-post-sell/make_post_sell!48
2025-10-03 15:15:28 +00:00
9432375bcb Add shop ribbon color styling to links in product and content descriptions
- Modify protect_links function to apply shop theme_link_color to all links
- Add custom CSS validation using regex patterns for security
- Support hex colors (#fff, #ffffff), rgb(), rgba(), hsl(), hsla(), and named colors
- Reject malicious inputs like javascript: schemes
- Add style attribute to allowed attributes for anchor tags
- Pass shop reference through cleaner object for color access
2025-10-03 09:46:20 -04:00
2657f982ec Fix crypto_watcher tests after sendtoaddress changes
- Update DOGE sweep tests to expect _call method with subtractfeefromamount
- Fix refund tests to properly mock sendmany method calls
- Update sweep_restocking_fee to use consistent _call interface
- Adjust tests to account for estimatesmartfee calls before sweeps
- Update XMR refund tests to match actual implementation flow

All 101 crypto_watcher tests now pass successfully.
2025-10-02 19:55:27 -04:00
24bd698ecd Fix DOGE sweep insufficient funds error using subtractfeefromamount
- Use subtractfeefromamount=True parameter in sendtoaddress for DOGE sweeps
- This allows Dogecoin to automatically deduct network fee from the sweep amount
- Resolves 500 errors when trying to sweep the exact wallet balance
- Regular payment sweeps remain single-output transactions (no multi-output needed)
2025-10-02 19:26:53 -04:00
f545e0e3e4 modified: make_post_sell/lib/crypto_watcher/__init__.py
modified:   make_post_sell/lib/crypto_watcher/crypto_clients.py
	modified:   make_post_sell/models/invoice.py
	modified:   make_post_sell/scripts/alembic/versions/0915b3ff883d_add_swept_confirmations_to_track_sweep_.py
	modified:   make_post_sell/tests/test_crypto_watcher.py
	modified:   make_post_sell/tests/test_multi_output_refunds.py
	modified:   make_post_sell/views/crypto.py
2025-10-02 19:22:38 -04:00
d90f41c5d9 Fix sweep confirmation monitoring to use coin-specific thresholds
- Query DOGE sweeps only if < 2 confirmations
- Query XMR sweeps only if < 10 confirmations
- Set model default to 0 for new sweeps
- Migration sets server_default to 10 for existing records
- This prevents monitoring already-confirmed legacy sweeps
2025-10-02 19:15:09 -04:00
a74bf72e6a Add sweep transaction confirmation monitoring
- Added global OUTBOUND_CONFIRMATIONS_REQUIRED config (2 for DOGE, 10 for XMR)
- Added swept_confirmations field to CryptoPayment model
- Modified auto-sweep functions to track confirmations instead of immediately transitioning to confirmed-complete
- Added process_sweep_confirmations() to monitor sweep transactions
- Standardized confirmation requirements for both sweeps and refunds
- Created alembic migration 0915b3ff883d for swept_confirmations field

This ensures we track when funds actually leave the hot wallet and provides consistent monitoring for all outbound transactions.
2025-10-02 19:04:13 -04:00
dc092d920d Fix redirect after purchase to check for digital products properly
- Add check for is_physical=False in addition to has_product_file
- Add detailed logging to diagnose redirect issues
- Physical products should always redirect to invoice
- Digital products without files should redirect to invoice
- Only digital products with files should redirect to product page
2025-10-02 16:42:44 -04:00
3289702d50 Move Dogecoin fee buffer to global constant for easier ops access
- DOGE_REFUND_FEE_BUFFER now defined at top of file (line 22)
- Clear comments explaining when/why to adjust it
- Error messages point directly to the constant
- Still overridable via environment variable
2025-10-02 16:35:24 -04:00
8836fb6333 Add better fee error handling and monitoring
- Log clear error messages when fee buffer is too low
- Show exact shortfall amount and required action
- Add DOGE_REFUND_FEE_BUFFER environment variable for dynamic adjustment
- Log actual fee buffer used on successful refunds
- Add helpful comment in vars.sh about the fee buffer setting

Now when watching crypto-watcher logs, admins will see:
- 'INSUFFICIENT FUNDS - Fee estimate too low\!'
- Current buffer, shortfall amount, and line number to fix
- Success messages show actual vs estimated fee usage

This makes it much easier to adjust the fee buffer without diving into code.
2025-10-02 16:34:16 -04:00
d4a239d748 Clean up multi-output refund code
- Reduce fee buffer from 0.01 to 0.005 DOGE (actual fee was 0.0026)
- Remove excessive logging throughout refund process
- Simplify sendmany retry logic - just try funded account then default
- Remove unnecessary balance checks and debug logging
- Fix test mocks to use sendmany instead of _call

This reduces the dust left in temporary wallets from ~0.011 to ~0.005 DOGE
2025-10-02 16:27:33 -04:00
d2d09e8851 Fix Dogecoin multi-output refunds with proper fee handling
- Add payment amount to shop output for overpayment refunds
- Both XMR and DOGE now send payment + restocking fee to shop
- Fix insufficient funds error by using conservative fee buffer (0.01 DOGE)
- Round outputs down to 3 decimal places to avoid precision issues
- Update sendmany to try actual account first (where funds are located)
- Add better error handling for different account formats
- Fix fee calculation to properly account for Dogecoin's fee-on-top model

The issue was that sendmany adds network fee on top of outputs, and we
were trying to send exactly the wallet balance, leaving no room for fees.
Now we reserve 0.01 DOGE for fees and round conservatively.
2025-10-02 16:19:23 -04:00
958a003f35 modified: CLAUDE.md
modified:   make_post_sell/lib/crypto_watcher/__init__.py
	modified:   make_post_sell/tests/test_double_spend_integration.py
2025-10-01 19:25:25 -04: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
8d382c7f31 modified: make_post_sell/lib/crypto_watcher/__init__.py
modified:   make_post_sell/models/crypto_payment.py
	modified:   make_post_sell/request_methods.py
	modified:   make_post_sell/tests/test_crypto_watcher.py
2025-10-01 15:55:34 -04:00