Class: BeyondApi::Orders

Inherits:
Base
  • Object
show all
Includes:
Utils
Defined in:
lib/beyond_api/resources/orders.rb

Instance Attribute Summary

Attributes inherited from Base

#session

Instance Method Summary collapse

Methods included from Utils

#file_content_type, #handle_all_request, #handle_error, #handle_response, #sanitize_key, #sanitize_response, #to_object_struct

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from BeyondApi::Base

Instance Method Details

#active_payment_process(order_id) ⇒ OpenStruct

A GET request is used to retrieve the active payment processes. There is only one active payment process. See Show payment process details for more information about the request and response structure.

$ curl 'https://api-shop.beyondshop.cloud/api/orders/208e2c1d-6610-43c7-b2f1-20aad6f029b9/processes/payments/active' -i -X GET \
    -H 'Content-Type: application/json' \
    -H 'Accept: application/hal+json' \
    -H 'Authorization: Bearer <Access token>'

Examples:

@payment_process = session.orders.active_payment_process("208e2c1d-6610-43c7-b2f1-20aad6f029b9")

Parameters:

  • order_id (String)

    the order UUID

Returns:

  • (OpenStruct)

Scopes:

  • pypr:r



26
27
28
29
30
31
32
33
# File 'lib/beyond_api/resources/orders.rb', line 26

def active_payment_process(order_id)
  path = "/orders/#{order_id}/processes/payments/active"

  response, status = BeyondApi::Request.get(@session,
                                            path)

  handle_response(response, status)
end

#active_refund_process(order_id) ⇒ OpenStruct

A GET request is used to retrieve the active refund processes. There is only one active refund process. See Show refund process details for more information about the request and response structure.

$ curl 'https://api-shop.beyondshop.cloud/api/orders/8613295f-4d44-4143-bfd0-6b81fc178618/processes/refunds/active' -i -X GET \
    -H 'Content-Type: application/json' \
    -H 'Accept: application/hal+json' \
    -H 'Authorization: Bearer <Access token>'

Examples:

@refund_process = session.orders.active_refund_process("8613295f-4d44-4143-bfd0-6b81fc178618")

Parameters:

  • order_id (String)

    the order UUID

Returns:

  • (OpenStruct)

Scopes:

  • rfpr:r



52
53
54
55
56
57
58
59
# File 'lib/beyond_api/resources/orders.rb', line 52

def active_refund_process(order_id)
  path = "/orders/#{order_id}/processes/refunds/active"

  response, status = BeyondApi::Request.get(@session,
                                            path)

  handle_response(response, status)
end

#all(params = {}) ⇒ OpenStruct

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.

Examples:

@orders = session.orders.all(size: 100, page: 0)

Parameters:

  • params (Hash) (defaults to: {})

    a customizable set of options

Options Hash (params):

  • :paginated (Boolean)
  • :size (Integer)

    the page size

  • :page (Integer)

    the page number

Returns:

  • (OpenStruct)

Scopes:

  • ordr:r



75
76
77
78
79
# File 'lib/beyond_api/resources/orders.rb', line 75

def all(params = {})
  path = "/orders"

  handle_all_request(path, :orders, params)
end

#cancel(order_id, body) ⇒ OpenStruct

A POST request is used to cancel an order.

$ curl 'https://api-shop.beyondshop.cloud/api/orders/e3f9264a-395b-407d-9036-00f38f609be6/cancel' -i -X POST \
    -H 'Content-Type: application/json' \
    -H 'Accept: application/hal+json' \
    -H 'Authorization: Bearer <Access token>' \
    -d '{
    "comment" : "This needs to be done fast!"
}'

Examples:

body = {
  "comment"=> "This needs to be done fast!"
}
@order = session.orders.cancel("e3f9264a-395b-407d-9036-00f38f609be6", body)

Parameters:

  • order_id (String)

    the order UUID

  • body (Hash)

    the request body

Returns:

  • (OpenStruct)

Scopes:

  • clpr:c



105
106
107
108
109
110
111
112
113
# File 'lib/beyond_api/resources/orders.rb', line 105

def cancel(order_id, body)
  path = "/orders/#{order_id}/cancel"

  response, status = BeyondApi::Request.post(@session,
                                             path,
                                             body)

  handle_response(response, status)
end

#cancelation_process(order_id, cancelation_id) ⇒ OpenStruct

A GET request is used to retrieve the cancelation process details of an order.

$ curl 'https://api-shop.beyondshop.cloud/api/orders/f16cf0db-7449-4029-a886-76f38b4aa464/processes/cancelations/365b4b63-45a8-49f6-94c5-a65e0dee83b5' -i -X GET \
    -H 'Content-Type: application/json' \
    -H 'Accept: application/hal+json' \
    -H 'Authorization: Bearer <Access token>'

Examples:

@pcancelation_process = session.orders.cancelation_process("f16cf0db-7449-4029-a886-76f38b4aa464", "365b4b63-45a8-49f6-94c5-a65e0dee83b5")

Parameters:

  • order_id (String)

    the order UUID

  • cancelation_id (String)

    the cancelation UUID

Returns:

  • (OpenStruct)

Scopes:

  • clpr:r



133
134
135
136
137
138
139
140
# File 'lib/beyond_api/resources/orders.rb', line 133

def cancelation_process(order_id, cancelation_id)
  path = "/orders/#{order_id}/processes/payments/cancelations/#{cancelation_id}"

  response, status = BeyondApi::Request.get(@session,
                                            path)

  handle_response(response, status)
end

#cancelation_processes(order_id, params = {}) ⇒ OpenStruct

A GET request is used to list all cancelation processes of an order in a paged way.

$ curl 'https://api-shop.beyondshop.cloud/api/orders/b8cb904d-4c82-4c39-a3a4-de7cb181a5d3/processes/cancelations?page=0&size=20' -i -X GET \
    -H 'Content-Type: application/json' \
    -H 'Accept: application/hal+json' \
    -H 'Authorization: Bearer <Access token>'

Examples:

@pcancelation_processes = session.orders.cancelation_processes("b8cb904d-4c82-4c39-a3a4-de7cb181a5d3", {page: 0, size: 20})

Parameters:

  • order_id (String)

    the order UUID

  • params (Hash) (defaults to: {})

    a customizable set of options

Options Hash (params):

  • :size (Integer)

    the page size

  • :page (Integer)

    the page number

Returns:

  • (OpenStruct)

Scopes:

  • clpr:r



161
162
163
164
165
166
167
168
169
# File 'lib/beyond_api/resources/orders.rb', line 161

def cancelation_processes(order_id, params = {})
  path = "/orders/#{order_id}/processes/payments/cancelations"

  response, status = BeyondApi::Request.get(@session,
                                            path,
                                            params)

  handle_response(response, status)
end

#capture_payment_process(order_id, payment_id) ⇒ OpenStruct

A POST request is used to capture the payment.

$ curl 'https://api-shop.beyondshop.cloud/api/orders/ebfd99d6-f025-4c97-96d2-d5adbb45d6c2/processes/payments/2936deca-fd56-4c0d-88e2-8030c897bf90/capture' -i -X POST \
    -H 'Accept: application/hal+json' \
    -H 'Authorization: Bearer <Access token>'

Examples:

@payment_process = session.orders.capture_payment_process("ebfd99d6-f025-4c97-96d2-d5adbb45d6c2", "2936deca-fd56-4c0d-88e2-8030c897bf90")

Parameters:

  • order_id (String)

    the order UUID

  • payment_id (String)

    the payment UUID

Returns:

  • (OpenStruct)

Scopes:

  • pypr:u



188
189
190
191
192
193
194
195
# File 'lib/beyond_api/resources/orders.rb', line 188

def capture_payment_process(order_id, payment_id)
  path = "/orders/#{order_id}/processes/payments/#{payment_id}/capture"

  response, status = BeyondApi::Request.post(@session,
                                             path)

  handle_response(response, status)
end

#create_cancelation_process(order_id, body) ⇒ OpenStruct

A POST request is used to create a new cancelation process for an order. Cancelation processes trigger a refund process.

$ curl 'https://api-shop.beyondshop.cloud/api/orders/9072c00d-1bc7-4fd8-8836-94ada5084e7a/processes/cancelations' -i -X POST \
    -H 'Content-Type: application/json' \
    -H 'Accept: application/hal+json' \
    -H 'Authorization: Bearer <Access token>' \
    -d '{
  "comment" : "This needs to be done fast!",
  "lineItems" : [ {
    "quantity" : 3,
    "productLineItemId" : "0e1f8ab4-ec78-42a6-9a46-a3384cd17d52"
  } ]
}'

Examples:

body = {
  "comment"=> "This needs to be done fast!",
  "lineItems"=> [{
    "quantity"=> 3,
    "productLineItemId"=> "0e1f8ab4-ec78-42a6-9a46-a3384cd17d52"
  }]
}
@cancelation_process = session.orders.create_cancelation_process("9072c00d-1bc7-4fd8-8836-94ada5084e7a", body)

Parameters:

  • order_id (String)

    the order UUID

  • body (Hash)

    the request body

Returns:

  • (OpenStruct)

Scopes:

  • clpr:c



229
230
231
232
233
234
235
236
237
# File 'lib/beyond_api/resources/orders.rb', line 229

def create_cancelation_process(order_id, body)
  path = "/orders/#{order_id}/processes/payments/cancelations"

  response, status = BeyondApi::Request.post(@session,
                                             path,
                                             body)

  handle_response(response, status)
end

#create_invoice(order_id, body) ⇒ OpenStruct

A POST request is used to create an invoice for the order.

$ curl 'https://api-shop.beyondshop.cloud/api/orders/a5d4d6c6-e77d-4180-8dbf-729f38a698b2/create-invoice' -i -X POST \
    -H 'Content-Type: application/json' \
    -H 'Accept: application/hal+json' \
    -H 'Authorization: Bearer <Access token>' \
    -d '{"deliveryDateNote": "Test DeliveryDateNote", "invoiceNote": "Test invoiceNote"}'

Examples:

body = {
  "deliveryDateNote" => "Test DeliveryDateNote",
  "invoiceNote" => "Test invoiceNote"
}
@order = session.orders.create_invoice("a5d4d6c6-e77d-4180-8dbf-729f38a698b2", body)

Parameters:

  • order_id (String)

    the order UUID

  • body (Hash)

    the request body

Returns:

  • (OpenStruct)

Scopes:

  • ordr:u



262
263
264
265
266
267
268
269
270
# File 'lib/beyond_api/resources/orders.rb', line 262

def create_invoice(order_id, body)
  path = "/orders/#{order_id}/create-invoice"

  response, status = BeyondApi::Request.put(@session,
                                            path,
                                            body)

  handle_response(response, status)
end

#create_return_process(order_id, body) ⇒ OpenStruct

A POST request is used to create a new return process for an order. Return processes trigger a refund process.

$ curl 'https://api-shop.beyondshop.cloud/api/orders/29007bb7-739a-46f5-8c70-4e1029b52fa5/processes/returns' -i -X POST \
    -H 'Content-Type: application/json' \
    -H 'Accept: application/hal+json' \
    -H 'Authorization: Bearer <Access token>' \
    -d '{
  "comment" : "This needs to be done fast!",
  "sendMail" : true,
  "lineItems" : [ {
    "quantity" : 3,
    "productLineItemId" : "bb9ad011-6417-4f04-8bc2-39651edebd2f",
    "status" : "RETURNED"
  } ],
  "shippingPriceRefund" : {
    "currency" : "EUR",
    "amount" : 19.99
  }
}'

Examples:

body = {
  "comment": "This needs to be done fast!",
  "sendMail": true,
  "lineItems": [{
    "quantity": 3,
    "productLineItemId": "bb9ad011-6417-4f04-8bc2-39651edebd2f",
    "status": "RETURNED"
  }],
  "shippingPriceRefund": {
    "currency": "EUR",
    "amount": 19.99
  }
}
@return_process = session.orders.create_return_process("29007bb7-739a-46f5-8c70-4e1029b52fa5", body)

Parameters:

  • order_id (String)

    the order UUID

  • body (Hash)

    the request body

Returns:

  • (OpenStruct)

Scopes:

  • rtpr:c



316
317
318
319
320
321
322
323
324
# File 'lib/beyond_api/resources/orders.rb', line 316

def create_return_process(order_id, body)
  path = "/orders/#{order_id}/processes/returns"

  response, status = BeyondApi::Request.post(@session,
                                             path,
                                             body)

  handle_response(response, status)
end

#create_shipping_process(order_id, body) ⇒ OpenStruct

A POST request is ussed to create a new shipping processes for an order.

$ curl 'https://api-shop.beyondshop.cloud/api/orders/8df2fe3b-5149-492f-932a-073f012305eb/processes/shippings' -i -X POST \
    -H 'Content-Type: application/json' \
    -H 'Accept: application/hal+json' \
    -H 'Authorization: Bearer <Access token>' \
    -d '{
  "comment" : "This needs to be done fast!",
  "sendMail" : true,
  "createPackingSlip" : true,
  "trackingCode" : "lookAtMyTrackingCodeWow",
  "trackingLink" : "http://tracking.is/fun?code=lookAtMyTrackingCodeWow",
  "lineItems" : [ {
    "quantity" : 3,
    "productLineItemId" : "e96e1b33-d9e9-4508-862a-816235b541f7"
  } ]
}'

Examples:

body = {
  "comment" => "This needs to be done fast!",
  "send_mail" => true,
  "create_packing_slip" => true,
  "tracking_code" => "lookAtMyTrackingCodeWow",
  "tracking_link" => "http=>//tracking.is/fun?code=lookAtMyTrackingCodeWow",
  "line_items" => [ {
    "quantity" => 3,
    "product_line_item_id" => "e96e1b33-d9e9-4508-862a-816235b541f7"
  } ]
}
@shipping_process = session.orders.create_shipping_process("8df2fe3b-5149-492f-932a-073f012305eb", body)

Parameters:

  • order_id (String)

    the order UUID

  • body (Hash)

    the request body

Returns:

  • (OpenStruct)

Scopes:

  • shpr:c



366
367
368
369
370
371
372
373
374
# File 'lib/beyond_api/resources/orders.rb', line 366

def create_shipping_process(order_id, body)
  path = "/orders/#{order_id}/processes/shippings"

  response, status = BeyondApi::Request.post(@session,
                                             path,
                                             body)

  handle_response(response, status)
end

#events(order_id, params = {}) ⇒ OpenStruct

A GET request is used to list all events of an order in a paged way.

$ curl 'https://api-shop.beyondshop.cloud/api/orders/66b6aab5-2ed4-4f36-855e-3adb2ea873ee/events' -i -X GET \
    -H 'Accept: application/hal+json' \
    -H 'Authorization: Bearer <Access token>'

Examples:

@events = session.orders.find("66b6aab5-2ed4-4f36-855e-3adb2ea873ee", { size: 100, page: 0 })

Parameters:

  • order_id (String)

    the order UUID

  • params (Hash) (defaults to: {})

    a customizable set of options

Options Hash (params):

  • :size (Integer)

    the page size

  • :page (Integer)

    the page number

Returns:

  • (OpenStruct)

Scopes:

  • ordr:r



394
395
396
397
398
399
400
401
402
# File 'lib/beyond_api/resources/orders.rb', line 394

def events(order_id, params = {})
  path = "/orders/#{order_id}/events"

  response, status = BeyondApi::Request.get(@session,
                                            path,
                                            params)

  handle_response(response, status)
end

#find(order_id) ⇒ OpenStruct

A GET request is used to retrieve the details of an order.

$ curl 'https://api-shop.beyondshop.cloud/api/orders/a27f1019-3690-40d1-bd9d-d60dff4c4cf8' -i -X GET \
    -H 'Content-Type: application/json' \
    -H 'Accept: application/hal+json' \
    -H 'Authorization: Bearer <Access token>'

Examples:

@order = session.orders.find("a27f1019-3690-40d1-bd9d-d60dff4c4cf8")

Parameters:

  • order_id (String)

    the order UUID

Returns:

  • (OpenStruct)

Scopes:

  • ordr:r



421
422
423
424
425
426
427
428
# File 'lib/beyond_api/resources/orders.rb', line 421

def find(order_id)
  path = "/orders/#{order_id}"

  response, status = BeyondApi::Request.get(@session,
                                            path)

  handle_response(response, status)
end

#mark_payment_process_as_paid(order_id, payment_id, body) ⇒ OpenStruct

A POST request is used to mark the payment process as paid.

$ 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 \
    -H 'Content-Type: application/json' \
    -H 'Accept: application/hal+json' \
    -H 'Authorization: Bearer <Access token>' \
    -d '{
       "comment" : "comment",
       "details" : {
         "amount" : {
           "currency" : "EUR",
           "amount" : 77.44
         }
       }
     }'

