docbrown/config
Daniel Uber 0eb4e690ed
Validate payment info present before attempting to process (#15629)
* Add two guards when purchasing credits

This prevents sending an empty card to stripe, and avoids a
foreseeable error when purchasing 0 credits. Error returned from
stripe is "This value must be greater than or equal to 1".

* Move redirect back into action method

Only use validation methods to check input and set appropriate messages.

* Accept organization id if set

The payment service will use the organization id (and charge the
organization) when that's the purchaser. Don't fail when no stripe
token or card selected if an organization admin is purchasing credits.

* Move validation into the payment processing service

This cleans up the number of details the controller needs to worry
about

Now only if the process payment service had any tests...

* Prevent only organization_id from permitting purchase

and move this check to a method, with an intention revealing name

* Add i18n translation for error message

There weren't any service side error messages - this will be displayed
in a view (credits/purchase) but comes from the payment service -
other messages (from stripe) are passed through as-is there.

If this is the wrong _place_ for the translation I can retool.

* Add unit test for payment processing

Only checking errors are raised as expected and the internal error
message is translated.

* Leave translation alone

Revert test translation
2021-12-03 13:09:23 -06:00
..
environments Automatically run DUSs in development (#15489) 2021-11-24 12:32:13 -05:00
fastly/snippets Block more bots (#15626) 2021-12-01 13:06:28 -05:00
initializers Renaming method to reduce surprise (#15632) 2021-12-01 16:38:26 -05:00
locales Validate payment info present before attempting to process (#15629) 2021-12-03 13:09:23 -06:00
routes ✂✂✂ Remove Connect (#14734) 2021-11-18 08:21:00 -06:00
webpack Added the babel-inline-react-svg plugin (#15461) 2021-11-23 12:24:50 -05:00
application.rb Load any translation files in subdirectories (#15077) 2021-10-14 11:17:07 -05:00
blazer.yml Increase Blazer's timeout (#15427) 2021-11-18 14:50:18 -05:00
boot.rb Upgrade to Rails 6.0 (#7658) 2020-06-04 11:54:25 +02:00
cable.yml Upgrade Rails to 5.2.3 (#1408) 2019-04-03 13:08:59 -04:00
database.yml Update database config (#11308) 2021-02-23 17:41:34 -05:00
environment.rb Rails 6: enable zeitwerk autoloader (#8766) 2020-06-22 16:27:55 +02:00
field_test.yml Configurable weighted feed strategy (#15240) 2021-11-29 10:46:56 -05:00
i18n-tasks.yml Update i18n read_path to match our current localization file layout (#15140) 2021-10-20 12:50:22 -05:00
puma.rb Upgrade Rails to 6.1.3.1 (#11333) 2021-04-05 10:39:48 -04:00
routes.rb Remove Pusher route (#15426) 2021-11-18 14:04:06 -05:00
schedule.yml Add PGHero for more insights into the DB (#15073) 2021-11-05 12:25:02 -04:00
secrets.yml Initial commit 2018-02-28 16:11:08 -05:00
sidekiq.yml setup sidekiq queues for different priority jobs (#5300) [deploy] 2019-12-30 10:16:52 -06:00
spring.rb Upgrade Rails to 6.1.3.1 (#11333) 2021-04-05 10:39:48 -04:00
storage.yml Upgrade Rails to 5.2.3 (#1408) 2019-04-03 13:08:59 -04:00
webpacker.yml Moved from resolved_paths (deprecated) to additional_paths. (#9982) 2020-08-24 16:08:16 -04:00