Skip to content

fix(offers): show each offer price's territory and price point - #24

Merged
hanrw merged 1 commit into
mainfrom
fix/offer-price-territory
Sep 23, 2026
Merged

hanrw merged 1 commit into
mainfrom
fix/offer-price-territory

Conversation

@hanrw

@hanrw hanrw commented Sep 23, 2026 •

Copy link
Copy Markdown
Member

Stacked on #23. It touches the same four listPrices functions, so merge #23 first. GitHub then retargets this PR to main.

Problem

iap-offer-codes, subscription-offer-codes, subscription-promotional-offers and win-back-offers prices list returned entries with only id and the offer ID. territory and the price-point ID were empty, so you couldn't tell which territory each price was for. The mappers read both from relationship data, and Apple only sends that data when the request asks for it with include=. The unit-test fixtures included the data anyway, so tests passed while the live API returned empty fields.

Fix

Each request now passes include: [.territory, .<pricePoint>].

Tests

  • One new test per adapter checks that the request asks Apple for include=territory,<pricePoint>. All four failed before the fix.
  • Full swift test passes.

Live check

  • Created a temporary promotional offer priced in 175 territories, then deleted it.
  • CLI and GET /api/v1/subscription-promotional-offers/:id/prices both returned 175 entries.
  • Every entry had its territory, and every price point matched the one we set.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Offer price list commands now include each price’s territory and price-point ID, providing more complete price details.

The four offer price lists (IAP offer codes, subscription offer codes,
promotional offers, win-back offers) returned entries with territory and
price point empty. The mappers read them from relationship data, which
Apple only sends when the request asks for it with include=. The requests
now include territory and the price point.

Verified live: a promotional offer priced in 175 territories lists all 175
with territory and the exact price point set, over CLI and REST.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@hanrw
hanrw deleted the branch main September 23, 2026 04:00
@hanrw hanrw closed this Sep 23, 2026
@hanrw hanrw reopened this Sep 23, 2026
@hanrw
hanrw changed the base branch from fix/per-territory-price-pagination to main September 23, 2026 04:01
@coderabbitai

coderabbitai Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 2af310f5-cd45-4671-ba0c-b5c19acc90df

📥 Commits

Reviewing files that changed from the base of the PR and between 32c0a29 and c4df682.

📒 Files selected for processing (9)
  • CHANGELOG.md
  • Sources/Infrastructure/Apps/InAppPurchases/OfferCodes/SDKInAppPurchaseOfferCodeRepository.swift
  • Sources/Infrastructure/Apps/Subscriptions/OfferCodes/SDKSubscriptionOfferCodeRepository.swift
  • Sources/Infrastructure/Apps/Subscriptions/PromotionalOffers/SDKSubscriptionPromotionalOfferRepository.swift
  • Sources/Infrastructure/Apps/Subscriptions/WinBackOffers/SDKWinBackOfferRepository.swift
  • Tests/InfrastructureTests/Apps/InAppPurchases/OfferCodes/SDKInAppPurchaseOfferCodeRepositoryTests.swift
  • Tests/InfrastructureTests/Apps/Subscriptions/OfferCodes/SDKSubscriptionOfferCodeRepositoryTests.swift
  • Tests/InfrastructureTests/Apps/Subscriptions/SDKSubscriptionPromotionalOfferRepositoryTests.swift
  • Tests/InfrastructureTests/Apps/Subscriptions/SDKWinBackOfferRepositoryTests.swift

Included review availability: Your plan provides up to 2 included reviews per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

Offer price list requests now include territory and price-point relationships for in-app purchase offer codes, subscription offer codes, promotional offers, and win-back offers. Tests verify the include parameters, and the changelog records the update.

Changes

Offer price relationship includes

Layer / File(s) Summary
Include relationships in offer price requests
Sources/Infrastructure/Apps/InAppPurchases/OfferCodes/SDKInAppPurchaseOfferCodeRepository.swift, Sources/Infrastructure/Apps/Subscriptions/OfferCodes/SDKSubscriptionOfferCodeRepository.swift, Sources/Infrastructure/Apps/Subscriptions/PromotionalOffers/SDKSubscriptionPromotionalOfferRepository.swift, Sources/Infrastructure/Apps/Subscriptions/WinBackOffers/SDKWinBackOfferRepository.swift, Tests/InfrastructureTests/Apps/InAppPurchases/OfferCodes/SDKInAppPurchaseOfferCodeRepositoryTests.swift, Tests/InfrastructureTests/Apps/Subscriptions/OfferCodes/SDKSubscriptionOfferCodeRepositoryTests.swift, Tests/InfrastructureTests/Apps/Subscriptions/SDKSubscriptionPromotionalOfferRepositoryTests.swift, Tests/InfrastructureTests/Apps/Subscriptions/SDKWinBackOfferRepositoryTests.swift, CHANGELOG.md
The four repositories request territory and price-point relationships when listing prices. Tests assert the include query values, and the changelog describes the updated price entries.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Low

Merge Risk: ⚪ Minimal · up to c4df6

The offer price listings are ready to merge after normal checks; no unresolved issue is identified.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 6 functions across 8 files. (1 skipped: 1 … Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: offer price lists now include each price’s territory and price point.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 6 functions across 8 files. (1 skipped: 1 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@hanrw hanrw closed this Sep 23, 2026
@hanrw hanrw reopened this Sep 23, 2026
@hanrw
hanrw merged commit 6989f97 into main Sep 23, 2026
2 checks passed
@codecov

codecov Bot commented Sep 23, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.65%. Comparing base (7b7a61e) to head (c4df682).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main      #24   +/-   ##
=======================================
  Coverage   81.65%   81.65%           
=======================================
  Files         473      473           
  Lines       13834    13838    +4     
=======================================
+ Hits        11296    11300    +4     
  Misses       2538     2538           
Files with missing lines Coverage Δ
...ferCodes/SDKInAppPurchaseOfferCodeRepository.swift 100.00% <100.00%> (ø)
...fferCodes/SDKSubscriptionOfferCodeRepository.swift 100.00% <100.00%> (ø)
...rs/SDKSubscriptionPromotionalOfferRepository.swift 100.00% <100.00%> (ø)
...ions/WinBackOffers/SDKWinBackOfferRepository.swift 97.41% <100.00%> (+0.01%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@hanrw
hanrw deleted the fix/offer-price-territory branch September 23, 2026 04:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant