Constructor

@return authorizenet_echeck
351871
function authorizenet_echeck() {
    global $order, $messageStack;
    $this->code = 'authorizenet_echeck';
    $this->enabled = ((MODULE_PAYMENT_AUTHORIZENET_ECHECK_STATUS == 'True') ? true : false); // Whether the module is installed or not
    if (IS_ADMIN_FLAG === true) {
      // Payment module title in Admin
      $this->title = MODULE_PAYMENT_AUTHORIZENET_ECHECK_TEXT_ADMIN_TITLE;
      if ($this->enabled) {
        if (MODULE_PAYMENT_AUTHORIZENET_ECHECK_STATUS == 'True' && (MODULE_PAYMENT_AUTHORIZENET_ECHECK_LOGIN == 'testing' || MODULE_PAYMENT_AUTHORIZENET_ECHECK_TXNKEY == 'Test')) {
          $this->title .=  '<span class="alert"> (Not Configured)</span>';
        } elseif (MODULE_PAYMENT_AUTHORIZENET_ECHECK_TESTMODE == 'Test') {
          $this->title .= '<span class="alert"> (in Testing mode)</span>';
        }
        if ($this->enabled && !function_exists('curl_init')) $messageStack->add_session(MODULE_PAYMENT_AUTHORIZENET_AIM_TEXT_ERROR_CURL_NOT_FOUND, 'error');
        if (strlen(MODULE_PAYMENT_AUTHORIZENET_ECHECK_MD5HASH) > 20) $this->title .= '<span class="alert"> (NOTE: MD5 Hash key too long)</span>';
      }
    } else {
      $this->title = MODULE_PAYMENT_AUTHORIZENET_ECHECK_TEXT_CATALOG_TITLE; // Payment module title in Catalog
    }
    $this->description = MODULE_PAYMENT_AUTHORIZENET_ECHECK_TEXT_DESCRIPTION; // Descriptive Info about module in Admin
    $this->sort_order = MODULE_PAYMENT_AUTHORIZENET_ECHECK_SORT_ORDER; // Sort Order of this payment option on the customer payment page
    $this->form_action_url = zen_href_link(FILENAME_CHECKOUT_PROCESS, '', 'SSL', false); // Page to go to upon submitting page info
    $this->order_status = (int)DEFAULT_ORDERS_STATUS_ID;
    if ((int)MODULE_PAYMENT_AUTHORIZENET_ECHECK_ORDER_STATUS_ID > 0) {
      $this->order_status = (int)MODULE_PAYMENT_AUTHORIZENET_ECHECK_ORDER_STATUS_ID;
    }

    $this->_logDir = defined('DIR_FS_LOGS') ? DIR_FS_LOGS : DIR_FS_SQL_CACHE;

    if (is_object($order)) $this->update_status();

    // verify table structure
    if (IS_ADMIN_FLAG === true) $this->tableCheckup();
  }
71921
private function instantiateAuthentication()
    {
        foreach ((array) $this->getConfig('auth.bindings', []) as $binding) {
            $this->auths[] = $this->make($binding);
        }
    }
857500
public function authorize()
    {
        $response = new Response();

        /** @var Response $response */
        $response = $this->oauthServer->handleAuthorizeRequest(Request::createFromGlobals(), $response, true);
        if (!$response->getParameters()) {
            $code = substr(
                $response->getHttpHeader('Location'),
                strpos($response->getHttpHeader('Location'), 'code=') + 5,
                40
            );
            return $this->response->sendSuccess(['code' => $code]);
        } else {
            return $this->response->sendError(
                ResponseCodes::AUTH_ERROR,
                $response->getStatusCode(),
                $response->getParameter('error_description')
            );
        }
    }
118296
private function initContext()
    {
        //request instance;
        $req=new Request();

        //request headers
        $req->headers=[];
        foreach ($_SERVER as $name => $value){
            if(strpos($name, "HTTP_")===0){
                $key=str_replace(" ", "-", ucwords(str_replace("_", " ", substr(strtolower($name), 5))));
                $req->headers[$key]=$value;
            }
        }
        if (isset($_SERVER["PHP_AUTH_DIGEST"])) {
            $req->headers["Authorization"] = $_SERVER["PHP_AUTH_DIGEST"];
        } elseif (isset($_SERVER["PHP_AUTH_USER"]) && isset($_SERVER["PHP_AUTH_PW"])) {
            $req->headers["Authorization"] = base64_encode($_SERVER["PHP_AUTH_USER"] . ":" . $_SERVER["PHP_AUTH_PW"]);
        }
        if (isset($_SERVER["CONTENT_LENGTH"])) {
            $req->headers["Content-Length"] = $_SERVER["CONTENT_LENGTH"];
        }
        if (isset($_SERVER["CONTENT_TYPE"])) {
            $req->headers["Content-Type"] = $_SERVER["CONTENT_TYPE"];
        }
        $req->charset=array_key_exists("HTTP_ACCEPT_CHARSET", $req->headers)?$req->headers["HTTP_ACCEPT_CHARSET"]:"utf-8";
        $req->contentType=array_key_exists("CONTENT_TYPE", $req->headers)?$req->headers["CONTENT_TYPE"]:"text/html";
        $req->contentLength=array_key_exists("CONTENT_LENGTH", $req->headers)?$req->headers["CONTENT_LENGTH"]:0;

        $req->method=$_SERVER["REQUEST_METHOD"];
        $req->protocol=$_SERVER["SERVER_PROTOCOL"];
        $req->scheme=$_SERVER["REQUEST_SCHEME"];
        $req->host=$_SERVER["HTTP_HOST"];
        $req->port=$_SERVER["SERVER_PORT"];
        $req->uri=$_SERVER["REQUEST_URI"];
        $req->get=$_GET;
        $req->post=$_POST;

        //response
        $rsp=new Response();
        $rsp->setCharset($req->charset);

        //context
        $this->m_context=new Context($req,$rsp);
    }
