worldcubeassociation.org
worldcubeassociation.org copied to clipboard
Add sandbox Paypal Integration
This issue tracks the steps required for having a working PayPal Integration in a test environment. Included in the scope of this is a refactor of the existing Stripe/payments logic, so that it becomes much easier to add more payment providers in the future.
Overall Steps
- [x] Add ability for organizers to link paypal accounts
- [x] Refactor Stripe to use the same pattern as paypal account linking
- [ ] Refactor StripeTransaction to StripeRecord
- [ ] Refactor StripePaymentIntent to be a generic column with a polymorphic association to a Stripe/Paypal Record object
- [ ] Process Paypal payment confirmations via a generic "payments engine"
- [ ] Add refund capability to payments engine
- [ ] Add any other feature requirements to payments engine
- [ ] Migrate Stripe to use the generic "payments engine" (make sure we have good test coverage on payment functionality by this point)
- [ ] Various polish/cleanup PR's (see backlog)
Backlog
- [ ] Refactor stripe connection stuff into Stripe interface
- [ ] add a validation preventing the organizer from linking multiple integrations
- [x] Add logic in paypal_interface for appropriately converting amounts based on currency code
- [ ] add API endpoints for initiating paypal payments
- [ ] Get paypal payment form working
- [x] Split Stripe payment form into a separate component
- [ ] change Registration Service to use new /payment/init
- [ ] Refactor where
PaypalRecordobjects are created, and how they have payloads populated (should they be created inPaypalInterface? It is more appropriate for them to be created in the controller) - [ ] Address all TODOs and notes
Polish
- [ ] Rename
StripeRecord:api_typetoStripeRecord:record_type - [ ] Store the user_id of the user who connected the account on the integration
- [ ] change "Payment Setup" icon to be a generic cash sign, not Stripe
- [ ] Integrate Stripe and Paypal setup in payment_setup page (ie change text and button positioning to be more intuitive)
- [ ] Transition payment_setup to React?
- [x] Create separate database fields for paypal-specific data
- [ ] Add payment webhook as backup for return_url being interrupted
- [ ] Add onboarding webbook as backup for return_url being interrupted
- [ ] Is there a way that we can allow people with non-supported currencies to use paypal? (eg, converting any non-supported currencies to USD when creating the order)
- [ ] Paypal form error handling
- [ ] Monolith fails to make connection to paypal
- [ ] Paypal SDK load fails for some reason (probably incorrect currency)
- [ ] Prevent organizer from adding more than 1 payment integration (ie, can't have Stripe and Paypal connected at the same time)
Paypal payment form polish
- [ ] Don't submit the form on Enter
- [ ] Does it even need to be a form for Paypal? Maybe we should remove the form components and display the data differently
- [ ] Uncheck the "Donation" tickbox on page reload