Skip to content

Commit d333d44

Browse files
Copy Promotion usages (#281)
* Copy Promotion usages * edits * copied payments spec
1 parent e655429 commit d333d44

File tree

10 files changed

+311
-6
lines changed

10 files changed

+311
-6
lines changed

docs/promotions/_category_.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"position": 156,
3+
"label": "Promotion Usages"
4+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"position": 156,
3+
"label": "Promotion Usages"
4+
}
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
---
2+
title: Anonymize usages
3+
nav_label: Anonymize Usages
4+
sidebar_position: 3
5+
---
6+
7+
You can anonymize promotion usage.
8+
9+
When anonymization is successful, Personal Identifiable Information such as `customer_email` address is replaced with `*`.
10+
11+
## `POST` Anonymize Usages
12+
13+
```http
14+
https://useast.api.elasticpath.com/v2/promotions/usages/anonymize
15+
```
16+
17+
## Parameters
18+
19+
### Headers
20+
21+
| Name | Required | Type | Description |
22+
|:----------------|:---------|:---------|:-------------------------------------|
23+
| `Authorization` | Required | `string` | The Bearer token required to get access to the API. The grant type must be `client_credentials`. |
24+
25+
### Body
26+
27+
| Name | Required | Type | Description |
28+
|:-------|:---------|:---------|:------------|
29+
| `usage_ids` | Required | `array [string]` | The unique identifiers of the usages to be anonymized. You can anonymize multiple usages at the same time. |
30+
31+
## Request Example - Curl
32+
33+
```bash
34+
curl -X POST https://useast.api.elasticpath.com/v2/promotions/usages/anonymize \
35+
-H "Authorization: Bearer XXXX" \
36+
-H "Content-Type: application/json" \
37+
-d $ {
38+
"data": {
39+
"usage_ids": ["ca4385ec-7fb2-4a95-8690-f752c508d68a"]
40+
}
41+
}
42+
```
43+
44+
## Response Example
45+
46+
`200 OK`
47+
48+
```json
49+
{
50+
"data": [
51+
{
52+
"id": "ca4385ec-7fb2-4a95-8690-f752c508d68a",
53+
"order_id": "8edd5ca8-39b7-468d-aea9-a470690ca98d",
54+
"code_id": "00fc633b-9932-4e18-b122-fd5c3173caa3",
55+
"code": "node1off",
56+
"times_used": 1,
57+
"used_on": "2023-06-19T18:05:20.846Z",
58+
"cusomter_id": "9ef25142-d67a-41d3-99b2-4d30aeef6c9d",
59+
"customer_email": "**",
60+
"meta": {
61+
"timestamps": {
62+
"updated_at": "2023-06-19T18:05:39.141Z"
63+
}
64+
},
65+
"updated_by": "Key-2439657140697170361",
66+
"anonymized": true
67+
}
68+
]
69+
}
70+
```
71+
## Errors
72+
73+
The following response is returned if some `usage_ids` are successfuly anonymized and if some `usage_ids` are not valid. The invalid `usage_ids` are returned in the `errors:[]` array.
74+
75+
```json
76+
{
77+
"data": [
78+
{
79+
"id": "6a847eba-aec1-4d35-b43a-c9ff7f14e3e3",
80+
"order_id": "2ff49239-3a3c-4877-8611-37515aac20c2",
81+
"code_id": "00fc633b-9932-4e18-b122-fd5c3173caa3",
82+
"code": "node1off",
83+
"times_used": 1,
84+
"used_on": "2023-06-16T17:38:11.403Z",
85+
"customer_email": "**",
86+
"meta": {
87+
"timestamps": {
88+
"updated_at": "2023-06-16T18:14:14.218Z"
89+
}
90+
},
91+
"anonymized": true
92+
}
93+
],
94+
"errors": [
95+
{
96+
"status": "404",
97+
"title": "Could not anonymize some usages",
98+
"detail": "Usages not found.",
99+
"meta": {
100+
"usage_ids": [
101+
"6a847eba-aec1-4d35-b43a-c9ff7f14e3e4"
102+
]
103+
}
104+
}
105+
]
106+
}
107+
```
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
---
2+
title: Get a Promotion Code Usage
3+
nav_label: Get a Promotion Code Usage
4+
sidebar_position: 2
5+
---
6+
7+
## `GET` Get a Promotion Code Usage
8+
9+
```http
10+
https://useast.api.elasticpath.com/v2/promotions/:id/codes/:code-name/usages
11+
```
12+
Use this endpoint to track the usage history of a specific promotion code within the specific promotion. For example, `order_id`, `code`, `times_used`.
13+
14+
## Parameters
15+
16+
### Path parameters
17+
18+
| Name | Required | Type | Description |
19+
| ---- | -------- | -------- | -------------------------------- |
20+
| `id` | Required | `string` | Specifies the unique identifier for the promotion. |
21+
| `code-name` | Required | `string` | Specifies the name of the code. For example, `10OFF`. |
22+
23+
### Headers
24+
25+
| Name | Required | Type | Description |
26+
| --------------- | -------- | -------- | --------------------------------------------------- |
27+
| `Authorization` | Required | `string` | The Bearer token required to get access to the API. |
28+
29+
### Query parameters
30+
31+
| Name | Required | Type | Description |
32+
| ---- | -------- | -------- | -------------------------------- |
33+
| `filter` | Optional | `string` | Filter attributes. For more information, see [Filtering](#filtering). |
34+
| `page[limit]` | Optional | `integer` | The number of records per page. |
35+
| `page[offset]` | Optional | `integer` | The number of records to offset the results by. |
36+
| `sort` | Optional | `string` | Supported attribute is `used_on`. When specified, the results are sorted in ascending order based on the value of the field. To sort in descending order, prefix the attribute with -, for example, -used_on. The default sort order is `used_on` in ascending order. See [Sorting](/guides/Getting-Started/sorting). |
37+
38+
## Filtering
39+
40+
| Attribute | Type | Operators | Example |
41+
| ---------| --------- | ---------------------------| -------- |
42+
| `code` | `string` | `eq` | `eq(code,cart1off)` |
43+
| `id` | `string` | `eq` |
44+
| `used_on` | `string` | `gt`,`ge`,`le` and `lt` | `gt(used_on,2023-07-11)` |
45+
46+
## Request Example
47+
48+
```bash
49+
curl https://useast.api.elasticpath.com/v2/promotions/:id/codes/:code-name/usages \
50+
-H "Authorization: Bearer XXXX" \
51+
-H "Content-Type: application/json" \
52+
```
53+
54+
## Response Example
55+
56+
`200 OK`
57+
58+
```json
59+
{
60+
"data": [
61+
{
62+
"id": "a042bd4b-21a6-4f55-8add-5a3e8b862ddc",
63+
"order_id": "01e2a292-f92e-4579-973c-2f3bc70acec1",
64+
"code_id": "7905c48a-55b0-4bf0-abd7-c2cdbbb944e9",
65+
"code": "cart2uses",
66+
"times_used": 1,
67+
"used_on": "2023-05-30T23:10:56.016Z",
68+
"cusomter_id": "1eaf092c-f6e1-48e6-a64f-1c092b711916",
69+
"customer_email": "[email protected]",
70+
"meta": {
71+
"timestamps": {
72+
"updated_at": "2024-01-03T17:37:47.111Z"
73+
}
74+
},
75+
"anonymized": false
76+
}
77+
]
78+
}
79+
```
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
---
2+
title: Get Usages for Promotion
3+
nav_label: Get Usages for Promotion
4+
sidebar_position: 1
5+
---
6+
7+
## `GET` Get Usages for Promotion
8+
9+
```http
10+
https://useast.api.elasticpath.com/v2/promotions/:id/usages
11+
```
12+
Use this endpoint to track the usage history of the specific promotion. For example, `order_id`, `code`, `times_used`, and so on.
13+
14+
## Parameters
15+
16+
### Path parameters
17+
18+
| Name | Required | Type | Description |
19+
| ---- | -------- | -------- | -------------------------------- |
20+
| `id` | Required | `string` | Specifies The unique identifier for the promotion. |
21+
22+
23+
### Headers
24+
25+
| Name | Required | Type | Description |
26+
| --------------- | -------- | -------- | --------------------------------------------------- |
27+
| `Authorization` | Required | `string` | The Bearer token required to get access to the API. |
28+
29+
### Query parameters
30+
31+
| Name | Required | Type | Description |
32+
| ---- | -------- | -------- | -------------------------------- |
33+
| `filter` | Optional | `string` | Filter attributes. For more information, see [Filtering](#filtering). |
34+
| `page[limit]` | Optional | `integer` | The number of records per page. |
35+
| `page[offset]` | Optional | `integer` | The number of records to offset the results by. |
36+
| `sort` | Optional | `string` | Supported attributes are `code`, `customer_id`, `order_id`, `customer_email`, `id`, `used_on`, `updated_at`. When specified, the results are sorted in ascending order based on the value of the field. To sort in descending order, prefix the attribute with -, for example, -updated_at. The default sort order is updated_at in descending order. See [Sorting](/guides/Getting-Started/sorting). |
37+
38+
## Filtering
39+
40+
The following operators and attributes are available for filtering usages:
41+
42+
| Attribute | Type | Operators | Example |
43+
| ---------| --------- | ---------------------------| -------- |
44+
| `id` | `string` | `eq` | `eq(id,8dac76b3-9282-4730-b1dd-bdd2a95610cb)` |
45+
| `code` | `string` | `eq` | `eq(code,cart1off)` |
46+
| `used_on` | `string` | `gt`,`ge`,`le` and `lt` | `gt(used_on,2023-07-11)` |
47+
48+
## Request Example
49+
50+
```bash
51+
curl https://useast.api.elasticpath.com/v2/promotions/:id/usages \
52+
-H "Authorization: Bearer XXXX" \
53+
-H "Content-Type: application/json" \
54+
```
55+
56+
## Response Example
57+
58+
`200 OK`
59+
60+
```json
61+
{
62+
"data": [
63+
{
64+
"id": "a042bd4b-21a6-4f55-8add-5a3e8b862ddc",
65+
"order_id": "01e2a292-f92e-4579-973c-2f3bc70acec1",
66+
"code_id": "7905c48a-55b0-4bf0-abd7-c2cdbbb944e9",
67+
"code": "cart2uses",
68+
"times_used": 1,
69+
"used_on": "2023-05-30T23:10:56.016Z",
70+
"cusomter_id" : "1eaf092c-f6e1-48e6-a64f-1c092b711916",
71+
"customer_email": "[email protected]",
72+
"meta": {
73+
"timestamps": {
74+
"updated_at": "2024-01-03T17:37:47.111Z"
75+
}
76+
},
77+
"anonymized": false
78+
}
79+
]
80+
}
81+
```
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
title: Overview
3+
nav_label: Overview
4+
sidebar_position: 0.5
5+
---
6+
7+
Promotion usages are helpful in tracking and understanding how promotional offers are utilized. This includes details such as which promotions were used, how frequently they were used, order ID, code ID, customer email, date of the promotion's usage. To retrieve the usage history of a specific promotion, see [Get Promotion Usages](/docs/api/promotions/get-promotion-codes).
8+
9+
You can also track the history of a specific promotion code within a particular promotion. See [Get a Promotion Code Usage](/docs/promotions/promotion-usages/get-a-promotion-code-usage).
10+
11+
Additionally, you can also choose to anonymize customer email addresses associated with promotion usages. For more information, see [Anonymize Usages](/docs/promotions/promotion-usages/anonymize-usages).

guides/Getting-Started/pagination.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,10 @@ Even if the result is zero, pagination fields are always included in the respons
7070
* [Get all Inventory](/docs/api/pxm/inventory/get-stock-for-all-products)
7171
* [Get all Files](/docs/api/pxm/files/get-all-files)
7272
* [Get all Jobs](/docs/api/pxm/products/get-all-jobs)
73-
* [Get Usages for Promotion](/docs/promotions-builder/promotions-builder-codes/get-promotion-usages)
74-
* [Get a Promotion Code Usage](/docs/promotions-builder/promotions-builder-codes/get-a-promotion-code-usage)
73+
* [Get Usages for Standard Promotions](/docs/promotions-builder/promotions-builder-codes/get-promotion-usages)
74+
* [Get a Promotion Code Usage in Promotions Builder](/docs/promotions-builder/promotions-builder-codes)
75+
* [Get Usages for Promotion in Promitions Builder](/docs/promotions-builder/promotions-builder-codes/get-promotion-usages)
76+
* [Get a Promotion Code Usage in Promotions Builder](/docs/promotions-builder/promotions-builder-codes/get-a-promotion-code-usage)
7577

7678
## Limitations
7779

openapispecs/payments/OpenAPISpec.yaml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -731,7 +731,13 @@ paths:
731731
tags:
732732
- Gateways
733733
summary: Update Authorize.net Gateway
734-
description: Use this endpoint to configure Authorize.net.
734+
description: |
735+
736+
Use this endpoint to configure Authorize.net.
737+
738+
:::note
739+
The credentials used for a test account may differ from those used for a live account. When configuring the payment gateway with your credentials and setting `test` to `true`, the system allows you to test various Authorize.net payment interactions to ensure everything works as expected. Once you are ready to go live, update `test` as `false` to direct requests to the live endpoints instead of the test account. Additionally, ensure that you switch to the credentials for the live account when making this change. To access your sandbox environment, see [Authorize.net Sandbox account](https://developer.authorize.net/hello_world/sandbox.html).
740+
:::
735741
operationId: updateAuthorizeNetGateway
736742
parameters: [ ]
737743
requestBody:

openapispecs/promotions/OpenAPISpec.yaml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,14 @@ paths:
519519
tags:
520520
- Promotion Codes
521521
summary: Get Promotion Codes
522-
description: Get promotion codes
522+
description: |
523+
You can use this endpoint to retrieve promotion codes.
524+
525+
:::note
526+
- The `codes.max_uses` attribute represents the maximum usage of the codes.
527+
- The `codes.uses` attribute represents the remaining number of times the codes can be used for the promotion.
528+
- Codes created before April 27, 2023 will only have `codes.uses` attribute in the response body.
529+
:::
523530
operationId: getPromotionCodes
524531
parameters:
525532
- name: promotionID
@@ -1408,12 +1415,12 @@ components:
14081415
examples:
14091416
- per_item
14101417
user:
1411-
description: Specifies a string that specifies the users who can use the code. You can use the customer object ID or an array of customer object IDs. For more information, see the Create a customer section. Additionally, you could pass any identifying string to the promotions service that identifies a user.
1418+
description: Specifies the users who can use the code. You can use the customer object ID or an array of customer object IDs. For more information, see the [Create a customer](/docs/customer-management/customer-management-api/create-a-customer) section. Additionally, you could pass any identifying string to the promotions service that identifies a user.
14121419
type: string
14131420
examples:
14141421
- '{customerID}'
14151422
uses:
1416-
description: Specifies the number of times the code can be used. If no value is set, the customer can use the code any number of times.
1423+
description: Specifies the maximum number of times the code can be used. If no value is set, the shopper can use the code any number of times.
14171424
type: number
14181425
examples:
14191426
- 10

sidebars-default.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -435,6 +435,10 @@ const sidebarsDefault = {
435435
// @ts-ignore
436436
items: require("./docs/api/promotions/sidebar.js")
437437
},
438+
{
439+
type: 'autogenerated',
440+
dirName: 'promotions',
441+
},
438442
],
439443
pxm: [
440444
{

0 commit comments

Comments
 (0)