-
Notifications
You must be signed in to change notification settings - Fork 9.7k
[IMP] developer/reference/payment: update docstrings for payment models #13888
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
Closed
+18
−5
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
c189a79
to
2fdf9c4
Compare
f9f4a38
to
ad36c70
Compare
@robodoo r+ |
@AntoineVDV linked pull request(s) odoo/enterprise#87325, odoo/odoo#209685 not ready. Linked PRs are not staged until all of them are ready. |
ad36c70
to
585bbe4
Compare
@robodoo r+ |
robodoo
pushed a commit
to odoo/odoo
that referenced
this pull request
Jul 19, 2025
…orting This commit introduces a significant change in the paradigm of how the payment engine handles processing errors. The previous mechanism relied on exceptions bubbling to signal processing errors to the callers (payment form, web client, cron). This approach posed two problems: it was necessary to catch and handle any exception raised by the payment engine, and transactions were not persisted if an error was encountered and the cursor rolled back. The new approach consists of catching exceptions as soon as possible to prevent them from discarding database changes, setting the transaction to the 'error' state, and saving the error message on the transaction. It allows tracking transactions whose processing failed, and simplifies the handling of payment errors for applications integrating with online payments (e.g., Subscriptions). A number of collateral changes are made to enable the state-based reporting and streamline the integration of new payment providers: - A new `_send_api_request` util method is introduced on both the `payment.provider` and `payment.transaction` models to handle all API requests for the providers and centralize the management of processing errors. A series of specific hook methods are introduced to allow providers to configure the requests: `_build_request_url`, `_build_request_headers`, `_build_request_auth`, `_parse_response_error`, and `_parse_response_content`. - The processing-oriented methods (`*_from_notification_data`) are replaced by a new set of core and hook methods to centralize all the common logic involving error management. The overrides are kept to a bare minimum, consisting of only the provider-specific handling of transactions. - Provider-specific overrides of core `payment` methods are no longer required to call the `super()` method. This is made possible by moving the common logic previously living in those core methods into new, high-level business methods: `_charge_with_token`, `_capture`, `_void`, and `_refund`. - Action methods related to payment operations (capture, etc.) now display a toaster notification with the operation's result. - The capture and void payment operations now always create a child transaction to track the operation's progress, and save any error message on the child transaction rather than the source one. - Provider names are removed from the log messages and from displayed errors. - A new `get_payment_logger` util method is introduced to configure the logger of a payment provider and automatically mask sensitive data (e.g., secret keys) from logs. task-3648413 closes #209685 Related: odoo/enterprise#87325 Related: odoo/documentation#13888 Signed-off-by: Antoine Vandevenne (anv) <[email protected]> Co-authored-by: Antoine Vandevenne (anv) <[email protected]>
robodoo
pushed a commit
that referenced
this pull request
Jul 19, 2025
task-3648413 closes #13888 Related: odoo/odoo#209685 Related: odoo/enterprise#87325 Signed-off-by: Antoine Vandevenne (anv) <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
task-3648413
See also: