diff --git a/specification/paths.json b/specification/paths.json index 2480eff5..d7e43d19 100644 --- a/specification/paths.json +++ b/specification/paths.json @@ -131,6 +131,9 @@ "/onboarding/v1/invitations/{invitation_id}/onboard": { "$ref": "./paths/Onboarding-v1-invitations-invitation_id-onboard.json" }, + "/orders/v1/orders/{reference}": { + "$ref": "./paths/Orders-v1-orders-reference.json" + }, "/organizations": { "$ref": "./paths/Organizations.json" }, @@ -398,12 +401,6 @@ "/zones/{zone_id}": { "$ref": "./paths/Zones-zone_id.json" }, - "/analytics/on-time-delivery/{interval}": { - "$ref": "./paths/Analytics-on-time-delivery.json" - }, - "/analytics/volume/{group_by}/{interval}": { - "$ref": "./paths/Analytics-volume.json" - }, "/add-shipments-to-collection": { "$ref": "./paths/AddShipmentsToCollection.json" }, diff --git a/specification/paths/Analytics-on-time-delivery.json b/specification/paths/Analytics-on-time-delivery.json deleted file mode 100644 index e7e66f31..00000000 --- a/specification/paths/Analytics-on-time-delivery.json +++ /dev/null @@ -1,86 +0,0 @@ -{ - "get": { - "tags": [ - "Analytics" - ], - "security": [ - { - "OAuth2": [ - "shipments.manage" - ] - } - ], - "summary": "Get analytics report for delivered shipments on time.", - "description": "This endpoint retrieves the rate by which shipments are successfully delivered on time on intervals.", - "parameters": [ - { - "name": "interval", - "in": "path", - "description": "Interval by which to arrange the dataset.", - "required": true, - "schema": { - "type": "string", - "enum": [ - "month" - ] - } - }, - { - "name": "filter[date_from]", - "in": "query", - "description": "Date string in ISO 8601 date format (YYYY-MM-DD). Only shipments created at >= this date will be in the response.", - "schema": { - "type": "string" - } - }, - { - "name": "filter[date_to]", - "in": "query", - "description": "Date string in ISO 8601 date format (YYYY-MM-DD). Only shipments created at <= this date will be in the response.", - "schema": { - "type": "string" - } - }, - { - "$ref": "#/components/parameters/query-filter-shop" - }, - { - "$ref": "#/components/parameters/query-filter-organization" - }, - { - "$ref": "#/components/parameters/query-filter-broker" - }, - { - "$ref": "#/components/parameters/query-filter-carrier" - }, - { - "name": "filter[service_code]", - "in": "query", - "description": "Comma separated string of service codes to filter by. Only shipments with a service that corresponds with one of the service codes will be in the response.", - "schema": { - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "Retrieved the analytics data in timeseries.", - "content": { - "application/json": { - "schema": { - "type": "object", - "required": [ - "data" - ], - "properties": { - "data": { - "$ref": "#/components/schemas/Analytics" - } - } - } - } - } - } - } - } -} diff --git a/specification/paths/Analytics-volume.json b/specification/paths/Analytics-volume.json deleted file mode 100644 index 6a22897b..00000000 --- a/specification/paths/Analytics-volume.json +++ /dev/null @@ -1,118 +0,0 @@ -{ - "get": { - "tags": [ - "Analytics" - ], - "security": [ - { - "OAuth2": [ - "shipments.manage" - ] - } - ], - "summary": "Get analytics report for volumes per carrier.", - "description": "This endpoint retrieves the amount of shipments delivered organized by carrier over time.", - "parameters": [ - { - "name": "group_by", - "in": "path", - "description": "Field by which to group data series by. Set `combined` to ignore grouping.", - "required": true, - "schema": { - "type": "string", - "enum": [ - "carrier", - "service", - "combined" - ] - } - }, - { - "name": "interval", - "in": "path", - "description": "Interval by which to arrange the dataset.", - "required": true, - "schema": { - "type": "string", - "enum": [ - "month" - ] - } - }, - { - "$ref": "#/components/parameters/query-shipments-filter-search" - }, - { - "$ref": "#/components/parameters/query-shipments-filter-description" - }, - { - "$ref": "#/components/parameters/query-shipments-filter-customer_reference" - }, - { - "$ref": "#/components/parameters/query-shipments-filter-date_from" - }, - { - "$ref": "#/components/parameters/query-shipments-filter-date_to" - }, - { - "$ref": "#/components/parameters/query-filter-created_at-date_from" - }, - { - "$ref": "#/components/parameters/query-filter-created_at-date_to" - }, - { - "$ref": "#/components/parameters/query-shipments-filter-register_at-date_from" - }, - { - "$ref": "#/components/parameters/query-shipments-filter-register_at-date_to" - }, - { - "$ref": "#/components/parameters/query-filter-shop" - }, - { - "$ref": "#/components/parameters/query-filter-organization" - }, - { - "$ref": "#/components/parameters/query-filter-broker" - }, - { - "$ref": "#/components/parameters/query-filter-carrier" - }, - { - "$ref": "#/components/parameters/query-shipments-filter-current_status_code" - }, - { - "$ref": "#/components/parameters/query-shipments-filter-service_code" - }, - { - "$ref": "#/components/parameters/query-shipments-filter-recipient_address-country_code" - }, - { - "$ref": "#/components/parameters/query-shipments-filter-sender_address-country_code" - }, - { - "$ref": "#/components/parameters/query-shipments-filter-consolidation_shipment" - } - ], - "responses": { - "200": { - "description": "Retrieved the analytics data in timeseries.", - "content": { - "application/json": { - "schema": { - "type": "object", - "required": [ - "data" - ], - "properties": { - "data": { - "$ref": "#/components/schemas/Analytics" - } - } - } - } - } - } - } - } -} diff --git a/specification/paths/Orders-v1-orders-reference.json b/specification/paths/Orders-v1-orders-reference.json new file mode 100644 index 00000000..147fb017 --- /dev/null +++ b/specification/paths/Orders-v1-orders-reference.json @@ -0,0 +1,80 @@ +{ + "parameters": [ + { + "name": "reference", + "in": "path", + "description": "Order reference to retrieve the order by.", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "shop_id", + "in": "query", + "required": true, + "description": "Id of the shop to retrieve the order for.", + "schema": { + "$ref": "#/components/schemas/Uuid" + } + }, + { + "name": "email", + "in": "query", + "description": "Email address of the receiver of the order. This query parameter is mutually exclusive with postal code query parameter. Either one is required.", + "schema": { + "$ref": "#/components/schemas/Email" + } + }, + { + "name": "postal_code", + "in": "query", + "description": "Postal code of the receiver of the order. This query parameter is mutually exclusive with email query parameter. Either one is required.", + "schema": { + "type": "string", + "example": "1111AA" + } + } + ], + "get": { + "tags": [ + "Orders" + ], + "security": [ + { + "OAuth2": [ + "returns.manage" + ] + } + ], + "summary": "Get an order resource by reference and email or postal code.", + "description": "This endpoint retrieves an order resource by the specified reference and either email address or postal code.", + "responses": { + "200": { + "description": "Retrieved the order.", + "content": { + "application/vnd.api+json": { + "schema": { + "type": "object", + "required": [ + "data" + ], + "additionalProperties": false, + "properties": { + "data": { + "$ref": "#/components/schemas/OrderResponse" + } + } + } + } + } + }, + "404": { + "description": "No order was found with the provided input." + }, + "409": { + "description": "One or more of the orders resource is handled by a 3rd party." + } + } + } +} diff --git a/specification/paths/Returns-v1-return-methods-resolve.json b/specification/paths/Returns-v1-return-methods-resolve.json index 4d3ad275..531f0e95 100644 --- a/specification/paths/Returns-v1-return-methods-resolve.json +++ b/specification/paths/Returns-v1-return-methods-resolve.json @@ -43,19 +43,39 @@ "example": "35eddf50-1d84-47a3-8479-6bfda729cd99" }, "consumer_address": { - "required": [ - "country_code", - "email" - ], - "properties": { - "country_code": { - "$ref": "#/components/schemas/CountryCode" + "oneOf": [ + { + "title": "Resolve order by email", + "required": [ + "country_code", + "email" + ], + "properties": { + "country_code": { + "$ref": "#/components/schemas/CountryCode" + }, + "email": { + "$ref": "#/components/schemas/Email" + } + } }, - "email": { - "$ref": "#/components/schemas/Email", - "example": "s.holmes@holmesinvestigations.com" + { + "title": "Resolve order by postal code", + "required": [ + "country_code", + "postal_code" + ], + "properties": { + "country_code": { + "$ref": "#/components/schemas/CountryCode" + }, + "postal_code": { + "type": "string", + "example": "1111AA" + } + } } - } + ] }, "weight": { "type": "integer", diff --git a/specification/paths/Returns-v1-returns.json b/specification/paths/Returns-v1-returns.json index bdfb0d47..1d27affe 100644 --- a/specification/paths/Returns-v1-returns.json +++ b/specification/paths/Returns-v1-returns.json @@ -29,6 +29,14 @@ "type": "string" } }, + { + "name": "filter[postal_code]", + "in": "query", + "description": "Postal code of the consumer_address of the return.", + "schema": { + "type": "string" + } + }, { "name": "filter[search]", "in": "query", diff --git a/specification/paths/Returns-v1-shops-shop_id-orders-reference-email.json b/specification/paths/Returns-v1-shops-shop_id-orders-reference-email.json index dbd50655..3371ab99 100644 --- a/specification/paths/Returns-v1-shops-shop_id-orders-reference-email.json +++ b/specification/paths/Returns-v1-shops-shop_id-orders-reference-email.json @@ -33,6 +33,7 @@ ] } ], + "deprecated": true, "summary": "Get an order resource.", "description": "This endpoint retrieves an order resource by the specified reference and email address.", "responses": { diff --git a/specification/schemas.json b/specification/schemas.json index fbb23cf2..d8d83349 100644 --- a/specification/schemas.json +++ b/specification/schemas.json @@ -764,9 +764,6 @@ "Weight": { "$ref": "./schemas/Weight.json" }, - "Analytics": { - "$ref": "./schemas/Analytics.json" - }, "TaxIdentificationNumber": { "$ref": "./schemas/organizations/TaxIdentificationNumber.json" }, diff --git a/specification/schemas/Analytics.json b/specification/schemas/Analytics.json deleted file mode 100644 index 089321a0..00000000 --- a/specification/schemas/Analytics.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "type": "object", - "additionalProperties": false, - "properties": { - "unit_type": { - "type": "string", - "example": "percentage", - "enum": [ - "amount", - "percentage" - ] - }, - "labels": { - "type": "array", - "description": "List of all chart labels on the X axis", - "items": { - "type": "string", - "example": "January" - } - }, - "datasets": { - "type": "array", - "items": { - "type": "object", - "properties": { - "label": { - "type": "string", - "example": "Delivery < 1 day" - }, - "data": { - "type": "array", - "items": { - "type": "number", - "format": "float", - "example": 93.56 - } - } - } - } - } - } -} diff --git a/specification/tags.json b/specification/tags.json index 12ded8c1..13ec51d2 100644 --- a/specification/tags.json +++ b/specification/tags.json @@ -98,6 +98,9 @@ { "name": "Onboarding" }, + { + "name": "Orders" + }, { "name": "Organizations", "externalDocs": { @@ -211,8 +214,5 @@ }, { "name": "Zones" - }, - { - "name": "Analytics" } ] diff --git a/src/myparcelcom.js b/src/myparcelcom.js index 738baceb..1931f26f 100644 --- a/src/myparcelcom.js +++ b/src/myparcelcom.js @@ -101,7 +101,6 @@ 'SystemMessages', 'ExportLoginAttempts', 'ReturnReasonsManagement', - 'Analytics', ] for (var i = 0; i < internal.length; i++) { var sections = document.querySelectorAll([