Commit Graph
42 Commits
Author SHA1 Message Date
Toufik Benjaa e34b8b07b4 [FIX] stripe: Fix float representation error
- Stripe needs to have the amount in integer, so we have to multiply by 100 the amount.
  Which sometimes create float representation errors and remove/add ~1 cent on some transactions (i.e 72.60€)
2018-04-23 16:28:08 +02:00
Christophe Simonis ad825b673b [MERGE] forward port branch saas-15 up to bfa5af45df 2018-04-16 17:10:23 +02:00
Christophe Simonis bfa5af45df [MERGE] forward port branch saas-14 up to aab0908818 2018-04-16 14:21:00 +02:00
Toufik Benjaa 2a09289e32 [FIX] payment_stripe: Create stripe charge with email
- When creating a Stripe charge, we have the possibility to send the customer email.
  This is then used by Stripe to send a payment notification (receipt) to the customer.
  This was never done by Odoo, this commit introduce this feature.

OPW-1829945
2018-04-11 11:58:55 +02:00
Christophe Simonis c94d30541c [MERGE] forward port branch saas-15 up to 97a70c2d8e 2018-04-06 14:33:40 +02:00
Christophe Simonis 97a70c2d8e [MERGE] forward port branch saas-14 up to 5eb6e14e85 2018-04-06 13:43:57 +02:00
Lucas Perais (lpe) bf2e541c27 [FIX] payment_stripe: partner info is not mandatory
Before this commit, when accessing the payment page with arbitrary amount
(/website_payment/pay?reference=Testinvoice&amount=150.0&currency_id=6&country_id=)
A traceback was thrown because the keys concerning the partner were not present in the dictionary
that prepares the values for the form that we send to Stripe

Considering that those info are not mandatory for stripe (although not very good practice -- the more info the better to verify an identity)
we ignore them if not present

After this commit, the public route works fine

