Skip to content

PROMO-933 add bulk coupon code generation #970

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

Conversation

YevenLourance
Copy link

@YevenLourance YevenLourance commented Jun 4, 2025

add bulk coupon code generation

PROMO-933

What changed?

  • Add new bulk coupon code generation API

Release notes draft

in progress

Anything else?

in progress

ping {names}

@YevenLourance YevenLourance marked this pull request as draft June 4, 2025 23:31
@YevenLourance YevenLourance force-pushed the PROMO-933 branch 5 times, most recently from b2368fc to 281881b Compare June 5, 2025 04:14
- batch_size
type: object
properties:
prefix:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets add a minLength, maxLength and pattern to this property.

type: string
description: A prefix to add to the generated codes.
example: 'PROMO'
suffix:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here. A minLength, maxLength and pattern could be helpful here

Comment on lines 231 to 249
batch_size:
type: integer
description: The number of coupon codes to generate in each batch. The maximum value is 250.
example: 5
max_uses:
type: integer
description: The maximum number of times each coupon code can be used. The default value is 0, which represents unlimited uses.
example: 10
max_uses_per_customer:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can define a minimum and maximum for these values

example: 5
max_uses:
type: integer
description: The maximum number of times each coupon code can be used. The default value is 0, which represents unlimited uses.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Considering the use case for batch creation of codes would a default of 1 make more sense?

Generate a batch of coupon codes for a particular bulk coupon promotion.

**Note:**
* batch_size is limited to 250 codes per request for first version. If batch_size is not an integer or larger than 250, it will return a 400 error code.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we prefer 422 over 400: https://stackoverflow.com/a/20215807

Suggested change
* batch_size is limited to 250 codes per request for first version. If batch_size is not an integer or larger than 250, it will return a 400 error code.
* batch_size is limited to 250 codes per request for first version. If batch_size is not an integer or larger than 250, it will return a 422 error code.


**Note:**
* batch_size is limited to 250 codes per request for first version. If batch_size is not an integer or larger than 250, it will return a 400 error code.
* The default rate limit for this endpoint is 40 concurrent requests.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we start with small number first ?

Suggested change
* The default rate limit for this endpoint is 40 concurrent requests.
* The default rate limit for this endpoint is 10 concurrent requests.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe lets just not expose what our concurrent limits are? Since these are dynamic, probably not very useful to add a hard number in the docs

maximum: 250
max_uses:
type: integer
description: The maximum number of times each coupon code can be used. The default value is 1.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we default it to "0" which is unlimited usage, similar to

description: The maximum number of times you can use this coupon code. The default value is 0, which represents unlimited uses. The parent promotion's `max_uses` field overrides the coupon code's `max_uses` field.
?

'200':
$ref: '#/components/responses/BulkCouponCodesResponse'
'400':
description: The request payload was invalid.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
description: The request payload was invalid.
description: invalid request

Comment on lines +1263 to +1269
code:
type: string
pattern: '[a-zA-Z0-9_\ -]'
description: A unique code that can be used to manually apply a discount. Only letters, numbers, white spaces, underscores and hyphens are allowed.
example: TEST-COUPON-CODE
maxLength: 50
minLength: 12
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not in scope of this PR: probably we can define a type for this and reuse it in many places

prefix:
type: string
description: A prefix to add to the generated codes.
example: 'PROMO'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe better communicate that we will not add anything to the prefix

Suggested change
example: 'PROMO'
example: 'PROMO_'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants