Commit Graph
47 Commits
Author SHA1 Message Date
Lucas Perais (lpe) f5e145d2b9 [FIX] payment_stripe: regex to match so_ID
Before this commit, when paying a confirmed SO with the token access with Stripe,
Clicking on the button "pay now" wouldn't do anything, because the id of the SO couldn't be retrieved

After this commit, the regex that does just that is more generic and the flow works

OPW 1881192
closes #26884
2018-09-11 09:30:25 +02:00
Christophe Simonis 4c2bdafe69 [MERGE] forward port branch saas-15 up to e7ccf38c48 2018-08-08 18:42:27 +02:00
Nicolas Martinelli 6ded4d9ce8 [FIX] payment_stripe: disable button
- Create an order from the eCommerce
- Choose to pay with Stripe
- Enter the credit card info, validate

There is a short window of time (before the reload of the page) where
the user can click on 'Pay Now' again.

This is because the HTML is completely replaced, including the button.
We restore it when necessary.

opw-1866332
2018-08-08 14:18:17 +02:00
Adrien Peiffer (ACSONE) 31f3687124 [IMP] payment_stripe: Fill email on stripe modal to avoid retyping it
Purpose
=======

Currently, users have to retype email in the stripe payment popup.

For event registration, the email address must be typed 3 times (the first
for the registration information, the second for the billing information
and finally for the payment on the stripe popup)

Specifications
==============

As the email is already filled on billing information view, isn't
necessary to retype in the payment form.
2018-06-11 11:27:49 +02:00
tbe-odoo 4d905070f9 [FIX] payment: Unable to pay if character '/' in reference
- 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-03-02 14:18:47 +01:00
tbe-odoo 14081b848f [FIX] payment: Payment form not implemented on /website_payment/pay
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-02-20 15:36:56 +01:00
Christophe Simonis da19a7701e [MERGE] forward port branch saas-16 up to 23752102a0 2018-02-07 17:47:26 +01:00
Christophe Simonis 23752102a0 [MERGE] forward port branch saas-15 up to 830327c66a 2018-02-07 15:18:07 +01:00
Romain Derie 66e76d681d [FIX] payment_stripe: integer currencies (portal payment)
Before this commit:
On portal (My Account > Invoices > Pay Now), a stripe payment in a normal
currency (eg: a non integer currency) would debit the amount *100.
This comes from b335ae0348 which added a workflow to handle integer
currencies but it also sent the *100 amount to /website_payment/transaction
that would create a TX with that amount instead of the normal amount.

Now, the normal amount is correctly sent to the backend, the multiplied amount
is just sent to StripeCheckout handler to correctly display the amount on the
popup after clicking on "Pay Now".

Note: the amount will be multiplied on the backend independently ecda057e11
2018-02-07 13:59:33 +01:00
Nicolas Martinelli ad9edfc2dd [FIX] payment_stripe: missing route
In case an invoice is required to be paid thanks to the route
'/my/invoices/', the user is redirected to '/shop/payment/transaction/'.
If website_sale is not installed, this causes a crash.

Complement of 2bd17285ea

opw-813481
2018-02-02 09:17:30 +01:00
Nicolas Martinelli 4df087b24d [FIX] payment_stripe: incorrect route
The route should contain the SO id, not the acquier id.
2018-02-02 09:17:30 +01:00
fda-odoo eefe879a37 [MERGE] fix payment flow with acquirers in e-commerce, invoices and quotations
As some flows were broken, this set of fixs improve the different routes for all acquirers
See commit messages for more information

Thanks to @jpr-odoo for his first implementation and to @tde and @fgi
2018-01-25 13:12:25 +01:00
fda-odoo 2bd17285ea [FIX] payment_stripe: fix the 404 error and redirect on /my/orders page
Fix the 404 error with stripe on the page /my/orders if website_quote and website_sale aren't installed
2018-01-24 15:41:01 +01:00
Christophe Simonis 950d9b2369 [MERGE] forward port branch saas-16 up to dfe7f00e78 2018-01-22 16:38:01 +01:00
tbe-odoo dfe7f00e78 [FIX] stripe: Fix when no access token set
- When no access token is set, the stripe implementation uses a the access token the string 'undefined'.
2018-01-22 15:03:19 +01:00
Romain Derie cca12fbb08 [FIX] payment_stripe: route receive wrong currency parameter
This commit b335ae0348 previously sent currency instead of currency_id on
/website_payment/transaction route resulting in a cast error.

Now, we send the currency_id as the route expect

This closes #19468, closes #22165
2018-01-11 11:01:35 +01:00
Christophe Simonis b37cc1f9b7 [MERGE] forward port branch saas-16 up to a2ea4ba095 2017-12-12 18:39:43 +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
tbe-odoo 7c639be4aa [FIX] payment_stripe: fix stripe payment form
- Before this patch, stripe doesn't get displayed.
    It was a bug related to the fact that stripe doesn't respect how the generic payment form works.
    So to make it work, we were relying on small hacks that got broke by changes on the payment form.
    To fix the bug we are no longer adding an event to the pay button of the payment form, instead
    we listen all the changes made to the DOM and detect if a form with an attribute 'provider' set to
    'stripe' is added.
    If so, we open up the Stripe payment form.
- Fix ACL issue when trying to pay with Stripe on eCommerce without being logged.

