Skip to content

Commit 85902cc

Browse files
authored
Merge pull request #98 from RichardCardGate/master
Fix: Instructions cannot be null.
2 parents 0527a8d + 4113de1 commit 85902cc

16 files changed

Lines changed: 61 additions & 35 deletions

File tree

‎Block/Adminhtml/Config/FetchPM.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public function __construct(
4545
*/
4646
protected function _getElementHtml(\Magento\Framework\Data\Form\Element\AbstractElement $element)
4747
{
48-
if (! empty($this->cardgateConfig->getGlobal( 'api_username' ))
48+
if (!empty($this->cardgateConfig->getGlobal('api_username'))
4949
&& ! empty($this->cardgateConfig->getGlobal('api_password'))
5050
&& ! empty($this->cardgateConfig->getGlobal('site_id'))
5151
&& ! empty($this->cardgateConfig->getGlobal('site_key'))

‎Block/Adminhtml/Config/GroupInfo.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,4 +117,4 @@ protected function _isCollapseState($element)
117117

118118
return false;
119119
}
120-
}
120+
}

‎Block/Info/DefaultInfo.php‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
* See LICENSE for license details.
66
*/
77
namespace Cardgate\Payment\Block\Info;
8+
89
/**
910
* Default Checkout template
1011
*
@@ -30,14 +31,14 @@ class DefaultInfo extends \Magento\Payment\Block\Info
3031
/**
3132
* Get instructions text from config
3233
*
33-
* @return null|string
34+
* @return string
3435
*/
3536
public function getInstructions()
3637
{
3738
if ( $this->_instructions === null ) {
3839
$this->_instructions = $this->getInfo()->getAdditionalInformation(
3940
'instructions'
40-
) ?: trim( $this->getMethod()->getConfigData( 'instructions' ) );
41+
).' ' ?: trim( $this->getMethod()->getConfigData( 'instructions' ) ).' ';
4142
}
4243
return $this->_instructions;
4344
}

