Add transaction origin for internal credit payments

This commit is contained in:
Gaetan Craig-Riou
2026-03-06 13:26:30 +11:00
parent 6a99d2a3c8
commit 7790259c27
3 changed files with 4 additions and 32 deletions

View File

@@ -43,9 +43,8 @@ RSpec.describe Spree::PaymentMethod::CustomerCredit do
transaction = customer.customer_account_transactions.last
expect(transaction.amount).to eq(-10.00)
expect(transaction.payment_method).to be_a(Spree::PaymentMethod::CustomerCredit)
expect(transaction.payment).to eq(payment)
expect(transaction.description).to eq("Payment for order: R023075164")
expect(transaction.description).to eq("Customer credit: Payment for order: R023075164")
end
context "when not enough credit is available" do
@@ -95,15 +94,6 @@ RSpec.describe Spree::PaymentMethod::CustomerCredit do
expect(response.message).to eq("Missing payment")
end
end
context "when credit payment method is not configured" do
let!(:credit_payment_method) { nil }
it "returns an error" do
expect(response.success?).to be(false)
expect(response.message).to eq("Credit payment method is missing")
end
end
end
describe "#void" do
@@ -131,9 +121,8 @@ RSpec.describe Spree::PaymentMethod::CustomerCredit do
transaction = customer.customer_account_transactions.last
expect(transaction.amount).to eq(15.00)
expect(transaction.payment_method).to be_a(Spree::PaymentMethod::CustomerCredit)
expect(transaction.payment).to eq(payment)
expect(transaction.description).to eq("Refund for order: R023075164")
expect(transaction.description).to eq("Customer credit: Refund for order: R023075164")
end
context "when user_id provided" do
@@ -182,14 +171,5 @@ RSpec.describe Spree::PaymentMethod::CustomerCredit do
expect(response.message).to eq("Missing payment")
end
end
context "when credit payment method is not configured" do
let!(:credit_payment_method) { nil }
it "returns an error" do
expect(response.success?).to be(false)
expect(response.message).to eq("Credit payment method is missing")
end
end
end
end