diff --git a/Block/Form.php b/Block/Form.php deleted file mode 100644 index 65af4c5..0000000 --- a/Block/Form.php +++ /dev/null @@ -1,10 +0,0 @@ -request = $request; diff --git a/Model/Payment.php b/Model/Payment.php index 8efa180..e9b0298 100644 --- a/Model/Payment.php +++ b/Model/Payment.php @@ -63,7 +63,6 @@ class Payment implements MethodInterface */ protected $_logger; - /** * Payment constructor. * @param ScopeConfigInterface $scopeConfigInterface @@ -122,6 +121,7 @@ public function setStore($storeId) public function getStore() { // TODO: Implement getStore() method. + return \Magento\Store\Model\Store::DEFAULT_STORE_ID; } /** @@ -213,6 +213,7 @@ public function canUseCheckout() public function canEdit() { // TODO: Implement canEdit() method. + return false; } /** @@ -221,6 +222,7 @@ public function canEdit() public function canFetchTransactionInfo() { // TODO: Implement canFetchTransactionInfo() method. + return true; } /** @@ -305,6 +307,7 @@ public function setInfoInstance(InfoInterface $info) public function validate() { // TODO: Implement validate() + return $this; } /** @@ -328,13 +331,12 @@ public function getClient($payment, $order, $amount, $transactionType = self::RE $endpoint = $this->getPaymentUrl() . 'charges'; $method = \Zend_Http_Client::POST; - if($transactionType === self::REQUEST_TYPE_CAPTURE_ONLY) - { + if ($transactionType === self::REQUEST_TYPE_CAPTURE_ONLY) { $endpoint .= '/' . $payment->getCcTransId() . '/capture'; $method = \Zend_Http_Client::PUT; } - $client->setAuth($this->getConfigData('secret_key'), $order->getStoreId()); + $client->setAuth($this->getConfigData('secret_key', $order->getStoreId())); $client->setConfig(['maxredirects' => 0, 'timeout' => 30]); $client->setUri($endpoint); $client->setMethod($method); @@ -343,11 +345,9 @@ public function getClient($payment, $order, $amount, $transactionType = self::RE * A capture-only request requires amount value as the only parameter. * Note: the charge token is part of the URL. */ - if($transactionType === self::REQUEST_TYPE_CAPTURE_ONLY) - { - $data = ['amount' => $this->_pinHelper->getRequestAmount($order->getBaseCurrencyCode(),$amount)]; - } - else{ + if ($transactionType === self::REQUEST_TYPE_CAPTURE_ONLY) { + $data = ['amount' => $this->_pinHelper->getRequestAmount($order->getBaseCurrencyCode(), $amount)]; + } else { $capture = $transactionType === self::REQUEST_TYPE_AUTH_CAPTURE; $data = $this->_buildAuthRequest($order, $payment, $amount, $capture); } @@ -403,8 +403,7 @@ public function capture(\Magento\Payment\Model\InfoInterface $payment, $amount) $order = $payment->getOrder(); $transactionType = self::REQUEST_TYPE_AUTH_CAPTURE; - if($payment->getCcTransId()) - { + if ($payment->getCcTransId()) { $transactionType = self::REQUEST_TYPE_CAPTURE_ONLY; } $client = $this->getClient($payment, $order, $amount, $transactionType); @@ -431,8 +430,7 @@ protected function _handleResponse($response, $payment) */ $result = new Result($response); $error = $result->getError(); - if ($result->isSuccess()) - { + if ($result->isSuccess()) { $payment->setCcTransId($result->getToken()); $payment->setTransactionId($result->getToken()); } elseif ($error) { @@ -450,10 +448,9 @@ protected function _handleResponse($response, $payment) protected function _buildAuthRequest($order, $payment, $amount, $capture = true) { $descPrefix = $this->getConfigData('description_prefix', $order->getStoreId()); - if(is_null($descPrefix)) { + if (is_null($descPrefix)) { $descPrefix = ''; - } - else{ + } else { $descPrefix = $descPrefix . ' '; } return [ diff --git a/etc/adminhtml/system.xml b/etc/adminhtml/system.xml index 3f2b8d0..6e40872 100644 --- a/etc/adminhtml/system.xml +++ b/etc/adminhtml/system.xml @@ -18,8 +18,9 @@ - + + Magento\Config\Model\Config\Backend\Encrypted diff --git a/etc/config.xml b/etc/config.xml index 6e0017c..8916539 100644 --- a/etc/config.xml +++ b/etc/config.xml @@ -9,6 +9,7 @@ 1 1 authorize_capture + diff --git a/view/frontend/templates/form.phtml b/view/frontend/templates/form.phtml deleted file mode 100644 index e69de29..0000000