Closes #20202
opw-776200
2017-10-27 11:45:25 +02: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 be650c5979 [IMP] Fixing the code to fit the reviews 2017-08-29 17:16:42 +02:00
tbe-odoo 7ce35e99b7 [IMP] payment_stripe: Retrieve access token on website_quote 2017-08-29 17:16:42 +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
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
Christophe Simonis 48b2ce60ed [MERGE] forward port branch saas-16 up to 85571bb78c 2017-08-10 17:01:05 +02:00
Nicolas Martinelli b335ae0348 [FIX] payment_stripe: integer currencies
The currencies with zero decimal should not be multiplied by 100. See
https://stripe.com/docs/currencies#zero-decimal

opw-760707
2017-08-02 11:02:36 +02:00
Thibault Delavallée dee9b5cf3c [REF] payment, website_sale: make payment_transaction js code generic
JS code managing transaction creation through acquirer 'Pay Now' form
button is improved in order to be less website-sale dependant. It now
takes parameters for access token and URL to call in Json. Class used
to bind JS is now o_payment_acquirer_button in order to be more generic.

eCommerce module is updated accordingly. Future commits will probably
make Online Quote (website_quote) use it.
2017-06-06 11:04:34 +02:00
Thibault Delavallée b5146643b5 [REF] website_(quote/sale), sale: move access_token in sale
Access token field is moved directly in sale module. Indeed future commits
will improve customer portal and access tokens will be used in other module
than website_quote. This commit already moves the field.

Moreover some strange code in website_sale already uses access_token even
if it does not exist in that module. Moving the field solves that issue.
Finally so_token defined in stripe is renamed to access_token to have the
same naming through all addons.
2017-06-06 11:04:29 +02:00
Goffin Simon 7d15a6e6d6 [FIX] payment_stripe: handler.open in deferred
As explained in https://stripe.com/docs/checkout#integration-more-runloop
the function handler.open cannot be called in a deferred because it can
block in some browser.

opw:726101
2017-04-24 23:04:52 +02: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
Christophe Simonis 63860373ac [MERGE] forward port branch saas-11 up to c19f546 2016-11-08 14:43:28 +01:00
Nicolas Martinelli 83d1bb8df2 [FIX] payment_stripe, website_quote, website_sale: update SO
! This is a backport from 10.0 (9010ed0a) !

opw-693017

Original commit message:

A side effect of commit b9d1239eff if that the method `sale_get_order`,
which is used to retrieve the SO, will also update information on this
SO (change partner, change pricelist...). We therefore need another way
to retrieve the SO.

opw-692919
2016-11-03 12:58:02 -07:00
Nicolas Martinelli c54dbe2a92 [FIX] payment_stripe: select correct div when web quote
! This is a backport from 10.0 (815f085) !

opw-693017

Original commit message:

When a user tries to pay a website quote thanks to Stripe, the button
spins and nothing happens.

In the case of a quote, the jQuery selector is not correct.

opw-692341
2016-11-03 12:57:58 -07:00
Nicolas Martinelli ab609ec4a5 [FIX] payment_stripe: preventDefault
! This is a back-port from 10.0 (fb010a1) !

opw-693017

Original commit message:

When a user uses Strip and clicks on "Pay & Confirm", a "Bad Request"
error can pop-up. This is because it tries to reload the page, while it
should only display the Strip pop-up.

This is simply due to a `preventDefault` done after the event is
performed, and not before.

opw-692341
2016-11-03 12:57:46 -07:00
Nicolas Martinelli 9010ed0a35 [FIX] payment_stripe, website_quote, website_sale: update SO
A side effect of commit b9d1239eff if that the method `sale_get_order`,
which is used to retrieve the SO, will also update information on this
SO (change partner, change pricelist...). We therefore need another way
to retrieve the SO.

opw-692919
2016-11-03 12:03:22 +01:00
Nicolas Martinelli fb010a1004 [FIX] payment_stripe: preventDefault
When a user uses Strip and clicks on "Pay & Confirm", a "Bad Request"
error can pop-up. This is because it tries to reload the page, while it
should only display the Strip pop-up.

This is simply due to a `preventDefault` done after the event is
performed, and not before.

opw-692341
2016-10-28 11:33:35 +02:00
Nicolas Martinelli 815f0853c8 [FIX] payment_stripe: select correct div when web quote
When a user tries to pay a website quote thanks to Stripe, the button
spins and nothing happens.

In the case of a quote, the jQuery selector is not correct.

opw-692341
2016-10-28 11:31:33 +02:00
Fabien Pinckaers c5eefb3c7f [IMP] payment*: better acquirer kanban cards and logos 2016-07-20 16:11:18 -07:00
Christophe Simonis da53a27a5d [MERGE] forward port of branch saas-11 up to c88c70e 2016-06-21 16:24:38 +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
Martin Trigaux da82a6b705 [FIX] payment_stripe: correctly compute reference number
As explained in 15f27b26, the transaction information should be computed when
hitting the "pay now" button, not at page rendering (e.g. in case of users going
back to previous page).

Stripe do not work as typical providers as it does not redirect to the provider
page but opens a popup.
The route /shop/payment/transaction/<id> needs to be called manually.
2016-06-20 12:31:06 +02:00
Joren Van Onder 2d0053a80a [FIX] payment_stripe: support payments through website_quote
Contrary to other payment acquirers all transactions through stripe are
s2s transactions. Because of this payment_stripe has to create it's own
payment.transactions which is unusual.

Because of this payment_stripe needs a sale order id which will be
provided by website_sale in request.session. website_quote doesn't do
this so this extracts it from the return_url, just like
website_quotation.js does.

opw-678117
2016-05-30 13:42:04 +02:00
Martin Trigaux 33c094d218 [ADD] payment_stripe
https://stripe.com/docs/api

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