From 9ac360679d4940475f760b499c5e8a073a503a78 Mon Sep 17 00:00:00 2001 From: adrianbarbos Date: Thu, 6 Apr 2017 12:20:21 +0300 Subject: [PATCH] Bug fix --- src/MobilpayGateway.php | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/MobilpayGateway.php b/src/MobilpayGateway.php index 40cb5f1..e0be5d1 100644 --- a/src/MobilpayGateway.php +++ b/src/MobilpayGateway.php @@ -7,29 +7,28 @@ class MobilpayGateway { protected $data; - protected $gateway; use DataTrait; function __construct() { - - $this->gateway = Omnipay::create('MobilPay')->setMerchantId(config('mobilpay.merchant_id')); - $this->initData(); } public function purchase() { - $this->gateway->setPublicKey(config('mobilpay.public_key_path')); + $gateway = Omnipay::create('MobilPay'); + $gateway->setMerchantId(config('mobilpay.merchant_id')); + $gateway->setPublicKey(config('mobilpay.public_key_path')); - $response = $this->gateway->purchase($this->data)->send(); + $response = $gateway->purchase($this->data)->send(); $response->redirect(); } public function response() { - $this->gateway->privateKeyPath(config('mobilpay.private_key_path')); + $gateway = Omnipay::create('MobilPay'); + $gateway->privateKeyPath(config('mobilpay.private_key_path')); - $response = $this->gateway->completePurchase($_POST)->send(); + $response = $gateway->completePurchase($_POST)->send(); $response->sendResponse(); return $response;