1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 05:02:36 +01:00

Return company user settings as object (#3156)

* Conditional in test

* Add additional fields to payments

* Additional fields for payments table

* Return company user as object
This commit is contained in:
David Bomba 2019-12-17 21:50:45 +11:00 committed by GitHub
parent 2895e6df2d
commit f6f5b89af9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 13 additions and 4 deletions

View File

@ -66,6 +66,7 @@ class StorePaymentRequest extends Request
'date' => 'required',
'client_id' => 'required',
'invoices' => new ValidPayableInvoicesRule(),
'number' => 'nullable|unique',
];
return $rules;

View File

@ -71,7 +71,7 @@ class CreateUser
'is_admin' => 1,
'is_locked' => 0,
'permissions' => '',
'settings' => json_encode(DefaultSettings::userSettings()),
'settings' => DefaultSettings::userSettings(),
]);
event(new UserWasCreated($user, $this->company));

View File

@ -55,7 +55,8 @@ class Payment extends BaseModel
'type_id',
'amount',
'date',
'transaction_reference'
'transaction_reference',
'number'
];
protected $casts = [

View File

@ -51,7 +51,7 @@ class CompanyUserTransformer extends EntityTransformer
// 'user_id' => $company_user->user_id,
// 'company_id' => $company_user->company_id,
'permissions' => $company_user->permissions ?: '',
'settings' => $company_user->settings ?: '',
'settings' => $company_user->settings,
'is_owner' => (bool) $company_user->is_owner,
'is_admin' => (bool) $company_user->is_admin,
'is_locked' => (bool) $company_user->is_locked,

View File

@ -70,6 +70,7 @@ class PaymentTransformer extends EntityTransformer
'assigned_user_id' => $this->encodePrimaryKey($payment->assigned_user_id),
'amount' => (float) $payment->amount,
'refunded' => (float) $payment->refunded,
'applied' => (float) $payment->applied,
'transaction_reference' => $payment->transaction_reference ?: '',
'date' => $payment->date ?: '',
'is_manual' => (bool) $payment->is_manual,
@ -78,6 +79,7 @@ class PaymentTransformer extends EntityTransformer
'is_deleted' => (bool) $payment->is_deleted,
'type_id' => (string) $payment->payment_type_id ?: '',
'invitation_id' => (string) $payment->invitation_id ?: '',
'number' => (string) $payment->number ?: '',
'client_id' => (string) $this->encodePrimaryKey($payment->client_id),
'client_contact_id' => (string) $this->encodePrimaryKey($payment->client_contact_id),
'company_gateway_id' => (string) $this->encodePrimaryKey($payment->company_gateway_id),

View File

@ -422,7 +422,7 @@ class CreateUsersTable extends Migration
$table->string('custom_value2')->nullable();
$table->string('custom_value3')->nullable();
$table->string('custom_value4')->nullable();
$table->timestamps(6);
$table->softDeletes('deleted_at', 6);
@ -815,9 +815,11 @@ class CreateUsersTable extends Migration
$t->unsignedInteger('status_id')->index();
$t->decimal('amount', 16, 4)->default(0);
$t->decimal('refunded', 16, 4)->default(0);
$t->decimal('applied', 16, 4)->default(0);
$t->date('date')->nullable();
$t->string('transaction_reference')->nullable();
$t->string('payer_id')->nullable();
$t->string('number')->nullable();
$t->timestamps(6);
$t->softDeletes('deleted_at', 6);
$t->boolean('is_deleted')->default(false);

View File

@ -26,6 +26,9 @@ class ClientModelTest extends TestCase
if(config('ninja.testvars.travis') !== false)
$this->markTestSkipped('Skip test for Travis');
if(!config('ninja.testvars.stripe'))
$this->markTestSkipped('Skip test no company gateways installed');
}