summaryrefslogtreecommitdiff
path: root/addons/payment/controllers
AgeCommit message (Collapse)Author
2021-04-23[FIX] payment_stripe_sca, *: use setup_future_usage when saving cardnie
*: account_payment, payment, sale Steps: - Install eCommerce - Go to Website / Configuration / eCommerce / Payment Acquirers - Configure Stripe: - Save Cards: Always - Payment Flow: Redirection to the acquirer website - Go to /shop - Add a product to the cart - Process Checkout - Select Stripe - Pay Now - Enter test data in Stripe Checkout form (https://stripe.com/docs/testing#cards) - Pay - Go to /shop - Add a product to the cart - Process Checkout - Select your saved card - Pay Now Bug: Stripe Error: The provided PaymentMethod was previously used with a PaymentIntent without Customer attachment, shared with a connected account without Customer attachment, or was detached from a Customer. It may not be used again. To use a PaymentMethod multiple times, you must attach it to a Customer first. Explanation: https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-payment_intent_data-setup_future_usage > Indicates that you intend to make future payments with the payment > method collected by this Checkout Session. According to this doc, `setup_future_usage` must be set in order to use the saved card afterwards. opw:2452452 opw:2498571 opw:2509897 closes odoo/odoo#69772 X-original-commit: 43e666f21f488067cf09a994fba7782271446b84 Signed-off-by: backspac <backspac@users.noreply.github.com>
2021-03-04[FIX] payment: link transaction to invoice with payment linknie
Steps: - Install account,payment - Go to Invoicing - Create an invoice - Click Actions > Generate a Payment Link - Follow the generated link - Pay Bug: The transaction is not linked to the sale order in the link table `account_invoice_transaction_rel` Explanation: This fix is broadly mimicking the behavior of the sales module regarding the link of an order to a transaction, adding `invoice_id`s where they are needed throughout the payment process in order to link the transaction to the invoice. opw:2451534 closes odoo/odoo#67289 X-original-commit: 7c6d06fa5858f79f3b22cdeaf74cdc26a642742f Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com> Signed-off-by: backspac <backspac@users.noreply.github.com>
2021-02-22[FIX] payment: link to order when not connectednie
Steps: - Install sales,payment - Go to Sales - Create a quotation - Click Actions > Generate a Payment Link - Browse the link in a private window - Pay Bug: The transaction is not linked to the sale order in the link table `sale_order_transaction_rel` Explanation: When not connected, the user doesn't have the rights to read the order. This leads `order_id` to be set to `None`: https://github.com/odoo/odoo/blob/d2f3c9e7975188753fa17c06db3fc5c73c773944/addons/payment/controllers/portal.py#L177-L178 When paying without `order_id`, the app is not able to make a link with the transactions: https://github.com/odoo/odoo/blob/d2f3c9e7975188753fa17c06db3fc5c73c773944/addons/payment/controllers/portal.py#L276-L277 This raises problems such as not being able to capture an amount as seen here: https://github.com/odoo/odoo/blob/d2f3c9e7975188753fa17c06db3fc5c73c773944/addons/sale/views/sale_views.xml#L254-L257 If we ensure a `partner_id` is present, using `sudo` here shouldn't be a problem as the data is protected by the token. Everything we get from `order_id` should already be in the URL. opw:2451564 closes odoo/odoo#66616 X-original-commit: f1f73fd2f8efdbac18d33d4e0b866ca50a28d537 Signed-off-by: backspac <backspac@users.noreply.github.com>
2020-08-20[FIX] payment: crash when using payment pageToufik Ben Jaa
- The PR https://github.com/odoo/odoo/pull/55122 introduced a typo, that breaks the payment page. opw-2322033 closes odoo/odoo#56204 X-original-commit: 125683bbbb7b1f43bec29bdd07e81886c4e6e139 Signed-off-by: Toufik Benjaa (tbe) <tbe@odoo.com>
2020-07-23[FIX] payment: fix payment processing via external linkAndrea Grazioso (agr-odoo)
Select a sales order. Go to action > generate payment link. Open private browser, reach the link. User will receive error message because of access denied to the res.partner data. opw-2287534 closes odoo/odoo#54808 X-original-commit: 3b4f3a8ad2880721cf6de9fb08387412df85d356 Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2020-06-23[FIX] account_payment, payment: filter providersNicolas Martinelli
- Install 3 payment providers: P1: no countries set P2: country set to USA P3: country set to Canada - Activate online payment of invoices - Create an invoice for portal user A (country of user is USA) - Login with A - Pay the invoice All 3 providers are available, while only 1 & 2 should be available. The providers are filtered in the sale module, but not in the account module: https://github.com/odoo/odoo/blob/586ee04a6296c13868011b3afaca61be5c6ff3c6/addons/sale/controllers/portal.py#L190-L193 The same issue occurs with the direct link `/website_payment/pay`. We apply the same filtering in all modules. opw-2279710 closes odoo/odoo#53483 X-original-commit: aaac93b551e2a5f331dd14ee5aefbe4ced173691 Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2020-05-18[FIX] payment,sale: company information in payment wizard linkDamien Bouvy
When generating a payment link through the payment link wizard, the company was previously not included. This could cause accounting issues if the acquirer displayed to the customer were not part of the same company as the underlying document that generated the link. This commit add a new computed field 'company_id' on the wizard model that gets computed based on the underlying model; this field will be included in links generated by the wizard to limit the acquirers displayed to those of the that company, preventing extra acocunting steps (interco reconciliation). opw-2254011 closes odoo/odoo#51441 X-original-commit: a6fcd7e0cfec8d4c62620a53b5fa806561e239af Signed-off-by: Damien Bouvy (dbo) <dbo@odoo.com>
2020-05-05[FIX] payment: float consistency enforcement in access_token generationjerome hanke (jhk)
Steps to reproduce: - install sales, ecommerce and payment_authorize - setup authorize.net (test mode) - go to sales and select the quotation S00007 (demo data) or create a quotation with multiple items that add up to a float - select action > generate a payment link > go to the link > select pay with authorize - you are redirected to authorize.net use 4111 1111 1111 1111 as card number and 1223 as expiration date > pay - you are redirected to the odoo payment process page - wait for the result Previous behavior: the user is returned to a 404 error page but the payment went trough Current behavior: access_token generation is consistent and will not fail because of float representation the user is returned to the "payment confirmed" page WARNINGS: - watching the values in vscode prevents bug reproduction - when setting up authorize.net, do not forget to add your test url to the account's allowed return urls - use https for authorize.net connection opw-2223135 closes odoo/odoo#50633 X-original-commit: 0fe7fa0f95b7393d8829ba4b216d6c41d0c0dc3d Signed-off-by: mightyjol <jhk-odoo@users.noreply.github.com>
2020-04-22[FIX] payment: handle tx in error in /website_payment/payDamien Bouvy
opw-2231276 X-original-commit: 7b62c95d44c0abce9b53b476bb1e65fc873da24d
2020-04-06[FIX] payment: use order company on payment pageToufik Ben Jaa
- The payment link generated by using the wizard `payment.link.wizard` are overriden to generate URL linked to sale orders. If so, we want the payment acquirer displayed to be in the same company as the sale order. closes odoo/odoo#49018 X-original-commit: 8c299efb6cb4355cec39cdedd8d7c3134f53d199 Signed-off-by: Toufik Benjaa (tbe) <tbe@odoo.com>
2020-01-30[FIX] payment: don't show unwanted payment tokenThibault Francois
The access right on payment_token is based on the partner_id linked with the user If there is token link with the public user, they are shown for every request were the partner_id is not defined If you are logged with an internal user with sales access right, you'll see all the payment_token linked with the acquirer We should avoid both situation and show only the payment_token from the legit partner_id the one of the current user or the one given as parameter closes odoo/odoo#44346 X-original-commit: 9edad5d9018ae357e955a5e21e9366e56caa8e31 Signed-off-by: Damien Bouvy (dbo) <dbo@odoo.com> Co-authored-by: Damien Bouvy <dbo@odoo.com>
2019-12-04[FIX] payment: Keep session serializablePatrick Tombez
Fix error like "TypeError: {4} is not JSON serializable" when serializing the session object (e.g. for external storage) closes odoo/odoo#41360 X-original-commit: e91e38fa4bd12ba9d2027e7778a10252e08b9a86 Signed-off-by: Damien Bouvy (dbo) <dbo@odoo.com>
2019-09-20[MERGE] forward port branch saas-12.4 up to 4a1321bc99dChristophe Simonis
closes odoo/odoo#37127 Signed-off-by: Christophe Simonis <chs@odoo.com>
2019-09-17[MERGE] forward port branch saas-12.3 up to d8ce75466e4Christophe Simonis
2019-09-13[IMP] payment: sca-readynessDamien Bouvy
- allow acquirers to arbitrarily include info about the tx in the processing page - pending is now a valid state that could require customer action in the payment processing page - don't blindly redirect to the return url of another tx if a pending transaction is there This latest change might mean that customers with many tx attempts might have a sub-par experience as they may need to click manually on the redirect url of a successful tx while before they were redirected immediately.
2019-08-23[IMP] payment, sale: access token for payment link wizardDamien Bouvy
When generating a link for a payment through the website_payment/pay route, including the partner_id 'blindly' is somewhat of a security issue since it means you could potentially create payments for any partner of your choosing. This commit instead introduces an access token mechanism where the partner_id, amount and currency_id are used to generate a unique access token that can be checked upon accessing the payment page. This token is only checked if the partner_id field is set (otherwise this is just an anonymous payment like any other).
2019-08-23[IMP] payment: security for public user paymentsDamien Bouvy
2019-08-23[IMP] payment: pass the partner on direct payment from payment linksza-odoo
Currently when payment is processed through the payment link by public user then there is no details of partner(email, country etc..) so due to that some payment provider(paypal, stripe etc.) produce the traceback on public payment so when generating link for the payment pass the partner on link so where payment is processed by public user then it will get the customer of the record as partner, so on behalf of the customer the payment is processed. task-1938635 Closes: #31575
2019-08-16[IMP] payment: handle pending tx in /payDamien Bouvy
let the landing page handle the message to display instead of intercepting the state in the controller.
2019-08-12[FIX] payment : show everywhere payment in test mode.Victor Feyens
2019-08-12[REF] payment : messaging and payment displayVictor Feyens
Co-Authored-By: William Andre <wan@odoo.com>
2019-08-12[REF] payment* : state based publishingVictor Feyens
Replace website_published and environment by a generic state on payment.acquirer Payment acquirers aren't enabled by default. When setting their state to 'enabled' or 'test', it is verified the required fields for the provider are set.
2019-07-16[MERGE] Forward port of saas-12.3 to saas-12.4 up to 40421be73c94551bMartin Trigaux
2019-07-16[MERGE] Forward port of saas-11.3 to 12.0 up to d8072d54acf8Martin Trigaux
2019-07-15[MERGE] Forward port of 11.0 to saas-11.3 up to d5dd136ba03bMartin Trigaux
closes odoo/odoo#34872 Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2019-07-15[MERGE] Forward port of saas-15 to 11.0 up to 1d9f64c91e44fb344efd6Martin Trigaux
closes odoo/odoo#34868 Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2019-06-06[MERGE] forward port branch saas-12.3 up to 409679866b2Christophe Simonis
2019-05-29[IMP] api.py: Rename company_id/company_ids into company/companiesYannick Tivisse
The goal is to be coherent with the user property. Actually, company_id and company_ids on the environment are no fields. Calling env.company_id returns a browse record, not an id.
2019-07-18[IMP] payment: small code improvementsDamien Bouvy
- treat s2s transactions as such - don't filter out tokens saved on acquirers that are not set for full s2s mode, as tokens might get created through a form and still be usable - detect the submit event as well as the click on the 'Pay Now' button to avoid completely wrecking the payment flow by pressing the return key - correct start override in JS should chain promises
2019-05-14[FIX] payment: transactional routes should not appear in the sitemapNils Hamerlinck
closes odoo/odoo#33360 Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2019-05-13[IMP] base: Contextualize the multi companyYannick Tivisse
Purpose ======= Allow the user to select the allowed companies for which he wants to see records on top of selecting his current company. It is confusing for users to see the records from the company he is connected to and the records of the children companies. Instead of using the hierarchy of companies to access records across companies, the user can now select (from his set of allowed companies) the companies for which he wants to access records. /!\ This means that the user will interact with records from company A when in company B. Example: a SO has been created and confirmed in A. When in B, I create the invoice from it. Specifications ============== 1/ Deprecate the parent/children hierarchy on the res.company model. The fields are kept on the res.company model to ensure the retro-compatibility, but won't be used accross the standard code anymore. The only functional usage for this mechanism was to allow to see records from several companies by creating a virtual parent company, which will be possible with the new mechanism. 2/ By default, a user will only see the records of the company he is connected to (or records without a company). (It is still editable by the user if needed). For that, put this information in the user context, to allow having different configurations on different browser tabs. Instead of having domains like ['|', ('company_id', '=', False), ('company_id', 'child_of', user.company_id.id)] you'll have something like ['|', ('company_id', '=', False), ('company_id', 'in', company_ids)] Note that the 'company_ids' is a value that is passed in the evaluation context on the record rule, as we already have user, or time. company_ids is a list of the ids of all the enabled companies in the user's context. 3/ Out of the generic improvements brought by this task, this will illustrate issues that could exist since several versions. For example, it should not be possible to create a scrap order for the company A with a package of the company B, or it should not be possible to create an invoice on the company A with payment terms from the company B. Before the version 12.0, it was easy to encounter this kind of issues as the admin was the SUPERUSER_ID. A positive side effect of the fact that the SUPERUSER_ID has become an inactive user was to make it more difficult to introduce mismatch on the records, but haven't solved the issue, as it was still possible to do it with parent companies configuration. Some of these issues have been fixed in this commit, but all the business flows should be re-tested to check if an ir.rule should be introduced (eg: a multi company rule for stock.quand.package), if the company of a record is correctly transfered to another record created from the first record (eg: From a SO, create an invoice and a payment, the company of the sales order should be transfered on the invoice and the payment, even if the company of the sales order is A and I'm logged into the company B with the company A enabled. 4/ Currently, if I click on a button on a notification email (example 'View Task'), I face a traceback if I'm not logged into the company of the record. Now, if you click on a button and if you have access to the record, the correct company will be automatically set. 5/ If I display a kanban view with several records from several companies (and an image), all the images should be displayed. 6/ Currently if you copy paste an url, this will crash if you're not in the correct company. This won't be fixed because it's quite impossible to do it in a clean way. This task brings a workaround. Copy/Paste -> Traceback -> Log into the correct company, re-copy/paste -> Ok. 7/ 2 property methods have been added on the environment to retrieve the company on which the user is logged in and the companies the user enabled, on a specific tab. That way, when creating a record, instead of doing default=lambda self: self.env.user.company_id do default=lambda self: self.env.company_id On the other hand, to retrieve the enabled companies, do companies = self.env.company_ids 8/ Modify the Company Switcher widget to allow to log into another company WITHOUT writing on the res.users (and thus bringing cache invalidation issues and so on). Also allow to enable several companies and see records from several companies, and independantly of the other browser's tabs. 9/ When focusing on a tab, save the current company configuration on the local storage. That way, when doing 'CTRL+T' or a middle click, the context is propagated to the new tab. 10/ Improve the error message in case of multi company access errors. Now, when the user is in debug mode, display the related names of the records and the name of the user who brings the issue. 11/ Remove the context erasing when writing on a res.users This is probably coming from the migration to new API of the base module. The context was not propagated at this moment, which was a common mistake at that time. When migrating the module, probably by using the 'black box' method, as the context was not propagated, it was erased on the new version. This is now an issue because the context (i.e. the enabled companies) was erased when writing on a res.users, leading to tracebacks. See: https://github.com/odoo/odoo/commit/7eab8e26d3d46c53f4be924d6a34e80a66e74960#diff-4c2e738ee8f64f11806c889ea097b5e7R624 12/ Fix the crash manager on redirect warnings. The issue is the following - Create an invoice on a company without a configured CoA. - Set a partner - On the onchange_partner_id, a redirect warning is raised to propose you to configure a CoA - Click on 'Go to the configuration panel' - A generic warning says something like 'Do you want to discard your changes?' - Click on yes, the page refreshes, but not on the redirect action. Now, set correctly the action on the hash, and reload instead. The breadcrumb is lost for example, but you reach the correct action at least. 13/ Introduce a res.group to enable/disable the multi company per tab feature. 14/ To help the users to know which tab is in which company, add the possibility to have a favicon per company. When creating a company, the classical 'O' icon is colored by default in a random color. 15/ Remove the company switcher on the frontend. This was mainly there to allow a user to swicth to the company linked to the website. This behavior is now transparent to the user. If the website A is activated, then the company set on the context is the company of the website. 16/ Deprecated the _company_default_get method on the res.company model. Remove the method _get_company on the res.users model. 17/ Add 'allowed_company_ids' and 'current_company_id' on the pyeval context. You can now use those variables on domains in the views to access directly to the activated company.ies on the current tab. TaskID: 1960971 closes odoo/odoo#32341 Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2019-05-21[FIX] payment: do not shadow error tracebackToufik Ben Jaa
- When validating payments on the payment process polling page errors can occurs and the tracebacks aren't logged which doesn't help when trying to understand the issues. With this commit we display the traceback instead of shadowing them. closes odoo/odoo#33537 Signed-off-by: Toufik Benjaa (tbe) <tbe@odoo.com>
2019-05-17[FIX] payment: do not display postgres operational errorsToufik Ben Jaa
- When processing payments on the payments processing page, `psycopg2.OperationalError` can be raised. We do not want those exceptions to be displayed to the customers, instead we want the polling page to try to process the payments again. This commit hides the display of psycopg2 operational errors. - This commit also fixes the "processing your payments" message being hidden after the first polling, no matter if the processing has succeeded or not. closes odoo/odoo#33462 Signed-off-by: Toufik Benjaa (tbe) <tbe@odoo.com>
2019-03-11[FIX] payment: remove transaction from sessionJohan Demaret Rivarola
Sequentially previewing and paying two sale orders was causing a redirection issue. Instead of being redirect to the SO preview (/my/orders/<:order_id>), the user was redirected to /payment/process. The issue was due to processed transactions not being removed from the session. opw-1948288 Closes #31741 Signed-off-by: Toufik Benjaa (tbe) <tbe@odoo.com>
2019-01-25[FIX] payment: multiple companiesNicolas Martinelli
- Activate multi-company - Create 2 S2S payment methods (Payment Flow: Payment from Odoo), one for each company - Connect as a regular user to `/my/payment_method` The user has access to both payment methods, while he should only have access to the method of his company. opw-1920483 closes odoo/odoo#30558
2018-10-01[MERGE] forward port branch saas-11.4 up to 57e387b6452Christophe Simonis
2018-09-26[FIX] payment: always redirect when using wire transferDemaret Rivarola Johan
The user should always be redirected when paying with wire transfer. This is because the landing page displays useful data such as the communication. Closes #27194
2018-09-25[FIX] payment, payment_sips: compute reference correctly and encode return urlDemaret Rivarola Johan
Sips does not accept special characters as a transaction reference. Replacing '-' solve this issue. Parsing Sips response was failing when the return url had query parameters. This was due to the split on '='. Encoding the url solve this issue.
2018-09-19[IMP] payment_*: payment acquirers error handlingToufik Benjaa
This commit aims to improve the user experience when using payment acquirers. There currently are no error feedback with some acquirers, which leaves the user wondering what is going on and what is the real status of its payment. In some cases, the user is currently being redirected to the home page even though the payment has failed. We want to make it more obvious to the user that something unexpected has happened by redirecting to an intermediate page that will provide good feedback on payments status. Another goal of this commit is to order acquirers by sequence instead of by flow and to select the first acquirer by default. This feature was already implmented in commit fe294fd43e521bd2d339e962f43acf46c3d4cb97, some UI adaptations were needed though. Related to task #36680 Closes #26958
2018-09-07[FIX] payment: portal payment use newly generated referenceToufik Benjaa
- When creating a transaction on the payment page of the portal, the transaction reference returned was incorrect. This commit return the newly created transaction's reference.
2018-09-06[FIX] payment: Fix reference computation to avoid duplicatesToufik Benjaa
- The method to compute the reference of a payment.transaction and avoid duplicate was missing some edge cases (for example if there was a '-' in the reference). - The creation of transactions in the route /website_payment/pay was not checking for duplicate payment.transaction.
2018-05-29[MERGE] forward port branch saas-11.3 up to 37eed7c509fChristophe Simonis
2018-05-24[FIX] payment: Remove lang when creating payment transactionToufik Benjaa
- Having a lang set when trying to create a payment transaction can cause issues due to uninstalled langs on the database.
2018-05-23[REF] account,payment(_*),sale*: downgrade transactions into debug itemsqdp-odoo
It was very confusing for the user to distinct account.payment and payment.transaction. From now on, the transactions are technical objects and, in the backend, we only refer to it in log messages (Front end will be adapted in the same fashion later on). They are hidden in debug mode in accounting\configuration\payments as their purpose is now purely technical/log This commit also aims to reduce the gap between the accounting app and the transactions: account.payment objects are created/validated upon completion of transaction. To ease the capture/voiding of pending transactions, the related buttons are now displayed directly on the SO/invoice instead of the transactions. Was task: https://www.odoo.com/web#id=35857&view_type=form&model=project.task&action=333&active_id=967&menu_id=4720 Was PR #24043 [FIX] add domain based on journal to payment tokens Was opw: https://www.odoo.com/web?debug#id=1828206&view_type=form&model=project.task&menu_id=5200
2018-04-18[FIX] payment: Save payment token only if user is connectedToufik Benjaa
- Fix an issue where the transaction were always set a 'form_save' thus always creating payment tokens. - Fix an issue where when the customer paying while not being logged in was crashing. The issue is due to the fact that we are creating payment transactions linked to no partners, doing so it crashing the code when creating the payment token with no partner set.
2018-04-16[FIX] payment: Portal payment were not saving tokensToufik Benjaa
- Portal payement is not respecting the option to save tokens after payments.
2018-03-02[FIX] payment: Unable to pay if character '/' in referencetbe-odoo
- On 'website_payment/pay' if the reference contains a '/' the payment will never succeed. It is due to the fact that in the template "payment.pay" were setting "prepare_tx_url" and "form_action" using this reference. But having a '/' in the reference breaks the URL to call to create a transaction. So when creating a transaction (or even paying in S2S) the payment never succeed and returns a HTTP 404 error.
2018-02-20[FIX] payment: Payment form not implemented on /website_payment/paytbe-odoo
The generic payment form introduced in 11.0 has changed the way we collect payment and so does the code. The route /website_payment/pay hasn't been changed to support the new payment form. This commit fixes this. It also fixes a bug for when a customer tries to create two transactions with the same reference.
2018-01-22[FIX] payment: missing supportNicolas Martinelli
The `website_payment` route has not been implmented following the payment refactoring. Deactive it for now. opw-787897
2017-12-12[MERGE] forward port branch saas-16 up to a2ea4ba095cChristophe Simonis