akaunting 3.0 (the last dance)
This commit is contained in:
@ -41,16 +41,18 @@ abstract class PaymentController extends BaseController
|
||||
});
|
||||
}
|
||||
|
||||
public function show(Document $invoice, PaymentRequest $request)
|
||||
public function show(Document $invoice, PaymentRequest $request, $cards = [])
|
||||
{
|
||||
$this->setContactFirstLastName($invoice);
|
||||
|
||||
$confirm_url = $this->getConfirmUrl($invoice);
|
||||
|
||||
$html = view('partials.portal.payment_method.' . $this->type, [
|
||||
$html = view('components.payment_method.' . $this->type, [
|
||||
'setting' => $this->setting,
|
||||
'invoice' => $invoice,
|
||||
'confirm_url' => $confirm_url,
|
||||
'store_card' => !empty($this->setting['store_card']) ? true : false,
|
||||
'cards' => $cards,
|
||||
])->render();
|
||||
|
||||
return response()->json([
|
||||
@ -101,15 +103,15 @@ abstract class PaymentController extends BaseController
|
||||
|
||||
flash($message)->success();
|
||||
|
||||
$invoice_url = $this->getInvoiceUrl($invoice);
|
||||
$finish_url = $this->getFinishUrl($invoice);
|
||||
|
||||
if ($force_redirect || ($this->type == 'redirect')) {
|
||||
return redirect($invoice_url);
|
||||
return redirect($finish_url);
|
||||
}
|
||||
|
||||
return response()->json([
|
||||
'error' => $message,
|
||||
'redirect' => $invoice_url,
|
||||
'redirect' => $finish_url,
|
||||
'success' => true,
|
||||
'data' => false,
|
||||
]);
|
||||
@ -122,6 +124,13 @@ abstract class PaymentController extends BaseController
|
||||
: URL::signedRoute('signed.invoices.show', [$invoice->id]);
|
||||
}
|
||||
|
||||
public function getFinishUrl($invoice)
|
||||
{
|
||||
return request()->isPortal($invoice->company_id)
|
||||
? route('portal.invoices.finish', $invoice->id)
|
||||
: URL::signedRoute('signed.invoices.finish', [$invoice->id]);
|
||||
}
|
||||
|
||||
public function getConfirmUrl($invoice)
|
||||
{
|
||||
return $this->getModuleUrl($invoice, 'confirm');
|
||||
|
Reference in New Issue
Block a user