Skip to content

Commit

Permalink
Merge pull request #86 from hugofintecture/3.4.1
Browse files Browse the repository at this point in the history
3.4.1
  • Loading branch information
hugofintecture authored Dec 13, 2023
2 parents a2fcc45 + 07277e7 commit a342c93
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 76 deletions.
66 changes: 0 additions & 66 deletions Block/CustomLogo.php

This file was deleted.

16 changes: 9 additions & 7 deletions Controller/Standard/PaymentCreated.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,36 +40,39 @@ public function execute()

if (!in_array($params['type'], self::ALLOWED_WEBHOOK_TYPES)) {
$result->setContents('invalid_webhook_type');

return $result;
}

$order = $this->fintectureHelper->getOrderBySessionId($params['sessionId']);
$isRefund = !empty($params['refundedSessionId']);

$sessionId = $isRefund ? $params['refundedSessionId'] : $params['sessionId'];

$order = $this->fintectureHelper->getOrderBySessionId($sessionId);
if (!$order) {
$this->fintectureLogger->error('Webhook', [
'message' => 'No order found',
'state' => $params['state'],
'status' => $params['status'],
'sessionId' => $params['sessionId'],
'sessionId' => $sessionId,
]);
$result->setHttpResponseCode(400);
$result->setContents('invalid_order');

return $result;
}

try {
$isRefund = !empty($params['refundedSessionId']);
if ($isRefund) {
$decodedState = json_decode(base64_decode($params['state']));
if (property_exists($decodedState, 'creditmemo_transaction_id')) {
return $this->refund($order, $params['status'], $decodedState->creditmemo_transaction_id);
} else {
$this->fintectureLogger->error('Webhook', [
'message' => 'No order found',
'message' => 'No credit memo id found',
'state' => $params['state'],
'status' => $params['status'],
'sessionId' => $params['sessionId'],
]);
$result->setHttpResponseCode(400);
$result->setContents('invalid_refund');
}
} else {
Expand Down Expand Up @@ -184,7 +187,6 @@ private function refund(Order $order, string $status, string $creditmemoTransact
$result->setContents('refund_not_applied');
}
} else {
$result->setHttpResponseCode(400);
$result->setContents('invalid_refund_status');
}

Expand Down
2 changes: 1 addition & 1 deletion Gateway/Config/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
class Config extends BaseConfig
{
const CODE = 'fintecture';
const VERSION = '3.4.0';
const VERSION = '3.4.1';

const KEY_SHOP_NAME = 'general/store_information/name';
const KEY_ACTIVE = 'active';
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"email": "[email protected]"
},
"type": "magento2-module",
"version": "3.4.0",
"version": "3.4.1",
"license": [
"GPL-3.0"
],
Expand Down
2 changes: 1 addition & 1 deletion etc/module.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Fintecture_Payment" setup_version="3.4.0">
<module name="Fintecture_Payment" setup_version="3.4.1">
<sequence>
<module name="Magento_Sales"/>
<module name="Magento_Payment"/>
Expand Down

0 comments on commit a342c93

Please sign in to comment.