diff --git a/app/PaymentDrivers/Eway/CreditCard.php b/app/PaymentDrivers/Eway/CreditCard.php index c4d68ba37a..426b19834a 100644 --- a/app/PaymentDrivers/Eway/CreditCard.php +++ b/app/PaymentDrivers/Eway/CreditCard.php @@ -41,20 +41,34 @@ class CreditCard $data['gateway'] = $this->eway_driver; $data['api_key'] = $this->eway_driver->company_gateway->getConfigField('apiKey'); - $data['public_api_key'] = 'epk-8C1675E6-8E07-4C86-8946-71B3DE390F44'; + $data['public_api_key'] = $this->eway_driver->company_gateway->getConfigField('publicApiKey'); return render('gateways.eway.authorize', $data); } - public function authorizeRequest($request) + public function authorizeResponse($request) { - $transaction = [ + $this->eway_driver->init(); + + $transaction = [ + 'Reference' => 'A12345', 'Title' => 'Mr.', 'FirstName' => 'John', 'LastName' => 'Smith', + 'CompanyName' => 'Demo Shop 123', + 'JobDescription' => 'PHP Developer', + 'Street1' => 'Level 5', + 'Street2' => '369 Queen Street', + 'City' => 'Sydney', + 'State' => 'NSW', + 'PostalCode' => '2000', 'Country' => 'au', + 'Phone' => '09 889 0986', + 'Mobile' => '09 889 6542', + 'Email' => 'demo@example.org', + "Url" => "http://www.ewaypayments.com", 'Payment' => [ 'TotalAmount' => 0, ], @@ -63,8 +77,9 @@ class CreditCard 'SecuredCardData' => $request->input('SecuredCardData'), ]; - $response = $client->createTransaction(\Eway\Rapid\Enum\ApiMethod::DIRECT, $transaction); + $response = $this->eway_driver->init()->eway->createCustomer(\Eway\Rapid\Enum\ApiMethod::DIRECT, $transaction); +dd($response); } public function paymentView($data) diff --git a/app/PaymentDrivers/EwayPaymentDriver.php b/app/PaymentDrivers/EwayPaymentDriver.php index 925d1df958..7ed47e69e5 100644 --- a/app/PaymentDrivers/EwayPaymentDriver.php +++ b/app/PaymentDrivers/EwayPaymentDriver.php @@ -43,7 +43,7 @@ class EwayPaymentDriver extends BaseDriver public function init() { $apiKey = $this->company_gateway->getConfigField('apiKey'); - $password = $this->company_gateway->getConfigField('password'); + $apiPassword = $this->company_gateway->getConfigField('password'); $apiEndpoint = $this->company_gateway->getConfigField('testMode') ? \Eway\Rapid\Client::MODE_SANDBOX : \Eway\Rapid\Client::MODE_PRODUCTION; $this->eway = \Eway\Rapid::createClient($apiKey, $apiPassword, $apiEndpoint); @@ -70,12 +70,12 @@ class EwayPaymentDriver extends BaseDriver public function authorizeView(array $data) { - return $this->payment_method->authorizeView($data); //this is your custom implementation from here + return $this->payment_method->authorizeView($data); } public function authorizeResponse($request) { - return $this->payment_method->authorizeResponse($request); //this is your custom implementation from here + return $this->payment_method->authorizeResponse($request); } public function processPaymentView(array $data) diff --git a/resources/views/portal/ninja2020/gateways/eway/authorize.blade.php b/resources/views/portal/ninja2020/gateways/eway/authorize.blade.php index 1730abdf59..1081a99809 100644 --- a/resources/views/portal/ninja2020/gateways/eway/authorize.blade.php +++ b/resources/views/portal/ninja2020/gateways/eway/authorize.blade.php @@ -7,9 +7,12 @@ ctrans('texts.credit_card')]) @section('gateway_content')