# Managing Internet Subscriptions

## Overview

This journey covers how a customer views and manages their Internet subscription in the portal. Internet services are NTT fiber connections sold under the "SonixNet via NTT Optical Fiber" brand. The portal shows subscription details and billing history, and provides a cancellation flow. Unlike SIM subscriptions, Internet subscriptions do not have a self-service management dashboard for plan changes or configuration -- those changes are handled through customer support.

## Portal Flow

### Viewing an Internet Subscription

1. Go to **Subscriptions** from the sidebar.
2. The subscriptions list shows all services. Internet subscriptions have product names like "SonixNet via NTT Optical Fiber (Home 1G) [GOLD]" or "SonixNet via NTT Optical Fiber (APT 1G) [SILVER]."
3. Click on an Internet subscription to open the detail page.
4. The detail page shows four stat cards across the top:
   - **Service Status** -- Active, Pending, Suspended, etc.
   - **Billing Amount** -- the monthly fee with the billing cycle label (e.g., "6,500 JPY / monthly").
   - **Next Due Date** -- when the next invoice is due.
   - **Registration Date** -- when the service was first set up.
5. Below the stat cards is a **Billing History** section showing all invoices related to this subscription.
6. If the service is Active, a **Cancel Service** button appears in the top-right header area.

Internet subscriptions do **not** have a SIM Management tab. The detail page only shows the Overview & Billing view.

### Understanding Internet Plans

Internet plans come from the Salesforce product catalog. They are organized by:

**Offering Type** (determines the physical connection):

- **Home 1G** -- for detached houses, up to 1 Gbps.
- **Apartment 1G** -- for apartments with 1 Gbps fiber to the building.
- **Apartment 100M** -- for apartments with shared 100 Mbps fiber.
- **Flets X (Home 10G)** -- for detached houses, up to 10 Gbps (premium tier).

**Plan Tier** (determines the service level and price):

- **Silver** -- basic tier.
- **Gold** -- mid-tier with enhanced support.
- **Platinum** -- premium tier with priority support.

Each combination creates a specific WHMCS product. For example, "Internet Gold (Apartment 1G)" maps to WHMCS product ID 185 with a monthly price of 5,300 JPY.

### Internet Eligibility

Before ordering Internet, customers must go through an eligibility check (covered in the ordering journey). This is relevant to subscription management because:

- The eligibility status is stored on the Salesforce Account record (Internet_Eligibility\_\_c field).
- If a customer already has an active Internet service in WHMCS, the portal blocks ordering a second one (duplicate detection in production mode).
- Eligibility requests create a Salesforce Case. A support agent then manually checks NTT fiber availability at the customer's address and updates the eligibility field -- this is not an automated check.

### Installation Options

Internet orders include an installation component. While this is part of the ordering flow, it shows up on the subscription as a separate WHMCS service:

- **Single Installation** (one-time payment) -- WHMCS product ID 242.
- **12-Month Installation** (monthly installments) -- WHMCS product ID 243.
- **24-Month Installation** (monthly installments) -- WHMCS product ID 244.
- **Weekend Installation Fee** (add-on, one-time) -- WHMCS product ID 245.

These appear as separate line items on the WHMCS order and may show as separate subscriptions in the portal.

### Add-on Services

Internet subscriptions can have add-ons:

- **Hikari Denwa (Home Phone)** -- a VoIP home phone service, billed monthly (WHMCS product ID 246).
- **Hikari Denwa Installation Fee** -- one-time setup fee (WHMCS product ID 247).

These also appear as separate WHMCS services linked to the same order.

### Cancelling an Internet Subscription

1. From the Internet subscription detail page, click the **Cancel Service** button (red, in the top-right corner). This button only appears when the service status is Active.
2. The cancellation page loads, showing the service name (e.g., "Cancel Internet Service - SonixNet via NTT Optical Fiber (APT 1G) [GOLD]").
3. If a cancellation is already in progress (Salesforce Opportunity stage is "Cancelling"), the page shows a **Cancellation In Progress** status view with:
   - The service name.
   - The scheduled end date.
   - An **Equipment Return Status** section showing the rental return status from Salesforce (shown when the customer has rented equipment such as a router or ONU).
   - A note saying the customer will receive an email when cancellation is complete.

4. If no cancellation is pending, the full cancellation flow is displayed in three steps:

**Step 1 -- Review Service Information:**

- Shows service details (product name, billing amount, registration date, next due date).
- Displays cancellation terms and conditions specific to Internet services.
- Shows any warnings (e.g., minimum contract period).

**Step 2 -- Select Cancellation Month:**

- Choose from a list of available cancellation months.
- Check two confirmation boxes: "I have read the terms" and "I confirm I want to cancel."
- Optionally add comments.

**Step 3 -- Confirm and Submit:**

- Summary of service information and selected month.
- Click **Submit Cancellation**.

5. On success: "Cancellation request submitted. You will receive a confirmation email." The page redirects to the subscription detail after 2 seconds.

## What Happens in WHMCS

| Action                | WHMCS Impact                                                                                                                                                                                                                                                                                                                      |
| --------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **View subscription** | The subscription data comes from WHMCS (product name, status, amount, billing cycle, next due date, registration date). Data is cached for 5-10 minutes.                                                                                                                                                                          |
| **Cancel Internet**   | The service continues until the end of the current billing cycle (or the selected cancellation month). No pro-rated refund is issued. The WHMCS service status changes to Cancelled at the end of the period. Related services (installation installments, add-ons like Hikari Denwa) are also cancelled as part of this process. |

