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.
Ruby b2b-commercee-commerceecommerceecommerce-apiecommerce-frameworkecommerce-platformheadlessheadless-commerceheadless-ecommercemarketplacemulti-tenantmulti-vendormulti-vendor-ecommerceopen-sourcespree-commerce
Added `Refund#return_items` and `Refund#refunder`
Damian Legawiecb2c8574311f1
diff --git a/core/app/models/spree/refund.rb b/core/app/models/spree/refund.rbindex b980c55149..e8b40627f2 100644--- a/core/app/models/spree/refund.rb+++ b/core/app/models/spree/refund.rb@@ -13,6 +13,7 @@ module Spreebelongs_to :reimbursement, optional: trueendbelongs_to :reason, class_name: 'Spree::RefundReason', foreign_key: :refund_reason_id+ belongs_to :refunder, class_name: Spree.admin_user_class.to_s, optional: truehas_many :log_entries, as: :source@@ -31,8 +32,10 @@ module Spreeattr_reader :response+ delegate :order, :currency, to: :payment+def money- Spree::Money.new(amount, currency: payment.currency)+ Spree::Money.new(amount, currency: currency)endalias display_amount money@@ -46,6 +49,15 @@ module Spreepayment.payment_method.nameend+ # return items for the refund+ #+ # @return [Array<Spree::ReturnItem>]+ def return_items+ return [] unless reimbursement.present?++ reimbursement.customer_return&.return_items || reimbursement.return_items+ end+private# attempts to perform the refund.@@ -53,7 +65,7 @@ module Spreedef perform!return true if transaction_id.present?- credit_cents = Spree::Money.new(amount.to_f, currency: payment.currency).amount_in_cents+ credit_cents = Spree::Money.new(amount.to_f, currency: currency).amount_in_cents@response = process!(credit_cents)