solidus_api 2.1.0.beta1 → 2.1.0.rc1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of solidus_api might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d202cbb2d66a818ad824e739704be52b81f63d48
4
- data.tar.gz: da186de43c9f9021a1a35c5ad3b4addb89fbac5f
3
+ metadata.gz: a4b0bb30392fb3f98f7b70a30a7fea33fafdff51
4
+ data.tar.gz: 235bdb122832d0a26a76f7fe524e123bde524c54
5
5
  SHA512:
6
- metadata.gz: ea88be5b89fd4e8ab09210ad1a08c8900255492134bf6e072cef9bdb0f2e610bce615f2f622f6c22be9f43fddf3a83657575845e9afc15c576f64a6bb6ac7363
7
- data.tar.gz: 1e7bf9f59a65a1df20263f901cafd1793f50cabd4157ef2baf51fa94d24d586abbef35b5881ad343ce87089043360df09a4b5c5e2f98bcc378d92940c0f2fb66
6
+ metadata.gz: 6a6b41555532b56e6c5e500ace3c61609460762fff046d1f31002d922aeb2f18428d6b4f5f8dc6690d6cfdc4f76b159c25fd9401695a1558c3710d02b4c9e4ae
7
+ data.tar.gz: 64e5f7d0479aa233df96e13cb8c2b9c3420b8442b75993df038c94e52b3ab4bebfb027e2cd52f58159be8526d52853dd547cb5bac42f1c202d8a7a8f4d489110
@@ -8,6 +8,7 @@ module Spree
8
8
  rescue_from Spree::Order::InsufficientStock, with: :insufficient_stock_error
9
9
 
10
10
  include Spree::Core::ControllerHelpers::Order
11
+
11
12
  # TODO: Remove this after deprecated usage in #update is removed
12
13
  include Spree::Core::ControllerHelpers::PaymentParameters
13
14
 
@@ -15,12 +16,6 @@ module Spree
15
16
  skip_before_action :set_current_order
16
17
 
17
18
  def next
18
- if @order.confirm?
19
- Spree::Deprecation.warn "Using Spree::Api::CheckoutsController#next to transition to complete is deprecated. Please use #complete instead of #next.", caller
20
- complete
21
- return
22
- end
23
-
24
19
  authorize! :update, @order, order_token
25
20
  if !expected_total_ok?(params[:expected_total])
26
21
  respond_with(@order, default_template: 'spree/api/orders/expected_total_mismatch', status: 400)
@@ -93,16 +88,6 @@ module Spree
93
88
  def massaged_params
94
89
  massaged_params = params.deep_dup
95
90
 
96
- if params[:payment_source].present?
97
- Spree::Deprecation.warn("Passing payment_source is deprecated. Send source parameters inside payments_attributes[:source_attributes].", caller)
98
- move_payment_source_into_payments_attributes(massaged_params)
99
- end
100
-
101
- if params[:order] && params[:order][:existing_card].present?
102
- Spree::Deprecation.warn("Passing order[:existing_card] is deprecated. Send existing_card_id inside of payments_attributes[:source_attributes].", caller)
103
- move_existing_card_into_payments_attributes(massaged_params)
104
- end
105
-
106
91
  set_payment_parameters_amount(massaged_params, @order)
107
92
 
108
93
  massaged_params
@@ -221,30 +221,6 @@ module Spree
221
221
  expect(json_response['payments'][0]['payment_method']['name']).to eq(@payment_method.name)
222
222
  expect(json_response['payments'][0]['amount']).to eq(order.total.to_s)
223
223
  end
224
-
225
- context 'with deprecated payment_source parameters' do
226
- let(:params) do
227
- {
228
- id: order.to_param,
229
- order_token: order.guest_token,
230
- order: {
231
- payments_attributes: [
232
- { payment_method_id: @payment_method.id.to_s }
233
- ]
234
- },
235
- payment_source: { @payment_method.id.to_s => attributes_for(:credit_card) }
236
- }
237
- end
238
-
239
- it "succeeds" do
240
- Spree::Deprecation.silence do
241
- api_put(:update, params)
242
- end
243
- expect(response.status).to eq(200)
244
- expect(json_response['payments'][0]['payment_method']['name']).to eq(@payment_method.name)
245
- expect(json_response['payments'][0]['amount']).to eq(order.total.to_s)
246
- end
247
- end
248
224
  end
249
225
 
250
226
  context 'when source is missing attributes' do
@@ -277,36 +253,6 @@ module Spree
277
253
  expect(cc_errors).to include("Year is not a number")
278
254
  expect(cc_errors).to include("Verification Value can't be blank")
279
255
  end
280
-
281
- context 'with deprecated payment_source parameters' do
282
- let(:params) do
283
- {
284
- id: order.to_param,
285
- order_token: order.guest_token,
286
- order: {
287
- payments_attributes: [
288
- { payment_method_id: @payment_method.id.to_s }
289
- ]
290
- },
291
- payment_source: {
292
- @payment_method.id.to_s => { name: "Spree" }
293
- }
294
- }
295
- end
296
-
297
- it 'returns errors' do
298
- Spree::Deprecation.silence do
299
- api_put(:update, params)
300
- end
301
-
302
- expect(response.status).to eq(422)
303
- cc_errors = json_response['errors']['payments.Credit Card']
304
- expect(cc_errors).to include("Card Number can't be blank")
305
- expect(cc_errors).to include("Month is not a number")
306
- expect(cc_errors).to include("Year is not a number")
307
- expect(cc_errors).to include("Verification Value can't be blank")
308
- end
309
- end
310
256
  end
311
257
 
312
258
  context 'reusing a credit card' do
@@ -348,35 +294,6 @@ module Spree
348
294
  expect(response.status).to eq 200
349
295
  expect(order.credit_cards).to match_array [credit_card]
350
296
  end
351
-
352
- context 'with deprecated existing_card parameters' do
353
- let(:params) do
354
- {
355
- id: order.to_param,
356
- order_token: order.guest_token,
357
- order: {
358
- existing_card: credit_card.id.to_s
359
- },
360
- cvc_confirm: '456'
361
- }
362
- end
363
-
364
- it 'succeeds' do
365
- # unfortunately the credit card gets reloaded by `@order.next` before
366
- # the controller action finishes so this is the best way I could think
367
- # of to test that the verification_value gets set.
368
- expect_any_instance_of(Spree::CreditCard).to(
369
- receive(:verification_value=).with('456').and_call_original
370
- )
371
-
372
- Spree::Deprecation.silence do
373
- api_put(:update, params)
374
- end
375
-
376
- expect(response.status).to eq 200
377
- expect(order.credit_cards).to match_array [credit_card]
378
- end
379
- end
380
297
  end
381
298
 
382
299
  it "returns the order if the order is already complete" do
@@ -451,50 +368,40 @@ module Spree
451
368
  end
452
369
  end
453
370
 
454
- # NOTE: Temporarily making "next" behave just like "complete" when order is in confirm state
455
- # Using "next" this way is deprecated.
456
- [:next, :complete].each do |action|
457
- context action.to_s do
458
- context "with order in confirm state" do
459
- subject do
460
- if action == :next
461
- Spree::Deprecation.silence do
462
- api_put action, params
463
- end
464
- else
465
- api_put action, params
466
- end
467
- end
371
+ context "complete" do
372
+ context "with order in confirm state" do
373
+ subject do
374
+ api_put :complete, params
375
+ end
468
376
 
469
- let(:params) { { id: order.to_param, order_token: order.guest_token } }
470
- let(:order) { create(:order_with_line_items) }
377
+ let(:params) { { id: order.to_param, order_token: order.guest_token } }
378
+ let(:order) { create(:order_with_line_items) }
471
379
 
472
- before do
473
- order.update_column(:state, "confirm")
474
- end
380
+ before do
381
+ order.update_column(:state, "confirm")
382
+ end
475
383
 
476
- it "can transition from confirm to complete" do
477
- allow_any_instance_of(Spree::Order).to receive_messages(payment_required?: false)
478
- subject
479
- expect(json_response['state']).to eq('complete')
480
- expect(response.status).to eq(200)
481
- end
384
+ it "can transition from confirm to complete" do
385
+ allow_any_instance_of(Spree::Order).to receive_messages(payment_required?: false)
386
+ subject
387
+ expect(json_response['state']).to eq('complete')
388
+ expect(response.status).to eq(200)
389
+ end
482
390
 
483
- it "returns a sensible error when no payment method is specified" do
484
- # api_put :complete, :id => order.to_param, :order_token => order.token, :order => {}
485
- subject
486
- expect(json_response["errors"]["base"]).to include(Spree.t(:no_payment_found))
487
- end
391
+ it "returns a sensible error when no payment method is specified" do
392
+ # api_put :complete, :id => order.to_param, :order_token => order.token, :order => {}
393
+ subject
394
+ expect(json_response["errors"]["base"]).to include(Spree.t(:no_payment_found))
395
+ end
488
396
 
489
- context "with mismatched expected_total" do
490
- let(:params) { super().merge(expected_total: order.total + 1) }
397
+ context "with mismatched expected_total" do
398
+ let(:params) { super().merge(expected_total: order.total + 1) }
491
399
 
492
- it "returns an error if expected_total is present and does not match actual total" do
493
- # api_put :complete, :id => order.to_param, :order_token => order.token, :expected_total => order.total + 1
494
- subject
495
- expect(response.status).to eq(400)
496
- expect(json_response['errors']['expected_total']).to include(Spree.t(:expected_total_mismatch, scope: 'api.order'))
497
- end
400
+ it "returns an error if expected_total is present and does not match actual total" do
401
+ # api_put :complete, :id => order.to_param, :order_token => order.token, :expected_total => order.total + 1
402
+ subject
403
+ expect(response.status).to eq(400)
404
+ expect(json_response['errors']['expected_total']).to include(Spree.t(:expected_total_mismatch, scope: 'api.order'))
498
405
  end
499
406
  end
500
407
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: solidus_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0.beta1
4
+ version: 2.1.0.rc1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Solidus Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-12-06 00:00:00.000000000 Z
11
+ date: 2016-12-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: solidus_core
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 2.1.0.beta1
19
+ version: 2.1.0.rc1
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 2.1.0.beta1
26
+ version: 2.1.0.rc1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rabl
29
29
  requirement: !ruby/object:Gem::Requirement