Skip to content

Commit 499efa3

Browse files
Merge pull request #17 from AppInlet/release/2.7.0
[2.7.0]
2 parents 5ee25fb + 205395c commit 499efa3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+171
-274
lines changed

CHANGELOG.md

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,27 @@
11
# Changelog
22

3-
## [[2.6.0]](https://github.com/Payfast/mod-magento_2/releases/tag/v2.6.0)
3+
## [[2.7.0]](https://github.com/Payfast/magento-aggregation/releases/tag/v2.7.0)
4+
5+
### Added
6+
7+
- Added support for Magento 2.4.8+ and PHP 8.4.
8+
- Updated Common Library to version 1.4.0.
9+
- Updated branding to use the Payfast by Network logo.
10+
- Revised configuration branding to Payfast Aggregation.
11+
12+
## [[2.6.0]](https://github.com/Payfast/magento-aggregation/releases/tag/v2.6.0)
413

514
### Added
615

716
- Update for Magento 2.4.7+ and PHP 8.2.
817

9-
## [[2.5.1]](https://github.com/Payfast/mod-magento_2/releases/tag/v2.5.1)
18+
## [[2.5.1]](https://github.com/Payfast/magento-aggregation/releases/tag/v2.5.1)
1019

1120
### Fixed
1221

1322
- Dynamic creation of properties error (php 8.2+).
1423

15-
## [[2.5.0]](https://github.com/Payfast/mod-magento_2/releases/tag/v2.5.0)
24+
## [[2.5.0]](https://github.com/Payfast/magento-aggregation/releases/tag/v2.5.0)
1625

1726
### Added
1827

@@ -23,7 +32,7 @@
2332

2433
- Bug fixes and code quality improvements.
2534

26-
## [[2.4.1]](https://github.com/Payfast/mod-magento_2/releases/tag/v2.4.1)
35+
## [[2.4.1]](https://github.com/Payfast/magento-aggregation/releases/tag/v2.4.1)
2736

2837
### Added
2938

@@ -43,7 +52,7 @@
4352

4453
- Update branding.
4554

46-
## [[2.4.0]](https://github.com/Payfast/mod-magento_2/releases/tag/v2.4.0)
55+
## [[2.4.0]](https://github.com/Payfast/magento-aggregation/releases/tag/v2.4.0)
4756

4857
### Added
4958

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
# mod-magento_2
1+
# magento-aggregation
22

3-
## Payfast module v2.6.0 for Magento v2.4.7
3+
## Payfast Aggregation module v2.7.0 for Magento v2.4.8
44

5-
This is the Payfast module for Magento 2. Please feel free
5+
This is the Payfast Aggregation module for Magento 2. Please feel free
66
to [contact the Payfast support team](https://payfast.io/contact/) should you require any assistance.
77

88
## Installation
@@ -14,7 +14,7 @@ to [contact the Payfast support team](https://payfast.io/contact/) should you re
1414
3. You will now need to run the following commands in the given order:
1515

1616
```
17-
composer require payfast/payfast-common:v1.1.0
17+
composer require payfast/payfast-common:v1.4.0
1818
php ./bin/magento module:enable Payfast_Payfast
1919
php ./bin/magento setup:di:compile
2020
php ./bin/magento setup:static-content:deploy

app/code/Payfast/Payfast/Block/Form.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
/**
3-
* Copyright (c) 2024 Payfast (Pty) Ltd
3+
* Copyright (c) 2025 Payfast (Pty) Ltd
44
*/
55

66
namespace Payfast\Payfast\Block;
@@ -13,9 +13,6 @@
1313
use Payfast\Payfast\Model\ConfigFactory;
1414
use Payfast\Payfast\Model\PayfastConfigProvider;
1515

16-
/**
17-
* Form class
18-
*/
1916
class Form extends \Magento\Payment\Block\Form
2017
{
2118
/**

app/code/Payfast/Payfast/Block/Info.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@
55
use Magento\Framework\Phrase;
66
use Magento\Payment\Block\ConfigurableInfo;
77

8-
/**
9-
* Info class
10-
*/
118
class Info extends ConfigurableInfo
129
{
1310
/**

app/code/Payfast/Payfast/Block/Payment/Info.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
/**
3-
* Copyright (c) 2024 Payfast (Pty) Ltd
3+
* Copyright (c) 2025 Payfast (Pty) Ltd
44
*/
55

66
namespace Payfast\Payfast\Block\Payment;

app/code/Payfast/Payfast/Block/Payment/Request.php

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
/**
3-
* Copyright (c) 2024 Payfast (Pty) Ltd
3+
* Copyright (c) 2025 Payfast (Pty) Ltd
44
*/
55

66
namespace Payfast\Payfast\Block\Payment;
@@ -14,9 +14,6 @@
1414
use Payfast\Payfast\Helper\Data;
1515
use Payfast\Payfast\Model\Payfast;
1616

17-
/**
18-
* Request class
19-
*/
2017
class Request extends Template
2118
{
2219

@@ -71,9 +68,9 @@ public function __construct(
7168
$this->_orderFactory = $orderFactory;
7269
$this->_checkoutSession = $checkoutSession;
7370
parent::__construct($context, $data);
74-
$this->readFactory = $readFactory;
75-
$this->reader = $reader;
76-
$this->_paymentMethod = $paymentMethod;
71+
$this->readFactory = $readFactory;
72+
$this->reader = $reader;
73+
$this->_paymentMethod = $paymentMethod;
7774
}
7875

7976
/**

app/code/Payfast/Payfast/Controller/AbstractPayfast.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
/**
3-
* Copyright (c) 2024 Payfast (Pty) Ltd
3+
* Copyright (c) 2025 Payfast (Pty) Ltd
44
*/
55

66
namespace Payfast\Payfast\Controller;

app/code/Payfast/Payfast/Controller/Notify/Index.php

Lines changed: 25 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,6 @@
22

33
namespace Payfast\Payfast\Controller\Notify;
44

5-
/**
6-
* Copyright (c) 2024 Payfast (Pty) Ltd
7-
* You (being anyone who is not Payfast (Pty) Ltd) may download and use this plugin / code in your own website
8-
* in conjunction with a registered and active Payfast account. If your Payfast account is terminated for any reason,
9-
* you may not use this plugin / code or part thereof.
10-
* Except as expressly indicated in this licence, you may not use, copy, modify or distribute this plugin / code or
11-
* part thereof in any way.
12-
*/
13-
145
use Exception;
156
use LogicException;
167
use Magento\Framework\App\Action\HttpPostActionInterface;
@@ -27,11 +18,8 @@
2718
use Payfast\Payfast\Model\Config as PayfastConfig;
2819
use Payfast\Payfast\Model\Info;
2920
use Magento\Framework\Controller\ResultFactory;
30-
use Payfast\PayfastCommon\PayfastCommon;
21+
use Payfast\PayfastCommon\Aggregator\Request\PaymentRequest;
3122

32-
/**
33-
* Index class
34-
*/
3523
class Index extends AbstractPayfast implements CsrfAwareActionInterface, HttpPostActionInterface
3624
{
3725

@@ -42,14 +30,14 @@ class Index extends AbstractPayfast implements CsrfAwareActionInterface, HttpPos
4230
*/
4331
public function execute(): ResultInterface
4432
{
45-
$debugMode = $this->getConfigData('debug');
46-
$payfastCommon = new PayfastCommon((bool)$debugMode);
33+
$debugMode = $this->getConfigData('debug');
34+
$paymentRequest = new PaymentRequest((bool)$debugMode);
4735

4836
$moduleInfo = [
49-
'pfSoftwareName' => 'Magento',
50-
'pfSoftwareVer' => '2.4.7',
37+
'pfSoftwareName' => 'Magento',
38+
'pfSoftwareVer' => '2.4.7',
5139
'pfSoftwareModuleName' => 'Payfast-Magento',
52-
'pfModuleVer' => '2.6.0'
40+
'pfModuleVer' => '2.7.0'
5341
];
5442

5543
$this->_logger->debug('Notify: ' . json_encode($this->request->getPostValue()));
@@ -65,9 +53,9 @@ public function execute(): ResultInterface
6553

6654
$pfHost = $this->paymentMethod->getPayfastHost($serverMode);
6755

68-
$payfastCommon->pflog(' Payfast ITN call received');
56+
$paymentRequest->pflog(' Payfast ITN call received');
6957

70-
$payfastCommon->pflog('Server = ' . $pfHost);
58+
$paymentRequest->pflog('Server = ' . $pfHost);
7159

7260
//// Notify Payfast that information has been received
7361
$resultRaw = $this->resultFactory->create(ResultFactory::TYPE_RAW);
@@ -87,58 +75,58 @@ public function execute(): ResultInterface
8775

8876
//// Get data sent by Payfast
8977
// Posted variables from ITN
90-
$pfData = PayfastCommon::pfGetData();
78+
$pfData = $paymentRequest->pfGetData();
9179

9280
if (empty($pfData)) {
9381
$pfError = true;
94-
$pfErrMsg = PayfastCommon::PF_ERR_BAD_ACCESS;
82+
$pfErrMsg = $paymentRequest::PF_ERR_BAD_ACCESS;
9583
}
9684

9785
//// Verify security signature
9886
if (!$pfError) {
99-
$payfastCommon->pflog('Verify security signature');
87+
$paymentRequest->pflog('Verify security signature');
10088

10189
// If signature different, log for debugging
102-
if (!$payfastCommon->pfValidSignature(
90+
if (!$paymentRequest->pfValidSignature(
10391
$pfData,
10492
$pfParamString,
10593
$passPhrase
10694
)) {
10795
$pfError = true;
108-
$pfErrMsg = PayfastCommon::PF_ERR_INVALID_SIGNATURE;
96+
$pfErrMsg = $paymentRequest::PF_ERR_INVALID_SIGNATURE;
10997
}
11098
}
11199

112100
//// Get internal order and verify it hasn't already been processed
113101
if (!$pfError) {
114-
$payfastCommon->pflog("Check order hasn't been processed");
102+
$paymentRequest->pflog("Check order hasn't been processed");
115103

116104
// Load order
117105
$orderId = $pfData[Info::M_PAYMENT_ID];
118106

119107
$this->_order = $this->orderFactory->create()->loadByIncrementId($orderId);
120108

121-
$payfastCommon->pflog('order status is : ' . $this->_order->getStatus());
109+
$paymentRequest->pflog('order status is : ' . $this->_order->getStatus());
122110

123111
// Check order is in "pending payment" state
124112
if ($this->_order->getState() !== Order::STATE_PENDING_PAYMENT) {
125-
$pfErrMsg = PayfastCommon::PF_ERR_ORDER_PROCESSED;
113+
$pfErrMsg = $paymentRequest::PF_ERR_ORDER_PROCESSED;
126114
}
127115
}
128116

129117
//// Verify data received
130118
if (!$pfError) {
131-
$payfastCommon->pflog('Verify data received');
119+
$paymentRequest->pflog('Verify data received');
132120

133-
if (!$payfastCommon->pfValidData($moduleInfo, $pfHost, $pfParamString)) {
121+
if (!$paymentRequest->pfValidData($moduleInfo, $pfHost, $pfParamString)) {
134122
$pfError = true;
135-
$pfErrMsg = PayfastCommon::PF_ERR_BAD_ACCESS;
123+
$pfErrMsg = $paymentRequest::PF_ERR_BAD_ACCESS;
136124
}
137125
}
138126

139127
//// Check status and update order
140128
if (!$pfError) {
141-
$payfastCommon->pflog('Check status and update order');
129+
$paymentRequest->pflog('Check status and update order');
142130

143131
// Successful
144132
if ($pfData[Info::PAYMENT_STATUS] === 'COMPLETE') {
@@ -155,7 +143,7 @@ public function execute(): ResultInterface
155143

156144
// If an error occurred
157145
if ($pfError) {
158-
$payfastCommon->pflog('Error occurred: ' . $pfErrMsg);
146+
$paymentRequest->pflog('Error occurred: ' . $pfErrMsg);
159147
$this->_logger->critical($pre . 'Error occured : ' . $pfErrMsg);
160148

161149
return $this->rawResult
@@ -278,11 +266,11 @@ protected function saveInvoice(): void
278266
*/
279267
private function setPaymentAdditionalInformation(array $pfData): void
280268
{
281-
$debugMode = $this->getConfigData('debug');
282-
$payfastCommon = new PayfastCommon((bool)$debugMode);
269+
$debugMode = $this->getConfigData('debug');
270+
$paymentRequest = new PaymentRequest((bool)$debugMode);
283271

284-
$payfastCommon->pflog(__METHOD__ . ' : bof');
285-
$payfastCommon->pflog('Order complete');
272+
$paymentRequest->pflog(__METHOD__ . ' : bof');
273+
$paymentRequest->pflog('Order complete');
286274

287275
try {
288276
// Update order additional payment information

app/code/Payfast/Payfast/Controller/Redirect/Cancel.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
/**
3-
* Copyright (c) 2024 Payfast (Pty) Ltd
3+
* Copyright (c) 2025 Payfast (Pty) Ltd
44
*/
55

66
namespace Payfast\Payfast\Controller\Redirect;

app/code/Payfast/Payfast/Controller/Redirect/Index.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
/**
3-
* Copyright (c) 2024 Payfast (Pty) Ltd
3+
* Copyright (c) 2025 Payfast (Pty) Ltd
44
*/
55

66
namespace Payfast\Payfast\Controller\Redirect;

0 commit comments

Comments
 (0)