Skip to content

Commit 93bc180

Browse files
caseylockerclaude
andcommitted
fix(promo-codes): address CodeRabbit findings on saga reorder
- Critical: ReserveOrderTask::run now returns the accumulated formerState instead of a fresh ['order' => ...] array. After the reorder, ApplyPromoCodeTask runs downstream and reads promo_codes_usage / reservations / ticket_types_ids that earlier tasks populated; dropping state broke promo redemption and per-account enforcement for every promo-code checkout. - Minor: discover() OpenAPI security annotation now declares both ReadSummitData and ReadAllSummitData to match the seeded scopes. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent d824974 commit 93bc180

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitPromoCodesApiController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1588,7 +1588,7 @@ public function sendSponsorPromoCodes($summit_id)
15881588
description: "Returns domain-authorized promo codes (matched by email domain) and existing email-linked promo codes (member/speaker, matched by associated email) for the current user",
15891589
operationId: "discoverPromoCodesBySummit",
15901590
tags: ["Promo Codes"],
1591-
security: [['summit_promo_codes_oauth2' => [SummitScopes::ReadSummitData]]],
1591+
security: [['summit_promo_codes_oauth2' => [SummitScopes::ReadSummitData, SummitScopes::ReadAllSummitData]]],
15921592
parameters: [
15931593
new OA\Parameter(name: "id", in: "path", required: true, schema: new OA\Schema(type: "integer")),
15941594
new OA\Parameter(name: "expand", in: "query", required: false, schema: new OA\Schema(type: "string")),

app/Services/Model/Imp/SummitOrderService.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -664,7 +664,10 @@ public function run(array $formerState): array
664664
$invitation->addOrder($order);
665665
}
666666
$this->formerState['order'] = $order;
667-
return ['order' => $order];
667+
// Preserve accumulated state (promo_codes_usage, reservations, etc.) so
668+
// ApplyPromoCodeTask — which now runs after ReserveOrderTask — can read
669+
// the state populated by PreProcessReservationTask.
670+
return $this->formerState;
668671
});
669672
}
670673

0 commit comments

Comments
 (0)