1
1
<?php
2
2
/**
3
- *
4
3
* ShipperHQ Shipping Module
5
- *
6
4
* NOTICE OF LICENSE
7
- *
8
5
* This source file is subject to the Open Software License (OSL 3.0)
9
6
* that is bundled with this package in the file LICENSE.txt.
10
7
* It is also available through the world-wide-web at this URL:
11
8
* http://opensource.org/licenses/osl-3.0.php
12
9
* If you did not receive a copy of the license and are unable to
13
10
* obtain it through the world-wide-web, please send an email
14
11
* to license@magentocommerce.com so we can send you a copy immediately.
15
- *
16
12
* DISCLAIMER
17
- *
18
13
* Do not edit or add to this file if you wish to upgrade Magento to newer
19
14
* versions in the future. If you wish to customize Magento for your
20
15
* needs please refer to http://www.magentocommerce.com for more information.
21
- *
22
16
* Shipper HQ Shipping
23
- *
24
- * @category ShipperHQ
25
- * @package ShipperHQ_Shipping_Carrier
17
+ * @category ShipperHQ
18
+ * @package ShipperHQ_Shipping_Carrier
26
19
* @copyright Copyright (c) 2015 Zowta LLC (http://www.ShipperHQ.com)
27
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
28
- * @author ShipperHQ Team sales@shipperhq.com
20
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
21
+ * @author ShipperHQ Team sales@shipperhq.com
29
22
*/
30
23
31
24
/**
36
29
namespace ShipperHQ \Shipper \Helper ;
37
30
38
31
use Magento \Framework \App \Config \ScopeConfigInterface ;
32
+ use Magento \Store \Model \ScopeInterface ;
39
33
40
34
/**
41
35
* Shipping data helper
42
36
*/
43
37
class Rest
44
38
{
39
+ /**
40
+ * @var string
41
+ */
45
42
private static $ wsTimeout ;
46
43
47
44
/**
48
45
* @var \ShipperHQ\Lib\Helper\Rest
49
46
*/
50
47
private $ restHelper ;
48
+
51
49
/**
52
50
* @var ScopeConfigInterface
53
51
*/
54
52
private $ config ;
55
- /**
56
- * @var Data $shipperHelperData
57
- */
58
53
59
54
/**
60
55
* @param \ShipperHQ\Lib\Helper\Rest $restHelper
61
- * @param ScopeConfigInterface $config
56
+ * @param ScopeConfigInterface $config
62
57
*/
63
58
public function __construct (
64
59
\ShipperHQ \Lib \Helper \Rest $ restHelper ,
@@ -78,29 +73,28 @@ private function getGatewayUrl()
78
73
{
79
74
$ live = $ this ->cleanUpUrl ($ this ->config ->getValue (
80
75
'carriers/shipper/live_url ' ,
81
- \ Magento \ Store \ Model \ ScopeInterface::SCOPE_STORE
76
+ ScopeInterface::SCOPE_STORE
82
77
));
83
-
84
78
$ test = $ this ->cleanUpUrl ($ this ->config ->getValue (
85
79
'carriers/shipper/url ' ,
86
- \ Magento \ Store \ Model \ ScopeInterface::SCOPE_STORE
80
+ ScopeInterface::SCOPE_STORE
87
81
));
82
+
88
83
return $ this ->config ->isSetFlag (
89
84
'carriers/shipper/sandbox_mode ' ,
90
- \ Magento \ Store \ Model \ ScopeInterface::SCOPE_STORE
85
+ ScopeInterface::SCOPE_STORE
91
86
) ? $ test : $ live ;
92
87
}
93
88
94
89
/**
95
90
* Returns place order endpoint
96
- *
97
91
* @return string
98
92
*/
99
93
private function getPostOrderGatewayUrl ()
100
94
{
101
95
return $ this ->cleanUpUrl ($ this ->config ->getValue (
102
96
'carriers/shipper/postorder_rest_url ' ,
103
- \ Magento \ Store \ Model \ ScopeInterface::SCOPE_STORE
97
+ ScopeInterface::SCOPE_STORE
104
98
));
105
99
}
106
100
@@ -111,6 +105,7 @@ private function cleanUpUrl($urlStart)
111
105
if ($ lastChar != '/ ' ) {
112
106
$ url .= '/ ' ;
113
107
}
108
+
114
109
return $ url ;
115
110
}
116
111
@@ -144,7 +139,6 @@ public function getPlaceorderGatewayUrl()
144
139
/*
145
140
* Retrieve configured timeout for webservice
146
141
*/
147
-
148
142
public function getAttributeGatewayUrl ()
149
143
{
150
144
return $ this ->restHelper ->getAttributeGatewayUrl ();
@@ -160,13 +154,14 @@ public function getWebserviceTimeout()
160
154
if (self ::$ wsTimeout == null ) {
161
155
$ timeout = $ this ->config ->getValue (
162
156
'carriers/shipper/ws_timeout ' ,
163
- \ Magento \ Store \ Model \ ScopeInterface::SCOPE_STORE
157
+ ScopeInterface::SCOPE_STORE
164
158
);
165
159
if (!is_numeric ($ timeout )) {
166
160
$ timeout = 30 ;
167
161
}
168
162
self ::$ wsTimeout = $ timeout ;
169
163
}
164
+
170
165
return self ::$ wsTimeout ;
171
166
}
172
167
}
0 commit comments