Commit Graph
31 Commits
Author SHA1 Message Date
Valeriya(vchu) 565e18c946 [FIX] payment_adyen: stop logging stacktrace for invalid reference
as Adyen sends the same notification data for POS and online payments
that can not be distiguished, the webhook controller logs a stacktrace
for every POS payment. If the payment_adyen is installed it generates
noise in logs as the POS transaction can not be found in online
payments. To clear the log we make missing transaction as warning to
not log the stacktrace.

task-2960381

closes odoo/odoo#123282

X-original-commit: 4754895ac7901c497f33a6bf9be6d18c0b4b55d8
Signed-off-by: Antoine Vandevenne (anv) <anv@odoo.com>
Signed-off-by: Valeriya Chuprina (vchu) <vchu@odoo.com>
2023-06-01 17:55:23 +02:00
Valeriya(vchu) 2173c252ad [IMP] payment_(adyen, stripe): webhooks transition from json-rpc to http
to return the response with correct status code as json-rpc returned status code 200 even if there was an error
task-2835711

closes odoo/odoo#117940

Signed-off-by: Antoine Vandevenne (anv) <anv@odoo.com>
2023-05-24 14:27:44 +02:00
Demesmaeker 7f2ae9ed5b [IMP] payment(_adyen): allow partial capture
Before this commit, it was not possible to partially capture a
transaction from Odoo, and doing so in the provider backend would often
result in a full capture in Odoo when capture was supported.

With this commit, partial captures are made available in Odoo directly
from the sales order or invoice, for providers that support them.
Provider can either only support full capture or also support partial
ones. It also optionally managed the automatic void of the remaining
amount at the user request when multiple captures are supported by the
provider.

As of now, the only acquirer allowing partial capture is Adyen.

task-2728768

closes odoo/odoo#87251

Related: odoo/enterprise#35205
Related: odoo/documentation#2063
Signed-off-by: Antoine Vandevenne (anv) <anv@odoo.com>
2023-03-09 10:51:29 +01:00
Ivan Yelizariev 8b027b69ce [FIX] payment_adyen: add missing fields to api call
It's needed to use "Automatic Risk assessment" feature in Adyen.

Technical docs:
https://docs.adyen.com/risk-management/configure-manual-risk/required-risk-field-reference

opw-3004646

X-original-commit: a8a166086b41692af49e0a9d4c44c0afdc0e05d4
Part-of: odoo/odoo#105664
2022-11-14 16:21:36 +01:00
Horacio Tellez f7b8f07501 [IMP] payment: rename of acquirer to provider
Changing the name of model payment.acquirer to payment.provider
and everything that it touches. It is technically incorrect to
use the term "acquirer" for systems that only provide a service
of payment.
After this commit the model payment.acquirer and all related to
it will be renamed to payment.provider.

Task - 2842088

closes odoo/odoo#90899

Related: odoo/upgrade#3542
Related: odoo/documentation#1981
Related: odoo/enterprise#27131
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
2022-09-09 13:38:08 +02:00
Julien Castiaux c0647b5c52 [REF] core: HTTPocalypse (14) changes all addons
This commit is the 14th commit of a comprehensive refactor of our HTTP
framework. See odoo/odoo#78857 for complete historic, discussions and
rationnals.

* `request.uid = x` => `request.update_env(user=x)`.
* `request.context = x` => `request.update_env(context=x)`.
* `request.context = dict(request.context, x=y)`
   => `request.update_context(x=y)`.
* `request.cr = None` => `request.cr.close()`.
* `http.mono_db()` => `request.db`.
* `http.dispatch_rpc()` => `service.dispatch_rpc()`.
* `@service.model.check` => `service.model.retrying()`.
* `request.endpoint`
   => `env['ir.http']._match(request.httprequest.path)[0].endpoint`.
* `request.routing_iteration `=> `removed`.
* `request.jsonrequest` => `request.dispatcher.jsonrequest`.

Note that `request.params` is now set much later in the process. If you
are in a situation where you values from the query string or the
http body you can use `request.get_http_params()`.

