Bonusbox_Bonusbox1 - Version 1.1.5

Version Notes

* PHPCS and PHPMD checks
* Compatibility of Magento CE 1.7
* Compatibility of Magento EE 1.12

Download this release

Release Info

Developer Jan Riethmayer
Extension Bonusbox_Bonusbox1
Version 1.1.5
Comparing to
See all releases


Code changes from version 1.1.4 to 1.1.5

Files changed (25) hide show
  1. app/code/community/Bonusbox/Bonusbox/Block/Checkout/Success.php +74 -27
  2. app/code/community/Bonusbox/Bonusbox/Exception.php +39 -5
  3. app/code/community/Bonusbox/Bonusbox/Helper/Data.php +234 -170
  4. app/code/community/Bonusbox/Bonusbox/Helper/Successpage.php +83 -32
  5. app/code/community/Bonusbox/Bonusbox/Model/Client.php +235 -169
  6. app/code/community/Bonusbox/Bonusbox/Model/Client/Badges.php +56 -13
  7. app/code/community/Bonusbox/Bonusbox/Model/Client/Coupons.php +70 -27
  8. app/code/community/Bonusbox/Bonusbox/Model/Client/Successpages.php +166 -111
  9. app/code/community/Bonusbox/Bonusbox/Model/Sales/Observer.php +67 -34
  10. app/code/community/Bonusbox/Bonusbox/Model/SalesRule/Condition/Bonusbox.php +145 -87
  11. app/code/community/Bonusbox/Bonusbox/Model/SalesRule/Rule/Condition/Combine.php +87 -0
  12. app/code/community/Bonusbox/Bonusbox/Model/SalesRule/Validator.php +135 -91
  13. app/code/community/Bonusbox/Bonusbox/Model/Session.php +74 -23
  14. app/code/community/Bonusbox/Bonusbox/controllers/TestController.php +62 -16
  15. app/code/community/Bonusbox/Bonusbox/etc/adminhtml.xml +63 -0
  16. app/code/community/Bonusbox/Bonusbox/etc/config.xml +141 -142
  17. app/code/community/Bonusbox/Bonusbox/etc/system.xml +111 -87
  18. app/design/frontend/base/default/layout/bonusbox.xml +38 -0
  19. app/design/frontend/base/default/template/bonusbox/checkout/success.phtml +31 -0
  20. app/design/frontend/default/default/layout/bonusbox.xml +0 -14
  21. app/design/frontend/default/default/template/bonusbox/checkout/success.phtml +0 -1
  22. app/etc/modules/Bonusbox_Bonusbox.xml +33 -6
  23. app/locale/de_DE/bonusbox_admin.csv +1 -0
  24. package.xml +22 -7
  25. skin/frontend/default/default/css/bonusbox.css +35 -0
app/code/community/Bonusbox/Bonusbox/Block/Checkout/Success.php CHANGED
@@ -1,28 +1,75 @@
1
- <?php
2
- class Bonusbox_Bonusbox_Block_Checkout_Success extends Mage_Core_Block_Template
3
- {
4
- protected $_template = 'bonusbox/checkout/success.phtml';
5
-
6
- /**
7
- * Checks if a bonusbox success url exits. After rendering the url is removed from the session.
8
- * Otherwise nothing is rendered.
9
- */
10
- protected function _toHtml()
11
- {
12
- if ($this->getSuccessPageUrl())
13
- {
14
- $html = parent::_toHtml();
15
- Mage::helper('bonusbox')->getSession()->setSuccessPage(null);
16
- return $html;
17
- }
18
- }
19
-
20
- /**
21
- * Retrieves the bonusbox success url from the session.
22
- */
23
- public function getSuccessPageUrl()
24
- {
25
- $successPage = Mage::helper('bonusbox')->getSession()->getSuccessPage();
26
- return isset($successPage['url']) ? $successPage['url'] : null;
27
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
28
  }
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * @category Bonusbox
16
+ * @package Bonusbox_Bonusbox
17
+ * @author symmetrics - a CGI Group brand <info@symmetrics.de>
18
+ * @author Ngoc Anh Doan <ngoc-anh.doan@cgi.com>
19
+ * @copyright 2011-2012 BonusBox GmbH
20
+ * @license http://www.opensource.org/licenses/mit-license.php The MIT License (MIT)
21
+ * @link http://bonusbox.me
22
+ * @link http://github.com/symmetrics/bonusbox_magento
23
+ */
24
+
25
+ /**
26
+ * Block to render iFrame.
27
+ *
28
+ * @category Bonusbox
29
+ * @package Bonusbox_Bonusbox
30
+ * @author symmetrics - a CGI Group brand <info@symmetrics.de>
31
+ * @author Ngoc Anh Doan <ngoc-anh.doan@cgi.com>
32
+ * @copyright 2011-2012 BonusBox GmbH
33
+ * @license http://www.opensource.org/licenses/mit-license.php The MIT License (MIT)
34
+ * @link http://bonusbox.me
35
+ * @link http://github.com/symmetrics/bonusbox_magento
36
+ */
37
+ class Bonusbox_Bonusbox_Block_Checkout_Success extends Mage_Core_Block_Template
38
+ {
39
+ /**
40
+ * Default block template.
41
+ *
42
+ * @var string
43
+ */
44
+ protected $_template = 'bonusbox/checkout/success.phtml';
45
+
46
+ /**
47
+ * Checks if a bonusbox success url exits. After rendering the url is removed
48
+ * from the session. Otherwise nothing is rendered.
49
+ *
50
+ * @return string
51
+ */
52
+ protected function _toHtml()
53
+ {
54
+ $html = '';
55
+
56
+ if ($this->getSuccessPageUrl()) {
57
+ $html = parent::_toHtml();
58
+ Mage::helper('bonusbox')->getSession()->setSuccessPage(null);
59
+ }
60
+
61
+ return $html;
62
+ }
63
+
64
+ /**
65
+ * Retrieves the bonusbox success url from the session.
66
+ *
67
+ * @return string|null
68
+ */
69
+ public function getSuccessPageUrl()
70
+ {
71
+ $successPage = Mage::helper('bonusbox')->getSession()->getSuccessPage();
72
+
73
+ return isset($successPage['url']) ? $successPage['url'] : null;
74
+ }
75
  }
app/code/community/Bonusbox/Bonusbox/Exception.php CHANGED
@@ -1,5 +1,39 @@
1
- <?php
2
- class Bonusbox_Bonusbox_Exception extends Zend_Exception
3
- {
4
-
5
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * @category Bonusbox
16
+ * @package Bonusbox_Bonusbox
17
+ * @author symmetrics - a CGI Group brand <info@symmetrics.de>
18
+ * @author Ngoc Anh Doan <ngoc-anh.doan@cgi.com>
19
+ * @copyright 2011-2012 BonusBox GmbH
20
+ * @license http://www.opensource.org/licenses/mit-license.php The MIT License (MIT)
21
+ * @link http://bonusbox.me
22
+ * @link http://github.com/symmetrics/bonusbox_magento
23
+ */
24
+
25
+ /**
26
+ * Bonusbox module exception class
27
+ *
28
+ * @category Bonusbox
29
+ * @package Bonusbox_Bonusbox
30
+ * @author symmetrics - a CGI Group brand <info@symmetrics.de>
31
+ * @author Ngoc Anh Doan <ngoc-anh.doan@cgi.com>
32
+ * @copyright 2011-2012 BonusBox GmbH
33
+ * @license http://www.opensource.org/licenses/mit-license.php The MIT License (MIT)
34
+ * @link http://bonusbox.me
35
+ * @link http://github.com/symmetrics/bonusbox_magento
36
+ */
37
+ class Bonusbox_Bonusbox_Exception extends Zend_Exception
38
+ {
39
+ }
app/code/community/Bonusbox/Bonusbox/Helper/Data.php CHANGED
@@ -1,171 +1,235 @@
1
- <?php
2
- class Bonusbox_Bonusbox_Helper_Data extends Mage_Core_Helper_Data
3
- {
4
- protected $configCode = 'bonusbox';
5
-
6
- protected $configSection = 'general';
7
-
8
- /**
9
- * Convinience method for access to config data.
10
- * @param string $field
11
- */
12
- public function getConfig($field, $storeId = null)
13
- {
14
- return Mage::getStoreConfig($this->configCode . '/' . $this->configSection . '/' . $field, $storeId);
15
- }
16
-
17
-
18
- public function isEnabled()
19
- {
20
- return $this->getConfig('enabled');
21
- }
22
-
23
-
24
- public function isLive()
25
- {
26
- return $this->getConfig('live');
27
- }
28
-
29
- /**
30
- * Checks if modulke is enabled and if keys are provided
31
- */
32
- public function isOperational()
33
- {
34
- return $this->isEnabled() && $this->getKey('public') && $this->getKey('secret');
35
- }
36
-
37
-
38
- /**
39
- * Returns the key for the selected live mode (live|test) and the given param (public|secret)
40
- * @param bool $secret
41
- */
42
- public function getKey($secret, $storeId = null)
43
- {
44
- $mode = $this->isLive() ? 'live' : 'test';
45
- $type = $secret ? 'secret' : 'public';
46
- return $this->getConfig($mode . '_' . $type . '_key', $storeId);
47
- }
48
-
49
- /**
50
- * If live mode is enabled an email is sent to the configured debug mail address (see config.xml). In test mode an excption is thrown.
51
- * @param string|Exception $message
52
- * @throws Exception
53
- * @throws Mage_Core_Exception
54
- */
55
- public function handleError($message)
56
- {
57
- if ($this->isLive())
58
- {
59
- Mage::log((string)$message);
60
- try {
61
- $mail = new Zend_Mail('utf-8');
62
- $mail
63
- ->setFrom(Mage::getStoreConfig('trans_email/ident_general/email'))
64
- ->addTo($this->getConfig('debug_email'))
65
- ->setSubject('Bonusbox Magento Error')
66
- ->setBodyText((string)$message)
67
- ->send()
68
- ;
69
- }
70
- catch (Exception $ex)
71
- {
72
- Mage::logException($ex);
73
- }
74
- }
75
- else {
76
- Mage::log('TEST ' . (string)$message);
77
- if ($message instanceof Exception)
78
- {
79
- throw $message;
80
- }
81
- else {
82
- require_once 'Bonusbox/Bonusbox/Exception.php';
83
- throw new Bonusbox_Bonusbox_Exception($message);
84
- }
85
- }
86
- }
87
-
88
- /**
89
- * Retrieves an options array with the id, title (incl. the benefit).
90
- * The Badges are cached in the session.
91
- * @TODO refactor and extract to badge helper class
92
- * @return array
93
- */
94
- public function getBadgeOptions()
95
- {
96
- $session = Mage::getSingleton('bonusbox/session');
97
- if (!$session->getData('badge_options'))
98
- {
99
- $secret = true;
100
- foreach (Mage::app()->getGroups() as $storeGroup)
101
- {
102
- $apiKey = $this->getKey($secret, $storeGroup->getDefaultStoreId());
103
- $storeGroups[$apiKey] = $storeGroup;
104
- }
105
-
106
- $client = Mage::getModel('bonusbox/client_badges');
107
- foreach ($storeGroups as $storeGroup)
108
- {
109
- $badges = $client->setStoreId($storeGroup->getDefaultStoreId())->get();
110
- foreach ($badges as $badge)
111
- {
112
- $badge = $badge['badge'];
113
- $label = $badge['title'];
114
- if ($badge['benefit'])
115
- {
116
- $label = sprintf('%s (%s)', $label, $badge['benefit']);
117
- }
118
- if (count($storeGroups) > 1)
119
- {
120
- $label = sprintf('%s - %s', $storeGroup->getName(), $label);
121
- }
122
- $badgeOptions[] = array('value' => $badge['id'], 'label' => $label);
123
- }
124
- }
125
- $session->setData('badge_options', $badgeOptions);
126
- }
127
- return $session->getData('badge_options');
128
- }
129
-
130
- /**
131
- * Checks if coupon code is a valid bonusbox code
132
- * @param string $couponCode
133
- * @return bool
134
- */
135
- public function isValidBonusboxCouponCode($couponCode)
136
- {
137
- $request = new Varien_Object();
138
- $request->setCouponCode($couponCode);
139
- return $this->getCustomerBadge($request) !== null;
140
- }
141
-
142
- /**
143
- * Retrieves the badge id for a given coupon code.
144
- * The response is cached in the session.
145
- * @TODO extract to badge helper class
146
- * @param Varien_Object $quote
147
- * @return int
148
- */
149
- public function getCustomerBadge(Varien_Object $request)
150
- {
151
- $couponCode = $request->getCouponCode();
152
- if ($couponCode)
153
- {
154
- $session = $this->getSession();
155
- if (!$session->getCustomerBadgeByCoupon($couponCode))
156
- {
157
- $response = Mage::getModel('bonusbox/client_coupons')->get($couponCode);
158
- $session->setCustomerBadgeByCoupon($couponCode, isset($response['coupon']['user']['badge']['id']) ? $response['coupon']['user']['badge']['id'] : null);
159
- }
160
- return $session->getCustomerBadgeByCoupon($couponCode);
161
- }
162
- }
163
-
164
- /**
165
- * @return Bonusbox_Bonusbox_Model_Session
166
- */
167
- public function getSession()
168
- {
169
- return Mage::getSingleton('bonusbox/session');
170
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
171
  }
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * @category Bonusbox
16
+ * @package Bonusbox_Bonusbox
17
+ * @author symmetrics - a CGI Group brand <info@symmetrics.de>
18
+ * @author Ngoc Anh Doan <ngoc-anh.doan@cgi.com>
19
+ * @copyright 2011-2012 BonusBox GmbH
20
+ * @license http://www.opensource.org/licenses/mit-license.php The MIT License (MIT)
21
+ * @link http://bonusbox.me
22
+ * @link http://github.com/symmetrics/bonusbox_magento
23
+ */
24
+
25
+ /**
26
+ * Default module helper class.
27
+ *
28
+ * @category Bonusbox
29
+ * @package Bonusbox_Bonusbox
30
+ * @author symmetrics - a CGI Group brand <info@symmetrics.de>
31
+ * @author Ngoc Anh Doan <ngoc-anh.doan@cgi.com>
32
+ * @copyright 2011-2012 BonusBox GmbH
33
+ * @license http://www.opensource.org/licenses/mit-license.php The MIT License (MIT)
34
+ * @link http://bonusbox.me
35
+ * @link http://github.com/symmetrics/bonusbox_magento
36
+ */
37
+ class Bonusbox_Bonusbox_Helper_Data extends Mage_Core_Helper_Data
38
+ {
39
+ /**
40
+ * Part of config XML node.
41
+ *
42
+ * @var string
43
+ */
44
+ protected $_configCode = 'bonusbox';
45
+
46
+ /**
47
+ * Part of config XML node.
48
+ *
49
+ * @var string
50
+ */
51
+ protected $_configSection = 'general';
52
+
53
+ /**
54
+ * Convinience method for access to config data.
55
+ *
56
+ * @param string $field Config XML node
57
+ * @param int $storeId Store ID
58
+ *
59
+ * @return string
60
+ */
61
+ public function getConfig($field, $storeId = null)
62
+ {
63
+ return Mage::getStoreConfig($this->_configCode . '/' . $this->_configSection . '/' . $field, $storeId);
64
+ }
65
+
66
+ /**
67
+ * Check if it is enabled.
68
+ *
69
+ * @return bool
70
+ */
71
+ public function isEnabled()
72
+ {
73
+ return $this->getConfig('enabled');
74
+ }
75
+
76
+ /**
77
+ * Check if in live mode.
78
+ *
79
+ * @return bool
80
+ */
81
+ public function isLive()
82
+ {
83
+ return $this->getConfig('live');
84
+ }
85
+
86
+ /**
87
+ * Checks if module is enabled and if keys are provided.
88
+ *
89
+ * @return bool
90
+ */
91
+ public function isOperational()
92
+ {
93
+ return $this->isEnabled() && $this->getKey('public') && $this->getKey('secret');
94
+ }
95
+
96
+ /**
97
+ * Returns the key for the selected live mode (live|test) and the given param
98
+ * (public|secret).
99
+ *
100
+ * @param bool $secret Flag indicating secret or public type
101
+ * @param int $storeId Store ID
102
+ *
103
+ * @return string
104
+ */
105
+ public function getKey($secret, $storeId = null)
106
+ {
107
+ $mode = $this->isLive() ? 'live' : 'test';
108
+ $type = $secret ? 'secret' : 'public';
109
+ return $this->getConfig($mode . '_' . $type . '_key', $storeId);
110
+ }
111
+
112
+ /**
113
+ * If live mode is enabled an email is sent to the configured debug mail
114
+ * address (see config.xml). In test mode an excption is thrown.
115
+ *
116
+ * @param string|Exception $message Message/Exception to log
117
+ *
118
+ * @return void
119
+ * @throws Bonusbox_Bonusbox_Exception
120
+ */
121
+ public function handleError($message)
122
+ {
123
+ if ($this->isLive()) {
124
+ Mage::log((string) $message);
125
+ try {
126
+ $mail = new Zend_Mail('utf-8');
127
+ $mail
128
+ ->setFrom(Mage::getStoreConfig('trans_email/ident_general/email'))
129
+ ->addTo($this->getConfig('debug_email'))
130
+ ->setSubject('Bonusbox Magento Error')
131
+ ->setBodyText((string) $message)
132
+ ->send();
133
+ } catch (Exception $ex) {
134
+ Mage::logException($ex);
135
+ }
136
+ } else {
137
+ Mage::log('TEST ' . (string) $message);
138
+ if ($message instanceof Exception) {
139
+ throw $message;
140
+ } else {
141
+ require_once 'Bonusbox/Bonusbox/Exception.php';
142
+ throw new Bonusbox_Bonusbox_Exception($message);
143
+ }
144
+ }
145
+ }
146
+
147
+ /**
148
+ * Retrieves an options array with the id, title (incl. the benefit).
149
+ * The Badges are cached in the session.
150
+ *
151
+ * @return array
152
+ *
153
+ * @todo refactor and extract to badge helper class
154
+ */
155
+ public function getBadgeOptions()
156
+ {
157
+ $session = Mage::getSingleton('bonusbox/session');
158
+ if (!$session->getData('badge_options')) {
159
+ $secret = true;
160
+ foreach (Mage::app()->getGroups() as $storeGroup) {
161
+ $apiKey = $this->getKey($secret, $storeGroup->getDefaultStoreId());
162
+ $storeGroups[$apiKey] = $storeGroup;
163
+ }
164
+
165
+ $client = Mage::getModel('bonusbox/client_badges');
166
+ foreach ($storeGroups as $storeGroup) {
167
+ $badges = $client->setStoreId($storeGroup->getDefaultStoreId())->get();
168
+ foreach ($badges as $badge) {
169
+ $badge = $badge['badge'];
170
+ $label = $badge['title'];
171
+ if ($badge['benefit']) {
172
+ $label = sprintf('%s (%s)', $label, $badge['benefit']);
173
+ }
174
+ if (count($storeGroups) > 1) {
175
+ $label = sprintf('%s - %s', $storeGroup->getName(), $label);
176
+ }
177
+ $badgeOptions[] = array('value' => $badge['id'], 'label' => $label);
178
+ }
179
+ }
180
+ $session->setData('badge_options', $badgeOptions);
181
+ }
182
+ return $session->getData('badge_options');
183
+ }
184
+
185
+ /**
186
+ * Checks if coupon code is a valid bonusbox code.
187
+ *
188
+ * @param string $couponCode Coupon code
189
+ *
190
+ * @return bool
191
+ */
192
+ public function isValidBonusboxCouponCode($couponCode)
193
+ {
194
+ $request = new Varien_Object();
195
+ $request->setCouponCode($couponCode);
196
+ return $this->getCustomerBadge($request) !== null;
197
+ }
198
+
199
+ /**
200
+ * Retrieves the badge id for a given coupon code.
201
+ * The response is cached in the session.
202
+ *
203
+ * @param Varien_Object $request Generic data object.
204
+ *
205
+ * @return int|void
206
+ * @todo extract to badge helper class
207
+ */
208
+ public function getCustomerBadge(Varien_Object $request)
209
+ {
210
+ $couponCode = $request->getCouponCode();
211
+ if ($couponCode) {
212
+ $session = $this->getSession();
213
+ if (!$session->getCustomerBadgeByCoupon($couponCode)) {
214
+ $response = Mage::getModel('bonusbox/client_coupons')->get($couponCode);
215
+ $badge = isset($response['coupon']['user']['badge']['id']) ?
216
+ $response['coupon']['user']['badge']['id'] :
217
+ null;
218
+
219
+ $session->setCustomerBadgeByCoupon($couponCode, $badge);
220
+ }
221
+ return $session->getCustomerBadgeByCoupon($couponCode);
222
+ }
223
+ }
224
+
225
+ /**
226
+ * Public accessor to bonusbox session.
227
+ *
228
+ * @return Bonusbox_Bonusbox_Model_Session
229
+ */
230
+ public function getSession()
231
+ {
232
+ return Mage::getSingleton('bonusbox/session');
233
+ }
234
+
235
  }
app/code/community/Bonusbox/Bonusbox/Helper/Successpage.php CHANGED
@@ -1,33 +1,84 @@
1
- <?php
2
- class Bonusbox_Bonusbox_Helper_Successpage extends Bonusbox_Bonusbox_Helper_Data
3
- {
4
- protected $configSection = 'success_page';
5
-
6
-
7
- public function isOperational()
8
- {
9
- return Mage::helper('bonusbox')->isOperational();
10
- }
11
-
12
-
13
- public function getCssUrl($appendTimestampp = true)
14
- {
15
- $url = Mage::getBaseUrl('skin');
16
- $url = Mage::getDesign()->getSkinUrl($this->getConfig('style_url'), array());
17
- if ($appendTimestampp)
18
- {
19
- $filename = $this->getCssFile();
20
- if (file_exists($filename))
21
- {
22
- $url .= '?' . filemtime($filename);
23
- }
24
- }
25
- return $url;
26
- }
27
-
28
-
29
- public function getCssFile()
30
- {
31
- return Mage::getDesign()->getFilename($this->getConfig('style_url'), array('_type' => 'skin'));
32
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33
  }
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * @category Bonusbox
16
+ * @package Bonusbox_Bonusbox
17
+ * @author symmetrics - a CGI Group brand <info@symmetrics.de>
18
+ * @author Ngoc Anh Doan <ngoc-anh.doan@cgi.com>
19
+ * @copyright 2011-2012 BonusBox GmbH
20
+ * @license http://www.opensource.org/licenses/mit-license.php The MIT License (MIT)
21
+ * @link http://bonusbox.me
22
+ * @link http://github.com/symmetrics/bonusbox_magento
23
+ */
24
+
25
+ /**
26
+ * Module helper class for checkout success view.
27
+ *
28
+ * @category Bonusbox
29
+ * @package Bonusbox_Bonusbox
30
+ * @author symmetrics - a CGI Group brand <info@symmetrics.de>
31
+ * @author Ngoc Anh Doan <ngoc-anh.doan@cgi.com>
32
+ * @copyright 2011-2012 BonusBox GmbH
33
+ * @license http://www.opensource.org/licenses/mit-license.php The MIT License (MIT)
34
+ * @link http://bonusbox.me
35
+ * @link http://github.com/symmetrics/bonusbox_magento
36
+ */
37
+ class Bonusbox_Bonusbox_Helper_Successpage extends Bonusbox_Bonusbox_Helper_Data
38
+ {
39
+ /**
40
+ * Part of config XML node.
41
+ *
42
+ * @var string
43
+ */
44
+ protected $_configSection = 'success_page';
45
+
46
+ /**
47
+ * Checks if module is enabled and if keys are provided.
48
+ *
49
+ * @return bool
50
+ */
51
+ public function isOperational()
52
+ {
53
+ return Mage::helper('bonusbox')->isOperational();
54
+ }
55
+
56
+ /**
57
+ * Generates CSS URL
58
+ *
59
+ * @param bool $appendTimestamp Flag to append a timestamp to CSS resource
60
+ *
61
+ * @return string
62
+ */
63
+ public function getCssUrl($appendTimestamp = true)
64
+ {
65
+ $url = Mage::getDesign()->getSkinUrl($this->getConfig('style_url'), array());
66
+ if ($appendTimestamp) {
67
+ $filename = $this->getCssFile();
68
+ if (file_exists($filename)) {
69
+ $url .= '?' . filemtime($filename);
70
+ }
71
+ }
72
+ return $url;
73
+ }
74
+
75
+ /**
76
+ * Gets CSS file name
77
+ *
78
+ * @return string
79
+ */
80
+ public function getCssFile()
81
+ {
82
+ return Mage::getDesign()->getFilename($this->getConfig('style_url'), array('_type' => 'skin'));
83
+ }
84
  }
app/code/community/Bonusbox/Bonusbox/Model/Client.php CHANGED
@@ -1,170 +1,236 @@
1
- <?php
2
- class Bonusbox_Bonusbox_Model_Client extends Zend_Http_Client
3
- {
4
- const CONTENT_TYPE = 'application/json';
5
-
6
- const
7
- METHOD_POST = 'POST',
8
- METHOD_PUT = 'PUT',
9
- METHOD_GET = 'GET',
10
- METHOD_DELETE = 'DELETE'
11
- ;
12
-
13
- /**
14
- * Name of requested resource -> is set by sub classes
15
- * @var string
16
- */
17
- protected $_resourceName;
18
-
19
- /**
20
- * determines store and which config data will be used
21
- * @TODO resolve with config object
22
- * @var int
23
- */
24
- protected $_storeId;
25
-
26
- /**
27
- * object is created with empty array by magento -> if constructor is invoked with empty array, it requires to contain a valid url
28
- */
29
- public function __construct()
30
- {
31
- parent::__construct();
32
- $adapter = new Zend_Http_Client_Adapter_Curl();
33
- $this->setAdapter($adapter);
34
- $adapter->setConfig(array(
35
- 'curloptions' => array(
36
- CURLOPT_SSL_VERIFYPEER => 0,
37
- CURLOPT_SSL_VERIFYHOST => 0
38
- )
39
- ));
40
- }
41
-
42
- /**
43
- * Initialize request
44
- * @param bool $useSecretKey
45
- */
46
- public function init($useSecretKey = true)
47
- {
48
- $helper = Mage::helper('bonusbox');
49
- $this
50
- ->resetParameters(true)
51
- ->setUri($helper->getConfig('url') . $this->_resourceName)
52
- ->setHeaders('Accept', $helper->getConfig('accept_header'))
53
- ->setHeaders('Content-Type', self::CONTENT_TYPE)
54
- ->setAuth(trim($helper->getKey($useSecretKey, $this->getStoreId()))) // to collect all badges with multiple shops, request has ti be executed with different store context
55
- ->setRawData(null)
56
- ;
57
- return $this;
58
- }
59
-
60
- /**
61
- * @return int
62
- */
63
- public function getStoreId()
64
- {
65
- return $this->_storeId;
66
- }
67
-
68
- /**
69
- * @param int $value
70
- */
71
- public function setStoreId($value)
72
- {
73
- $this->_storeId = $value;
74
- return $this;
75
- }
76
-
77
- /**
78
- * Encodes data to json format
79
- * @param mixed $body
80
- */
81
- public function encodeData($body)
82
- {
83
- return json_encode($body);
84
- }
85
-
86
- /**
87
- * Decodes data from json format
88
- * @param mixed $body
89
- */
90
- public function decodeData($body)
91
- {
92
- return json_decode($body, true);
93
- }
94
-
95
- /**
96
- * Formats decimal values to int by multiplying and rounding
97
- * @param decimal $value
98
- * @param int $precision
99
- * @return int
100
- */
101
- public function encodeDecimal($value, $precision = 2)
102
- {
103
- return (int)round($value * pow(10, $precision));
104
- }
105
-
106
- /**
107
- * Request a resource with given method and data.
108
- * @link https://github.com/bonusboxme/api_documentation/wiki
109
- * @param string $method
110
- * @param bool $useSecretKey - Flag for secure/public key
111
- * @param mixed $queryData
112
- * @param mixed $rawData
113
- * @param array $acceptedErrors codes that do not invoke an exception, if an error is provided in the response @TODO move to handleError method for every client
114
- */
115
- public function requestResource($method, $useSecretKey, $queryData = null, $rawData = null, $acceptedErrors = null)
116
- {
117
- try {
118
- $this->init($useSecretKey);
119
- if ($queryData)
120
- {
121
- // @todo if array is provided
122
- $this->setUri($this->getUri() . '/' . $queryData);
123
- }
124
- if ($rawData)
125
- {
126
- $this->setRawData($this->encodeData($rawData));
127
- }
128
- $this->setMethod($method);
129
-
130
- $response = $this->request();
131
- if (strpos($response->getStatus(), '2') === 0) # codes in the 2xx range indicate success
132
- {
133
- $responseBody = $this->decodeData($response->getBody());
134
- return $responseBody;
135
- }
136
- if (is_array($acceptedErrors) && in_array($response->getStatus(), $acceptedErrors))
137
- {
138
- $responseBody = $this->decodeData($response->getBody());
139
- if ($responseBody['error'])
140
- {
141
- return null;
142
- }
143
- }
144
- require_once 'Bonusbox/Bonusbox/Exception.php';
145
- throw new Bonusbox_Bonusbox_Exception("Invalid Response\n" . (string)$this . "\n\n" . (string)$response);
146
- }
147
- catch (Exception $ex)
148
- {
149
- Mage::helper('bonusbox')->handleError($ex);
150
- }
151
- }
152
-
153
- /**
154
- * Super class does not support __toString
155
- * @return string
156
- * @codeCoverageIgnore
157
- */
158
- public function __toString()
159
- {
160
- foreach ($this->headers as $header)
161
- {
162
- $headers[] = $header[0] . ': ' . $header[1];
163
- }
164
- return implode("\n", array(
165
- $this->method . ' ' . $this->getUri(),
166
- implode("\n", $headers),
167
- $this->raw_post_data
168
- ));
169
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
170
  }
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * @category Bonusbox
16
+ * @package Bonusbox_Bonusbox
17
+ * @author symmetrics - a CGI Group brand <info@symmetrics.de>
18
+ * @author Ngoc Anh Doan <ngoc-anh.doan@cgi.com>
19
+ * @copyright 2011-2012 BonusBox GmbH
20
+ * @license http://www.opensource.org/licenses/mit-license.php The MIT License (MIT)
21
+ * @link http://bonusbox.me
22
+ * @link http://github.com/symmetrics/bonusbox_magento
23
+ */
24
+
25
+ /**
26
+ * Basic client to access API
27
+ *
28
+ * @category Bonusbox
29
+ * @package Bonusbox_Bonusbox
30
+ * @author symmetrics - a CGI Group brand <info@symmetrics.de>
31
+ * @author Ngoc Anh Doan <ngoc-anh.doan@cgi.com>
32
+ * @copyright 2011-2012 BonusBox GmbH
33
+ * @license http://www.opensource.org/licenses/mit-license.php The MIT License (MIT)
34
+ * @link http://bonusbox.me
35
+ * @link http://github.com/symmetrics/bonusbox_magento
36
+ */
37
+ class Bonusbox_Bonusbox_Model_Client extends Zend_Http_Client
38
+ {
39
+ /**
40
+ * Some constants for initializing client
41
+ */
42
+ const CONTENT_TYPE = 'application/json';
43
+ const METHOD_POST = 'POST',
44
+ METHOD_PUT = 'PUT',
45
+ METHOD_GET = 'GET',
46
+ METHOD_DELETE = 'DELETE';
47
+
48
+ /**
49
+ * Name of requested resource -> is set by sub classes
50
+ *
51
+ * @var string
52
+ */
53
+ protected $_resourceName;
54
+
55
+ /**
56
+ * determines store and which config data will be used
57
+ *
58
+ * @var int
59
+ * @TODO resolve with config object
60
+ */
61
+ protected $_storeId;
62
+
63
+ /**
64
+ * object is created with empty array by magento -> if constructor is invoked
65
+ * with empty array, it requires to contain a valid url
66
+ */
67
+ public function __construct()
68
+ {
69
+ parent::__construct();
70
+ $adapter = new Zend_Http_Client_Adapter_Curl();
71
+ $this->setAdapter($adapter);
72
+ $adapter->setConfig(
73
+ array(
74
+ 'curloptions' => array(
75
+ CURLOPT_SSL_VERIFYPEER => 0,
76
+ CURLOPT_SSL_VERIFYHOST => 0
77
+ )
78
+ )
79
+ );
80
+ }
81
+
82
+ /**
83
+ * Initialize request
84
+ *
85
+ * @param bool $useSecretKey Flag indicates using secret key or not
86
+ *
87
+ * @return Bonusbox_Bonusbox_Model_Client
88
+ */
89
+ public function init($useSecretKey = true)
90
+ {
91
+ $helper = Mage::helper('bonusbox');
92
+ $this->resetParameters(true)
93
+ ->setUri($helper->getConfig('url') . $this->_resourceName)
94
+ ->setHeaders('Accept', $helper->getConfig('accept_header'))
95
+ ->setHeaders('Content-Type', self::CONTENT_TYPE)
96
+ // to collect all badges with multiple shops, request has ti be
97
+ // executed with different store context
98
+ ->setAuth(trim($helper->getKey($useSecretKey, $this->getStoreId())))
99
+ ->setRawData(null);
100
+
101
+ return $this;
102
+ }
103
+
104
+ /**
105
+ * Getting store ID
106
+ *
107
+ * @return int
108
+ */
109
+ public function getStoreId()
110
+ {
111
+ return $this->_storeId;
112
+ }
113
+
114
+ /**
115
+ * Setting store ID
116
+ *
117
+ * @param int $value Store ID
118
+ *
119
+ * @return Bonusbox_Bonusbox_Model_Client
120
+ */
121
+ public function setStoreId($value)
122
+ {
123
+ $this->_storeId = $value;
124
+ return $this;
125
+ }
126
+
127
+ /**
128
+ * Encodes data to json format
129
+ *
130
+ * @param mixed $body Content to encode
131
+ *
132
+ * @return string
133
+ */
134
+ public function encodeData($body)
135
+ {
136
+ return json_encode($body);
137
+ }
138
+
139
+ /**
140
+ * Decodes data from json format
141
+ *
142
+ * @param mixed $body Content to decode
143
+ *
144
+ * @return mixed
145
+ */
146
+ public function decodeData($body)
147
+ {
148
+ return json_decode($body, true);
149
+ }
150
+
151
+ /**
152
+ * Formats decimal values to int by multiplying and rounding
153
+ *
154
+ * @param decimal $value Value to round
155
+ * @param int $precision Precision to round up to
156
+ *
157
+ * @return int
158
+ */
159
+ public function encodeDecimal($value, $precision = 2)
160
+ {
161
+ return (int) round($value * pow(10, $precision));
162
+ }
163
+
164
+ /**
165
+ * Request a resource with given method and data.
166
+ *
167
+ * @param string $method Request method
168
+ * @param bool $useSecretKey Flag for secure/public key
169
+ * @param mixed $queryData GET query data
170
+ * @param mixed $rawData Raw data for request
171
+ * @param array $acceptedErrors Codes that do not invoke an exception, if an
172
+ * error is provided in the response
173
+ *
174
+ * @return void
175
+ * @link https://github.com/bonusboxme/api_documentation/wiki
176
+ * @TODO move to handleError method for every client
177
+ */
178
+ public function requestResource(
179
+ $method, $useSecretKey, $queryData = null, $rawData = null, $acceptedErrors = null
180
+ )
181
+ {
182
+ try {
183
+ $this->init($useSecretKey);
184
+ if ($queryData) {
185
+ // @todo if array is provided
186
+ $this->setUri($this->getUri() . '/' . $queryData);
187
+ }
188
+ if ($rawData) {
189
+ $this->setRawData($this->encodeData($rawData));
190
+ }
191
+ $this->setMethod($method);
192
+
193
+ $response = $this->request();
194
+ // codes in the 2xx range indicate success
195
+ if (strpos($response->getStatus(), '2') === 0) {
196
+ $responseBody = $this->decodeData($response->getBody());
197
+ return $responseBody;
198
+ }
199
+ if (is_array($acceptedErrors) && in_array($response->getStatus(), $acceptedErrors)) {
200
+ $responseBody = $this->decodeData($response->getBody());
201
+ if ($responseBody['error']) {
202
+ return null;
203
+ }
204
+ }
205
+ require_once 'Bonusbox/Bonusbox/Exception.php';
206
+ throw new Bonusbox_Bonusbox_Exception(
207
+ 'Invalid Response' . PHP_EOL . (string) $this . PHP_EOL . PHP_EOL . (string) $response
208
+ );
209
+ } catch (Exception $exc) {
210
+ Mage::helper('bonusbox')->handleError($exc);
211
+ }
212
+ }
213
+
214
+ /**
215
+ * Super class does not support __toString
216
+ *
217
+ * @return string
218
+ * @codeCoverageIgnore
219
+ */
220
+ public function __toString()
221
+ {
222
+ foreach ($this->headers as $header) {
223
+ $headers[] = $header[0] . ': ' . $header[1];
224
+ }
225
+ return implode(
226
+ "\n",
227
+ array(
228
+ $this->method . ' ' . $this->getUri(),
229
+ implode("\n", $headers),
230
+ // @codingStandardsIgnoreStart
231
+ $this->raw_post_data
232
+ // @codingStandardsIgnoreEnd
233
+ )
234
+ );
235
+ }
236
  }
app/code/community/Bonusbox/Bonusbox/Model/Client/Badges.php CHANGED
@@ -1,14 +1,57 @@
1
- <?php
2
- class Bonusbox_Bonusbox_Model_Client_Badges extends Bonusbox_Bonusbox_Model_Client
3
- {
4
- protected $_resourceName = 'badges';
5
-
6
- /**
7
- * @link https://github.com/bonusboxme/api_documentation/wiki/Get--badges
8
- * @return mixed
9
- */
10
- public function get()
11
- {
12
- return $this->requestResource(self::METHOD_GET, true);
13
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
  }
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * @category Bonusbox
16
+ * @package Bonusbox_Bonusbox
17
+ * @author symmetrics - a CGI Group brand <info@symmetrics.de>
18
+ * @author Ngoc Anh Doan <ngoc-anh.doan@cgi.com>
19
+ * @copyright 2011-2012 BonusBox GmbH
20
+ * @license http://www.opensource.org/licenses/mit-license.php The MIT License (MIT)
21
+ * @link http://bonusbox.me
22
+ * @link http://github.com/symmetrics/bonusbox_magento
23
+ */
24
+
25
+ /**
26
+ * Model accessing Badges API
27
+ *
28
+ * @category Bonusbox
29
+ * @package Bonusbox_Bonusbox
30
+ * @author symmetrics - a CGI Group brand <info@symmetrics.de>
31
+ * @author Ngoc Anh Doan <ngoc-anh.doan@cgi.com>
32
+ * @copyright 2011-2012 BonusBox GmbH
33
+ * @license http://www.opensource.org/licenses/mit-license.php The MIT License (MIT)
34
+ * @link http://bonusbox.me
35
+ * @link http://github.com/symmetrics/bonusbox_magento
36
+ */
37
+ class Bonusbox_Bonusbox_Model_Client_Badges extends Bonusbox_Bonusbox_Model_Client
38
+ {
39
+ /**
40
+ * API resource name
41
+ *
42
+ * @var string
43
+ */
44
+ protected $_resourceName = 'badges';
45
+
46
+ /**
47
+ * Gets all badges of shop, with benefit and threshold values
48
+ *
49
+ * @link https://github.com/bonusboxme/api_documentation/wiki/Get--badges
50
+ *
51
+ * @return mixed
52
+ */
53
+ public function get()
54
+ {
55
+ return $this->requestResource(self::METHOD_GET, true);
56
+ }
57
  }
app/code/community/Bonusbox/Bonusbox/Model/Client/Coupons.php CHANGED
@@ -1,28 +1,71 @@
1
- <?php
2
- class Bonusbox_Bonusbox_Model_Client_Coupons extends Bonusbox_Bonusbox_Model_Client
3
- {
4
- protected $_resourceName = 'coupons';
5
-
6
- /**
7
- * Retrieves info for a bonusbox coupon
8
- * @link https://github.com/bonusboxme/api_documentation/wiki/GET-coupons
9
- * @param string $couponCode
10
- * @return mixed
11
- */
12
- public function get($couponCode)
13
- {
14
- return $this->requestResource(self::METHOD_GET, true, $couponCode, null, array(404));
15
- }
16
-
17
-
18
- /**
19
- * Deletes a bonusbox coupon
20
- * @link https://github.com/bonusboxme/api_documentation/wiki/DELETE-coupons
21
- * @param string $couponCode
22
- * @return mixed
23
- */
24
- public function delete($couponCode)
25
- {
26
- return $this->requestResource(self::METHOD_DELETE, true, $couponCode);
27
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
28
  }
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * @category Bonusbox
16
+ * @package Bonusbox_Bonusbox
17
+ * @author symmetrics - a CGI Group brand <info@symmetrics.de>
18
+ * @author Ngoc Anh Doan <ngoc-anh.doan@cgi.com>
19
+ * @copyright 2011-2012 BonusBox GmbH
20
+ * @license http://www.opensource.org/licenses/mit-license.php The MIT License (MIT)
21
+ * @link http://bonusbox.me
22
+ * @link http://github.com/symmetrics/bonusbox_magento
23
+ */
24
+
25
+ /**
26
+ * Model accessing coupons API
27
+ *
28
+ * @category Bonusbox
29
+ * @package Bonusbox_Bonusbox
30
+ * @author symmetrics - a CGI Group brand <info@symmetrics.de>
31
+ * @author Ngoc Anh Doan <ngoc-anh.doan@cgi.com>
32
+ * @copyright 2011-2012 BonusBox GmbH
33
+ * @license http://www.opensource.org/licenses/mit-license.php The MIT License (MIT)
34
+ * @link http://bonusbox.me
35
+ * @link http://github.com/symmetrics/bonusbox_magento
36
+ */
37
+ class Bonusbox_Bonusbox_Model_Client_Coupons extends Bonusbox_Bonusbox_Model_Client
38
+ {
39
+ /**
40
+ * API resource name
41
+ *
42
+ * @var string
43
+ */
44
+ protected $_resourceName = 'coupons';
45
+
46
+ /**
47
+ * Retrieves info for a bonusbox coupon
48
+ *
49
+ * @param string $couponCode Coupon code to get infos about
50
+ *
51
+ * @return mixed
52
+ * @link https://github.com/bonusboxme/api_documentation/wiki/GET-coupons
53
+ */
54
+ public function get($couponCode)
55
+ {
56
+ return $this->requestResource(self::METHOD_GET, true, $couponCode, null, array(404));
57
+ }
58
+
59
+ /**
60
+ * Deletes a bonusbox coupon
61
+ *
62
+ * @param string $couponCode Coupon code to get infos about
63
+ *
64
+ * @return mixed
65
+ * @link https://github.com/bonusboxme/api_documentation/wiki/DELETE-coupons
66
+ */
67
+ public function delete($couponCode)
68
+ {
69
+ return $this->requestResource(self::METHOD_DELETE, true, $couponCode);
70
+ }
71
  }
app/code/community/Bonusbox/Bonusbox/Model/Client/Successpages.php CHANGED
@@ -1,112 +1,167 @@
1
- <?php
2
- class Bonusbox_Bonusbox_Model_Client_Successpages extends Bonusbox_Bonusbox_Model_Client
3
- {
4
- protected $_resourceName = 'success_pages';
5
-
6
- /**
7
- * Sets required data from address object to array
8
- * @param Mage_Sales_Model_Order_Address $address
9
- * @return array
10
- */
11
- protected function encodeAddress(Mage_Sales_Model_Order_Address $address)
12
- {
13
- return array(
14
- 'code' => $address->getAddressType(),
15
- 'city' => $address->getCity(),
16
- 'company' => $address->getCompany(),
17
- 'region' => $address->getRegion(),
18
- 'country' => $address->getCountry(),
19
- 'firstname' => $address->getFirstname(),
20
- 'lastname' => $address->getLastname(),
21
- 'phone' => $address->getTelephone(),
22
- 'fax' => $address->getFax(),
23
- 'email' => $address->getEmail(),
24
- 'street' => $address->getStreetFull(),
25
- 'zip' => $address->getPostcode()
26
- );
27
- }
28
-
29
- /**
30
- * Sets required data from item object to array
31
- * @param Mage_Sales_Model_Order_Item $item
32
- * @return array
33
- */
34
- protected function encodeItem(Mage_Sales_Model_Order_Item $item)
35
- {
36
- $product = Mage::getModel('catalog/product')->load($item->getProductId()); // ensure that all product attributes are loaded
37
- return array(
38
- 'code' => 'product',
39
- 'sku' => $item->getSku(),
40
- 'quantity' => round($item->getQtyOrdered()),
41
- 'title' => $item->getName(),
42
- 'description' => $item->getDescription(),
43
- 'price' => $this->encodeDecimal($item->getData('price')),
44
- 'vat_rate' => $this->encodeDecimal($item->getData('tax_percent')),
45
- 'vat_amount' => $this->encodeDecimal($item->getData('tax_amount')),
46
- 'landing_page' => $product->getUrlModel()->getUrl($product, array('_ignore_category' => true)),
47
- 'image_url' => Mage::helper('catalog/image')->init($product, 'image')->__toString()
48
- );
49
- }
50
-
51
- /**
52
- * Encodes order to array
53
- * @param Mage_Sales_Model_Order $order
54
- * @return array
55
- */
56
- public function encodeOrder(Mage_Sales_Model_Order $order)
57
- {
58
- $helper = Mage::helper('bonusbox/successpage');
59
- $payment = $order->getPayment();
60
-
61
- $addresses[] = $this->encodeAddress($order->getBillingAddress());
62
- if (!$order->getIsVirtual())
63
- {
64
- $addresses[] = $this->encodeAddress($order->getShippingAddress());
65
- }
66
- $data = array(
67
- 'addresses' => $addresses,
68
- 'currency' => $order->getData('order_currency_code'),
69
- 'order_number' => $order->getData('increment_id'),
70
- 'discounts_used' => $order->getCouponCode() ? array($order->getCouponCode()) : null,
71
- 'style_url' => $helper->getCssUrl(),
72
- 'items' => array(
73
- array(
74
- 'code' => 'shipping',
75
- 'quantity' => $this->encodeDecimal(1),
76
- 'sku' => $order->getShippingMethod(),
77
- 'title' => $order->getShippingDescription(),
78
- 'price' => $this->encodeDecimal($order->getData('shipping_amount')),
79
- 'vat_amount' => $this->encodeDecimal($order->getData('shipping_tax_amount')),
80
- 'vat_rate' => $order->getData('shipping_amount') > 0 ? $this->encodeDecimal($order->getData('shipping_tax_amount') / $order->getData('shipping_amount') * 100) : 0
81
- ),
82
- array(
83
- 'code' => 'payment',
84
- 'quantity' => $this->encodeDecimal(1),
85
- 'sku' => $payment->getMethod(),
86
- 'title' => $payment->getMethodInstance()->getTitle(),
87
- 'price' => 0,
88
- 'vat_amount' => 0,
89
- 'vat_rate' => 0
90
- )
91
- )
92
- );
93
-
94
- foreach ($order->getAllItems() as $item)
95
- {
96
- $data['items'][] = $this->encodeItem($item);
97
- }
98
- return $data;
99
- }
100
-
101
- /**
102
- * Request resource success_pages with order data
103
- * Return url and token, if successful, otherwise detailed error description
104
- * @link https://github.com/bonusboxme/api_documentation/wiki/CREATE-success_pages
105
- * @param Mage_Sales_Model_Order $order
106
- * @return mixed
107
- */
108
- public function post(Mage_Sales_Model_Order $order)
109
- {
110
- return $this->requestResource(self::METHOD_POST, true, null, $this->encodeOrder($order));
111
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
112
  }
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * @category Bonusbox
16
+ * @package Bonusbox_Bonusbox
17
+ * @author symmetrics - a CGI Group brand <info@symmetrics.de>
18
+ * @author Ngoc Anh Doan <ngoc-anh.doan@cgi.com>
19
+ * @copyright 2011-2012 BonusBox GmbH
20
+ * @license http://www.opensource.org/licenses/mit-license.php The MIT License (MIT)
21
+ * @link http://bonusbox.me
22
+ * @link http://github.com/symmetrics/bonusbox_magento
23
+ */
24
+
25
+ /**
26
+ * Model accessing create API
27
+ *
28
+ * @category Bonusbox
29
+ * @package Bonusbox_Bonusbox
30
+ * @author symmetrics - a CGI Group brand <info@symmetrics.de>
31
+ * @author Ngoc Anh Doan <ngoc-anh.doan@cgi.com>
32
+ * @copyright 2011-2012 BonusBox GmbH
33
+ * @license http://www.opensource.org/licenses/mit-license.php The MIT License (MIT)
34
+ * @link http://bonusbox.me
35
+ * @link http://github.com/symmetrics/bonusbox_magento
36
+ */
37
+ class Bonusbox_Bonusbox_Model_Client_Successpages extends Bonusbox_Bonusbox_Model_Client
38
+ {
39
+ /**
40
+ * API resource name
41
+ *
42
+ * @var string
43
+ */
44
+ protected $_resourceName = 'success_pages';
45
+
46
+ /**
47
+ * Sets required data from address object to array
48
+ *
49
+ * @param Mage_Sales_Model_Order_Address $address Order address instance
50
+ *
51
+ * @return array
52
+ */
53
+ protected function encodeAddress(Mage_Sales_Model_Order_Address $address)
54
+ {
55
+ return array(
56
+ 'code' => $address->getAddressType(),
57
+ 'city' => $address->getCity(),
58
+ 'company' => $address->getCompany(),
59
+ 'region' => $address->getRegion(),
60
+ 'country' => $address->getCountry(),
61
+ 'firstname' => $address->getFirstname(),
62
+ 'lastname' => $address->getLastname(),
63
+ 'phone' => $address->getTelephone(),
64
+ 'fax' => $address->getFax(),
65
+ 'email' => $address->getEmail(),
66
+ 'street' => $address->getStreetFull(),
67
+ 'zip' => $address->getPostcode()
68
+ );
69
+ }
70
+
71
+ /**
72
+ * Sets required data from item object to array
73
+ *
74
+ * @param Mage_Sales_Model_Order_Item $item Order item
75
+ *
76
+ * @return array
77
+ */
78
+ protected function encodeItem(Mage_Sales_Model_Order_Item $item)
79
+ {
80
+ // ensure that all product attributes are loaded
81
+ $product = Mage::getModel('catalog/product')->load($item->getProductId());
82
+
83
+ return array(
84
+ 'code' => 'product',
85
+ 'sku' => $item->getSku(),
86
+ 'quantity' => round($item->getQtyOrdered()),
87
+ 'title' => $item->getName(),
88
+ 'description' => $item->getDescription(),
89
+ 'price' => $this->encodeDecimal($item->getData('price')),
90
+ 'vat_rate' => $this->encodeDecimal($item->getData('tax_percent')),
91
+ 'vat_amount' => $this->encodeDecimal($item->getData('tax_amount')),
92
+ 'landing_page' => $product->getUrlModel()->getUrl($product, array('_ignore_category' => true)),
93
+ 'image_url' => Mage::helper('catalog/image')->init($product, 'image')->__toString()
94
+ );
95
+ }
96
+
97
+ /**
98
+ * Encodes order to array
99
+ *
100
+ * @param Mage_Sales_Model_Order $order Order to encode
101
+ *
102
+ * @return array
103
+ */
104
+ public function encodeOrder(Mage_Sales_Model_Order $order)
105
+ {
106
+ $helper = Mage::helper('bonusbox/successpage');
107
+ $payment = $order->getPayment();
108
+ $vatRate = 0;
109
+
110
+ if (($order->getData('shipping_amount') > 0)) {
111
+ $vatRate = $this->encodeDecimal(
112
+ $order->getData('shipping_tax_amount') / $order->getData('shipping_amount') * 100
113
+ );
114
+ }
115
+
116
+ $addresses[] = $this->encodeAddress($order->getBillingAddress());
117
+ if (!$order->getIsVirtual()) {
118
+ $addresses[] = $this->encodeAddress($order->getShippingAddress());
119
+ }
120
+ $data = array(
121
+ 'addresses' => $addresses,
122
+ 'currency' => $order->getData('order_currency_code'),
123
+ 'order_number' => $order->getData('increment_id'),
124
+ 'discounts_used' => $order->getCouponCode() ? array($order->getCouponCode()) : null,
125
+ 'style_url' => $helper->getCssUrl(),
126
+ 'items' => array(
127
+ array(
128
+ 'code' => 'shipping',
129
+ 'quantity' => $this->encodeDecimal(1),
130
+ 'sku' => $order->getShippingMethod(),
131
+ 'title' => $order->getShippingDescription(),
132
+ 'price' => $this->encodeDecimal($order->getData('shipping_amount')),
133
+ 'vat_amount' => $this->encodeDecimal($order->getData('shipping_tax_amount')),
134
+ 'vat_rate' => $vatRate
135
+ ),
136
+ array(
137
+ 'code' => 'payment',
138
+ 'quantity' => $this->encodeDecimal(1),
139
+ 'sku' => $payment->getMethod(),
140
+ 'title' => $payment->getMethodInstance()->getTitle(),
141
+ 'price' => 0,
142
+ 'vat_amount' => 0,
143
+ 'vat_rate' => 0
144
+ )
145
+ )
146
+ );
147
+
148
+ foreach ($order->getAllItems() as $item) {
149
+ $data['items'][] = $this->encodeItem($item);
150
+ }
151
+ return $data;
152
+ }
153
+
154
+ /**
155
+ * Request resource success_pages with order data.
156
+ * Return url and token, if successful, otherwise detailed error description
157
+ *
158
+ * @param Mage_Sales_Model_Order $order Sales order object
159
+ *
160
+ * @return mixed
161
+ * @link https://github.com/bonusboxme/api_documentation/wiki/CREATE-success_pages
162
+ */
163
+ public function post(Mage_Sales_Model_Order $order)
164
+ {
165
+ return $this->requestResource(self::METHOD_POST, true, null, $this->encodeOrder($order));
166
+ }
167
  }
app/code/community/Bonusbox/Bonusbox/Model/Sales/Observer.php CHANGED
@@ -1,35 +1,68 @@
1
- <?php
2
- class Bonusbox_Bonusbox_Model_Sales_Observer
3
- {
4
- /**
5
- * Forwards order to bonuxbox and saves url for success page iframe in session.
6
- * Deletes bonusbox coupon code.
7
- * @param Varien_Event_Observer $observer
8
- */
9
- public function forwardOrder(Varien_Event_Observer $observer)
10
- {
11
- $order = $observer->getOrder();
12
- if (Mage::helper('bonusbox')->isEnabled())
13
- {
14
- if (Mage::helper('bonusbox/successpage')->isOperational())
15
- {
16
- // send order to bonusbox
17
- $response = Mage::getModel('bonusbox/client_successpages')->post($order);
18
- Mage::helper('bonusbox')->getSession()->setSuccessPage($response['success_page']);
19
-
20
- // delete coupon code from bonusbox
21
- if (Mage::helper('bonusbox')->isValidBonusboxCouponCode($order->getCouponCode()))
22
- {
23
- Mage::getModel('bonusbox/client_coupons')->delete($order->getCouponCode());
24
- }
25
-
26
- // invalidate Customer Badge Cache
27
- Mage::helper('bonusbox')->getSession()->setCustomerBadgesByCoupon(null);
28
- }
29
- else {
30
- Mage::log('Bonusbox Success Page is missing config data.');
31
- }
32
- }
33
- }
34
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
35
  }
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * @category Bonusbox
16
+ * @package Bonusbox_Bonusbox
17
+ * @author symmetrics - a CGI Group brand <info@symmetrics.de>
18
+ * @author Ngoc Anh Doan <ngoc-anh.doan@cgi.com>
19
+ * @copyright 2011-2012 BonusBox GmbH
20
+ * @license http://www.opensource.org/licenses/mit-license.php The MIT License (MIT)
21
+ * @link http://bonusbox.me
22
+ * @link http://github.com/symmetrics/bonusbox_magento
23
+ */
24
+
25
+ /**
26
+ * Event listener to submit order data to API
27
+ *
28
+ * @category Bonusbox
29
+ * @package Bonusbox_Bonusbox
30
+ * @author symmetrics - a CGI Group brand <info@symmetrics.de>
31
+ * @author Ngoc Anh Doan <ngoc-anh.doan@cgi.com>
32
+ * @copyright 2011-2012 BonusBox GmbH
33
+ * @license http://www.opensource.org/licenses/mit-license.php The MIT License (MIT)
34
+ * @link http://bonusbox.me
35
+ * @link http://github.com/symmetrics/bonusbox_magento
36
+ */
37
+ class Bonusbox_Bonusbox_Model_Sales_Observer
38
+ {
39
+ /**
40
+ * Forwards order to bonuxbox and saves url for success page iframe in session.
41
+ * Deletes bonusbox coupon code.
42
+ *
43
+ * @param Varien_Event_Observer $observer Event observer
44
+ *
45
+ * @return void
46
+ */
47
+ public function forwardOrder(Varien_Event_Observer $observer)
48
+ {
49
+ $order = $observer->getOrder();
50
+ if (Mage::helper('bonusbox')->isEnabled()) {
51
+ if (Mage::helper('bonusbox/successpage')->isOperational()) {
52
+ // send order to bonusbox
53
+ $response = Mage::getModel('bonusbox/client_successpages')->post($order);
54
+ Mage::helper('bonusbox')->getSession()->setSuccessPage($response['success_page']);
55
+
56
+ // delete coupon code from bonusbox
57
+ if (Mage::helper('bonusbox')->isValidBonusboxCouponCode($order->getCouponCode())) {
58
+ Mage::getModel('bonusbox/client_coupons')->delete($order->getCouponCode());
59
+ }
60
+
61
+ // invalidate Customer Badge Cache
62
+ Mage::helper('bonusbox')->getSession()->setCustomerBadgesByCoupon(null);
63
+ } else {
64
+ Mage::log('Bonusbox Success Page is missing config data.');
65
+ }
66
+ }
67
+ }
68
  }
app/code/community/Bonusbox/Bonusbox/Model/SalesRule/Condition/Bonusbox.php CHANGED
@@ -1,88 +1,146 @@
1
- <?php
2
- class Bonusbox_Bonusbox_Model_SalesRule_Condition_Bonusbox extends Mage_Rule_Model_Condition_Abstract
3
- {
4
- public function addConditions(Varien_Event_Observer $observer)
5
- {
6
- if (!Mage::helper('bonusbox')->isEnabled())
7
- {
8
- return;
9
- }
10
- $class = 'bonusbox/salesRule_condition_bonusbox';
11
- $condition = Mage::getModel($class);
12
- $condition->loadAttributeOptions();
13
- foreach ($condition->getAttributeOption() as $attribute => $label)
14
- {
15
- $attributes = array(
16
- array('value' => $class . '|' . $attribute, 'label' => $label)
17
- );
18
- }
19
- $conditions = array(array('label' => Mage::helper('bonusbox')->__('Bonusbox'), 'value' => $attributes));
20
- $observer->getEvent()->getAdditional()->setConditions($conditions);
21
- }
22
-
23
-
24
- public function loadAttributeOptions()
25
- {
26
- $this->setAttributesMeta(array(
27
- 'badge' => array(
28
- 'label' => Mage::helper('bonusbox')->__('Badge'),
29
- 'input_type' => 'select',
30
- 'value_element_type' => 'select'
31
- )
32
- ));
33
-
34
- foreach ($this->getAttributesMeta() as $attribute => $attributeMeta)
35
- {
36
- $attributes[$attribute] = $attributeMeta['label'];
37
- }
38
- $this->setAttributeOption($attributes);
39
- return $this;
40
- }
41
-
42
-
43
- public function getInputType()
44
- {
45
- $attributesMeta = $this->getAttributesMeta();
46
- return $attributesMeta[$this->getAttribute()]['input_type'];
47
- }
48
-
49
-
50
- public function getValueElementType()
51
- {
52
- $attributesMeta = $this->getAttributesMeta();
53
- return $attributesMeta[$this->getAttribute()]['value_element_type'];
54
- }
55
-
56
-
57
- public function getValueSelectOptions()
58
- {
59
- if (!$this->hasData('value_select_options'))
60
- {
61
- switch ($this->getAttribute())
62
- {
63
- case 'badge':
64
- $options = Mage::helper('bonusbox')->getBadgeOptions();
65
- break;
66
- }
67
- $this->setData('value_select_options', $options);
68
- }
69
- return $this->getData('value_select_options');
70
- }
71
-
72
- /**
73
- * Validate Bonusbox Badge Conditions
74
- *
75
- * @param Varien_Object $object
76
- * @return bool
77
- */
78
- public function validate(Varien_Object $object)
79
- {
80
- if (!Mage::helper('bonusbox')->isEnabled())
81
- {
82
- return;
83
- }
84
- $bonusbox = new Varien_Object();
85
- $bonusbox->setBadge(Mage::helper('bonusbox')->getCustomerBadge($object->getQuote()));
86
- return parent::validate($bonusbox);
87
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
88
  }
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * @category Bonusbox
16
+ * @package Bonusbox_Bonusbox
17
+ * @author symmetrics - a CGI Group brand <info@symmetrics.de>
18
+ * @author Ngoc Anh Doan <ngoc-anh.doan@cgi.com>
19
+ * @copyright 2011-2012 BonusBox GmbH
20
+ * @license http://www.opensource.org/licenses/mit-license.php The MIT License (MIT)
21
+ * @link http://bonusbox.me
22
+ * @link http://github.com/symmetrics/bonusbox_magento
23
+ */
24
+
25
+ /**
26
+ * Custom sales rule condition model
27
+ *
28
+ * @category Bonusbox
29
+ * @package Bonusbox_Bonusbox
30
+ * @author symmetrics - a CGI Group brand <info@symmetrics.de>
31
+ * @author Ngoc Anh Doan <ngoc-anh.doan@cgi.com>
32
+ * @copyright 2011-2012 BonusBox GmbH
33
+ * @license http://www.opensource.org/licenses/mit-license.php The MIT License (MIT)
34
+ * @link http://bonusbox.me
35
+ * @link http://github.com/symmetrics/bonusbox_magento
36
+ */
37
+ class Bonusbox_Bonusbox_Model_SalesRule_Condition_Bonusbox extends Mage_Rule_Model_Condition_Abstract
38
+ {
39
+ /**
40
+ * Listener on 'salesrule_rule_condition_combine' to add additonal conditions.
41
+ *
42
+ * BONBOX-12: Moved listener logic for Magento EE compatibility overridden
43
+ * Mage_SalesRule_Model_Rule_Condition_Combine class.
44
+ *
45
+ * @param Varien_Event_Observer $observer Event observer instance
46
+ *
47
+ * @return void
48
+ */
49
+ public function addConditions(Varien_Event_Observer $observer)
50
+ {
51
+ if (!Mage::helper('bonusbox')->isEnabled()) {
52
+ return;
53
+ }
54
+ $class = 'bonusbox/salesRule_condition_bonusbox';
55
+ $condition = Mage::getModel($class);
56
+ $condition->loadAttributeOptions();
57
+ foreach ($condition->getAttributeOption() as $attribute => $label) {
58
+ $attributes = array(
59
+ array('value' => $class . '|' . $attribute, 'label' => $label)
60
+ );
61
+ }
62
+ $conditions = array(array('label' => Mage::helper('bonusbox')->__('Bonusbox'), 'value' => $attributes));
63
+ $observer->getEvent()->getAdditional()->setConditions($conditions);
64
+ }
65
+
66
+ /**
67
+ * Adding badge as attribute
68
+ *
69
+ * @return Bonusbox_Bonusbox_Model_SalesRule_Condition_Bonusbox
70
+ */
71
+ public function loadAttributeOptions()
72
+ {
73
+ $this->setAttributesMeta(
74
+ array(
75
+ 'badge' => array(
76
+ 'label' => Mage::helper('bonusbox')->__('Badge'),
77
+ 'input_type' => 'select',
78
+ 'value_element_type' => 'select'
79
+ )
80
+ )
81
+ );
82
+
83
+ foreach ($this->getAttributesMeta() as $attribute => $attributeMeta) {
84
+ $attributes[$attribute] = $attributeMeta['label'];
85
+ }
86
+ $this->setAttributeOption($attributes);
87
+ return $this;
88
+ }
89
+
90
+ /**
91
+ * Getting badge attribute input type.
92
+ *
93
+ * @return string
94
+ */
95
+ public function getInputType()
96
+ {
97
+ $attributesMeta = $this->getAttributesMeta();
98
+ return $attributesMeta[$this->getAttribute()]['input_type'];
99
+ }
100
+
101
+ /**
102
+ * Getting badge attribute value type.
103
+ *
104
+ * @return string
105
+ */
106
+ public function getValueElementType()
107
+ {
108
+ $attributesMeta = $this->getAttributesMeta();
109
+ return $attributesMeta[$this->getAttribute()]['value_element_type'];
110
+ }
111
+
112
+ /**
113
+ * Get a list of available attribute options to select
114
+ *
115
+ * @return array
116
+ */
117
+ public function getValueSelectOptions()
118
+ {
119
+ if (!$this->hasData('value_select_options')) {
120
+ switch ($this->getAttribute()) {
121
+ case 'badge':
122
+ $options = Mage::helper('bonusbox')->getBadgeOptions();
123
+ break;
124
+ }
125
+ $this->setData('value_select_options', $options);
126
+ }
127
+ return $this->getData('value_select_options');
128
+ }
129
+
130
+ /**
131
+ * Validate Bonusbox Badge Conditions
132
+ *
133
+ * @param Varien_Object $object Object holding quote.
134
+ *
135
+ * @return bool
136
+ */
137
+ public function validate(Varien_Object $object)
138
+ {
139
+ if (!Mage::helper('bonusbox')->isEnabled()) {
140
+ return;
141
+ }
142
+ $bonusbox = new Varien_Object();
143
+ $bonusbox->setBadge(Mage::helper('bonusbox')->getCustomerBadge($object->getQuote()));
144
+ return parent::validate($bonusbox);
145
+ }
146
  }
app/code/community/Bonusbox/Bonusbox/Model/SalesRule/Rule/Condition/Combine.php ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * @category Bonusbox
16
+ * @package Bonusbox_Bonusbox
17
+ * @author symmetrics - a CGI Group brand <info@symmetrics.de>
18
+ * @author Ngoc Anh Doan <ngoc-anh.doan@cgi.com>
19
+ * @copyright 2011-2012 BonusBox GmbH
20
+ * @license http://www.opensource.org/licenses/mit-license.php The MIT License (MIT)
21
+ * @link http://bonusbox.me
22
+ * @link http://github.com/symmetrics/bonusbox_magento
23
+ */
24
+
25
+ /**
26
+ * BONBOX-12: Overriding Mage_SalesRule_Model_Rule_Condition_Combine to make sure
27
+ * additional rule combines will also take affect in Magento EE.
28
+ *
29
+ * @category Bonusbox
30
+ * @package Bonusbox_Bonusbox
31
+ * @author symmetrics - a CGI Group brand <info@symmetrics.de>
32
+ * @author Ngoc Anh Doan <ngoc-anh.doan@cgi.com>
33
+ * @copyright 2011-2012 BonusBox GmbH
34
+ * @license http://www.opensource.org/licenses/mit-license.php The MIT License (MIT)
35
+ * @link http://bonusbox.me
36
+ * @link http://github.com/symmetrics/bonusbox_magento
37
+ */
38
+ class Bonusbox_Bonusbox_Model_SalesRule_Rule_Condition_Combine extends Mage_SalesRule_Model_Rule_Condition_Combine
39
+ {
40
+ /**
41
+ * Get inherited conditions selectors and add BonusBox specific ones.
42
+ *
43
+ * @return array
44
+ * @see Mage_SalesRule_Model_Rule_Condition_Combine::getNewChildSelectOptions()
45
+ * @see Bonusbox_Bonusbox_Model_SalesRule_Condition_Bonusbox::addConditions()
46
+ */
47
+ public function getNewChildSelectOptions()
48
+ {
49
+ $conditions = parent::getNewChildSelectOptions();
50
+ if (Mage::helper('bonusbox')->isEnabled()) {
51
+ $attributes = array();
52
+ $className = 'bonusbox/salesRule_condition_bonusbox';
53
+ $bonusBoxCondition = Mage::getModel($className)->loadAttributeOptions();
54
+ /* @var $bonusBoxCondition Bonusbox_Bonusbox_Model_SalesRule_Condition_Bonusbox */
55
+
56
+ foreach ($bonusBoxCondition->getAttributeOption() as $attribute => $label) {
57
+ $attributes[] = array(
58
+ 'value' => $className . '|' . $attribute,
59
+ 'label' => $label
60
+ );
61
+ }
62
+
63
+ $conditions = array_merge_recursive(
64
+ $conditions,
65
+ array(
66
+ array(
67
+ 'label' => Mage::helper('bonusbox')->__('Bonusbox'),
68
+ 'value' => $attributes
69
+ )
70
+ )
71
+ );
72
+ }
73
+
74
+ // 'salesrule_rule_condition_combine' has been dispatched already! Doing some
75
+ // module specific event dispatching.
76
+ $additional = new Varien_Object();
77
+ Mage::dispatchEvent(
78
+ 'bonousbox_salesrule_rule_condition_combine',
79
+ array('additional' => $additional)
80
+ );
81
+ if (($additionalConditions = $additional->getConditions())) {
82
+ $conditions = array_merge_recursive($conditions, $additionalConditions);
83
+ }
84
+
85
+ return $conditions;
86
+ }
87
+ }
app/code/community/Bonusbox/Bonusbox/Model/SalesRule/Validator.php CHANGED
@@ -1,92 +1,136 @@
1
- <?php
2
- class Bonusbox_Bonusbox_Model_SalesRule_Validator extends Mage_SalesRule_Model_Validator
3
- {
4
- /**
5
- * Removes the coupon code if it is an bonusbox coupon code an stores it. After validation the bonusbox code is set order.
6
- * @param int $websiteId
7
- * @param int $customerGroupId
8
- * @param string $couponCode
9
- * @see Mage_SalesRule_Model_Validator::init($websiteId, $customerGroupId, $couponCode)
10
- */
11
- public function init($websiteId, $customerGroupId, $couponCode)
12
- {
13
- if (Mage::helper('bonusbox')->isEnabled() && $couponCode)
14
- {
15
- if (Mage::helper('bonusbox')->isValidBonusboxCouponCode($couponCode))
16
- {
17
- $this->setBonusboxCode($couponCode);
18
- $couponCode = null;
19
- }
20
- else {
21
- $this->setBonusboxCode(null);
22
- }
23
- }
24
- return parent::init($websiteId, $customerGroupId, $couponCode);
25
- }
26
-
27
- /**
28
- * Checks if rule contains bonusbox Conditions and if a bonusbox code is set.
29
- * @param Mage_SalesRule_Model_Rule $rule
30
- * @return boolean
31
- */
32
- private function isBonusboxRule($rule)
33
- {
34
- if ($this->getBonusboxCode() && !$rule->getCouponCode())
35
- {
36
- return $this->hasBonusboxConditions($rule->getConditions()->getConditions());
37
- }
38
- }
39
-
40
- /**
41
- * Check if $conditions contains a bonusbox condition and searches recursively if a combine condition is contained.
42
- * @param array $conditions
43
- */
44
- private function hasBonusboxConditions($conditions)
45
- {
46
- foreach ($conditions as $condition)
47
- {
48
- if ( $condition instanceof Bonusbox_Bonusbox_Model_SalesRule_Condition_Bonusbox
49
- || $this->hasBonusboxConditions($condition->getConditions())
50
- ) {
51
- return true;
52
- }
53
- }
54
- }
55
-
56
- /**
57
- * If one of the applied rules is a bonusbox rule, the code is set to the address
58
- * @see Mage_SalesRule_Model_Validator::process($item)
59
- */
60
- public function process(Mage_Sales_Model_Quote_Item_Abstract $item)
61
- {
62
- parent::process($item);
63
- if (!Mage::helper('bonusbox')->isEnabled() || !$this->getBonusboxCode())
64
- {
65
- return $this;
66
- }
67
- $appliedRuleIds = explode(',', $item->getQuote()->getAppliedRuleIds());
68
- foreach ($this->_getRules() as $rule)
69
- {
70
- if (in_array($rule->getId(), $appliedRuleIds) && $this->isBonusboxRule($rule))
71
- {
72
- $this->_setCouponDataToAddress($item, $rule);
73
- break;
74
- }
75
- }
76
- return $this;
77
- }
78
-
79
- /**
80
- * Set coupon code and description to address
81
- * @param Mage_Sales_Model_Quote_Item_Abstract $item
82
- * @param Mage_SalesRule_Model_Rule $rule
83
- */
84
- private function _setCouponDataToAddress($item, $rule)
85
- {
86
- $address = $this->_getAddress($item);
87
- $address->setCouponCode($this->getBonusboxCode());
88
- $rule->setCouponCode($this->getBonusboxCode()); // used in _addDiscountDescription
89
- $this->_addDiscountDescription($address, $rule);
90
- $rule->setCouponCode(null);
91
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
92
  }
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * @category Bonusbox
16
+ * @package Bonusbox_Bonusbox
17
+ * @author symmetrics - a CGI Group brand <info@symmetrics.de>
18
+ * @author Ngoc Anh Doan <ngoc-anh.doan@cgi.com>
19
+ * @copyright 2011-2012 BonusBox GmbH
20
+ * @license http://www.opensource.org/licenses/mit-license.php The MIT License (MIT)
21
+ * @link http://bonusbox.me
22
+ * @link http://github.com/symmetrics/bonusbox_magento
23
+ */
24
+
25
+ /**
26
+ * Custom sales rule validator model
27
+ *
28
+ * @category Bonusbox
29
+ * @package Bonusbox_Bonusbox
30
+ * @author symmetrics - a CGI Group brand <info@symmetrics.de>
31
+ * @author Ngoc Anh Doan <ngoc-anh.doan@cgi.com>
32
+ * @copyright 2011-2012 BonusBox GmbH
33
+ * @license http://www.opensource.org/licenses/mit-license.php The MIT License (MIT)
34
+ * @link http://bonusbox.me
35
+ * @link http://github.com/symmetrics/bonusbox_magento
36
+ */
37
+ class Bonusbox_Bonusbox_Model_SalesRule_Validator extends Mage_SalesRule_Model_Validator
38
+ {
39
+ /**
40
+ * Removes the coupon code if it is an bonusbox coupon code an stores it. After
41
+ * validation the bonusbox code is set order.
42
+ *
43
+ * @param int $websiteId Website ID
44
+ * @param int $customerGroupId Customer group ID
45
+ * @param string $couponCode Coupon code
46
+ *
47
+ * @return Bonusbox_Bonusbox_Model_SalesRule_Validator
48
+ * @see Mage_SalesRule_Model_Validator::init($websiteId, $customerGroupId, $couponCode)
49
+ */
50
+ public function init($websiteId, $customerGroupId, $couponCode)
51
+ {
52
+ if (Mage::helper('bonusbox')->isEnabled() && $couponCode) {
53
+ if (Mage::helper('bonusbox')->isValidBonusboxCouponCode($couponCode)) {
54
+ $this->setBonusboxCode($couponCode);
55
+ $couponCode = null;
56
+ } else {
57
+ $this->setBonusboxCode(null);
58
+ }
59
+ }
60
+ return parent::init($websiteId, $customerGroupId, $couponCode);
61
+ }
62
+
63
+ /**
64
+ * Checks if rule contains bonusbox Conditions and if a bonusbox code is set.
65
+ *
66
+ * @param Mage_SalesRule_Model_Rule $rule Sales rule model instance
67
+ *
68
+ * @return boolean
69
+ */
70
+ private function isBonusboxRule($rule)
71
+ {
72
+ if ($this->getBonusboxCode() && !$rule->getCouponCode()) {
73
+ return $this->hasBonusboxConditions($rule->getConditions()->getConditions());
74
+ }
75
+ }
76
+
77
+ /**
78
+ * Check if $conditions contains a bonusbox condition and searches recursively
79
+ * if a combine condition is contained.
80
+ *
81
+ * @param array $conditions Conditions to check
82
+ *
83
+ * @return bool|void
84
+ */
85
+ private function hasBonusboxConditions($conditions)
86
+ {
87
+ foreach ($conditions as $condition) {
88
+ if ($condition instanceof Bonusbox_Bonusbox_Model_SalesRule_Condition_Bonusbox
89
+ || $this->hasBonusboxConditions($condition->getConditions())
90
+ ) {
91
+ return true;
92
+ }
93
+ }
94
+ }
95
+
96
+ /**
97
+ * If one of the applied rules is a bonusbox rule, the code is set to the address
98
+ *
99
+ * @param Mage_Sales_Model_Quote_Item_Abstract $item Sales quote item
100
+ *
101
+ * @return Bonusbox_Bonusbox_Model_SalesRule_Validator
102
+ * @see Mage_SalesRule_Model_Validator::process($item)
103
+ */
104
+ public function process(Mage_Sales_Model_Quote_Item_Abstract $item)
105
+ {
106
+ parent::process($item);
107
+ if (!Mage::helper('bonusbox')->isEnabled() || !$this->getBonusboxCode()) {
108
+ return $this;
109
+ }
110
+ $appliedRuleIds = explode(',', $item->getQuote()->getAppliedRuleIds());
111
+ foreach ($this->_getRules() as $rule) {
112
+ if (in_array($rule->getId(), $appliedRuleIds) && $this->isBonusboxRule($rule)) {
113
+ $this->_setCouponDataToAddress($item, $rule);
114
+ break;
115
+ }
116
+ }
117
+ return $this;
118
+ }
119
+
120
+ /**
121
+ * Set coupon code and description to address
122
+ *
123
+ * @param Mage_Sales_Model_Quote_Item_Abstract $item Sales quote item
124
+ * @param Mage_SalesRule_Model_Rule $rule Sales rule model
125
+ *
126
+ * @return void
127
+ */
128
+ private function _setCouponDataToAddress($item, $rule)
129
+ {
130
+ $address = $this->_getAddress($item);
131
+ $address->setCouponCode($this->getBonusboxCode());
132
+ $rule->setCouponCode($this->getBonusboxCode()); // used in _addDiscountDescription
133
+ $this->_addDiscountDescription($address, $rule);
134
+ $rule->setCouponCode(null);
135
+ }
136
  }
app/code/community/Bonusbox/Bonusbox/Model/Session.php CHANGED
@@ -1,24 +1,75 @@
1
- <?php
2
- class Bonusbox_Bonusbox_Model_Session extends Mage_Core_Model_Session_Abstract
3
- {
4
- public function __construct()
5
- {
6
- $this->init('bonusbox');
7
- }
8
-
9
-
10
- public function getCustomerBadgeByCoupon($couponCode)
11
- {
12
- $badges = $this->getCustomerBadgesByCoupon();
13
- return isset($badges[$couponCode]) ? $badges[$couponCode] : null;
14
- }
15
-
16
-
17
- public function setCustomerBadgeByCoupon($couponCode, $badge)
18
- {
19
- $badges = $this->getCustomerBadgesByCoupon();
20
- $badges[$couponCode] = $badge;
21
- $this->setCustomerBadgesByCoupon($badges);
22
- return $this;
23
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24
  }
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * @category Bonusbox
16
+ * @package Bonusbox_Bonusbox
17
+ * @author symmetrics - a CGI Group brand <info@symmetrics.de>
18
+ * @author Ngoc Anh Doan <ngoc-anh.doan@cgi.com>
19
+ * @copyright 2011-2012 BonusBox GmbH
20
+ * @license http://www.opensource.org/licenses/mit-license.php The MIT License (MIT)
21
+ * @link http://bonusbox.me
22
+ * @link http://github.com/symmetrics/bonusbox_magento
23
+ */
24
+
25
+ /**
26
+ * Custom module session model
27
+ *
28
+ * @category Bonusbox
29
+ * @package Bonusbox_Bonusbox
30
+ * @author symmetrics - a CGI Group brand <info@symmetrics.de>
31
+ * @author Ngoc Anh Doan <ngoc-anh.doan@cgi.com>
32
+ * @copyright 2011-2012 BonusBox GmbH
33
+ * @license http://www.opensource.org/licenses/mit-license.php The MIT License (MIT)
34
+ * @link http://bonusbox.me
35
+ * @link http://github.com/symmetrics/bonusbox_magento
36
+ */
37
+ class Bonusbox_Bonusbox_Model_Session extends Mage_Core_Model_Session_Abstract
38
+ {
39
+ /**
40
+ * Initialize session space
41
+ */
42
+ public function __construct()
43
+ {
44
+ $this->init('bonusbox');
45
+ }
46
+
47
+ /**
48
+ * Getting customer badge by coupon code
49
+ *
50
+ * @param string $couponCode Coupon code
51
+ *
52
+ * @return mixed
53
+ */
54
+ public function getCustomerBadgeByCoupon($couponCode)
55
+ {
56
+ $badges = $this->getCustomerBadgesByCoupon();
57
+ return isset($badges[$couponCode]) ? $badges[$couponCode] : null;
58
+ }
59
+
60
+ /**
61
+ * Set customer badge by coupon
62
+ *
63
+ * @param string $couponCode Coupon code
64
+ * @param mixed $badge Badge to apply
65
+ *
66
+ * @return Bonusbox_Bonusbox_Model_Session
67
+ */
68
+ public function setCustomerBadgeByCoupon($couponCode, $badge)
69
+ {
70
+ $badges = $this->getCustomerBadgesByCoupon();
71
+ $badges[$couponCode] = $badge;
72
+ $this->setCustomerBadgesByCoupon($badges);
73
+ return $this;
74
+ }
75
  }
app/code/community/Bonusbox/Bonusbox/controllers/TestController.php CHANGED
@@ -1,26 +1,72 @@
1
  <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  require_once 'Mage/Checkout/controllers/OnepageController.php';
 
3
  /**
 
 
 
 
 
 
 
 
 
 
4
  * @codeCoverageIgnore
5
  */
6
- class Bonusbox_Bonusbox_TestController extends Mage_Checkout_OnepageController
7
  {
8
- protected function getOrder()
9
- {
10
- return Mage::getModel('sales/order')->getResourceCollection()
11
- ->setPageSize(1)
12
- ->getFirstItem()
13
- ;
14
- }
15
-
16
-
 
 
 
 
 
 
 
 
 
17
  public function successAction()
18
  {
19
- $order = $this->getOrder();
20
- Mage::dispatchEvent('sales_model_service_quote_submit_after', array('order'=>$order));
21
-
22
- $this->loadLayout();
23
- $this->getLayout()->getBlock('content')->append($this->getLayout()->createBlock('bonusbox/checkout_success'));
24
- $this->renderLayout();
 
 
 
25
  }
26
  }
1
  <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * @category Bonusbox
16
+ * @package Bonusbox_Bonusbox
17
+ * @author symmetrics - a CGI Group brand <info@symmetrics.de>
18
+ * @author Ngoc Anh Doan <ngoc-anh.doan@cgi.com>
19
+ * @copyright 2011-2012 BonusBox GmbH
20
+ * @license http://www.opensource.org/licenses/mit-license.php The MIT License (MIT)
21
+ * @link http://bonusbox.me
22
+ * @link http://github.com/symmetrics/bonusbox_magento
23
+ */
24
+
25
  require_once 'Mage/Checkout/controllers/OnepageController.php';
26
+
27
  /**
28
+ * Testing controller
29
+ *
30
+ * @category Bonusbox
31
+ * @package Bonusbox_Bonusbox
32
+ * @author symmetrics - a CGI Group brand <info@symmetrics.de>
33
+ * @author Ngoc Anh Doan <ngoc-anh.doan@cgi.com>
34
+ * @copyright 2011-2012 BonusBox GmbH
35
+ * @license http://www.opensource.org/licenses/mit-license.php The MIT License (MIT)
36
+ * @link http://bonusbox.me
37
+ * @link http://github.com/symmetrics/bonusbox_magento
38
  * @codeCoverageIgnore
39
  */
40
+ class Bonusbox_Bonusbox_TestController extends Mage_Checkout_OnepageController
41
  {
42
+ /**
43
+ * Getting order object.
44
+ *
45
+ * @return Mage_Sales_Model_Order
46
+ */
47
+ protected function getOrder()
48
+ {
49
+ return Mage::getModel('sales/order')
50
+ ->getResourceCollection()
51
+ ->setPageSize(1)
52
+ ->getFirstItem();
53
+ }
54
+
55
+ /**
56
+ * Order success action.
57
+ *
58
+ * @return void
59
+ */
60
  public function successAction()
61
  {
62
+ $order = $this->getOrder();
63
+ Mage::dispatchEvent('sales_model_service_quote_submit_after', array('order' => $order));
64
+
65
+ $this->loadLayout();
66
+ $this->getLayout()
67
+ ->getBlock('content')
68
+ ->append($this->getLayout()->createBlock('bonusbox/checkout_success'));
69
+
70
+ $this->renderLayout();
71
  }
72
  }
app/code/community/Bonusbox/Bonusbox/etc/adminhtml.xml ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!--
3
+ /**
4
+ * Magento Enterprise Edition
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Magento Enterprise Edition License
9
+ * that is bundled with this package in the file LICENSE_EE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://www.magentocommerce.com/license/enterprise-edition
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * DISCLAIMER
17
+ *
18
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
19
+ * versions in the future. If you wish to customize Magento for your
20
+ * needs please refer to http://www.magentocommerce.com for more information.
21
+ *
22
+ * @category Bonusbox
23
+ * @package Bonusbox_Bonusbox
24
+ * @author symmetrics - a CGI Group brand <info@symmetrics.de>
25
+ * @author Ngoc Anh Doan <ngoc-anh.doan@cgi.com>
26
+ * @copyright 2011-2012 BonusBox GmbH
27
+ * @license http://www.opensource.org/licenses/mit-license.php The MIT License (MIT)
28
+ * @link http://bonusbox.me
29
+ * @link http://github.com/symmetrics/bonusbox_magento
30
+ */
31
+ -->
32
+ <config>
33
+ <acl>
34
+ <resources>
35
+ <admin>
36
+ <children>
37
+ <system>
38
+ <children>
39
+ <config>
40
+ <children>
41
+ <bonusbox translate="title" module="bonusbox">
42
+ <title>Bonusbox</title>
43
+ </bonusbox>
44
+ </children>
45
+ </config>
46
+ </children>
47
+ </system>
48
+
49
+ <bonusbox>
50
+ <title>Bonusbox</title>
51
+ <sort_order>71</sort_order>
52
+ <children>
53
+ <bonusbox translate="title" module="bonusbox">
54
+ <title>Config</title>
55
+ <sort_order>0</sort_order>
56
+ </bonusbox>
57
+ </children>
58
+ </bonusbox>
59
+ </children>
60
+ </admin>
61
+ </resources>
62
+ </acl>
63
+ </config>
app/code/community/Bonusbox/Bonusbox/etc/config.xml CHANGED
@@ -1,143 +1,142 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <config>
3
- <modules>
4
- <bonusbox_bonusbox>
5
- <version>1.1.4</version>
6
- </bonusbox_bonusbox>
7
- </modules>
8
- <global>
9
- <models>
10
- <bonusbox>
11
- <class>Bonusbox_Bonusbox_Model</class>
12
- </bonusbox>
13
- <salesrule>
14
- <rewrite>
15
- <validator>Bonusbox_Bonusbox_Model_SalesRule_Validator</validator>
16
- </rewrite>
17
- </salesrule>
18
- </models>
19
- <helpers>
20
- <bonusbox>
21
- <class>Bonusbox_Bonusbox_Helper</class>
22
- </bonusbox>
23
- </helpers>
24
- <blocks>
25
- <bonusbox>
26
- <class>Bonusbox_Bonusbox_Block</class>
27
- </bonusbox>
28
- </blocks>
29
-
30
- <resources>
31
- <bonusbox_setup>
32
- <setup><module>Bonusbox_Bonusbox</module></setup>
33
- <connection><use>core_setup</use></connection>
34
- </bonusbox_setup>
35
- <bonusbox_write>
36
- <connection><use>core_write</use></connection>
37
- </bonusbox_write>
38
- <bonusbox_read>
39
- <connection><use>core_read</use></connection>
40
- </bonusbox_read>
41
- </resources>
42
-
43
- <events>
44
- <salesrule_rule_condition_combine>
45
- <observers>
46
- <bonusbox>
47
- <class>bonusbox/salesRule_condition_bonusbox</class>
48
- <method>addConditions</method>
49
- </bonusbox>
50
- </observers>
51
- </salesrule_rule_condition_combine>
52
-
53
- <sales_model_service_quote_submit_after>
54
- <observers>
55
- <bonusbox>
56
- <class>bonusbox/sales_observer</class>
57
- <method>forwardOrder</method>
58
- </bonusbox>
59
- </observers>
60
- </sales_model_service_quote_submit_after>
61
- </events>
62
- </global>
63
-
64
- <frontend>
65
- <routers>
66
- <bonusbox_test>
67
- <use>standard</use>
68
- <args>
69
- <module>Bonusbox_Bonusbox</module>
70
- <frontName>bonusbox</frontName>
71
- </args>
72
- </bonusbox_test>
73
- </routers>
74
-
75
- <layout>
76
- <updates>
77
- <bonusbox>
78
- <file>bonusbox.xml</file>
79
- </bonusbox>
80
- </updates>
81
- </layout>
82
- </frontend>
83
-
84
- <adminhtml>
85
- <acl>
86
- <resources>
87
- <admin>
88
- <children>
89
- <system>
90
- <children>
91
- <config>
92
- <children>
93
- <bonusbox translate="title" module="bonusbox">
94
- <title>Bonusbox</title>
95
- </bonusbox>
96
- </children>
97
- </config>
98
- </children>
99
- </system>
100
- <bonusbox>
101
- <title>Bonusbox</title>
102
- <sort_order>71</sort_order>
103
- <children>
104
- <bonusbox translate="title" module="bonusbox">
105
- <title>Config</title>
106
- <sort_order>0</sort_order>
107
- </bonusbox>
108
- </children>
109
- </bonusbox>
110
- </children>
111
- </admin>
112
- </resources>
113
- </acl>
114
- <translate>
115
- <modules>
116
- <bonusbox_bonusbox>
117
- <files>
118
- <default>bonusbox_admin.csv</default>
119
- </files>
120
- </bonusbox_bonusbox>
121
- </modules>
122
- </translate>
123
- </adminhtml>
124
-
125
- <default>
126
- <bonusbox>
127
- <general>
128
- <enabled>0</enabled>
129
- <live>0</live>
130
- <live_public_key />
131
- <live_secret_key />
132
- <test_public_key />
133
- <test_secret_key />
134
- <url><![CDATA[https://api.bonusbox.me/]]></url>
135
- <accept_header><![CDATA[application/json,application/vnd.api;ver=1]]></accept_header>
136
- <debug_email><![CDATA[no-reply@bonusbox.me]]></debug_email>
137
- </general>
138
- <success_page>
139
- <style_url>css/bonusbox.css</style_url>
140
- </success_page>
141
- </bonusbox>
142
- </default>
143
  </config>
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!--
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * @category Bonusbox
17
+ * @package Bonusbox_Bonusbox
18
+ * @author symmetrics - a CGI Group brand <info@symmetrics.de>
19
+ * @author Ngoc Anh Doan <ngoc-anh.doan@cgi.com>
20
+ * @copyright 2011-2012 BonusBox GmbH
21
+ * @license http://www.opensource.org/licenses/mit-license.php The MIT License (MIT)
22
+ * @link http://bonusbox.me
23
+ * @link http://github.com/symmetrics/bonusbox_magento
24
+ */
25
+ -->
26
+ <config>
27
+ <modules>
28
+ <bonusbox_bonusbox>
29
+ <version>1.1.5</version>
30
+ </bonusbox_bonusbox>
31
+ </modules>
32
+ <global>
33
+ <models>
34
+ <bonusbox>
35
+ <class>Bonusbox_Bonusbox_Model</class>
36
+ </bonusbox>
37
+ <salesrule>
38
+ <rewrite>
39
+ <validator>Bonusbox_Bonusbox_Model_SalesRule_Validator</validator>
40
+ <rule_condition_combine>Bonusbox_Bonusbox_Model_SalesRule_Rule_Condition_Combine</rule_condition_combine>
41
+ </rewrite>
42
+ </salesrule>
43
+ </models>
44
+ <helpers>
45
+ <bonusbox>
46
+ <class>Bonusbox_Bonusbox_Helper</class>
47
+ </bonusbox>
48
+ </helpers>
49
+ <blocks>
50
+ <bonusbox>
51
+ <class>Bonusbox_Bonusbox_Block</class>
52
+ </bonusbox>
53
+ </blocks>
54
+
55
+ <resources>
56
+ <bonusbox_setup>
57
+ <setup>
58
+ <module>Bonusbox_Bonusbox</module>
59
+ </setup>
60
+ <connection>
61
+ <use>core_setup</use>
62
+ </connection>
63
+ </bonusbox_setup>
64
+ </resources>
65
+
66
+ <events>
67
+ <!--
68
+ BONBOX-12: Due to Magento EEs CustomerSegment module all additional
69
+ conditions are deleted and replaced.
70
+
71
+ <salesrule_rule_condition_combine>
72
+ <observers>
73
+ <bonusbox>
74
+ <class>bonusbox/salesRule_condition_bonusbox</class>
75
+ <method>addConditions</method>
76
+ </bonusbox>
77
+ </observers>
78
+ </salesrule_rule_condition_combine>
79
+ -->
80
+
81
+ <sales_model_service_quote_submit_after>
82
+ <observers>
83
+ <bonusbox>
84
+ <class>bonusbox/sales_observer</class>
85
+ <method>forwardOrder</method>
86
+ </bonusbox>
87
+ </observers>
88
+ </sales_model_service_quote_submit_after>
89
+ </events>
90
+ </global>
91
+
92
+ <frontend>
93
+ <routers>
94
+ <bonusbox_test>
95
+ <use>standard</use>
96
+ <args>
97
+ <module>Bonusbox_Bonusbox</module>
98
+ <frontName>bonusbox</frontName>
99
+ </args>
100
+ </bonusbox_test>
101
+ </routers>
102
+
103
+ <layout>
104
+ <updates>
105
+ <bonusbox>
106
+ <file>bonusbox.xml</file>
107
+ </bonusbox>
108
+ </updates>
109
+ </layout>
110
+ </frontend>
111
+
112
+ <adminhtml>
113
+ <translate>
114
+ <modules>
115
+ <bonusbox_bonusbox>
116
+ <files>
117
+ <default>bonusbox_admin.csv</default>
118
+ </files>
119
+ </bonusbox_bonusbox>
120
+ </modules>
121
+ </translate>
122
+ </adminhtml>
123
+
124
+ <default>
125
+ <bonusbox>
126
+ <general>
127
+ <enabled>0</enabled>
128
+ <live>0</live>
129
+ <live_public_key />
130
+ <live_secret_key />
131
+ <test_public_key />
132
+ <test_secret_key />
133
+ <url><![CDATA[https://api.bonusbox.me/]]></url>
134
+ <accept_header><![CDATA[application/json,application/vnd.api;ver=1]]></accept_header>
135
+ <debug_email><![CDATA[no-reply@bonusbox.me]]></debug_email>
136
+ </general>
137
+ <success_page>
138
+ <style_url>css/bonusbox.css</style_url>
139
+ </success_page>
140
+ </bonusbox>
141
+ </default>
 
142
  </config>
app/code/community/Bonusbox/Bonusbox/etc/system.xml CHANGED
@@ -1,88 +1,112 @@
1
- <?xml version="1.0"?>
2
- <config>
3
- <sections>
4
- <bonusbox translate="label" module="bonusbox">
5
- <label>Bonusbox</label>
6
- <tab>sales</tab>
7
- <sort_order>70</sort_order>
8
- <show_in_default>1</show_in_default>
9
- <show_in_website>1</show_in_website>
10
- <show_in_store>1</show_in_store>
11
- <groups>
12
- <general>
13
- <label>General</label>
14
- <sort_order>10</sort_order>
15
- <show_in_default>1</show_in_default>
16
- <show_in_website>1</show_in_website>
17
- <show_in_store>1</show_in_store>
18
- <fields>
19
- <enabled translate="label">
20
- <label>Enabled</label>
21
- <frontend_type>select</frontend_type>
22
- <source_model>adminhtml/system_config_source_yesno</source_model>
23
- <sort_order>10</sort_order>
24
- <show_in_default>1</show_in_default>
25
- <show_in_website>1</show_in_website>
26
- <show_in_store>1</show_in_store>
27
- </enabled>
28
- <live>
29
- <label>Live Mode</label>
30
- <frontend_type>select</frontend_type>
31
- <source_model>adminhtml/system_config_source_yesno</source_model>
32
- <comment>Yes = Live Mode, No = Test Mode.</comment>
33
- <sort_order>20</sort_order>
34
- <show_in_default>1</show_in_default>
35
- <show_in_website>1</show_in_website>
36
- <show_in_store>1</show_in_store>
37
- </live>
38
- <live_public_key translate="label">
39
- <label>Public Key (Live)</label>
40
- <sort_order>30</sort_order>
41
- <show_in_default>1</show_in_default>
42
- <show_in_website>1</show_in_website>
43
- <show_in_store>1</show_in_store>
44
- </live_public_key>
45
- <live_secret_key translate="label">
46
- <label>Secret Key (Live)</label>
47
- <sort_order>40</sort_order>
48
- <show_in_default>1</show_in_default>
49
- <show_in_website>1</show_in_website>
50
- <show_in_store>1</show_in_store>
51
- </live_secret_key>
52
- <test_public_key translate="label">
53
- <label>Public Key (Test)</label>
54
- <sort_order>50</sort_order>
55
- <show_in_default>1</show_in_default>
56
- <show_in_website>1</show_in_website>
57
- <show_in_store>1</show_in_store>
58
- </test_public_key>
59
- <test_secret_key translate="label">
60
- <label>Secret Key (Test)</label>
61
- <sort_order>60</sort_order>
62
- <show_in_default>1</show_in_default>
63
- <show_in_website>1</show_in_website>
64
- <show_in_store>1</show_in_store>
65
- </test_secret_key>
66
- </fields>
67
- </general>
68
- <success_page>
69
- <label>Checkout Success Page</label>
70
- <sort_order>20</sort_order>
71
- <show_in_default>1</show_in_default>
72
- <show_in_website>1</show_in_website>
73
- <show_in_store>1</show_in_store>
74
- <fields>
75
- <style_url translate="label">
76
- <label>Stylesheet</label>
77
- <comment>Provide the path relative to your skin path (e.g. "css/bonusbox.css").</comment>
78
- <sort_order>70</sort_order>
79
- <show_in_default>1</show_in_default>
80
- <show_in_website>1</show_in_website>
81
- <show_in_store>1</show_in_store>
82
- </style_url>
83
- </fields>
84
- </success_page>
85
- </groups>
86
- </bonusbox>
87
- </sections>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
88
  </config>
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * @category Bonusbox
17
+ * @package Bonusbox_Bonusbox
18
+ * @author symmetrics - a CGI Group brand <info@symmetrics.de>
19
+ * @author Ngoc Anh Doan <ngoc-anh.doan@cgi.com>
20
+ * @copyright 2011-2012 BonusBox GmbH
21
+ * @license http://www.opensource.org/licenses/mit-license.php The MIT License (MIT)
22
+ * @link http://bonusbox.me
23
+ * @link http://github.com/symmetrics/bonusbox_magento
24
+ */
25
+ -->
26
+ <config>
27
+ <sections>
28
+ <bonusbox translate="label" module="bonusbox">
29
+ <label>Bonusbox</label>
30
+ <tab>sales</tab>
31
+ <sort_order>70</sort_order>
32
+ <show_in_default>1</show_in_default>
33
+ <show_in_website>1</show_in_website>
34
+ <show_in_store>1</show_in_store>
35
+ <groups>
36
+ <general>
37
+ <label>General</label>
38
+ <sort_order>10</sort_order>
39
+ <show_in_default>1</show_in_default>
40
+ <show_in_website>1</show_in_website>
41
+ <show_in_store>1</show_in_store>
42
+ <fields>
43
+ <enabled translate="label">
44
+ <label>Enabled</label>
45
+ <frontend_type>select</frontend_type>
46
+ <source_model>adminhtml/system_config_source_yesno</source_model>
47
+ <sort_order>10</sort_order>
48
+ <show_in_default>1</show_in_default>
49
+ <show_in_website>1</show_in_website>
50
+ <show_in_store>1</show_in_store>
51
+ </enabled>
52
+ <live>
53
+ <label>Live Mode</label>
54
+ <frontend_type>select</frontend_type>
55
+ <source_model>adminhtml/system_config_source_yesno</source_model>
56
+ <comment>Yes = Live Mode, No = Test Mode.</comment>
57
+ <sort_order>20</sort_order>
58
+ <show_in_default>1</show_in_default>
59
+ <show_in_website>1</show_in_website>
60
+ <show_in_store>1</show_in_store>
61
+ </live>
62
+ <live_public_key translate="label">
63
+ <label>Public Key (Live)</label>
64
+ <sort_order>30</sort_order>
65
+ <show_in_default>1</show_in_default>
66
+ <show_in_website>1</show_in_website>
67
+ <show_in_store>1</show_in_store>
68
+ </live_public_key>
69
+ <live_secret_key translate="label">
70
+ <label>Secret Key (Live)</label>
71
+ <sort_order>40</sort_order>
72
+ <show_in_default>1</show_in_default>
73
+ <show_in_website>1</show_in_website>
74
+ <show_in_store>1</show_in_store>
75
+ </live_secret_key>
76
+ <test_public_key translate="label">
77
+ <label>Public Key (Test)</label>
78
+ <sort_order>50</sort_order>
79
+ <show_in_default>1</show_in_default>
80
+ <show_in_website>1</show_in_website>
81
+ <show_in_store>1</show_in_store>
82
+ </test_public_key>
83
+ <test_secret_key translate="label">
84
+ <label>Secret Key (Test)</label>
85
+ <sort_order>60</sort_order>
86
+ <show_in_default>1</show_in_default>
87
+ <show_in_website>1</show_in_website>
88
+ <show_in_store>1</show_in_store>
89
+ </test_secret_key>
90
+ </fields>
91
+ </general>
92
+ <success_page>
93
+ <label>Checkout Success Page</label>
94
+ <sort_order>20</sort_order>
95
+ <show_in_default>1</show_in_default>
96
+ <show_in_website>1</show_in_website>
97
+ <show_in_store>1</show_in_store>
98
+ <fields>
99
+ <style_url translate="label">
100
+ <label>Stylesheet</label>
101
+ <comment>Provide the path relative to your skin path (e.g. "css/bonusbox.css").</comment>
102
+ <sort_order>70</sort_order>
103
+ <show_in_default>1</show_in_default>
104
+ <show_in_website>1</show_in_website>
105
+ <show_in_store>1</show_in_store>
106
+ </style_url>
107
+ </fields>
108
+ </success_page>
109
+ </groups>
110
+ </bonusbox>
111
+ </sections>
112
  </config>
app/design/frontend/base/default/layout/bonusbox.xml ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!--
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * @category Bonusbox
17
+ * @package Bonusbox_Bonusbox
18
+ * @author symmetrics - a CGI Group brand <info@symmetrics.de>
19
+ * @author Ngoc Anh Doan <ngoc-anh.doan@cgi.com>
20
+ * @copyright 2011-2012 BonusBox GmbH
21
+ * @license http://www.opensource.org/licenses/mit-license.php The MIT License (MIT)
22
+ * @link http://bonusbox.me
23
+ * @link http://github.com/symmetrics/bonusbox_magento
24
+ */
25
+ -->
26
+ <layout version="0.1.0">
27
+ <checkout_onepage_success>
28
+ <reference name="content">
29
+ <block type="bonusbox/checkout_success" name="bonusbox.checkout_success" />
30
+ </reference>
31
+ </checkout_onepage_success>
32
+
33
+ <firecheckout_index_success>
34
+ <reference name="content">
35
+ <block type="bonusbox/checkout_success" name="bonusbox.checkout_success" />
36
+ </reference>
37
+ </firecheckout_index_success>
38
+ </layout>
app/design/frontend/base/default/template/bonusbox/checkout/success.phtml ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * @category design
16
+ * @package default_default
17
+ * @author symmetrics - a CGI Group brand <info@symmetrics.de>
18
+ * @author Ngoc Anh Doan <ngoc-anh.doan@cgi.com>
19
+ * @copyright 2011-2012 BonusBox GmbH
20
+ * @license http://www.opensource.org/licenses/mit-license.php The MIT License (MIT)
21
+ * @link http://bonusbox.me
22
+ * @link http://github.com/symmetrics/bonusbox_magento
23
+ * @link https://github.com/symmetrics/bonusbox_magento
24
+ */
25
+
26
+ /**
27
+ * 'bonusbox/checkout/success.phtml'
28
+ */
29
+ ?>
30
+
31
+ <iframe style="overflow: hidden; border: 0; width: 100%;" src="<?php echo $this->getSuccessPageUrl() ?>" />
app/design/frontend/default/default/layout/bonusbox.xml DELETED
@@ -1,14 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <layout version="0.1.0">
3
- <checkout_onepage_success>
4
- <reference name="content">
5
- <block type="bonusbox/checkout_success" name="bonusbox.checkout_success" />
6
- </reference>
7
- </checkout_onepage_success>
8
-
9
- <firecheckout_index_success>
10
- <reference name="content">
11
- <block type="bonusbox/checkout_success" name="bonusbox.checkout_success" />
12
- </reference>
13
- </firecheckout_index_success>
14
- </layout>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/design/frontend/default/default/template/bonusbox/checkout/success.phtml DELETED
@@ -1 +0,0 @@
1
- <iframe style="overflow: hidden; border: 0; width: 100%;" src="<?php echo $this->getSuccessPageUrl() ?>" />
 
app/etc/modules/Bonusbox_Bonusbox.xml CHANGED
@@ -1,9 +1,36 @@
1
  <?xml version="1.0"?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  <config>
3
- <modules>
4
- <Bonusbox_Bonusbox>
5
- <active>true</active>
6
- <codePool>community</codePool>
7
- </Bonusbox_Bonusbox>
8
- </modules>
 
 
 
9
  </config>
1
  <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * @category Bonusbox
17
+ * @package Bonusbox_Bonusbox
18
+ * @author symmetrics - a CGI Group brand <info@symmetrics.de>
19
+ * @author Ngoc Anh Doan <ngoc-anh.doan@cgi.com>
20
+ * @copyright 2011-2012 BonusBox GmbH
21
+ * @license http://www.opensource.org/licenses/mit-license.php The MIT License (MIT)
22
+ * @link http://bonusbox.me
23
+ * @link http://github.com/symmetrics/bonusbox_magento
24
+ */
25
+ -->
26
  <config>
27
+ <modules>
28
+ <Bonusbox_Bonusbox>
29
+ <active>true</active>
30
+ <codePool>community</codePool>
31
+ <depends>
32
+ <Mage_SalesRule />
33
+ </depends>
34
+ </Bonusbox_Bonusbox>
35
+ </modules>
36
  </config>
app/locale/de_DE/bonusbox_admin.csv ADDED
@@ -0,0 +1 @@
 
1
+ "Enabled","Enabled"
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Bonusbox_Bonusbox1</name>
4
- <version>1.1.4</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/MIT">MIT License</license>
7
  <channel>community</channel>
@@ -10,11 +10,26 @@
10
  <description>Bonusbox enables merchants to win and retain customers in Facebook. Reward customers with bonusbox credits for referrals, comments and for repeat purchases!
11
 
12
  For further information, check out our homepage www.bonusbox.me.</description>
13
- <notes>Loyalty programme for success pages</notes>
14
- <authors><author><name>Jan Riethmayer</name><user>auto-converted</user><email>jan@bonusbox.me</email></author></authors>
15
- <date>2012-03-13</date>
16
- <time>21:33:35</time>
17
- <contents><target name="magecommunity"><dir name="Bonusbox"><dir name="Bonusbox"><dir name="Block"><dir name="Checkout"><file name="Success.php" hash="d54f41cb4ef4e7fa3586cbd5525bf697"/></dir></dir><dir name="controllers"><file name="TestController.php" hash="c0b4a8bc94e61ad974cb2639a9f31d2e"/></dir><dir name="etc"><file name="config.xml" hash="a384c405c94182c031638dda32914be1"/><file name="system.xml" hash="34c55484b3db6b7df74078ff9259831a"/></dir><dir name="Helper"><file name="Data.php" hash="ac73d44d017c8cc71812e4c6c2a1c89a"/><file name="Successpage.php" hash="bc389365d75932a6054df02f3359597d"/></dir><dir name="Model"><dir name="Client"><file name="Badges.php" hash="ef1b25b841ab24db961a9007de26d3a2"/><file name="Coupons.php" hash="d194a60a18c8ef5d50885de48edd5f58"/><file name="Successpages.php" hash="f90e95b81a385aa6e11ca7ece3ade63b"/></dir><dir name="Sales"><file name="Observer.php" hash="ca70bb57f270691743c9683438cda6c0"/></dir><dir name="SalesRule"><dir name="Condition"><file name="Bonusbox.php" hash="9eeaf056104a8dcd55d7ba37e7d00184"/></dir><file name="Validator.php" hash="db2446fb3b40d660bc5a413e3ca9e5ec"/></dir><file name="Client.php" hash="4ba2bf781bbf3ad5125fdae40170f03f"/><file name="Session.php" hash="afd1b944ef8a37533fbe725c750b5c10"/></dir><file name="Exception.php" hash="3816ef60762bc800941bfb975525d581"/></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="bonusbox.xml" hash="8a0f839c7be99208bd860cd788fb37fe"/></dir><dir name="template"><dir name="bonusbox"><dir name="checkout"><file name="success.phtml" hash="2db7c3f9ba5bc1ba70332550c9def603"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Bonusbox_Bonusbox.xml" hash="924b6d17825c821f6d4e5846eba164c5"/></dir></target></contents>
 
 
 
 
 
 
 
 
18
  <compatible/>
19
- <dependencies/>
 
 
 
 
 
 
 
20
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Bonusbox_Bonusbox1</name>
4
+ <version>1.1.5</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/MIT">MIT License</license>
7
  <channel>community</channel>
10
  <description>Bonusbox enables merchants to win and retain customers in Facebook. Reward customers with bonusbox credits for referrals, comments and for repeat purchases!
11
 
12
  For further information, check out our homepage www.bonusbox.me.</description>
13
+ <notes>* PHPCS and PHPMD checks
14
+ * Compatibility of Magento CE 1.7
15
+ * Compatibility of Magento EE 1.12</notes>
16
+ <authors>
17
+ <author>
18
+ <name>Jan Riethmayer</name>
19
+ <user>jan_bonusbox</user>
20
+ <email>jan@bonusbox.me</email>
21
+ </author>
22
+ </authors>
23
+ <date>2012-07-04</date>
24
+ <time>14:02:27</time>
25
+ <contents><target name="mageskin"><dir name="frontend"><dir name="default"><dir name="default"><dir name="css"><file name="bonusbox.css"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="bonusbox.xml"/></dir><dir name="template"><dir name="bonusbox"><dir name="checkout"><file name="success.phtml"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Bonusbox_Bonusbox.xml"/></dir></target><target name="magecommunity"><dir name="Bonusbox"><dir name="Bonusbox"><dir name="controllers"><file name="TestController.php"/></dir><dir name="etc"><file name="system.xml"/><file name="config.xml"/><file name="adminhtml.xml"/></dir><dir name="Model"><dir name="Client"><file name="Badges.php"/><file name="Coupons.php"/><file name="Successpages.php"/></dir><dir name="SalesRule"><dir name="Rule"><dir name="Condition"><file name="Combine.php"/></dir></dir><dir name="Condition"><file name="Bonusbox.php"/></dir><file name="Validator.php"/></dir><dir name="Sales"><file name="Observer.php"/></dir><file name="Client.php"/><file name="Session.php"/></dir><dir name="Helper"><file name="Data.php"/><file name="Successpage.php"/></dir><dir name="Block"><dir name="Checkout"><file name="Success.php"/></dir></dir><file name="Exception.php"/></dir></dir></target><target name="magelocale"><dir name="de_DE"><file name="bonusbox_admin.csv"/></dir></target></contents>
26
  <compatible/>
27
+ <dependencies>
28
+ <required>
29
+ <php>
30
+ <min>5.2.0</min>
31
+ <max>6.0.0</max>
32
+ </php>
33
+ </required>
34
+ </dependencies>
35
  </package>
skin/frontend/default/default/css/bonusbox.css ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ @charset 'UTF-8';
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * @category skin
16
+ * @package default_default
17
+ * @author symmetrics - a CGI Group brand <info@symmetrics.de>
18
+ * @author Ngoc Anh Doan <ngoc-anh.doan@cgi.com>
19
+ * @copyright 2011-2012 BonusBox GmbH
20
+ * @license http://www.opensource.org/licenses/mit-license.php The MIT License (MIT)
21
+ * @link http://bonusbox.me
22
+ * @link http://github.com/symmetrics/bonusbox_magento
23
+ * @link https://github.com/symmetrics/bonusbox_magento
24
+ */
25
+
26
+ /**
27
+ * minimal styles for default skin
28
+ *
29
+ * 'css/bonusbox.css'
30
+ */
31
+
32
+ body {
33
+ color: #2F2F2F;
34
+ font: 12px/1.55 Arial,Helvetica,sans-serif;
35
+ }