OPW 1832164
closes #23948
2018-03-30 09:17:53 +02:00
Nicolas Martinelli ecfcaea080 [FIX] payment_stripe: correctly handle error
If there is an error, we should handle it first. Otherwise, some keys might
not be found in the results (e.g. 'object' or type') and cause a crash.
2018-02-02 09:17:30 +01:00
Christophe Simonis b37cc1f9b7 [MERGE] forward port branch saas-16 up to a2ea4ba095 2017-12-12 18:39:43 +01:00
Olivier Dony 88841c3927 [FIX] payment_stripe: avoid crash on non-ascii cardholder names
`str.format()` is only safe with byte-strings arguments, not unicode.
Unicode parameters would be automatically encoded using 'ascii'
encoding, resulting in a UnicideEncoreError in case any non-ascii
characters are present, which is quite likely.

Using '%' formatting on a str format string works the other way around,
and will cause the format string to be decoded into unicode if any
unicode params are present. This is typically safer because we never
use non-ascii characters in our format strings.

It also feels more natural than having to coerce the format string to
unicode using a u'' prefix.

This issue does not occur in Python 3, where either syntax will work.
2017-12-10 02:25:29 +01:00
Olivier Dony 0a74272bed [FIX] payment_stripe: do not rely on token email
Depending on the payment flow, the `email` field may not always be
present in the token data coming from Stripe.
Currently, it is missing in s2s mode, because we do not send it.

To avoid a KeyError during creation of the customer, we can use
token["card"]["name"] instead, which is always provided (it contains
either email or cardholder name), or the explicit ` description`,
when provided.
2017-12-10 01:55:47 +01:00
tbe-odoo 3bc1e0175d [FIX] payment_stripe: Create proper customer description 2017-12-07 20:09:11 +01:00
tbe-odoo d45f79e58f [IMP] payment_stripe: Add support of form tokenization
- Added support of form based payment with tokenization to be able to pay Subscriptions and save a payment token for later payments
2017-12-06 16:47:54 +01:00
Christophe Simonis 10128fa7e8 [MERGE] forward port branch saas-16 up to dc2a6c6cd2 2017-10-20 19:27:04 +02:00
Olivier Dony 0fc6fe8653 [FIX] payment_stripe: fix multiple usability problems
- There was no feedback to the user when executing the Charge
  transaction in server-to-server mode, while it could take several
  seconds, with the normal UI/action buttons still available.

- Stripe integration was almost working along with `website_quote`
  payment, but entirely broken with `website_payment`, and partially
  broken with `website_sale`.
  Fixing it required:
  + More leniency in processing optional transaction parameters, which
    may or may not be present in the various payment flows.
  + It also required more precautions when locating the transaction for
    which the Stripe Charge was to be created, which passed in different
    manners in the session. The route now supports an explicit `tx_id`
    to allow forcing the transaction without risk of mixing different
    payment flows.
  + FIXME: There is still some amount of duplication and bad modularity
    in the handling of the various payment flows in relation with
    Stripe.

- We provided very little metadata to the Customer and Charge APIs of
  Stripe. We now pass more names and references to make Stripe payments
  easier to manage in the Stripe dashboard.

- In some cases, selecting Stripe as payment method caused a second
  inclusion of `stripe.js`, raising a JS error because of the
  duplication.

- Strip whitespace in emails: the Stripe API raises an error for
  transactions done with invalid emails, including with
  leading/trailing whitespace.
  Customers will have a hard time figuring out the problem
  by themselves, so we should at least strip whitespaces.
2017-10-19 18:14:15 +02:00
tbe-odoo 7419661247 [IMP] payment_stripe: Compatible with the new payment form
- Stripe checkout form is now compatible with the new payment form.
- Fixed a typo on a currency code.
2017-08-29 17:15:00 +02:00
Christophe Simonis 30bd5ac0e9 [MERGE] forward port branch saas-16 up to aec6248bb3 2017-08-23 16:44:58 +02:00
Christophe Simonis 59f8b849fb [MERGE] forward port branch saas-15 up to d5f2a38b50 2017-08-23 11:23:08 +02:00
Christophe Simonis d5f2a38b50 [MERGE] forward port branch saas-14 up to 6956ad54de 2017-08-22 17:20:15 +02:00
Nicolas Martinelli 99e5a601b0 [FIX] payment_stripe: charge creation failed
To reproduce:
- Buy a product costing 0.01
- Validate the cart, pay with Stripe
- Enter the credit card info, validate

Stripe cannot process the transaction (minimum charge is not met), but
the user is not warned about it. The Stripe pop-up is closed and the
error is recorded in the console silently.

opw-765775
2017-08-17 12:16:28 +02:00
Nicolas Martinelli c9cd44cf56 [FIX] payment_stripe: UTF-8 encoding
For proper comparison with 'PYGí'
2017-08-17 10:43:23 +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
Christophe Simonis 85571bb78c [MERGE] forward port branch saas-15 up to dde62073ba 2017-08-10 16:22:36 +02:00
Christophe Simonis c3d710d2f6 [MERGE] forward port branch saas-14 up to 80ac087d6e 2017-08-09 17:11:10 +02:00
Nicolas Martinelli ecda057e11 [FIX] payment_stripe: integer currencies
Complement of commit b335ae0348

opw-760707
2017-08-03 11:05:16 +02:00
Joren Van Onder 91abcdf842 [FIX] payment_*: always read callback_eval as superuser
The callback_eval field has a groups parameter of
base.group_system. Without this patch everyone not part of that group
ends up with an access right error when the system attempts to read
that field.

Previously this was not a problem because all code reading
callback_eval was executed with the superuser already. New code has
been introduced however that does not do this (eg. paying with a
payment.token from the backend).

opw-741181
2017-06-26 11:19:46 +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 cf1df16aea [IMP] payment_*, website_quote: change callback_eval string to parameters
callback_eval is currently a code string that is evaluated directly
at payment confirmation. This commit changes it to have parameters
on the record and method to call on it. Moreover a hash done once at
transaction creation ensure that a modified transaction does not allow
to execute code on other records.
2017-02-13 16:58:47 +01:00
Christophe Simonis 6804085b8c [MERGE] forward port branch saas-11 up to b9374d5c21 2017-01-23 13:56:18 +01:00
Martin Trigaux ebda1abec4 [IMP] stripe: add receipt_email to the order
The email of the recipient must be specified in the charge.
The checkout.js prompt creates a token with the email specified as the name but
to get an email confirmation that the charge succeeded, the receipt_email
parameter must be set.

Side note: the receipt_email is not enough to send email confirmation, it must
also be enabled on Stripe dashboard that generated the access tokens.

Reference: https://support.stripe.com/questions/email-receipts

opw-697759
2017-01-19 13:34:58 +01:00
Christophe Simonis 7d4ac39c4c [MERGE] forward port branch saas-12 up to d853d3c 2016-11-24 18:35:42 +01:00
Christophe Simonis d853d3c00e [MERGE] forward port branch saas-11 up to 3f3c88b 2016-11-24 18:29:46 +01:00
Nicolas Martinelli 7e7205a7bf [FIX] payment_stripe: make it work
The module `payment_stripe` was apparently not designed to work with
module `website_payment`, althought the payment method is available. For
example:
- Go to '/my/home', select "Pay Now" on an invoice
- Try to pay with Stripe ==> nothing happens

This commit brings the necessary modifications to make it compatible
with `website_payment`. Moreover, it prevents the creation of 2
`payment.transactions`, which was not necessary.

opw-693421
2016-11-24 12:33:55 +01:00
Nicolas Martinelli 53281b5dbf [FIX] payment_stripe: tracebacks
Tracebacks due to key not present in dict, and inconsistent return of
the method.
2016-10-20 15:16:35 +02:00
Ravi Gohil 5bd4218454 [IMP] payment_payumoney, payment_stripe: set private fields accessible to employees only
In 8.0 private fields have been recently set as visible only to employees
at commit b226510840.

However between v9 and v10 two new payment acquirers have been implemented
payumoney and stripe. Those addons now have their credential set as private.

Methods using the acquirers have been sudoed accordingly to avoid access
issues when rendering the buttons. Other payment modules will be updated when
the forward port from 8 to 9 and pre-10-master will be done.
2016-09-06 12:39:33 +02:00
Thibault Delavallée 415eee1ca7 [CLN] payment_stripe: cleaning and guidelines
As this module is already in new API only small linting is performed.
2016-07-06 15:10:49 +02:00
Thibault Delavallée 86a51d28d0 [MOV] payment_stripe: file organization 2016-07-06 15:10:48 +02:00
Thibault Delavallée 88126f95d3 [REF] payment_*: method signatures
Methods with signature

 - cr, uid, id
 - cr, uid, <browse_record>

have been refactored to be future multi ensure one methods.
2016-07-06 11:47:39 +02:00
Daniel Dico 3cb64f517a [IMP] payment_stripe: better content
show logo, merchant name, description, currency and amount on the stripe
checkout page.

Add the field stripe_image_url to display the logo that was configured according
to https://stripe.com/docs/checkout
Do not use company logo as there is no guarantee on the image ratio.

Closes #12378
2016-06-20 15:59:18 +02:00
Joren Van Onder e3730cf1f2 [IMP] payment*,website: rename payment.method -> payment.token
payment.method was not a good name because it was too easy to confuse
with account.payment.method.
2016-06-17 13:09:18 +02:00
Joren Van Onder 101a9693b3 [FIX] payment*: fix invalid coding
-*- coding: utf-'8' "-*-"

is not a valid encoding. Introduced by
666387a274 I think. It was probably a
typo/replace gone bad and it got copy-pasted everywhere. Emacs complains
every time you try to save changes to files with this invalid encoding.

This changes all of them to

coding: utf-8

adhering to eae045949d.

Done with:

find . -name '*.py' -print0 |\
xargs -0 sed -ie 's/-\*- coding: utf-'"'"'8'"'"' "-\*-"/coding: utf-8/'
2016-06-17 13:09:18 +02:00
Martin Trigaux 33c094d218 [ADD] payment_stripe
https://stripe.com/docs/api

Closes #11587
2016-04-04 17:09:08 +02:00