Logo: Relish

  1. Sign in

Project: Checkout v2.0

  • Change version

    1. v2.0

Consume an order resource

As a client application customer
I want to consume a order resource
So that I can see the detailed content of the requested order

Background
Given
I use a valid token which authorizes access to the "Checkout::V2::OrderResource" scope
And
the following clients exist
ID client-account
1 user1
2 user2
And
the following billings exist
ID billing-status
1 ok
2 rejected
And
the following orders exist
ID gateway-id status billing-id client-id
1 129825289 completed 1 1
2 pending 2 2
And
the following valorizations exist
ID valorization-offer order-id
1 custom-market-value 1
2 extended-market-value 2
3 extended-market-value 2
Scenarios
Get a single order
Given
I authenticate as the following proxy user "account"
When
I send a GET request for "checkout/2.0/orders/ID"
Then
the response status should be "200"
And
the response should be a JSON API resource of type "orders"
And
the resource should have a "relationships" subnode in the "data" node
And
the response should be a JSON API resource of type "orders"
And
the resource should have an attribute "gateway-id" that displays gateway-id
And
the resource should have an attribute "status" that displays "status"
And
the resource should have a "billing" relationship that points to "checkout/2.0/orders/ID/billing"
And
the resource should have a "client" relationship that points to "checkout/2.0/orders/ID/client"
And
the resource should have a "valorizations" relationship that points to "checkout/2.0/orders/ID/valorizations"
Examples:
ID gateway-id status billing client valorizations account
1 129825289 completed 1 1 1 user1
2 pending 2 2 2,3 user2
Get a single order including billing
Given
I authenticate as the following proxy user "user1"
When
I send a GET request for "checkout/2.0/orders/1?include=billing"
Then
the response status should be "200"
And
the response should be a JSON API resource of type "orders"
And
the resource should have a node named "included" showing a collection
And
the "included" collection should have one JSON API resource of type "billings"
And
the "billing" resource should have the ID 1
And
the "billing" resource should have the attribute "status" "ok"
Get a single order including client
Given
I authenticate as the following proxy user "user1"
When
I send a GET request for "checkout/2.0/orders/1?include=client"
Then
the response status should be "200"
And
the response should be a JSON API resource of type "orders"
And
the resource should have a node named "included" showing a collection
And
the "included" collection should have one JSON API resource of type "clients"
And
the "client" resource should have the ID 1
And
the "client" resource should have the attribute "account" "user1"
Get a single order including valorizations
Given
I authenticate as the following proxy user "user1"
When
I send a GET request for "checkout/2.0/orders/1?include=valorizations"
Then
the response status should be "200"
And
the response should be a JSON API resource of type "orders"
And
the resource should have a node named "included" showing a collection
And
the "included" collection should have one JSON API resource of type "valorizations"
And
the "valorization" resource should have the ID 1
And
the "valorization" resource should have the attribute "offer" "custom-market-value"
Get a billing associated to an order
Given
I authenticate as the following proxy user "user1"
When
I send a GET request for "checkout/2.0/orders/1/billing"
Then
the response status should be "200"
And
the response should be a JSON API resource of type "billings"
And
the resource should have the ID 1
Get a client associated to an order
Given
I authenticate as the following proxy user "user1"
When
I send a GET request for "checkout/2.0/orders/1/client"
Then
the response status should be "200"
And
the response should be a JSON API resource of type "clients"
And
the resource should have the ID 1
Get a collection of valorizations associated to an order
Given
I authenticate as the following proxy user "user2"
When
I send a GET request for "checkout/2.0/orders/2/valorizations"
Then
the response status should be "200"
And
the response should be a JSON API collection of type "valorizations"
And
the collection should have 2 items
And
one item have the ID 2
And
one item have the ID 3

Last published over 4 years ago by Donaldo.