Matt-Yorkley
74f27544f7
Merge pull request #7647 from andrewpbrett/default-country-codes
...
Use correct default country code
2021-05-25 11:21:34 +02:00
Luis Ramos
a1ac4e85ed
Replace update_attributes with update
2021-05-19 09:54:25 -07:00
Luis Ramos
341f6c9f62
Now that adjustment.update! has been renamed to adjustment.update_adjustment! we can use AR's update! on adjustment
2021-05-19 09:54:25 -07: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
Andy Brett
7df2915fbd
add DefaultCountry service
2021-05-18 12:44:53 -07:00
Matt-Yorkley
5dd24623f7
Merge pull request #7479 from Matt-Yorkley/payment-callbacks
...
Update Payment after_save callback
2021-05-18 16:19:29 +02:00
Matt-Yorkley
a2862e604c
Find relevant payment that matches the payment intent, not the last payment
2021-05-16 23:00:31 +01:00
Matt-Yorkley
81aac442f2
Improve conditional in raise_if_not_in_capture_state
2021-05-16 20:11:45 +01:00
Matt-Yorkley
e686a4f627
Move raising of errors when payment intent state != "requires_capture" out of PaymentIntentValidator service
...
When we're fetching the payment intent via PaymentIntentValidator in StripeSCA#purhcase (to capture it), we want it to fail loudly if it's not in "requires_capture" state. We're now also re-using the same PaymentIntentValidator service to check if payment processing was *successful*, in which case we need it *not* to fail loudly if the state == "succeeded", eg != "requires_capture".
2021-05-16 12:19:04 +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
69b91ea136
Wait until the end to mark payment as processed
...
This gives us the opportunity to retry the operation in case the
processing fails.
2021-05-06 16:19:01 +02:00
Andy Brett
a7331efd67
Merge pull request #7477 from luisramos0/require_dependency
...
Remove require_dependency or use require
2021-05-05 13:24:19 -07:00
Andy Brett
82845e1cfc
Merge pull request #7528 from Matt-Yorkley/has_many_through
...
Reorder has_many relationship with :through option
2021-05-05 08:08:15 -07:00
Andy Brett
3e714b1539
Merge pull request #7527 from Matt-Yorkley/dead-code-deleted
...
Remove #deleted? method from Product and Variant
2021-05-05 08:07:39 -07:00
Andy Brett
002420304d
Merge pull request #7526 from Matt-Yorkley/dead-currency
...
Remove currency from OrderContents
2021-05-05 08:06:53 -07:00
Matt-Yorkley
00c4a28d22
Extract order-updating logic to Order::Updater
2021-05-04 16:40:10 +01:00
Matt-Yorkley
135a311c05
Update void payments
...
Backport from Spree 2.4 stable: 4121992398
2021-05-04 16:40:10 +01:00
Matt-Yorkley
13bb5aa8dd
Update Payment after_save callback
...
Backport from Spree 2.4 stable: 4d652a77fd
2021-05-04 16:40:09 +01:00
Matt-Yorkley
a645b8c58f
Re-apply previous 5.2 commit: Don't reload payments in after_save callback
...
This causes issues in master, but is needed in the 5.2 branch.
2021-05-03 14:17:54 +01:00
Matt-Yorkley
1de68d091a
Update guard clause in line item callbacks (take two)
...
The `changed?` method is more accurately replaced by `saved_changes.present?`
In some cases here (where the object had just been saved for the first time) the guard clause was still stopping execution unexpectedly.
2021-05-03 14:17:54 +01:00
Matt-Yorkley
ac53df37d9
Fix callback in LineItem
...
#changed? here was not working as before, and the code was never getting past this guard in various places where previously it did. This meant the callback was effectively disabled, and order.update! was not being called when it should be.
2021-05-03 14:17:54 +01:00
Andy Brett
705666ecd0
fix /spec/models/spree/credit_card_spec.rb:301
2021-05-03 14:17:54 +01:00
Andy Brett
d255ca22f5
use new attribute_changed method for taxons take 2
2021-05-03 14:17:54 +01:00
Andy Brett
52525dc437
Fix /spec/models/spree/product_spec.rb:118
2021-05-03 14:17:54 +01:00
Andy Brett
d381b2a544
Use saved_change_to prefix to check for changes
2021-05-03 14:17:54 +01:00
Luis Ramos
c08bc743d3
Replace usage of changed? with saved_change_to_
2021-05-03 14:17:54 +01:00
Matt-Yorkley
2560757ea2
Change Enterprise after_create callback to after_create_commit
...
As a general rule, if you're triggering an email job as part of an after create/save callback, it should use after commit instead.
Why? The transaction can't finish until after the record is persisted (the data is committed) which includes the logic in all callbacks. So for example if the transaction fails after the email job has been placed it will be rolled back, but the email job will already be in the queue, and it'll be referencing a record that doesn't actually exist (due to the rollback).
2021-05-02 13:23:31 +01:00
Matt-Yorkley
9d23c0d9e2
Reorder has_many relationship with :through option
...
If it's using :through it should be defined after the relationship it's connected to
2021-05-01 16:20:36 +01:00
Matt-Yorkley
7948c5943d
Remove #deleted? method from Product and Variant
...
This method is already supplied via the paranoia gem, there's no need to re-implement it here.
2021-05-01 12:54:33 +01:00
Matt-Yorkley
2eb17dbbd1
Remove currency from OrderContents
...
The currency argument here is not actually used anywhere. The related conditional logic is also not covered in any tests.
2021-05-01 11:10:51 +01:00
Andy Brett
8ba139c6fb
Merge pull request #6825 from julesemmac/6584-map-location-confirm
...
6584 map location confirm
2021-04-29 14:04:06 -07:00
Andy Brett
699f1c4f41
Merge pull request #7497 from andrewpbrett/fix-double-stripe-payments
...
Use capture! if payment is already authorized
2021-04-29 08:35:19 -07:00
Matt-Yorkley
2f49d089ea
Use Time.zone.now
2021-04-29 08:56:17 +01:00
Matt-Yorkley
290c1d0ebf
Bring in shipment state updating from Spree 2.2
2021-04-28 21:43:28 +01:00
Andy Brett
73e5fd3f5b
use method to clarify intent on payment intents
2021-04-28 10:43:06 -07:00
Andy Brett
9906afa1a6
use capture! if payment is already authorized
2021-04-27 17:59:03 -07:00
Matt-Yorkley
1d29e277f2
Merge pull request #7493 from Matt-Yorkley/order-states-bug-redux
...
Reload order before updating in Payment callback
2021-04-27 17:43:34 +02:00
Matt-Yorkley
22f79fe540
Reload order before updating in Payment callback
2021-04-27 14:27:35 +01:00
Matt-Yorkley
574d78403d
Merge pull request #7433 from coopdevs/raise-on-failed-customer-creation
...
Notify Bugsnag if customer fails to be created
2021-04-27 12:42:39 +02:00
Pau Perez
ee01b0162c
Write if as a one-liner and avoid extra queries
2021-04-26 12:39:03 +02:00
Pau Perez
c65d82be01
Notify Bugsnag if customer fails to be created
...
This will hopefully let us see in Bugsnag when #6038 happens and so
we'll have all the diagnostics data. The fact that the `order.distributor`
is optional but mandatory to create the customer already gives us some
clue.
2021-04-26 10:15:12 +02:00
Luis Ramos
f357c3ff30
Remove require_dependency or use require
...
See here https://edgeguides.rubyonrails.org/upgrading_ruby_on_rails.html#require-dependency
2021-04-23 19:20:25 +01:00
Matt-Yorkley
4938285dd7
Move order query methods to chainable scopes
2021-04-23 10:29:48 +01:00
Matt-Yorkley
caee2eb3e9
Remove dead code in order
...
These aren't used anywhere
2021-04-23 10:23:40 +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
Pau Pérez Fabregat
c1da97527a
Merge pull request #7420 from Matt-Yorkley/adjustments-controller
...
Adjustments controller index
2021-04-22 19:15:28 +02:00
Matt-Yorkley
bef3f8c51f
Merge pull request #7452 from Matt-Yorkley/adjustments-permissions
...
Update CanCan permissions on adjustments
2021-04-22 18:07:18 +02:00
Matt-Yorkley
6dc23804a1
Merge pull request #7425 from mkllnk/application-record
...
Add ApplicationRecord for customisations of models
2021-04-21 23:18:03 +02:00
Matt-Yorkley
ecd433b343
Update permissions on adjustments
...
The previous permissions assumed that an adjustment's "adjustable" could only be only line items or orders, and that's no longer true. It's now commonly a shipment or a payment as well.
2021-04-21 18:17:20 +01:00
Pau Pérez Fabregat
87624f4c9f
Merge pull request #7416 from coopdevs/remove-old-balance-implementation
...
Remove old balance implementation
2021-04-20 08:51:27 +02:00