PaypalStandard replace document to invoice..
This commit is contained in:
parent
b7d35b47e7
commit
93be6da63b
@ -17,15 +17,15 @@ class Payment extends PaymentController
|
||||
|
||||
public $type = 'redirect';
|
||||
|
||||
public function show(Document $document, PaymentRequest $request)
|
||||
public function show(Document $invoice, PaymentRequest $request)
|
||||
{
|
||||
$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';
|
||||
|
||||
$document_url = $this->getInvoiceUrl($document);
|
||||
$invoice_url = $this->getInvoiceUrl($invoice);
|
||||
|
||||
$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;
|
||||
|
||||
@ -66,12 +66,12 @@ class Payment extends PaymentController
|
||||
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;
|
||||
|
||||
@ -79,7 +79,7 @@ class Payment extends PaymentController
|
||||
|
||||
$paypal_log->pushHandler(new StreamHandler(storage_path('logs/paypal.log')), Logger::INFO);
|
||||
|
||||
if (!$document) {
|
||||
if (!$invoice) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -115,10 +115,10 @@ class Payment extends PaymentController
|
||||
case 'Completed':
|
||||
$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) {
|
||||
event(new PaymentReceived($document, $request->merge(['type' => 'income'])));
|
||||
event(new PaymentReceived($invoice, $request->merge(['type' => 'income'])));
|
||||
}
|
||||
|
||||
if (!$receiver_match) {
|
||||
|
@ -21,29 +21,29 @@
|
||||
<input type="hidden" name="upload" value="1" />
|
||||
<input type="hidden" name="business" value="{{ $setting['email'] }}" />
|
||||
<?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="amount_{{ $i }}" value="{{ $item->price }}" />
|
||||
<input type="hidden" name="quantity_{{ $i }}" value="{{ $item->quantity }}" />
|
||||
<?php $i++; ?>
|
||||
@endforeach
|
||||
<input type="hidden" name="currency_code" value="{{ $document->currency_code}}" />
|
||||
<input type="hidden" name="first_name" value="{{ $document->first_name }}" />
|
||||
<input type="hidden" name="last_name" value="{{ $document->last_name }}" />
|
||||
<input type="hidden" name="address1" value="{{ $document->customer_address }}" />
|
||||
<input type="hidden" name="currency_code" value="{{ $invoice->currency_code}}" />
|
||||
<input type="hidden" name="first_name" value="{{ $invoice->first_name }}" />
|
||||
<input type="hidden" name="last_name" value="{{ $invoice->last_name }}" />
|
||||
<input type="hidden" name="address1" value="{{ $invoice->customer_address }}" />
|
||||
<input type="hidden" name="address_override" value="0" />
|
||||
<input type="hidden" name="email" value="{{ $document->customer_email }}" />
|
||||
<input type="hidden" name="invoice" value="{{ $document->id . '-' . $document->customer_name }}" />
|
||||
<input type="hidden" name="email" value="{{ $invoice->customer_email }}" />
|
||||
<input type="hidden" name="invoice" value="{{ $invoice->id . '-' . $invoice->customer_name }}" />
|
||||
<input type="hidden" name="lc" value="{{ $setting['language'] }}" />
|
||||
<input type="hidden" name="rm" value="2" />
|
||||
<input type="hidden" name="no_note" value="1" />
|
||||
<input type="hidden" name="no_shipping" value="1" />
|
||||
<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="notify_url" value="{{ route('portal.invoices.paypal-standard.complete', $document->id) }}" />
|
||||
<input type="hidden" name="cancel_return" value="{{ $document_url }}" />
|
||||
<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', $invoice->id) }}" />
|
||||
<input type="hidden" name="cancel_return" value="{{ $invoice_url }}" />
|
||||
<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="submit" value="{{ trans('general.confirm') }}" class="btn btn-success" />
|
||||
|
Loading…
x
Reference in New Issue
Block a user