Skip to content

Comments

fix: phone number cancel billing#23854

Merged
Udit-takkar merged 11 commits intomainfrom
fix/double-cancel
Sep 16, 2025
Merged

fix: phone number cancel billing#23854
Udit-takkar merged 11 commits intomainfrom
fix/double-cancel

Conversation

@Udit-takkar
Copy link
Contributor

@Udit-takkar Udit-takkar commented Sep 15, 2025

What does this PR do?

Screenshot 2025-09-16 at 1 10 39 PM

Mandatory Tasks (DO NOT REMOVE)

  • I have self-reviewed the code (A decent size PR without self-review might be rejected).
  • N/A I have updated the developer docs in /docs if this PR makes changes that would require a documentation change. If N/A, write N/A here and check the checkbox.
  • I confirm automated tests are in place that prove my fix is effective or that my feature works.

How should this be tested?

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 15, 2025

Walkthrough

  • Replaces stripeResourceMissingErrorSchema with stripeErrorSchema that expects only a nested raw.code (no top-level type, code, message, param, doc_url, or request_log_url fields).
  • In cancelPhoneNumberSubscription adds an optimistic pre-cancellation DB update setting subscriptionStatus = CANCELLED with disconnectOutboundAgent = false before calling Stripe.
  • On Stripe error parsed as resource_missing (parsedError.success && parsedError.data.raw.code === "resource_missing"), logs a fixed message ("Subscription resource not found") and proceeds to finalization without throwing.
  • On non-resource_missing Stripe errors, reverts the status to ACTIVE and rethrows the error.
  • After the Stripe call (regardless of outcome), performs a final update setting subscriptionStatus = CANCELLED with disconnectOutboundAgent = true.
  • Tests updated to expect two sequential updateSubscriptionStatus calls (first with disconnectOutboundAgent: false, then with disconnectOutboundAgent: true), and to use the new Stripe error object shape for resource_missing and other error scenarios.
  • Webhook handler handleCalAIPhoneNumberSubscriptionDeleted short-circuits when phoneNumber.subscriptionStatus === "CANCELLED", returning { success: true, subscriptionId, skipped: true } without invoking provider cancellation.

Possibly related PRs

  • fix: phone number billing bug #23851: Modifies BillingService.cancelPhoneNumberSubscription and Stripe resource_missing error handling; closely related to the optimistic pre-cancellation and error-shaping changes.

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Description Check ❓ Inconclusive The PR description contains a template, a screenshot, and a completed checklist but lacks a concrete summary of the code changes, motivation, and testing instructions, making it too vague to be fully informative for reviewers. Please expand the PR description with a short summary of the key code changes and their rationale, list the files or subsystems affected, explain how to test the change (including any automated test updates and expected outcomes), and link to any related issue or follow-up tasks so reviewers can validate the fix quickly.
✅ Passed checks (1 passed)
Check name Status Explanation
Title Check ✅ Passed The title "fix: phone number cancel billing" is concise and directly summarizes the primary change in this PR—fixes to the phone-number cancellation/billing flow as implemented in BillingService, the webhook handler, and accompanying tests—so it accurately represents the changeset.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/double-cancel

Tip

👮 Agentic pre-merge checks are now available in preview!

Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.

  • Built-in checks – Quickly apply ready-made checks to enforce title conventions, require pull request descriptions that follow templates, validate linked issues for compliance, and more.
  • Custom agentic checks – Define your own rules using CodeRabbit’s advanced agentic capabilities to enforce organization-specific policies and workflows. For example, you can instruct CodeRabbit’s agent to verify that API documentation is updated whenever API schema files are modified in a PR. Note: Upto 5 custom checks are currently allowed during the preview period. Pricing for this feature will be announced in a few weeks.

Please see the documentation for more information.

Example:

reviews:
  pre_merge_checks:
    custom_checks:
      - name: "Undocumented Breaking Changes"
        mode: "warning"
        instructions: |
          Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).

Please share your feedback with us on this Discord post.


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 and usage tips.

@github-actions
Copy link
Contributor

github-actions bot commented Sep 15, 2025

Hey there and thank you for opening this pull request! 👋🏼

We require pull request titles to follow the Conventional Commits specification and it looks like your proposed title needs to be adjusted.

Details:

