Skip to content

Conversation

@SasakiTakatsugu
Copy link
Contributor

No description provided.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds plan management functionality to the billing system, enabling retrieval of pricing plans, tax rates, and tenant plan information, as well as updating tenant plans.

  • Adds new API endpoints for retrieving pricing plans and tax rates
  • Implements tenant plan information retrieval with current and reservation details
  • Adds tenant plan update functionality with support for plan changes, cancellations, and reservation management

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
routes/api.php Adds four new API routes for plan management functionality
app/Http/Controllers/BillingController.php Implements controller methods for pricing plans, tax rates, and tenant plan operations

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines 610 to 611
$plans = $this->pricing->getPricingPlans();
return response()->json($plans->getPricingPlans());
Copy link

Copilot AI Oct 2, 2025

Choose a reason for hiding this comment

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

The method getPricingPlans() is called twice - once on the service and once on the returned object. This creates confusion and potential for errors. Consider simplifying to either return the service result directly or clarify the method naming.

Suggested change
$plans = $this->pricing->getPricingPlans();
return response()->json($plans->getPricingPlans());
$plansResponse = $this->pricing->getPricingPlans();
return response()->json($plansResponse->getPricingPlans());

Copilot uses AI. Check for mistakes.
{
try {
$taxRates = $this->pricing->getTaxRates();
return response()->json($taxRates->getTaxRates());
Copy link

Copilot AI Oct 2, 2025

Choose a reason for hiding this comment

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

Similar to the pricing plans endpoint, getTaxRates() is called twice which creates unnecessary complexity. Consider returning the service result directly or using clearer method naming.

Suggested change
return response()->json($taxRates->getTaxRates());
return response()->json($taxRates);

Copilot uses AI. Check for mistakes.
$updateParam->next_plan_id = $nextPlanId;

// 税率IDが指定されている場合のみ設定
if ($taxRateId && $taxRateId !== '') {
Copy link

Copilot AI Oct 2, 2025

Choose a reason for hiding this comment

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

[nitpick] The condition $taxRateId && $taxRateId !== '' could be simplified to just !empty($taxRateId) for better readability and consistency.

Suggested change
if ($taxRateId && $taxRateId !== '') {
if (!empty($taxRateId)) {

Copilot uses AI. Check for mistakes.
}

// using_next_plan_fromが指定されている場合のみ設定
if ($usingNextPlanFrom && $usingNextPlanFrom > 0) {
Copy link

Copilot AI Oct 2, 2025

Choose a reason for hiding this comment

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

[nitpick] The validation logic mixes truthiness check with numeric comparison. Consider using explicit validation like if ($usingNextPlanFrom !== null && $usingNextPlanFrom > 0) for clearer intent.

Suggested change
if ($usingNextPlanFrom && $usingNextPlanFrom > 0) {
if ($usingNextPlanFrom !== null && $usingNextPlanFrom > 0) {

Copilot uses AI. Check for mistakes.
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines +638 to +640
if (!$tenantId) {
return response()->json(['error' => 'tenant_id is required'], Response::HTTP_BAD_REQUEST);
}
Copy link

Copilot AI Oct 23, 2025

Choose a reason for hiding this comment

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

This validation is redundant. The $tenantId parameter comes from the route and will always have a value when this method is called. Laravel ensures route parameters are present, so this check will never trigger.

Suggested change
if (!$tenantId) {
return response()->json(['error' => 'tenant_id is required'], Response::HTTP_BAD_REQUEST);
}

Copilot uses AI. Check for mistakes.
Comment on lines +693 to +695
if (!$tenantId) {
return response()->json(['error' => 'tenant_id is required'], Response::HTTP_BAD_REQUEST);
}
Copy link

Copilot AI Oct 23, 2025

Choose a reason for hiding this comment

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

This validation is redundant. The $tenantId parameter comes from the route and will always have a value when this method is called. Laravel ensures route parameters are present, so this check will never trigger.

Suggested change
if (!$tenantId) {
return response()->json(['error' => 'tenant_id is required'], Response::HTTP_BAD_REQUEST);
}

Copilot uses AI. Check for mistakes.
@KooriyamaHiroki KooriyamaHiroki merged commit 81a530f into main Oct 23, 2025
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.

3 participants