-
Notifications
You must be signed in to change notification settings - Fork 10
T2853 recurring payment methods integration postfinance #243
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 14.0-MyCompassion2.0
Are you sure you want to change the base?
T2853 recurring payment methods integration postfinance #243
Conversation
…r a contract and to update differents groups of payment methods
… of payment methods
Summary of ChangesHello @SamBachmann, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the MyCompassion 2.0 portal by introducing a robust system for managing recurring payment methods. It provides users with the ability to securely add new payment methods, such as credit/debit cards via PostFinance Checkout, and to easily change or update existing ones for their sponsorships. The changes involve a clear separation of concerns between generic and specific payment logic, alongside a revamped user interface for a more intuitive experience in handling recurring donations. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
Summary of ChangesHello @SamBachmann, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request completes the integration of recurring payment methods for the MyCompassion 2.0 portal, focusing on secure tokenization and automated billing. It introduces a robust architectural separation between generic and region-specific payment logic, primarily implementing PostFinance Checkout. Users can now manage their payment methods through a redesigned and interactive interface, improving the overall sponsorship experience. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request introduces a significant and well-architected feature for managing recurring payment methods with PostFinance. The separation of concerns, use of modern Odoo frontend patterns for AJAX updates, and robust backend logic are commendable. My review focuses on removing debug artifacts that pose a security risk in a production environment, along with minor suggestions to improve code style, consistency, and maintainability. Overall, this is a solid implementation.
|
/gemini review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request introduces significant enhancements to the 'My Donations' portal page, primarily focusing on managing payment methods for sponsorships. Key changes include adding new UI components for payment method selection and management, such as modals for updating, changing, and adding payment methods. The backend now supports grouping sponsorships by payment method, fetching payment method details, and new API endpoints for modifying contract groups and individual contracts' payment methods. It also integrates with external payment providers like PostFinance via iframes for adding new online payment methods. Additionally, the definition of 'active' sponsorships has been expanded to include the 'mandate' state across various models and controllers. Review comments highlight potential N+1 query issues in fetching payment icons and payment modes, suggest refining broad exception handling, and recommend improving the user experience by using the existing toast service instead of native alerts and avoiding full page reloads as a primary UI update mechanism. There's also a suggestion to dynamically fetch manual payment options instead of hardcoding them in templates.
| <select class="form-control" name="method_type" id="new_method_type"> | ||
| <option value="" disabled="disabled" selected="selected"> | ||
| Select a method... | ||
| </option> | ||
| <option value="permanent_order">Permanent Order</option> | ||
| <option value="bvr">BVR</option> | ||
| </select> | ||
| </t> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The options for manual payment methods ("Permanent Order" and "BVR") are hardcoded directly in the QWeb template. If the available manual payment methods change or new ones are introduced in the future, this template will require manual modification.
For better maintainability and flexibility, consider fetching these options dynamically from the backend. This would allow administrators to manage payment methods without code changes.
…the partner Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
|
/gemini review |
Related PR: T2853
Description:
This PR implements the secure addition and tokenization of modern payment methods (Credit/Debit cards, etc.) for recurring sponsorships on the MyCompassion 2.0 portal. It finalizes the work started in T2534 by connecting the frontend payment selection to the backend payment acquirer logic.
Key Changes:
Architectural Separation:
Compassion-website/my_compassion(Generic): Implements the generic flows for adding payment methods and handling user feedback (loading states, success/error messages), ensuring no region-specific logic leaks into the core module.Compassion-switzerland/my_compassion(Specific): Contains the specific implementation for PostFinance Checkout, including API integrations for iframe embedding and transaction handling.Payment Integration:
Iframe Integration: Integrates PostFinance Checkout to allow sponsors to add new payment methods via a secure
iframe.Token Management: Handles callback processing to create the payment token. Includes deduplication logic that queries the PostFinance API to prevent creating multiple tokens for the same payment instrument.
Contract Linking: Automatically creates or updates the partner's
recurring.contract.groupupon successful tokenization.Recurring Billing & Invoicing:
_process_invoice_generationin the Swiss module to ensure correct payment terms and due dates are applied to automatically generated invoices.I got some changes requested by David the day I left, so I couldn't achieve to implement them / test them:
When a user change its payment method for a contract from a BVR/Recurring payment method to a tokenized one verify / implement the following
Result :
Documentation:
As the processes are quite complex, I wrote some docs detailing the frontend-backend interactions and data flow.