From 173b45ec847a8560416ea342fd96a1636983f85f Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Mon, 9 Mar 2015 13:37:24 +0200 Subject: [PATCH] Set payment cancelUrl to client invoice page --- app/controllers/PaymentController.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/app/controllers/PaymentController.php b/app/controllers/PaymentController.php index af651e117c3e..b1c67aa80284 100755 --- a/app/controllers/PaymentController.php +++ b/app/controllers/PaymentController.php @@ -223,8 +223,9 @@ class PaymentController extends \BaseController ]; } - private function getPaymentDetails($invoice, $input = null) + private function getPaymentDetails($invitation, $input = null) { + $invoice = $invitation->invoice; $key = $invoice->invoice_number.'_details'; $gateway = $invoice->client->account->getGatewayByType(Session::get('payment_type'))->gateway; $paymentLibrary = $gateway->paymentlibrary; @@ -288,7 +289,7 @@ class PaymentController extends \BaseController 'card' => $card, 'currency' => $currencyCode, 'returnUrl' => URL::to('complete'), - 'cancelUrl' => URL::to('/') + 'cancelUrl' => $invitation->getLink(), ]; } else { return $data; @@ -557,7 +558,7 @@ class PaymentController extends \BaseController try { if ($paymentLibrary->id == PAYMENT_LIBRARY_OMNIPAY) { $gateway = self::createGateway($accountGateway); - $details = self::getPaymentDetails($invoice, $useToken || !$onSite ? false : Input::all()); + $details = self::getPaymentDetails($invitation, $useToken || !$onSite ? false : Input::all()); if ($accountGateway->gateway_id == GATEWAY_STRIPE) { if ($useToken) { @@ -671,7 +672,7 @@ class PaymentController extends \BaseController $gateway = self::createGateway($accountGateway); try { - $details = self::getPaymentDetails($invoice); + $details = self::getPaymentDetails($invitation); $response = $gateway->completePurchase($details)->send(); $ref = $response->getTransactionReference();