solidus_six_saferpay 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/assets/javascripts/solidus_six_saferpay/saferpay_payment.js +4 -1
- data/app/controllers/spree/solidus_six_saferpay/checkout_controller.rb +93 -16
- data/app/controllers/spree/solidus_six_saferpay/transaction/checkout_controller.rb +1 -1
- data/app/models/spree/payment_method/saferpay_payment_method.rb +1 -1
- data/app/models/spree/payment_method/saferpay_payment_page.rb +2 -2
- data/app/models/spree/payment_method/saferpay_transaction.rb +2 -2
- data/app/services/spree/solidus_six_saferpay/cancel_authorized_payment.rb +33 -0
- data/app/services/spree/solidus_six_saferpay/initialize_payment.rb +0 -1
- data/app/services/spree/solidus_six_saferpay/initialize_transaction.rb +0 -1
- data/app/services/spree/solidus_six_saferpay/inquire_payment.rb +26 -1
- data/app/views/spree/checkout/payment/_saferpay_payment.html.erb +2 -2
- data/app/views/spree/solidus_six_saferpay/checkout/{iframe_breakout_redirect.html.erb → iframe_breakout_redirect.erb} +1 -1
- data/config/locales/de.yml +3 -0
- data/config/locales/en.yml +3 -0
- data/config/locales/fr.yml +3 -0
- data/config/routes.rb +2 -2
- data/lib/solidus_six_saferpay/configuration.rb +2 -0
- data/lib/solidus_six_saferpay/gateway.rb +6 -7
- data/lib/solidus_six_saferpay/version.rb +1 -1
- data/spec/controllers/spree/solidus_six_saferpay/payment_page/checkout_controller_spec.rb +8 -198
- data/spec/controllers/spree/solidus_six_saferpay/transaction/checkout_controller_spec.rb +8 -221
- data/spec/services/spree/solidus_six_saferpay/assert_payment_page_spec.rb +2 -128
- data/spec/services/spree/solidus_six_saferpay/authorize_transaction_spec.rb +3 -127
- data/spec/services/spree/solidus_six_saferpay/cancel_authorized_payment_spec.rb +58 -0
- data/spec/services/spree/solidus_six_saferpay/initialize_payment_page_spec.rb +0 -2
- data/spec/services/spree/solidus_six_saferpay/initialize_transaction_spec.rb +0 -1
- data/spec/services/spree/solidus_six_saferpay/inquire_payment_page_payment_spec.rb +2 -98
- data/spec/services/spree/solidus_six_saferpay/inquire_transaction_payment_spec.rb +2 -98
- data/spec/services/spree/solidus_six_saferpay/process_payment_page_payment_spec.rb +1 -206
- data/spec/services/spree/solidus_six_saferpay/process_transaction_payment_spec.rb +1 -200
- data/spec/support/shared_examples/authorize_payment.rb +132 -0
- data/spec/support/shared_examples/checkout_controller.rb +342 -0
- data/spec/support/shared_examples/inquire_payment.rb +118 -0
- data/spec/support/shared_examples/process_authorized_payment.rb +202 -0
- metadata +14 -6
- data/app/services/spree/solidus_six_saferpay/inquire_transaction.rb +0 -7
- data/spec/controllers/spree/solidus_six_saferpay/checkout_controller_spec.rb +0 -41
@@ -1,206 +1,16 @@
|
|
1
1
|
require 'rails_helper'
|
2
2
|
|
3
|
-
|
4
|
-
|
3
|
+
module Spree
|
4
|
+
module SolidusSixSaferpay
|
5
|
+
RSpec.describe PaymentPage::CheckoutController do
|
5
6
|
|
6
|
-
|
7
|
-
|
8
|
-
|
7
|
+
let(:initialize_payment_service_class) { InitializePaymentPage }
|
8
|
+
let(:authorize_payment_service_class) { AssertPaymentPage }
|
9
|
+
let(:process_authorization_service_class) { ProcessPaymentPagePayment }
|
10
|
+
let(:inquire_payment_service_class) { InquirePaymentPagePayment }
|
9
11
|
|
10
|
-
|
12
|
+
it_behaves_like "checkout_controller"
|
11
13
|
|
12
|
-
before do
|
13
|
-
allow(controller).to receive_messages try_spree_current_user: user
|
14
|
-
allow(controller).to receive_messages current_order: order
|
15
|
-
end
|
16
|
-
|
17
|
-
describe 'GET init' do
|
18
|
-
let(:success) { false }
|
19
|
-
let(:redirect_url) { '/saferpay/redirect/url' }
|
20
|
-
let(:initialized_payment) { instance_double("Spree::SolidusSixSaferpay::InitializePaymentPage", success?: success, redirect_url: redirect_url) }
|
21
|
-
|
22
|
-
it 'tries to the saferpay payment' do
|
23
|
-
expect(Spree::SolidusSixSaferpay::InitializePaymentPage).to receive(:call).with(order, payment_method).and_return(initialized_payment)
|
24
|
-
|
25
|
-
get :init, params: { payment_method_id: payment_method.id }
|
26
|
-
end
|
27
|
-
|
28
|
-
|
29
|
-
context 'when payment initialize succeeds' do
|
30
|
-
let(:success) { true }
|
31
|
-
|
32
|
-
before do
|
33
|
-
allow(Spree::SolidusSixSaferpay::InitializePaymentPage).to receive(:call).with(order, payment_method).and_return(initialized_payment)
|
34
|
-
end
|
35
|
-
|
36
|
-
it 'returns the redirect_url' do
|
37
|
-
get :init, params: { payment_method_id: payment_method.id }
|
38
|
-
|
39
|
-
body = JSON.parse(response.body)
|
40
|
-
expect(body["redirect_url"]).to eq(redirect_url)
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
context 'when payment initialize fails' do
|
45
|
-
let(:success) { false }
|
46
|
-
|
47
|
-
before do
|
48
|
-
allow(Spree::SolidusSixSaferpay::InitializePaymentPage).to receive(:call).with(order, payment_method).and_return(initialized_payment)
|
49
|
-
end
|
50
|
-
|
51
|
-
it 'returns an error' do
|
52
|
-
get :init, params: { payment_method_id: payment_method.id }
|
53
|
-
|
54
|
-
expect(response.body).to match(/errors/)
|
55
|
-
expect(response.status).to eq(422)
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
end
|
60
|
-
|
61
|
-
describe 'GET success' do
|
62
|
-
context 'when the order is not found' do
|
63
|
-
let(:order) { nil }
|
64
|
-
|
65
|
-
it 'redirects to the cart page via iframe breakout' do
|
66
|
-
get :success, params: { order_number: "not_found" }
|
67
|
-
expect(assigns(:redirect_path)).to eq(routes.cart_path)
|
68
|
-
expect(response).to render_template :iframe_breakout_redirect
|
69
|
-
end
|
70
|
-
end
|
71
|
-
|
72
|
-
context 'when the order is already completed' do
|
73
|
-
let(:order) { create(:order_ready_to_ship) }
|
74
|
-
|
75
|
-
it 'redirects to the cart page via iframe breakout' do
|
76
|
-
get :success, params: { order_number: order.number }
|
77
|
-
expect(assigns(:redirect_path)).to eq(routes.cart_path)
|
78
|
-
expect(response).to render_template :iframe_breakout_redirect
|
79
|
-
end
|
80
|
-
end
|
81
|
-
|
82
|
-
context 'when payment could not be created' do
|
83
|
-
let!(:payment) { nil }
|
84
|
-
|
85
|
-
it 'raises an error because no payment exists' do
|
86
|
-
expect{ get(:success, params: { order_number: order.number }) }.to raise_error(Spree::Core::GatewayError)
|
87
|
-
end
|
88
|
-
end
|
89
|
-
|
90
|
-
context 'when payment create was successful' do
|
91
|
-
let!(:payment) { create(:six_saferpay_payment, order: order) }
|
92
|
-
let(:assert_success) { false }
|
93
|
-
let(:payment_assert) { instance_double("Spree::SolidusSixSaferpay::AssertPaymentPage", success?: assert_success) }
|
94
|
-
let(:payment_inquiry) { instance_double("Spree::SolidusSixSaferpay::InquirePaymentPagePayment", user_message: "payment inquiry message") }
|
95
|
-
|
96
|
-
it 'asserts the payment' do
|
97
|
-
expect(Spree::SolidusSixSaferpay::AssertPaymentPage).to receive(:call).with(payment).and_return(payment_assert)
|
98
|
-
expect(Spree::SolidusSixSaferpay::InquirePaymentPagePayment).to receive(:call).with(payment).and_return(payment_inquiry)
|
99
|
-
|
100
|
-
get :success, params: { order_number: order.number }
|
101
|
-
end
|
102
|
-
|
103
|
-
context 'when the payment assert is successful' do
|
104
|
-
let(:assert_success) { true }
|
105
|
-
let(:process_success) { false }
|
106
|
-
let(:processed_payment) { instance_double("Spree::SolidusSixSaferpay::ProcessPaymentPagePayment", success?: process_success, user_message: "payment processing message") }
|
107
|
-
|
108
|
-
before do
|
109
|
-
allow(Spree::SolidusSixSaferpay::AssertPaymentPage).to receive(:call).with(payment).and_return(payment_assert)
|
110
|
-
end
|
111
|
-
|
112
|
-
it 'processes the asserted payment' do
|
113
|
-
expect(Spree::SolidusSixSaferpay::ProcessPaymentPagePayment).to receive(:call).with(payment).and_return(processed_payment)
|
114
|
-
|
115
|
-
get :success, params: { order_number: order.number }
|
116
|
-
end
|
117
|
-
|
118
|
-
context 'when the processing is successful' do
|
119
|
-
let(:process_success) { true }
|
120
|
-
|
121
|
-
before do
|
122
|
-
allow(Spree::SolidusSixSaferpay::ProcessPaymentPagePayment).to receive(:call).with(payment).and_return(processed_payment)
|
123
|
-
allow(Spree::Order).to receive(:find_by).with(number: order.number).and_return(order)
|
124
|
-
end
|
125
|
-
|
126
|
-
|
127
|
-
context 'when order is in payment state' do
|
128
|
-
let(:order) { create(:order, state: :payment) }
|
129
|
-
|
130
|
-
it 'moves order to next state' do
|
131
|
-
expect(order).to receive(:next!)
|
132
|
-
|
133
|
-
get :success, params: { order_number: order.number }
|
134
|
-
end
|
135
|
-
end
|
136
|
-
|
137
|
-
context 'when order is already in complete state' do
|
138
|
-
let(:order) { create(:order, state: :complete) }
|
139
|
-
|
140
|
-
it 'does not modify the order state' do
|
141
|
-
expect(order).not_to receive(:next!)
|
142
|
-
|
143
|
-
get :success, params: { order_number: order.number }
|
144
|
-
end
|
145
|
-
end
|
146
|
-
end
|
147
|
-
|
148
|
-
context 'when the processing fails' do
|
149
|
-
let(:process_success) { false }
|
150
|
-
|
151
|
-
before do
|
152
|
-
allow(Spree::SolidusSixSaferpay::ProcessPaymentPagePayment).to receive(:call).with(payment).and_return(processed_payment)
|
153
|
-
end
|
154
|
-
|
155
|
-
it 'displays an error message' do
|
156
|
-
get :success, params: { order_number: order.number }
|
157
|
-
|
158
|
-
expect(flash[:error]).to eq("payment processing message")
|
159
|
-
end
|
160
|
-
end
|
161
|
-
|
162
|
-
end
|
163
|
-
|
164
|
-
context 'when the payment assert fails' do
|
165
|
-
let(:assert_success) { false }
|
166
|
-
|
167
|
-
before do
|
168
|
-
allow(Spree::SolidusSixSaferpay::AssertPaymentPage).to receive(:call).with(payment).and_return(payment_assert)
|
169
|
-
end
|
170
|
-
|
171
|
-
it 'inquires the payment' do
|
172
|
-
expect(Spree::SolidusSixSaferpay::InquirePaymentPagePayment).to receive(:call).with(payment).and_return(payment_inquiry)
|
173
|
-
|
174
|
-
get :success, params: { order_number: order.number }
|
175
|
-
end
|
176
|
-
|
177
|
-
it 'displays an error message' do
|
178
|
-
expect(Spree::SolidusSixSaferpay::InquirePaymentPagePayment).to receive(:call).with(payment).and_return(payment_inquiry)
|
179
|
-
get :success, params: { order_number: order.number }
|
180
|
-
|
181
|
-
expect(flash[:error]).to eq("payment inquiry message")
|
182
|
-
end
|
183
|
-
end
|
184
|
-
end
|
185
|
-
end
|
186
|
-
|
187
|
-
describe 'GET fail' do
|
188
|
-
let!(:payment) { create(:six_saferpay_payment, order: order) }
|
189
|
-
let(:payment_inquiry) { instance_double("Spree::SolidusSixSaferpay::InquirePaymentPagePayment", user_message: "payment inquiry message") }
|
190
|
-
|
191
|
-
it 'inquires the payment' do
|
192
|
-
expect(Spree::SolidusSixSaferpay::InquirePaymentPagePayment).to receive(:call).with(payment).and_return(payment_inquiry)
|
193
|
-
|
194
|
-
get :fail, params: { order_number: order.number }
|
195
|
-
end
|
196
|
-
|
197
|
-
it 'displays an error message' do
|
198
|
-
expect(Spree::SolidusSixSaferpay::InquirePaymentPagePayment).to receive(:call).with(payment).and_return(payment_inquiry)
|
199
|
-
|
200
|
-
get :fail, params: { order_number: order.number }
|
201
|
-
|
202
|
-
expect(flash[:error]).to eq("payment inquiry message")
|
203
14
|
end
|
204
|
-
|
205
15
|
end
|
206
16
|
end
|
@@ -1,229 +1,16 @@
|
|
1
1
|
require 'rails_helper'
|
2
2
|
|
3
|
-
|
4
|
-
|
3
|
+
module Spree
|
4
|
+
module SolidusSixSaferpay
|
5
|
+
RSpec.describe Transaction::CheckoutController do
|
5
6
|
|
6
|
-
|
7
|
-
|
8
|
-
|
7
|
+
let(:initialize_payment_service_class) { InitializeTransaction }
|
8
|
+
let(:authorize_payment_service_class) { AuthorizeTransaction }
|
9
|
+
let(:process_authorization_service_class) { ProcessTransactionPayment }
|
10
|
+
let(:inquire_payment_service_class) { InquireTransactionPayment }
|
9
11
|
|
10
|
-
|
12
|
+
it_behaves_like "checkout_controller"
|
11
13
|
|
12
|
-
before do
|
13
|
-
allow(controller).to receive_messages try_spree_current_user: user
|
14
|
-
allow(controller).to receive_messages current_order: order
|
15
|
-
end
|
16
|
-
|
17
|
-
describe 'GET init' do
|
18
|
-
let(:success) { false }
|
19
|
-
let(:redirect_url) { '/saferpay/redirect/url' }
|
20
|
-
let(:initialized_payment) { instance_double("Spree::SolidusSixSaferpay::InitializeTransaction", success?: success, redirect_url: redirect_url) }
|
21
|
-
|
22
|
-
it 'tries to the saferpay payment' do
|
23
|
-
expect(Spree::SolidusSixSaferpay::InitializeTransaction).to receive(:call).with(order, payment_method).and_return(initialized_payment)
|
24
|
-
|
25
|
-
get :init, params: { payment_method_id: payment_method.id }
|
26
|
-
end
|
27
|
-
|
28
|
-
|
29
|
-
context 'when payment initialize succeeds' do
|
30
|
-
let(:success) { true }
|
31
|
-
|
32
|
-
before do
|
33
|
-
allow(Spree::SolidusSixSaferpay::InitializeTransaction).to receive(:call).with(order, payment_method).and_return(initialized_payment)
|
34
|
-
end
|
35
|
-
|
36
|
-
it 'returns the redirect_url' do
|
37
|
-
get :init, params: { payment_method_id: payment_method.id }
|
38
|
-
|
39
|
-
body = JSON.parse(response.body)
|
40
|
-
expect(body["redirect_url"]).to eq(redirect_url)
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
context 'when payment initialize fails' do
|
45
|
-
let(:success) { false }
|
46
|
-
|
47
|
-
before do
|
48
|
-
allow(Spree::SolidusSixSaferpay::InitializeTransaction).to receive(:call).with(order, payment_method).and_return(initialized_payment)
|
49
|
-
end
|
50
|
-
|
51
|
-
it 'returns an error' do
|
52
|
-
get :init, params: { payment_method_id: payment_method.id }
|
53
|
-
|
54
|
-
expect(response.body).to match(/errors/)
|
55
|
-
expect(response.status).to eq(422)
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
end
|
60
|
-
|
61
|
-
describe 'GET success' do
|
62
|
-
context 'when the order is not found' do
|
63
|
-
let(:order) { nil }
|
64
|
-
|
65
|
-
it 'redirects to the cart page via iframe breakout' do
|
66
|
-
get :success, params: { order_number: 'not_found' }
|
67
|
-
expect(assigns(:redirect_path)).to eq(routes.cart_path)
|
68
|
-
expect(response).to render_template :iframe_breakout_redirect
|
69
|
-
end
|
70
|
-
end
|
71
|
-
|
72
|
-
context 'when the order is already completed' do
|
73
|
-
let(:order) { create(:order_ready_to_ship) }
|
74
|
-
|
75
|
-
it 'redirects to the cart page via iframe breakout' do
|
76
|
-
get :success, params: { order_number: order.number }
|
77
|
-
expect(assigns(:redirect_path)).to eq(routes.cart_path)
|
78
|
-
expect(response).to render_template :iframe_breakout_redirect
|
79
|
-
end
|
80
|
-
end
|
81
|
-
|
82
|
-
context 'when payment could not be created' do
|
83
|
-
let!(:payment) { nil }
|
84
|
-
|
85
|
-
it 'raises an error because no payment exists' do
|
86
|
-
expect{ get(:success, params: { order_number: order.number }) }.to raise_error(Spree::Core::GatewayError)
|
87
|
-
end
|
88
|
-
end
|
89
|
-
|
90
|
-
context 'when payment create was successful' do
|
91
|
-
let!(:payment) { create(:six_saferpay_payment, order: order) }
|
92
|
-
let(:assert_success) { false }
|
93
|
-
let(:payment_assert) { instance_double("Spree::SolidusSixSaferpay::AuthorizeTransaction", success?: assert_success) }
|
94
|
-
let(:payment_inquiry) { instance_double("Spree::SolidusSixSaferpay::InquireTransactionPayment", user_message: "payment inquiry message") }
|
95
|
-
|
96
|
-
it 'asserts the payment' do
|
97
|
-
expect(Spree::SolidusSixSaferpay::AuthorizeTransaction).to receive(:call).with(payment).and_return(payment_assert)
|
98
|
-
expect(Spree::SolidusSixSaferpay::InquireTransactionPayment).to receive(:call).with(payment).and_return(payment_inquiry)
|
99
|
-
|
100
|
-
get :success, params: { order_number: order.number }
|
101
|
-
end
|
102
|
-
|
103
|
-
context 'when the payment assert is successful' do
|
104
|
-
let(:assert_success) { true }
|
105
|
-
let(:process_success) { false }
|
106
|
-
let(:processed_payment) { instance_double("Spree::SolidusSixSaferpay::ProcessTransactionPayment", success?: process_success, user_message: "payment processing message") }
|
107
|
-
|
108
|
-
before do
|
109
|
-
allow(Spree::SolidusSixSaferpay::AuthorizeTransaction).to receive(:call).with(payment).and_return(payment_assert)
|
110
|
-
end
|
111
|
-
|
112
|
-
it 'processes the asserted payment' do
|
113
|
-
expect(Spree::SolidusSixSaferpay::ProcessTransactionPayment).to receive(:call).with(payment).and_return(processed_payment)
|
114
|
-
|
115
|
-
get :success, params: { order_number: order.number }
|
116
|
-
end
|
117
|
-
|
118
|
-
context 'when the processing is successful' do
|
119
|
-
let(:process_success) { true }
|
120
|
-
|
121
|
-
before do
|
122
|
-
allow(Spree::SolidusSixSaferpay::ProcessTransactionPayment).to receive(:call).with(payment).and_return(processed_payment)
|
123
|
-
allow(Spree::Order).to receive(:find_by).with(number: order.number).and_return(order)
|
124
|
-
end
|
125
|
-
|
126
|
-
context 'when the default success handling is applied' do
|
127
|
-
context 'when order is in payment state' do
|
128
|
-
let(:order) { create(:order, state: :payment) }
|
129
|
-
|
130
|
-
it 'moves order to next state' do
|
131
|
-
expect(order).to receive(:next!)
|
132
|
-
|
133
|
-
get :success, params: { order_number: order.number }
|
134
|
-
end
|
135
|
-
end
|
136
|
-
|
137
|
-
context 'when order is already in complete state' do
|
138
|
-
let(:order) { create(:order, state: :complete) }
|
139
|
-
|
140
|
-
it 'does not modify the order state' do
|
141
|
-
expect(order).not_to receive(:next!)
|
142
|
-
|
143
|
-
get :success, params: { order_number: order.number }
|
144
|
-
end
|
145
|
-
end
|
146
|
-
end
|
147
|
-
|
148
|
-
context 'when a custom success handling is applied' do
|
149
|
-
let(:custom_handler) do
|
150
|
-
Proc.new { |context, order| order.email }
|
151
|
-
end
|
152
|
-
|
153
|
-
before do
|
154
|
-
allow(::SolidusSixSaferpay.config).to receive(:payment_processing_success_handler).and_return(custom_handler)
|
155
|
-
end
|
156
|
-
|
157
|
-
it 'does not modify the order state' do
|
158
|
-
expect(order).not_to receive(:next!)
|
159
|
-
|
160
|
-
get :success, params: { order_number: order.number }
|
161
|
-
end
|
162
|
-
|
163
|
-
it 'executes the custom handler' do
|
164
|
-
expect(order).to receive(:email)
|
165
|
-
|
166
|
-
get :success, params: { order_number: order.number }
|
167
|
-
end
|
168
|
-
end
|
169
|
-
end
|
170
|
-
|
171
|
-
context 'when the processing fails' do
|
172
|
-
let(:process_success) { false }
|
173
|
-
|
174
|
-
before do
|
175
|
-
allow(Spree::SolidusSixSaferpay::ProcessTransactionPayment).to receive(:call).with(payment).and_return(processed_payment)
|
176
|
-
end
|
177
|
-
|
178
|
-
it 'displays an error message' do
|
179
|
-
get :success, params: { order_number: order.number }
|
180
|
-
|
181
|
-
expect(flash[:error]).to eq("payment processing message")
|
182
|
-
end
|
183
|
-
end
|
184
|
-
|
185
|
-
end
|
186
|
-
|
187
|
-
context 'when the payment assert fails' do
|
188
|
-
let(:assert_success) { false }
|
189
|
-
|
190
|
-
before do
|
191
|
-
allow(Spree::SolidusSixSaferpay::AuthorizeTransaction).to receive(:call).with(payment).and_return(payment_assert)
|
192
|
-
end
|
193
|
-
|
194
|
-
it 'inquires the payment' do
|
195
|
-
expect(Spree::SolidusSixSaferpay::InquireTransactionPayment).to receive(:call).with(payment).and_return(payment_inquiry)
|
196
|
-
|
197
|
-
get :success, params: { order_number: order.number }
|
198
|
-
end
|
199
|
-
|
200
|
-
it 'displays an error message' do
|
201
|
-
expect(Spree::SolidusSixSaferpay::InquireTransactionPayment).to receive(:call).with(payment).and_return(payment_inquiry)
|
202
|
-
get :success, params: { order_number: order.number }
|
203
|
-
|
204
|
-
expect(flash[:error]).to eq("payment inquiry message")
|
205
|
-
end
|
206
|
-
end
|
207
14
|
end
|
208
15
|
end
|
209
|
-
|
210
|
-
describe 'GET fail' do
|
211
|
-
let!(:payment) { create(:six_saferpay_payment, order: order) }
|
212
|
-
let(:payment_inquiry) { instance_double("Spree::SolidusSixSaferpay::InquireTransactionPayment", user_message: "payment inquiry message") }
|
213
|
-
|
214
|
-
it 'inquires the payment' do
|
215
|
-
expect(Spree::SolidusSixSaferpay::InquireTransactionPayment).to receive(:call).with(payment).and_return(payment_inquiry)
|
216
|
-
|
217
|
-
get :fail, params: { order_number: order.number }
|
218
|
-
end
|
219
|
-
|
220
|
-
it 'displays an error message' do
|
221
|
-
expect(Spree::SolidusSixSaferpay::InquireTransactionPayment).to receive(:call).with(payment).and_return(payment_inquiry)
|
222
|
-
|
223
|
-
get :fail, params: { order_number: order.number }
|
224
|
-
|
225
|
-
expect(flash[:error]).to eq("payment inquiry message")
|
226
|
-
end
|
227
|
-
|
228
|
-
end
|
229
16
|
end
|