-
Notifications
You must be signed in to change notification settings - Fork 86
[Discounts] Described Discounts API #2783
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
Conversation
Preview of modified filesPreview of modified Markdown: |
new IsInRegions(['germany', 'france']), | ||
new IsProductInArray(['product-1', 'product-2']), | ||
new IsInCurrency('EUR'), | ||
new IsValidDiscountCode($discountCode->getCode(), $discountCode->getUsedLimit()), |
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 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.
Maybe @Steveb-p can clarify, but to me it's the max usage.
$discountCode = $this->discountCodeService->createDiscountCode($discountCodeCreateStruct); | ||
|
||
$discountCreateStruct = new DiscountCreateStruct(); | ||
$discountCreateStruct->setIdentifier('discount_identifier') |
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.
I've chosen the fluent API usage over the constructor, as this is self-documenting for the code sample - I'd just use the constructor in "standard" code.
I hope it will be clear for the readers that they can just use the constructor.
docs/discounts/discounts_api.md
Outdated
## Search | ||
|
||
You can search for Discounts using the [`DiscountServiceInterface::findDiscounts()](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Discounts-DiscountServiceInterface.html#method_findDiscounts) method. | ||
To learn more about the available search options, see Discounts' Search Criteria and Sort Clauses. |
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
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.
Very solid overall 💪 A few remarks from my end:
new IsInRegions(['germany', 'france']), | ||
new IsProductInArray(['product-1', 'product-2']), | ||
new IsInCurrency('EUR'), | ||
new IsValidDiscountCode($discountCode->getCode(), $discountCode->getUsedLimit()), |
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.
Maybe @Steveb-p can clarify, but to me it's the max usage.
@konradoboza thank you for your suggestions, I've applied them in e141ad2 Please note that I've added a small note on Discount Statuses. |
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.
I'm lost with expression values and condition Identifiers in REST. Maybe it's only for migration, not REST?
Co-authored-by: Adrien Dupuis <61695653+adriendupuis@users.noreply.github.com>
code_samples/ change report
|
This PR describes how you can use the Discounts PHP API and the core concepts needed to work with it.
Previews: