beyond_api 0.1.0.pre
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/.rspec +3 -0
- data/.travis.yml +7 -0
- data/.yardopts +1 -0
- data/CHANGELOG.md +4 -0
- data/CONTRIBUTING.md +48 -0
- data/GETTING_STARTED.md +0 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +55 -0
- data/LICENSE +19 -0
- data/README.md +51 -0
- data/Rakefile +11 -0
- data/beyond_api.gemspec +31 -0
- data/bin/console +18 -0
- data/bin/setup +8 -0
- data/lib/beyond_api.rb +37 -0
- data/lib/beyond_api/connection.rb +30 -0
- data/lib/beyond_api/ext.rb +43 -0
- data/lib/beyond_api/request.rb +55 -0
- data/lib/beyond_api/resources/base.rb +17 -0
- data/lib/beyond_api/resources/carts.rb +547 -0
- data/lib/beyond_api/resources/categories.rb +168 -0
- data/lib/beyond_api/resources/categories_view.rb +142 -0
- data/lib/beyond_api/resources/checkout_settings.rb +48 -0
- data/lib/beyond_api/resources/newsletter_target.rb +97 -0
- data/lib/beyond_api/resources/order_settings.rb +80 -0
- data/lib/beyond_api/resources/orders.rb +968 -0
- data/lib/beyond_api/resources/payment_methods.rb +192 -0
- data/lib/beyond_api/resources/product_attribute_definitions.rb +109 -0
- data/lib/beyond_api/resources/product_settings.rb +28 -0
- data/lib/beyond_api/resources/products.rb +245 -0
- data/lib/beyond_api/resources/products/attachments.rb +119 -0
- data/lib/beyond_api/resources/products/availability.rb +177 -0
- data/lib/beyond_api/resources/products/custom_attributes.rb +141 -0
- data/lib/beyond_api/resources/products/images.rb +165 -0
- data/lib/beyond_api/resources/products/searches.rb +52 -0
- data/lib/beyond_api/resources/products/variation_properties.rb +87 -0
- data/lib/beyond_api/resources/products_view.rb +158 -0
- data/lib/beyond_api/resources/scopes.rb +31 -0
- data/lib/beyond_api/resources/script_tags.rb +122 -0
- data/lib/beyond_api/resources/shipping_zones.rb +324 -0
- data/lib/beyond_api/resources/shop.rb +561 -0
- data/lib/beyond_api/resources/signers.rb +63 -0
- data/lib/beyond_api/resources/token.rb +41 -0
- data/lib/beyond_api/resources/users.rb +376 -0
- data/lib/beyond_api/resources/variations.rb +145 -0
- data/lib/beyond_api/resources/variations/availability.rb +105 -0
- data/lib/beyond_api/resources/webhook_subscriptions.rb +176 -0
- data/lib/beyond_api/session.rb +121 -0
- data/lib/beyond_api/utils.rb +51 -0
- data/lib/beyond_api/version.rb +3 -0
- data/lib/generators/beyond_api/install_generator.rb +13 -0
- data/lib/generators/templates/beyond_api_initializer.rb +29 -0
- metadata +194 -0
@@ -0,0 +1,80 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "beyond_api/utils"
|
4
|
+
|
5
|
+
module BeyondApi
|
6
|
+
class OrderSettings < Base
|
7
|
+
include BeyondApi::Utils
|
8
|
+
|
9
|
+
#
|
10
|
+
# A +GET+ request is used to retrieve the order settings.
|
11
|
+
#
|
12
|
+
# $ curl 'https://api-shop.beyondshop.cloud/api/order-settings' -i -X GET \
|
13
|
+
# -H 'Accept: application/hal+json' \
|
14
|
+
# -H 'Authorization: Bearer <Access token>'
|
15
|
+
#
|
16
|
+
# @beyond_api.scopes +oset:r
|
17
|
+
#
|
18
|
+
# @return [OpenStruct]
|
19
|
+
#
|
20
|
+
# @example
|
21
|
+
# @order_settings = session.payment_methods.all
|
22
|
+
#
|
23
|
+
def all(params = {})
|
24
|
+
response, status = BeyondApi::Request.get(@session, "/order-settings")
|
25
|
+
|
26
|
+
handle_response(response, status)
|
27
|
+
end
|
28
|
+
|
29
|
+
#
|
30
|
+
# A +PUT+ request is used to update the order settings.
|
31
|
+
#
|
32
|
+
# $ curl 'https://api-shop.beyondshop.cloud/api/order-settings' -i -X PUT \
|
33
|
+
# -H 'Content-Type: application/json' \
|
34
|
+
# -H 'Accept: application/hal+json' \
|
35
|
+
# -H 'Authorization: Bearer <Access token>' \
|
36
|
+
# -d '{"invoiceCancelationNote": "This is an invoice cancelation note","invoiceCancellationNote": "This is an invoice cancellation note","defaultDeliveryDateNote": "This is the default delivery date note","defaultInvoiceNote": "This is the default invoice note","orderNumberConfiguration": {
|
37
|
+
# "stringPrefix" : "2017-shop-",
|
38
|
+
# "nextNumericSuffix" : 1000,
|
39
|
+
# "numericSuffixLength" : 4
|
40
|
+
# },
|
41
|
+
# "invoiceNumberConfiguration": {
|
42
|
+
# "stringPrefix" : "2017-invoice-",
|
43
|
+
# "nextNumericSuffix" : 1000,
|
44
|
+
# "numericSuffixLength" : 4
|
45
|
+
# }
|
46
|
+
# }'
|
47
|
+
#
|
48
|
+
# @beyond_api.scopes +oset:u
|
49
|
+
#
|
50
|
+
# @param body [Hash] the request body
|
51
|
+
#
|
52
|
+
# @return [OpenStruct]
|
53
|
+
#
|
54
|
+
# @example
|
55
|
+
# body = {
|
56
|
+
# "invoiceCancelationNote"=> "This is an invoice cancelation note",
|
57
|
+
# "invoiceCancellationNote"=> "This is an invoice cancellation note",
|
58
|
+
# "defaultDeliveryDateNote"=> "This is the default delivery date note",
|
59
|
+
# "defaultInvoiceNote"=> "This is the default invoice note",
|
60
|
+
# "orderNumberConfiguration"=> {
|
61
|
+
# "stringPrefix"=> "2017-shop-",
|
62
|
+
# "nextNumericSuffix"=> 1000,
|
63
|
+
# "numericSuffixLength"=> 4
|
64
|
+
# },
|
65
|
+
# "invoiceNumberConfiguration"=> {
|
66
|
+
# "stringPrefix"=> "2017-invoice-",
|
67
|
+
# "nextNumericSuffix"=> 1000,
|
68
|
+
# "numericSuffixLength"=> 4
|
69
|
+
# }
|
70
|
+
# }
|
71
|
+
#
|
72
|
+
# @order_settings = session.order_settings.update(body)
|
73
|
+
#
|
74
|
+
def update(order_settings, body)
|
75
|
+
response, status = BeyondApi::Request.put(@session, "/order-settings", body)
|
76
|
+
|
77
|
+
handle_response(response, status)
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
@@ -0,0 +1,968 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "beyond_api/utils"
|
4
|
+
|
5
|
+
module BeyondApi
|
6
|
+
class Orders < Base
|
7
|
+
include BeyondApi::Utils
|
8
|
+
|
9
|
+
#
|
10
|
+
# A +GET+ request is used to retrieve the active payment processes. There is only one active payment process. See {Show payment process details}[http://docs.beyondshop.cloud/#resources-payment-process-get] for more information about the request and response structure.
|
11
|
+
#
|
12
|
+
# $ curl 'https://api-shop.beyondshop.cloud/api/orders/208e2c1d-6610-43c7-b2f1-20aad6f029b9/processes/payments/active' -i -X GET \
|
13
|
+
# -H 'Content-Type: application/json' \
|
14
|
+
# -H 'Accept: application/hal+json' \
|
15
|
+
# -H 'Authorization: Bearer <Access token>'
|
16
|
+
#
|
17
|
+
# @beyond_api.scopes +pypr:r
|
18
|
+
#
|
19
|
+
# @param order_id [String] the order UUID
|
20
|
+
#
|
21
|
+
# @return [OpenStruct]
|
22
|
+
#
|
23
|
+
# @example
|
24
|
+
# @payment_process = session.orders.active_payment_process("268a8629-55cd-4890-9013-936b9b5ea14c")
|
25
|
+
#
|
26
|
+
def active_payment_process(order_id)
|
27
|
+
response, status = BeyondApi::Request.get(@session, "/orders/#{order_id}/processes/payments/active")
|
28
|
+
|
29
|
+
handle_response(response, status)
|
30
|
+
end
|
31
|
+
|
32
|
+
#
|
33
|
+
# A +GET+ request is used to retrieve the active refund processes. There is only one active refund process. See {Show refund process details}[http://docs.beyondshop.cloud/#resources-refund-process-get] for more information about the request and response structure.
|
34
|
+
#
|
35
|
+
# $ curl 'https://api-shop.beyondshop.cloud/api/orders/8613295f-4d44-4143-bfd0-6b81fc178618/processes/refunds/active' -i -X GET \
|
36
|
+
# -H 'Content-Type: application/json' \
|
37
|
+
# -H 'Accept: application/hal+json' \
|
38
|
+
# -H 'Authorization: Bearer <Access token>'
|
39
|
+
#
|
40
|
+
# @beyond_api.scopes +rfpr:r
|
41
|
+
#
|
42
|
+
# @param order_id [String] the order UUID
|
43
|
+
#
|
44
|
+
# @return [OpenStruct]
|
45
|
+
#
|
46
|
+
# @example
|
47
|
+
# @refund_process = session.orders.active_refund_process("268a8629-55cd-9845-3114-454b9b5ea14c")
|
48
|
+
#
|
49
|
+
def active_refund_process(order_id)
|
50
|
+
response, status = BeyondApi::Request.get(@session, "/orders/#{order_id}/processes/refunds/active")
|
51
|
+
|
52
|
+
handle_response(response, status)
|
53
|
+
end
|
54
|
+
|
55
|
+
#
|
56
|
+
# A +GET+ request is used to list all orders of the shop in a paged way. Each item in the response represents a summary of the order data.
|
57
|
+
#
|
58
|
+
# @beyond_api.scopes +ordr:r
|
59
|
+
#
|
60
|
+
# @option params [Integer] :size the page size
|
61
|
+
# @option params [Integer] :page the page number
|
62
|
+
#
|
63
|
+
# @return [OpenStruct]
|
64
|
+
#
|
65
|
+
# @example
|
66
|
+
# @orders = session.orders.all(size: 100, page: 0)
|
67
|
+
#
|
68
|
+
def all(params = {})
|
69
|
+
response, status = BeyondApi::Request.get(@session, "/orders", params)
|
70
|
+
|
71
|
+
handle_response(response, status)
|
72
|
+
end
|
73
|
+
|
74
|
+
#
|
75
|
+
# A +POST+ request is used to cancel an order.
|
76
|
+
#
|
77
|
+
# $ curl 'https://api-shop.beyondshop.cloud/api/orders/e3f9264a-395b-407d-9036-00f38f609be6/cancel' -i -X POST \
|
78
|
+
# -H 'Content-Type: application/json' \
|
79
|
+
# -H 'Accept: application/hal+json' \
|
80
|
+
# -H 'Authorization: Bearer <Access token>' \
|
81
|
+
# -d '{
|
82
|
+
# "comment" : "This needs to be done fast!"
|
83
|
+
# }'
|
84
|
+
#
|
85
|
+
# @beyond_api.scopes +clpr:c
|
86
|
+
#
|
87
|
+
# @param order_id [String] the order UUID
|
88
|
+
# @param body [Hash] the request body
|
89
|
+
#
|
90
|
+
# @return [OpenStruct]
|
91
|
+
#
|
92
|
+
# @example
|
93
|
+
# body = {
|
94
|
+
# "comment"=> "This needs to be done fast!"
|
95
|
+
# }
|
96
|
+
# @order = session.orders.cancel("268a8629-55cd-4890-9013-936b9b5ea14c", body)
|
97
|
+
#
|
98
|
+
def cancel(order_id, body)
|
99
|
+
response, status = BeyondApi::Request.post(@session, "/orders/#{order_id}/cancel", body)
|
100
|
+
|
101
|
+
handle_response(response, status)
|
102
|
+
end
|
103
|
+
|
104
|
+
#
|
105
|
+
# A +GET+ request is used to retrieve the cancelation process details of an order.
|
106
|
+
#
|
107
|
+
# $ curl 'https://api-shop.beyondshop.cloud/api/orders/f16cf0db-7449-4029-a886-76f38b4aa464/processes/cancelations/365b4b63-45a8-49f6-94c5-a65e0dee83b5' -i -X GET \
|
108
|
+
# -H 'Content-Type: application/json' \
|
109
|
+
# -H 'Accept: application/hal+json' \
|
110
|
+
# -H 'Authorization: Bearer <Access token>'
|
111
|
+
#
|
112
|
+
# @beyond_api.scopes +clpr:r
|
113
|
+
#
|
114
|
+
# @param order_id [String] the order UUID
|
115
|
+
# @param cancelation_id [String] the cancelation UUID
|
116
|
+
#
|
117
|
+
# @return [OpenStruct]
|
118
|
+
#
|
119
|
+
# @example
|
120
|
+
# @pcancelation_process = session.orders.cancelation_process("268a8629-55cd-4890-9013-936b9b5ea14c", "365b4b63-45a8-49f6-94c5-a65e0dee83b5")
|
121
|
+
#
|
122
|
+
def cancelation_process(order_id, cancelation_id)
|
123
|
+
response, status = BeyondApi::Request.get(@session, "/orders/#{order_id}/processes/payments/cancelations/#{cancelation_id}")
|
124
|
+
|
125
|
+
handle_response(response, status)
|
126
|
+
end
|
127
|
+
|
128
|
+
#
|
129
|
+
# A +GET+ request is used to list all cancelation processes of an order in a paged way.
|
130
|
+
#
|
131
|
+
# $ curl 'https://api-shop.beyondshop.cloud/api/orders/b8cb904d-4c82-4c39-a3a4-de7cb181a5d3/processes/cancelations?page=0&size=20' -i -X GET \
|
132
|
+
# -H 'Content-Type: application/json' \
|
133
|
+
# -H 'Accept: application/hal+json' \
|
134
|
+
# -H 'Authorization: Bearer <Access token>'
|
135
|
+
#
|
136
|
+
# @beyond_api.scopes +clpr:r
|
137
|
+
#
|
138
|
+
# @param order_id [String] the order UUID
|
139
|
+
# @option params [Integer] :size the page size
|
140
|
+
# @option params [Integer] :page the page number
|
141
|
+
#
|
142
|
+
# @return [OpenStruct]
|
143
|
+
#
|
144
|
+
# @example
|
145
|
+
# @pcancelation_processes = session.orders.cancelation_processes("268a8629-55cd-4890-9013-936b9b5ea14c", {page: 0, size: 20})
|
146
|
+
#
|
147
|
+
def cancelation_processes(order_id, params = {})
|
148
|
+
response, status = BeyondApi::Request.get(@session, "/orders/#{order_id}/processes/payments/cancelations", params)
|
149
|
+
|
150
|
+
handle_response(response, status)
|
151
|
+
end
|
152
|
+
|
153
|
+
#
|
154
|
+
# A +POST+ request is used to capture the payment.
|
155
|
+
#
|
156
|
+
# $ curl 'https://api-shop.beyondshop.cloud/api/orders/ebfd99d6-f025-4c97-96d2-d5adbb45d6c2/processes/payments/2936deca-fd56-4c0d-88e2-8030c897bf90/capture' -i -X POST \
|
157
|
+
# -H 'Accept: application/hal+json' \
|
158
|
+
# -H 'Authorization: Bearer <Access token>'
|
159
|
+
#
|
160
|
+
# @beyond_api.scopes +pypr:u
|
161
|
+
#
|
162
|
+
# @param order_id [String] the order UUID
|
163
|
+
# @param payment_id [String] the payment UUID
|
164
|
+
#
|
165
|
+
# @return [OpenStruct]
|
166
|
+
#
|
167
|
+
# @example
|
168
|
+
# @payment_process = session.orders.capture_payment_process("268a8629-55cd-4890-9013-936b9b5ea14c", "266d8608-55cd-4890-9474-296a9q1ea05q")
|
169
|
+
#
|
170
|
+
def capture_payment_process(order_id, payment_id)
|
171
|
+
response, status = BeyondApi::Request.post(@session, "/orders/#{order_id}/processes/payments/#{payment_id}/capture", body)
|
172
|
+
|
173
|
+
handle_response(response, status)
|
174
|
+
end
|
175
|
+
|
176
|
+
#
|
177
|
+
# A +POST+ request is used to create a new cancelation process for an order. Cancelation processes trigger a refund process.
|
178
|
+
#
|
179
|
+
# $ curl 'https://api-shop.beyondshop.cloud/api/orders/9072c00d-1bc7-4fd8-8836-94ada5084e7a/processes/cancelations' -i -X POST \
|
180
|
+
# -H 'Content-Type: application/json' \
|
181
|
+
# -H 'Accept: application/hal+json' \
|
182
|
+
# -H 'Authorization: Bearer <Access token>' \
|
183
|
+
# -d '{
|
184
|
+
# "comment" : "This needs to be done fast!",
|
185
|
+
# "lineItems" : [ {
|
186
|
+
# "quantity" : 3,
|
187
|
+
# "productLineItemId" : "0e1f8ab4-ec78-42a6-9a46-a3384cd17d52"
|
188
|
+
# } ]
|
189
|
+
# }'
|
190
|
+
#
|
191
|
+
# @beyond_api.scopes +clpr:c
|
192
|
+
#
|
193
|
+
# @param order_id [String] the order UUID
|
194
|
+
# @param body [Hash] the request body
|
195
|
+
#
|
196
|
+
# @return [OpenStruct]
|
197
|
+
#
|
198
|
+
# @example
|
199
|
+
# body = {
|
200
|
+
# "comment"=> "This needs to be done fast!",
|
201
|
+
# "lineItems"=> [{
|
202
|
+
# "quantity"=> 3,
|
203
|
+
# "productLineItemId"=> "0e1f8ab4-ec78-42a6-9a46-a3384cd17d52"
|
204
|
+
# }]
|
205
|
+
# }
|
206
|
+
# @pcancelation_process = session.orders.create_cancelation_process("268a8629-55cd-4890-9013-936b9b5ea14c", body)
|
207
|
+
#
|
208
|
+
def create_cancelation_process(order_id, body)
|
209
|
+
response, status = BeyondApi::Request.post(@session, "/orders/#{order_id}/processes/payments/cancelations")
|
210
|
+
|
211
|
+
handle_response(response, status)
|
212
|
+
end
|
213
|
+
|
214
|
+
#
|
215
|
+
# A +POST+ request is used to create an invoice for the order.
|
216
|
+
#
|
217
|
+
# $ curl 'https://api-shop.beyondshop.cloud/api/orders/a5d4d6c6-e77d-4180-8dbf-729f38a698b2/create-invoice' -i -X POST \
|
218
|
+
# -H 'Content-Type: application/json' \
|
219
|
+
# -H 'Accept: application/hal+json' \
|
220
|
+
# -H 'Authorization: Bearer <Access token>' \
|
221
|
+
# -d '{"deliveryDateNote": "Test DeliveryDateNote", "invoiceNote": "Test invoiceNote"}'
|
222
|
+
#
|
223
|
+
# @beyond_api.scopes +ordr:u
|
224
|
+
#
|
225
|
+
# @param order_id [String] the order UUID
|
226
|
+
# @param body [Hash] the request body
|
227
|
+
#
|
228
|
+
# @return [OpenStruct]
|
229
|
+
#
|
230
|
+
# @example
|
231
|
+
# body = {
|
232
|
+
# "deliveryDateNote" => "Test DeliveryDateNote",
|
233
|
+
# "invoiceNote" => "Test invoiceNote"
|
234
|
+
# }
|
235
|
+
# @order = session.orders.create_invoice("268a8629-55cd-4890-9013-936b9b5ea14c", body)
|
236
|
+
#
|
237
|
+
def create_invoice(order_id, body)
|
238
|
+
response, status = BeyondApi::Request.put(@session, "/orders/#{order_id}/create-invoice", body)
|
239
|
+
|
240
|
+
handle_response(response, status)
|
241
|
+
end
|
242
|
+
|
243
|
+
#
|
244
|
+
# A +POST+ request is used to create a new return process for an order. Return processes trigger a refund process.
|
245
|
+
#
|
246
|
+
# $ curl 'https://api-shop.beyondshop.cloud/api/orders/29007bb7-739a-46f5-8c70-4e1029b52fa5/processes/returns' -i -X POST \
|
247
|
+
# -H 'Content-Type: application/json' \
|
248
|
+
# -H 'Accept: application/hal+json' \
|
249
|
+
# -H 'Authorization: Bearer <Access token>' \
|
250
|
+
# -d '{
|
251
|
+
# "comment" : "This needs to be done fast!",
|
252
|
+
# "sendMail" : true,
|
253
|
+
# "lineItems" : [ {
|
254
|
+
# "quantity" : 3,
|
255
|
+
# "productLineItemId" : "bb9ad011-6417-4f04-8bc2-39651edebd2f",
|
256
|
+
# "status" : "RETURNED"
|
257
|
+
# } ],
|
258
|
+
# "shippingPriceRefund" : {
|
259
|
+
# "currency" : "EUR",
|
260
|
+
# "amount" : 19.99
|
261
|
+
# }
|
262
|
+
# }'
|
263
|
+
#
|
264
|
+
# @beyond_api.scopes +rtpr:c
|
265
|
+
#
|
266
|
+
# @param order_id [String] the order UUID
|
267
|
+
# @param body [Hash] the request body
|
268
|
+
#
|
269
|
+
# @return [OpenStruct]
|
270
|
+
#
|
271
|
+
# @example
|
272
|
+
# body = {
|
273
|
+
# "comment": "This needs to be done fast!",
|
274
|
+
# "sendMail": true,
|
275
|
+
# "lineItems": [{
|
276
|
+
# "quantity": 3,
|
277
|
+
# "productLineItemId": "bb9ad011-6417-4f04-8bc2-39651edebd2f",
|
278
|
+
# "status": "RETURNED"
|
279
|
+
# }],
|
280
|
+
# "shippingPriceRefund": {
|
281
|
+
# "currency": "EUR",
|
282
|
+
# "amount": 19.99
|
283
|
+
# }
|
284
|
+
# }
|
285
|
+
# @return_process = session.orders.create_return_process("268a8629-55cd-4890-9013-936b9b5ea14c", body)
|
286
|
+
#
|
287
|
+
def create_return_process(order_id, body)
|
288
|
+
response, status = BeyondApi::Request.post(@session, "/orders/#{order_id}/processes/returns", body)
|
289
|
+
|
290
|
+
handle_response(response, status)
|
291
|
+
end
|
292
|
+
|
293
|
+
#
|
294
|
+
# A +POST+ request is ussed to create a new shipping processes for an order.
|
295
|
+
#
|
296
|
+
# $ curl 'https://api-shop.beyondshop.cloud/api/orders/8df2fe3b-5149-492f-932a-073f012305eb/processes/shippings' -i -X POST \
|
297
|
+
# -H 'Content-Type: application/json' \
|
298
|
+
# -H 'Accept: application/hal+json' \
|
299
|
+
# -H 'Authorization: Bearer <Access token>' \
|
300
|
+
# -d '{
|
301
|
+
# "comment" : "This needs to be done fast!",
|
302
|
+
# "sendMail" : true,
|
303
|
+
# "createDeliveryNote" : true,
|
304
|
+
# "trackingCode" : "lookAtMyTrackingCodeWow",
|
305
|
+
# "trackingLink" : "http://tracking.is/fun?code=lookAtMyTrackingCodeWow",
|
306
|
+
# "lineItems" : [ {
|
307
|
+
# "quantity" : 3,
|
308
|
+
# "productLineItemId" : "e96e1b33-d9e9-4508-862a-816235b541f7"
|
309
|
+
# } ]
|
310
|
+
# }'
|
311
|
+
#
|
312
|
+
# @beyond_api.scopes +shpr:c
|
313
|
+
#
|
314
|
+
# @param order_id [String] the order UUID
|
315
|
+
# @param body [Hash] the request body
|
316
|
+
#
|
317
|
+
# @return [OpenStruct]
|
318
|
+
#
|
319
|
+
# @example
|
320
|
+
# body = {
|
321
|
+
# "comment" => "This needs to be done fast!",
|
322
|
+
# "send_mail" => true,
|
323
|
+
# "create_delivery_note" => true,
|
324
|
+
# "tracking_code" => "lookAtMyTrackingCodeWow",
|
325
|
+
# "tracking_link" => "http=>//tracking.is/fun?code=lookAtMyTrackingCodeWow",
|
326
|
+
# "line_items" => [ {
|
327
|
+
# "quantity" => 3,
|
328
|
+
# "product_line_item_id" => "e96e1b33-d9e9-4508-862a-816235b541f7"
|
329
|
+
# } ]
|
330
|
+
# }
|
331
|
+
# @shipping_process = session.orders.create_shipping_process("268a8629-55cd-9845-3114-454b9b5ea14c", "268a8629-55cd-4890-9013-936b9b5ea14a")
|
332
|
+
#
|
333
|
+
def create_shipping_process(order_id, body)
|
334
|
+
response, status = BeyondApi::Request.post(@session, "/orders/#{order_id}/processes/shippings", body)
|
335
|
+
|
336
|
+
handle_response(response, status)
|
337
|
+
end
|
338
|
+
|
339
|
+
#
|
340
|
+
# A +GET+ request is used to list all events of an order in a paged way.
|
341
|
+
#
|
342
|
+
# $ curl 'https://api-shop.beyondshop.cloud/api/orders/66b6aab5-2ed4-4f36-855e-3adb2ea873ee/events' -i -X GET \
|
343
|
+
# -H 'Accept: application/hal+json' \
|
344
|
+
# -H 'Authorization: Bearer <Access token>'
|
345
|
+
#
|
346
|
+
# @beyond_api.scopes +ordr:r
|
347
|
+
#
|
348
|
+
# @param order_id [String] the order UUID
|
349
|
+
# @option params [Integer] :size the page size
|
350
|
+
# @option params [Integer] :page the page number
|
351
|
+
#
|
352
|
+
# @return [OpenStruct]
|
353
|
+
#
|
354
|
+
# @example
|
355
|
+
# @events = session.orders.find("268a8629-55cd-4890-9013-936b9b5ea14c")
|
356
|
+
#
|
357
|
+
def events(order_id, params = {})
|
358
|
+
response, status = BeyondApi::Request.get(@session, "/orders/#{order_id}/events", params)
|
359
|
+
|
360
|
+
handle_response(response, status)
|
361
|
+
end
|
362
|
+
|
363
|
+
#
|
364
|
+
# A +GET+ request is used to retrieve the details of an order.
|
365
|
+
#
|
366
|
+
# $ curl 'https://api-shop.beyondshop.cloud/api/orders/a27f1019-3690-40d1-bd9d-d60dff4c4cf8' -i -X GET \
|
367
|
+
# -H 'Content-Type: application/json' \
|
368
|
+
# -H 'Accept: application/hal+json' \
|
369
|
+
# -H 'Authorization: Bearer <Access token>'
|
370
|
+
#
|
371
|
+
# @beyond_api.scopes +ordr:r
|
372
|
+
#
|
373
|
+
# @param order_id [String] the order UUID
|
374
|
+
#
|
375
|
+
# @return [OpenStruct]
|
376
|
+
#
|
377
|
+
# @example
|
378
|
+
# @order = session.orders.find("268a8629-55cd-4890-9013-936b9b5ea14c")
|
379
|
+
#
|
380
|
+
def find(order_id)
|
381
|
+
response, status = BeyondApi::Request.get(@session, "/orders/#{order_id}")
|
382
|
+
|
383
|
+
handle_response(response, status)
|
384
|
+
end
|
385
|
+
|
386
|
+
#
|
387
|
+
# A +POST+ request is used to mark the payment process as paid.
|
388
|
+
#
|
389
|
+
# $ curl 'https://api-shop.beyondshop.cloud/api/orders/9a1a1aaa-e37d-4c71-bc95-cbc228463fec/processes/payments/cb8c9a16-2d81-4ec1-9a4a-84a4c36124ae/mark-paid' -i -X POST \
|
390
|
+
# -H 'Content-Type: application/json' \
|
391
|
+
# -H 'Accept: application/hal+json' \
|
392
|
+
# -H 'Authorization: Bearer <Access token>' \
|
393
|
+
# -d '{
|
394
|
+
# "comment" : "comment",
|
395
|
+
# "details" : {
|
396
|
+
# "amount" : {
|
397
|
+
# "currency" : "EUR",
|
398
|
+
# "amount" : 77.44
|
399
|
+
# }
|
400
|
+
# }
|
401
|
+
# }'
|
402
|
+
#
|
403
|
+
# @beyond_api.scopes +pypr:u
|
404
|
+
#
|
405
|
+
# @param order_id [String] the order UUID
|
406
|
+
# @param payment_id [String] the payment UUID
|
407
|
+
# @param body [Hash] the request body
|
408
|
+
#
|
409
|
+
# @return [OpenStruct]
|
410
|
+
#
|
411
|
+
# @example
|
412
|
+
# body = {
|
413
|
+
# "comment" => "comment",
|
414
|
+
# "details" => {
|
415
|
+
# "amount" => {
|
416
|
+
# "currency" => "EUR",
|
417
|
+
# "amount" => 77.44
|
418
|
+
# }
|
419
|
+
# }
|
420
|
+
# }
|
421
|
+
#
|
422
|
+
# @payment_process = session.orders.mark_payment_process_as_paid("268a8629-55cd-4890-9013-936b9b5ea14c", "266d8608-55cd-4890-9474-296a9q1ea05q", body)
|
423
|
+
#
|
424
|
+
def mark_payment_process_as_paid(order_id, payment_id, body)
|
425
|
+
response, status = BeyondApi::Request.post(@session, "/orders/#{order_id}/processes/payments/#{payment_id}/mark-paid", body)
|
426
|
+
|
427
|
+
handle_response(response, status)
|
428
|
+
end
|
429
|
+
|
430
|
+
#
|
431
|
+
# A +POST+ request is used to mark the payment process as voided.
|
432
|
+
#
|
433
|
+
# $ curl 'https://api-shop.beyondshop.cloud/api/orders/a5558b7f-55f4-47d4-b603-9bf7eb59c05b/processes/payments/5bcc48e7-2641-42a8-a042-189ae92e9901/mark-voided' -i -X POST \
|
434
|
+
# -H 'Content-Type: application/json' \
|
435
|
+
# -H 'Accept: application/hal+json' \
|
436
|
+
# -H 'Authorization: Bearer <Access token>' \
|
437
|
+
# -d '{
|
438
|
+
# "comment" : "comment"
|
439
|
+
# }'
|
440
|
+
#
|
441
|
+
# @beyond_api.scopes +pypr:u
|
442
|
+
#
|
443
|
+
# @param order_id [String] the order UUID
|
444
|
+
# @param payment_id [String] the payment UUID
|
445
|
+
# @param body [Hash] the request body
|
446
|
+
#
|
447
|
+
# @return [OpenStruct]
|
448
|
+
#
|
449
|
+
# @example
|
450
|
+
# body = {
|
451
|
+
# "comment" => "comment"
|
452
|
+
# }
|
453
|
+
#
|
454
|
+
# @payment_process = session.orders.mark_payment_process_as_voided("268a8629-55cd-4890-9013-936b9b5ea14c", "266d8608-55cd-4890-9474-296a9q1ea05q", body)
|
455
|
+
#
|
456
|
+
def mark_payment_process_as_voided(order_id, payment_id, body)
|
457
|
+
response, status = BeyondApi::Request.post(@session, "/orders/#{order_id}/processes/payments/#{payment_id}/mark-voided", body)
|
458
|
+
|
459
|
+
handle_response(response, status)
|
460
|
+
end
|
461
|
+
|
462
|
+
#
|
463
|
+
# A +POST+ request is used to mark the refund process as paid.
|
464
|
+
#
|
465
|
+
# $ curl 'https://api-shop.beyondshop.cloud/api/orders/60baa84c-9e11-4d55-97a9-1a7b00a0691c/processes/refunds/active/mark-paid' -i -X POST \
|
466
|
+
# -H 'Content-Type: application/json' \
|
467
|
+
# -H 'Accept: application/hal+json' \
|
468
|
+
# -H 'Authorization: Bearer <Access token>' \
|
469
|
+
# -d '{
|
470
|
+
# "comment" : "comment",
|
471
|
+
# "details" : {
|
472
|
+
# "amount" : {
|
473
|
+
# "currency" : "EUR",
|
474
|
+
# "amount" : 19.98
|
475
|
+
# }
|
476
|
+
# }
|
477
|
+
# }'
|
478
|
+
#
|
479
|
+
# @beyond_api.scopes +rfpr:r
|
480
|
+
#
|
481
|
+
# @param order_id [String] the order UUID
|
482
|
+
#
|
483
|
+
# @return [OpenStruct]
|
484
|
+
#
|
485
|
+
# @example
|
486
|
+
# body = {
|
487
|
+
# "comment" => "comment",
|
488
|
+
# "details" => {
|
489
|
+
# "amount" => {
|
490
|
+
# "currency" => "EUR",
|
491
|
+
# "amount" => 19.98
|
492
|
+
# }
|
493
|
+
# }
|
494
|
+
# }
|
495
|
+
# @refund_process = session.orders.mark_refund_process_as_paid("268a8629-55cd-9845-3114-454b9b5ea14c", body)
|
496
|
+
#
|
497
|
+
def mark_refund_process_as_paid(order_id)
|
498
|
+
response, status = BeyondApi::Request.post(@session, "/orders/#{order_id}/processes/refunds/active/mark-paid")
|
499
|
+
|
500
|
+
handle_response(response, status)
|
501
|
+
end
|
502
|
+
|
503
|
+
#
|
504
|
+
# A +POST+ request is used to mark the shipment as delivered.
|
505
|
+
#
|
506
|
+
# $ curl 'https://api-shop.beyondshop.cloud/api/orders/b5642d1f-0f7f-444e-96d5-1c1d1642ea5e/processes/shippings/619d06d8-0077-4efd-b341-5103f71bfb2d/mark-delivered' -i -X POST \
|
507
|
+
# -H 'Content-Type: application/json' \
|
508
|
+
# -H 'Accept: application/hal+json' \
|
509
|
+
# -H 'Authorization: Bearer <Access token>' \
|
510
|
+
# -d '{
|
511
|
+
# "comment" : "comment"
|
512
|
+
# }'
|
513
|
+
#
|
514
|
+
# @beyond_api.scopes +shpr:u
|
515
|
+
#
|
516
|
+
# @param order_id [String] the order UUID
|
517
|
+
# @param shipping_id [String] the shipping UUID
|
518
|
+
# @param body [Hash] the request body
|
519
|
+
#
|
520
|
+
# @return [OpenStruct]
|
521
|
+
#
|
522
|
+
# @example
|
523
|
+
# body = {
|
524
|
+
# "comment" => "comment",
|
525
|
+
# }
|
526
|
+
#
|
527
|
+
# @shipping_process = session.orders.mark_shipping_process_as_delivered("268a8629-55cd-4890-9013-936b9b5ea14c", "266d8608-55cd-4890-9474-296a9q1ea05q", body)
|
528
|
+
#
|
529
|
+
def mark_shipping_process_as_delivered(order_id, shipping_process_id, body)
|
530
|
+
response, status = BeyondApi::Request.post(@session, "/orders/#{order_id}/processes/shippings/#{shipping_process_id}/mark-delivered", body)
|
531
|
+
|
532
|
+
handle_response(response, status)
|
533
|
+
end
|
534
|
+
|
535
|
+
#
|
536
|
+
# A +POST+ request is used to mark the shipment as shipped.
|
537
|
+
#
|
538
|
+
# $ curl 'https://api-shop.beyondshop.cloud/api/orders/dd6a7e20-16be-4509-bf83-fb8ee072ddad/processes/shippings/a0b0c4a5-0c80-47f4-98c3-0f55f4161176/mark-shipped' -i -X POST \
|
539
|
+
# -H 'Content-Type: application/json' \
|
540
|
+
# -H 'Accept: application/hal+json' \
|
541
|
+
# -H 'Authorization: Bearer <Access token>' \
|
542
|
+
# -d '{
|
543
|
+
# "comment" : "This needs to be done fast!",
|
544
|
+
# "sendMail" : true,
|
545
|
+
# "details" : {
|
546
|
+
# "trackingCode" : "lookAtMyTrackingCodeWow",
|
547
|
+
# "trackingLink" : "http://tracking.is/fun?code=lookAtMyTrackingCodeWow"
|
548
|
+
# }
|
549
|
+
# }'
|
550
|
+
#
|
551
|
+
# @beyond_api.scopes +shpr:u
|
552
|
+
#
|
553
|
+
# @param order_id [String] the order UUID
|
554
|
+
# @param shipping_id [String] the shipping UUID
|
555
|
+
# @param body [Hash] the request body
|
556
|
+
#
|
557
|
+
# @return [OpenStruct]
|
558
|
+
#
|
559
|
+
# @example
|
560
|
+
# body = {
|
561
|
+
# "comment" => "This needs to be done fast!",
|
562
|
+
# "sendMail" => true,
|
563
|
+
# "details" => {
|
564
|
+
# "trackingCode" => "lookAtMyTrackingCodeWow",
|
565
|
+
# "trackingLink" => "http://tracking.is/fun?code=lookAtMyTrackingCodeWow"
|
566
|
+
# }
|
567
|
+
# }
|
568
|
+
#
|
569
|
+
# @shipping_process = session.orders.mark_shipping_process_as_shipped("268a8629-55cd-4890-9013-936b9b5ea14c", "266d8608-55cd-4890-9474-296a9q1ea05q", body)
|
570
|
+
#
|
571
|
+
def mark_shipping_process_as_shipped(order_id, shipping_id, body)
|
572
|
+
response, status = BeyondApi::Request.post(@session, "/orders/#{order_id}/processes/shippings/#{shipping_id}/mark-shipped", body)
|
573
|
+
|
574
|
+
handle_response(response, status)
|
575
|
+
end
|
576
|
+
|
577
|
+
#
|
578
|
+
# A +GET+ request is used to retrieve the payment processes.
|
579
|
+
#
|
580
|
+
# $ curl 'https://api-shop.beyondshop.cloud/api/orders/d44ed295-6a08-47ba-a288-90d4f3ba9fff/processes/payments/be56bfbd-af95-45b9-8b0e-cb0c184aaf60' -i -X GET \
|
581
|
+
# -H 'Content-Type: application/json' \
|
582
|
+
# -H 'Accept: application/hal+json' \
|
583
|
+
# -H 'Authorization: Bearer <Access token>'
|
584
|
+
#
|
585
|
+
# @beyond_api.scopes +pypr:r
|
586
|
+
#
|
587
|
+
# @param order_id [String] the order UUID
|
588
|
+
# @param payment_id [String] the payment UUID
|
589
|
+
#
|
590
|
+
# @return [OpenStruct]
|
591
|
+
#
|
592
|
+
# @example
|
593
|
+
# @payment_process = session.orders.payment_process("268a8629-55cd-4890-9013-936b9b5ea14c", "266d8608-55cd-4890-9474-296a9q1ea05q")
|
594
|
+
#
|
595
|
+
def payment_process(order_id, payment_id)
|
596
|
+
response, status = BeyondApi::Request.get(@session, "/orders/#{order_id}/processes/payments/#{payment_id}")
|
597
|
+
|
598
|
+
handle_response(response, status)
|
599
|
+
end
|
600
|
+
|
601
|
+
#
|
602
|
+
# A +GET+ request is used to list all payment processes of an order in a paged way.
|
603
|
+
#
|
604
|
+
# $ curl 'https://api-shop.beyondshop.cloud/api/orders/2012b775-a706-41e0-b0f9-5142864ca4a0/processes/payments?page=0&size=20' -i -X GET \
|
605
|
+
# -H 'Content-Type: application/json' \
|
606
|
+
# -H 'Accept: application/hal+json' \
|
607
|
+
# -H 'Authorization: Bearer <Access token>'
|
608
|
+
#
|
609
|
+
# @beyond_api.scopes +pypr:r
|
610
|
+
#
|
611
|
+
# @param order_id [String] the order UUID
|
612
|
+
# @option params [Integer] :size the page size
|
613
|
+
# @option params [Integer] :page the page number
|
614
|
+
#
|
615
|
+
# @return [OpenStruct]
|
616
|
+
#
|
617
|
+
# @example
|
618
|
+
# @payment_processes = session.orders.payment_processes("268a8629-55cd-4890-9013-936b9b5ea14c", {page: 0, size: 20})
|
619
|
+
#
|
620
|
+
def payment_processes(order_id, params = {})
|
621
|
+
response, status = BeyondApi::Request.get(@session, "/orders/#{order_id}/processes/payments", params)
|
622
|
+
|
623
|
+
handle_response(response, status)
|
624
|
+
end
|
625
|
+
|
626
|
+
#
|
627
|
+
# A +GET+ request is used to list all order processes.
|
628
|
+
#
|
629
|
+
# $ curl 'https://api-shop.beyondshop.cloud/api/orders/934ece52-055c-4896-8d16-560f1461ea56/processes' -i -X GET \
|
630
|
+
# -H 'Content-Type: application/json' \
|
631
|
+
# -H 'Accept: application/hal+json' \
|
632
|
+
# -H 'Authorization: Bearer <Access token>'
|
633
|
+
#
|
634
|
+
# @beyond_api.scopes +ordr:r
|
635
|
+
#
|
636
|
+
# @param order_id [String] the order UUID
|
637
|
+
#
|
638
|
+
# @return [OpenStruct]
|
639
|
+
#
|
640
|
+
# @example
|
641
|
+
# @orders = session.orders.processes("268a8629-55cd-4890-9013-936b9b5ea14c")
|
642
|
+
#
|
643
|
+
def processes(order_id)
|
644
|
+
response, status = BeyondApi::Request.get(@session, "/orders/#{order_id}/processes")
|
645
|
+
|
646
|
+
handle_response(response, status)
|
647
|
+
end
|
648
|
+
|
649
|
+
#
|
650
|
+
# A +GET+ request is used to retrieve the refund processes.
|
651
|
+
#
|
652
|
+
# $ curl 'https://api-shop.beyondshop.cloud/api/orders/801885c8-0b25-44a2-a1a4-60cbf3f9ecca/processes/refunds/4c02883f-be31-4fb2-ad0d-ccbc3678a9f5' -i -X GET \
|
653
|
+
# -H 'Content-Type: application/json' \
|
654
|
+
# -H 'Accept: application/hal+json' \
|
655
|
+
# -H 'Authorization: Bearer <Access token>'
|
656
|
+
#
|
657
|
+
# @beyond_api.scopes +rfpr:r
|
658
|
+
#
|
659
|
+
# @param order_id [String] the order UUID
|
660
|
+
# @param refund_id [String] the refund UUID
|
661
|
+
#
|
662
|
+
# @return [OpenStruct]
|
663
|
+
#
|
664
|
+
# @example
|
665
|
+
# @refund_process = session.orders.refund_process("268a8629-55cd-9845-3114-454b9b5ea14c", "268a8629-55cd-4890-9013-936b9b5ea14a")
|
666
|
+
#
|
667
|
+
def refund_process(order_id, refund_id)
|
668
|
+
response, status = BeyondApi::Request.get(@session, "/orders/#{order_id}/processes/refunds/#{refund_id}")
|
669
|
+
|
670
|
+
handle_response(response, status)
|
671
|
+
end
|
672
|
+
|
673
|
+
#
|
674
|
+
# A +GET+ request is used to list all refund processes of an order in a paged way. Refunds are triggered if either a cancelation or return process is created. See {Create cancelation processes}[http://docs.beyondshop.cloud/#resources-cancel-processes-create] and {Create return processes}[http://docs.beyondshop.cloud/#resources-return-processes-create] for more information.
|
675
|
+
#
|
676
|
+
# $ curl 'https://api-shop.beyondshop.cloud/api/orders/6f86e42f-763e-4514-a37d-fb8f88cdc14c/processes/refunds?page=0&size=20' -i -X GET \
|
677
|
+
# -H 'Content-Type: application/json' \
|
678
|
+
# -H 'Accept: application/hal+json' \
|
679
|
+
# -H 'Authorization: Bearer <Access token>'
|
680
|
+
#
|
681
|
+
# @beyond_api.scopes +rfpr:r
|
682
|
+
#
|
683
|
+
# @param order_id [String] the order UUID
|
684
|
+
# @option params [Integer] :size the page size
|
685
|
+
# @option params [Integer] :page the page number
|
686
|
+
#
|
687
|
+
# @return [OpenStruct]
|
688
|
+
#
|
689
|
+
# @example
|
690
|
+
# @refund_processes = session.orders.refund_processes("268a8629-55cd-4890-9013-936b9b5ea14c", {page: 0, size: 20})
|
691
|
+
#
|
692
|
+
def refund_processes(order_id, params = {})
|
693
|
+
response, status = BeyondApi::Request.get(@session, "/orders/#{order_id}/processes/refunds", params)
|
694
|
+
|
695
|
+
handle_response(response, status)
|
696
|
+
end
|
697
|
+
|
698
|
+
#
|
699
|
+
# A +GET+ request is used to list all return processes of an order in a paged way.
|
700
|
+
#
|
701
|
+
# $ curl 'https://api-shop.beyondshop.cloud/api/orders/cb9927e4-60d1-4a90-b40c-f5a8e2b25301/processes/returns/910a3fde-cb23-418f-876a-694ce42245ef' -i -X GET \
|
702
|
+
# -H 'Content-Type: application/json' \
|
703
|
+
# -H 'Accept: application/hal+json' \
|
704
|
+
# -H 'Authorization: Bearer <Access token>'
|
705
|
+
#
|
706
|
+
# @beyond_api.scopes +rtpr:r
|
707
|
+
#
|
708
|
+
# @param order_id [String] the order UUID
|
709
|
+
# @param return_process_id [String] the return process UUID
|
710
|
+
#
|
711
|
+
# @return [OpenStruct]
|
712
|
+
#
|
713
|
+
# @example
|
714
|
+
# @return_process = session.orders.return_process("268a8629-55cd-4890-9013-936b9b5ea14c", "910a3fde-cb23-418f-876a-694ce42245ef")
|
715
|
+
#
|
716
|
+
def return_process(order_id, return_process_id)
|
717
|
+
response, status = BeyondApi::Request.get(@session, "/orders/#{order_id}/processes/returns/#{return_process_id}")
|
718
|
+
|
719
|
+
handle_response(response, status)
|
720
|
+
end
|
721
|
+
|
722
|
+
#
|
723
|
+
# A +GET+ request is used to list all return processes of an order in a paged way.
|
724
|
+
#
|
725
|
+
# $ curl 'https://api-shop.beyondshop.cloud/api/orders/9e26232f-aa7a-408b-8041-9439999268c5/processes/returns?page=0&size=20' -i -X GET \
|
726
|
+
# -H 'Content-Type: application/json' \
|
727
|
+
# -H 'Accept: application/hal+json' \
|
728
|
+
# -H 'Authorization: Bearer <Access token>'
|
729
|
+
#
|
730
|
+
# @beyond_api.scopes +rtpr:r
|
731
|
+
#
|
732
|
+
# @param order_id [String] the order UUID
|
733
|
+
# @option params [Integer] :size the page size
|
734
|
+
# @option params [Integer] :page the page number
|
735
|
+
#
|
736
|
+
# @return [OpenStruct]
|
737
|
+
#
|
738
|
+
# @example
|
739
|
+
# @return_processes = session.orders.return_processes("268a8629-55cd-4890-9013-936b9b5ea14c", {page: 0, size: 20})
|
740
|
+
#
|
741
|
+
def return_processes(order_id, params = {})
|
742
|
+
response, status = BeyondApi::Request.get(@session, "/orders/#{order_id}/processes/returns", params)
|
743
|
+
|
744
|
+
handle_response(response, status)
|
745
|
+
end
|
746
|
+
|
747
|
+
#
|
748
|
+
# A +GET+ request is used to retrieve the details of an order by cart ID.
|
749
|
+
#
|
750
|
+
# @beyond_api.scopes +ordr:r
|
751
|
+
#
|
752
|
+
# @param cart_id [String] the cart UUID
|
753
|
+
#
|
754
|
+
# @return [OpenStruct]
|
755
|
+
#
|
756
|
+
# @example
|
757
|
+
# @order = session.orders.search_by_cart_id("268a8629-55cd-4890-9013-936b9b5ea14c")
|
758
|
+
#
|
759
|
+
def search_by_cart_id(cart_id)
|
760
|
+
response, status = BeyondApi::Request.get(@session, "/orders/search/find-by-cart-id", {"cartId": cart_id})
|
761
|
+
|
762
|
+
handle_response(response, status)
|
763
|
+
end
|
764
|
+
|
765
|
+
#
|
766
|
+
# A +GET+ request is used to retrieve the +orderNumber+ and +orderId+ of an order by cart Id. If there is no order for the given cart Id, a HTTP 404 - NOT FOUND response is returned.
|
767
|
+
#
|
768
|
+
# @param cart_id [String] the cart UUID
|
769
|
+
#
|
770
|
+
# @return [OpenStruct]
|
771
|
+
#
|
772
|
+
# @example
|
773
|
+
# @order = session.orders.search_by_cart_id("268a8629-55cd-4890-9013-936b9b5ea14c")
|
774
|
+
#
|
775
|
+
def search_order_number_by_cart_id(cart_id)
|
776
|
+
response, status = BeyondApi::Request.get(@session, "/orders/search/find-order-number-by-cart-id", {"cartId": cart_id})
|
777
|
+
|
778
|
+
handle_response(response, status)
|
779
|
+
end
|
780
|
+
|
781
|
+
#
|
782
|
+
# A +GET+ request is used to send an invoice for the order.
|
783
|
+
#
|
784
|
+
# $ curl 'https://api-shop.beyondshop.cloud/api/orders/73bb3fbb-7146-4088-a0d8-dd24dc030e07/send-invoice' -i -X POST \
|
785
|
+
# -H 'Accept: application/hal+json' \
|
786
|
+
# -H 'Authorization: Bearer <Access token>'
|
787
|
+
#
|
788
|
+
# @param order_id [String] the order_id UUID
|
789
|
+
#
|
790
|
+
# @return [OpenStruct]
|
791
|
+
#
|
792
|
+
# @example
|
793
|
+
# @order = session.orders.send_invoice("268a8629-55cd-4890-9013-936b9b5ea14c")
|
794
|
+
#
|
795
|
+
def send_invoice(order_id)
|
796
|
+
response, status = BeyondApi::Request.post(@session, "/orders/#{order_id}/send-invoice")
|
797
|
+
|
798
|
+
handle_response(response, status)
|
799
|
+
end
|
800
|
+
|
801
|
+
#
|
802
|
+
# A +GET+ request is used to retrieve the shipping process details.
|
803
|
+
#
|
804
|
+
# $ curl 'https://api-shop.beyondshop.cloud/api/orders/af42860f-2813-4130-85d9-2d315a4f802e/processes/shippings/80ebe96b-bcd5-4a34-a428-8a67ed114ce6' -i -X GET \
|
805
|
+
# -H 'Content-Type: application/json' \
|
806
|
+
# -H 'Accept: application/hal+json' \
|
807
|
+
# -H 'Authorization: Bearer <Access token>'
|
808
|
+
#
|
809
|
+
# @beyond_api.scopes +shpr:r
|
810
|
+
#
|
811
|
+
# @param order_id [String] the order UUID
|
812
|
+
# @param shipping_process_id [String] the shipping process UUID
|
813
|
+
#
|
814
|
+
# @return [OpenStruct]
|
815
|
+
#
|
816
|
+
# @example
|
817
|
+
# @shipping_process = session.orders.refund_process("268a8629-55cd-9845-3114-454b9b5ea14c", "268a8629-55cd-4890-9013-936b9b5ea14a")
|
818
|
+
#
|
819
|
+
def shipping_process(order_id, shipping_process_id)
|
820
|
+
response, status = BeyondApi::Request.get(@session, "/orders/#{order_id}/processes/shippings/#{shipping_process_id}")
|
821
|
+
|
822
|
+
handle_response(response, status)
|
823
|
+
end
|
824
|
+
|
825
|
+
#
|
826
|
+
# A +GET+ request is used to list all shipping processes of an order in a paged way.
|
827
|
+
#
|
828
|
+
# $ curl 'https://api-shop.beyondshop.cloud/api/orders/d6387876-5e93-48dc-a6f3-f85893149819/processes/shippings?page=0&size=20' -i -X GET \
|
829
|
+
# -H 'Content-Type: application/json' \
|
830
|
+
# -H 'Accept: application/hal+json' \
|
831
|
+
# -H 'Authorization: Bearer <Access token>'
|
832
|
+
#
|
833
|
+
# @beyond_api.scopes +shpr:r
|
834
|
+
#
|
835
|
+
# @param order_id [String] the order UUID
|
836
|
+
# @option params [Integer] :size the page size
|
837
|
+
# @option params [Integer] :page the page number
|
838
|
+
#
|
839
|
+
# @return [OpenStruct]
|
840
|
+
#
|
841
|
+
# @example
|
842
|
+
# @shipping_processes = session.orders.shipping_processes("268a8629-55cd-4890-9013-936b9b5ea14c", {page: 0, size: 20})
|
843
|
+
#
|
844
|
+
def shipping_processes(order_id, params = {})
|
845
|
+
response, status = BeyondApi::Request.get(@session, "/orders/#{order_id}/processes/shippings", params)
|
846
|
+
|
847
|
+
handle_response(response, status)
|
848
|
+
end
|
849
|
+
|
850
|
+
#
|
851
|
+
# A +PUT+ request is used to change the customer’s billing address.
|
852
|
+
#
|
853
|
+
# @beyond_api.scopes +ordr:u
|
854
|
+
#
|
855
|
+
# @param order_id [String] the order UUID
|
856
|
+
# @param body [Hash] the request body
|
857
|
+
#
|
858
|
+
# @return [OpenStruct]
|
859
|
+
#
|
860
|
+
# @example
|
861
|
+
# body = {
|
862
|
+
# "address" => {
|
863
|
+
# "salutation" => "Mrs",
|
864
|
+
# "gender" => "FEMALE",
|
865
|
+
# "company" => "Astrid Alster GmbH",
|
866
|
+
# "title" => nil,
|
867
|
+
# "firstName" => "Astrid",
|
868
|
+
# "middleName" => "Agnes",
|
869
|
+
# "lastName" => "Alster",
|
870
|
+
# "street" => "Alsterwasserstraße",
|
871
|
+
# "houseNumber" => "3",
|
872
|
+
# "street2" => "Erdgeschoss",
|
873
|
+
# "addressExtension" => "Hinterhof",
|
874
|
+
# "postalCode" => "20999",
|
875
|
+
# "dependentLocality" => "Seevetal",
|
876
|
+
# "city" => "Alsterwasser",
|
877
|
+
# "country" => "DE",
|
878
|
+
# "state" => "Hamburg",
|
879
|
+
# "email" => "a.alsterh@example.com",
|
880
|
+
# "phone" => "(800) 555-0102",
|
881
|
+
# "mobile" => "(800) 555-0103",
|
882
|
+
# "vatId" => "DE123456789",
|
883
|
+
# "taxNumber" => "HRE 987654/32123/864516",
|
884
|
+
# "birthDate" => "1985-05-11",
|
885
|
+
# "displayAddressLines" => [ "Astrid Alster GmbH", "Astrid Agnes Alster", "Alsterwasserweg 2", "Erdgeschoss", "Seevetal", "20999 Alsterwasser", "Germany" ],
|
886
|
+
# "_id" => null
|
887
|
+
# },
|
888
|
+
# "comment" => "Updated billing address"
|
889
|
+
# }
|
890
|
+
# @order = session.orders.update_billing_address("268a8629-55cd-4890-9013-936b9b5ea14c", body)
|
891
|
+
#
|
892
|
+
def update_billing_address(order_id, body)
|
893
|
+
response, status = BeyondApi::Request.put(@session, "/orders/#{order_id}/billing-address", body)
|
894
|
+
|
895
|
+
handle_response(response, status)
|
896
|
+
end
|
897
|
+
|
898
|
+
#
|
899
|
+
# A +PUT+ request is used to change the order note.
|
900
|
+
#
|
901
|
+
# @beyond_api.scopes +ordr:u
|
902
|
+
#
|
903
|
+
# @param order_id [String] the order UUID
|
904
|
+
# @param body [Hash] the request body
|
905
|
+
#
|
906
|
+
# @return [OpenStruct]
|
907
|
+
#
|
908
|
+
# @example
|
909
|
+
# body = {
|
910
|
+
# "orderNote" => "not paid yet"
|
911
|
+
# }
|
912
|
+
# @order = session.orders.update_order_note("268a8629-55cd-4890-9013-936b9b5ea14c", body)
|
913
|
+
#
|
914
|
+
def update_order_note(order_id, body)
|
915
|
+
response, status = BeyondApi::Request.put(@session, "/orders/#{order_id}/order-note", body)
|
916
|
+
|
917
|
+
handle_response(response, status)
|
918
|
+
end
|
919
|
+
|
920
|
+
#
|
921
|
+
# A +PUT+ request is used to change the customer’s shipping.
|
922
|
+
#
|
923
|
+
# @beyond_api.scopes +ordr:u
|
924
|
+
#
|
925
|
+
# @param order_id [String] the order UUID
|
926
|
+
# @param body [Hash] the request body
|
927
|
+
#
|
928
|
+
# @return [OpenStruct]
|
929
|
+
#
|
930
|
+
# @example
|
931
|
+
# body = {
|
932
|
+
# "address" => {
|
933
|
+
# "salutation" => "Mrs",
|
934
|
+
# "gender" => "FEMALE",
|
935
|
+
# "company" => "Astrid Alster GmbH",
|
936
|
+
# "title" => nil,
|
937
|
+
# "firstName" => "Astrid",
|
938
|
+
# "middleName" => "Agnes",
|
939
|
+
# "lastName" => "Alster",
|
940
|
+
# "street" => "Alsterwasserstraße",
|
941
|
+
# "houseNumber" => "3",
|
942
|
+
# "street2" => "Erdgeschoss",
|
943
|
+
# "addressExtension" => "Hinterhof",
|
944
|
+
# "postalCode" => "20999",
|
945
|
+
# "dependentLocality" => "Seevetal",
|
946
|
+
# "city" => "Alsterwasser",
|
947
|
+
# "country" => "DE",
|
948
|
+
# "state" => "Hamburg",
|
949
|
+
# "email" => "a.alsterh@example.com",
|
950
|
+
# "phone" => "(800) 555-0102",
|
951
|
+
# "mobile" => "(800) 555-0103",
|
952
|
+
# "vatId" => "DE123456789",
|
953
|
+
# "taxNumber" => "HRE 987654/32123/864516",
|
954
|
+
# "birthDate" => "1985-05-11",
|
955
|
+
# "displayAddressLines" => [ "Astrid Alster GmbH", "Astrid Agnes Alster", "Alsterwasserweg 2", "Erdgeschoss", "Seevetal", "20999 Alsterwasser", "Germany" ],
|
956
|
+
# "_id" => null
|
957
|
+
# },
|
958
|
+
# "comment" => "Updated shipping address"
|
959
|
+
# }
|
960
|
+
# @order = session.orders.update_shipping_address("268a8629-55cd-4890-9013-936b9b5ea14c", body)
|
961
|
+
#
|
962
|
+
def update_shipping_address(order_id, body)
|
963
|
+
response, status = BeyondApi::Request.put(@session, "/orders/#{order_id}/shipping-address", body)
|
964
|
+
|
965
|
+
handle_response(response, status)
|
966
|
+
end
|
967
|
+
end
|
968
|
+
end
|