1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 21:22:58 +01:00

Merge pull request #7601 from turbo124/v5-develop

Fixes for type checking for purchase orders
This commit is contained in:
David Bomba 2022-07-01 19:26:04 +10:00 committed by GitHub
commit 41d542ac59
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 124 additions and 84 deletions

View File

@ -1 +1 @@
5.4.4
5.4.5

View File

@ -138,6 +138,14 @@ class InvoiceFilters extends QueryFilters
});
}
public function without_deleted_clients()
{
return $this->builder->whereHas('client', function ($query) {
$query->where('is_deleted',0);
});
}
public function upcoming()
{
return $this->builder
@ -212,7 +220,7 @@ class InvoiceFilters extends QueryFilters
{
if (auth()->guard('contact')->user()) {
return $this->contactViewFilter();
} else {
} else {
return $this->builder->company()->with(['invitations.company'], ['documents.company']);
}

View File

@ -58,6 +58,6 @@ class StoreProjectRequest extends Request
public function getClient($client_id)
{
return Client::find($client_id);
return Client::withTrashed()->find($client_id);
}
}

View File

@ -14,12 +14,15 @@ namespace App\Http\Requests\PurchaseOrder;
use App\Http\Requests\Request;
use App\Models\PurchaseOrder;
use App\Utils\Traits\CleanLineItems;
use App\Utils\Traits\MakesHash;
use Illuminate\Validation\Rule;
class StorePurchaseOrderRequest extends Request
{
use MakesHash;
use CleanLineItems;
/**
* Determine if the user is authorized to make this request.
*
@ -43,8 +46,6 @@ class StorePurchaseOrderRequest extends Request
$rules['number'] = ['nullable', Rule::unique('purchase_orders')->where('company_id', auth()->user()->company()->id)];
$rules['discount'] = 'sometimes|numeric';
$rules['is_amount_discount'] = ['boolean'];
$rules['line_items'] = 'array';
return $rules;
@ -56,6 +57,12 @@ class StorePurchaseOrderRequest extends Request
$input = $this->decodePrimaryKeys($input);
if (isset($input['line_items']) && is_array($input['line_items']))
$input['line_items'] = isset($input['line_items']) ? $this->cleanItems($input['line_items']) : [];
$input['amount'] = 0;
$input['balance'] = 0;
$this->replace($input);
}

View File

@ -14,6 +14,7 @@ namespace App\Http\Requests\PurchaseOrder;
use App\Http\Requests\Request;
use App\Utils\Traits\ChecksEntityStatus;
use App\Utils\Traits\CleanLineItems;
use App\Utils\Traits\MakesHash;
use Illuminate\Validation\Rule;
@ -21,6 +22,7 @@ class UpdatePurchaseOrderRequest extends Request
{
use ChecksEntityStatus;
use MakesHash;
use CleanLineItems;
/**
* Determine if the user is authorized to make this request.
@ -57,6 +59,10 @@ class UpdatePurchaseOrderRequest extends Request
$input['id'] = $this->purchase_order->id;
if (isset($input['line_items']) && is_array($input['line_items'])) {
$input['line_items'] = isset($input['line_items']) ? $this->cleanItems($input['line_items']) : [];
}
$this->replace($input);
}
}

View File

@ -318,20 +318,25 @@ class NinjaMailerJob implements ShouldQueue
return true;
/* GMail users are uncapped */
if(Ninja::isHosted() && $this->nmo->settings->email_sending_method == 'gmail')
if(Ninja::isHosted() && ($this->nmo->settings->email_sending_method == 'gmail' || $this->nmo->settings->email_sending_method == 'office365'))
return false;
/* On the hosted platform, if the user is over the email quotas, we do not send the email. */
if(Ninja::isHosted() && $this->company->account && $this->company->account->emailQuotaExceeded())
return true;
/* To handle spam users we drop all emails from flagged accounts */
if(Ninja::isHosted() && $this->company->account && $this->nmo->company->account->is_flagged)
return true;
/* Ensure the user has a valid email address */
if(!str_contains($this->nmo->to_user->email, "@"))
return true;
/* On the hosted platform we actively scan all outbound emails to ensure outbound email quality remains high */
if(Ninja::isHosted())
return (new \Modules\Admin\Jobs\Account\EmailQuality($this->nmo, $this->company))->run();
return false;
}
@ -373,7 +378,7 @@ class NinjaMailerJob implements ShouldQueue
'form_params' => [
'client_id' => config('ninja.o365.client_id') ,
'client_secret' => config('ninja.o365.client_secret') ,
'scope' => 'email Mail.ReadWrite Mail.Send offline_access profile User.Read openid',
'scope' => 'email Mail.Send offline_access profile User.Read openid',
'grant_type' => 'refresh_token',
'refresh_token' => $user->oauth_user_refresh_token
],

View File

@ -153,7 +153,7 @@ class PurchaseOrder extends BaseModel
public function vendor()
{
return $this->belongsTo(Vendor::class);
return $this->belongsTo(Vendor::class)->withTrashed();
}
public function history()

View File

@ -60,6 +60,8 @@ class Design extends BaseDesign
public $company;
public $client_or_vendor_entity;
/** @var array */
public $aging = [];
@ -803,7 +805,7 @@ class Design extends BaseDesign
foreach ($taxes as $i => $tax) {
$elements[1]['elements'][] = ['element' => 'div', 'elements' => [
['element' => 'span', 'content', 'content' => $tax['name'], 'properties' => ['data-ref' => 'totals-table-total_tax_' . $i . '-label']],
['element' => 'span', 'content', 'content' => Number::formatMoney($tax['total'], $this->context['client']), 'properties' => ['data-ref' => 'totals-table-total_tax_' . $i]],
['element' => 'span', 'content', 'content' => Number::formatMoney($tax['total'], $this->client_or_vendor_entity), 'properties' => ['data-ref' => 'totals-table-total_tax_' . $i]],
]];
}
} elseif ($variable == '$line_taxes') {
@ -816,13 +818,13 @@ class Design extends BaseDesign
foreach ($taxes as $i => $tax) {
$elements[1]['elements'][] = ['element' => 'div', 'elements' => [
['element' => 'span', 'content', 'content' => $tax['name'], 'properties' => ['data-ref' => 'totals-table-line_tax_' . $i . '-label']],
['element' => 'span', 'content', 'content' => Number::formatMoney($tax['total'], $this->context['client']), 'properties' => ['data-ref' => 'totals-table-line_tax_' . $i]],
['element' => 'span', 'content', 'content' => Number::formatMoney($tax['total'], $this->client_or_vendor_entity), 'properties' => ['data-ref' => 'totals-table-line_tax_' . $i]],
]];
}
} elseif (Str::startsWith($variable, '$custom_surcharge')) {
$_variable = ltrim($variable, '$'); // $custom_surcharge1 -> custom_surcharge1
$visible = (int)$this->entity->{$_variable} != 0 || $this->entity->{$_variable} != '0' || !$this->entity->{$_variable};
$visible = (int)$this->entity->{$_variable} > 0 || (int)$this->entity->{$_variable} < 0 || !$this->entity->{$_variable};
$elements[1]['elements'][] = ['element' => 'div', 'elements' => [
['element' => 'span', 'content' => $variable . '_label', 'properties' => ['hidden' => !$visible, 'data-ref' => 'totals_table-' . substr($variable, 1) . '-label']],

View File

@ -32,10 +32,12 @@ trait DesignHelpers
if (isset($this->context['vendor'])) {
$this->vendor = $this->context['vendor'];
$this->client_or_vendor_entity = $this->context['vendor'];
}
if (isset($this->context['client'])) {
$this->client = $this->context['client'];
$this->client_or_vendor_entity = $this->context['client'];
}
if (isset($this->context['entity'])) {

View File

@ -84,6 +84,10 @@ class TemplateEngine
public function build()
{
if ($this->template == 'email_template_null')
$this->template = 'email_template_purchase_order';
return $this->setEntity()
->setSettingsObject()
->setTemplates()
@ -105,11 +109,11 @@ class TemplateEngine
private function setSettingsObject()
{
if($this->entity == 'purchase_order'){
if($this->entity == 'purchaseOrder'){
$this->settings_entity = auth()->user()->company();
$this->settings = $this->settings_entity->settings;
}
elseif ($this->entity_obj) {
elseif ($this->entity_obj->client()->exists()) {
$this->settings_entity = $this->entity_obj->client;
$this->settings = $this->settings_entity->getMergedSettings();
} else {
@ -153,10 +157,10 @@ class TemplateEngine
$this->raw_body = $this->body;
$this->raw_subject = $this->subject;
if($this->entity == 'purchase_order'){
if($this->entity == 'purchaseOrder'){
$this->fakerValues();
}
elseif ($this->entity_obj) {
elseif ($this->entity_obj->client()->exists()) {
$this->entityValues($this->entity_obj->client->primary_contact()->first());
}
else {
@ -186,7 +190,7 @@ class TemplateEngine
private function entityValues($contact)
{
if($this->entity == 'purchase_order')
if($this->entity == 'purchaseOrder')
$this->labels_and_values = (new VendorHtmlEngine($this->entity_obj->invitations->first()))->generateLabelsAndValues();
else
$this->labels_and_values = (new HtmlEngine($this->entity_obj->invitations->first()))->generateLabelsAndValues();
@ -214,7 +218,7 @@ class TemplateEngine
$data['footer'] = '';
$data['logo'] = auth()->user()->company()->present()->logo();
if($this->entity_obj->client)
if($this->entity_obj->client()->exists())
$data = array_merge($data, Helpers::sharedEmailVariables($this->entity_obj->client));
else{
@ -269,7 +273,7 @@ class TemplateEngine
private function mockEntity()
{
if(!$this->entity && $this->template && str_contains($this->template, 'purchase_order'))
$this->entity = 'purchase_order';
$this->entity = 'purchaseOrder';
DB::connection(config('database.default'))->beginTransaction();
@ -323,7 +327,7 @@ class TemplateEngine
if($this->entity == 'purchase_order')
if($this->entity == 'purchaseOrder')
{
$vendor = Vendor::factory()->create([

View File

@ -63,6 +63,11 @@ class VendorHtmlEngine
$this->vendor = $this->contact->vendor->load('company','country');
if(!$this->vendor->currency_id){
$this->vendor->currency_id = $this->company->settings->currency_id;
$this->vendor->save();
}
$this->entity->load('vendor');
$this->settings = $this->company->settings;

View File

@ -14,8 +14,8 @@ return [
'require_https' => env('REQUIRE_HTTPS', true),
'app_url' => rtrim(env('APP_URL', ''), '/'),
'app_domain' => env('APP_DOMAIN', 'invoicing.co'),
'app_version' => '5.4.4',
'app_tag' => '5.4.4',
'app_version' => '5.4.5',
'app_tag' => '5.4.5',
'minimum_client_version' => '5.0.16',
'terms_version' => '1.0.1',
'api_secret' => env('API_SECRET', ''),

View File

@ -15,6 +15,7 @@ class AddFlagToAccountsTable extends Migration
{
Schema::table('accounts', function (Blueprint $table) {
$table->boolean('is_flagged')->default(0);
$table->boolean('is_verified_account')->default(0);
});
}

View File

@ -124,7 +124,7 @@ class EventTest extends TestCase
$response = $this->withHeaders([
'X-API-SECRET' => config('ninja.api_secret'),
'X-API-TOKEN' => $this->token,
])->post('/api/v1/expenses/', $data)
])->postJson('/api/v1/expenses/', $data)
->assertStatus(200);
@ -137,7 +137,7 @@ class EventTest extends TestCase
$response = $this->withHeaders([
'X-API-SECRET' => config('ninja.api_secret'),
'X-API-TOKEN' => $this->token,
])->put('/api/v1/expenses/' . $arr['data']['id'], $data)
])->putJson('/api/v1/expenses/' . $arr['data']['id'], $data)
->assertStatus(200);
@ -148,19 +148,19 @@ class EventTest extends TestCase
$response = $this->withHeaders([
'X-API-SECRET' => config('ninja.api_secret'),
'X-API-TOKEN' => $this->token,
])->post('/api/v1/expenses/bulk?action=archive', $data)
])->postJson('/api/v1/expenses/bulk?action=archive', $data)
->assertStatus(200);
$response = $this->withHeaders([
'X-API-SECRET' => config('ninja.api_secret'),
'X-API-TOKEN' => $this->token,
])->post('/api/v1/expenses/bulk?action=restore', $data)
])->postJson('/api/v1/expenses/bulk?action=restore', $data)
->assertStatus(200);
$response = $this->withHeaders([
'X-API-SECRET' => config('ninja.api_secret'),
'X-API-TOKEN' => $this->token,
])->post('/api/v1/expenses/bulk?action=delete', $data)
])->postJson('/api/v1/expenses/bulk?action=delete', $data)
->assertStatus(200);
}
@ -183,7 +183,7 @@ class EventTest extends TestCase
$response = $this->withHeaders([
'X-API-SECRET' => config('ninja.api_secret'),
'X-API-TOKEN' => $this->token,
])->post('/api/v1/vendors/', $data)
])->postJson('/api/v1/vendors/', $data)
->assertStatus(200);
@ -197,7 +197,7 @@ class EventTest extends TestCase
$response = $this->withHeaders([
'X-API-SECRET' => config('ninja.api_secret'),
'X-API-TOKEN' => $this->token,
])->put('/api/v1/vendors/' . $arr['data']['id'], $data)
])->putJson('/api/v1/vendors/' . $arr['data']['id'], $data)
->assertStatus(200);
@ -208,19 +208,19 @@ class EventTest extends TestCase
$response = $this->withHeaders([
'X-API-SECRET' => config('ninja.api_secret'),
'X-API-TOKEN' => $this->token,
])->post('/api/v1/vendors/bulk?action=archive', $data)
])->postJson('/api/v1/vendors/bulk?action=archive', $data)
->assertStatus(200);
$response = $this->withHeaders([
'X-API-SECRET' => config('ninja.api_secret'),
'X-API-TOKEN' => $this->token,
])->post('/api/v1/vendors/bulk?action=restore', $data)
])->postJson('/api/v1/vendors/bulk?action=restore', $data)
->assertStatus(200);
$response = $this->withHeaders([
'X-API-SECRET' => config('ninja.api_secret'),
'X-API-TOKEN' => $this->token,
])->post('/api/v1/vendors/bulk?action=delete', $data)
])->postJson('/api/v1/vendors/bulk?action=delete', $data)
->assertStatus(200);
}
@ -245,7 +245,7 @@ class EventTest extends TestCase
$response = $this->withHeaders([
'X-API-SECRET' => config('ninja.api_secret'),
'X-API-TOKEN' => $this->token,
])->post('/api/v1/tasks/', $data)
])->postJson('/api/v1/tasks/', $data)
->assertStatus(200);
@ -259,7 +259,7 @@ class EventTest extends TestCase
$response = $this->withHeaders([
'X-API-SECRET' => config('ninja.api_secret'),
'X-API-TOKEN' => $this->token,
])->put('/api/v1/tasks/' . $arr['data']['id'], $data)
])->putJson('/api/v1/tasks/' . $arr['data']['id'], $data)
->assertStatus(200);
@ -270,19 +270,19 @@ class EventTest extends TestCase
$response = $this->withHeaders([
'X-API-SECRET' => config('ninja.api_secret'),
'X-API-TOKEN' => $this->token,
])->post('/api/v1/tasks/bulk?action=archive', $data)
])->postJson('/api/v1/tasks/bulk?action=archive', $data)
->assertStatus(200);
$response = $this->withHeaders([
'X-API-SECRET' => config('ninja.api_secret'),
'X-API-TOKEN' => $this->token,
])->post('/api/v1/tasks/bulk?action=restore', $data)
])->postJson('/api/v1/tasks/bulk?action=restore', $data)
->assertStatus(200);
$response = $this->withHeaders([
'X-API-SECRET' => config('ninja.api_secret'),
'X-API-TOKEN' => $this->token,
])->post('/api/v1/tasks/bulk?action=delete', $data)
])->postJson('/api/v1/tasks/bulk?action=delete', $data)
->assertStatus(200);
}
@ -306,7 +306,7 @@ class EventTest extends TestCase
$response = $this->withHeaders([
'X-API-SECRET' => config('ninja.api_secret'),
'X-API-TOKEN' => $this->token,
])->post('/api/v1/credits/', $data)
])->postJson('/api/v1/credits/', $data)
->assertStatus(200);
@ -320,7 +320,7 @@ class EventTest extends TestCase
$response = $this->withHeaders([
'X-API-SECRET' => config('ninja.api_secret'),
'X-API-TOKEN' => $this->token,
])->put('/api/v1/credits/' . $arr['data']['id'], $data)
])->putJson('/api/v1/credits/' . $arr['data']['id'], $data)
->assertStatus(200);
@ -331,19 +331,19 @@ class EventTest extends TestCase
$response = $this->withHeaders([
'X-API-SECRET' => config('ninja.api_secret'),
'X-API-TOKEN' => $this->token,
])->post('/api/v1/credits/bulk?action=archive', $data)
])->postJson('/api/v1/credits/bulk?action=archive', $data)
->assertStatus(200);
$response = $this->withHeaders([
'X-API-SECRET' => config('ninja.api_secret'),
'X-API-TOKEN' => $this->token,
])->post('/api/v1/credits/bulk?action=restore', $data)
])->postJson('/api/v1/credits/bulk?action=restore', $data)
->assertStatus(200);
$response = $this->withHeaders([
'X-API-SECRET' => config('ninja.api_secret'),
'X-API-TOKEN' => $this->token,
])->post('/api/v1/credits/bulk?action=delete', $data)
])->postJson('/api/v1/credits/bulk?action=delete', $data)
->assertStatus(200);
}
@ -368,7 +368,7 @@ class EventTest extends TestCase
$response = $this->withHeaders([
'X-API-SECRET' => config('ninja.api_secret'),
'X-API-TOKEN' => $this->token,
])->post('/api/v1/quotes/', $data)
])->postJson('/api/v1/quotes/', $data)
->assertStatus(200);
@ -382,7 +382,7 @@ class EventTest extends TestCase
$response = $this->withHeaders([
'X-API-SECRET' => config('ninja.api_secret'),
'X-API-TOKEN' => $this->token,
])->put('/api/v1/quotes/' . $arr['data']['id'], $data)
])->putJson('/api/v1/quotes/' . $arr['data']['id'], $data)
->assertStatus(200);
@ -397,25 +397,25 @@ class EventTest extends TestCase
$response = $this->withHeaders([
'X-API-SECRET' => config('ninja.api_secret'),
'X-API-TOKEN' => $this->token,
])->post('/api/v1/quotes/bulk?action=archive', $data)
])->postJson('/api/v1/quotes/bulk?action=archive', $data)
->assertStatus(200);
$response = $this->withHeaders([
'X-API-SECRET' => config('ninja.api_secret'),
'X-API-TOKEN' => $this->token,
])->post('/api/v1/quotes/bulk?action=restore', $data)
])->postJson('/api/v1/quotes/bulk?action=restore', $data)
->assertStatus(200);
$response = $this->withHeaders([
'X-API-SECRET' => config('ninja.api_secret'),
'X-API-TOKEN' => $this->token,
])->post('/api/v1/quotes/bulk?action=approve', $data)
])->postJson('/api/v1/quotes/bulk?action=approve', $data)
->assertStatus(200);
$response = $this->withHeaders([
'X-API-SECRET' => config('ninja.api_secret'),
'X-API-TOKEN' => $this->token,
])->post('/api/v1/quotes/bulk?action=delete', $data)
])->postJson('/api/v1/quotes/bulk?action=delete', $data)
->assertStatus(200);
}
@ -449,7 +449,7 @@ class EventTest extends TestCase
$response = $this->withHeaders([
'X-API-SECRET' => config('ninja.api_secret'),
'X-API-TOKEN' => $this->token,
])->post('/api/v1/payments?include=invoices', $data)
])->postJson('/api/v1/payments?include=invoices', $data)
->assertStatus(200);
$arr = $response->json();
@ -461,7 +461,7 @@ class EventTest extends TestCase
$response = $this->withHeaders([
'X-API-SECRET' => config('ninja.api_secret'),
'X-API-TOKEN' => $this->token,
])->put('/api/v1/payments/' . $arr['data']['id'], $data)
])->putJson('/api/v1/payments/' . $arr['data']['id'], $data)
->assertStatus(200);
$data = [
@ -471,19 +471,19 @@ class EventTest extends TestCase
$response = $this->withHeaders([
'X-API-SECRET' => config('ninja.api_secret'),
'X-API-TOKEN' => $this->token,
])->post('/api/v1/payments/bulk?action=archive', $data)
])->postJson('/api/v1/payments/bulk?action=archive', $data)
->assertStatus(200);
$response = $this->withHeaders([
'X-API-SECRET' => config('ninja.api_secret'),
'X-API-TOKEN' => $this->token,
])->post('/api/v1/payments/bulk?action=restore', $data)
])->postJson('/api/v1/payments/bulk?action=restore', $data)
->assertStatus(200);
$response = $this->withHeaders([
'X-API-SECRET' => config('ninja.api_secret'),
'X-API-TOKEN' => $this->token,
])->post('/api/v1/payments/bulk?action=delete', $data)
])->postJson('/api/v1/payments/bulk?action=delete', $data)
->assertStatus(200);
}
@ -507,7 +507,7 @@ class EventTest extends TestCase
$response = $this->withHeaders([
'X-API-SECRET' => config('ninja.api_secret'),
'X-API-TOKEN' => $this->token,
])->post('/api/v1/invoices/', $data)
])->postJson('/api/v1/invoices/', $data)
->assertStatus(200);
@ -521,7 +521,7 @@ class EventTest extends TestCase
$response = $this->withHeaders([
'X-API-SECRET' => config('ninja.api_secret'),
'X-API-TOKEN' => $this->token,
])->put('/api/v1/invoices/' . $arr['data']['id'], $data)
])->putJson('/api/v1/invoices/' . $arr['data']['id'], $data)
->assertStatus(200);
@ -532,19 +532,19 @@ class EventTest extends TestCase
$response = $this->withHeaders([
'X-API-SECRET' => config('ninja.api_secret'),
'X-API-TOKEN' => $this->token,
])->post('/api/v1/invoices/bulk?action=archive', $data)
])->postJson('/api/v1/invoices/bulk?action=archive', $data)
->assertStatus(200);
$response = $this->withHeaders([
'X-API-SECRET' => config('ninja.api_secret'),
'X-API-TOKEN' => $this->token,
])->post('/api/v1/invoices/bulk?action=restore', $data)
])->postJson('/api/v1/invoices/bulk?action=restore', $data)
->assertStatus(200);
$response = $this->withHeaders([
'X-API-SECRET' => config('ninja.api_secret'),
'X-API-TOKEN' => $this->token,
])->post('/api/v1/invoices/bulk?action=delete', $data)
])->postJson('/api/v1/invoices/bulk?action=delete', $data)
->assertStatus(200);
}
@ -571,7 +571,7 @@ class EventTest extends TestCase
$response = $this->withHeaders([
'X-API-SECRET' => config('ninja.api_secret'),
'X-API-TOKEN' => $this->token,
])->post('/api/v1/recurring_invoices/', $data);
])->postJson('/api/v1/recurring_invoices/', $data);
} catch (ValidationException $e) {
$message = json_decode($e->validator->getMessageBag(), 1);
}
@ -590,7 +590,7 @@ class EventTest extends TestCase
$response = $this->withHeaders([
'X-API-SECRET' => config('ninja.api_secret'),
'X-API-TOKEN' => $this->token,
])->put('/api/v1/recurring_invoices/' . $arr['data']['id'], $data)
])->putJson('/api/v1/recurring_invoices/' . $arr['data']['id'], $data)
->assertStatus(200);
@ -601,19 +601,19 @@ class EventTest extends TestCase
$response = $this->withHeaders([
'X-API-SECRET' => config('ninja.api_secret'),
'X-API-TOKEN' => $this->token,
])->post('/api/v1/recurring_invoices/bulk?action=archive', $data)
])->postJson('/api/v1/recurring_invoices/bulk?action=archive', $data)
->assertStatus(200);
$response = $this->withHeaders([
'X-API-SECRET' => config('ninja.api_secret'),
'X-API-TOKEN' => $this->token,
])->post('/api/v1/recurring_invoices/bulk?action=restore', $data)
])->postJson('/api/v1/recurring_invoices/bulk?action=restore', $data)
->assertStatus(200);
$response = $this->withHeaders([
'X-API-SECRET' => config('ninja.api_secret'),
'X-API-TOKEN' => $this->token,
])->post('/api/v1/recurring_invoices/bulk?action=delete', $data)
])->postJson('/api/v1/recurring_invoices/bulk?action=delete', $data)
->assertStatus(200);
}
@ -636,7 +636,7 @@ class EventTest extends TestCase
$response = $this->withHeaders([
'X-API-SECRET' => config('ninja.api_secret'),
'X-API-TOKEN' => $this->token,
])->post('/api/v1/clients/', $data)
])->postJson('/api/v1/clients/', $data)
->assertStatus(200);
@ -650,7 +650,7 @@ class EventTest extends TestCase
$response = $this->withHeaders([
'X-API-SECRET' => config('ninja.api_secret'),
'X-API-TOKEN' => $this->token,
])->put('/api/v1/clients/' . $arr['data']['id'], $data)
])->putJson('/api/v1/clients/' . $arr['data']['id'], $data)
->assertStatus(200);
@ -661,19 +661,19 @@ class EventTest extends TestCase
$response = $this->withHeaders([
'X-API-SECRET' => config('ninja.api_secret'),
'X-API-TOKEN' => $this->token,
])->post('/api/v1/clients/bulk?action=archive', $data)
])->postJson('/api/v1/clients/bulk?action=archive', $data)
->assertStatus(200);
$response = $this->withHeaders([
'X-API-SECRET' => config('ninja.api_secret'),
'X-API-TOKEN' => $this->token,
])->post('/api/v1/clients/bulk?action=restore', $data)
])->postJson('/api/v1/clients/bulk?action=restore', $data)
->assertStatus(200);
$response = $this->withHeaders([
'X-API-SECRET' => config('ninja.api_secret'),
'X-API-TOKEN' => $this->token,
])->post('/api/v1/clients/bulk?action=delete', $data)
])->postJson('/api/v1/clients/bulk?action=delete', $data)
->assertStatus(200);
}
@ -705,7 +705,7 @@ class EventTest extends TestCase
'X-API-SECRET' => config('ninja.api_secret'),
'X-API-TOKEN' => $this->token,
'X-API-PASSWORD' => 'ALongAndBriliantPassword',
])->post('/api/v1/users?include=company_user', $data)
])->postJson('/api/v1/users?include=company_user', $data)
->assertStatus(200);
$arr = $response->json();
@ -725,7 +725,7 @@ class EventTest extends TestCase
'X-API-SECRET' => config('ninja.api_secret'),
'X-API-TOKEN' => $this->token,
'X-API-PASSWORD' => 'ALongAndBriliantPassword',
])->put('/api/v1/users/' . $arr['data']['id'], $data)
])->putJson('/api/v1/users/' . $arr['data']['id'], $data)
->assertStatus(200);
@ -737,21 +737,21 @@ class EventTest extends TestCase
'X-API-SECRET' => config('ninja.api_secret'),
'X-API-TOKEN' => $this->token,
'X-API-PASSWORD' => 'ALongAndBriliantPassword',
])->post('/api/v1/users/bulk?action=archive', $data)
])->postJson('/api/v1/users/bulk?action=archive', $data)
->assertStatus(200);
$response = $this->withHeaders([
'X-API-SECRET' => config('ninja.api_secret'),
'X-API-TOKEN' => $this->token,
'X-API-PASSWORD' => 'ALongAndBriliantPassword',
])->post('/api/v1/users/bulk?action=restore', $data)
])->postJson('/api/v1/users/bulk?action=restore', $data)
->assertStatus(200);
$response = $this->withHeaders([
'X-API-SECRET' => config('ninja.api_secret'),
'X-API-TOKEN' => $this->token,
'X-API-PASSWORD' => 'ALongAndBriliantPassword',
])->post('/api/v1/users/bulk?action=delete', $data)
])->postJson('/api/v1/users/bulk?action=delete', $data)
->assertStatus(200);
}
@ -772,7 +772,7 @@ class EventTest extends TestCase
$response = $this->withHeaders([
'X-API-SECRET' => config('ninja.api_secret'),
'X-API-TOKEN' => $this->token,
])->post('/api/v1/subscriptions/', $data)
])->postJson('/api/v1/subscriptions/', $data)
->assertStatus(200);
@ -785,7 +785,7 @@ class EventTest extends TestCase
$response = $this->withHeaders([
'X-API-SECRET' => config('ninja.api_secret'),
'X-API-TOKEN' => $this->token,
])->put('/api/v1/subscriptions/' . $arr['data']['id'], $data)
])->putJson('/api/v1/subscriptions/' . $arr['data']['id'], $data)
->assertStatus(200);
@ -796,19 +796,19 @@ class EventTest extends TestCase
$response = $this->withHeaders([
'X-API-SECRET' => config('ninja.api_secret'),
'X-API-TOKEN' => $this->token,
])->post('/api/v1/subscriptions/bulk?action=archive', $data)
])->postJson('/api/v1/subscriptions/bulk?action=archive', $data)
->assertStatus(200);
$response = $this->withHeaders([
'X-API-SECRET' => config('ninja.api_secret'),
'X-API-TOKEN' => $this->token,
])->post('/api/v1/subscriptions/bulk?action=restore', $data)
])->postJson('/api/v1/subscriptions/bulk?action=restore', $data)
->assertStatus(200);
$response = $this->withHeaders([
'X-API-SECRET' => config('ninja.api_secret'),
'X-API-TOKEN' => $this->token,
])->post('/api/v1/subscriptions/bulk?action=delete', $data)
])->postJson('/api/v1/subscriptions/bulk?action=delete', $data)
->assertStatus(200);
}
@ -833,7 +833,7 @@ public function PurchaseOrderEvents()
$response = $this->withHeaders([
'X-API-SECRET' => config('ninja.api_secret'),
'X-API-TOKEN' => $this->token,
])->post('/api/v1/purchase_orders/', $data)
])->postJson('/api/v1/purchase_orders/', $data)
->assertStatus(200);
@ -847,7 +847,7 @@ public function PurchaseOrderEvents()
$response = $this->withHeaders([
'X-API-SECRET' => config('ninja.api_secret'),
'X-API-TOKEN' => $this->token,
])->put('/api/v1/purchase_orders/' . $arr['data']['id'], $data)
])->putJson('/api/v1/purchase_orders/' . $arr['data']['id'], $data)
->assertStatus(200);
@ -862,25 +862,25 @@ public function PurchaseOrderEvents()
$response = $this->withHeaders([
'X-API-SECRET' => config('ninja.api_secret'),
'X-API-TOKEN' => $this->token,
])->post('/api/v1/purchase_orders/bulk?action=archive', $data)
])->postJson('/api/v1/purchase_orders/bulk?action=archive', $data)
->assertStatus(200);
$response = $this->withHeaders([
'X-API-SECRET' => config('ninja.api_secret'),
'X-API-TOKEN' => $this->token,
])->post('/api/v1/purchase_orders/bulk?action=restore', $data)
])->postJson('/api/v1/purchase_orders/bulk?action=restore', $data)
->assertStatus(200);
$response = $this->withHeaders([
'X-API-SECRET' => config('ninja.api_secret'),
'X-API-TOKEN' => $this->token,
])->post('/api/v1/purchase_orders/bulk?action=approve', $data)
])->postJson('/api/v1/purchase_orders/bulk?action=approve', $data)
->assertStatus(200);
$response = $this->withHeaders([
'X-API-SECRET' => config('ninja.api_secret'),
'X-API-TOKEN' => $this->token,
])->post('/api/v1/purchase_orders/bulk?action=delete', $data)
])->postJson('/api/v1/purchase_orders/bulk?action=delete', $data)
->assertStatus(200);
}