Commit Graph
205 Commits
Author SHA1 Message Date
Toufik Benjaa d30fa83114 [FIX] payment: crash when validating a payment.transaction
- If a payment.transaction is already linked to an account.payment, the
  transaction validation crashes.
2018-09-19 14:08:00 +02:00
Christophe Simonis f3fa5a5ef7 [MERGE] forward port branch saas-11.3 up to 1e0a92c996 2018-09-13 19:30:33 +02:00
Laurent Smet 99f599232b [REM] account, payment, website_sale: remove dead code 2018-09-11 15:04:10 +02:00
Christophe Simonis 826cd9b3d3 [MERGE] forward port branch 11.0 up to c3ea0a7811 2018-09-10 19:21:57 +02:00
Nikunj Ladava 2ea7d9b10e [IMP] payment: Improved error message for an empty field in payment.acquirer form view
- payment.acquirer have many fields with 'required_if_provider'
   attribute and while saving form it gave an error like "Required
   fields not filled", so it was confusing to know  which required fields were empty.

 - after this commit, it is displayed like "Required fields not filled (field name)"

opw:1881054
2018-09-10 16:46:21 +02:00
Toufik Benjaa 29cd2c33eb [FIX] payment: allow to set done a payment.transaction in pending state
- If a payment.transaction is in pending state, it was impossible to set
  it to done.
2018-09-10 10:41:37 +02:00
Toufik Benjaa d78f23df84 [FIX] payment,sale_payment: extract code to overridable methods
- We extract some code logic to methods to allow to override them.
  This is needed for the subscription module where a payment token need
  to be copied from a transaction to a subscription.
  The subscriptions is created from a sale order and before the
  payment.transaction holding the payment.token id is validated.
  Since the payment.transaction is not validated, the subscription
  module doesn't find the correct transaction.

  By extracting this code logic, we can override exactly when it should
  be.
2018-09-07 19:26:51 +02:00
Toufik Benjaa e11c0a45f2 [FIX] payment: Fix reference computation to avoid duplicates
- 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-09-06 16:03:01 +02:00
Toufik Benjaa 541e049d96 [FIX] payment: properly set communication field on account.payment
- After 01216345e2 the field communication
  on account.payment was not properly set when created by a
  payment.transaction.
2018-09-06 15:57:27 +02:00
Christophe Simonis 6fc061a96d [FIX] payment: force company when posting payments 2018-09-06 14:25:23 +02:00
Toufik Benjaa 03d8f528b7 [FIX] payment: Avoid accessing a field on an integer
- When clicking on the invoices stat button on payment transactions via
the form view a traceback is displayed.
  This is due to the fact that the code is trying to access to a
member/field named "id" on an integer.
  "invoice" is an integer, not a record/object.
2018-07-11 14:15:55 +02:00
Christophe Simonis f36e6917bd [MERGE] forward port branch saas-11.3 up to 37eed7c509 2018-05-29 17:34:43 +02:00
Richard Mathot a01f7b0e0b [IMP] payment: faster search on transaction reference 2018-05-29 10:06:44 +02:00
qdp-odoo 01216345e2 [REF] account,payment(_*),sale*: downgrade transactions into debug items
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-05-23 15:44:55 +02:00
Christophe Simonis fa8a67ee5f [MERGE] forward port branch 11.0 up to 5a943390f2 2018-05-15 20:18:14 +02:00
Nicolas Martinelli 429bcd9464 [FIX] payment_sips: special characters
The field `transactionReference` of Sips must contain only
alphanumerical characters. Previous commit 31dc6b888e solved
the special case of several attempts to pay, but a much simpler case may
appear in v11. Paying an invoice is likely to fail since the reference
contains by default `/`.

In the previous commit, we could simply modify the common `payment`
module code. In this specific case, however, we only change the
reference if the acquirer is Sips.

opw-1841483
2018-05-15 08:33:06 +02:00
Christophe Simonis 87e21ccdc5 [MERGE] forward port branch 11.0 up to 521414b1c1 2018-05-02 19:36:16 +02:00
Laurent Smet 5439e72a4e [IMP] payment*: auto-create journal for payment.acquirer
This commit adds the auto-creation journal for installed acquirers.
This is not easy because:
- The acquirers are created on the 'payment' module but are enabled only when the specific module
is installed. E.g. Paypal is enabled with 'payment_paypal'.
- To create a journal, a chart of accounts is required. However, the post_init_hook on the
'account' module makes the installation order harder. E.g install payment_paypal directly:
The module are installed in the order: account -> payment -> payment_paypal -> l10n_generic_coa.

To fix the problem, the journals are created at two moments:
- During the installation of the chart of accounts.
- At the installation of an acquirer module. E.g. payment_paypal.

