Spaces:
Running on CPU Upgrade
Running on CPU Upgrade
/recommend: carry the trip scope
Browse files- app/main.py +13 -1
app/main.py
CHANGED
|
@@ -127,6 +127,14 @@ class RecommendRequest(BaseModel):
|
|
| 127 |
# recommending a card whose income cutoff the user cannot meet is a promise
|
| 128 |
# they cannot claim. Held cards are never filtered: they already have them.
|
| 129 |
income_band: Optional[str] = None
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 130 |
|
| 131 |
|
| 132 |
class AnalyzeRequest(BaseModel):
|
|
@@ -386,7 +394,11 @@ def recommend(req: RecommendRequest, request: Request = None):
|
|
| 386 |
rail = req.rail or "card"
|
| 387 |
|
| 388 |
ctx = TxnContext(category=category, amount=float(amount), merchant=merchant,
|
| 389 |
-
brand_key=brand_key, offers=offers, rail=rail
|
|
|
|
|
|
|
|
|
|
|
|
|
| 390 |
result = score_transaction(held, ctx, include_discovery=True, persona=persona)
|
| 391 |
# Income gate on the DISCOVERY suggestion only (mirror of the app's
|
| 392 |
# discover screen): a "get this card" nudge whose income cutoff the user
|
|
|
|
| 127 |
# recommending a card whose income cutoff the user cannot meet is a promise
|
| 128 |
# they cannot claim. Held cards are never filtered: they already have them.
|
| 129 |
income_band: Optional[str] = None
|
| 130 |
+
# TRIP SCOPE for travel categories. Without these the offer gate in
|
| 131 |
+
# score_transaction has nothing to act on, so this endpoint kept pricing
|
| 132 |
+
# Yatra's 3-passenger ROUND-TRIP slab onto a 1-passenger one-way fare
|
| 133 |
+
# (₹3,000 where the truth is ₹799) even after the engine learned the rule.
|
| 134 |
+
# None means "unknown, do not filter" - a non-travel ask is unaffected.
|
| 135 |
+
passengers: Optional[int] = None
|
| 136 |
+
round_trip: Optional[bool] = None
|
| 137 |
+
international: Optional[bool] = None
|
| 138 |
|
| 139 |
|
| 140 |
class AnalyzeRequest(BaseModel):
|
|
|
|
| 394 |
rail = req.rail or "card"
|
| 395 |
|
| 396 |
ctx = TxnContext(category=category, amount=float(amount), merchant=merchant,
|
| 397 |
+
brand_key=brand_key, offers=offers, rail=rail,
|
| 398 |
+
# Carried so the offer gate can apply; see RecommendRequest.
|
| 399 |
+
international=req.international,
|
| 400 |
+
passengers=req.passengers,
|
| 401 |
+
round_trip=req.round_trip)
|
| 402 |
result = score_transaction(held, ctx, include_discovery=True, persona=persona)
|
| 403 |
# Income gate on the DISCOVERY suggestion only (mirror of the app's
|
| 404 |
# discover screen): a "get this card" nudge whose income cutoff the user
|