paypal #93

Merged
russellballestrini merged 21 commits from feature/Paypal_checkout into master 2025-12-22 17:29:52 -05:00

21 commits

Author SHA1 Message Date
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
0b89ab2bb3 Fix test_cart_checkout_for_shop to match current checkout flow
The checkout POST now returns a 200 OK directly (or with different
redirect count), so update the test to:
1. Use a while loop to follow any number of redirects
2. Update assertion text from "Please enter your payment information."
   to "Please confirm your order." to match current UI text
2025-12-22 15:32:55 -05:00
31592b6923 Add PayPal unit, integration, and sandbox functional tests 2025-12-22 15:21:46 -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
66382c9ca2 Fix PayPal migrations: use proper revision IDs and remove table creation
- Rebased onto master to include grid_lanes_enabled and other changes
- Replaced fake revision IDs (a1b2c3d4...) with proper alembic-generated IDs
- Removed table creation migrations (auto-created)
- Removed obsolete merge migration
- Keep only shop column migration for paypal_client_id, paypal_secret, paypal_enabled
2025-12-22 12:27:17 -05:00
8a3b172c0a contains the class-to-table mappings that SQLAlchemy needs to know which table each model class belongs to. 2025-12-22 12:04:37 -05:00
ae8113b857 Update file development.ini 2025-12-22 12:04:37 -05:00
85c2bb5649 Update 9 files
- /make_post_sell/models/shop.py
- /make_post_sell/views/cart.py
- /make_post_sell/scripts/alembic/versions/a1b2c3d4e5f8_create_paypal_payment_table.py
- /make_post_sell/scripts/alembic/versions/a1b2c3d4e5f7_create_paypal_user_shop_table.py
- /make_post_sell/scripts/alembic/versions/a1b2c3d4e5f6_add_paypal_credentials_to_shop.py
- /make_post_sell/scripts/alembic/versions/1396317d0fc4_merge_paypal_and_default_theme_.py
- /make_post_sell/templates/shop_settings.j2
- /make_post_sell/request_methods.py
- /development.ini
2025-12-22 12:04:37 -05:00
557fdda9bc Update 3 files
- /make_post_sell/models/paypal_payment.py
- /make_post_sell/models/paypal_user_shop.py
- /make_post_sell/models/__init__.py
2025-12-22 12:04:37 -05:00
9eab6e0218 PayPal Saved Payment Methods:
- Add vault parameters to order creation for saving payment methods
  - Extract and store vault.id in PayPalUserShop after successful payment
  - Add "Save PayPal" checkbox to checkout page
  - Show saved status for returning customers
  - Add PayPal management section to billing page
  - Add disconnect PayPal functionality at /billing/disconnect-paypal

  - Refunds are handled externally by shop owners via PayPal dashboard
  - Platform does not track or process refunds
  - Update documentation to reflect external refund handling

  Documentation:

  - Update CHANGES_PAYPAL.md 

  No database migrations required - uses existing PayPalUserShop columns:
  - active_payment_token (stores vault.id)
  - payer_id (stores PayPal payer ID)
  EOF
  )"
2025-12-22 12:04:37 -05:00
22be720c53 - Added /billing/disconnect-paypal route 2025-12-22 12:04:37 -05:00
e8e0e52f40 make_post_sell/templates/cart_checkout.j2
- Added "Save PayPal for faster checkout" checkbox
    - Shows "PayPal saved" status for returning users
    - Sends save_paypal parameter to backend

make_post_sell/templates/billing.j2
    - Added PayPal management section
    - Shows connected status with PayPal logo
    - Added "Disconnect PayPal" button
2025-12-22 12:04:37 -05:00
4a6f7ebb3a make_post_sell/views/paypal.py
- Added vault parameters for saving PayPal payment methods

- Extract and store vault.id after successful payment

- Logs vault status (VAULTED vs APPROVED)

make_post_sell/views/billing.py
    - Added paypal_user_shop to template context
    - Added disconnect_paypal() view function
2025-12-22 12:04:37 -05:00