mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Credit PDF download
This commit is contained in:
parent
be03714aa4
commit
4c502919dc
@ -646,6 +646,10 @@ class CreditController extends BaseController
|
||||
{
|
||||
$invitation = $this->credit_repository->getInvitationByKey($invitation_key);
|
||||
|
||||
if (! $invitation) {
|
||||
return response()->json(['message' => 'no record found'], 400);
|
||||
}
|
||||
|
||||
$credit = $invitation->credit;
|
||||
|
||||
$file = $credit->service()->getCreditPdf($invitation);
|
||||
|
@ -172,6 +172,7 @@ Route::group(['middleware' => ['throttle:300,1', 'api_db', 'token_auth', 'locale
|
||||
Route::put('credits/{credit}/upload', [CreditController::class, 'upload'])->name('credits.upload');
|
||||
Route::get('credits/{credit}/{action}', [CreditController::class, 'action'])->name('credits.action');
|
||||
Route::post('credits/bulk', [CreditController::class, 'bulk'])->name('credits.bulk');
|
||||
Route::get('credit/{invitation_key}/download', [CreditController::class, 'downloadPdf'])->name('credits.downloadPdf');
|
||||
|
||||
Route::resource('designs', DesignController::class); // name = (payments. index / create / show / update / destroy / edit
|
||||
Route::post('designs/bulk', [DesignController::class, 'bulk'])->name('designs.bulk');
|
||||
|
@ -40,6 +40,23 @@ class CreditTest extends TestCase
|
||||
$this->makeTestData();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function testQuoteDownloadPDF()
|
||||
{
|
||||
$i = $this->credit->invitations->first();
|
||||
|
||||
$response = $this->withHeaders([
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->get("/api/v1/credit/{$i->key}/download");
|
||||
|
||||
$response->assertStatus(200);
|
||||
$this->assertTrue($response->headers->get('content-type') == 'application/pdf');
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function testBulkActions()
|
||||
{
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user