113767
public function createRequest()
    {
        $this->crt = new SignedCertificate();
        $this->crt->setPrivateKey(openssl_pkey_new($this->certConfigure));

        $privKey = $this->crt->getPrivateKey();
        $this->crt->setCsr(openssl_csr_new($this->domainName()->get(), $privKey, $this->certConfigure));

        $request = json_encode([
            'csr' => $this->crt->getCsr()
        ]);

        // Send CSR to server and wait for signing
        $response = $this->signWithServer($request);
        $response = json_decode($response);
        $this->crt->setSignedCert(openssl_x509_read($response->certificate));

        return $this;
    }
62595
protected function createClient()
    {
        $this->client = new OAuthServer([
            'identifier' => Configuration::get('key'),
            'secret' => Configuration::get('secret'),
            'callback_uri' => Configuration::get('callbackUrl'),
            'name' => Configuration::get('name'),
            'expiration' => Configuration::get('expiration'),
            'scope' => Configuration::get('scope'),
        ]);

        return $this;
    }
1193117
public function createNonce()
    {
        $secret  = $this->getSecret();
        $timeout = $this->getLifetime();

        $nonce = $this->_createNonce($secret, $timeout);
        $this->nonces[$nonce] = $nonce;

        return $nonce;
    }
1088115
public function create()
    {
        $serviceId = $this->container->getParameter('graviton.security.authentication.provider.model');
        $service = $this->container->get('graviton.security.authentication.provider.model.noop');

        if (!empty($serviceId) && $this->container->has($serviceId)) {
            $service = $this->container->get($serviceId);
        }

        return $service;
    }
1121088
protected function _auth()
    {
        if ($this->_helo == false) {
            throw new SMTPException(__('Must call EHLO (or HELO) before calling AUTH'));
        } elseif ($this->_auth !== false) {
            throw new SMTPException(__('Can not call AUTH again.'));
        }

        $this->_send('AUTH LOGIN');
        $this->_expect(334);
        $this->_send(base64_encode($this->_user));
        $this->_expect(334);
        $this->_send(base64_encode($this->_pass));
        $this->_expect(235);
        $this->_auth = true;
    }
1255311
private function init()
    {
        $this->curl = curl_init();
        $this->setUserAgent(self::USER_AGENT);
        $this->setOpt(CURLINFO_HEADER_OUT, true);
        $this->setOpt(CURLOPT_HEADER, false);
        $this->setOpt(CURLOPT_RETURNTRANSFER, true);
        $this->setOpt(CURLOPT_HEADERFUNCTION, array($this, 'addResponseHeaderLine'));
        return $this;
    }
1033963
public function create()
    {
        // @codeCoverageIgnoreStart
        if (!empty($this->ch)) {
            curl_close($this->ch);
        }
        // @codeCoverageIgnoreEnd

        // Instantiate cURL object
        $this->ch = curl_init();

        // Apply authentication headers
        $this->authenticate();
    }
664052
protected function createClient()
    {
        $client = new MultiCurl();
        $client->setVerifyPeer(false);

        $this->serviceClient = new Browser($client);

        return $this;
    }
1011090
public function createDefaultHttpClient()
    {
        $stack = HandlerStack::create();

        $middleware = new Oauth1([
            'consumer_key'    => $this->consumerKey,
            'consumer_secret' => $this->consumerSecret,
            'token'           => $this->token,
            'token_secret'    => $this->tokenSecret
        ]);

        $stack->push($middleware);

        return new HttpClient([
            'handler' => $stack
        ]);
    }
1182985
public function create()
    {
      $data = Ensure::Input(func_get_args());
      $url = URIResource::Make($this->path);
      $id = Locator::Find($this->client->post($url, $data->get()));
      $data->add("id", $id);

      return Constructor::Make($this, $data->get(), TRUE);
    }
550355
function signIn()
    {
        if ( (null === $identity = $this->identity) || !$identity->isFulfilled() )
            throw new \Exception('Identity not exists or not fullfilled');

        $identity = serialize($identity);
        $this->_storage()->set(self::STORAGE_IDENTITY_KEY , $identity);
        return $this;
    }
220111
public function authorize()
    {
        $path = $this->endpoint.self::OAUTH_TOKEN;
        $headers = ['Content-Type' => 'application/x-www-form-urlencoded'];
        $body = [
            'client_id'     => $this->client_id,
            'client_secret' => $this->client_secret,
            'grant_type'    => self::GRANT_TYPE,
            'code'          => $this->code,
            'redirect_uri'  => $this->redirect_uri,
        ];

        try {
            $http_response = $this->createNewSession()->request($path, $headers, $body, 'POST');
        } catch (Requests_Exception $e) {
            throw new UnexpectedException($e);
        }

        if ($http_response->status_code >= 200 && $http_response->status_code < 300) {
            return json_decode($http_response->body);
        } elseif ($http_response->status_code >= 400 && $http_response->status_code <= 499) {
            throw new ValidationException($http_response->status_code, $http_response->body);
        }

        throw new UnexpectedException();
    }
1035377
protected function newSecurity()
    {
        $config = $this->config->getCurrentResourceConfiguration();

        return new Security(
            new SimpleAuthenticationBouncer($config),
            new SimpleRoleBouncer($config),
            new ParentBouncer($config)
        );
    }