-
Notifications
You must be signed in to change notification settings - Fork 2
feat(promo-codes): domain-authorized promo codes for early registration access #525
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
Merged
Merged
Changes from all commits
Commits
Show all changes
36 commits
Select commit
Hold shift + click to select a range
24f1e3d
feat(promo-codes): implement domain-authorized promo codes for early …
caseylocker 05c889c
fix(promo-codes): address review follow-ups for Tasks 1–3
caseylocker a556412
docs(promo-codes): add Task 4 review follow-up note for no-op override
caseylocker fe32435
docs(promo-codes): add review follow-ups for Tasks 5 and 7
caseylocker 6a12e47
fix(promo-codes): address Task 6 review follow-ups
caseylocker 2967746
fix(promo-codes): address Task 7 review follow-ups
caseylocker 5dd1ad7
fix(promo-codes): address review follow-ups for Tasks 8 and 9
caseylocker 82a28c3
fix(promo-codes): address Task 10 review follow-ups — race-safe quant…
caseylocker a5809af
docs(promo-codes): add Task 11 review follow-up notes
caseylocker b38e434
fix(promo-codes): address Task 12 review follow-ups — tests for colli…
caseylocker a9ece25
fix(promo-codes): register discover endpoint in ApiEndpointsSeeder
caseylocker 138c1f8
fix(promo-codes): use rate.limit instead of auth.user on discover route
caseylocker b87cefd
fix(promo-codes): guard WithPromoCode reservations and exclude exhaus…
caseylocker ed2064d
test(promo-codes): add mixed-payload and infinite-code regression tests
caseylocker 19e5f53
fix(promo-codes): fix serializer tests and resolve D3 deviation
caseylocker ae261a7
fix(promo-codes): address CodeRabbit findings — CSV domain import and…
caseylocker c3f8df7
fix(promo-codes): harden CSV domain import and migration rollback safety
caseylocker c2719e1
docs(promo-codes): add D10/D11 deviations for CSV import and migratio…
caseylocker c4bcdef
fix(promo-codes): address smarcet review — saga compensation, discove…
caseylocker e2ca6b5
Merge remote-tracking branch 'origin/main' into pr-525
caseylocker d824974
test(saga): clear resolved facade instances in setUp for test isolation
caseylocker 93bc180
fix(promo-codes): address CodeRabbit findings on saga reorder
caseylocker 283f576
refactor(promo-codes): address romanetar's PR #525 review comments
caseylocker 1ac95a0
refactor(migrations): use Builder/Table API in Version20260401150000
caseylocker b9f2b2a
fix(rules): accept multi-level TLD suffixes in AllowedEmailDomainsArray
caseylocker f464339
feat(promo-codes): add SummitPromoCodeMemberReservation entity (data …
caseylocker 13e13a2
fix(promo-codes): harden reservation backfill per Codex review
caseylocker 8ad56fc
feat(promo-codes): atomic per-member reserve in PreProcessReservation…
caseylocker a0a9ba4
fix(promo-codes): prevent partial-reservation leak on mid-loop failure
caseylocker ff81217
chore(unit-test): add unit test to demo the toctou bug
smarcet b909683
feat(promo-codes): finish TOCTOU fix — remove post-facto check, add t…
caseylocker 310455a
fix(promo-codes): step-3 review follow-ups
caseylocker f12af1b
refactor(promo-codes): split discover query into targeted per-subtype…
caseylocker d2fbcb1
fix(promo-codes): address Codex review on discover query split
caseylocker 39e452f
fix(promo-codes): close reservation counter leak on cancel + fix undo…
caseylocker a1bd4ea
fix(tests): add missing reservation repo mock to SummitOrderServiceTest
caseylocker File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
...mmit/Registration/PromoCodes/DomainAuthorizedSummitRegistrationDiscountCodeSerializer.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| <?php namespace ModelSerializers; | ||
| /** | ||
| * Copyright 2026 OpenStack Foundation | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| **/ | ||
|
|
||
| use models\summit\DomainAuthorizedSummitRegistrationDiscountCode; | ||
|
|
||
| /** | ||
| * Class DomainAuthorizedSummitRegistrationDiscountCodeSerializer | ||
| * @package ModelSerializers | ||
| */ | ||
| class DomainAuthorizedSummitRegistrationDiscountCodeSerializer | ||
| extends SummitRegistrationDiscountCodeSerializer | ||
| { | ||
| protected static $array_mappings = [ | ||
| 'AllowedEmailDomains' => 'allowed_email_domains:json_string_array', | ||
| 'QuantityPerAccount' => 'quantity_per_account:json_int', | ||
| 'AutoApply' => 'auto_apply:json_boolean', | ||
| ]; | ||
|
|
||
| protected static $allowed_relations = [ | ||
| 'allowed_ticket_types', | ||
| ]; | ||
|
|
||
| /** | ||
| * @param null $expand | ||
| * @param array $fields | ||
| * @param array $relations | ||
| * @param array $params | ||
| * @return array | ||
| */ | ||
| public function serialize($expand = null, array $fields = [], array $relations = [], array $params = []) | ||
| { | ||
| $code = $this->object; | ||
| if (!$code instanceof DomainAuthorizedSummitRegistrationDiscountCode) return []; | ||
| $values = parent::serialize($expand, $fields, $relations, $params); | ||
|
|
||
| // See parent::restoreAllowedTicketTypes() docblock for why this call is needed. | ||
| $this->restoreAllowedTicketTypes($values, $expand, $relations); | ||
|
|
||
| // Transient remaining_quantity_per_account (set by service layer) | ||
| $values['remaining_quantity_per_account'] = $code->getRemainingQuantityPerAccount(); | ||
|
|
||
| return $values; | ||
| } | ||
|
|
||
| protected static $expand_mappings = [ | ||
| 'allowed_ticket_types' => [ | ||
| 'type' => \Libs\ModelSerializers\Many2OneExpandSerializer::class, | ||
| 'getter' => 'getAllowedTicketTypes', | ||
| ], | ||
| ]; | ||
| } |
48 changes: 48 additions & 0 deletions
48
.../Summit/Registration/PromoCodes/DomainAuthorizedSummitRegistrationPromoCodeSerializer.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| <?php namespace ModelSerializers; | ||
| /** | ||
| * Copyright 2026 OpenStack Foundation | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| **/ | ||
|
|
||
| use models\summit\DomainAuthorizedSummitRegistrationPromoCode; | ||
|
|
||
| /** | ||
| * Class DomainAuthorizedSummitRegistrationPromoCodeSerializer | ||
| * @package ModelSerializers | ||
| */ | ||
| class DomainAuthorizedSummitRegistrationPromoCodeSerializer | ||
| extends SummitRegistrationPromoCodeSerializer | ||
| { | ||
| protected static $array_mappings = [ | ||
| 'AllowedEmailDomains' => 'allowed_email_domains:json_string_array', | ||
| 'QuantityPerAccount' => 'quantity_per_account:json_int', | ||
| 'AutoApply' => 'auto_apply:json_boolean', | ||
| ]; | ||
|
|
||
| /** | ||
| * @param null $expand | ||
| * @param array $fields | ||
| * @param array $relations | ||
| * @param array $params | ||
| * @return array | ||
| */ | ||
| public function serialize($expand = null, array $fields = [], array $relations = [], array $params = []) | ||
| { | ||
| $code = $this->object; | ||
| if (!$code instanceof DomainAuthorizedSummitRegistrationPromoCode) return []; | ||
| $values = parent::serialize($expand, $fields, $relations, $params); | ||
|
|
||
| // Transient remaining_quantity_per_account (set by service layer) | ||
| $values['remaining_quantity_per_account'] = $code->getRemainingQuantityPerAccount(); | ||
|
|
||
| return $values; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.