Examples:

body = {
  "comment" => "comment",
  "details" => {
    "amount" => {
      "currency" => "EUR",
      "amount" => 77.44
    }
  }
}

@payment_process = session.orders.mark_payment_process_as_paid("9a1a1aaa-e37d-4c71-bc95-cbc228463fec", "cb8c9a16-2d81-4ec1-9a4a-84a4c36124ae", body)

Parameters:

  • order_id (String)

    the order UUID

  • payment_id (String)

    the payment UUID

  • body (Hash)

    the request body

Returns:

  • (OpenStruct)

Scopes:

  • pypr:u



468
469
470
471
472
473
474
475
476
# File 'lib/beyond_api/resources/orders.rb', line 468

def mark_payment_process_as_paid(order_id, payment_id, body)
  path = "/orders/#{order_id}/processes/payments/#{payment_id}/mark-paid"

  response, status = BeyondApi::Request.post(@session,
                                             path,
                                             body)

  handle_response(response, status)
end

#mark_payment_process_as_voided(order_id, payment_id, body) ⇒ OpenStruct

A POST request is used to mark the payment process as voided.

$ 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 \
    -H 'Content-Type: application/json' \
    -H 'Accept: application/hal+json' \
    -H 'Authorization: Bearer <Access token>' \
    -d '{
    "comment" : "comment"
}'

Examples:

body = {
  "comment" => "comment"
}

@payment_process = session.orders.mark_payment_process_as_voided("a5558b7f-55f4-47d4-b603-9bf7eb59c05b", "5bcc48e7-2641-42a8-a042-189ae92e9901", body)

Parameters:

  • order_id (String)

    the order UUID

  • payment_id (String)

    the payment UUID

  • body (Hash)

    the request body

Returns:

  • (OpenStruct)

Scopes:

  • pypr:u



504
505
506
507
508
509
510
511
512
# File 'lib/beyond_api/resources/orders.rb', line 504

def mark_payment_process_as_voided(order_id, payment_id, body)
  path = "/orders/#{order_id}/processes/payments/#{payment_id}/mark-voided"

  response, status = BeyondApi::Request.post(@session,
                                             path,
                                             body)

  handle_response(response, status)
end

#mark_refund_process_as_paid(order_id) ⇒ OpenStruct

A POST request is used to mark the refund process as paid.

$ curl 'https://api-shop.beyondshop.cloud/api/orders/60baa84c-9e11-4d55-97a9-1a7b00a0691c/processes/refunds/active/mark-paid' -i -X POST \
    -H 'Content-Type: application/json' \
    -H 'Accept: application/hal+json' \
    -H 'Authorization: Bearer <Access token>' \
    -d '{
    "comment" : "comment",
    "details" : {
      "amount" : {
        "currency" : "EUR",
        "amount" : 19.98
      }
    }
}'

Examples:

body = {
  "comment" => "comment",
  "details" => {
    "amount" => {
      "currency" => "EUR",
      "amount" => 19.98
    }
  }
}
@refund_process = session.orders.mark_refund_process_as_paid("60baa84c-9e11-4d55-97a9-1a7b00a0691c", body)

Parameters:

  • order_id (String)

    the order UUID

Returns:

  • (OpenStruct)

Scopes:

  • rfpr:r



549
550
551
552
553
554
555
556
# File 'lib/beyond_api/resources/orders.rb', line 549

def mark_refund_process_as_paid(order_id)
  path = "/orders/#{order_id}/processes/refunds/active/mark-paid"

  response, status = BeyondApi::Request.post(@session,
                                             path)

  handle_response(response, status)
end

#mark_shipping_process_as_delivered(order_id, shipping_process_id, body) ⇒ OpenStruct

A POST request is used to mark the shipment as delivered.

$ 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 \
    -H 'Content-Type: application/json' \
    -H 'Accept: application/hal+json' \
    -H 'Authorization: Bearer <Access token>' \
    -d '{
  "comment" : "comment"
}'

Examples:

body = {
  "comment" => "comment",
}

@shipping_process = session.orders.mark_shipping_process_as_delivered("b5642d1f-0f7f-444e-96d5-1c1d1642ea5e", "619d06d8-0077-4efd-b341-5103f71bfb2d", body)

Parameters:

  • order_id (String)

    the order UUID

  • shipping_id (String)

    the shipping UUID

  • body (Hash)

    the request body

Returns:

  • (OpenStruct)

Scopes:

  • shpr:u



584
585
586
587
588
589
590
591
592
# File 'lib/beyond_api/resources/orders.rb', line 584

def mark_shipping_process_as_delivered(order_id, shipping_process_id, body)
  path = "/orders/#{order_id}/processes/shippings/#{shipping_process_id}/mark-delivered"

  response, status = BeyondApi::Request.post(@session,
                                             path,
                                             body)

  handle_response(response, status)
end

#mark_shipping_process_as_shipped(order_id, shipping_id, body) ⇒ OpenStruct

A POST request is used to mark the shipment as shipped.

$ 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 \
    -H 'Content-Type: application/json' \
    -H 'Accept: application/hal+json' \
    -H 'Authorization: Bearer <Access token>' \
    -d '{
  "comment" : "This needs to be done fast!",
  "sendMail" : true,
  "details" : {
    "trackingCode" : "lookAtMyTrackingCodeWow",
    "trackingLink" : "http://tracking.is/fun?code=lookAtMyTrackingCodeWow"
  }
}'

Examples:

body = {
  "comment" => "This needs to be done fast!",
  "sendMail" => true,
  "details" => {
    "trackingCode" => "lookAtMyTrackingCodeWow",
    "trackingLink" => "http://tracking.is/fun?code=lookAtMyTrackingCodeWow"
  }
}

@shipping_process = session.orders.mark_shipping_process_as_shipped("dd6a7e20-16be-4509-bf83-fb8ee072ddad", "a0b0c4a5-0c80-47f4-98c3-0f55f4161176", body)

Parameters:

  • order_id (String)

    the order UUID

  • shipping_id (String)

    the shipping UUID

  • body (Hash)

    the request body

Returns:

  • (OpenStruct)

Scopes:

  • shpr:u



630
631
632
633
634
635
636
637
638
# File 'lib/beyond_api/resources/orders.rb', line 630

def mark_shipping_process_as_shipped(order_id, shipping_id, body)
  path = "/orders/#{order_id}/processes/shippings/#{shipping_id}/mark-shipped"

  response, status = BeyondApi::Request.post(@session,
                                             path,
                                             body)

  handle_response(response, status)
end

#payment_process(order_id, payment_id) ⇒ OpenStruct

A GET request is used to retrieve the payment processes.

$ curl 'https://api-shop.beyondshop.cloud/api/orders/d44ed295-6a08-47ba-a288-90d4f3ba9fff/processes/payments/be56bfbd-af95-45b9-8b0e-cb0c184aaf60' -i -X GET \
    -H 'Content-Type: application/json' \
    -H 'Accept: application/hal+json' \
    -H 'Authorization: Bearer <Access token>'

Examples:

@payment_process = session.orders.payment_process("d44ed295-6a08-47ba-a288-90d4f3ba9fff", "be56bfbd-af95-45b9-8b0e-cb0c184aaf60")

Parameters:

  • order_id (String)

    the order UUID

  • payment_id (String)

    the payment UUID

Returns:

  • (OpenStruct)

Scopes:

  • pypr:r



658
659
660
661
662
663
664
665
# File 'lib/beyond_api/resources/orders.rb', line 658

def payment_process(order_id, payment_id)
  path = "/orders/#{order_id}/processes/payments/#{payment_id}"

  response, status = BeyondApi::Request.get(@session,
                                            path)

  handle_response(response, status)
end

#payment_processes(order_id, params = {}) ⇒ OpenStruct

A GET request is used to list all payment processes of an order in a paged way.

$ curl 'https://api-shop.beyondshop.cloud/api/orders/2012b775-a706-41e0-b0f9-5142864ca4a0/processes/payments?page=0&size=20' -i -X GET \
    -H 'Content-Type: application/json' \
    -H 'Accept: application/hal+json' \
    -H 'Authorization: Bearer <Access token>'

Examples:

@payment_processes = session.orders.payment_processes("2012b775-a706-41e0-b0f9-5142864ca4a0", {page: 0, size: 20})

Parameters:

  • order_id (String)

    the order UUID

  • params (Hash) (defaults to: {})

    a customizable set of options

Options Hash (params):

  • :size (Integer)

    the page size

  • :page (Integer)

    the page number

Returns:

  • (OpenStruct)

Scopes:

  • pypr:r



686
687
688
689
690
691
692
693
694
# File 'lib/beyond_api/resources/orders.rb', line 686

def payment_processes(order_id, params = {})
  path = "/orders/#{order_id}/processes/payments"

  response, status = BeyondApi::Request.get(@session,
                                            path,
                                            params)

  handle_response(response, status)
end

#processes(order_id) ⇒ OpenStruct

A GET request is used to list all order processes.

$ curl 'https://api-shop.beyondshop.cloud/api/orders/934ece52-055c-4896-8d16-560f1461ea56/processes' -i -X GET \
    -H 'Content-Type: application/json' \
    -H 'Accept: application/hal+json' \
    -H 'Authorization: Bearer <Access token>'

Examples:

@processes = session.orders.processes("934ece52-055c-4896-8d16-560f1461ea56")

Parameters:

  • order_id (String)

    the order UUID

Returns:

  • (OpenStruct)

Scopes:

  • ordr:r



713
714
715
716
717
718
719
720
# File 'lib/beyond_api/resources/orders.rb', line 713

def processes(order_id)
  path = "/orders/#{order_id}/processes"

  response, status = BeyondApi::Request.get(@session,
                                            path)

  handle_response(response, status)
end

#refund_process(order_id, refund_id) ⇒ OpenStruct

A GET request is used to retrieve the refund processes.

$ curl 'https://api-shop.beyondshop.cloud/api/orders/801885c8-0b25-44a2-a1a4-60cbf3f9ecca/processes/refunds/4c02883f-be31-4fb2-ad0d-ccbc3678a9f5' -i -X GET \
    -H 'Content-Type: application/json' \
    -H 'Accept: application/hal+json' \
    -H 'Authorization: Bearer <Access token>'

Examples:

@refund_process = session.orders.refund_process("801885c8-0b25-44a2-a1a4-60cbf3f9ecca", "4c02883f-be31-4fb2-ad0d-ccbc3678a9f5")

Parameters:

  • order_id (String)

    the order UUID

  • refund_id (String)

    the refund UUID

Returns:

  • (OpenStruct)

Scopes:

  • rfpr:r



740
741
742
743
744
745
746
747
# File 'lib/beyond_api/resources/orders.rb', line 740

def refund_process(order_id, refund_id)
  path = "/orders/#{order_id}/processes/refunds/#{refund_id}"

  response, status = BeyondApi::Request.get(@session,
                                            path)

  handle_response(response, status)
end

#refund_processes(order_id, params = {}) ⇒ OpenStruct

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 and Create return processes for more information.

$ curl 'https://api-shop.beyondshop.cloud/api/orders/6f86e42f-763e-4514-a37d-fb8f88cdc14c/processes/refunds?page=0&size=20' -i -X GET \
    -H 'Content-Type: application/json' \
    -H 'Accept: application/hal+json' \
    -H 'Authorization: Bearer <Access token>'

Examples:

@refund_processes = session.orders.refund_processes("6f86e42f-763e-4514-a37d-fb8f88cdc14c", {page: 0, size: 20})

Parameters:

  • order_id (String)

    the order UUID

  • params (Hash) (defaults to: {})

    a customizable set of options

Options Hash (params):

  • :size (Integer)

    the page size

  • :page (Integer)

    the page number

Returns:

  • (OpenStruct)

Scopes:

  • rfpr:r



768
769
770
771
772
773
774
775
776
# File 'lib/beyond_api/resources/orders.rb', line 768

def refund_processes(order_id, params = {})
  path = "/orders/#{order_id}/processes/refunds"

  response, status = BeyondApi::Request.get(@session,
                                            path,
                                            params)

  handle_response(response, status)
end

#return_process(order_id, return_process_id) ⇒ OpenStruct

A GET request is used to list all return processes of an order in a paged way.

$ curl 'https://api-shop.beyondshop.cloud/api/orders/cb9927e4-60d1-4a90-b40c-f5a8e2b25301/processes/returns/910a3fde-cb23-418f-876a-694ce42245ef' -i -X GET \
    -H 'Content-Type: application/json' \
    -H 'Accept: application/hal+json' \
    -H 'Authorization: Bearer <Access token>'

Examples:

@return_process = session.orders.return_process("cb9927e4-60d1-4a90-b40c-f5a8e2b25301", "910a3fde-cb23-418f-876a-694ce42245ef")

Parameters:

  • order_id (String)

    the order UUID

  • return_process_id (String)

    the return process UUID

Returns:

  • (OpenStruct)

Scopes:

  • rtpr:r



796
797
798
799
800
801
802
803
# File 'lib/beyond_api/resources/orders.rb', line 796

def return_process(order_id, return_process_id)
  path = "/orders/#{order_id}/processes/returns/#{return_process_id}"

  response, status = BeyondApi::Request.get(@session,
                                            path)

  handle_response(response, status)
end

#return_processes(order_id, params = {}) ⇒ OpenStruct

A GET request is used to list all return processes of an order in a paged way.

$ curl 'https://api-shop.beyondshop.cloud/api/orders/9e26232f-aa7a-408b-8041-9439999268c5/processes/returns?page=0&size=20' -i -X GET \
    -H 'Content-Type: application/json' \
    -H 'Accept: application/hal+json' \
    -H 'Authorization: Bearer <Access token>'

Examples:

@return_processes = session.orders.return_processes("9e26232f-aa7a-408b-8041-9439999268c5", {page: 0, size: 20})

Parameters:

  • order_id (String)

    the order UUID

  • params (Hash) (defaults to: {})

    a customizable set of options

Options Hash (params):

  • :size (Integer)

    the page size

  • :page (Integer)

    the page number

Returns:

  • (OpenStruct)

Scopes:

  • rtpr:r



824
825
826
827
828
829
830
831
832
# File 'lib/beyond_api/resources/orders.rb', line 824

def return_processes(order_id, params = {})
  path = "/orders/#{order_id}/processes/returns"

  response, status = BeyondApi::Request.get(@session,
                                            path,
                                            params)

  handle_response(response, status)
end

#search_by_cart_id(cart_id) ⇒ OpenStruct

A GET request is used to retrieve the details of an order by cart ID.

$ curl 'https://api-shop.beyondshop.cloud/api/orders/search/find-by-cart-id?cartId=82e859a8-7f70-4c19-83c1-ed03457b2ceb' -i -X GET \
    -H 'Content-Type: application/json' \
    -H 'Accept: application/hal+json' \
    -H 'Authorization: Bearer <Access token>'

Examples:

@order = session.orders.search_by_cart_id("82e859a8-7f70-4c19-83c1-ed03457b2ceb")

Parameters:

  • cart_id (String)

    the cart UUID

Returns:

  • (OpenStruct)

Scopes:

  • ordr:r



851
852
853
854
855
856
857
858
859
# File 'lib/beyond_api/resources/orders.rb', line 851

def search_by_cart_id(cart_id)
  path = "/orders/search/find-by-cart-id"

  response, status = BeyondApi::Request.get(@session,
                                            path,
                                            { cart_id: cart_id })

  handle_response(response, status)
end

#search_order_number_by_cart_id(cart_id) ⇒ OpenStruct

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.

$ curl 'https://api-shop.beyondshop.cloud/api/orders/search/find-order-number-by-cart-id?cartId=7f1cf6c8-7780-430f-9de0-91cbe31c4bf6' -i -X GET \
    -H 'Content-Type: application/json' \
    -H 'Accept: application/hal+json' \
    -H 'Authorization: Bearer <Access token>'

Examples:

@order = session.orders.search_order_number_by_cart_id("7f1cf6c8-7780-430f-9de0-91cbe31c4bf6")

Parameters:

  • cart_id (String)

    the cart UUID

Returns:

  • (OpenStruct)

Scopes:

  • ordr:r



878
879
880
881
882
883
884
885
886
# File 'lib/beyond_api/resources/orders.rb', line 878

def search_order_number_by_cart_id(cart_id)
  path = "/orders/search/find-order-number-by-cart-id"

  response, status = BeyondApi::Request.get(@session,
                                            path,
                                            { cart_id: cart_id })

  handle_response(response, status)
end

#send_order_document(order_id, order_document_uri) ⇒ OpenStruct

A GET request is used to send an invoice for the order.

