@@ -5,20 +5,47 @@ class Lybe_Budbee_Helper_Data extends Mage_Core_Helper_Abstract
5
5
6
6
const BUDBEE_PRICE_XPATH = 'carriers/lybe_budbee/budbee_price ' ;
7
7
const BUDBEE_ACTIVE_XPATH = 'carriers/lybe_budbee/active ' ;
8
- const BUDBEE_API_USERNAME = 'carriers/lybe_budbee/budbee_username ' ;
9
- const BUDBEE_API_PASSWORD = 'carriers/lybe_budbee/budbee_password ' ;
8
+ const BUDBEE_API_KEY = 'carriers/lybe_budbee/budbee_username ' ;
9
+ const BUDBEE_API_SECRET_KEY = 'carriers/lybe_budbee/budbee_password ' ;
10
10
11
11
const CONFIGURABLE_PRODUCT_TYPE = 'configurable ' ;
12
12
const SIMPLE_PRODUCT_TYPE = 'simple ' ;
13
13
14
- public function getPrice ()
14
+ const BUDBEE_LIVE_URL = 'https://api.budbee.com ' ; // Production url
15
+ const BUDBEE_SANDBOX_URL = 'http://sandbox.api.budbee.com ' ; // Sandbox url
16
+ const BUDBEE_LOCALHOST_URL = "http://localhost:9300 " ; // Internal development
17
+
18
+ public function getPrice ($ store = null )
19
+ {
20
+ return Mage::getStoreConfig (self ::BUDBEE_PRICE_XPATH , $ store );
21
+ }
22
+
23
+ public function isEnabled ($ store = null )
24
+ {
25
+ return Mage::getStoreConfig (self ::BUDBEE_ACTIVE_XPATH , $ store );
26
+ }
27
+
28
+ public function getBudbeeApiKey ($ store = null )
29
+ {
30
+ return Mage::getStoreConfig (self ::BUDBEE_API_KEY , $ store );
31
+ }
32
+
33
+ public function getBudbeeApiSecretKey ($ store = null )
15
34
{
16
- return Mage::getStoreConfig (self ::BUDBEE_PRICE_XPATH );
35
+ return Mage::getStoreConfig (self ::BUDBEE_API_SECRET_KEY , $ store );
17
36
}
18
37
19
- public function isEnabled ( )
38
+ public function getSandBoxMode ( $ development = false , $ store = null )
20
39
{
21
- return Mage::getStoreConfig (self ::BUDBEE_ACTIVE_XPATH );
40
+ $ res = SELF ::BUDBEE_LIVE_URL ;
41
+ if (Mage::getStoreConfig ('carriers/lybe_budbee/budbee_sandbox ' , $ store )) {
42
+ $ res = SELF ::BUDBEE_SANDBOX_URL ;
43
+ }
44
+
45
+ if ($ development )
46
+ $ res = SELF ::BUDBEE_LOCALHOST_URL ;
47
+
48
+ return $ res ;
22
49
}
23
50
24
51
public function _isShippable ($ items )
@@ -37,4 +64,12 @@ public function _isShippable($items)
37
64
}
38
65
return true ;
39
66
}
67
+
68
+ public function formatDesiredDeliveryDate ($ string ){
69
+ $ date = explode (": " ,$ string );
70
+ $ start_date = date ('Y-m-d H:i ' , $ date [0 ]);
71
+ $ end_date = date ('H:i ' , $ date [1 ]);
72
+
73
+ return $ start_date . " - " .$ end_date ;
74
+ }
40
75
}
0 commit comments