mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-27 21:06:49 +00:00
Merge pull request #7110 from Matt-Yorkley/payment-capture-error
Fix payment capture handling in Api::OrdersController
This commit is contained in:
@@ -47,7 +47,7 @@ module Api
|
||||
private
|
||||
|
||||
def payment_capture_failed
|
||||
render json: { error: t(:payment_processing_failed) }, status: :unprocessable_entity
|
||||
render json: { error: I18n.t(:payment_processing_failed) }, status: :unprocessable_entity
|
||||
end
|
||||
|
||||
def serialized_orders(orders)
|
||||
|
||||
@@ -285,6 +285,18 @@ module Api
|
||||
expect(order.reload.pending_payments.empty?).to be true
|
||||
expect_order
|
||||
end
|
||||
|
||||
context "when payment is not required" do
|
||||
before do
|
||||
allow_any_instance_of(Spree::Order).to receive(:payment_required?) { false }
|
||||
end
|
||||
|
||||
it "returns an error" do
|
||||
put :capture, params: { id: order.number }
|
||||
|
||||
expect(json_response['error']).to eq I18n.t(:payment_processing_failed)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe "#ship" do
|
||||
|
||||
Reference in New Issue
Block a user