‎Controller/Payment/Callback.php‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@ public function __construct(
9595
\Cardgate\Payment\Model\Config $config,
9696
\Magento\Framework\Encryption\Encryptor $encryptor,
9797
StockRegistryProviderInterface $stockRegistry
98-
9998
) {
10099
$this->resultFactory = $context->getResultFactory();
101100
$this->_request = $context->getRequest();

‎Controller/Payment/Start.php‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,8 @@ public function __construct(
128128
}
129129

130130
/**
131+
* Initiate CardGate transaction
132+
*
131133
* @return \Magento\Framework\App\ResponseInterface|Redirect|\Magento\Framework\Controller\ResultInterface|void
132134
* @throws \Magento\Framework\Exception\AlreadyExistsException
133135
* @throws \Magento\Framework\Exception\InputException
@@ -317,7 +319,7 @@ public function execute()
317319
// issuer is stored as additional data in the assignData method from Model/PaymentMethod.php.
318320
$payment = $order->getPayment();
319321
$instructions = $this->_cardgateConfig->getValue('instructions', $payment->getOrder()->getStoreId());
320-
$payment->setAdditionalInformation('instructions',$instructions);
322+
$payment->setAdditionalInformation('instructions', $instructions);
321323
$data = $payment->getAdditionalInformation();
322324
if (! empty($data['issuer_id'])) {
323325
$transaction->setIssuer($data['issuer_id']);
@@ -360,7 +362,7 @@ public function execute()
360362
*
361363
* @param Address $oAddress_
362364
* @param \cardgate\api\Consumer $oConsumer_
363-
* @param $sMethod_
365+
* @param string $sMethod_
364366
*
365367
* @return void
366368
*/
@@ -381,7 +383,6 @@ private function _convertAddress(Address &$oAddress_, \cardgate\api\Consumer &$o
381383
}
382384

383385
/**
384-
* /**
385386
* Return checkout quote object
386387
*
387388
* @return \Magento\Quote\Api\Data\CartInterface|\Magento\Quote\Model\Quote

‎Helper/TaxData.php‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public function aroundGetCalculatedTaxes(\Magento\Tax\Helper\Data $taxData, \Clo
6161

6262
// Aggregate taxable items associated with shipping
6363
if ($itemTaxDetail->getType() == \Cardgate\Payment\Model\Total\Fee::TYPE_FEE) {
64-
$taxClassAmount = $this->__aggregateTaxes($taxClassAmount, $itemTaxDetail, $cardgatefeeRatio);
64+
$taxClassAmount = $this->_aggregateTaxes($taxClassAmount, $itemTaxDetail, $cardgatefeeRatio);
6565
}
6666
}
6767
}
@@ -95,7 +95,7 @@ public function aroundGetCalculatedTaxes(\Magento\Tax\Helper\Data $taxData, \Clo
9595
* @param float $ratio
9696
* @return array
9797
*/
98-
private function __aggregateTaxes($taxClassAmount, OrderTaxDetailsItemInterface $itemTaxDetail, $ratio)
98+
private function _aggregateTaxes($taxClassAmount, OrderTaxDetailsItemInterface $itemTaxDetail, $ratio)
9999
{
100100
$itemAppliedTaxes = $itemTaxDetail->getAppliedTaxes();
101101
foreach ($itemAppliedTaxes as $itemAppliedTax) {

‎Model/Config.php‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,15 +65,13 @@ class Config implements ConfigInterface
6565
*/
6666
private static $activePMIDs = [];
6767

68-
69-
7068
/**
7169
* @param MutableScopeConfigInterface $scopeConfig
7270
* @param ConfigResource $configResource
7371
* @param Master $master
7472
* @param SerializerInterface $serializer
75-
* @param $pathPattern
76-
* @param $methodCode
73+
* @param string $pathPattern
74+
* @param string $methodCode
7775
*/
7876
public function __construct(
7977
MutableScopeConfigInterface $scopeConfig,

‎Model/Config/Master.php‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ private function updatePaymentMethods()
188188
}
189189

190190
/**
191-
* get the CardGate Payment methods
191+
* Get the CardGate Payment methods
192192
*
193193
* @return array
194194
*/
@@ -200,7 +200,7 @@ public function getCardgateMethods()
200200
/**
201201
* Get the payment methods
202202
*
203-
* @param $bIncludingNames
203+
* @param bool $bIncludingNames
204204
*
205205
* @return array|int[]|string[]
206206
*/

‎Model/GatewayClient.php‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,15 +82,15 @@ public function __construct(
8282
\cardgate\api\Client::CLIENT_VERSION
8383
);
8484
} catch (\Exception $e) {
85-
/* ignore */
85+
/* ignore */
8686
}
8787
}
8888

8989
/**
9090
* Magic function proxying all calls to the client lib instance.
9191
*
92-
* @param $sMethod_
93-
* @param $aArgs_
92+
* @param string $sMethod_
93+
* @param array|string $aArgs_
9494
*
9595
* @return false|mixed
9696
* @throws GatewayClientException
@@ -126,6 +126,7 @@ public function getSiteKey()
126126

127127
/**
128128
* Get the ip address of the client.
129+
*
129130
* @return string
130131
*/
131132
private function _determineIp()

‎Model/PaymentMethods.php‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ public function isAvailable(\Magento\Quote\Api\Data\CartInterface $quote = null)
124124
$groupId = $quote->getCustomer()->getGroupId();
125125
$loggedInIsGroup = $this->config->loggedInIsGroup($quote->getStoreId());
126126
$isLoggedIn = ($quote->getCustomer()->getId() < 1 ? false : true);
127-
if ( $isLoggedIn ) {
127+
if ($isLoggedIn) {
128128
if ($groupId > 0 && count($aCustomerGroups) > 0 && ! in_array($groupId, $aCustomerGroups)){
129129
return false;
130130
}
@@ -188,6 +188,8 @@ public function getMailingAddress()
188188
* Get fee for quote
189189
*
190190
* @param Quote $quote
191+
* @param Total $total
192+
*
191193
* @return FeeData
192194
*/
193195
public function getFeeForQuote(Quote $quote, Total $total = null)
@@ -296,7 +298,7 @@ public function getInstructions()
296298
/**
297299
* Get Value handler pool
298300
*
299-
* @param $methodCode
301+
* @param mixed $methodCode
300302
*
301303
* @return mixed
302304
*/

0 commit comments

Comments
 (0)