$ curl 'https://api-shop.beyondshop.cloud/api/orders/acc1f22f-a992-4534-be92-b378a0319fcd/send-order-document' -i -X POST \
    -H 'Accept: application/hal+json' \
    -H 'Authorization: Bearer <Access token>' \
    -d '{
    "orderDocumentUri" : "https://myshop.com/api/pdf-storage/attachments/invoice_10003.pdf?hash=9e5e2631c6f5877d64cb3d40db46ec6eb48a3a92"
}'

Examples:

@order = session.orders.send_order_document("acc1f22f-a992-4534-be92-b378a0319fcd",
                                            "https://myshop.com/api/pdf-storage/attachments/invoice_10003.pdf?hash=9e5e2631c6f5877d64cb3d40db46ec6eb48a3a92")

Parameters:

  • order_id (String)

    the order UUID

  • order_document_uri (String)

    the document url

Returns:

  • (OpenStruct)

Scopes:

  • ordr:u



909
910
911
912
913
914
915
916
917
# File 'lib/beyond_api/resources/orders.rb', line 909

def send_order_document(order_id, order_document_uri)
  path = "/orders/#{order_id}/send-order-document"

  response, status = BeyondApi::Request.post(@session,
                                             path,
                                             { order_document_uri: order_document_uri })

  handle_response(response, status)
end

#shipping_process(order_id, shipping_process_id) ⇒ OpenStruct

A GET request is used to retrieve the shipping process details.

$ curl 'https://api-shop.beyondshop.cloud/api/orders/af42860f-2813-4130-85d9-2d315a4f802e/processes/shippings/80ebe96b-bcd5-4a34-a428-8a67ed114ce6' -i -X GET \
    -H 'Content-Type: application/json' \
    -H 'Accept: application/hal+json' \
    -H 'Authorization: Bearer <Access token>'

Examples:

@shipping_process = session.orders.refund_process("af42860f-2813-4130-85d9-2d315a4f802e", "80ebe96b-bcd5-4a34-a428-8a67ed114ce6")

Parameters:

  • order_id (String)

    the order UUID

  • shipping_process_id (String)

    the shipping process UUID

Returns:

  • (OpenStruct)

Scopes:

  • shpr:r



937
938
939
940
941
942
943
944
# File 'lib/beyond_api/resources/orders.rb', line 937

def shipping_process(order_id, shipping_process_id)
  path = "/orders/#{order_id}/processes/shippings/#{shipping_process_id}"

  response, status = BeyondApi::Request.get(@session,
                                            path)

  handle_response(response, status)
end

#shipping_processes(order_id, params = {}) ⇒ OpenStruct

A GET request is used to list all shipping processes of an order in a paged way.

$ curl 'https://api-shop.beyondshop.cloud/api/orders/d6387876-5e93-48dc-a6f3-f85893149819/processes/shippings?page=0&size=20' -i -X GET \
    -H 'Content-Type: application/json' \
    -H 'Accept: application/hal+json' \
    -H 'Authorization: Bearer <Access token>'

Examples:

@shipping_processes = session.orders.shipping_processes("268a8629-55cd-4890-9013-936b9b5ea14c", {page: 0, size: 20})

Parameters:

  • order_id (String)

    the order UUID

  • params (Hash) (defaults to: {})

    a customizable set of options

Options Hash (params):

  • :size (Integer)

    the page size

  • :page (Integer)

    the page number

Returns:

  • (OpenStruct)

Scopes:

  • shpr:r



965
966
967
968
969
970
971
972
973
# File 'lib/beyond_api/resources/orders.rb', line 965

def shipping_processes(order_id, params = {})
  path = "/orders/#{order_id}/processes/shippings"

  response, status = BeyondApi::Request.get(@session,
                                            path,
                                            params)

  handle_response(response, status)
end

#update_billing_address(order_id, body) ⇒ OpenStruct

A PUT request is used to change the customer’s billing address.

$ curl 'https://api-shop.beyondshop.cloud/api/orders/6c36e5e3-dc4c-4d00-b4e8-3fbf9a4bed14/billing-address' -i -X PUT \
    -H 'Content-Type: application/json' \
    -H 'Accept: application/hal+json' \
    -H 'Authorization: Bearer <Access token>' \
    -d '{
    "address" : {
      "salutation" : "Mrs",
      "gender" : "FEMALE",
      "company" : "Astrid Alster GmbH",
      "title" : null,
      "firstName" : "Astrid",
      "middleName" : "Agnes",
      "lastName" : "Alster",
      "street" : "Alsterwasserstraße",
      "houseNumber" : "3",
      "street2" : "Erdgeschoss",
      "addressExtension" : "Hinterhof",
      "postalCode" : "20999",
      "dependentLocality" : "Seevetal",
      "city" : "Alsterwasser",
      "country" : "DE",
      "state" : "Hamburg",
      "email" : "a.alsterh@example.com",
      "phone" : "(800) 555-0102",
      "mobile" : "(800) 555-0103",
      "vatId" : "DE123456789",
      "taxNumber" : "HRE 987654/32123/864516",
      "birthDate" : "1985-05-11",
      "displayAddressLines" : [ "Astrid Alster GmbH", "Astrid Agnes Alster", "Alsterwasserweg 2", "Erdgeschoss", "Seevetal", "20999 Alsterwasser", "Germany" ],
      "_id" : null
    },
    "comment" : "Updated billing address"
}'

Examples:

body = {
  "address" => {
    "salutation" => "Mrs",
    "gender" => "FEMALE",
    "company" => "Astrid Alster GmbH",
    "title" => nil,
    "firstName" => "Astrid",
    "middleName" => "Agnes",
    "lastName" => "Alster",
    "street" => "Alsterwasserstraße",
    "houseNumber" => "3",
    "street2" => "Erdgeschoss",
    "addressExtension" => "Hinterhof",
    "postalCode" => "20999",
    "dependentLocality" => "Seevetal",
    "city" => "Alsterwasser",
    "country" => "DE",
    "state" => "Hamburg",
    "email" => "a.alsterh@example.com",
    "phone" => "(800) 555-0102",
    "mobile" => "(800) 555-0103",
    "vatId" => "DE123456789",
    "taxNumber" => "HRE 987654/32123/864516",
    "birthDate" => "1985-05-11",
    "displayAddressLines" => [ "Astrid Alster GmbH", "Astrid Agnes Alster", "Alsterwasserweg 2", "Erdgeschoss", "Seevetal", "20999 Alsterwasser", "Germany" ],
    "_id" => null
  },
  "comment" => "Updated billing address"
}
@order = session.orders.update_billing_address("6c36e5e3-dc4c-4d00-b4e8-3fbf9a4bed14", body)

Parameters:

  • order_id (String)

    the order UUID

  • body (Hash)

    the request body

Returns:

  • (OpenStruct)

Scopes:

  • ordr:u



1051
1052
1053
1054
1055
1056
1057
1058
1059
# File 'lib/beyond_api/resources/orders.rb', line 1051

def update_billing_address(order_id, body)
  path = "/orders/#{order_id}/billing-address"

  response, status = BeyondApi::Request.put(@session,
                                            path,
                                            body)

  handle_response(response, status)
end

#update_order_note(order_id, order_note) ⇒ OpenStruct

A PUT request is used to change the order note.

$ curl 'https://api-shop.beyondshop.cloud/api/orders/58545e43-f4ba-48e2-b0bf-e340fd64f7b8/order-note' -i -X PUT \
    -H 'Content-Type: application/json' \
    -H 'Authorization: Bearer <Access token>' \
    -d '{
    "orderNote" : "not paid yet"
}'

Examples:

@order = session.orders.update_order_note("58545e43-f4ba-48e2-b0bf-e340fd64f7b8", "not paid yet" )

Parameters:

  • order_id (String)

    the order UUID

  • order_note (String)

    the order note

Returns:

  • (OpenStruct)

Scopes:

  • ordr:u



1081
1082
1083
1084
1085
1086
1087
1088
1089
# File 'lib/beyond_api/resources/orders.rb', line 1081

def update_order_note(order_id, order_note)
  path = "/orders/#{order_id}/order-note"

  response, status = BeyondApi::Request.put(@session,
                                            path,
                                            { order_note: order_note })

  handle_response(response, status)
end

#update_shipping_address(order_id, body) ⇒ OpenStruct

A PUT request is used to change the customer’s shipping address.

$ curl 'https://api-shop.beyondshop.cloud/api/orders/30327fed-812f-4b70-8931-43e34d8c8181/shipping-address' -i -X PUT \
    -H 'Content-Type: application/json' \
    -H 'Accept: application/hal+json' \
    -H 'Authorization: Bearer <Access token>' \
    -d '{
    "address" : {
      "salutation" : "Mrs",
      "gender" : "FEMALE",
      "company" : "Astrid Alster GmbH",
      "title" : null,
      "firstName" : "Astrid",
      "middleName" : "Agnes",
      "lastName" : "Alster",
      "street" : "Alsterwasserstraße",
      "houseNumber" : "3",
      "street2" : "Erdgeschoss",
      "addressExtension" : "Hinterhof",
      "postalCode" : "20999",
      "dependentLocality" : "Seevetal",
      "city" : "Alsterwasser",
      "country" : "DE",
      "state" : "Hamburg",
      "email" : "a.alsterh@example.com",
      "phone" : "(800) 555-0102",
      "mobile" : "(800) 555-0103",
      "doorCode" : "456",
      "displayAddressLines" : [ "Astrid Alster GmbH", "Astrid Agnes Alster", "Alsterwasserweg 2", "Erdgeschoss", "Seevetal", "20999 Alsterwasser", "Germany" ],
      "_id" : null
    },
    "comment" : "Updated shipping address"
}'

Examples:

body = {
  "address" => {
    "salutation" => "Mrs",
    "gender" => "FEMALE",
    "company" => "Astrid Alster GmbH",
    "title" => nil,
    "firstName" => "Astrid",
    "middleName" => "Agnes",
    "lastName" => "Alster",
    "street" => "Alsterwasserstraße",
    "houseNumber" => "3",
    "street2" => "Erdgeschoss",
    "addressExtension" => "Hinterhof",
    "postalCode" => "20999",
    "dependentLocality" => "Seevetal",
    "city" => "Alsterwasser",
    "country" => "DE",
    "state" => "Hamburg",
    "email" => "a.alsterh@example.com",
    "phone" => "(800) 555-0102",
    "mobile" => "(800) 555-0103",
    "vatId" => "DE123456789",
    "taxNumber" => "HRE 987654/32123/864516",
    "birthDate" => "1985-05-11",
    "displayAddressLines" => [ "Astrid Alster GmbH", "Astrid Agnes Alster", "Alsterwasserweg 2", "Erdgeschoss", "Seevetal", "20999 Alsterwasser", "Germany" ],
    "_id" => null
  },
  "comment" => "Updated shipping address"
}
@order = session.orders.update_shipping_address("30327fed-812f-4b70-8931-43e34d8c8181", body)

Parameters:

  • order_id (String)

    the order UUID

  • body (Hash)

    the request body

Returns:

  • (OpenStruct)

Scopes:

  • ordr:u



1164
1165
1166
1167
1168
1169
1170
1171
1172
# File 'lib/beyond_api/resources/orders.rb', line 1164

def update_shipping_address(order_id, body)
  path = "/orders/#{order_id}/shipping-address"

  response, status = BeyondApi::Request.put(@session,
                                            path,
                                            body)

  handle_response(response, status)
end