Was PR #23904
Was task: 1831620
2018-04-26 11:26:22 +02:00
Christophe Simonis 6773bdbe32 [MERGE] forward port branch 11.0 up to e8f630e44d 2018-03-21 19:36:58 +01:00
Nikunj Ladava cbd395ec36 [IMP] payment, sale_payment: set invoice id in payment transaction form after payment being done from sale order.
Until now invoice_id is filled on the transaction only when we make
payments through invoice. However if we make payments through sale order
then invoice_id is not filled.

This commit fixes that issue. As there is no common point between
sale_payment and account_payment except payment, a void method is added
in payment and an override done in account_payment. That was when both
modules are installed code is correctly triggered.

This commit is related to task ID 1813602. Closes #22746 .
2018-03-20 16:16:27 +01:00
Christophe Simonis e0345a4a3f [MERGE] forward port branch 11.0 up to 2835d29979 2018-03-20 11:45:11 +01:00
Joren Van Onder e94912b9a9 [FIX] payment: do not refund transactions if they need 3DS validation
This was already the intended behavior, but in Python a return inside
of a try...finally does not behave this way. From the Python
documentation [1]:

When a return, break or continue statement is executed in the try
suite of a try...finally statement, the finally clause is also
executed ‘on the way out.’

This can cause issues because some payment acquirers will return an
error when refunding a pending transaction. This puts the transaction
in the 'error' state which means it won't be refunded anymore.

Additionally, putting s2s_do_transaction in a try...except like this
hides any traceback that occurs which makes troubleshooting harder.

[1] https://docs.python.org/3/reference/compound_stmts.html#finally
2018-03-15 14:56:34 -07:00
Goffin Simon 669c23d58d [FIX] payment, payment_authorize: company field in authorize.net
Steps to reproduce the bug:

-Just purchase a simple product using Authorize.net
-Click on "Pay Now" to be redirected to Authorize.net gateway

Bug: The company field added during checkout page was not filled.

opw:1817597
2018-03-13 15:02:51 +01:00
Christophe Simonis 36945a5853 [MERGE] forward port branch 11.0 up to c2e878e34c 2018-03-01 19:43:25 +01:00
Yannick Tivisse 6f614c3254 [FIX] payment: Be less resrictive for payment journals on acquires
Purpose
=======

It looks a little to restrictive to only allow bank journals on payment acquirers.

For example on could want to define a manual payment acquirer linked with a journal of type "cash".

Allow both journal types instead of only bank.
2018-02-26 17:17:33 +01:00
Yannick Tivisse dc6913e2e0 [FIX] payment: Avoid to reset journal_id on acquirer edition
Coming from https://github.com/odoo/odoo/pull/17067

Don't reset the journal but make it required on the form view instead.
2018-02-26 17:17:33 +01:00
Christophe Simonis cb50970f3f [MERGE] forward port branch 11.0 up to eefe879a37 2018-01-25 15:41:45 +01:00
fda-odoo 1423ad9379 [Fix] payment: hide save_token field if the payment_mode is in form mode and change typo 2018-01-24 15:34:39 +01:00
Christophe Simonis 228ecdbe28 [MERGE] forward port branch 11.0 up to ff0abd214c 2018-01-10 11:41:35 +01:00
Martin Trigaux ff0abd214c [FIX] untranslated defaults
The field was translatable but the default value was untranslated

Fixes #22059
2018-01-10 08:57:12 +01:00
Nicolas Lempereur dc61861f90 [FIX] payment: py3 error payment icon save
Code to thumbnail payment icon image had an error for python3 because
from RPC the image would be a text string instead of an expected
bytestring.

This change accepts both and made another small fix in the view since
image_medium doesn't exist (and image is already thumbnailed).

A third fix was that removing an image caused an error.

opw-803722
closes #22088
2018-01-08 15:58:30 +01:00
Christophe Simonis 362f0489d0 [MERGE] forward port branch 11.0 up to fe22a0f9ca 2018-01-03 12:28:52 +01:00
Martin Trigaux cab7e0d204 [FIX] *: add missing space in multilines messages
Courtesy of @Yenthe666
2018-01-03 11:09:09 +01:00
Nicolas Lempereur a1da9eec41 [FIX] payment: reload on kanban acquirer install
When installing a payment acquirer from the kanban view, this would by
luck display the form view correctly.

But if we go back to the listing then forward to the form view, things
go awry.

This is because the listing action views have not been updated after the
module installed, this worked at install because we loaded a new action.

This commit change the action so when installing a payment acquirer from
the kanban view, the view is simply reloaded.

