User Discount

This section is the extension of Discount section, it give's control over user discounts. To be active discount it must be attached to specific user - and then it will get applied at checkout.

Admin logged in - can attach any discount to any user, or remove any discount attachment from any user.
User logged in - an see it's attached discount's in case he has any,at trade checkout.

update-user-discount

update exact row from user_discounts DB table using user_discount_id

SecurityAuthorization
Request
path Parameters
user_id
required
string

user_id path parameter

Example: <user_discount_id>
header Parameters
Authorization
required
string

auth header for JWT

Example: <JWT token>
username
required
string

auth header for username

Example: <username>
Request Body schema: application/json
required

raw(json)

user_id
string
discount_id
string
expiry_date
string
Responses
200

Success

401

Unauthorized

403

Forbidden

put/discounts/user/{user_id}
Request samples
application/json
{
  • "user_id": "Y0ZuTVFCNnl6S3pISDhMTXVYSHBwZz09",
  • "discount_id": "WlBPdmtSY2hITGM9",
  • "expiry_date": "2023-10-26 08:53:53"
}
Response samples
application/json
{
  • "api_message": "<string>",
  • "api_data": null
}

delete-user-discount

Delete exact row from user discounts using user_discount_id

SecurityAuthorization
Request
path Parameters
user_id
required
string

user_id path parameter

Example: <user_discount_id>
header Parameters
Authorization
required
string

auth header for JWT

Example: <JWT token>
username
required
string

auth header for username

Example: <username>
Responses
204

No Content (Success)

401

Unauthorized

403

Forbidden

delete/discounts/user/{user_id}
Response samples
application/json
{ }

get-user-discounts

getting discounts rows of user if user does not exist or he does not have discount defined , empty array is return in api_data

SecurityAuthorization
Request
path Parameters
user_id
required
string

user_id path parameter

Example: <user_id>
header Parameters
Authorization
required
string

auth header for JWT

Example: <JWT token>
username
required
string

auth header for username

Example: <username>
Responses
200

Success

401

Unauthorized

403

Forbidden

get/discounts/user/{user_id}
Response samples
application/json
{
  • "api_message": "<string>",
  • "api_data": { },
  • "id": "<string>",
  • "user_id": "<string>",
  • "discount_id": "<string>",
  • "status": true,
  • "is_gross": true,
  • "expiry_date": "<datetime string>",
  • "created_at": "<datetime string>",
  • "updated_at": "<datetime string>",
  • "is_one_time": true,
  • "currency": "<string>",
  • "volumes": {
    }
}

attach-discount-to-user

Attach a discount to a specified user.

SecurityAuthorization
Request
header Parameters
Authorization
required
string

auth header for JWT

Example: <JWT token>
username
required
string

auth header for username

Example: <username>
Request Body schema: application/json
required

raw(json)

user_id
string
discount_id
string
expiry_date
string
Responses
200

Success

401

Unauthorized

403

Forbidden

422

Unprocessable Content

500

Internal Server Error

post/discounts/user
Request samples
application/json
{
  • "user_id": "Y0ZuTVFCNnl6S3pISDhMTXVYSHBwZz09",
  • "discount_id": "WlBPdmtSY2hITGM9",
  • "expiry_date": "2023-10-26 08:53:53"
}
Response samples
application/json
{
  • "api_message": "<string>",
  • "api_data": null
}