spree_api 4.1.0.rc2 → 4.1.0.rc3
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of spree_api might be problematic. Click here for more details.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1a6d504c0ee96c400f8b0d26171978338dd75a3620ebc24ff51e29f658bbd1ee
|
4
|
+
data.tar.gz: 36a37886c072632e633d41d9a695ba8b47b6665a4d5d81d61c1fe52c83528cdc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7daf912d4522c924888c99d967208619a0c50b17d3093878722e807e656b5e5354ed6d4a20c31daae0b442496d66f397ed1922053c8a63deda0f80ab52223357
|
7
|
+
data.tar.gz: e1d87922707bcd3d5d5e23549bd4eaa841d19865a792151144b18cedab459aa89e05a4fa1a287ff745f5e867d7c755e2056caf85502b304965bc888f3605ea20
|
@@ -5,6 +5,7 @@ module Spree
|
|
5
5
|
class CartController < ::Spree::Api::V2::BaseController
|
6
6
|
include Spree::Api::V2::Storefront::OrderConcern
|
7
7
|
before_action :ensure_order, except: :create
|
8
|
+
before_action :load_variant, only: :add_item
|
8
9
|
|
9
10
|
def create
|
10
11
|
spree_authorize! :create, Spree::Order
|
@@ -22,14 +23,12 @@ module Spree
|
|
22
23
|
end
|
23
24
|
|
24
25
|
def add_item
|
25
|
-
variant = Spree::Variant.find(params[:variant_id])
|
26
|
-
|
27
26
|
spree_authorize! :update, spree_current_order, order_token
|
28
|
-
spree_authorize! :show, variant
|
27
|
+
spree_authorize! :show, @variant
|
29
28
|
|
30
29
|
result = add_item_service.call(
|
31
30
|
order: spree_current_order,
|
32
|
-
variant: variant,
|
31
|
+
variant: @variant,
|
33
32
|
quantity: params[:quantity],
|
34
33
|
options: params[:options]
|
35
34
|
)
|
@@ -149,6 +148,10 @@ module Spree
|
|
149
148
|
@line_item ||= spree_current_order.line_items.find(params[:line_item_id])
|
150
149
|
end
|
151
150
|
|
151
|
+
def load_variant
|
152
|
+
@variant = Spree::Variant.find(params[:variant_id])
|
153
|
+
end
|
154
|
+
|
152
155
|
def render_error_item_quantity
|
153
156
|
render json: { error: I18n.t(:wrong_quantity, scope: 'spree.api.v2.cart') }, status: 422
|
154
157
|
end
|
@@ -457,6 +457,7 @@ paths:
|
|
457
457
|
<pre>
|
458
458
|
order: {
|
459
459
|
email: 'john@snow.org',
|
460
|
+
special_instructions: 'Please leave at door',
|
460
461
|
bill_address_attributes: {
|
461
462
|
firstname: 'John',
|
462
463
|
lastname: 'Snow',
|
@@ -519,18 +520,16 @@ paths:
|
|
519
520
|
order: {
|
520
521
|
payments_attributes: [
|
521
522
|
{
|
522
|
-
payment_method_id: 1
|
523
|
+
payment_method_id: 1,
|
524
|
+
source_attributes: {
|
525
|
+
number: '4111111111111111',
|
526
|
+
month: '01',
|
527
|
+
year: '2022',
|
528
|
+
verification_value: '123',
|
529
|
+
name: 'John Doe'
|
530
|
+
}
|
523
531
|
}
|
524
532
|
]
|
525
|
-
},
|
526
|
-
payment_source: {
|
527
|
-
1: {
|
528
|
-
number: '4111111111111111',
|
529
|
-
month: '01',
|
530
|
-
year: '2022',
|
531
|
-
verification_value: '123',
|
532
|
-
name: 'John Doe'
|
533
|
-
}
|
534
533
|
}
|
535
534
|
}
|
536
535
|
</pre>
|
@@ -583,6 +582,9 @@ paths:
|
|
583
582
|
email:
|
584
583
|
type: string
|
585
584
|
example: 'john@snow.org'
|
585
|
+
special_instructions:
|
586
|
+
type: string
|
587
|
+
example: 'Please leave at door'
|
586
588
|
bill_address_attributes:
|
587
589
|
$ref: '#/components/schemas/AddressPayload'
|
588
590
|
ship_address_attributes:
|
@@ -596,10 +598,10 @@ paths:
|
|
596
598
|
type: number
|
597
599
|
example: 1
|
598
600
|
description: 'ID of selected payment method'
|
601
|
+
source_attributes:
|
602
|
+
$ref: '#/components/schemas/PaymentSource'
|
599
603
|
shipments_attributes:
|
600
604
|
type: object
|
601
|
-
payment_source:
|
602
|
-
type: object
|
603
605
|
|
604
606
|
'/checkout/next':
|
605
607
|
patch:
|
@@ -2416,6 +2418,29 @@ components:
|
|
2416
2418
|
zipcode: '20814'
|
2417
2419
|
state_name: 'MD'
|
2418
2420
|
country_iso: 'US'
|
2421
|
+
PaymentSource:
|
2422
|
+
properties:
|
2423
|
+
number:
|
2424
|
+
type: string
|
2425
|
+
description: 'Credit card number'
|
2426
|
+
month:
|
2427
|
+
type: string
|
2428
|
+
year:
|
2429
|
+
type: string
|
2430
|
+
verification_value:
|
2431
|
+
type: string
|
2432
|
+
cc_type:
|
2433
|
+
type: string
|
2434
|
+
description: 'Credit Card Brand'
|
2435
|
+
name:
|
2436
|
+
type: string
|
2437
|
+
example:
|
2438
|
+
number: '4111111111111111'
|
2439
|
+
month: '01'
|
2440
|
+
year: '2022'
|
2441
|
+
verification_value: '123'
|
2442
|
+
cc_type: 'visa'
|
2443
|
+
name: 'John Doe'
|
2419
2444
|
|
2420
2445
|
parameters:
|
2421
2446
|
CreditCardIncludeParam:
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spree_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.1.0.
|
4
|
+
version: 4.1.0.rc3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Bigg
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-02-
|
11
|
+
date: 2020-02-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jsonapi-rspec
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - '='
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 4.1.0.
|
33
|
+
version: 4.1.0.rc3
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - '='
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 4.1.0.
|
40
|
+
version: 4.1.0.rc3
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rabl
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|