API doc for NovoWatt app (1.0.0)

Download OpenAPI specification:

This is the API documentation for novowatt app.

PromoCodes

Get list promo codes programs with pagination

query Parameters
keyword
string

Search by keyword - code, name, ...

code
string

Filter by code

promo_type
string
Enum: "Subscription" "FeePayment"

Filter by promo type

status
string
Enum: "active" "inactive" "deleted"

Filter by status

is_used
boolean

Filter by is used

merchant_id
string

Filter by merchant id

page
integer

The page number.

per_page
integer

The numbers of items to return.

Responses

Response samples

Content type
application/json
{
  • "ok": true,
  • "total": 25,
  • "page": 1,
  • "data": [
    ]
}

Get promo codes

path Parameters
id
required
string

Responses

Response samples

Content type
application/json
{
  • "ok": true,
  • "data": [
    ]
}

Generate a list of promo codes. Promo program will be created automatically if not exist.

Request Body schema: application/json
required
program_id
string
number_of_codes
integer
start_date
string
end_date
string
status
string
discount_value
number
discount_type
string
Enum: "percent" "fixed"
max_discount
number

Maximum discount amount

max_discount_type
string
Enum: "percent" "fixed"

Responses

Request samples

Content type
application/json
{
  • "program_id": "665e8f15ebf7d56c133612ab",
  • "number_of_codes": 10,
  • "start_date": "2021-07-01",
  • "end_date": "2021-07-31",
  • "status": "active",
  • "discount_value": 100,
  • "discount_type": "percent",
  • "max_discount": 50,
  • "max_discount_type": "fixed"
}

Response samples

Content type
application/json
{
  • "ok": true
}

Invalidate

Request Body schema: application/json
required
ids
Array of strings
promo_program_id
string

Responses

Request samples

Content type
application/json
{
  • "ids": [
    ],
  • "promo_program_id": "667fced180a245c95d401f4c"
}

Response samples

Content type
application/json
{
  • "ok": true,
  • "message": "Invalidated {number} promo codes"
}

Get promo code by code

Request Body schema: application/json
required
code
string

Responses

Request samples

Content type
application/json
{
  • "code": "PROMO52E"
}

Response samples

Content type
application/json
{
  • "ok": true,
  • "data": [
    ]
}

Extend Expiration.

Request Body schema: application/json
required
ids
Array of strings
promo_program_id
string
extend_to_date
string

date with format YYYY-MM-DD

Responses

Request samples

Content type
application/json
{
  • "ids": [
    ],
  • "promo_program_id": "667fced180a245c95d401f4c",
  • "extend_to_date": "2028-07-31"
}

Response samples

Content type
application/json
{
  • "ok": true,
  • "message": "Expiration dates updated successfully"
}

Calculate discount with promo code

path Parameters
id
required
string

Promo code ID

Request Body schema: application/json
required

Calculate discount request body

invoice_type
string

Type of invoice

amount
number

Amount for which discount is to be calculated

Responses

Request samples

Content type
application/json
{
  • "invoice_type": "Subscription",
  • "amount": 100
}

Response samples

Content type
application/json
{
  • "ok": true,
  • "data": {
    }
}

Redeem a promo code

path Parameters
id
required
string

Promo code ID

Responses

Response samples

Content type
application/json
{
  • "ok": true,
  • "msg": "Promo code redeemed successfully"
}

Mark used a promo code

path Parameters
id
required
string

Promo code ID

Request Body schema: application/json
required

Mark used request body

transaction_id
string

Transaction id

user_id
string

User id

Responses

Request samples

Content type
application/json
{
  • "transaction_id": "666b176eac77dae25d567ec2",
  • "user_id": "663a687cdd21174060cf185a"
}

Response samples

Content type
application/json
{
  • "ok": true,
  • "msg": "Used ${number} promo codes"
}

Promo Program

Get promo programs

query Parameters
keyword
string

Keyword for searching promo programs

code
string

Code of the promo program

merchant_id
string

Merchant ID associated with the promo program

promo_type
string

Type of promo program

status
string

Status of the promo program

used_codes
integer

Number of used codes

start_date
string <date-time>

Start date of the promo program

end_date
string <date-time>

End date of the promo program

per_page
integer >= 1

Number of results per page

page
integer >= 1

Page number

Responses

Response samples

Content type
application/json
{
  • "ok": true,
  • "data": [
    ],
  • "total": 0,
  • "page": 0,
  • "per_page": 0
}

Create a new promo program

Request Body schema: application/json
required
_id
string
code
string
merchant_id
string
name
string
description
string
promo_type
string
Enum: "Subscription" "FeePayment"
discount_value
number
discount_type
string
Enum: "percent" "fixed"
max_discount
number

Maximum discount amount

max_discount_type
string
Enum: "percent" "fixed"
start_date
string
end_date
string
status
string
created_at
string
updated_at
string
number_of_codes
integer
used_codes
integer

Responses

Request samples

Content type
application/json
{
  • "_id": "665e8f15ebf7d56c133612ab",
  • "code": "PROMO52E",
  • "merchant_id": "665e8f15ebf7d56c133612ab",
  • "name": "Free 1 month",
  • "description": "This program is for new user only",
  • "promo_type": "Subscription",
  • "discount_value": 100,
  • "discount_type": "percent",
  • "max_discount": 50,
  • "max_discount_type": "fixed",
  • "start_date": "2021-07-01",
  • "end_date": "2021-07-31",
  • "status": "active",
  • "created_at": "2021-07-01T00:00:00.000Z",
  • "updated_at": "2021-07-01T00:00:00.000Z",
  • "number_of_codes": 10,
  • "used_codes": 0
}

Response samples

Content type
application/json
{
  • "ok": true,
  • "promoprograms": {
    }
}

Get a promo program by ID

path Parameters
promo_program_id
required
string

The ID of the promo program to retrieve

Responses

Response samples

Content type
application/json
{
  • "ok": true,
  • "msg": "string",
  • "data": {
    }
}

Update a promo program by ID

path Parameters
promo_program_id
required
string

The ID of the promo program to update

Request Body schema: application/json
required
_id
string
code
string
merchant_id
string
name
string
description
string
promo_type
string
Enum: "Subscription" "FeePayment"
discount_value
number
discount_type
string
Enum: "percent" "fixed"
max_discount
number

Maximum discount amount

max_discount_type
string
Enum: "percent" "fixed"
start_date
string
end_date
string
status
string
created_at
string
updated_at
string
number_of_codes
integer
used_codes
integer

Responses

Request samples

Content type
application/json
{
  • "_id": "665e8f15ebf7d56c133612ab",
  • "code": "PROMO52E",
  • "merchant_id": "665e8f15ebf7d56c133612ab",
  • "name": "Free 1 month",
  • "description": "This program is for new user only",
  • "promo_type": "Subscription",
  • "discount_value": 100,
  • "discount_type": "percent",
  • "max_discount": 50,
  • "max_discount_type": "fixed",
  • "start_date": "2021-07-01",
  • "end_date": "2021-07-31",
  • "status": "active",
  • "created_at": "2021-07-01T00:00:00.000Z",
  • "updated_at": "2021-07-01T00:00:00.000Z",
  • "number_of_codes": 10,
  • "used_codes": 0
}

Response samples

Content type
application/json
{
  • "ok": true,
  • "msg": "string"
}

Delete a promo program by ID

path Parameters
promo_program_id
required
string

The ID of the promo program to delete

Responses

Response samples

Content type
application/json
{
  • "ok": true,
  • "msg": "string"
}