No release type found in pull request title "Fix/double cancel". Add a prefix to indicate what kind of release this pull request corresponds to. For reference, see https://www.conventionalcommits.org/

Available types:
 - feat: A new feature
 - fix: A bug fix
 - docs: Documentation only changes
 - style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
 - refactor: A code change that neither fixes a bug nor adds a feature
 - perf: A code change that improves performance
 - test: Adding missing tests or correcting existing tests
 - build: Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)
 - ci: Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)
 - chore: Other changes that don't modify src or test files
 - revert: Reverts a previous commit

@keithwillcode keithwillcode added core area: core, team members only enterprise area: enterprise, audit log, organisation, SAML, SSO labels Sep 15, 2025
@vercel
Copy link

vercel bot commented Sep 15, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

2 Skipped Deployments
Project Deployment Preview Comments Updated (UTC)
cal Ignored Ignored Sep 16, 2025 9:27am
cal-eu Ignored Ignored Sep 16, 2025 9:27am

@Udit-takkar Udit-takkar changed the title Fix/double cancel fix: double cancel bug Sep 15, 2025
@Udit-takkar Udit-takkar changed the title fix: double cancel bug fix: phone number billing Sep 16, 2025
@pull-request-size pull-request-size bot added size/M and removed size/L labels Sep 16, 2025
@Udit-takkar Udit-takkar marked this pull request as ready for review September 16, 2025 07:40
@graphite-app graphite-app bot requested a review from a team September 16, 2025 07:40
@dosubot dosubot bot added billing area: billing, stripe, payments, paypal, get paid 🐛 bug Something isn't working labels Sep 16, 2025
@Udit-takkar Udit-takkar changed the title fix: phone number billing fix: phone number cancel billing Sep 16, 2025
@Udit-takkar Udit-takkar added the High priority Created by Linear-GitHub Sync label Sep 16, 2025
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (2)
packages/features/calAIPhone/providers/retellAI/services/BillingService.ts (2)

15-22: Update error schema to match actual Stripe error structure.

The current schema expects both a top-level code field and nested raw.code field, but based on the test file (lines 276-286), the actual Stripe error structure only has the nested raw.code field.

 const stripeErrorSchema = z.object({
   type: z.string(),
   raw: z.object({
     code: z.literal("resource_missing"),
     type: z.literal("invalid_request_error"),
   }),
-  code: z.literal("resource_missing"),
 });

168-173: Fix typo in comment.

There's a typo in the comment that should be corrected for clarity.

-      // Disconnnect agent after cancelling from stripe
+      // Disconnect agent after cancelling from stripe
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 7e415b4 and cc78d71.

📒 Files selected for processing (3)
  • packages/features/calAIPhone/providers/retellAI/services/BillingService.ts (2 hunks)
  • packages/features/calAIPhone/providers/retellAI/services/__tests__/BillingService.test.ts (4 hunks)
  • packages/features/ee/billing/api/webhook/_customer.subscription.deleted.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (4)
**/*.ts

📄 CodeRabbit inference engine (.cursor/rules/review.mdc)

**/*.ts: For Prisma queries, only select data you need; never use include, always use select
Ensure the credential.key field is never returned from tRPC endpoints or APIs

Files:

  • packages/features/calAIPhone/providers/retellAI/services/__tests__/BillingService.test.ts
  • packages/features/ee/billing/api/webhook/_customer.subscription.deleted.ts
  • packages/features/calAIPhone/providers/retellAI/services/BillingService.ts
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/review.mdc)

Flag excessive Day.js use in performance-critical code; prefer native Date or Day.js .utc() in hot paths like loops

Files:

  • packages/features/calAIPhone/providers/retellAI/services/__tests__/BillingService.test.ts
  • packages/features/ee/billing/api/webhook/_customer.subscription.deleted.ts
  • packages/features/calAIPhone/providers/retellAI/services/BillingService.ts
**/*.{ts,tsx,js,jsx}

⚙️ CodeRabbit configuration file

Flag default exports and encourage named exports. Named exports provide better tree-shaking, easier refactoring, and clearer imports. Exempt main components like pages, layouts, and components that serve as the primary export of a module.

Files:

  • packages/features/calAIPhone/providers/retellAI/services/__tests__/BillingService.test.ts
  • packages/features/ee/billing/api/webhook/_customer.subscription.deleted.ts
  • packages/features/calAIPhone/providers/retellAI/services/BillingService.ts
**/*Service.ts

