Matt-Yorkley
886e03af2f
Merge pull request #7805 from Matt-Yorkley/adjustments-admin
...
[Adjustments] Admin adjustments
2021-07-27 12:23:29 +02:00
Matt-Yorkley
6daa37a5c0
Ensure TaxRateFinder returns an array if the given adjustment has no tax
2021-07-25 22:47:40 +01:00
Andy Brett
a58e0fe217
Merge pull request #7926 from luisramos0/rubocop_fix
...
Update Rubocop todo files
2021-07-14 10:05:54 -07:00
Luis Ramos
01fe6abeed
Result of rubocop -a, safe autocorrect
2021-07-13 22:38:05 +01:00
Matt-Yorkley
200dde18e8
Update admin adjustment taxes in OrderAdjustmentsFetcher spec
2021-07-09 21:49:36 +01:00
Matt-Yorkley
0876f2ae0d
Remove tax rate guessing from TaxRateFinder
...
🎉
2021-07-09 21:49:36 +01:00
Andy Brett
46cd05c54a
Merge pull request #7712 from guidoDutra/1861-enable-shopfront-sorting-by-producer
...
Enable sorting by producer in shopfront
2021-07-06 09:27:42 -07:00
Andy Brett
9b1da14380
mark payment failed after failed authorization
2021-06-29 11:54:51 -07:00
Pau Perez
1f3560e964
Pass in the order when it's already initialized
...
At `CapQuantity`'s instantiation time the proxy's order is not yet
initialized, and so `CapQuantity` was checking against nil all the time.
This went unnoticed because the job's specs were not integration-level
tests and were stubbing way too many things.
2021-06-23 13:47:42 +02:00
Pau Perez
648023750b
Move tests exercising the service to its spec file
...
These are bypassing the job to only test the service, so there's no
point on doing that. They can test the service alone.
2021-06-23 13:45:43 +02:00
Pau Perez
475474b179
Replace order reloads with association set up
2021-06-21 10:30:12 +02:00
Pau Perez
073c4bc1ae
Reload order so line items are visible in spec
2021-06-21 10:30:12 +02:00
Pau Perez
e052f36cc6
Rubocop -a
2021-06-21 10:30:12 +02:00
Pau Perez
827faef690
Fix call to #record_and_log_error
2021-06-21 10:30:12 +02:00
Pau Perez
b69aeae892
Rename PlaceOrder to PlaceProxyOrder
...
As discussed in
https://github.com/openfoodfoundation/openfoodnetwork/pull/7281#discussion_r650183813 .
2021-06-21 10:30:12 +02:00
Pau Perez
f92ca964db
Improve service name
...
As discussed in
https://github.com/openfoodfoundation/openfoodnetwork/pull/7281#discussion_r650069982 .
2021-06-21 10:30:12 +02:00
Pau Perez
f61cdb6608
Extract CapQuantityAndStoreChanges service
...
This is a responsiblity of its own that makes the job's tests really
complex.
2021-06-21 09:49:07 +02:00
Pau Perez
431f30bb52
Fix proxy_order.placed_at test and deal with time
...
Relying on Rails' `freeze_time` is much more reliable than this brittle
magic number. It turns out Timecop is not needed for this case anymore.
See
https://frontdeveloper.pl/2020/03/how-we-migrated-from-timecop-to-built-in-rails-5-2-time-helpers/ .
2021-06-21 09:47:49 +02:00
Pau Perez
fcb013eb2a
Extract subs placement job logic into new service
...
While doing that we pass stock changes to the service but we
lazy-evaluate them. This way we don't fetch all this data from DB when
it might not be used due to an early return.
Also, this makes it possible to save the stock-related logic for later.
Finally, when changing things to rely on `#initialize_order`'s boolean
return value I noticed though, that we were evaluating
`proxy_order.order` too early. When instantiating the service object it
won't exist yet.
2021-06-21 09:47:49 +02:00
Pau Pérez Fabregat
db993652c4
Merge branch 'master' into payment-states
2021-06-18 12:20:26 +02:00
Luis Ramos
e52937c113
Use rubocop auto correct to add frozen string literal to all files
...
This is an unsafe auto corection, we will need to trust our build here
2021-06-17 23:07:26 +01:00
Andy Brett
b41302d5d8
update state transitions for new requires_authorization state
2021-06-17 14:23:59 -07:00
Luis Ramos
23627c5453
Run rubocop -a (safe corrections) removing all exceptions so all possible fixes are applied
...
9290 issues fixed
2021-06-17 22:19:26 +01:00
Pau Pérez Fabregat
a8efbffca6
Merge pull request #7429 from Matt-Yorkley/adjustments-taxrate
...
[Adjustments] TaxRate changes
2021-06-17 11:51:01 +02:00
Guido Oliveira
baca89c575
allow select producers for ordering
2021-06-16 15:02:27 -03:00
Guido Oliveira
c5471fc25c
enable ordering shopfront by producer id
2021-06-16 15:02:27 -03:00
Andy Brett
d4e9c0afdc
spec TOS service object
2021-06-09 14:06:55 +10:00
Matt-Yorkley
76756923ba
Use non-legacy-tax example in paypal items spec
2021-06-06 20:20:41 +01:00
Matt-Yorkley
355837547e
Add test coverage for legacy additional taxes in OrderTaxAdjustmentsFetcher
...
OrderTaxAdjustmentsFetcher is used in various places to display the taxes on an order. This test validates that legacy taxes are still returned and displayed as normal.
2021-06-06 20:16:03 +01:00
Matt-Yorkley
510f74f654
Update OrderTaxAdjustmentsFetcher
...
Taxes on Enterprise Fees are now recorded in proper tax adjustments, so they don't need special treatment.
2021-06-06 20:16:03 +01:00
Matt-Yorkley
47e2976fd1
Update CartService specs
2021-06-04 17:10:50 +01:00
Matt-Yorkley
6e8fd3c3f8
Simplify CartService interface
...
There's only one place this method is called, and the "overwrite" argument is always explicitly true. It doesn't need to be there if it's mandatory.
2021-06-04 17:10:50 +01:00
Matt-Yorkley
03fc63ad14
Remove #order_update! from line item after_save callback
2021-06-04 17:10:50 +01:00
Matt-Yorkley
3dc3581e6b
Ensure Mail configs are applied when the app starts
...
Previously we only set these part-way through deployment, so the values could be out of sync between our ENV vars and Spree::Config (which itself is a mix of both cached values and database-persisted values).
2021-05-23 23:05:16 +01:00
Luis Ramos
b2e97fe1d2
Rename order.update! to order.update_order! and adjustment.update! to adjustment.update_adjustment!
2021-05-19 09:54:22 -07:00
Matt-Yorkley
8429da3d2a
Remove unused argument from ProcessPaymentIntent
2021-05-16 22:19:01 +01:00
Matt-Yorkley
381b0e78d5
Improve ProcessPaymentIntent specs
2021-05-16 20:14:14 +01:00
Matt-Yorkley
05ed98aa0c
Use :order_with_totals in ProcessPaymentIntent
...
If we just use the :order factory here, it has no line items and no total, which means when we try to push it into complete state, the #requires_payment? check fails because the order total is zero, which means the call to #process_payments is ignored
2021-05-16 20:11:45 +01:00
Matt-Yorkley
227bdd7d4c
Update ProcessPaymentIntent spec
2021-05-16 12:55:48 +01:00
Matt-Yorkley
99cf23df26
Merge pull request #7530 from Matt-Yorkley/email-after-commit
...
Email after commit
2021-05-12 21:22:55 +02:00
Pau Perez
9a63f38790
I18n-ize error messages.
2021-05-06 16:34:29 +02:00
Pau Perez
dea6a01e61
Handle SCA payments that can't complete
2021-05-06 16:19:01 +02:00
Pau Perez
2147584daf
Validate intents against Stripe and display errors
...
Now the existing validation is redundant. It's Stripe's API who does
that now. It's up to them to decide what's a valid intent.
2021-05-06 16:19:01 +02:00
Matt-Yorkley
4888f1cd06
Stub OrderPaymentFinder to return correct object
...
OrderPaymentFinder was re-fetching the payment object from the database, so the subsequent line that stubs #authorize! on that payment was not being applied to the correct object.
2021-05-03 14:17:54 +01:00
Matt-Yorkley
ab65b01fcf
Rename payments helper
2021-05-03 14:17:54 +01:00
Luis Ramos
279c15c306
Adapt spec to rails 5.2
2021-05-03 14:17:54 +01:00
Luis Ramos
aaf4710694
Fix cart_service_spec to adapt to the actual usage of it from cart_controller, params are now sent inside a Parameters object, not as a hash
2021-05-03 14:17:54 +01:00
Andy Brett
ea5f9c6747
Revert "Fix cart_service_spec to adapt to the actual usage of it from cart_controller, params are now sent inside a Parameters object, not as a hash"
...
This reverts commit bb465b5715 .
2021-05-03 14:17:54 +01:00
Matt-Yorkley
7c2d77a3ee
Fix assertion in ModelSet test
...
The mismatched use of hash attributes as strings and hash attributes as symbols here (attrs['name'] and attrs[:name]) meant that the conditional was not returning the expected results in the test.
2021-05-02 13:42:38 +01:00
Cillian O'Ruanaidh
c41476423b
Merge latest master into julesemmac/6584-map-location-confirm and resolve conflict in api/enterprises_controller.rb
2021-04-22 19:43:49 +01:00