diff --git a/app/Console/Commands/CreateSingleAccount.php b/app/Console/Commands/CreateSingleAccount.php index fb7e9b575dce..5a18fdd66277 100644 --- a/app/Console/Commands/CreateSingleAccount.php +++ b/app/Console/Commands/CreateSingleAccount.php @@ -80,10 +80,7 @@ class CreateSingleAccount extends Command public function handle() { - if(config('ninja.is_docker')) - return; - - if (!$this->confirm('Are you sure you want to inject dummy data?')) + if (Ninja::isHosted() || config('ninja.is_docker') || !$this->confirm('Are you sure you want to inject dummy data?')) return; $this->invoice_repo = new InvoiceRepository(); @@ -105,6 +102,11 @@ class CreateSingleAccount extends Command { $this->info('Creating Small Account and Company'); + if($user = User::where('email','small@example.com')->first()) + { + $user->account->delete(); + } + $account = Account::factory()->create(); $company = Company::factory()->create([ 'account_id' => $account->id, diff --git a/app/Services/Subscription/SubscriptionService.php b/app/Services/Subscription/SubscriptionService.php index 636126b8e59e..6a7c7ea327c0 100644 --- a/app/Services/Subscription/SubscriptionService.php +++ b/app/Services/Subscription/SubscriptionService.php @@ -670,6 +670,8 @@ class SubscriptionService nlog("pro rata refund = {$pro_rata_refund_amount}"); } + nlog("{$pro_rata_refund_amount} + {$pro_rata_charge_amount} + {$this->subscription->price}"); + $total_payable = $pro_rata_refund_amount + $pro_rata_charge_amount + $this->subscription->price; if($total_payable > 0) diff --git a/tests/Feature/PaymentTest.php b/tests/Feature/PaymentTest.php index 4d37bfdafb13..0f95a9d33e65 100644 --- a/tests/Feature/PaymentTest.php +++ b/tests/Feature/PaymentTest.php @@ -68,7 +68,8 @@ class PaymentTest extends TestCase $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), 'X-API-TOKEN' => $this->token, - ])->get('/api/v1/payments?match_transactions=true'); + ])->get('/api/v1/payments?match_transactions=true') + ->assertStatus(200); }