Merge branch 'master' of github.com:akaunting/akaunting

This commit is contained in:
Denis Duliçi 2021-01-19 12:47:39 +03:00
commit 24b4a01d6e
6 changed files with 44 additions and 44 deletions

View File

@ -27,13 +27,13 @@ class Bills extends ApiController
/** /**
* Display the specified resource. * Display the specified resource.
* *
* @param Document $document * @param Document $bill
* *
* @return \Dingo\Api\Http\Response * @return \Dingo\Api\Http\Response
*/ */
public function show(Document $document) public function show(Document $bill)
{ {
return $this->response->item($document, new Transformer()); return $this->response->item($bill, new Transformer());
} }
/** /**
@ -53,29 +53,29 @@ class Bills extends ApiController
/** /**
* Update the specified resource in storage. * Update the specified resource in storage.
* *
* @param $document * @param $bill
* @param $request * @param $request
* *
* @return \Dingo\Api\Http\Response * @return \Dingo\Api\Http\Response
*/ */
public function update(Document $document, Request $request) public function update(Document $bill, Request $request)
{ {
$document = $this->dispatch(new UpdateDocument($document, $request)); $bill = $this->dispatch(new UpdateDocument($bill, $request));
return $this->item($document->fresh(), new Transformer()); return $this->item($bill->fresh(), new Transformer());
} }
/** /**
* Remove the specified resource from storage. * Remove the specified resource from storage.
* *
* @param Document $document * @param Document $bill
* *
* @return \Dingo\Api\Http\Response * @return \Dingo\Api\Http\Response
*/ */
public function destroy(Document $document) public function destroy(Document $bill)
{ {
try { try {
$this->dispatch(new DeleteDocument($document)); $this->dispatch(new DeleteDocument($bill));
return $this->response->noContent(); return $this->response->noContent();
} catch(\Exception $e) { } catch(\Exception $e) {

View File

@ -59,29 +59,29 @@ class Invoices extends ApiController
/** /**
* Update the specified resource in storage. * Update the specified resource in storage.
* *
* @param $document * @param $invoice
* @param $request * @param $request
* *
* @return \Dingo\Api\Http\Response * @return \Dingo\Api\Http\Response
*/ */
public function update(Document $document, Request $request) public function update(Document $invoice, Request $request)
{ {
$document = $this->dispatch(new UpdateDocument($document, $request)); $invoice = $this->dispatch(new UpdateDocument($invoice, $request));
return $this->response->item($document->fresh(), new Transformer()); return $this->response->item($invoice->fresh(), new Transformer());
} }
/** /**
* Remove the specified resource from storage. * Remove the specified resource from storage.
* *
* @param Document $document * @param Document $invoice
* *
* @return \Dingo\Api\Http\Response * @return \Dingo\Api\Http\Response
*/ */
public function destroy(Document $document) public function destroy(Document $invoice)
{ {
try { try {
$this->dispatch(new DeleteDocument($document)); $this->dispatch(new DeleteDocument($invoice));
return $this->response->noContent(); return $this->response->noContent();
} catch(\Exception $e) { } catch(\Exception $e) {

View File

@ -15,7 +15,7 @@ class Payment extends PaymentController
public $type = 'redirect'; public $type = 'redirect';
public function show(Document $document, PaymentRequest $request) public function show(Document $invoice, PaymentRequest $request)
{ {
$setting = []; $setting = [];
@ -40,7 +40,7 @@ class Payment extends PaymentController
]); ]);
} }
public function signed(Document $document, PaymentRequest $request) public function signed(Document $invoice, PaymentRequest $request)
{ {
$setting = []; $setting = [];
@ -54,7 +54,7 @@ class Payment extends PaymentController
} }
} }
$confirm_url = URL::signedRoute('signed.invoices.offline-payments.confirm', [$document->id, 'company_id' => session('company_id')]); $confirm_url = URL::signedRoute('signed.invoices.offline-payments.confirm', [$invoice->id, 'company_id' => session('company_id')]);
$html = view('offline-payments::signed', compact('setting', 'document', 'confirm_url'))->render(); $html = view('offline-payments::signed', compact('setting', 'document', 'confirm_url'))->render();
@ -67,10 +67,10 @@ class Payment extends PaymentController
]); ]);
} }
public function confirm(Document $document, Request $request) public function confirm(Document $invoice, Request $request)
{ {
try { try {
event(new PaymentReceived($document, $request)); event(new PaymentReceived($invoice, $request));
$message = trans('messages.success.added', ['type' => trans_choice('general.payments', 1)]); $message = trans('messages.success.added', ['type' => trans_choice('general.payments', 1)]);

View File

@ -13,7 +13,7 @@
<div class="buttons"> <div class="buttons">
<div class="pull-right"> <div class="pull-right">
{!! Form::open([ {!! Form::open([
'url' => route("portal.invoices.offline-payments.confirm", $document->id), 'url' => route("portal.invoices.offline-payments.confirm", $invoice->id),
'id' => 'redirect-form', 'id' => 'redirect-form',
'role' => 'form', 'role' => 'form',
'autocomplete' => "off", 'autocomplete' => "off",

View File

@ -17,15 +17,15 @@ class Payment extends PaymentController
public $type = 'redirect'; public $type = 'redirect';
public function show(Document $document, PaymentRequest $request) public function show(Document $invoice, PaymentRequest $request)
{ {
$setting = $this->setting; $setting = $this->setting;
$this->setContactFirstLastName($document); $this->setContactFirstLastName($invoice);
$setting['action'] = ($setting['mode'] == 'live') ? 'https://www.paypal.com/cgi-bin/webscr' : 'https://www.sandbox.paypal.com/cgi-bin/webscr'; $setting['action'] = ($setting['mode'] == 'live') ? 'https://www.paypal.com/cgi-bin/webscr' : 'https://www.sandbox.paypal.com/cgi-bin/webscr';
$document_url = $this->getInvoiceUrl($document); $invoice_url = $this->getInvoiceUrl($invoice);
$html = view('paypal-standard::show', compact('setting', 'document', 'document_url'))->render(); $html = view('paypal-standard::show', compact('setting', 'document', 'document_url'))->render();
@ -38,7 +38,7 @@ class Payment extends PaymentController
]); ]);
} }
public function return(Document $document, Request $request) public function return(Document $invoice, Request $request)
{ {
$success = true; $success = true;
@ -66,12 +66,12 @@ class Payment extends PaymentController
flash($message)->warning(); flash($message)->warning();
} }
$document_url = $this->getInvoiceUrl($document); $invoice_url = $this->getInvoiceUrl($invoice);
return redirect($document_url); return redirect($invoice_url);
} }
public function complete(Document $document, Request $request) public function complete(Document $invoice, Request $request)
{ {
$setting = $this->setting; $setting = $this->setting;
@ -79,7 +79,7 @@ class Payment extends PaymentController
$paypal_log->pushHandler(new StreamHandler(storage_path('logs/paypal.log')), Logger::INFO); $paypal_log->pushHandler(new StreamHandler(storage_path('logs/paypal.log')), Logger::INFO);
if (!$document) { if (!$invoice) {
return; return;
} }
@ -115,10 +115,10 @@ class Payment extends PaymentController
case 'Completed': case 'Completed':
$receiver_match = (strtolower($request['receiver_email']) == strtolower($setting['email'])); $receiver_match = (strtolower($request['receiver_email']) == strtolower($setting['email']));
$total_paid_match = ((double) $request['mc_gross'] == $document->amount); $total_paid_match = ((double) $request['mc_gross'] == $invoice->amount);
if ($receiver_match && $total_paid_match) { if ($receiver_match && $total_paid_match) {
event(new PaymentReceived($document, $request->merge(['type' => 'income']))); event(new PaymentReceived($invoice, $request->merge(['type' => 'income'])));
} }
if (!$receiver_match) { if (!$receiver_match) {

View File

@ -21,29 +21,29 @@
<input type="hidden" name="upload" value="1" /> <input type="hidden" name="upload" value="1" />
<input type="hidden" name="business" value="{{ $setting['email'] }}" /> <input type="hidden" name="business" value="{{ $setting['email'] }}" />
<?php $i = 1; ?> <?php $i = 1; ?>
@foreach ($document->items as $item) @foreach ($invoice->items as $item)
<input type="hidden" name="item_name_{{ $i }}" value="{{ $item->name }}" /> <input type="hidden" name="item_name_{{ $i }}" value="{{ $item->name }}" />
<input type="hidden" name="amount_{{ $i }}" value="{{ $item->price }}" /> <input type="hidden" name="amount_{{ $i }}" value="{{ $item->price }}" />
<input type="hidden" name="quantity_{{ $i }}" value="{{ $item->quantity }}" /> <input type="hidden" name="quantity_{{ $i }}" value="{{ $item->quantity }}" />
<?php $i++; ?> <?php $i++; ?>
@endforeach @endforeach
<input type="hidden" name="currency_code" value="{{ $document->currency_code}}" /> <input type="hidden" name="currency_code" value="{{ $invoice->currency_code}}" />
<input type="hidden" name="first_name" value="{{ $document->first_name }}" /> <input type="hidden" name="first_name" value="{{ $invoice->first_name }}" />
<input type="hidden" name="last_name" value="{{ $document->last_name }}" /> <input type="hidden" name="last_name" value="{{ $invoice->last_name }}" />
<input type="hidden" name="address1" value="{{ $document->customer_address }}" /> <input type="hidden" name="address1" value="{{ $invoice->customer_address }}" />
<input type="hidden" name="address_override" value="0" /> <input type="hidden" name="address_override" value="0" />
<input type="hidden" name="email" value="{{ $document->customer_email }}" /> <input type="hidden" name="email" value="{{ $invoice->customer_email }}" />
<input type="hidden" name="invoice" value="{{ $document->id . '-' . $document->customer_name }}" /> <input type="hidden" name="invoice" value="{{ $invoice->id . '-' . $invoice->customer_name }}" />
<input type="hidden" name="lc" value="{{ $setting['language'] }}" /> <input type="hidden" name="lc" value="{{ $setting['language'] }}" />
<input type="hidden" name="rm" value="2" /> <input type="hidden" name="rm" value="2" />
<input type="hidden" name="no_note" value="1" /> <input type="hidden" name="no_note" value="1" />
<input type="hidden" name="no_shipping" value="1" /> <input type="hidden" name="no_shipping" value="1" />
<input type="hidden" name="charset" value="utf-8" /> <input type="hidden" name="charset" value="utf-8" />
<input type="hidden" name="return" value="{{ route('portal.invoices.paypal-standard.return', $document->id) }}" /> <input type="hidden" name="return" value="{{ route('portal.invoices.paypal-standard.return', $invoice->id) }}" />
<input type="hidden" name="notify_url" value="{{ route('portal.invoices.paypal-standard.complete', $document->id) }}" /> <input type="hidden" name="notify_url" value="{{ route('portal.invoices.paypal-standard.complete', $invoice->id) }}" />
<input type="hidden" name="cancel_return" value="{{ $document_url }}" /> <input type="hidden" name="cancel_return" value="{{ $invoice_url }}" />
<input type="hidden" name="paymentaction" value="{{ $setting['transaction'] }}" /> <input type="hidden" name="paymentaction" value="{{ $setting['transaction'] }}" />
<input type="hidden" name="custom" value="{{ $document->id }}" /> <input type="hidden" name="custom" value="{{ $invoice->id }}" />
<input type="hidden" name="bn" value="Akaunting_2.0_WPS" /> <input type="hidden" name="bn" value="Akaunting_2.0_WPS" />
<input type="submit" value="{{ trans('general.confirm') }}" class="btn btn-success" /> <input type="submit" value="{{ trans('general.confirm') }}" class="btn btn-success" />