feat(payments): add order number to webhook payload

Include the order number in the webhook payload so consumers can
identify which order a payment notification belongs to.

Fixes #13858
This commit is contained in:
Matt Van Horn
2026-03-18 00:12:23 -07:00
parent 939ae20081
commit 544f62dbc5
2 changed files with 4 additions and 1 deletions

View File

@@ -13,7 +13,7 @@ module Payments
payment: @payment.slice(:updated_at, :amount, :state),
enterprise: @enterprise.slice(:abn, :acn, :name)
.merge(address: @enterprise.address.slice(:address1, :address2, :city, :zipcode)),
order: @order.slice(:total, :currency).merge(line_items: line_items)
order: @order.slice(:number, :total, :currency).merge(line_items: line_items)
}.with_indifferent_access
end
@@ -31,6 +31,7 @@ module Payments
def self.test_order
order = Spree::Order.new(
number: "R555555555",
total: 0.00,
currency: "AUD",
)

View File

@@ -42,6 +42,7 @@ RSpec.describe Payments::WebhookPayload do
}
},
order: {
number: order.number,
total: order.total,
currency: order.currency,
line_items: line_items
@@ -72,6 +73,7 @@ RSpec.describe Payments::WebhookPayload do
}
},
order: {
number: "R555555555",
total: 0.00,
currency: "AUD",
line_items: [