Orders-orderId-quote:GET
From Hostway API Documentation
(Difference between revisions)
Corinne.chui (Talk | contribs) m (1 revision) |
|||
(2 intermediate revisions by 2 users not shown) | |||
Line 56: | Line 56: | ||
"PromotionCode": "promo_1234", | "PromotionCode": "promo_1234", | ||
"PromotionName": "Seasonal Discount 25% off all dedicated servers for 3 months" | "PromotionName": "Seasonal Discount 25% off all dedicated servers for 3 months" | ||
+ | "ChildProduct": [], | ||
"Fees": [ | "Fees": [ | ||
{ | { | ||
Line 72: | Line 73: | ||
"ProratedUnitAmount": "100.00", | "ProratedUnitAmount": "100.00", | ||
"Type": "setup_fee", | "Type": "setup_fee", | ||
− | "Quantity": "1" | + | "Quantity": "1", |
+ | "Deferred": "0" | ||
}, | }, | ||
{ | { | ||
Line 90: | Line 92: | ||
"Type": "recurring", | "Type": "recurring", | ||
"Quantity": "1", | "Quantity": "1", | ||
+ | "Deferred": "1" | ||
} | } | ||
] | ] | ||
} | } | ||
], | ], | ||
− | "Total": " | + | "Total": "100.00", |
− | "SubTotal": " | + | "SubTotal": "100.00", |
"OneTimeFeeAmount": "100.00", | "OneTimeFeeAmount": "100.00", | ||
− | "TaxTotal": "0" | + | "TaxTotal": "0", |
+ | "DeferredSubTotals": [ | ||
+ | { | ||
+ | "PurchasedPlanNumber": "00000139b5dd73be7f14d3f8000a88fa0fa65d70", | ||
+ | "Amount": "239.00" | ||
+ | } | ||
+ | ], | ||
+ | "DeferredTaxes": [], | ||
+ | "DeferredTotals": [ | ||
+ | "PurchasedPlanNumber": "00000139b5dd73be7f14d3f8000a88fa0fa65d70", | ||
+ | "Amount": "239.00" | ||
+ | ], | ||
}, | }, | ||
"links": [ | "links": [ | ||
Line 130: | Line 144: | ||
::: ''(OPTIONAL)'' | ::: ''(OPTIONAL)'' | ||
::: Name or short description of the promotion that was applied, if any | ::: Name or short description of the promotion that was applied, if any | ||
+ | |||
+ | ::; ChildProduct - ''list'' | ||
+ | ::: List of products of the plan product | ||
::; Fees - ''list'' | ::; Fees - ''list'' | ||
Line 178: | Line 195: | ||
:::; Quantity - ''integer'' | :::; Quantity - ''integer'' | ||
:::: The quantity for this fee | :::: The quantity for this fee | ||
+ | |||
+ | :::; Deferred - ''integer'' | ||
+ | :::: Indicates whether the fee is deferred | ||
:; Total - ''decimal'' | :; Total - ''decimal'' | ||
− | :: Total sum for this quote | + | :: Total sum for this quote. Does not include deferred charges. |
:; SubTotal - ''decimal'' | :; SubTotal - ''decimal'' | ||
− | :: Subtotal sum for this quote | + | :: Subtotal sum for this quote. Does not include deferred charges. |
:; OneTimeFeeAmount - ''decimal'' | :; OneTimeFeeAmount - ''decimal'' | ||
Line 189: | Line 209: | ||
:; TaxTotal - ''decimal'' | :; TaxTotal - ''decimal'' | ||
− | :: Tax total value | + | :: Tax total value. Does not include taxes on deferred charges. |
+ | |||
+ | :; DeferredSubTotals - ''list'' | ||
+ | :: A list of dictionaries, containing the sub of deferred subtotals for each PurchasedPlan in the order. If no deferred fees are found in the plan, it might not be present. | ||
+ | |||
+ | :; DeferredTaxes - ''list'' | ||
+ | :: A list of dictionaries, containing the sub of deferred taxes for each PurchasedPlan in the order. If no deferred fees are found in the plan, it might not be present. | ||
+ | |||
+ | :; DeferredTotals - ''list'' | ||
+ | :: A list of dictionaries, containing the sub of deferred totals (subtotal + tax) for each PurchasedPlan in the order. If no deferred fees are found in the plan, it might not be present. | ||
; links - ''list'' | ; links - ''list'' | ||
Line 279: | Line 308: | ||
"details": "" | "details": "" | ||
} | } | ||
+ | }</nowiki> | ||
+ | |||
+ | |||
+ | === Get quote with child product === | ||
+ | '''Request''' | ||
+ | <nowiki> | ||
+ | GET /orders/{orderId}/quote | ||
+ | Cookie: OwnerId={owner_id}; Path=/</nowiki> | ||
+ | |||
+ | '''Response''' | ||
+ | <nowiki> | ||
+ | 200 OK | ||
+ | Content-Type : application/json; charset=UTF-8 | ||
+ | |||
+ | { | ||
+ | "quote": { | ||
+ | "PurchasedPlan": [ | ||
+ | "Product": [ | ||
+ | "PromotionCode":null, | ||
+ | "ChildProduct": [ | ||
+ | { | ||
+ | "PromotionCode":null, | ||
+ | "ChildProduct":[], | ||
+ | "Name":"ChildProductName", | ||
+ | "ProductNumber":null, | ||
+ | "MonthlyCycle":1" | ||
+ | "ConfigType":"ptc", | ||
+ | "Fees": [ | ||
+ | { | ||
+ | ... | ||
+ | "Currency":"USD", | ||
+ | "Amount":"0.00", | ||
+ | "NumCharges":"1", | ||
+ | "ProratedUnitAmount":"0.00", | ||
+ | "Type":"setup_fee", | ||
+ | "Discounts":[], | ||
+ | "Quantity":"1" | ||
+ | }, | ||
+ | { | ||
+ | ..., | ||
+ | "BaseAmount":"10.00", | ||
+ | "UnitAmount":"10.00", | ||
+ | "Prorated":"0", | ||
+ | "MonthlyCycle":"1" | ||
+ | ... | ||
+ | } | ||
+ | ] | ||
+ | } | ||
+ | ], | ||
+ | "Name":"ParentProduct", | ||
+ | "ProductNumber":null, | ||
+ | "MonthlyCycle":1, | ||
+ | "ConfigType":"parent.product", | ||
+ | "Fees":[ ], | ||
+ | "OrderNotes":[ ], | ||
+ | "ProductGUID":"0000015100dcc330be07657a007f000000010001" | ||
+ | ], | ||
+ | "DisplayName":"", | ||
+ | "Name":"plan name", | ||
+ | "ReferralKey":null, | ||
+ | "MonthlyCycle":1, | ||
+ | "PartnerId":"", | ||
+ | "Plan":"test.plan", | ||
+ | "Fees":[ ], | ||
+ | "PlanNumber":"0000015100dcbf46c7576990007f000000010001", | ||
+ | "PromotionCode":null | ||
+ | ], | ||
+ | "Hash": "26d42ebf46c38b3eaabca48a0f588d90e8f542fc", | ||
+ | "Currency": "USD", | ||
+ | "DeferredSubTotals":[], | ||
+ | "DeferredTotals":[], | ||
+ | "Total": "0", | ||
+ | "SubTotal": "0", | ||
+ | "OneTimeFeeAmount": "0", | ||
+ | "DeferredTaxes":[], | ||
+ | "TaxTotal": "0" | ||
+ | }, | ||
+ | "links": { | ||
+ | "self": { | ||
+ | "href": "</nowiki>{{APIBaseURL}}<nowiki>/orders/0000014854ec1d454e9cfd3d007f000000010001/quote/", | ||
+ | "rel": "self" | ||
+ | } | ||
+ | } | ||
}</nowiki> | }</nowiki> | ||
Latest revision as of 13:36, 30 May 2016
[edit] GET /orders/{orderId}/quote
Get quote for a given order.
Contents |
[edit] Request
GET /orders/{orderId}/quote
[edit] Request Parameters
- orderId - string
- The unique order Id. The URI of the order is returned by the POST /orders call.
[edit] URI Parameters
None.
[edit] Request Headers
- Cookie
- A cookie named OwnerId to identify the client (for most browser clients, the browser will do this automatically, depending on the browser configuration). The value of the cookie would come from the response to the create order request in the Set-Cookie response header.
[edit] Response
[edit] Status Code
Status Code | Error Message | Description |
---|---|---|
200 OK | - | The operation was successfully completed. |
401 Unauthorized | - | No owner Id specified or the specified owner is not authorized to get quote for this order. |
403 Forbidden | Unauthorized: Fees failed permission check | The user does not have sufficient privilege. |
404 Not Found | Resource not found | The specified order does not exist. |
502 Bad Gateway | - | Unexpected backend response. Cannot retrieve order quote. |
[edit] Response Body
{ "quote": { "Hash": "42fc1e100808efc62dadf8ad027d424dff30d6f1", "Currency": "USD", "Products": [ { "Services": [], "PlanNumber": "00000139b5dd73be7f14d3f8000a88fa0fa65d70", "PromotionCode": "promo_1234", "PromotionName": "Seasonal Discount 25% off all dedicated servers for 3 months" "ChildProduct": [], "Fees": [ { "ProrationAllowed": "0", "StartDate": "2012-09-11", "NumCharged": "0", "EndDate": "2012-09-11", "Description": "Setup fee ", "BaseAmount": "100.00", "UnitAmount": "100.00", "Prorated": "0", "MonthlyCycle": "1", "Currency": "USD", "Amount": "100.00", "NumCharges": "1", "ProratedUnitAmount": "100.00", "Type": "setup_fee", "Quantity": "1", "Deferred": "0" }, { "ProrationAllowed": "1", "StartDate": "2012-09-11", "NumCharged": "0", "EndDate": "2012-10-10", "Description": "Recurring fee", "BaseAmount": "239.00", "UnitAmount": "239.00", "Prorated": "0", "MonthlyCycle": "1", "Currency": "USD", "Amount": "239.00", "NumCharges": "-1", "ProratedUnitAmount": "239.00", "Type": "recurring", "Quantity": "1", "Deferred": "1" } ] } ], "Total": "100.00", "SubTotal": "100.00", "OneTimeFeeAmount": "100.00", "TaxTotal": "0", "DeferredSubTotals": [ { "PurchasedPlanNumber": "00000139b5dd73be7f14d3f8000a88fa0fa65d70", "Amount": "239.00" } ], "DeferredTaxes": [], "DeferredTotals": [ "PurchasedPlanNumber": "00000139b5dd73be7f14d3f8000a88fa0fa65d70", "Amount": "239.00" ], }, "links": [ {"href": "https://api.hostway.com/orders/{orderId}/quote/", "rel": "self"} ] }
[edit] Parameters
- quote - dictionary
- Quote's ordered items info
- Hash - string
- Hash string of this particular order.
- Currency - string
- The currency for this particular order. Must be a ISO-4217 currency code. ex. USD, CAD, etc.
- Products - list
- List of plan products
- Services - list
- List of product services
- PlanNumber - string
- Plan number identifier
- PromotionCode - string
- Promotion code, if any (applied at the time the product was added to the order)
- PromotionName - string
- (OPTIONAL)
- Name or short description of the promotion that was applied, if any
- ChildProduct - list
- List of products of the plan product
- Fees - list
- List of product fees
- ProrationAllowed - integer
- Number indicating whether fee proration is allowed
- StartDate - date
- Start date of the fee
- NumCharged - integer
- Number how many times this fee is charged
- EndDate - date
- End date the fee is applied
- Description - string
- Description info for this fee
- BaseAmount - decimal
- Base amount for this fee
- UnitAmount - decimal
- Unit amount for this fee
- Prorated - integer
- Integer indicating whether this fee is prorated
- MonthlyCycle - integer
- Billing cycle in months for this fee
- Currency - string
- The currency for this particular fee. Must be a ISO-4217 currency code. ex. USD, CAD, etc.
- Amount - decimal
- The actual fee amount
- NumCharges - integer
- Number of charges for this fee
- ProratedUnitAmount - decimal
- The prorated unit amount
- Type - string
- The type of this fee
- Quantity - integer
- The quantity for this fee
- Deferred - integer
- Indicates whether the fee is deferred
- Total - decimal
- Total sum for this quote. Does not include deferred charges.
- SubTotal - decimal
- Subtotal sum for this quote. Does not include deferred charges.
- OneTimeFeeAmount - decimal
- One time payable fee amount
- TaxTotal - decimal
- Tax total value. Does not include taxes on deferred charges.
- DeferredSubTotals - list
- A list of dictionaries, containing the sub of deferred subtotals for each PurchasedPlan in the order. If no deferred fees are found in the plan, it might not be present.
- DeferredTaxes - list
- A list of dictionaries, containing the sub of deferred taxes for each PurchasedPlan in the order. If no deferred fees are found in the plan, it might not be present.
- DeferredTotals - list
- A list of dictionaries, containing the sub of deferred totals (subtotal + tax) for each PurchasedPlan in the order. If no deferred fees are found in the plan, it might not be present.
- links - list
- Hypermedia for this resource. Links to self.
[edit] Example
[edit] Get empty quote info
Request
GET /orders/{orderId}/quote Cookie: OwnerId={owner_id}; Path=/
Response
200 OK Content-Type : application/json; charset=UTF-8 { "quote": { "PurchasedPlan": [], "Hash": "26d42ebf46c38b3eaabca48a0f588d90e8f542fc", "Currency": "USD", "Total": "0", "SubTotal": "0", "OneTimeFeeAmount": "0", "TaxTotal": "0" }, "links": { "self": { "href": "https://api.hostway.com/orders/0000014854ec1d454e9cfd3d007f000000010001/quote/", "rel": "self" } } }
[edit] No authorization
Request
GET /orders/{orderId}/quote Cookie: OwnerId={wrong_owner_id}; Path=/
Response
401 Unauthorized Content-Type : text/plain; charset=UTF-8 401 Unauthorized This server could not verify that you are authorized to access the document you requested. Either you supplied the wrong credentials (e.g., bad password), or your browser does not understand how to supply the credentials required.
[edit] Unauthorized user
Request
GET /orders/{orderId}/quote Authorization: Basic {wrong_user_authorization}; Path=/
Response
403 Forbidden Content-Type : application/json; charset=UTF-8 { "forbidden": { "guid": "ea88f675-dc71-410e-9e72-84f0944a289a", "message": "Unauthorized: Fees failed permission check", "code": 403, "details": "" } }
[edit] Order does not exist
Request
GET /orders/{non-existent_orderId}/quote Cookie: OwnerId={owner_id}; Path=/
Response
404 Not found Content-Type : application/json; charset=UTF-8 { "itemNotFound": { "guid": "92b7773f-e224-4971-a3dd-60fbd9c7129a", "message": "Resource not found", "code": 404, "details": "" } }
[edit] Get quote with child product
Request
GET /orders/{orderId}/quote Cookie: OwnerId={owner_id}; Path=/
Response
200 OK Content-Type : application/json; charset=UTF-8 { "quote": { "PurchasedPlan": [ "Product": [ "PromotionCode":null, "ChildProduct": [ { "PromotionCode":null, "ChildProduct":[], "Name":"ChildProductName", "ProductNumber":null, "MonthlyCycle":1" "ConfigType":"ptc", "Fees": [ { ... "Currency":"USD", "Amount":"0.00", "NumCharges":"1", "ProratedUnitAmount":"0.00", "Type":"setup_fee", "Discounts":[], "Quantity":"1" }, { ..., "BaseAmount":"10.00", "UnitAmount":"10.00", "Prorated":"0", "MonthlyCycle":"1" ... } ] } ], "Name":"ParentProduct", "ProductNumber":null, "MonthlyCycle":1, "ConfigType":"parent.product", "Fees":[ ], "OrderNotes":[ ], "ProductGUID":"0000015100dcc330be07657a007f000000010001" ], "DisplayName":"", "Name":"plan name", "ReferralKey":null, "MonthlyCycle":1, "PartnerId":"", "Plan":"test.plan", "Fees":[ ], "PlanNumber":"0000015100dcbf46c7576990007f000000010001", "PromotionCode":null ], "Hash": "26d42ebf46c38b3eaabca48a0f588d90e8f542fc", "Currency": "USD", "DeferredSubTotals":[], "DeferredTotals":[], "Total": "0", "SubTotal": "0", "OneTimeFeeAmount": "0", "DeferredTaxes":[], "TaxTotal": "0" }, "links": { "self": { "href": "https://api.hostway.com/orders/0000014854ec1d454e9cfd3d007f000000010001/quote/", "rel": "self" } } }
[edit] See also