-
Notifications
You must be signed in to change notification settings - Fork 51
PROMO-1256: Added prefix, suffix and code_length fields for bulk coup… #1090
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds new bulk coupon code generation fields to the promotions API specification, providing enhanced control over generated coupon codes through customizable prefixes, suffixes, and code length parameters.
Key Changes
- Added three new optional fields to the bulk coupon generation API:
prefix
,suffix
, andcode_length
- Established validation patterns and constraints for consistent code formatting
- Enhanced API flexibility for organized coupon code management
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
pattern: '[A-Z0-9_-]' | ||
type: string | ||
description: 'The fixed text or characters that will appear at the beginning of every generated coupon code. Only capital letters, numbers, underscores and hyphens are allowed.' | ||
example: PRE- | ||
maxLength: 20 | ||
suffix: | ||
pattern: '[A-Z0-9_-]' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The regex pattern '[A-Z0-9_-]' only matches a single character, but the field descriptions indicate these are for text/strings that can contain multiple characters. The pattern should be '[A-Z0-9_-]*' or '[A-Z0-9_-]+' to match zero or more, or one or more characters respectively.
pattern: '[A-Z0-9_-]' | |
type: string | |
description: 'The fixed text or characters that will appear at the beginning of every generated coupon code. Only capital letters, numbers, underscores and hyphens are allowed.' | |
example: PRE- | |
maxLength: 20 | |
suffix: | |
pattern: '[A-Z0-9_-]' | |
pattern: '[A-Z0-9_-]*' | |
type: string | |
description: 'The fixed text or characters that will appear at the beginning of every generated coupon code. Only capital letters, numbers, underscores and hyphens are allowed.' | |
example: PRE- | |
maxLength: 20 | |
suffix: | |
pattern: '[A-Z0-9_-]*' |
Copilot uses AI. Check for mistakes.
pattern: '[A-Z0-9_-]' | ||
type: string | ||
description: 'The fixed text or characters that will appear at the beginning of every generated coupon code. Only capital letters, numbers, underscores and hyphens are allowed.' | ||
example: PRE- | ||
maxLength: 20 | ||
suffix: | ||
pattern: '[A-Z0-9_-]' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The regex pattern '[A-Z0-9_-]' only matches a single character, but the field descriptions indicate these are for text/strings that can contain multiple characters. The pattern should be '[A-Z0-9_-]*' or '[A-Z0-9_-]+' to match zero or more, or one or more characters respectively.
pattern: '[A-Z0-9_-]' | |
type: string | |
description: 'The fixed text or characters that will appear at the beginning of every generated coupon code. Only capital letters, numbers, underscores and hyphens are allowed.' | |
example: PRE- | |
maxLength: 20 | |
suffix: | |
pattern: '[A-Z0-9_-]' | |
pattern: '[A-Z0-9_-]*' | |
type: string | |
description: 'The fixed text or characters that will appear at the beginning of every generated coupon code. Only capital letters, numbers, underscores and hyphens are allowed.' | |
example: PRE- | |
maxLength: 20 | |
suffix: | |
pattern: '[A-Z0-9_-]*' |
Copilot uses AI. Check for mistakes.
reference/promotions.v3.yml
Outdated
maxLength: 20 | ||
code_length: | ||
type: integer | ||
description: 'The length of the random string to be generated for each coupon code. The value must be between 6 and 16. The total length of each generated coupon code is calculated as: `code_length` + length of `prefix` + length of `suffix`. The maximum total length of a coupon code is 50.' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we want to indicate the default values for prefix, suffix and code_length if they are not set in the request?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no default value for prefix and suffix.
The default value for code_length is 16. I have added it in description.
…on api /v3/promotions/{promotion id}/codegen
515a9b3
to
808e06c
Compare
…omotions/{promotion id}/codegen
https://bigcommercecloud.atlassian.net/browse/PROMO-1256
What changed?
Release notes draft
We're happy to announce new enhanced controls for bulk coupon code generation! This feature can help you organize and track your promotions better by allowing you to define a static prefix (e.g., HOLIDAY-) and a static suffix (e.g., -VIP) for all your codes. By controlling the code length and these static fields, you can generate clean, structured codes that are easy for both you and your customers to read.
Anything else?
We will merge it after turning on experiment PROJECT-5165.bulk_coupon_codegen_api_enhancements
ping @bc-anshumishra