Note that using the new `request.future_response`, it is possible to
add headers and cookies on the response object before the response
object is initialized. Please note that headers/cookies saved on
the future response will NOT be injected in case of error.

PR: odoo#78857
Task: 2571224
2022-02-24 13:30:51 +00:00
Demesmaeker 8442ea9c1a [IMP] payment_adyen: allow splitting authorization and capture
Being able to first authorize then capture a payment has several
advantages:
- Confirm a quotation when the payment is authorized and capture it
  when the order is shipped.
- Review orders before capturing the payment.
- Prevent credit card fees in the case of a refund

This commit implements this feature for the payment acquirer Adyen.

task-2507304

closes odoo/odoo#70591

Related: odoo/upgrade#3088
Signed-off-by: Antoine Vandevenne (anv) <anv@odoo.com>
2022-02-18 09:49:20 +00:00
Antoine Vandevenne (anv) f4ca7290ac [IMP] payment(_*): search only once for the transaction
Before this commit, most acquirers needed to run several successive
searches for the transaction whose reference was received by a
controller in notification data. This is because the security checks
run on the notification data require access to the acquirer through the
transaction record which was immediately discarded.

Starting with this commit, all `*_feedback_data` method are no longer
decorated with `api.model` and can use the transaction record they're
called on if provided. They are also renamed to `*_notification_data`.

task-2737144

closes odoo/odoo#83850

Related: odoo/enterprise#23938
Signed-off-by: Antoine Vandevenne (anv) <anv@odoo.com>
2022-02-02 19:50:49 +00:00
Antoine Vandevenne (anv)andLucie Van Nieuwenhuyze 00259dc44a [IMP] payment_*: improve handling of webhook notifications
Notification handling in some acquirers presents a subset of the
following issues:
1. The signature of synchronous notifications (redirect payloads) is not
   checked. (Alipay, Authorize, Buckaroo, Mollie, PayU money, PayULatam)
2. When the signature check fails, we raise a ValidationError which
   counts as an HTTP 200 for some providers (it's not the case if they
   expect a specific string). (Adyen, Paypal,  Sips, Stripe)
3. If a ValidationError is raised when processing the feedback data, it
   is allowed to bubble up to the provider. (Alipay, Ogone)

The issues are respectively addressed as follows:
1. If the acquirer implements payments with redirection, make sure that
   if either makes a request to the provider to validate the data or
   that it verifies the signature. Verifying the origin of the request
   is not enough: the payload must be checked too.
2. Instead of raising ValidationError's, raise an HTTP 403 FORBIDDEN
   error if the signature check fails.
3. Wrap the call to `_handle_feedback_data` of the webhook method inside
   a try/except clause to catch any ValidationError, log a warning, and
   acknowledge the notification to avoid having the provider disable the
   webhook because of too many failures.

task-2688139
task-2693293

closes odoo/odoo#81607

Signed-off-by: Antoine Vandevenne (anv) <anv@odoo.com>
Co-authored-by: Lucie Van Nieuwenhuyze <luvn@odoo.com>
2022-01-27 17:11:52 +00:00
Horacio Tellez 5badb3fca8 [IMP] payment(_*): normalize logs across all acquirers
The logs for payments contain the transaction reference whenever possible.
Before logs for transactions contained the reference or the id of the
transaction in an inconsitent way. No transactions are identified by
reference whenever possible.

The logs for payments for the same function on different acquirers should
have the same format. Same flow step for different acquirers had
information passed in different formats. Now at each step of a transaction
flow log messages have the same format regardless of the acquirer.

Overall the payment logs should have an uniform format. Hopefully
understanding log messages related to transactions should be easier, as
now log format is independent of the acquirer and transaction are easily
identified by reference.

Task - 2545450

closes odoo/odoo#79547

Signed-off-by: Antoine Vandevenne (anv) <anv@odoo.com>
2021-11-29 15:40:54 +00:00
Valentin ChevalierandAntoine Vandevenne d9d2b6da6c [IMP] payment_adyen: migrate to the latest version of Checkout API
Checkout API v67
Web Drop-in v4.7.3

In particular, this commit changes the client-side authentication flow
to rely on client keys rather than origin keys as the latter is
deprecated by Adyen and the switch is required in order to upgrade the
Drop-in integration.

task-2590477

closes odoo/odoo#74827

Related: odoo/upgrade#2786
Signed-off-by: Antoine Vandevenne (anv) <anv@odoo.com>
Co-authored-by: Antoine Vandevenne <anv@odoo.com>
2021-09-03 14:30:18 +00:00
Demesmaeker e0233a1010 [IMP] payment(_adyen): allow to refund confirmed transactions
Before this commit, it was not possible to refund a payment from Odoo.
Users had to go through the payment acquirer's backend and update the
payment accordingly in Odoo.

With this commit, refunds are made available in Odoo directly from the
payment form, for acquirers that support them. Acquirer can either only
support full refunds or also support partial refunds.

As of now, the only acquirer allowing refunds is Adyen, with partial
refund support.

task-2527891

closes odoo/odoo#70881

Related: odoo/upgrade#2689
Related: odoo/enterprise#19829
Signed-off-by: Antoine Vandevenne (anv) <AntoineVDV@users.noreply.github.com>
2021-08-23 10:54:17 +00:00
Antoine Vandevenne (anv) 0885212a83 [FIX] payment_adyen: prevent creating a new session for returning users
Before this commit, users returning from Adyen to Odoo after payment
could see their session renewed, depending on their browser's
implementation of the `SameSite` cookie attribute. This prevented Odoo
from retrieving the transaction from the users' session.

This commit flags the return route of Adyen with `save_session=False`,
hence allowing all users to immediately post-process their transactions
when they return to Odoo.

While we're at it, the docstrings of the return routes of PayUmoney and
SIPS' have been updated for better clarity.

closes odoo/odoo#74763

Signed-off-by: Antoine Vandevenne (anv) <AntoineVDV@users.noreply.github.com>
2021-08-05 13:31:09 +00:00
Demesmaeker 9d62c2789e [FIX] payment_adyen: always reply with '[accepted]' to notifications
Before this commit, when the webhook was processing a notification,
if there was a validation error, the webhook was sending the whole
traceback to Adyen. Since this was still a response code 200, this
didn't cause any problem, but we could see the response received in
the Adyen backend.

So we will now catch any validation error and send `'[accepted]'` in the
response.

closes odoo/odoo#74733

Signed-off-by: Antoine Vandevenne (anv) <AntoineVDV@users.noreply.github.com>
2021-08-05 09:33:04 +00:00
Jeremy Kersten 478068c829 [IMP] *: always use Odoo Response
This branch adds request.redirect on all requests.
In case of a front end request, we do an url_for to the location.

We removed redirect_with_hash that was only for retro compatibility

local_redirect has been renamed to redirect_query, and param keep_hash has been
removed and moved.

Default code for redirect is 303 now instead of 302.

Now redirect and redirect_query make local redirect by default, you need to
pass local=False to make external redirect.

All werkeug.utils.redirect has been replaced by request.redirect.

Http.redirect now use an http.Response type, and it become easy to add an
override like 'set_cookies' e.g.

Dispatch of a website.page return an http.response too, so we first need to
check if it is a cached version before to check if it is an Odoo Response.

Migrate your code:

http.redirect -> request.redirect(location, code, local)
http.local_redirect -> request.redirect_query(location, query, code, local)
http.redirect_with_hash -> request.redirect

Courtesy of odony for help and review ;)

closes odoo/odoo#72599

Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2021-07-08 07:00:06 +00:00
Romain Derie 92175d3341 [IMP] *: replace web.base.url ICP by helper method
Previous commit introduce an helper to get the most suited URL for a record
instead of always using the ICP, which is not correct in a website context.

This commit replaces calls to ICP by the helper method.

Community: https://github.com/odoo/odoo/pull/68201
Enterprise: https://github.com/odoo/enterprise/pull/17538
Upgrade: https://github.com/odoo/upgrade/pull/2372

task-2476101
2021-06-02 10:04:29 +00:00
Antoine Vandevenne (anv) a30aa2aeed [REF] payment_adyen: migrate Adyen to the new payment API
This commits also switches the Adyen implementation from the Hosted
Payment Pages API to the new Checkout API, hence replacing the payment
with redirection flow by a direct payment flow.

See the merge commit for more details.

task-2479832
2021-03-30 09:25:51 +02:00
Raphael Collet caf900e89e [FIX] *: use auth='public' in controllers that use request.env
The following trick used to work, because `sudo()` was actually making
an environment for the superuser to operate upon:

request.env[...].sudo().method(...)

It no longer works in general, since `sudo()` now makes an environment
in superuser mode but with `uid=None`!  It may still work by accident
for operations that never use `env.uid`, but is broken in general.

Using `auth='public'` fixes the problem by using the public user when no
user is available.

closes odoo/odoo#34297

Signed-off-by: Olivier Dony (odo) <odo@openerp.com>
2019-07-04 11:32:22 +00:00
Toufik Benjaa 6ed44181d0 [IMP] payment_*: payment acquirers error handling
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-19 18:25:32 +02:00
xmo-odoo b4429c2a91 [FIX] Various P3-related import changes
* LDAP import: python-ldap is not python3-compatible, pyldap is

  Warning: only supported from debian Stretch (current testing)?
  https://packages.debian.org/search?searchon=names&keywords=pyldap

* implicitly relative imports
* imports of moved or removed stdlib modules

issue #8530
2017-04-28 09:06:53 +02:00
Thibault Delavallée e05f4612eb [MIG] payment_adyen: new API
No functional change.
2016-07-06 15:10:45 +02:00
Goffin Simon 32c8280a02 [FIX] payment_adyen, payment_authorize, payment_buckaroo, payment_paypal, payment_sips: Disable csrf on callbacks
Inspired from 2099f15d67

opw:653341
2015-11-24 11:35:57 +01:00
Denis Ledoux d5d8140f3a [MERGE] forward port of branch saas-6 up to 7158eaf 2015-11-02 18:06:25 +01:00
Ludovic Laffineur lla 3dafb19c96 [IMP] payment_adyen: add support HPP notifications from adyen
It is mandatory to switch to a production account
2015-10-28 16:36:18 +01:00
Leonardo Rochael Almeida 60af7cac02 [IMP] replace simplejson with stdlib json
The stdlib version of the json library is more recent than the 3.5.3
version we are pinning in `requirements.txt`

There is no reason to use it.

Closes #6940
2015-09-28 10:53:32 +02:00
Denis Ledoux 338df8f492 [FIX] payment_adyen: pspReference is not mandatory
Indeed, when canceling a transaction, pspReference
is not passed.

In such a case, the arg authResult is set to
`CANCELLED`, and in such a case, we should
just bypass the form_feedback, as done in
the payment_paypal module.

opw-634210
2015-04-30 14:26:34 +02:00
Fabien Meghazi e974e1fbea [REM] remove disable_db and ensure_db() from addons
bzr revid: fme@openerp.com-20140130092308-s24a7h2mhzuaasf1
2014-01-30 10:23:08 +01:00
Fabien Meghazi c4e48e2388 [REM] Removed auth='admin' from modules
bzr revid: fme@openerp.com-20140129171520-wkz8ot4pa63utoi3
2014-01-29 18:15:20 +01:00
Thibault Delavallée a7908b63bd [FIX] payment_*: fixed return controlers, now using werkzeug redirection
bzr revid: tde@openerp.com-20140124145923-fsyv2tm5z92m1je1
2014-01-24 15:59:23 +01:00
Thibault Delavallée 164a1ab180 [IMP] payment_*: routes as admin, remove website parameter in routes
bzr revid: tde@openerp.com-20140123154924-r1cylz0fobzav90y
2014-01-23 16:49:24 +01:00
Thibault Delavallée 0b69bad996 [RENAME] payment_acquirer_* -> payment_ *
bzr revid: tde@openerp.com-20140122175702-1h1e51z4njt4s70w
2014-01-22 18:57:02 +01:00