16 Commits

Author SHA1 Message Date
David Rodríguez
852e7fa81e Fix all existing prettier issues 2025-10-22 15:30:36 +02:00
Jean-Baptiste Bellet
7320a1714c Instead of selecting the controller, send an event handled by stripe-cards
Using a query selector to find controller in order to call method could be dangerous as the DOM can change. Using an event should be more robust.
2023-01-18 17:40:17 +01:00
Jean-Baptiste Bellet
2d86e8857a Put payment method description just above the
+ update spec by adding `data-paymentmethod-id` attribute
2022-12-28 15:21:29 +01:00
Jean-Baptiste Bellet
61928cbc05 Run prettier formatter 2022-08-08 14:40:58 +10:00
Matt-Yorkley
dd23e3d38a Simplify payment method controller 2021-12-20 18:47:22 +00:00
Matt-Yorkley
b4dab46cf8 Remove unused code for changing required attributes 2021-12-20 18:36:28 +00:00
Matt-Yorkley
723d6489cd Extract initSelectedCard() 2021-12-20 18:36:26 +00:00
Matt-Yorkley
9525e353a3 Don't try to select a card if there is no select element
This error was being thrown when the user had no cards saved:
```
TypeError: stripeCardsController is null
```
2021-12-20 18:36:09 +00:00
Jean-Baptiste Bellet
2c5667ef56 Initialize stripe-cards controller when selecting a payment method 2021-12-20 15:34:58 +01:00
Jean-Baptiste Bellet
7b6aa99de2 Handle when input is already checked
ie. user hasn't click on anything
2021-12-20 15:34:58 +01:00
Jean-Baptiste Bellet
fd5ad7566a Disabled all form elements that should not be sent to the controller 2021-12-07 16:27:22 +00:00
Jean-Baptiste Bellet
f7662947dc Extract to a method that handle all the form elements 2021-12-07 16:27:22 +00:00
Jean-Baptiste Bellet
5f3ea6accb Do not init by hidden all the container
that allow to init the content without clicking on anything
2021-12-07 16:27:22 +00:00
Jean-Baptiste Bellet
7159cc3ff1 Handle required attribute on input for PaymentMethod controller
This is done for one reason : do not submit form with required attribute on input that are actually hidden ; this is not handle correctly by browsers.

This idea here is to add/remove the required attribute on each input if the form is visible or not.
2021-12-07 16:27:22 +00:00
Jean-Baptiste Bellet
3063b041d1 Change the paymentmethod controller to handle both desc and form
Add tests as well

Update _payment.html.haml

Update _payment.html.haml
2021-12-07 16:23:39 +00:00
Jean-Baptiste Bellet
57d7191332 Add new step, second one: payment method
Add payment method form

- select the right form depending on the path
2021-07-26 15:47:36 +02:00