Skip to content

Commit 1bc71f8

Browse files
authored
Merge pull request #34 from kodbruket/v.1.3.6
Reset curl options before making a new request
2 parents dc60ecb + 7fc3677 commit 1bc71f8

3 files changed

Lines changed: 25 additions & 2 deletions

File tree

Model/Api/Mondido.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313

1414
namespace Mondido\Mondido\Model\Api;
1515

16+
use Psr\Log\LoggerInterface;
17+
1618
/**
1719
* Abstract Mondido API model
1820
*
@@ -26,6 +28,18 @@ abstract class Mondido
2628
{
2729
protected $_adapter;
2830

31+
/**
32+
* Constructor
33+
*
34+
* @param Psr\Log\LoggerInterface $logger Logger interface
35+
*
36+
* @return void
37+
*/
38+
public function __construct(LoggerInterface $logger)
39+
{
40+
$this->logger = $logger;
41+
}
42+
2943
/**
3044
* Call
3145
*
@@ -40,6 +54,11 @@ public function call($method, $resource, $params = null, $data = [])
4054
{
4155
$url = 'https://api.mondido.com/v1/' . $resource;
4256

57+
/**
58+
* Reset any options potentially set from elsewhere
59+
*/
60+
$this->_adapter->setOptions([]);
61+
4362
if (is_string($params)) {
4463
$url .= "/$params";
4564
} else if (is_array($params)) {
@@ -83,6 +102,10 @@ public function call($method, $resource, $params = null, $data = [])
83102

84103
$userPwd = sprintf("%s:%s", $this->_config->getMerchantId(), $this->_config->getPassword());
85104

105+
$this->logger->debug($method);
106+
$this->logger->debug($url);
107+
$this->logger->debug(var_export($data, true));
108+
86109
$this->_adapter->addOption(CURLOPT_USERPWD, $userPwd)
87110
->addOption(CURLOPT_RETURNTRANSFER, 1)
88111
->addOption(CURLOPT_CONNECTTIMEOUT, 30)

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "mondido/magento2-mondido",
33
"description": "Mondido payment module for Magento 2.",
4-
"version": "1.3.5",
4+
"version": "1.3.6",
55
"type": "magento2-module",
66
"repositories": [
77
{

etc/module.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0"?>
22
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
3-
<module name="Mondido_Mondido" setup_version="1.3.5">
3+
<module name="Mondido_Mondido" setup_version="1.3.6">
44
<sequence>
55
<module name="Magento_Checkout"/>
66
<module name="Magento_Payment"/>

0 commit comments

Comments
 (0)