**Where to find Internet services in WHMCS:**

- Go to **Clients > [Client] > Products/Services**.
- Internet services have product names starting with "SonixNet via NTT Optical Fiber" followed by the offering type and tier in brackets.
- Example product names:
  - "SonixNet via NTT Optical Fiber (Home 1G) [SILVER]"
  - "SonixNet via NTT Optical Fiber (APT 1G) [GOLD]"
  - "SonixNet via NTT Optical Fiber (Flets X) [PLATINUM - Base Plan]"
- Installation services appear as separate products (e.g., "NTT Installation Fee (Single Installment)").
- Add-ons appear as separate products (e.g., "Hikari Denwa Monthly Service").
- All products in the same order share the same WHMCS Order ID.

**WHMCS Product IDs for Internet:**

| Plan     | Home 1G | Apt 1G | Apt 100M | Flets X (10G) |
| -------- | ------- | ------ | -------- | ------------- |
| Silver   | 181     | 184    | 187      | 239           |
| Gold     | 182     | 185    | 188      | 214           |
| Platinum | 183     | 186    | 189      | 213           |

## What Happens in Salesforce

| Action                | Salesforce Impact                                                                                                                                                                                                                                                           |
| --------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **View subscription** | No Salesforce read for basic subscription display (comes from WHMCS).                                                                                                                                                                                                       |
| **Cancel Internet**   | The linked Salesforce Opportunity stage changes from "Active" to "△Cancelling" with a scheduled end date. A new internal Case (Origin: "Portal Notification") is created to notify the support team. When cancellation is complete, the Opportunity moves to "〇Cancelled." |

### How Cancellation Links WHMCS to Salesforce

Same as SIM cancellation -- the portal finds the Opportunity by matching the WHMCS Service ID:

1. The portal reads the WHMCS Service ID from the customer's internet subscription.
2. It searches Salesforce for the Opportunity where `WHMCS_Service_ID__c` matches.
3. It updates that Opportunity's stage and cancellation fields.

**Salesforce Opportunity fields updated during Internet cancellation:**

| Field                   | API Name                              | Value                                                                     |
| ----------------------- | ------------------------------------- | ------------------------------------------------------------------------- |
| Stage                   | `StageName`                           | Changes to "△Cancelling", then "〇Cancelled"                              |
| Scheduled Cancellation  | `ScheduledCancellationDateAndTime__c` | The selected cancellation month                                           |
| Cancellation Notice     | `CancellationNotice__c`               | Status: 有 (Received), 未 (Not Yet), 不要 (Not Required), 移転 (Transfer) |
| Line Return (Equipment) | `LineReturn__c`                       | Equipment return status: NotYet, SentKit, Returned1, Returned2, N/A, etc. |

**Where to find Internet data in Salesforce:**

- **Opportunity**: Look for Opportunities on the Account where `CommodityType__c` contains "Internet". Check `WHMCS_Service_ID__c` to verify it matches the WHMCS service. The `StageName` shows the lifecycle state. The `LineReturn__c` field tracks equipment returns.
- **Order**: Internet orders have `Type` = "Internet". The Order stores `WHMCS_Order_ID__c` and individual `WHMCS_Service_ID__c` on OrderItems.
- **Product2**: Internet products have `Internet_Plan_Tier__c` (Silver/Gold/Platinum), `Internet_Offering_Type__c` (Home 1G, Apartment 1G, etc.), and `WH_Product_ID__c` mapping to WHMCS.
- **Account**: The `Internet_Eligibility__c` field stores the eligibility value (e.g., "Cross 10G"). Related fields: `Internet_Eligibility_Status__c`, `Internet_Eligibility_Request_Date_Time__c`, `Internet_Eligibility_Checked_Date_Time__c`. A Case with Origin "Portal Notification" is created each time the customer requests an eligibility check.

## Key Things to Verify

### Subscription Detail Page

- [ ] Internet subscriptions do NOT show a SIM Management tab.
- [ ] The four stat cards show correct values matching WHMCS.
- [ ] The billing amount reflects the correct plan tier pricing.
- [ ] Billing history shows all invoices for this subscription (monthly recurring and any one-time installation charges).
- [ ] The Cancel Service button appears only when the status is Active.
- [ ] The Cancel Service button does not appear for non-Active statuses (Pending, Suspended, Cancelled).

### Product Name Display

- [ ] The product name matches the WHMCS product name format (e.g., includes the offering type and tier).
- [ ] Installation and add-on services appear as separate subscriptions if they were part of the same order.

### Cancellation Flow

- [ ] Clicking Cancel Service loads the cancellation page with correct service details.
- [ ] If already cancelling, the "Cancellation In Progress" view appears with the scheduled end date.
- [ ] For Internet cancellations, the Equipment Return Status section appears when applicable.
- [ ] Available cancellation months are in the future.
- [ ] Both confirmation checkboxes must be checked before submission is allowed.
- [ ] After submission, the Salesforce Opportunity moves to "Cancelling."
- [ ] The customer receives a confirmation email.
- [ ] After cancellation completes, the WHMCS service status changes to Cancelled.

### Cross-Service Verification

- [ ] If an Internet service has related installation or add-on services, check that all are visible in the subscriptions list.
- [ ] Verify that the portal blocks ordering a second Internet service when one is already active (production behavior).