opw-786454
closes #21757
2017-12-20 14:14:43 +01:00
tbe-odoo c32de79237 [ADD] payments: Logging payment transaction operations
- Logging data sent & received to/from payment acquirers to be able to track failed payments.
2017-12-01 10:06:30 +01:00
Thibault Delavallée 8b02f7fd67 [MOV] base: move module_* models into models/ 2017-11-27 11:15:06 +01:00
Thibault Delavallée 7cb704a324 [IMP] payment: add acquirer computation tools to ease future additions
* add a method computing available acquirers and payment tokens for a
   given partner and company. Those data will be used notably in customer
   portal when displaying the payment form;
 * raise if no partner_id set in s2s process. Indeed this field is
   required but values come from a dict. Current code raises an error
   about None being converted to Int instead of giving the real error;
2017-09-04 14:09:54 +02:00
tbe-odoo be650c5979 [IMP] Fixing the code to fit the reviews 2017-08-29 17:16:42 +02:00
tbe-odoo 2a2a1c7b28 [IMP] payment,website_sale/quote: Renaming a field and labels 2017-08-29 17:16:42 +02:00
tbe-odoo ad095e492f [IMP] payment,website_payment: Change payment.option model name to payment.icon 2017-08-29 17:16:42 +02:00
tbe-odoo 83fdc63b68 [IMP] payment: Fix crash on install
- Fixed a crash when installing payment module.
- Set a more specific css selector to display error on payment form where required input are empty
2017-08-29 17:13:58 +02:00
tbe-odoo 6b38cd8b85 [IMP] payment: UI changes & Fix 500 errors
- Fixed 500 errors when trying to display payment form because of variables partner_id/acquirer_id missing.
- Accepted credit cards are now display next to the acquirer name on the payment form
2017-08-29 17:13:58 +02:00
tbe-odoo 11bc680ae9 [IMP] payment: Remove ugly render() hack
- Removed an ugly hack that renders s2s forms then display them using t-raw, we're now providing the xml_id of the s2s forms and uses t-call instead.
2017-08-29 17:11:23 +02:00
tbe-odoo 194d52e8fd [IMP] website_quote/sale,payment: Support of the new payment form
- Online quotation and e-commerce now use the new payment form.
- Added the ability to chose on an acquirer if it uses only form/s2s or both.
(Still need some code cleaning)
2017-08-29 17:11:23 +02:00
tbe-odoo 64ae5e2bc3 [IMP] payment: Supported payment options
- Added the ability to specify which payment option each payment acquirer supports and,
    displays those payment option on e-commerce footer.
2017-08-29 17:11:23 +02:00
Olivier Dony 695716efb0 [FIX] P3: remove pycompat.{keys,items,values} helpers
Now that we're closer to switching to P3 for good, these helpers have
outlived their usefulness, and mostly add noise.

All remaining dict.iter*() or dict.view*() must be converted to the
normal keys(), values() or items() calls.

Whenever the result is likely to be used for more than the scope of a
loop, or when the dict needs to be modified during iteration, the calls
must be wrapped in a ``list()``, to protect the new P3 semantics.
Those cases are very exceptional.

Also removed some dead code or improved the API to remove unnecessary
conversions.
2017-08-20 23:25:54 +02:00
Xavier Morel 481a00dc4b [FIX] P3: hash/hmac payload must be bytes 2017-08-20 23:25:54 +02:00
tbe-odoo 2df9c22d80 [IMP] Payments & subscriptions: Improved Payments
- When registering a payment token, validating it using a payment of a small amount (~1.50€) followed by a refund allows ensuring
    that the payment method is valid (i.e. checksumming the card number simple ensure the number is valid but not that the card exists).
    This commit introduces a generic approach that must be implemented for each acquirer that has tokenization support.
    This commit also introduces a generic payment token registration/usage template that can be adapted according to one's need.
- Introducing a new payment form that handles payment, deletion and adding payment method (only for server2server for the moment).
- On /my/payment_method, changed strings 'Payment Acquirers' to 'Payment Methods' which is more clear.
- Stripe can now be used to pay subscriptions.
2017-08-14 08:30:59 +02:00
tbe-odoo 7d428c871b [IMP] payment, website_payment: generic mechanism to verify payment tokens on registration
When registering a payment token, validating it using a payment of a small amount followed by a refund
allows ensuring that the method is valid (i.e. checksumming the card number simple ensure the number
is valid but not that the card exists). This commit introduces a generic approach that must be implemented
for each acquirer that has tokenization support. This commit also introduces a generic payment token registration/usage template that can be adapted according to one's need.

payment_ogone: add support for tokens validation
2017-07-14 11:57:19 +02:00
Elkasitu 0e39cc9345 [IMP] payment: Add search for token_implemented
Since subscriptions only accept tokenizable (credit-cards and such)
payment options, we must use the token_implemented field to filter out
non-tokenizable payment options (such as wire transfer) and because
token_implemented is a computed field, a search function had to be
created
2017-07-07 20:06:41 +02:00