merchant_authentication = new MerchantAuthenticationType(); $this->merchant_authentication->setName($this->company_gateway->getConfigField('apiLoginId')); $this->merchant_authentication->setTransactionKey($this->company_gateway->getConfigField('transactionKey')); return $this; } public function getPublicClientKey() { $request = new GetMerchantDetailsRequest(); $request->setMerchantAuthentication($this->merchant_authentication); $controller = new GetMerchantDetailsController($request); $response = $controller->executeWithApiResponse($this->mode()); return $response->getPublicClientKey(); } public function mode() { if($this->company_gateway->getConfigField('testMode')) return ANetEnvironment::SANDBOX; return $env = ANetEnvironment::PRODUCTION; } public function authorizeView($payment_method) { return (new AuthorizePaymentMethod($this))->authorizeView($payment_method); } public function authorizeResponseView(array $data) { return (new AuthorizePaymentMethod($this))->authorizeResponseView($data['gateway_type_id'], $data); } public function authorize($payment_method) { return $this->authorizeView($payment_method); } public function purchase($amount, $return_client_response = false) { return () } public function refund($amount, $transaction_reference, $return_client_response = false) { } public function findClientGatewayRecord() :?ClientGatewayToken { return ClientGatewayToken::where('client_id', $this->client->id) ->where('company_gateway_id', $this->company_gateway->id) ->first(); } }