Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] account_payment: success url #33404

Closed

Conversation

Projects
None yet
3 participants
@nim-odoo
Copy link
Contributor

commented May 15, 2019

  • Activate online payment of invoices
  • Activate and configure Stripe
  • Create an invoice, access it through the portal
  • Pay it with Stripe

The user is redirected to /my instead of /my/invoices/<id>.

The root cause is because Stripe creates 2 transactions, the second
being created at:

ajax.jsonRpc(payment_tx_url, 'call', {

This second transaction, which is used to record the payment, doesn't
contain the appropriate success_url.

The best fix would probably be to either:

  • prevent the creation of the second transaction by refactoring
    stripe.js
  • pass the appropriate success_url to the stripe_form template
  • reuse existing draft transactions instead of creating a new one

None of these solutions is really suitable for stable since it might
require some heavy modification. However, a simple workaround is to
change the fallback success_urlsince we have all the necessary information
to build it.

opw-1997283

Description of the issue/feature this PR addresses:

Current behavior before PR:

Desired behavior after PR is merged:

--
I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr

[FIX] account_payment: success url
- Activate online payment of invoices
- Activate and configure Stripe
- Create an invoice, access it through the portal
- Pay it with Stripe

The user is redirected to `/my` instead of `/my/invoices/<id>`.

The root cause is because Stripe creates 2 transactions, the second
being created at:

https://github.com/odoo/odoo/blob/43295c2a3741fb98f9c5d1a506652442efed0a82/addons/payment_stripe/static/src/js/stripe.js#L108

This second transaction, which is used to record the payment, doesn't
contain the appropriate `success_url`.

The best fix would probably be to either:
- prevent the creation of the second transaction by refactoring
  `stripe.js`
- pass the appropriate `success_url` to the `stripe_form` template
- reuse existing draft transactions instead of creating a new one

None of these solutions is really suitable for stable since it might
require some heavy modification. However, a simple workaround is to
change the fallback `success_url`since we have all the necessary information
to build it.

opw-1997283

@robodoo robodoo added the seen 🙂 label May 15, 2019

@C3POdoo C3POdoo added the OE label May 15, 2019

@robodoo robodoo added the CI 🤖 label May 15, 2019

@nim-odoo

This comment has been minimized.

Copy link
Contributor Author

commented May 16, 2019

robodoo r+

@nim-odoo nim-odoo self-assigned this May 16, 2019

@robodoo robodoo added the r+ 👌 label May 16, 2019

robodoo pushed a commit that referenced this pull request May 16, 2019

[FIX] account_payment: success url
- Activate online payment of invoices
- Activate and configure Stripe
- Create an invoice, access it through the portal
- Pay it with Stripe

The user is redirected to `/my` instead of `/my/invoices/<id>`.

The root cause is because Stripe creates 2 transactions, the second
being created at:

https://github.com/odoo/odoo/blob/43295c2a3741fb98f9c5d1a506652442efed0a82/addons/payment_stripe/static/src/js/stripe.js#L108

This second transaction, which is used to record the payment, doesn't
contain the appropriate `success_url`.

The best fix would probably be to either:
- prevent the creation of the second transaction by refactoring
`stripe.js`
- pass the appropriate `success_url` to the `stripe_form` template
- reuse existing draft transactions instead of creating a new one

None of these solutions is really suitable for stable since it might
require some heavy modification. However, a simple workaround is to
change the fallback `success_url`since we have all the necessary information
to build it.

opw-1997283

closes #33404

Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
@robodoo

This comment has been minimized.

Copy link
Contributor

commented May 16, 2019

Merged, thanks!

@robodoo robodoo closed this May 16, 2019

@nim-odoo nim-odoo deleted the odoo-dev:12.0-opw-1997283-success_url-nim branch May 16, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.