-
Notifications
You must be signed in to change notification settings - Fork 439
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #331 from spark-solutions/fix/zeiwerk-fixes
Fix decorators to work with Rails 6.0 and Zeitwerk autoloader
- Loading branch information
Showing
6 changed files
with
35 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
module Spree | ||
module ApplePayOrderDecorator | ||
def confirmation_required? | ||
return false if paid_with_apple_pay? | ||
|
||
# Little hacky fix for #4117 | ||
# If this wasn't here, order would transition to address state on confirm failure | ||
# because there would be no valid payments any more. | ||
Spree::Config[:always_include_confirm_step] || | ||
payments.valid.map(&:payment_method).compact.any?(&:payment_profiles_supported?) || | ||
confirm? | ||
end | ||
|
||
def paid_with_apple_pay? | ||
payments.valid.any?(&:apple_pay?) | ||
end | ||
end | ||
end | ||
|
||
Spree::Order.prepend Spree::ApplePayOrderDecorator |
4 changes: 2 additions & 2 deletions
4
app/models/spree/payment_decorator.rb → ...dels/spree/apple_pay_payment_decorator.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
module SpreeGateway | ||
module Spree | ||
module ApplePayPaymentDecorator | ||
def apple_pay? | ||
payment_method.is_a? Spree::Gateway::StripeApplePayGateway | ||
end | ||
end | ||
end | ||
|
||
Spree::Payment.prepend SpreeGateway::ApplePayPaymentDecorator | ||
Spree::Payment.prepend Spree::ApplePayPaymentDecorator |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters