Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
has-well committed Jun 26, 2019
1 parent 2c11e0e commit 7ec1935
Show file tree
Hide file tree
Showing 12 changed files with 34 additions and 31 deletions.
2 changes: 1 addition & 1 deletion Api/ApiInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ interface ApiInterface
* @return string
*/
public function getToken($cartId, $method);
}
}
4 changes: 2 additions & 2 deletions Api/Token.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ public function getToken($cartId, $method)
'response_url' => $this->urlBuilder->getUrl('checkout/onepage/success'),
'currency' => $this->_checkoutSession->getQuote()->getCurrency()->getBaseCurrencyCode()
];
if(!empty($merchant_data))
if (!empty($merchant_data))
$requestData['merchant_data'] = $merchant_data;
$sign = $this->getSignature($requestData, $decrypted_key);
$requestData['signature'] = $sign;
Expand Down Expand Up @@ -230,4 +230,4 @@ private function getSignature($data, $password, $encoded = true)
return $str;
}
}
}
}
5 changes: 2 additions & 3 deletions Block/Widget/Redirect.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,8 @@ public function getAmount()


/**
* Get forma data
*
* @return array|null
* @throws \Magento\Framework\Exception\LocalizedException
*/
public function getPostData()
{
Expand All @@ -125,7 +124,7 @@ public function getPostData()
/**
* Get callback URL
*
* @return array
* @return string
*/
public function getPayUrl()
{
Expand Down
7 changes: 3 additions & 4 deletions Controller/Url/FondySuccess.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function __construct(
*/
public function createCsrfValidationException(
RequestInterface $request
): ?InvalidRequestException
): InvalidRequestException
{
return null;
}
Expand All @@ -51,15 +51,14 @@ public function createCsrfValidationException(
* @param RequestInterface $request
* @return bool|null
*/
public function validateForCsrf(RequestInterface $request): ?bool
public function validateForCsrf(RequestInterface $request): bool
{
return true;
}

/**
* @return \Magento\Framework\App\ResponseInterface|\Magento\Framework\Controller\Result\Json|\Magento\Framework\Controller\ResultInterface
* Load the page defined
*
* @return \Magento\Framework\View\Result\Page
*/
public function execute()
{
Expand Down
4 changes: 2 additions & 2 deletions Controller/Url/Submit.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public function execute()
*/
public function createCsrfValidationException(
RequestInterface $request
): ?InvalidRequestException
): InvalidRequestException
{
return null;
}
Expand All @@ -67,7 +67,7 @@ public function createCsrfValidationException(
* @param RequestInterface $request
* @return bool|null
*/
public function validateForCsrf(RequestInterface $request): ?bool
public function validateForCsrf(RequestInterface $request): bool
{
return true;
}
Expand Down
2 changes: 1 addition & 1 deletion Model/Config/Source/Order/Status/Pendingpayment.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ class Pendingpayment extends Status
/**
* @var string[]
*/
protected $_stateStatuses = [Order::STATE_PENDING_PAYMENT];
public $_stateStatuses = [Order::STATE_PENDING_PAYMENT];
}
27 changes: 16 additions & 11 deletions Model/Fondy.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,10 +160,9 @@ public function getCurrencyCode($orderId)

/**
* Check whether payment method can be used with selected shipping method
* (Проверка возможности доставки)
*
* @param string $shippingMethod
* @param $shippingMethod
* @return bool
* @throws \Magento\Framework\Exception\LocalizedException
*/
protected function isCarrierAllowed($shippingMethod)
{
Expand All @@ -186,10 +185,9 @@ protected function isCarrierAllowed($shippingMethod)

/**
* Check whether payment method can be used
* (Проверка на доступность метода оплаты)
*
* @param CartInterface|null $quote
* @return bool
* @throws \Magento\Framework\Exception\LocalizedException
*/
public function isAvailable(\Magento\Quote\Api\Data\CartInterface $quote = null)
{
Expand Down Expand Up @@ -222,10 +220,10 @@ public function getDataIntegrityCode()


/**
* Получить массив параметр для формы оплаты
*
* Get form array
* @param $orderId
* @return array
* @throws \Magento\Framework\Exception\LocalizedException
*/
public function getPostData($orderId)
{
Expand All @@ -252,10 +250,10 @@ public function getPostData($orderId)
}

/**
* Проверить данные ответного запроса (callback URL)
*
* Checking callback data
* @param $response
* @return bool
* @throws \Magento\Framework\Exception\LocalizedException
*/
private function checkFondyResponse($response)
{
Expand Down Expand Up @@ -284,6 +282,7 @@ private function checkFondyResponse($response)
/**
* @param $responseData
* @return string
* @throws \Magento\Framework\Exception\LocalizedException
*/
public function processResponse($responseData)
{
Expand Down Expand Up @@ -375,6 +374,11 @@ public function isPaymentValid($fondySettings, $response)
return true;
}

/**
* @param null $order
* @param array $paymentData
* @return mixed
*/
public function createTransaction($order = null, $paymentData = array())
{
try {
Expand Down Expand Up @@ -412,16 +416,17 @@ public function createTransaction($order = null, $paymentData = array())
$order->save();

return $transaction->save()->getTransactionId();

} catch (\Exception $e) {
$this->_logger->debug("_processOrder exception", $e->getTrace());
return false;
}
}

/**
* @param string $field
* @param null $storeId
* @return mixed
* @throws \Magento\Framework\Exception\LocalizedException
*/
public function getConfigData($field, $storeId = null)
{
Expand All @@ -434,4 +439,4 @@ public function getConfigData($field, $storeId = null)
$path = 'payment/' . $this->_code . '/' . $field;
return $this->_scopeConfig->getValue($path, \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $storeId);
}
}
}
2 changes: 1 addition & 1 deletion Model/FondyDirect.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,4 +138,4 @@ public function canUseForCurrency($currencyCode)
{
return true;
}
}
}
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"fraud"
],
"require": {
"php": "~5.5.0|~5.6.0|~7.0.0|~7.1.0|~7.2.0|~7.3.0"
"php": "~7.0.0|~7.1.0|~7.2.0|~7.3.0"
},
"autoload": {
"files": [ "registration.php" ],
Expand Down
4 changes: 2 additions & 2 deletions registration.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?php
/*
* @author DM
* @copyright 2017 Fondy
* @copyright 2019 Fondy
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License, version 2 (GPL-2.0)
*/
\Magento\Framework\Component\ComponentRegistrar::register(
\Magento\Framework\Component\ComponentRegistrar::MODULE,
'Fondy_Fondy',
__DIR__
);
);
2 changes: 1 addition & 1 deletion view/frontend/templates/form/fondy_form.phtml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php if ($instructions = $block->getMethod()->getInstructions()): ?>
<?php if ( $instructions = $block->getMethod()->getInstructions() ): ?>
<div class="items <?php echo $block->getMethodCode() ?> instructions agreement content" id="payment_form_<?php echo $block->getMethodCode() ?>" style="display: none;">
<?php echo nl2br($block->escapeHtml($instructions)) ?>
</div>
Expand Down
4 changes: 2 additions & 2 deletions view/frontend/templates/html/fondy_form.phtml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<form action="<?php echo $block->getGateUrl(); ?>" method="POST" id="FONDY_payment_form" style="display: none">
<?php if (!is_null($block->getPostData())): ?>
<?php if ( $block->getPostData() !== null ): ?>
<?php foreach ($block->getPostData() as $name => $value): ?>
<input type="hidden" name="<?php echo $block->escapeHtml($name); ?>"
value="<?php echo $block->escapeHtml($value); ?>"/>
<?php endforeach; ?>
<?php endif; ?>
</form>
<button class="action primary" type="submit" form="FONDY_payment_form">Submit</button>
<script type="text/javascript">
<script type="text/x-magento-init">
require(["jquery"], function ($) {
$(document).ready(function () {
setTimeout(function() {$('#FONDY_payment_form').submit(); }, 500);
Expand Down

0 comments on commit 7ec1935

Please sign in to comment.