mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-23 20:00:33 -04: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:
parent
2895e6df2d
commit
f6f5b89af9
@ -66,6 +66,7 @@ class StorePaymentRequest extends Request
|
|||||||
'date' => 'required',
|
'date' => 'required',
|
||||||
'client_id' => 'required',
|
'client_id' => 'required',
|
||||||
'invoices' => new ValidPayableInvoicesRule(),
|
'invoices' => new ValidPayableInvoicesRule(),
|
||||||
|
'number' => 'nullable|unique',
|
||||||
];
|
];
|
||||||
|
|
||||||
return $rules;
|
return $rules;
|
||||||
|
@ -71,7 +71,7 @@ class CreateUser
|
|||||||
'is_admin' => 1,
|
'is_admin' => 1,
|
||||||
'is_locked' => 0,
|
'is_locked' => 0,
|
||||||
'permissions' => '',
|
'permissions' => '',
|
||||||
'settings' => json_encode(DefaultSettings::userSettings()),
|
'settings' => DefaultSettings::userSettings(),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
event(new UserWasCreated($user, $this->company));
|
event(new UserWasCreated($user, $this->company));
|
||||||
|
@ -55,7 +55,8 @@ class Payment extends BaseModel
|
|||||||
'type_id',
|
'type_id',
|
||||||
'amount',
|
'amount',
|
||||||
'date',
|
'date',
|
||||||
'transaction_reference'
|
'transaction_reference',
|
||||||
|
'number'
|
||||||
];
|
];
|
||||||
|
|
||||||
protected $casts = [
|
protected $casts = [
|
||||||
|
@ -51,7 +51,7 @@ class CompanyUserTransformer extends EntityTransformer
|
|||||||
// 'user_id' => $company_user->user_id,
|
// 'user_id' => $company_user->user_id,
|
||||||
// 'company_id' => $company_user->company_id,
|
// 'company_id' => $company_user->company_id,
|
||||||
'permissions' => $company_user->permissions ?: '',
|
'permissions' => $company_user->permissions ?: '',
|
||||||
'settings' => $company_user->settings ?: '',
|
'settings' => $company_user->settings,
|
||||||
'is_owner' => (bool) $company_user->is_owner,
|
'is_owner' => (bool) $company_user->is_owner,
|
||||||
'is_admin' => (bool) $company_user->is_admin,
|
'is_admin' => (bool) $company_user->is_admin,
|
||||||
'is_locked' => (bool) $company_user->is_locked,
|
'is_locked' => (bool) $company_user->is_locked,
|
||||||
|
@ -70,6 +70,7 @@ class PaymentTransformer extends EntityTransformer
|
|||||||
'assigned_user_id' => $this->encodePrimaryKey($payment->assigned_user_id),
|
'assigned_user_id' => $this->encodePrimaryKey($payment->assigned_user_id),
|
||||||
'amount' => (float) $payment->amount,
|
'amount' => (float) $payment->amount,
|
||||||
'refunded' => (float) $payment->refunded,
|
'refunded' => (float) $payment->refunded,
|
||||||
|
'applied' => (float) $payment->applied,
|
||||||
'transaction_reference' => $payment->transaction_reference ?: '',
|
'transaction_reference' => $payment->transaction_reference ?: '',
|
||||||
'date' => $payment->date ?: '',
|
'date' => $payment->date ?: '',
|
||||||
'is_manual' => (bool) $payment->is_manual,
|
'is_manual' => (bool) $payment->is_manual,
|
||||||
@ -78,6 +79,7 @@ class PaymentTransformer extends EntityTransformer
|
|||||||
'is_deleted' => (bool) $payment->is_deleted,
|
'is_deleted' => (bool) $payment->is_deleted,
|
||||||
'type_id' => (string) $payment->payment_type_id ?: '',
|
'type_id' => (string) $payment->payment_type_id ?: '',
|
||||||
'invitation_id' => (string) $payment->invitation_id ?: '',
|
'invitation_id' => (string) $payment->invitation_id ?: '',
|
||||||
|
'number' => (string) $payment->number ?: '',
|
||||||
'client_id' => (string) $this->encodePrimaryKey($payment->client_id),
|
'client_id' => (string) $this->encodePrimaryKey($payment->client_id),
|
||||||
'client_contact_id' => (string) $this->encodePrimaryKey($payment->client_contact_id),
|
'client_contact_id' => (string) $this->encodePrimaryKey($payment->client_contact_id),
|
||||||
'company_gateway_id' => (string) $this->encodePrimaryKey($payment->company_gateway_id),
|
'company_gateway_id' => (string) $this->encodePrimaryKey($payment->company_gateway_id),
|
||||||
|
@ -815,9 +815,11 @@ class CreateUsersTable extends Migration
|
|||||||
$t->unsignedInteger('status_id')->index();
|
$t->unsignedInteger('status_id')->index();
|
||||||
$t->decimal('amount', 16, 4)->default(0);
|
$t->decimal('amount', 16, 4)->default(0);
|
||||||
$t->decimal('refunded', 16, 4)->default(0);
|
$t->decimal('refunded', 16, 4)->default(0);
|
||||||
|
$t->decimal('applied', 16, 4)->default(0);
|
||||||
$t->date('date')->nullable();
|
$t->date('date')->nullable();
|
||||||
$t->string('transaction_reference')->nullable();
|
$t->string('transaction_reference')->nullable();
|
||||||
$t->string('payer_id')->nullable();
|
$t->string('payer_id')->nullable();
|
||||||
|
$t->string('number')->nullable();
|
||||||
$t->timestamps(6);
|
$t->timestamps(6);
|
||||||
$t->softDeletes('deleted_at', 6);
|
$t->softDeletes('deleted_at', 6);
|
||||||
$t->boolean('is_deleted')->default(false);
|
$t->boolean('is_deleted')->default(false);
|
||||||
|
@ -26,6 +26,9 @@ class ClientModelTest extends TestCase
|
|||||||
|
|
||||||
if(config('ninja.testvars.travis') !== false)
|
if(config('ninja.testvars.travis') !== false)
|
||||||
$this->markTestSkipped('Skip test for Travis');
|
$this->markTestSkipped('Skip test for Travis');
|
||||||
|
|
||||||
|
if(!config('ninja.testvars.stripe'))
|
||||||
|
$this->markTestSkipped('Skip test no company gateways installed');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user