Skip to content

armgit / spree

Public Imported from GitHub
0

Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.

Add `Payment#display_credit_allowed` and standarize money methods

Damian Legawiec0915ad96c7b9
diff --git a/core/app/models/spree/payment.rb b/core/app/models/spree/payment.rb
index 1461d303ec..054e44d722 100644
--- a/core/app/models/spree/payment.rb
+++ b/core/app/models/spree/payment.rb
@@ -10,6 +10,8 @@ module Spree
include Spree::Security::Payments
end
+ extend Spree::DisplayMoney
+
include Spree::Payment::Processing
include Spree::Payment::Webhooks
@@ -81,6 +83,9 @@ module Spree
delegate :currency, to: :order
+ money_methods :amount, :credit_allowed
+ alias money display_amount # for compatibility with older versions of Spree
+
# order state machine (see http://github.com/pluginaweek/state_machine/tree/master for details)
state_machine initial: :checkout do
# With card payments, happens before purchase or authorization happens
@@ -129,11 +134,6 @@ module Spree
payment_method.payment_source_class.unscoped { super }
end
- def money
- Spree::Money.new(amount, currency: currency)
- end
- alias display_amount money
-
def amount=(amount)
self[:amount] =
case amount