{
	"info": {
		"_postman_id": "d5b718b2-3033-4f32-8b6b-37eed22abe6b",
		"name": "Deeployalty cashbacks",
		"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
		"_exporter_id": "20103944"
	},
	"item": [
		{
			"name": "Authorization casbacks",
			"event": [
				{
					"listen": "test",
					"script": {
						"exec": [
							"// Save token to the environment variable\r",
							"pm.environment.set(\"tokencashback\", pm.response.json().access_token);\r",
							""
						],
						"type": "text/javascript",
						"packages": {}
					}
				}
			],
			"request": {
				"auth": {
					"type": "bearer",
					"bearer": [
						{
							"key": "token",
							"value": "",
							"type": "string"
						}
					]
				},
				"method": "POST",
				"header": [
					{
						"key": "Authorization",
						"value": "Bearer {{authToken}}"
					},
					{
						"key": "Content-Type",
						"value": "application/json"
					}
				],
				"body": {
					"mode": "raw",
					"raw": "{\r\n    \"clientId\": \"{{clientId}}\",\r\n    \"secret\": \"{{secret}}\"\r\n}"
				},
				"url": {
					"raw": "{{baseUrl}}/getToken/auth",
					"host": [
						"{{baseUrl}}"
					],
					"path": [
						"getToken",
						"auth"
					]
				}
			},
			"response": []
		},
		{
			"name": "Create cashbacks",
			"event": [
				{
					"listen": "prerequest",
					"script": {
						"exec": [
							""
						],
						"type": "text/javascript",
						"packages": {}
					}
				},
				{
					"listen": "test",
					"script": {
						"exec": [
							""
						],
						"type": "text/javascript",
						"packages": {}
					}
				}
			],
			"request": {
				"auth": {
					"type": "bearer",
					"bearer": [
						{
							"key": "token",
							"value": "{{tokencashback}}",
							"type": "string"
						}
					]
				},
				"method": "POST",
				"header": [],
				"body": {
					"mode": "raw",
					"raw": "{\r\n    \"retailerId\":\"{{retailerId}}\",\r\n    \"bankId\": [\"{{bankId}}\"],\r\n    \"name\": \"test\",\r\n    \"description\": \"test cashback\",\r\n    \"bannerSmall\": \"http://test.com\",\r\n    \"bannerBig\": \"http://test.com\",\r\n    \"sku\": [\"1111111111\",\"2222222222\",\"3333333333\", \"44444444444\",\"5555555555\"],\r\n    \"categoryId\": [\"12\"],\r\n    \"dateFrom\": \"2025-03-24\",\r\n    \"dateTo\": \"2025-03-30\"\r\n}",
					"options": {
						"raw": {
							"language": "json"
						}
					}
				},
				"url": {
					"raw": "{{baseUrl}}/cashbacks",
					"host": [
						"{{baseUrl}}"
					],
					"path": [
						"cashbacks"
					]
				},
				"description": "### Create Cashback\n\nThis endpoint allows the creation of a new cashback offer.\n\n#### Request Body\n\n- `retailerId` (string): The ID of the retailer.\n    \n- `bankId` (array): An array of bank IDs associated with the cashback offer.\n    \n- `name` (string): The name of the cashback offer.\n    \n- `description` (string): A description of the cashback offer.\n    \n- `bannerSmall` (string): URL of the small banner for the cashback offer.\n    \n- `bannerBig` (string): URL of the big banner for the cashback offer.\n    \n- `sku` (array): An array of SKUs associated with the cashback offer.\n    \n- `categoryId` (array): An array of category IDs associated with the cashback offer.\n    \n- `dateFrom` (string): Start date of the cashback offer (format: YYYY-MM-DD).\n    \n- `dateTo` (string): End date of the cashback offer (format: YYYY-MM-DD).\n    \n\n#### Response\n\n- Status: 401\n    \n- Content-Type: application/json\n    \n- `exp` (string): The expiration date of the token.\n    \n\nBefore running the request, use the token 'tokencashback' from the environment."
			},
			"response": []
		},
		{
			"name": "Edit cashbacks",
			"request": {
				"auth": {
					"type": "bearer",
					"bearer": [
						{
							"key": "token",
							"value": "{{tokencashback}}",
							"type": "string"
						}
					]
				},
				"method": "PATCH",
				"header": [],
				"body": {
					"mode": "raw",
					"raw": "{\r\n    \"retailerId\":\"{{retailerId}}\",\r\n    \"bankId\": [\"{{bankId}}\"],\r\n    \"name\": \"test\",\r\n    \"description\": \"test cashback\",\r\n    \"bannerSmall\": \"http://test.com\",\r\n    \"bannerBig\": \"http://test.com\",\r\n    \"sku\": [\"1111111111\",\"2222222222\",\"3333333333\", \"44444444444\",\"5555555555\"],\r\n    \"categoryId\": [\"12\"],\r\n    \"dateFrom\": \"2025-03-24\",\r\n    \"dateTo\": \"2025-03-30\"\r\n}",
					"options": {
						"raw": {
							"language": "json"
						}
					}
				},
				"url": {
					"raw": "{{baseUrl}}/cashbacks/:cashbackId",
					"host": [
						"{{baseUrl}}"
					],
					"path": [
						"cashbacks",
						":cashbackId"
					],
					"variable": [
						{
							"key": "cashbackId",
							"value": "{{cashbackId}}"
						}
					]
				}
			},
			"response": []
		},
		{
			"name": "Get cashbacks",
			"request": {
				"auth": {
					"type": "bearer",
					"bearer": [
						{
							"key": "token",
							"value": "{{tokencashback}}",
							"type": "string"
						}
					]
				},
				"method": "GET",
				"header": [],
				"url": {
					"raw": "{{baseUrl}}/cashbacks?name=test&sku=1111&retailerId={{retailerId}}",
					"host": [
						"{{baseUrl}}"
					],
					"path": [
						"cashbacks"
					],
					"query": [
						{
							"key": "name",
							"value": "test"
						},
						{
							"key": "sku",
							"value": "1111"
						},
						{
							"key": "retailerId",
							"value": "{{retailerId}}"
						}
					]
				}
			},
			"response": []
		},
		{
			"name": "Get cashbacks by id",
			"request": {
				"auth": {
					"type": "bearer",
					"bearer": [
						{
							"key": "token",
							"value": "{{tokencashback}}",
							"type": "string"
						}
					]
				},
				"method": "GET",
				"header": [],
				"url": {
					"raw": "{{baseUrl}}/cashbacks/:cashbackId",
					"host": [
						"{{baseUrl}}"
					],
					"path": [
						"cashbacks",
						":cashbackId"
					],
					"variable": [
						{
							"key": "cashbackId",
							"value": "{{cashbackId}}"
						}
					]
				}
			},
			"response": []
		}
	],
	"variable": [
		{
			"key": "baseUrl",
			"value": "https://api.dev.deeployalty.io"
		},
		{
			"key": "clientId",
			"value": ""
		},
		{
			"key": "secret",
			"value": ""
		},
		{
			"key": "retailerId",
			"value": ""
		},
		{
			"key": "bankId",
			"value": ""
		},
		{
			"key": "cashbackId",
			"value": ""
		}
	]
}