📄 CodeRabbit inference engine (.cursor/rules/review.mdc)

Service files must include Service suffix, use PascalCase matching exported class, and avoid generic names (e.g., MembershipService.ts)

Files:

  • packages/features/calAIPhone/providers/retellAI/services/BillingService.ts
🧠 Learnings (3)
📓 Common learnings
Learnt from: Udit-takkar
PR: calcom/cal.com#22919
File: packages/features/calAIPhone/providers/retellAI/services/PhoneNumberService.ts:212-220
Timestamp: 2025-08-08T10:26:13.362Z
Learning: In calcom/cal.com PR #22919, packages/features/calAIPhone/providers/retellAI/services/PhoneNumberService.ts should include the phone number in client-facing HttpError messages (e.g., in updatePhoneNumber/getPhoneNumber catch blocks). Do not suggest redacting the phone number from these errors unless requirements change (per maintainer: Udit-takkar).
Learnt from: Udit-takkar
PR: calcom/cal.com#22995
File: packages/trpc/server/routers/viewer/phoneNumber/delete.handler.ts:13-24
Timestamp: 2025-08-21T16:34:10.839Z
Learning: In calcom/cal.com PR #22995, the deletePhoneNumber function in packages/trpc/server/routers/viewer/phoneNumber/delete.handler.ts is only used for imported phone numbers that don't have active Stripe subscriptions. Purchased phone numbers with subscriptions use a separate cancellation flow first (per maintainer Udit-takkar).
Learnt from: Udit-takkar
PR: calcom/cal.com#22919
File: packages/features/calAIPhone/interfaces/AIPhoneService.interface.ts:118-143
Timestamp: 2025-08-08T09:29:11.681Z
Learning: In calcom/cal.com PR #22919, packages/features/calAIPhone/interfaces/AIPhoneService.interface.ts (TypeScript), the AIPhoneServiceAgentListItem is required to include user.email in listAgents responses (per maintainer Udit-takkar). Future reviews should not flag this as unnecessary PII unless requirements change.
📚 Learning: 2025-08-08T10:26:13.362Z
Learnt from: Udit-takkar
PR: calcom/cal.com#22919
File: packages/features/calAIPhone/providers/retellAI/services/PhoneNumberService.ts:212-220
Timestamp: 2025-08-08T10:26:13.362Z
Learning: In calcom/cal.com PR #22919, packages/features/calAIPhone/providers/retellAI/services/PhoneNumberService.ts should include the phone number in client-facing HttpError messages (e.g., in updatePhoneNumber/getPhoneNumber catch blocks). Do not suggest redacting the phone number from these errors unless requirements change (per maintainer: Udit-takkar).

Applied to files:

  • packages/features/calAIPhone/providers/retellAI/services/__tests__/BillingService.test.ts
  • packages/features/ee/billing/api/webhook/_customer.subscription.deleted.ts
  • packages/features/calAIPhone/providers/retellAI/services/BillingService.ts
📚 Learning: 2025-08-21T16:34:10.839Z
Learnt from: Udit-takkar
PR: calcom/cal.com#22995
File: packages/trpc/server/routers/viewer/phoneNumber/delete.handler.ts:13-24
Timestamp: 2025-08-21T16:34:10.839Z
Learning: In calcom/cal.com PR #22995, the deletePhoneNumber function in packages/trpc/server/routers/viewer/phoneNumber/delete.handler.ts is only used for imported phone numbers that don't have active Stripe subscriptions. Purchased phone numbers with subscriptions use a separate cancellation flow first (per maintainer Udit-takkar).

Applied to files:

  • packages/features/calAIPhone/providers/retellAI/services/__tests__/BillingService.test.ts
  • packages/features/ee/billing/api/webhook/_customer.subscription.deleted.ts
  • packages/features/calAIPhone/providers/retellAI/services/BillingService.ts
🧬 Code graph analysis (1)
packages/features/calAIPhone/providers/retellAI/services/BillingService.ts (1)
packages/app-store/_utils/stripe.ts (1)
  • stripe (70-72)
⏰ Context from checks skipped due to timeout of 180000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Install dependencies / Yarn install & cache
  • GitHub Check: Codacy Static Code Analysis
