Clean up for createsingleaccount

This commit is contained in:
David Bomba 2023-01-19 12:16:51 +11:00
parent 0caa8ea8ce
commit 4364f0d168
3 changed files with 10 additions and 5 deletions

View File

@ -80,10 +80,7 @@ class CreateSingleAccount extends Command
public function handle() public function handle()
{ {
if(config('ninja.is_docker')) if (Ninja::isHosted() || config('ninja.is_docker') || !$this->confirm('Are you sure you want to inject dummy data?'))
return;
if (!$this->confirm('Are you sure you want to inject dummy data?'))
return; return;
$this->invoice_repo = new InvoiceRepository(); $this->invoice_repo = new InvoiceRepository();
@ -105,6 +102,11 @@ class CreateSingleAccount extends Command
{ {
$this->info('Creating Small Account and Company'); $this->info('Creating Small Account and Company');
if($user = User::where('email','small@example.com')->first())
{
$user->account->delete();
}
$account = Account::factory()->create(); $account = Account::factory()->create();
$company = Company::factory()->create([ $company = Company::factory()->create([
'account_id' => $account->id, 'account_id' => $account->id,

View File

@ -670,6 +670,8 @@ class SubscriptionService
nlog("pro rata refund = {$pro_rata_refund_amount}"); 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; $total_payable = $pro_rata_refund_amount + $pro_rata_charge_amount + $this->subscription->price;
if($total_payable > 0) if($total_payable > 0)

View File

@ -68,7 +68,8 @@ class PaymentTest extends TestCase
$response = $this->withHeaders([ $response = $this->withHeaders([
'X-API-SECRET' => config('ninja.api_secret'), 'X-API-SECRET' => config('ninja.api_secret'),
'X-API-TOKEN' => $this->token, 'X-API-TOKEN' => $this->token,
])->get('/api/v1/payments?match_transactions=true'); ])->get('/api/v1/payments?match_transactions=true')
->assertStatus(200);
} }