From b85b0913a6d6112257a40b86cc93bfb8bf6f9341 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Tue, 16 Jun 2020 13:49:45 +1000 Subject: [PATCH] Authorize.net payment via credit card --- app/PaymentDrivers/Authorize/AuthorizeCreditCard.php | 8 +++++--- app/PaymentDrivers/AuthorizePaymentDriver.php | 4 ++-- app/PaymentDrivers/BaseDriver.php | 8 +++++--- .../gateways/authorize/credit_card_payment.blade.php | 10 ++++++++-- 4 files changed, 20 insertions(+), 10 deletions(-) diff --git a/app/PaymentDrivers/Authorize/AuthorizeCreditCard.php b/app/PaymentDrivers/Authorize/AuthorizeCreditCard.php index dcb862520a91..1f050c9bf767 100644 --- a/app/PaymentDrivers/Authorize/AuthorizeCreditCard.php +++ b/app/PaymentDrivers/Authorize/AuthorizeCreditCard.php @@ -32,14 +32,16 @@ class AuthorizeCreditCard public function processPaymentView($data) { $tokens = ClientGatewayToken::where('client_id', $this->authorize->client->id) - ->where('company_gateway_key', $this->authorize->company_gateway->gateway_key) + ->where('company_gateway_id', $this->authorize->company_gateway->id) ->where('gateway_type_id', $this->authorize->payment_method_id) ->get(); $data['tokens'] = $tokens; $data['gateway'] = $this->authorize->company_gateway; - - return render('portal.ninja202.gateways.authorize.credit_card_payment', $data); + $data['public_client_id'] = $this->authorize->init()->getPublicClientKey(); + $data['api_login_id'] = $this->authorize->company_gateway->getConfigField('apiLoginId'); + + return render('gateways.authorize.credit_card_payment', $data); } } \ No newline at end of file diff --git a/app/PaymentDrivers/AuthorizePaymentDriver.php b/app/PaymentDrivers/AuthorizePaymentDriver.php index a99fdf6958a2..0d05573d7167 100644 --- a/app/PaymentDrivers/AuthorizePaymentDriver.php +++ b/app/PaymentDrivers/AuthorizePaymentDriver.php @@ -38,9 +38,9 @@ class AuthorizePaymentDriver extends BaseDriver ]; public function bootPaymentMethod() - { + {info(print_r($this->getPaymentMethod(),1)); - $class = self::$methods[$this->getPaymentMethodId()]; + $class = self::$methods[$this->getPaymentMethod()]; $this->payment_method = new $class($this); diff --git a/app/PaymentDrivers/BaseDriver.php b/app/PaymentDrivers/BaseDriver.php index ea9338c339b5..e928eabb2fe3 100644 --- a/app/PaymentDrivers/BaseDriver.php +++ b/app/PaymentDrivers/BaseDriver.php @@ -51,7 +51,7 @@ class BaseDriver extends AbstractPaymentDriver public $payment_method; - public $methods = []; + public static $methods = []; public function __construct(CompanyGateway $company_gateway, Client $client = null, $invitation = false) { @@ -101,8 +101,10 @@ class BaseDriver extends AbstractPaymentDriver * * @param int $payment_method_id The Payment Method ID */ - public function setPaymentMethod($method_id) + public function setPaymentMethod($payment_method_id) { + info("setting payment method {$payment_method_id}"); + $this->payment_method_id = $payment_method_id; return $this; @@ -115,6 +117,6 @@ class BaseDriver extends AbstractPaymentDriver */ public function getPaymentMethod() { - return $this->payment_method; + return $this->payment_method_id; } } diff --git a/resources/views/portal/ninja2020/gateways/authorize/credit_card_payment.blade.php b/resources/views/portal/ninja2020/gateways/authorize/credit_card_payment.blade.php index 5b0a6fc04a98..220880a104c0 100644 --- a/resources/views/portal/ninja2020/gateways/authorize/credit_card_payment.blade.php +++ b/resources/views/portal/ninja2020/gateways/authorize/credit_card_payment.blade.php @@ -15,6 +15,8 @@ + +
@@ -38,15 +40,19 @@
- +
@else + @endif