Skip to content

fix(dashboard): Google Play product-sync — region-dedupe, legal IDs, IDR zero-decimal + real error surfacing - #125

Merged
mobilebytesenseicommunity merged 2 commits into
MobileByteLabs:developmentfrom
therajanmaurya:development
Jul 25, 2026
Merged

fix(dashboard): Google Play product-sync — region-dedupe, legal IDs, IDR zero-decimal + real error surfacing#125
mobilebytesenseicommunity merged 2 commits into
MobileByteLabs:developmentfrom
therajanmaurya:development

Conversation

@therajanmaurya

@therajanmaurya therajanmaurya commented Jul 25, 2026

Copy link
Copy Markdown
Collaborator

Google Play product-sync hardening + deploy-pipeline fixes

Found while live-syncing the Reels Downloader tenant's subscriptions to Google Play. The store-sync UI was live but the Play sync failed on three successive real Play API errors — all fixed here, each with the underlying error now surfaced to the dashboard instead of swallowed.

Sync bug fixes (dashboard/lib/googleplay-product-sync.ts)

  1. Region dedupe — collapse prices that map to the same Play region (first wins). Fixes 400 "Region code DE is duplicated" (duplicate euro-zone rows all → DE).
  2. Hyphen-free subscription IDs — Play subscription product ids disallow -; pro-monthlypro_monthly. Fixes 400 "Subscription ID is malformed". (Base-plan ids keep hyphens.)
  3. IDR/COP zero-decimal — reuse the SAME ZERO_DECIMAL_CURRENCIES set that pricing-template.ts stores prices with (was a divergent Stripe-style copy omitting IDR/COP), so whole-unit currencies aren't wrongly ÷100. Fixes 400 "Price ... below IDR minimum" (Rp 89,892 was sent as IDR 898.92).

Error surfacing (stripe-route-helper.ts + both sync routes)

Store-sync wrappers now return the real Play / App Store API error to the caller; the dashboard shows it in the banner instead of an unactionable "check server logs".

Tests

New __tests__/lib/googleplay-product-sync.test.ts (4 cases: region-dedupe, hyphen sanitize, IDR zero-decimal, unmapped-currency skip).

Deploy pipeline

  • deploy-cloud.yml — the dashboard is a standalone Next.js app, not a pnpm workspace; removed the bogus root pnpm install --frozen-lockfile / --filter steps (the pnpm-lock.yaml not found failure) and deploy from repo root so Vercel builds it remotely.
  • .vercelignore — scope CLI uploads to dashboard/ only (repo root exceeded Vercel's 100 MB limit).

Verified end-to-end: queried Play's API directly — all 4 subscriptions now exist on Play with correct regional pricing (in DRAFT, pending an app APK upload on the Play side).

Summary by CodeRabbit

  • Bug Fixes

    • Improved Google Play product synchronization by preventing duplicate regional pricing configurations.
    • Sanitized subscription identifiers to meet Google Play formatting requirements.
    • Corrected whole-unit handling for supported currencies.
    • Added more reliable base-plan activation handling, including clear warnings when activation remains incomplete.
    • Improved App Store and Google Play sync error reporting for missing credentials or configuration.
  • Deployment

    • Updated dashboard deployment configuration to deploy the correct project content through Vercel.

…p/api/products/[id]/sync/route.ts dashboard/app/api/products/sync-to-providers/route.ts
@vercel

vercel Bot commented Jul 25, 2026

Copy link
Copy Markdown

@therajanmaurya is attempting to deploy a commit to the MobileByteLabs' projects Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented Jul 25, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: d9aa7ad5-1192-4ec5-91d1-6a4197003e46

📥 Commits

Reviewing files that changed from the base of the PR and between e7438ae and 59a92f0.

⛔ Files ignored due to path filters (1)
  • supabase/.temp/cli-latest is excluded by !**/.temp/**
📒 Files selected for processing (7)
  • .github/workflows/deploy-cloud.yml
  • .vercelignore
  • dashboard/__tests__/lib/googleplay-product-sync.test.ts
  • dashboard/app/api/products/[id]/sync/route.ts
  • dashboard/app/api/products/sync-to-providers/route.ts
  • dashboard/lib/googleplay-product-sync.ts
  • dashboard/lib/stripe-route-helper.ts

📝 Walkthrough

Walkthrough

Changes

Provider synchronization

Layer / File(s) Summary
Google Play sync behavior
dashboard/lib/googleplay-product-sync.ts
Google Play synchronization deduplicates regional pricing, sanitizes product IDs, handles zero-decimal currencies, and activates base plans while returning activation status.
Structured provider results
dashboard/lib/stripe-route-helper.ts, dashboard/app/api/products/[id]/sync/route.ts, dashboard/app/api/products/sync-to-providers/route.ts
Google Play and App Store helpers return structured errors and warnings, which API routes include in synchronization reports.
Google Play regression coverage
dashboard/__tests__/lib/googleplay-product-sync.test.ts
Tests cover regional pricing, identifiers, currency scaling, activation success, and non-fatal activation failure.

Cloud deployment configuration

Layer / File(s) Summary
Vercel dashboard deployment
.github/workflows/deploy-cloud.yml, .vercelignore
Vercel builds from the repository root and uploads only the dashboard application while excluding dependencies and build output.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant SyncRoute
  participant googlePlaySyncProduct
  participant GooglePlayAPI
  participant SyncReport
  SyncRoute->>googlePlaySyncProduct: sync product
  googlePlaySyncProduct->>GooglePlayAPI: create or retrieve subscription
  googlePlaySyncProduct->>GooglePlayAPI: activate base plan
  GooglePlayAPI-->>googlePlaySyncProduct: activation result
  googlePlaySyncProduct-->>SyncRoute: return sync status
  SyncRoute->>SyncReport: record warning or error
Loading
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

….test.ts dashboard/app/api/products/[id]/sync/route.ts dashboard/app/api/products/sync-to-providers/route.ts
@mobilebytesenseicommunity
mobilebytesenseicommunity marked this pull request as ready for review July 25, 2026 09:03
@mobilebytesenseicommunity
mobilebytesenseicommunity merged commit 590170f into MobileByteLabs:development Jul 25, 2026
7 of 9 checks passed
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.

2 participants