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.

Include `payment_id` in `Payment::GatewayOptions#to_hash`

Damian Legawiec647ab3d24503
diff --git a/core/app/models/spree/payment/gateway_options.rb b/core/app/models/spree/payment/gateway_options.rb
index 73fa66b177..c943bb9508 100644
--- a/core/app/models/spree/payment/gateway_options.rb
+++ b/core/app/models/spree/payment/gateway_options.rb
@@ -30,6 +30,10 @@ module Spree
"#{order.number}-#{payment.number}"
end
+ def payment_id
+ payment.number
+ end
+
def shipping
order.ship_total * exchange_multiplier
end
@@ -61,6 +65,7 @@ module Spree
:customer_id,
:ip,
:order_id,
+ :payment_id,
:shipping,
:tax,
:subtotal,
diff --git a/core/spec/models/spree/payment/gateway_options_spec.rb b/core/spec/models/spree/payment/gateway_options_spec.rb
index 89ef7babaf..640b5b1ff9 100644
--- a/core/spec/models/spree/payment/gateway_options_spec.rb
+++ b/core/spec/models/spree/payment/gateway_options_spec.rb
@@ -56,6 +56,12 @@ RSpec.describe Spree::Payment::GatewayOptions, type: :model do
it { is_expected.to eq payment }
end
+ describe '#payment_id' do
+ subject { options.payment_id }
+
+ it { is_expected.to eq 'P1566' }
+ end
+
describe '#email' do
subject { options.email }
@@ -138,6 +144,7 @@ RSpec.describe Spree::Payment::GatewayOptions, type: :model do
customer_id: 144,
ip: '0.0.0.0',
order_id: 'R1444-P1566',
+ payment_id: 'P1566',
shipping: '1244'.to_d,
tax: '153'.to_d,
subtotal: '1511'.to_d,