🔇 Additional comments (7)
packages/features/ee/billing/api/webhook/_customer.subscription.deleted.ts (1)

75-78: LGTM! Good defensive check to prevent duplicate processing.

The early return when the subscription is already cancelled prevents unnecessary processing and potential side effects. The inclusion of the skipped: true flag provides clear indication that the webhook was intentionally bypassed.

packages/features/calAIPhone/providers/retellAI/services/BillingService.ts (2)

143-147: LGTM! Optimistic cancellation improves user experience.

The pre-cancellation update ensures the subscription appears cancelled immediately, providing better UX even if the Stripe API call takes time or fails in a recoverable way.


152-166: LGTM! Robust error handling with proper rollback.

The error handling correctly distinguishes between resource-missing errors (which are treated as already cancelled) and other errors (which trigger a rollback to ACTIVE status). The logging provides good visibility into the error handling flow.

packages/features/calAIPhone/providers/retellAI/services/__tests__/BillingService.test.ts (4)

165-176: LGTM! Tests correctly validate the two-phase cancellation flow.

The test expectations accurately reflect the new behavior where the subscription is first marked as cancelled with disconnectOutboundAgent: false, then updated again with disconnectOutboundAgent: true.


276-286: LGTM! Error structure matches expected Stripe API format.

The test error structure correctly represents the actual Stripe API error format for resource_missing errors, providing comprehensive coverage of the error handling path.


297-309: LGTM! Comprehensive validation of resource_missing error handling.

The test correctly validates that resource_missing errors are handled gracefully with two sequential database updates, ensuring the subscription ends up in the CANCELLED state with the agent disconnected.


329-339: LGTM! Proper validation of error rollback behavior.

The test correctly validates that non-resource_missing errors trigger a rollback to ACTIVE status after the initial optimistic cancellation, ensuring data consistency when Stripe operations fail.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (5)
packages/features/calAIPhone/providers/retellAI/services/BillingService.ts (5)

15-19: Broaden Stripe error parsing; current schema is too narrow.

Stripe errors may expose code at the top level or under raw.code. Restricting to raw.code can misclassify resource_missing.

Apply:

-const stripeErrorSchema = z.object({
-  raw: z.object({
-    code: z.string(),
-  }),
-});
+const stripeErrorSchema = z.object({
+  code: z.string().optional(),
+  raw: z
+    .object({
+      code: z.string().optional(),
+    })
+    .optional(),
+});

149-151: Use a unified error code extraction (top‑level or raw) and add idempotency.

Make detection resilient:

-        const parsedError = stripeErrorSchema.safeParse(error);
-        if (parsedError.success && parsedError.data.raw.code === "resource_missing") {
+        const parsedError = stripeErrorSchema.safeParse(error);
+        const errCode = parsedError.success
+          ? parsedError.data.code ?? parsedError.data.raw?.code
+          : undefined;
+        if (errCode === "resource_missing") {

Additionally, consider passing an idempotency key when canceling (outside this hunk):

await stripe.subscriptions.cancel(
  phoneNumber.stripeSubscriptionId,
  undefined,
  { idempotencyKey: `ph-sub-cancel:${phoneNumber.stripeSubscriptionId}` }
);

151-155: Log the actual Stripe error message for diagnosability.

Replace the fixed string with the message when available:

-            stripeMessage: "Subscription resource not found",
+            stripeMessage:
+              (error as any)?.raw?.message ?? (error as any)?.message ?? "Subscription resource not found",

157-160: Explicitly restore disconnect flag on revert.

If you retain the optimistic pre‑write, ensure the revert also restores disconnectOutboundAgent:

-          await this.phoneNumberRepository.updateSubscriptionStatus({
-            id: phoneNumberId,
-            subscriptionStatus: PhoneNumberSubscriptionStatus.ACTIVE,
-          });
+          await this.phoneNumberRepository.updateSubscriptionStatus({
+            id: phoneNumberId,
+            subscriptionStatus: PhoneNumberSubscriptionStatus.ACTIVE,
+            disconnectOutboundAgent: false,
+          });

Please confirm updateSubscriptionStatus performs partial updates; if it replaces the whole record, this becomes mandatory.


165-165: Fix typo in comment.

-      // Disconnnect agent after cancelling from stripe
+      // Disconnect agent after cancelling from Stripe
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between cc78d71 and bbe3949.

📒 Files selected for processing (2)
  • packages/features/calAIPhone/providers/retellAI/services/BillingService.ts (2 hunks)
  • packages/features/ee/billing/api/webhook/_customer.subscription.deleted.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/features/ee/billing/api/webhook/_customer.subscription.deleted.ts
🧰 Additional context used
📓 Path-based instructions (4)
**/*Service.ts

📄 CodeRabbit inference engine (.cursor/rules/review.mdc)

Service files must include Service suffix, use PascalCase matching exported class, and avoid generic names (e.g., MembershipService.ts)

Files:

  • packages/features/calAIPhone/providers/retellAI/services/BillingService.ts
**/*.ts

📄 CodeRabbit inference engine (.cursor/rules/review.mdc)

**/*.ts: For Prisma queries, only select data you need; never use include, always use select
Ensure the credential.key field is never returned from tRPC endpoints or APIs

Files:

  • packages/features/calAIPhone/providers/retellAI/services/BillingService.ts
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/review.mdc)

Flag excessive Day.js use in performance-critical code; prefer native Date or Day.js .utc() in hot paths like loops

Files:

  • packages/features/calAIPhone/providers/retellAI/services/BillingService.ts
**/*.{ts,tsx,js,jsx}

⚙️ CodeRabbit configuration file

Flag default exports and encourage named exports. Named exports provide better tree-shaking, easier refactoring, and clearer imports. Exempt main components like pages, layouts, and components that serve as the primary export of a module.

Files:

  • packages/features/calAIPhone/providers/retellAI/services/BillingService.ts
🧠 Learnings (3)
📓 Common learnings
Learnt from: Udit-takkar
PR: calcom/cal.com#22995
File: packages/trpc/server/routers/viewer/phoneNumber/delete.handler.ts:13-24
Timestamp: 2025-08-21T16:34:10.839Z
Learning: In calcom/cal.com PR #22995, the deletePhoneNumber function in packages/trpc/server/routers/viewer/phoneNumber/delete.handler.ts is only used for imported phone numbers that don't have active Stripe subscriptions. Purchased phone numbers with subscriptions use a separate cancellation flow first (per maintainer Udit-takkar).
Learnt from: Udit-takkar
PR: calcom/cal.com#22919
File: packages/features/calAIPhone/providers/retellAI/services/PhoneNumberService.ts:212-220
Timestamp: 2025-08-08T10:26:13.362Z
Learning: In calcom/cal.com PR #22919, packages/features/calAIPhone/providers/retellAI/services/PhoneNumberService.ts should include the phone number in client-facing HttpError messages (e.g., in updatePhoneNumber/getPhoneNumber catch blocks). Do not suggest redacting the phone number from these errors unless requirements change (per maintainer: Udit-takkar).
📚 Learning: 2025-08-08T10:26:13.362Z
Learnt from: Udit-takkar
PR: calcom/cal.com#22919
File: packages/features/calAIPhone/providers/retellAI/services/PhoneNumberService.ts:212-220
Timestamp: 2025-08-08T10:26:13.362Z
Learning: In calcom/cal.com PR #22919, packages/features/calAIPhone/providers/retellAI/services/PhoneNumberService.ts should include the phone number in client-facing HttpError messages (e.g., in updatePhoneNumber/getPhoneNumber catch blocks). Do not suggest redacting the phone number from these errors unless requirements change (per maintainer: Udit-takkar).

Applied to files:

  • packages/features/calAIPhone/providers/retellAI/services/BillingService.ts
📚 Learning: 2025-08-21T16:34:10.839Z
Learnt from: Udit-takkar
PR: calcom/cal.com#22995
File: packages/trpc/server/routers/viewer/phoneNumber/delete.handler.ts:13-24
Timestamp: 2025-08-21T16:34:10.839Z
Learning: In calcom/cal.com PR #22995, the deletePhoneNumber function in packages/trpc/server/routers/viewer/phoneNumber/delete.handler.ts is only used for imported phone numbers that don't have active Stripe subscriptions. Purchased phone numbers with subscriptions use a separate cancellation flow first (per maintainer Udit-takkar).

Applied to files:

  • packages/features/calAIPhone/providers/retellAI/services/BillingService.ts
🧬 Code graph analysis (1)
packages/features/calAIPhone/providers/retellAI/services/BillingService.ts (2)
packages/app-store/_utils/stripe.ts (1)
  • stripe (70-72)
apps/api/v2/src/lib/logger.bridge.ts (1)
  • error (77-79)
🔇 Additional comments (1)
packages/features/calAIPhone/providers/retellAI/services/BillingService.ts (1)

139-145: ```shell
#!/usr/bin/env bash

Search repository for relevant occurrences and print the BillingService file for inspection.

Safe: only reads files, no builds or executions.

set -uo pipefail

echo "PWD: $(pwd)"
echo

if command -v rg >/dev/null 2>&1; then
RG=rg
else
RG=""
fi

echo "=== Searching for target file path ==="
if [ -n "$RG" ]; then
$RG -n --hidden --no-ignore-vcs "packages/features/calAIPhone/providers/retellAI/services/BillingService.ts" || true
else
find . -type f -path "*packages/features/calAIPhone/providers/retellAI/services/BillingService.ts" -print || true
fi
echo

echo "=== Searching for updateSubscriptionStatus occurrences ==="
if [ -n "$RG" ]; then
$RG -n --hidden --no-ignore-vcs -S "updateSubscriptionStatus" || true
else
grep -RIn --line-number "updateSubscriptionStatus" packages || true
fi
echo

echo "=== Searching for PhoneNumberSubscriptionStatus occurrences ==="
if [ -n "$RG" ]; then
$RG -n --hidden --no-ignore-vcs -S "PhoneNumberSubscriptionStatus" || true
else
grep -RIn --line-number "PhoneNumberSubscriptionStatus" packages || true
fi
echo

echo "=== Searching for phoneNumberRepository occurrences ==="
if [ -n "$RG" ]; then
$RG -n --hidden --no-ignore-vcs -S "phoneNumberRepository" || true
else
grep -RIn --line-number "phoneNumberRepository" packages || true
fi
echo

echo "=== Searching for disconnectOutboundAgent occurrences ==="
if [ -n "$RG" ]; then
$RG -n --hidden --no-ignore-vcs -S "disconnectOutboundAgent" || true
else
grep -RIn --line-number "disconnectOutboundAgent" packages || true
fi
echo

echo "=== Searching for 'cancel' (case-insensitive) inside calAIPhone package ==="
if [ -n "$RG" ]; then
$RG -n --hidden --no-ignore-vcs -S -i "cancel" packages/features/calAIPhone || true
else
grep -RIn --line-number -i "cancel" packages/features/calAIPhone || true
fi
echo

echo "=== Searching for 'stripe' occurrences in repository ==="
if [ -n "$RG" ]; then
$RG -n --hidden --no-ignore-vcs -S "stripe" || true
else
grep -RIn --line-number "stripe" || true
fi
echo

TARGET="packages/features/calAIPhone/providers/retellAI/services/BillingService.ts"
if [ -f "$TARGET" ]; then
echo "=== Showing $TARGET (1..400) ==="
sed -n '1,400p' "$TARGET" || true
echo
echo "=== Showing $TARGET (401..800) ==="
sed -n '401,800p' "$TARGET" || true
else
echo "File $TARGET not found."
fi


</blockquote></details>

</blockquote></details>

</details>

<!-- This is an auto-generated comment by CodeRabbit for review status -->

@github-actions
Copy link
Contributor

E2E results are ready!

@Udit-takkar Udit-takkar merged commit 5feca13 into main Sep 16, 2025
64 of 65 checks passed
@Udit-takkar Udit-takkar deleted the fix/double-cancel branch September 16, 2025 10:09
emrysal pushed a commit that referenced this pull request Sep 16, 2025
* fix: phone number billing bug

* fix: phone number billing bug

* fix: use raw code

* fix: use zod

* chore: update test

* fix: double cancel

* fix: double cancel

* fix: double cancel

* fix: chore update

* fix: schema
@coderabbitai coderabbitai bot mentioned this pull request Sep 23, 2025
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

billing area: billing, stripe, payments, paypal, get paid 🐛 bug Something isn't working core area: core, team members only enterprise area: enterprise, audit log, organisation, SAML, SSO High priority Created by Linear-GitHub Sync ready-for-e2e size/M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants