mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Merge pull request #7196 from turbo124/v5-develop
Fixes for currency set for payments
This commit is contained in:
commit
91d63f5321
@ -2,12 +2,19 @@
|
|||||||
|
|
||||||
namespace App\Http\Controllers\ClientPortal;
|
namespace App\Http\Controllers\ClientPortal;
|
||||||
|
|
||||||
|
use App\Events\Credit\CreditWasViewed;
|
||||||
|
use App\Events\Invoice\InvoiceWasViewed;
|
||||||
|
use App\Events\Misc\InvitationWasViewed;
|
||||||
|
use App\Events\Quote\QuoteWasViewed;
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Utils\Ninja;
|
||||||
use App\Utils\Traits\MakesHash;
|
use App\Utils\Traits\MakesHash;
|
||||||
use Illuminate\Contracts\View\Factory;
|
use Illuminate\Contracts\View\Factory;
|
||||||
use Illuminate\Http\RedirectResponse;
|
use Illuminate\Http\RedirectResponse;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Routing\Redirector;
|
use Illuminate\Routing\Redirector;
|
||||||
use Illuminate\Support\Facades\Hash;
|
use Illuminate\Support\Facades\Hash;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
use Illuminate\View\View;
|
use Illuminate\View\View;
|
||||||
|
|
||||||
class EntityViewController extends Controller
|
class EntityViewController extends Controller
|
||||||
@ -19,7 +26,7 @@ class EntityViewController extends Controller
|
|||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
private $entity_types = ['invoice', 'quote'];
|
private $entity_types = ['invoice', 'quote', 'credit', 'recurring_invoice'];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show the entity outside client portal.
|
* Show the entity outside client portal.
|
||||||
@ -118,4 +125,54 @@ class EntityViewController extends Controller
|
|||||||
|
|
||||||
return back();
|
return back();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function handlePasswordSet(Request $request)
|
||||||
|
{
|
||||||
|
$entity_obj = 'App\Models\\'.ucfirst(Str::camel($request->entity_type)).'Invitation';
|
||||||
|
$key = $request->entity_type.'_id';
|
||||||
|
|
||||||
|
$invitation = $entity_obj::where('key', $request->invitation_key)
|
||||||
|
->whereHas($request->entity_type, function ($query) {
|
||||||
|
$query->where('is_deleted',0);
|
||||||
|
})
|
||||||
|
->with('contact.client')
|
||||||
|
->first();
|
||||||
|
|
||||||
|
$contact = $invitation->contact;
|
||||||
|
$contact->password = Hash::make($request->password);
|
||||||
|
$contact->save();
|
||||||
|
|
||||||
|
$request->session()->invalidate();
|
||||||
|
auth()->guard('contact')->loginUsingId($contact->id, true);
|
||||||
|
|
||||||
|
if (! $invitation->viewed_date) {
|
||||||
|
$invitation->markViewed();
|
||||||
|
|
||||||
|
event(new InvitationWasViewed($invitation->{$request->entity_type}, $invitation, $invitation->{$request->entity_type}->company, Ninja::eventVars()));
|
||||||
|
|
||||||
|
$this->fireEntityViewedEvent($invitation, $request->entity_type);
|
||||||
|
}
|
||||||
|
|
||||||
|
return redirect()->route('client.'.$request->entity_type.'.show', [$request->entity_type => $this->encodePrimaryKey($invitation->{$key})]);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private function fireEntityViewedEvent($invitation, $entity_string)
|
||||||
|
{
|
||||||
|
switch ($entity_string) {
|
||||||
|
case 'invoice':
|
||||||
|
event(new InvoiceWasViewed($invitation, $invitation->company, Ninja::eventVars()));
|
||||||
|
break;
|
||||||
|
case 'quote':
|
||||||
|
event(new QuoteWasViewed($invitation, $invitation->company, Ninja::eventVars()));
|
||||||
|
break;
|
||||||
|
case 'credit':
|
||||||
|
event(new CreditWasViewed($invitation, $invitation->company, Ninja::eventVars()));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
// code...
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -102,6 +102,17 @@ class InvitationController extends Controller
|
|||||||
auth()->guard('contact')->loginUsingId($client_contact->id, true);
|
auth()->guard('contact')->loginUsingId($client_contact->id, true);
|
||||||
|
|
||||||
} elseif ((bool) $invitation->contact->client->getSetting('enable_client_portal_password') !== false) {
|
} elseif ((bool) $invitation->contact->client->getSetting('enable_client_portal_password') !== false) {
|
||||||
|
|
||||||
|
//if no contact password has been set - allow user to set password - then continue to view entity
|
||||||
|
if(empty($invitation->contact->password)){
|
||||||
|
|
||||||
|
return $this->render('view_entity.set_password', [
|
||||||
|
'root' => 'themes',
|
||||||
|
'entity_type' => $entity,
|
||||||
|
'invitation_key' => $invitation_key
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
$this->middleware('auth:contact');
|
$this->middleware('auth:contact');
|
||||||
return redirect()->route('client.login');
|
return redirect()->route('client.login');
|
||||||
|
|
||||||
|
@ -160,7 +160,7 @@ class QuoteController extends Controller
|
|||||||
$quotes = Quote::whereIn('id', $ids)
|
$quotes = Quote::whereIn('id', $ids)
|
||||||
->where('client_id', auth('contact')->user()->client->id)
|
->where('client_id', auth('contact')->user()->client->id)
|
||||||
->where('company_id', auth('contact')->user()->client->company_id)
|
->where('company_id', auth('contact')->user()->client->company_id)
|
||||||
->where('status_id', Quote::STATUS_SENT)
|
->whereIn('status_id', [Quote::STATUS_DRAFT, Quote::STATUS_SENT])
|
||||||
->withTrashed()
|
->withTrashed()
|
||||||
->get();
|
->get();
|
||||||
|
|
||||||
|
@ -76,6 +76,10 @@ class StoreRecurringInvoiceRequest extends Request
|
|||||||
$input['assigned_user_id'] = $this->decodePrimaryKey($input['assigned_user_id']);
|
$input['assigned_user_id'] = $this->decodePrimaryKey($input['assigned_user_id']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (array_key_exists('vendor_id', $input) && is_string($input['vendor_id'])) {
|
||||||
|
$input['vendor_id'] = $this->decodePrimaryKey($input['vendor_id']);
|
||||||
|
}
|
||||||
|
|
||||||
if (isset($input['client_contacts'])) {
|
if (isset($input['client_contacts'])) {
|
||||||
foreach ($input['client_contacts'] as $key => $contact) {
|
foreach ($input['client_contacts'] as $key => $contact) {
|
||||||
if (! array_key_exists('send_email', $contact) || ! array_key_exists('id', $contact)) {
|
if (! array_key_exists('send_email', $contact) || ! array_key_exists('id', $contact)) {
|
||||||
|
@ -78,6 +78,7 @@ class Credit extends BaseModel
|
|||||||
'assigned_user_id',
|
'assigned_user_id',
|
||||||
'exchange_rate',
|
'exchange_rate',
|
||||||
'subscription_id',
|
'subscription_id',
|
||||||
|
'vendor_id',
|
||||||
];
|
];
|
||||||
|
|
||||||
protected $casts = [
|
protected $casts = [
|
||||||
@ -123,6 +124,11 @@ class Credit extends BaseModel
|
|||||||
return $this->belongsTo(User::class, 'assigned_user_id', 'id')->withTrashed();
|
return $this->belongsTo(User::class, 'assigned_user_id', 'id')->withTrashed();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function vendor()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Vendor::class);
|
||||||
|
}
|
||||||
|
|
||||||
public function history()
|
public function history()
|
||||||
{
|
{
|
||||||
return $this->hasManyThrough(Backup::class, Activity::class);
|
return $this->hasManyThrough(Backup::class, Activity::class);
|
||||||
|
@ -76,6 +76,7 @@ class Quote extends BaseModel
|
|||||||
'exchange_rate',
|
'exchange_rate',
|
||||||
'subscription_id',
|
'subscription_id',
|
||||||
'uses_inclusive_taxes',
|
'uses_inclusive_taxes',
|
||||||
|
'vendor_id',
|
||||||
];
|
];
|
||||||
|
|
||||||
protected $casts = [
|
protected $casts = [
|
||||||
@ -133,6 +134,11 @@ class Quote extends BaseModel
|
|||||||
return $this->belongsTo(Company::class);
|
return $this->belongsTo(Company::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function vendor()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Vendor::class);
|
||||||
|
}
|
||||||
|
|
||||||
public function history()
|
public function history()
|
||||||
{
|
{
|
||||||
return $this->hasManyThrough(Backup::class, Activity::class);
|
return $this->hasManyThrough(Backup::class, Activity::class);
|
||||||
|
@ -107,6 +107,7 @@ class RecurringInvoice extends BaseModel
|
|||||||
'design_id',
|
'design_id',
|
||||||
'assigned_user_id',
|
'assigned_user_id',
|
||||||
'exchange_rate',
|
'exchange_rate',
|
||||||
|
'vendor_id',
|
||||||
];
|
];
|
||||||
|
|
||||||
protected $casts = [
|
protected $casts = [
|
||||||
@ -157,6 +158,11 @@ class RecurringInvoice extends BaseModel
|
|||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function vendor()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Vendor::class);
|
||||||
|
}
|
||||||
|
|
||||||
public function activities()
|
public function activities()
|
||||||
{
|
{
|
||||||
return $this->hasMany(Activity::class)->orderBy('id', 'DESC')->take(50);
|
return $this->hasMany(Activity::class)->orderBy('id', 'DESC')->take(50);
|
||||||
|
@ -202,6 +202,9 @@ class PaymentMigrationRepository extends BaseRepository
|
|||||||
*/
|
*/
|
||||||
private function processExchangeRates($data, $payment)
|
private function processExchangeRates($data, $payment)
|
||||||
{
|
{
|
||||||
|
if($payment->exchange_rate != 1)
|
||||||
|
return $payment;
|
||||||
|
|
||||||
$client = Client::where('id', $data['client_id'])->withTrashed()->first();
|
$client = Client::where('id', $data['client_id'])->withTrashed()->first();
|
||||||
|
|
||||||
$client_currency = $client->getSetting('currency_id');
|
$client_currency = $client->getSetting('currency_id');
|
||||||
|
@ -210,6 +210,7 @@ class PaymentRepository extends BaseRepository {
|
|||||||
$payment->exchange_currency_id = $company_currency;
|
$payment->exchange_currency_id = $company_currency;
|
||||||
$payment->currency_id = $client_currency;
|
$payment->currency_id = $client_currency;
|
||||||
|
|
||||||
|
return $payment;
|
||||||
}
|
}
|
||||||
|
|
||||||
$payment->currency_id = $company_currency;
|
$payment->currency_id = $company_currency;
|
||||||
|
@ -111,6 +111,9 @@ class ApplyPaymentAmount extends AbstractService
|
|||||||
private function setExchangeRate(Payment $payment)
|
private function setExchangeRate(Payment $payment)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
if($payment->exchange_rate != 1)
|
||||||
|
return;
|
||||||
|
|
||||||
$client_currency = $payment->client->getSetting('currency_id');
|
$client_currency = $payment->client->getSetting('currency_id');
|
||||||
$company_currency = $payment->client->company->settings->currency_id;
|
$company_currency = $payment->client->company->settings->currency_id;
|
||||||
|
|
||||||
|
@ -79,6 +79,9 @@ class InvoiceService
|
|||||||
public function setExchangeRate()
|
public function setExchangeRate()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
if($this->invoice->exchange_rate != 1)
|
||||||
|
return $this;
|
||||||
|
|
||||||
$client_currency = $this->invoice->client->getSetting('currency_id');
|
$client_currency = $this->invoice->client->getSetting('currency_id');
|
||||||
$company_currency = $this->invoice->company->settings->currency_id;
|
$company_currency = $this->invoice->company->settings->currency_id;
|
||||||
|
|
||||||
|
@ -116,6 +116,9 @@ class MarkPaid extends AbstractService
|
|||||||
private function setExchangeRate(Payment $payment)
|
private function setExchangeRate(Payment $payment)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
if($payment->exchange_rate != 1)
|
||||||
|
return;
|
||||||
|
|
||||||
$client_currency = $payment->client->getSetting('currency_id');
|
$client_currency = $payment->client->getSetting('currency_id');
|
||||||
$company_currency = $payment->client->company->settings->currency_id;
|
$company_currency = $payment->client->company->settings->currency_id;
|
||||||
|
|
||||||
|
@ -89,6 +89,7 @@ class CreditTransformer extends EntityTransformer
|
|||||||
'user_id' => $this->encodePrimaryKey($credit->user_id),
|
'user_id' => $this->encodePrimaryKey($credit->user_id),
|
||||||
'project_id' => $this->encodePrimaryKey($credit->project_id),
|
'project_id' => $this->encodePrimaryKey($credit->project_id),
|
||||||
'assigned_user_id' => $this->encodePrimaryKey($credit->assigned_user_id),
|
'assigned_user_id' => $this->encodePrimaryKey($credit->assigned_user_id),
|
||||||
|
'vendor_id' => (string) $this->encodePrimaryKey($credit->vendor_id),
|
||||||
'amount' => (float) $credit->amount,
|
'amount' => (float) $credit->amount,
|
||||||
'balance' => (float) $credit->balance,
|
'balance' => (float) $credit->balance,
|
||||||
'client_id' => (string) $this->encodePrimaryKey($credit->client_id),
|
'client_id' => (string) $this->encodePrimaryKey($credit->client_id),
|
||||||
|
@ -95,6 +95,7 @@ class QuoteTransformer extends EntityTransformer
|
|||||||
'status_id' => (string) $quote->status_id,
|
'status_id' => (string) $quote->status_id,
|
||||||
'design_id' => (string) $this->encodePrimaryKey($quote->design_id),
|
'design_id' => (string) $this->encodePrimaryKey($quote->design_id),
|
||||||
'invoice_id' => (string) $this->encodePrimaryKey($quote->invoice_id),
|
'invoice_id' => (string) $this->encodePrimaryKey($quote->invoice_id),
|
||||||
|
'vendor_id' => (string) $this->encodePrimaryKey($quote->vendor_id),
|
||||||
'updated_at' => (int) $quote->updated_at,
|
'updated_at' => (int) $quote->updated_at,
|
||||||
'archived_at' => (int) $quote->deleted_at,
|
'archived_at' => (int) $quote->deleted_at,
|
||||||
'created_at' => (int) $quote->created_at,
|
'created_at' => (int) $quote->created_at,
|
||||||
|
@ -4544,6 +4544,7 @@ $LANG = array(
|
|||||||
'activity_123' => ':user deleted recurring expense :recurring_expense',
|
'activity_123' => ':user deleted recurring expense :recurring_expense',
|
||||||
'activity_124' => ':user restored recurring expense :recurring_expense',
|
'activity_124' => ':user restored recurring expense :recurring_expense',
|
||||||
'fpx' => "FPX",
|
'fpx' => "FPX",
|
||||||
|
'to_view_entity_set_password' => 'To view the :entity you need to set password.',
|
||||||
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -21,14 +21,12 @@
|
|||||||
@endcomponent
|
@endcomponent
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
@if($quote->status_id === \App\Models\Quote::STATUS_SENT)
|
@if(in_array($quote->status_id, [\App\Models\Quote::STATUS_SENT, \App\Models\Quote::STATUS_DRAFT]))
|
||||||
<div class="mb-4">
|
<div class="mb-4">
|
||||||
@include('portal.ninja2020.quotes.includes.actions', ['quote' => $quote])
|
@include('portal.ninja2020.quotes.includes.actions', ['quote' => $quote])
|
||||||
</div>
|
</div>
|
||||||
@elseif($quote->status_id === \App\Models\Quote::STATUS_APPROVED)
|
@elseif($quote->status_id === \App\Models\Quote::STATUS_APPROVED)
|
||||||
<p class="text-right text-gray-900 text-sm mb-4">{{ ctrans('texts.approved') }}</p>
|
<p class="text-right text-gray-900 text-sm mb-4">{{ ctrans('texts.approved') }}</p>
|
||||||
@else
|
|
||||||
<p class="text-right text-gray-900 text-sm mb-4">{{ ctrans('texts.quotes_with_status_sent_can_be_approved') }}</p>
|
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
@include('portal.ninja2020.components.entity-documents', ['entity' => $quote])
|
@include('portal.ninja2020.components.entity-documents', ['entity' => $quote])
|
||||||
|
@ -18,6 +18,7 @@ Route::post('client/password/reset', 'Auth\ContactResetPasswordController@reset'
|
|||||||
Route::get('view/{entity_type}/{invitation_key}', 'ClientPortal\EntityViewController@index')->name('client.entity_view');
|
Route::get('view/{entity_type}/{invitation_key}', 'ClientPortal\EntityViewController@index')->name('client.entity_view');
|
||||||
Route::get('view/{entity_type}/{invitation_key}/password', 'ClientPortal\EntityViewController@password')->name('client.entity_view.password');
|
Route::get('view/{entity_type}/{invitation_key}/password', 'ClientPortal\EntityViewController@password')->name('client.entity_view.password');
|
||||||
Route::post('view/{entity_type}/{invitation_key}/password', 'ClientPortal\EntityViewController@handlePassword');
|
Route::post('view/{entity_type}/{invitation_key}/password', 'ClientPortal\EntityViewController@handlePassword');
|
||||||
|
Route::post('set_password', 'ClientPortal\EntityViewController@handlePasswordSet')->name('client.set_password');
|
||||||
|
|
||||||
Route::get('tmp_pdf/{hash}', 'ClientPortal\TempRouteController@index')->name('tmp_pdf');
|
Route::get('tmp_pdf/{hash}', 'ClientPortal\TempRouteController@index')->name('tmp_pdf');
|
||||||
|
|
||||||
|
@ -41,6 +41,147 @@ class VendorApiTest extends TestCase
|
|||||||
Model::reguard();
|
Model::reguard();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testAddVendorToInvoice()
|
||||||
|
{
|
||||||
|
$data = [
|
||||||
|
'name' => $this->faker->firstName,
|
||||||
|
];
|
||||||
|
|
||||||
|
$response = $this->withHeaders([
|
||||||
|
'X-API-SECRET' => config('ninja.api_secret'),
|
||||||
|
'X-API-TOKEN' => $this->token,
|
||||||
|
])->post('/api/v1/vendors', $data);
|
||||||
|
|
||||||
|
$response->assertStatus(200);
|
||||||
|
|
||||||
|
$arr = $response->json();
|
||||||
|
$vendor_id =$arr['data']['id'];
|
||||||
|
|
||||||
|
$data = [
|
||||||
|
'vendor_id' => $vendor_id,
|
||||||
|
'client_id' => $this->client->hashed_id
|
||||||
|
];
|
||||||
|
|
||||||
|
$response = $this->withHeaders([
|
||||||
|
'X-API-SECRET' => config('ninja.api_secret'),
|
||||||
|
'X-API-TOKEN' => $this->token,
|
||||||
|
])->post('/api/v1/invoices', $data);
|
||||||
|
|
||||||
|
$response->assertStatus(200);
|
||||||
|
|
||||||
|
$arr = $response->json();
|
||||||
|
|
||||||
|
$this->assertEquals($arr['data']['vendor_id'], $vendor_id);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function testAddVendorToRecurringInvoice()
|
||||||
|
{
|
||||||
|
$data = [
|
||||||
|
'name' => $this->faker->firstName,
|
||||||
|
];
|
||||||
|
|
||||||
|
$response = $this->withHeaders([
|
||||||
|
'X-API-SECRET' => config('ninja.api_secret'),
|
||||||
|
'X-API-TOKEN' => $this->token,
|
||||||
|
])->post('/api/v1/vendors', $data);
|
||||||
|
|
||||||
|
$response->assertStatus(200);
|
||||||
|
|
||||||
|
$arr = $response->json();
|
||||||
|
$vendor_id = $arr['data']['id'];
|
||||||
|
|
||||||
|
$data = [
|
||||||
|
'vendor_id' => $vendor_id,
|
||||||
|
'client_id' => $this->client->hashed_id,
|
||||||
|
'frequency_id' => 1,
|
||||||
|
];
|
||||||
|
|
||||||
|
$response = $this->withHeaders([
|
||||||
|
'X-API-SECRET' => config('ninja.api_secret'),
|
||||||
|
'X-API-TOKEN' => $this->token,
|
||||||
|
])->post('/api/v1/recurring_invoices', $data);
|
||||||
|
|
||||||
|
$response->assertStatus(200);
|
||||||
|
|
||||||
|
$arr = $response->json();
|
||||||
|
|
||||||
|
$this->assertEquals($arr['data']['vendor_id'], $vendor_id);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testAddVendorToQuote()
|
||||||
|
{
|
||||||
|
$data = [
|
||||||
|
'name' => $this->faker->firstName,
|
||||||
|
];
|
||||||
|
|
||||||
|
$response = $this->withHeaders([
|
||||||
|
'X-API-SECRET' => config('ninja.api_secret'),
|
||||||
|
'X-API-TOKEN' => $this->token,
|
||||||
|
])->post('/api/v1/vendors', $data);
|
||||||
|
|
||||||
|
$response->assertStatus(200);
|
||||||
|
|
||||||
|
$arr = $response->json();
|
||||||
|
$vendor_id =$arr['data']['id'];
|
||||||
|
|
||||||
|
$data = [
|
||||||
|
'vendor_id' => $vendor_id,
|
||||||
|
'client_id' => $this->client->hashed_id
|
||||||
|
];
|
||||||
|
|
||||||
|
$response = $this->withHeaders([
|
||||||
|
'X-API-SECRET' => config('ninja.api_secret'),
|
||||||
|
'X-API-TOKEN' => $this->token,
|
||||||
|
])->post('/api/v1/quotes', $data);
|
||||||
|
|
||||||
|
$response->assertStatus(200);
|
||||||
|
|
||||||
|
$arr = $response->json();
|
||||||
|
|
||||||
|
$this->assertEquals($arr['data']['vendor_id'], $vendor_id);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function testAddVendorToCredit()
|
||||||
|
{
|
||||||
|
$data = [
|
||||||
|
'name' => $this->faker->firstName,
|
||||||
|
];
|
||||||
|
|
||||||
|
$response = $this->withHeaders([
|
||||||
|
'X-API-SECRET' => config('ninja.api_secret'),
|
||||||
|
'X-API-TOKEN' => $this->token,
|
||||||
|
])->post('/api/v1/vendors', $data);
|
||||||
|
|
||||||
|
$response->assertStatus(200);
|
||||||
|
|
||||||
|
$arr = $response->json();
|
||||||
|
$vendor_id =$arr['data']['id'];
|
||||||
|
|
||||||
|
$data = [
|
||||||
|
'vendor_id' => $vendor_id,
|
||||||
|
'client_id' => $this->client->hashed_id
|
||||||
|
];
|
||||||
|
|
||||||
|
$response = $this->withHeaders([
|
||||||
|
'X-API-SECRET' => config('ninja.api_secret'),
|
||||||
|
'X-API-TOKEN' => $this->token,
|
||||||
|
])->post('/api/v1/credits', $data);
|
||||||
|
|
||||||
|
$response->assertStatus(200);
|
||||||
|
|
||||||
|
$arr = $response->json();
|
||||||
|
|
||||||
|
$this->assertEquals($arr['data']['vendor_id'], $vendor_id);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public function testVendorPost()
|
public function testVendorPost()
|
||||||
{
|
{
|
||||||
$data = [
|
$data = [
|
||||||
|
Loading…
x
Reference in New Issue
Block a user