Tb_Tenbucks - Version 1.1.4

Version Notes

Add new set of API

Download this release

Release Info

Developer Web In Color
Extension Tb_Tenbucks
Version 1.1.4
Comparing to
See all releases


Version 1.1.4

Files changed (56) hide show
  1. app/code/community/Tb/Tenbucks/.DS_Store +0 -0
  2. app/code/community/Tb/Tenbucks/Block/.DS_Store +0 -0
  3. app/code/community/Tb/Tenbucks/Block/Adminhtml/.DS_Store +0 -0
  4. app/code/community/Tb/Tenbucks/Block/Adminhtml/Register.php +45 -0
  5. app/code/community/Tb/Tenbucks/Block/Adminhtml/Register/Form.php +71 -0
  6. app/code/community/Tb/Tenbucks/Block/Adminhtml/View.php +71 -0
  7. app/code/community/Tb/Tenbucks/Helper/Api.php +78 -0
  8. app/code/community/Tb/Tenbucks/Helper/Data.php +86 -0
  9. app/code/community/Tb/Tenbucks/Model/.DS_Store +0 -0
  10. app/code/community/Tb/Tenbucks/Model/Catalog/.DS_Store +0 -0
  11. app/code/community/Tb/Tenbucks/Model/Catalog/Category/Api.php +62 -0
  12. app/code/community/Tb/Tenbucks/Model/Catalog/Category/Api/V2.php +29 -0
  13. app/code/community/Tb/Tenbucks/Model/Catalog/Product/Api.php +69 -0
  14. app/code/community/Tb/Tenbucks/Model/Catalog/Product/Api/V2.php +29 -0
  15. app/code/community/Tb/Tenbucks/Model/Catalog/Product/Attribute/Api.php +67 -0
  16. app/code/community/Tb/Tenbucks/Model/Catalog/Product/Attribute/Api/V2.php +28 -0
  17. app/code/community/Tb/Tenbucks/Model/Core/Store/Api.php +58 -0
  18. app/code/community/Tb/Tenbucks/Model/Core/Store/Api/V2.php +29 -0
  19. app/code/community/Tb/Tenbucks/Model/Directory/Currency/Api.php +56 -0
  20. app/code/community/Tb/Tenbucks/Model/Directory/Currency/Api/V2.php +29 -0
  21. app/code/community/Tb/Tenbucks/Model/Observer.php +43 -0
  22. app/code/community/Tb/Tenbucks/Model/Sales/Status/Api.php +41 -0
  23. app/code/community/Tb/Tenbucks/Model/Sales/Status/Api/V2.php +29 -0
  24. app/code/community/Tb/Tenbucks/Model/Shipping/Api.php +76 -0
  25. app/code/community/Tb/Tenbucks/Model/Shipping/Api/V2.php +29 -0
  26. app/code/community/Tb/Tenbucks/Model/System/.DS_Store +0 -0
  27. app/code/community/Tb/Tenbucks/Model/System/Config/Source/Attributes.php +77 -0
  28. app/code/community/Tb/Tenbucks/Model/Webhooks.php +83 -0
  29. app/code/community/Tb/Tenbucks/controllers/.DS_Store +0 -0
  30. app/code/community/Tb/Tenbucks/controllers/TenbucksController.php +114 -0
  31. app/code/community/Tb/Tenbucks/data/.DS_Store +0 -0
  32. app/code/community/Tb/Tenbucks/data/tenbucks_connect_setup/data-install-1.0.0.php +36 -0
  33. app/code/community/Tb/Tenbucks/etc/.DS_Store +0 -0
  34. app/code/community/Tb/Tenbucks/etc/adminhtml.xml +60 -0
  35. app/code/community/Tb/Tenbucks/etc/api.xml +182 -0
  36. app/code/community/Tb/Tenbucks/etc/config.xml +128 -0
  37. app/code/community/Tb/Tenbucks/etc/system.xml +46 -0
  38. app/code/community/Tb/Tenbucks/etc/wsdl.xml +229 -0
  39. app/code/community/Tb/Tenbucks/etc/wsi.xml +294 -0
  40. app/design/adminhtml/default/default/layout/tenbucks.xml +41 -0
  41. app/design/adminhtml/default/default/template/tenbucks/view.phtml +39 -0
  42. app/etc/modules/Tb_Tenbucks.xml +9 -0
  43. app/locale/en_US/Tb_Tenbucks.csv +0 -0
  44. app/locale/fr_FR/Tb_Tenbucks.csv +0 -0
  45. lib/tenbucks/tenbucks_registration_client/LICENSE +21 -0
  46. lib/tenbucks/tenbucks_registration_client/README.md +36 -0
  47. lib/tenbucks/tenbucks_registration_client/src/TenbucksRegistrationClient.php +156 -0
  48. lib/tenbucks/tenbucks_registration_client/tests/TenbucksRegistrationClientTest.php +57 -0
  49. lib/tenbucks/tenbuckswebhooks/.gitignore +6 -0
  50. lib/tenbucks/tenbuckswebhooks/LICENSE +201 -0
  51. lib/tenbucks/tenbuckswebhooks/README.md +26 -0
  52. lib/tenbucks/tenbuckswebhooks/src/TenbucksWebhooks.php +94 -0
  53. lib/tenbucks/tenbuckswebhooks/tests/TenbucksWebhooksTest.php +52 -0
  54. package.xml +18 -0
  55. skin/adminhtml/default/default/tenbucks/css/styles.css +17 -0
  56. skin/adminhtml/default/default/tenbucks/images/logo_220x50.png +0 -0
app/code/community/Tb/Tenbucks/.DS_Store ADDED
Binary file
app/code/community/Tb/Tenbucks/Block/.DS_Store ADDED
Binary file
app/code/community/Tb/Tenbucks/Block/Adminhtml/.DS_Store ADDED
Binary file
app/code/community/Tb/Tenbucks/Block/Adminhtml/Register.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Tenbucks
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 hello@tenbucks.io so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Tenbucks to newer
18
+ * versions in the future.
19
+ *
20
+ * @category Tenbucks
21
+ * @package Tb_Tenbucks
22
+ * @copyright Copyright (c) 2016 Tenbucks. (https://www.tenbucks.io)
23
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
24
+ * @author Tenbucks <hello@tenbucks.io>
25
+ */
26
+ class Tb_Tenbucks_Block_Adminhtml_Register extends Mage_Adminhtml_Block_Widget_Form_Container {
27
+
28
+ public function __construct() {
29
+
30
+ parent::__construct();
31
+
32
+ $this->_controller = 'adminhtml_tenbucks';
33
+ $this->_blockGroup = 'tenbucks';
34
+ $this->_headerText = Mage::helper('tenbucks')->__('Tenbucks. Sign Up');
35
+
36
+ $this->_updateButton('save', 'label', Mage::helper('tenbucks')->__('Sign Up'));
37
+ if(!Mage::helper('tenbucks')->canSignup()) {
38
+ $this->_updateButton('save','disabled',true);
39
+ }
40
+
41
+ $this->_removeButton('reset');
42
+ $this->_removeButton('back');
43
+ }
44
+
45
+ }
app/code/community/Tb/Tenbucks/Block/Adminhtml/Register/Form.php ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Tenbucks
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 hello@tenbucks.io 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 Tenbucks to newer
19
+ * versions in the future.
20
+ *
21
+ * @category Tenbucks
22
+ * @package Tb_Tenbucks
23
+ * @copyright Copyright (c) 2016 Tenbucks. (https://www.tenbucks.io)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ * @author Tenbucks <hello@tenbucks.io>
26
+ */
27
+ class Tb_Tenbucks_Block_Adminhtml_Register_Form extends Mage_Adminhtml_Block_Widget_Form {
28
+
29
+ protected function _prepareForm() {
30
+
31
+ $form = new Varien_Data_Form(array(
32
+ 'id' => 'edit_form',
33
+ 'action' => $this->getUrl('*/*/register'),
34
+ 'method' => 'post',
35
+ ));
36
+
37
+ $form->setUseContainer(true);
38
+ $this->setForm($form);
39
+
40
+ $fieldset = $form->addFieldset('edit_form', array('legend' => Mage::helper('tenbucks')->__('Please fill up details')));
41
+
42
+ $fieldset->addField('email', 'text', array(
43
+ 'label' => Mage::helper('tenbucks')->__('Email'),
44
+ 'name' => 'email',
45
+ 'class' => 'validate-email',
46
+ 'required' => true,
47
+ 'value' => Mage::getStoreConfig('trans_email/ident_general/email'),
48
+ 'after_element_html' => '<p class="note"><span>'.Mage::helper('tenbucks')->__('Your password will be sent to this email so it must be valid. If you already have an account with us, this shop will be added to your account.').'</span></p>',
49
+ ));
50
+
51
+ $fieldset->addField('email-confirm', 'text', array(
52
+ 'label' => Mage::helper('tenbucks')->__('Email Confirm'),
53
+ 'name' => 'email-confirm' ,
54
+ 'class' => 'validate-email',
55
+ 'required' => true,
56
+ ));
57
+
58
+ $fieldset->addField('sponsor', 'text', array(
59
+ 'label' => Mage::helper('tenbucks')->__('Sponsor Email'),
60
+ 'name' => 'sponsor' ,
61
+ 'class' => 'require-valid validate-email',
62
+ ));
63
+
64
+
65
+ if ( Mage::registry('register_data') ) {
66
+ $form->setValues(Mage::registry('register_data')->getData());
67
+ }
68
+ return parent::_prepareForm();
69
+ }
70
+
71
+ }
app/code/community/Tb/Tenbucks/Block/Adminhtml/View.php ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Tenbucks
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 hello@tenbucks.io so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Tenbucks to newer
18
+ * versions in the future.
19
+ *
20
+ * @category Tenbucks
21
+ * @package Tb_Tenbucks
22
+ * @copyright Copyright (c) 2016 Tenbucks. (https://www.tenbucks.io)
23
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
24
+ * @author Tenbucks <hello@tenbucks.io>
25
+ */
26
+ class Tb_Tenbucks_Block_Adminhtml_View extends Mage_Adminhtml_Block_Widget_Container {
27
+
28
+ public function __construct() {
29
+
30
+ $this->_controller = 'adminhtml_tenbucks';
31
+ $this->_blockGroup = 'tenbucks';
32
+ $this->_headerText = Mage::helper('tenbucks')->__('My Applications');
33
+ $this->_addButton('standalone', array(
34
+ 'label' => Mage::helper('tenbucks')->__('Standalone Mode'),
35
+ 'onclick' => "window.open('".$this->getIframeUrl(true)."')",
36
+ 'class' => 'add-widget'
37
+ ));
38
+ parent::__construct();
39
+ }
40
+
41
+ public function getIframeUrl($standalone = false) {
42
+
43
+ $params['url'] = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
44
+ $params['platform'] = 'Magento';
45
+ $params['cms_version'] = (string)Mage::getVersion();
46
+ $params['module_version'] = Mage::helper('tenbucks')->getModuleVersion();
47
+
48
+ $redirect = $this->getRequest()->getParam('redirect');
49
+
50
+ switch($redirect) {
51
+ case 'account':
52
+ $params['redirect'] = 'account';
53
+ break;
54
+
55
+ default :
56
+ $params['redirect'] = 'apps';
57
+ break;
58
+ }
59
+
60
+ if ($standalone) {
61
+ $params['standalone'] = 1;
62
+ } else {
63
+ $params['standalone'] = 0;
64
+ }
65
+
66
+ return Mage::helper('tenbucks')->getApiUrl('dispatch').'?'.http_build_query($params);
67
+ }
68
+
69
+
70
+
71
+ }
app/code/community/Tb/Tenbucks/Helper/Api.php ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Tenbucks
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 hello@tenbucks.io 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 Tenbucks to newer
19
+ * versions in the future.
20
+ *
21
+ * @category Tenbucks
22
+ * @package Tb_Tenbucks
23
+ * @copyright Copyright (c) 2016 Tenbucks. (https://www.tenbucks.io)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ * @author Tenbucks <hello@tenbucks.io>
26
+ */
27
+ class Tb_Tenbucks_Helper_Api extends Mage_Core_Helper_Abstract {
28
+
29
+ public function createUser() {
30
+
31
+ if (Mage::helper('tenbucks')->getApiKey()) {
32
+ // if api key already generated.
33
+ return Mage::helper('tenbucks')->getApiKey();
34
+ } else {
35
+
36
+ // generate API Key randomly
37
+ $api_key = Mage::helper('core')->getHash(Mage::helper('core')->getRandomString($length = 7));
38
+
39
+ // set API role
40
+ $api_role = Mage::getModel('api/roles')
41
+ ->setName('Tenbucks API')
42
+ ->setPid(false)
43
+ ->setRoleType('G')
44
+ ->save();
45
+
46
+ Mage::getModel('api/rules')
47
+ ->setRoleId($api_role->getId())
48
+ ->setResources(array('all'))
49
+ ->saveRel();
50
+
51
+ // create API user
52
+ $api_user = Mage::getModel('api/user');
53
+
54
+ $api_user->setData(array(
55
+ 'username' => 'tenbucks',
56
+ 'firstname' => 'tenbucks',
57
+ 'lastname' => 'tenbucks',
58
+ 'email' => 'hello@tenbucks.io',
59
+ 'is_active' => 1,
60
+ 'user_roles' => '',
61
+ 'assigned_user_role' => '',
62
+ 'role_name' => '',
63
+ 'roles' => array($api_role->getId())
64
+ ));
65
+
66
+ $api_user->setApiKey($api_key);
67
+
68
+ $api_user->save()->load($api_user->getId());
69
+
70
+ $api_user->setRoleIds(array($api_role->getId()))
71
+ ->setRoleUserId($api_user->getUserId())
72
+ ->saveRelations();
73
+
74
+ return $api_key;
75
+ }
76
+ }
77
+
78
+ }
app/code/community/Tb/Tenbucks/Helper/Data.php ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Tenbucks
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 hello@tenbucks.io so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Tenbucks to newer
18
+ * versions in the future.
19
+ *
20
+ * @category Tenbucks
21
+ * @package Tb_Tenbucks
22
+ * @copyright Copyright (c) 2016 Tenbucks. (https://www.tenbucks.io)
23
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
24
+ * @author Tenbucks <hello@tenbucks.io>
25
+ */
26
+
27
+ class Tb_Tenbucks_Helper_Data extends Mage_Core_Helper_Abstract
28
+ {
29
+ const URI = 'https://apps.tenbucks.io';
30
+
31
+ const XML_CONFIG_TENBUCKS_GENERAL_GTIN = 'tenbucks/general/gtin';
32
+ const XML_CONFIG_TENBUCKS_GENERAL_INSTALLED = 'tenbucks/general/installed';
33
+ const XML_CONFIG_TENBUCKS_GENERAL_API_KEY = 'tenbucks/general/api_key';
34
+
35
+ public function getModuleVersion() {
36
+
37
+ return (string)Mage::getConfig()->getModuleConfig('Tb_Tenbucks')->version;
38
+ }
39
+
40
+ public function getApiUrl($path = '') {
41
+
42
+ if($path) {
43
+ return self::URI . DS . $path;
44
+ } else {
45
+ return self::URI;
46
+ }
47
+ }
48
+
49
+
50
+ public function getGtinCode() {
51
+ return Mage::getStoreConfig(self::XML_CONFIG_TENBUCKS_GENERAL_GTIN);
52
+ }
53
+
54
+ public function isInstalled() {
55
+ return Mage::getStoreConfigFlag(self::XML_CONFIG_TENBUCKS_GENERAL_INSTALLED);
56
+ }
57
+
58
+ public function setisInstalled() {
59
+ return Mage::getConfig()->saveConfig(self::XML_CONFIG_TENBUCKS_GENERAL_INSTALLED,1);
60
+ }
61
+
62
+ public function canSignup() {
63
+ if(!Mage::getStoreConfig('general/store_information/name')) {
64
+ return false;
65
+ }
66
+ if(!$this->getGtinCode()) {
67
+ return false;
68
+ }
69
+
70
+ return true;
71
+ }
72
+
73
+ public function getApiKey() {
74
+ return Mage::getStoreConfig(self::XML_CONFIG_TENBUCKS_GENERAL_API_KEY);
75
+ }
76
+
77
+ public function setApiKey($api_key = '') {
78
+ return Mage::getConfig()->saveConfig(self::XML_CONFIG_TENBUCKS_GENERAL_API_KEY,$api_key);
79
+ }
80
+
81
+
82
+
83
+
84
+
85
+
86
+ }
app/code/community/Tb/Tenbucks/Model/.DS_Store ADDED
Binary file
app/code/community/Tb/Tenbucks/Model/Catalog/.DS_Store ADDED
Binary file
app/code/community/Tb/Tenbucks/Model/Catalog/Category/Api.php ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Tenbucks
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 hello@tenbucks.io so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Tenbucks to newer
18
+ * versions in the future.
19
+ *
20
+ * @category Tenbucks
21
+ * @package Tb_Tenbucks
22
+ * @copyright Copyright (c) 2016 Tenbucks. (https://www.tenbucks.io)
23
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
24
+ * @author Tenbucks <hello@tenbucks.io>
25
+ */
26
+
27
+ class Tb_Tenbucks_Model_Catalog_Category_Api extends Mage_Catalog_Model_Category_Api
28
+ {
29
+
30
+ /**
31
+ * Retrieve list of assigned products to category
32
+ *
33
+ * @param int $categoryId
34
+ * @param string|int $store
35
+ * @return array
36
+ */
37
+ public function assignedProducts($categoryId, $store = null)
38
+ {
39
+ $category = $this->_initCategory($categoryId);
40
+
41
+ $storeId = $this->_getStoreId($store);
42
+ $collection = $category->setStoreId($storeId)->getProductCollection()
43
+ ->addAttributeToSelect('name');
44
+ ($storeId == 0)? $collection->addOrder('position', 'asc') : $collection->setOrder('position', 'asc');;
45
+
46
+ $result = array();
47
+
48
+ foreach ($collection as $product) {
49
+
50
+ $result[] = array(
51
+ 'product_id' => $product->getId(),
52
+ 'type' => $product->getTypeId(),
53
+ 'set' => $product->getAttributeSetId(),
54
+ 'sku' => $product->getSku(),
55
+ 'name' => $product->getName(),
56
+ 'position' => $product->getCatIndexPosition()
57
+ );
58
+ }
59
+
60
+ return $result;
61
+ }
62
+ }
app/code/community/Tb/Tenbucks/Model/Catalog/Category/Api/V2.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Tenbucks
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 hello@tenbucks.io 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 Tenbucks to newer
19
+ * versions in the future.
20
+ *
21
+ * @category Tenbucks
22
+ * @package Tb_Tenbucks
23
+ * @copyright Copyright (c) 2016 Tenbucks. (https://www.tenbucks.io)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ * @author Tenbucks <hello@tenbucks.io>
26
+ */
27
+ class Tb_Tenbucks_Model_Catalog_Category_Api_V2 extends Tb_Tenbucks_Model_Catalog_Category_Api
28
+ {
29
+ }
app/code/community/Tb/Tenbucks/Model/Catalog/Product/Api.php ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Tenbucks
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 hello@tenbucks.io 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 Tenbucks to newer
19
+ * versions in the future.
20
+ *
21
+ * @category Tenbucks
22
+ * @package Tb_Tenbucks
23
+ * @copyright Copyright (c) 2016 Tenbucks. (https://www.tenbucks.io)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ * @author Tenbucks <hello@tenbucks.io>
26
+ */
27
+ class Tb_Tenbucks_Model_Catalog_Product_Api extends Mage_Catalog_Model_Product_Api {
28
+
29
+ /**
30
+ * Retrieve list of products with basic info (id, sku, type, set, name)
31
+ * assigned to at list one category
32
+ *
33
+ * @param null|object|array $filters
34
+ * @param string|int $store
35
+ * @return array
36
+ */
37
+ public function itemsInCategory($filters = null, $store = null) {
38
+ $collection = Mage::getModel('catalog/product')->getCollection()
39
+ ->addStoreFilter($this->_getStoreId($store))
40
+ ->addAttributeToSelect('name');
41
+
42
+ /** @var $apiHelper Mage_Api_Helper_Data */
43
+ $apiHelper = Mage::helper('api');
44
+ $filters = $apiHelper->parseFilters($filters, $this->_filtersMap);
45
+ try {
46
+ foreach ($filters as $field => $value) {
47
+ $collection->addFieldToFilter($field, $value);
48
+ }
49
+ } catch (Mage_Core_Exception $e) {
50
+ $this->_fault('filters_invalid', $e->getMessage());
51
+ }
52
+ $result = array();
53
+ foreach ($collection as $product) {
54
+ if (!empty($product->getCategoryIds())) {
55
+ $result[] = array(
56
+ 'product_id' => $product->getId(),
57
+ 'sku' => $product->getSku(),
58
+ 'name' => $product->getName(),
59
+ 'set' => $product->getAttributeSetId(),
60
+ 'type' => $product->getTypeId(),
61
+ 'category_ids' => $product->getCategoryIds(),
62
+ 'website_ids' => $product->getWebsiteIds()
63
+ );
64
+ }
65
+ }
66
+ return $result;
67
+ }
68
+
69
+ }
app/code/community/Tb/Tenbucks/Model/Catalog/Product/Api/V2.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Tenbucks
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 hello@tenbucks.io 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 Tenbucks to newer
19
+ * versions in the future.
20
+ *
21
+ * @category Tenbucks
22
+ * @package Tb_Tenbucks
23
+ * @copyright Copyright (c) 2016 Tenbucks. (https://www.tenbucks.io)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ * @author Tenbucks <hello@tenbucks.io>
26
+ */
27
+ class Tb_Tenbucks_Model_Catalog_Product_Api_V2 extends Tb_Tenbucks_Model_Catalog_Product_Api
28
+ {
29
+ }
app/code/community/Tb/Tenbucks/Model/Catalog/Product/Attribute/Api.php ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Tenbucks
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 hello@tenbucks.io 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 Tenbucks to newer
19
+ * versions in the future.
20
+ *
21
+ * @category Tenbucks
22
+ * @package Tb_Tenbucks
23
+ * @copyright Copyright (c) 2016 Tenbucks. (https://www.tenbucks.io)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ * @author Tenbucks <hello@tenbucks.io>
26
+ */
27
+ class Tb_Tenbucks_Model_Catalog_Product_Attribute_Api extends Mage_Catalog_Model_Product_Attribute_Api {
28
+
29
+ /**
30
+ * Retrieve attributes list
31
+ *
32
+ * @param int $setId
33
+ * @return array
34
+ */
35
+ public function items($setId = null) {
36
+ $attributes = Mage::getModel('catalog/product')->getResource()
37
+ ->loadAllAttributes()
38
+ ->getSortedAttributes($setId);
39
+ $result = array();
40
+
41
+ foreach ($attributes as $attribute) {
42
+ /* @var $attribute Mage_Catalog_Model_Resource_Eav_Attribute */
43
+ if ($attribute->getId() && $this->_isAllowedAttribute($attribute)) {
44
+ if ($attribute->isInSet($setId) || $setId == null) {
45
+ if (!$attribute->getId() || $attribute->isScopeGlobal()) {
46
+ $scope = 'global';
47
+ } elseif ($attribute->isScopeWebsite()) {
48
+ $scope = 'website';
49
+ } else {
50
+ $scope = 'store';
51
+ }
52
+
53
+ $result[] = array(
54
+ 'attribute_id' => $attribute->getId(),
55
+ 'code' => $attribute->getAttributeCode(),
56
+ 'type' => $attribute->getFrontendInput(),
57
+ 'required' => $attribute->getIsRequired(),
58
+ 'scope' => $scope
59
+ );
60
+ }
61
+ }
62
+ }
63
+
64
+ return $result;
65
+ }
66
+
67
+ }
app/code/community/Tb/Tenbucks/Model/Catalog/Product/Attribute/Api/V2.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Tenbucks
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 hello@tenbucks.io 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 Tenbucks to newer
19
+ * versions in the future.
20
+ *
21
+ * @category Tenbucks
22
+ * @package Tb_Tenbucks
23
+ * @copyright Copyright (c) 2016 Tenbucks. (https://www.tenbucks.io)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ * @author Tenbucks <hello@tenbucks.io>
26
+ */
27
+ class Tb_Tenbucks_Model_Catalog_Product_Attribute_Api_V2 extends Tb_Tenbucks_Model_Catalog_Product_Attribute_Api {
28
+ }
app/code/community/Tb/Tenbucks/Model/Core/Store/Api.php ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Tenbucks
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 hello@tenbucks.io 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 Tenbucks to newer
19
+ * versions in the future.
20
+ *
21
+ * @category Tenbucks
22
+ * @package Tb_Tenbucks
23
+ * @copyright Copyright (c) 2016 Tenbucks. (https://www.tenbucks.io)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ * @author Tenbucks <hello@tenbucks.io>
26
+ */
27
+ class Tb_Tenbucks_Model_Core_Store_Api extends Mage_Core_Model_Store_Api {
28
+
29
+ /**
30
+ * Retrieve stores list
31
+ *
32
+ * @return array
33
+ */
34
+ public function items() {
35
+ // Retrieve stores
36
+ $stores = Mage::app()->getStores();
37
+
38
+ // Make result array
39
+ $result = array();
40
+ foreach ($stores as $store) {
41
+ $result[] = array(
42
+ 'store_id' => $store->getId(),
43
+ 'code' => $store->getCode(),
44
+ 'website_id' => $store->getWebsiteId(),
45
+ 'group_id' => $store->getGroupId(),
46
+ 'name' => $store->getName(),
47
+ 'sort_order' => $store->getSortOrder(),
48
+ 'is_active' => $store->getIsActive(),
49
+ 'country_default' => Mage::getStoreConfig('general/country/default', $store->getId()),
50
+ 'locale_code' => Mage::getStoreConfig('general/locale/code', $store->getId()),
51
+ 'base_currency' => Mage::getStoreConfig('currency/options/base', $store->getId())
52
+ );
53
+ }
54
+
55
+ return $result;
56
+ }
57
+
58
+ }
app/code/community/Tb/Tenbucks/Model/Core/Store/Api/V2.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Tenbucks
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 hello@tenbucks.io 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 Tenbucks to newer
19
+ * versions in the future.
20
+ *
21
+ * @category Tenbucks
22
+ * @package Tb_Tenbucks
23
+ * @copyright Copyright (c) 2016 Tenbucks. (https://www.tenbucks.io)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ * @author Tenbucks <hello@tenbucks.io>
26
+ */
27
+ class Tb_Tenbucks_Model_Core_Store_Api_V2 extends Tb_Tenbucks_Model_Core_Store_Api
28
+ {
29
+ }
app/code/community/Tb/Tenbucks/Model/Directory/Currency/Api.php ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Tenbucks
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 hello@tenbucks.io 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 Tenbucks to newer
19
+ * versions in the future.
20
+ *
21
+ * @category Tenbucks
22
+ * @package Tb_Tenbucks
23
+ * @copyright Copyright (c) 2016 Tenbucks. (https://www.tenbucks.io)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ * @author Tenbucks <hello@tenbucks.io>
26
+ */
27
+ class Tb_Tenbucks_Model_Directory_Currency_Api extends Mage_Api_Model_Resource_Abstract {
28
+
29
+ /**
30
+ * Retrieve currency rates
31
+ *
32
+ * @return array
33
+ */
34
+ public function getRates() {
35
+
36
+ $_results = array();
37
+ // Get the base currency
38
+ $baseCurrencyCode = Mage::app()->getBaseCurrencyCode();
39
+ // get all allowed currency codes
40
+ $allowedCurrencies = Mage::getSingleton('directory/currency')
41
+ ->getConfigAllowCurrencies();
42
+
43
+ foreach (Mage::getSingleton('directory/currency')
44
+ ->getCurrencyRates($baseCurrencyCode, array_values($allowedCurrencies))
45
+ as $currency => $rate)
46
+ {
47
+ $_results[] = array(
48
+ 'base_currency' => $baseCurrencyCode,
49
+ 'to_currency' => $currency,
50
+ 'rate' => $rate
51
+ );
52
+ }
53
+ return $_results;
54
+ }
55
+
56
+ }
app/code/community/Tb/Tenbucks/Model/Directory/Currency/Api/V2.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Tenbucks
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 hello@tenbucks.io 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 Tenbucks to newer
19
+ * versions in the future.
20
+ *
21
+ * @category Tenbucks
22
+ * @package Tb_Tenbucks
23
+ * @copyright Copyright (c) 2016 Tenbucks. (https://www.tenbucks.io)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ * @author Tenbucks <hello@tenbucks.io>
26
+ */
27
+ class Tb_Tenbucks_Model_Directory_Currency_Api_V2 extends Tb_Tenbucks_Model_Directory_Currency_Api
28
+ {
29
+ }
app/code/community/Tb/Tenbucks/Model/Observer.php ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Tenbucks
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 hello@tenbucks.io so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Tenbucks to newer
18
+ * versions in the future.
19
+ *
20
+ * @category Tenbucks
21
+ * @package Tb_Tenbucks
22
+ * @copyright Copyright (c) 2016 Tenbucks. (https://www.tenbucks.io)
23
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
24
+ * @author Tenbucks <hello@tenbucks.io>
25
+ */
26
+
27
+ class Tb_Tenbucks_Model_Observer {
28
+
29
+ public function handle_adminSystemConfigChangedSection(Varien_Event_Observer $observer) {
30
+
31
+ return Mage::getModel('tenbucks/webhooks')->hookGtin();
32
+
33
+ }
34
+
35
+ public function handle_catalogProductSaveAfter(Varien_Event_Observer $observer) {
36
+
37
+ $productId = $observer->getProduct()->getId();
38
+
39
+ return Mage::getModel('tenbucks/webhooks')->hookProduct($productId);
40
+
41
+ }
42
+
43
+ }
app/code/community/Tb/Tenbucks/Model/Sales/Status/Api.php ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Tenbucks
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 hello@tenbucks.io 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 Tenbucks to newer
19
+ * versions in the future.
20
+ *
21
+ * @category Tenbucks
22
+ * @package Tb_Tenbucks
23
+ * @copyright Copyright (c) 2016 Tenbucks. (https://www.tenbucks.io)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ * @author Tenbucks <hello@tenbucks.io>
26
+ */
27
+ class Tb_Tenbucks_Model_Sales_Status_Api extends Mage_Api_Model_Resource_Abstract {
28
+
29
+ /**
30
+ * Get list of available order status
31
+ *
32
+ * @return array
33
+ */
34
+ public function getOrderStatusList() {
35
+
36
+
37
+ return Mage::getResourceModel('sales/order_status_collection')->joinStates()->getData();
38
+
39
+ }
40
+
41
+ }
app/code/community/Tb/Tenbucks/Model/Sales/Status/Api/V2.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Tenbucks
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 hello@tenbucks.io 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 Tenbucks to newer
19
+ * versions in the future.
20
+ *
21
+ * @category Tenbucks
22
+ * @package Tb_Tenbucks
23
+ * @copyright Copyright (c) 2016 Tenbucks. (https://www.tenbucks.io)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ * @author Tenbucks <hello@tenbucks.io>
26
+ */
27
+ class Tb_Tenbucks_Model_Sales_Status_Api_V2 extends Tb_Tenbucks_Model_Sales_Status_Api
28
+ {
29
+ }
app/code/community/Tb/Tenbucks/Model/Shipping/Api.php ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Tenbucks
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 hello@tenbucks.io 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 Tenbucks to newer
19
+ * versions in the future.
20
+ *
21
+ * @category Tenbucks
22
+ * @package Tb_Tenbucks
23
+ * @copyright Copyright (c) 2016 Tenbucks. (https://www.tenbucks.io)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ * @author Tenbucks <hello@tenbucks.io>
26
+ */
27
+ class Tb_Tenbucks_Model_Shipping_Api extends Mage_Checkout_Model_Api_Resource {
28
+
29
+ /**
30
+ * Get list of available shipping methods
31
+ *
32
+ * @param $store
33
+ * @return array
34
+ */
35
+ public function getShippingMethodsList($store = null) {
36
+
37
+ $storeId = $this->_getStoreId($store);
38
+
39
+ $activeCarriers = Mage::getSingleton('shipping/config')->getActiveCarriers($storeId);
40
+ if (empty($activeCarriers)) {
41
+ $this->_fault("no_shipping_method_active");
42
+ }
43
+
44
+ try {
45
+
46
+ $shippingMethosdResult = array();
47
+
48
+ foreach ($activeCarriers as $carrierCode => $carrierModel) {
49
+
50
+ if ($carrierMethods = $carrierModel->getAllowedMethods()) {
51
+
52
+ $carrierTitle = $carrierCode;
53
+ if (!is_null(Mage::getStoreConfig('carriers/' . $carrierCode . '/title'))) {
54
+ $carrierTitle = Mage::getStoreConfig('carriers/' . $carrierCode . '/title');
55
+ }
56
+
57
+ foreach ($carrierMethods as $methodCode => $method) {
58
+
59
+ $shippingMethosdResult[] = array(
60
+ 'code' => $carrierCode . '_' . $methodCode,
61
+ 'carrier' => $carrierCode,
62
+ 'carrier_title' => $carrierTitle,
63
+ 'method' => $methodCode,
64
+ 'method_title' => $method
65
+ );
66
+ }
67
+ }
68
+ }
69
+ } catch (Mage_Core_Exception $e) {
70
+ $this->_fault('shipping_methods_list_could_not_be_retrieved', $e->getMessage());
71
+ }
72
+
73
+ return $shippingMethosdResult;
74
+ }
75
+
76
+ }
app/code/community/Tb/Tenbucks/Model/Shipping/Api/V2.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Tenbucks
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 hello@tenbucks.io 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 Tenbucks to newer
19
+ * versions in the future.
20
+ *
21
+ * @category Tenbucks
22
+ * @package Tb_Tenbucks
23
+ * @copyright Copyright (c) 2016 Tenbucks. (https://www.tenbucks.io)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ * @author Tenbucks <hello@tenbucks.io>
26
+ */
27
+ class Tb_Tenbucks_Model_Shipping_Api_V2 extends Tb_Tenbucks_Model_Shipping_Api
28
+ {
29
+ }
app/code/community/Tb/Tenbucks/Model/System/.DS_Store ADDED
Binary file
app/code/community/Tb/Tenbucks/Model/System/Config/Source/Attributes.php ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Tenbucks
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 hello@tenbucks.io so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Tenbucks to newer
18
+ * versions in the future.
19
+ *
20
+ * @category Tenbucks
21
+ * @package Tb_Tenbucks
22
+ * @copyright Copyright (c) 2016 Tenbucks. (https://www.tenbucks.io)
23
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
24
+ * @author Tenbucks <hello@tenbucks.io>
25
+ */
26
+
27
+
28
+ class Tb_Tenbucks_Model_System_Config_Source_Attributes {
29
+
30
+
31
+ /**
32
+ * Convert to Admin System Dropdow Array
33
+ *
34
+ * @return array
35
+ */
36
+ public function toOptionArray() {
37
+
38
+ $attributes = $this->getExternalAttributes();
39
+ array_unshift($attributes, array("value" => "", "label" => Mage::helper('tenbucks')->__("Select attribute to map")));
40
+
41
+ return $attributes;
42
+ }
43
+
44
+ /**
45
+ * Retrieve accessible external product attributes
46
+ *
47
+ * @return array
48
+ */
49
+ public function getExternalAttributes()
50
+ {
51
+ $productAttributes = array();
52
+ if(file_exists(Mage::getModuleDir(null,'Mage_Catalog') ."Model/Resource/Eav/Mysql4/Product/Attribute/Collection"))
53
+ $productAttributes = Mage::getResourceModel('catalog/product_attribute_collection')->load();
54
+ else
55
+ {
56
+
57
+ $entityTypeId = Mage::getSingleton('eav/config')->getEntityType('catalog_product')->getId();
58
+ $productAttributes = Mage::getResourceModel('eav/entity_attribute_collection')
59
+ ->setEntityTypeFilter($entityTypeId)
60
+ ->load();
61
+ }
62
+
63
+ $attributes = array();
64
+
65
+ foreach ($productAttributes as $attr) {
66
+ $code = $attr->getAttributeCode();
67
+ if ($attr->getFrontendInput() == 'hidden') {
68
+ continue;
69
+ }
70
+ $attributes[$code] = $code;
71
+ }
72
+
73
+
74
+ return $attributes;
75
+ }
76
+
77
+ }
app/code/community/Tb/Tenbucks/Model/Webhooks.php ADDED
@@ -0,0 +1,83 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Tenbucks
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 hello@tenbucks.io so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Tenbucks to newer
18
+ * versions in the future.
19
+ *
20
+ * @category Tenbucks
21
+ * @package Tb_Tenbucks
22
+ * @copyright Copyright (c) 2016 Tenbucks. (https://www.tenbucks.io)
23
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
24
+ * @author Tenbucks <hello@tenbucks.io>
25
+ */
26
+
27
+ class Tb_Tenbucks_Model_Webhooks {
28
+
29
+ public function hookProduct($productId) {
30
+
31
+ $path = 'magento/webhooks/products';
32
+
33
+ $data = array(
34
+ 'shop_url' => Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB),
35
+ 'product_id' => $productId,
36
+ );
37
+
38
+ return $this->call($path, $data);
39
+ }
40
+
41
+ public function hookGtin() {
42
+
43
+ $path = 'magento/webhooks/gtin';
44
+
45
+ $data = array(
46
+ 'shop_url' => Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB),
47
+ 'gtin' => Mage::helper('tenbucks')->getGtinCode(),
48
+ );
49
+
50
+ return $this->call($path, $data);
51
+ }
52
+
53
+ private function call($path, array $data = array()) {
54
+
55
+ $url = Mage::helper('tenbucks')->getApiUrl($path);
56
+
57
+ try {
58
+
59
+ $client = new Zend_Http_Client($url);
60
+ $client->setParameterGet($data);
61
+
62
+ $time_start_zend = microtime(true);
63
+
64
+ $query = $client->request();
65
+
66
+ $zend_time_cumulative = microtime(true) - $time_start_zend;
67
+ Mage::log(Mage::helper('tenbucks')->__('Request time: %ss',round($zend_time_cumulative,4)));
68
+
69
+ if ($query->getBody() == 'OK') {
70
+ // success
71
+ return true;
72
+ } else {
73
+ // Error
74
+ Mage::throwException(print_r($query, TRUE));
75
+ }
76
+
77
+ } catch (Zend_Http_Client_Adapter_Exception $e) {
78
+ Mage::log(Mage::helper('tenbucks')->__('Error in tenbucks webhook %s : %s', $path, $e->getMessage()));
79
+ return false;
80
+ }
81
+ }
82
+
83
+ }
app/code/community/Tb/Tenbucks/controllers/.DS_Store ADDED
Binary file
app/code/community/Tb/Tenbucks/controllers/TenbucksController.php ADDED
@@ -0,0 +1,114 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Tenbucks
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 hello@tenbucks.io 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 Tenbucks to newer
19
+ * versions in the future.
20
+ *
21
+ * @category Tenbucks
22
+ * @package Tb_Tenbucks
23
+ * @copyright Copyright (c) 2016 Tenbucks. (https://www.tenbucks.io)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ * @author Tenbucks <hello@tenbucks.io>
26
+ */
27
+ class Tb_Tenbucks_TenbucksController extends Mage_Adminhtml_Controller_Action {
28
+
29
+ protected function _initAction() {
30
+
31
+ if (!Mage::helper('tenbucks')->getGtinCode()) {
32
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('tenbucks')->__('Please configure first your GTIN matching attribute: <a href="%s">configure</a>', Mage::helper("adminhtml")->getUrl('adminhtml/system_config/edit/section/tenbucks')));
33
+ }
34
+
35
+ if (!Mage::getStoreConfig('general/store_information/name')) {
36
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('tenbucks')->__('Please configure first your Store Name : <a href="%s">configure</a>', Mage::helper("adminhtml")->getUrl('adminhtml/system_config/edit/section/general')));
37
+ }
38
+
39
+ $this->loadLayout()
40
+ ->_setActiveMenu('tenbucks');
41
+ return $this;
42
+ }
43
+
44
+ public function indexAction() {
45
+
46
+ $this->_initAction();
47
+
48
+ if (Mage::helper('tenbucks')->isInstalled()) {
49
+ $block = $this->getLayout()->createBlock('tenbucks/adminhtml_view');
50
+ $block->setTemplate('tenbucks/view.phtml');
51
+ } else {
52
+
53
+ $block = $this->getLayout()->createBlock('tenbucks/adminhtml_register');
54
+ $block->setChild('form', $this->getLayout()->createBlock('tenbucks/adminhtml_register_form'));
55
+ }
56
+
57
+ $this->getLayout()->getBlock('content')->append($block);
58
+ $this->renderLayout();
59
+ }
60
+
61
+ public function registerAction() {
62
+
63
+ if ($this->getRequest()->getPost() && Mage::helper('tenbucks')->canSignup()) {
64
+ try {
65
+ $postData = $this->getRequest()->getPost();
66
+
67
+ require_once(Mage::getBaseDir('lib') . '/tenbucks/tenbucks_registration_client/src/TenbucksRegistrationClient.php');
68
+
69
+ $api_key = Mage::helper('tenbucks/api')->createUser();
70
+
71
+ // initialize TenbucksKeysClient library
72
+ $client = new TenbucksRegistrationClient();
73
+
74
+ // collect information
75
+ $opts = array(
76
+ 'email' => $postData['email'],
77
+ 'company' => Mage::getStoreConfig('general/store_information/name'),
78
+ 'platform' => 'Magento',
79
+ 'sponsor' => $postData['sponsor'],
80
+ 'locale' => substr(Mage::app()->getLocale()->getLocaleCode(), 0, 2),
81
+ 'country' => Mage::getStoreConfig('general/country/default'),
82
+ 'url' => Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB),
83
+ 'gtin' => Mage::helper('tenbucks')->getGtinCode(), // magento special attributes
84
+ 'credentials' => array(
85
+ 'api_key' => $api_key, // secret
86
+ )
87
+ );
88
+
89
+ // send information to tenbucks server (secure with HTTPS)
90
+ $query = $client->send($opts);
91
+
92
+ // test if information has been sent successfully
93
+ if (array_key_exists('success', $query) && (bool) $query['success']) {
94
+ // success
95
+ Mage::helper('tenbucks')->setisInstalled();
96
+ // empty api key
97
+ Mage::helper('tenbucks')->setApiKey();
98
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('tenbucks')->__('You have successfully signup. Thank you.<br>You will receive your password by email in a few seconds. Please check your inbox.'));
99
+ } else {
100
+ // Error
101
+ Mage::helper('tenbucks')->setApiKey($api_key);
102
+ Mage::throwException(print_r($query, TRUE));
103
+ }
104
+ } catch (Exception $e) {
105
+ Mage::log($e->getMessage());
106
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('tenbucks')->__('Error during signup : %s', $e->getMessage()));
107
+ Mage::getSingleton('adminhtml/session')->setRegisterData($this->getRequest()->getPost());
108
+ }
109
+ }
110
+
111
+ $this->_redirect('*/*/index');
112
+ }
113
+
114
+ }
app/code/community/Tb/Tenbucks/data/.DS_Store ADDED
Binary file
app/code/community/Tb/Tenbucks/data/tenbucks_connect_setup/data-install-1.0.0.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Tenbucks
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 hello@tenbucks.io so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Tenbucks to newer
18
+ * versions in the future.
19
+ *
20
+ * @category Tenbucks
21
+ * @package Tb_Tenbucks
22
+ * @copyright Copyright (c) 2016 Tenbucks. (https://www.tenbucks.io)
23
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
24
+ * @author Tenbucks <hello@tenbucks.io>
25
+ */
26
+
27
+ $installer = $this;
28
+
29
+ $installer->startSetup();
30
+
31
+
32
+ // Enable Web Service Cache
33
+ $installer->setConfigData('api/config/wsdl_cache_enabled', 1);
34
+
35
+
36
+ $installer->endSetup();
app/code/community/Tb/Tenbucks/etc/.DS_Store ADDED
Binary file
app/code/community/Tb/Tenbucks/etc/adminhtml.xml ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <config>
3
+ <menu>
4
+ <tenbucks module="tenbucks" translate="title">
5
+ <title>Tenbucks.</title>
6
+ <sort_order>71</sort_order>
7
+ <children>
8
+ <apps module="tenbucks" translate="title">
9
+ <title>My Applications</title>
10
+ <sort_order>10</sort_order>
11
+ <action>adminhtml/tenbucks/index</action>
12
+ </apps>
13
+ <account module="tenbucks" translate="title">
14
+ <title>My Account</title>
15
+ <sort_order>20</sort_order>
16
+ <action>adminhtml/tenbucks/index/redirect/account</action>
17
+ </account>
18
+ <configuration module="tenbucks" translate="title">
19
+ <title>Configuration</title>
20
+ <sort_order>30</sort_order>
21
+ <action>adminhtml/system_config/edit/section/tenbucks</action>
22
+ </configuration>
23
+ </children>
24
+ </tenbucks>
25
+ </menu>
26
+ <acl>
27
+ <resources>
28
+ <admin>
29
+ <children>
30
+ <tenbucks module="tenbucks" translate="title">
31
+ <title>Tenbucks.</title>
32
+ <sort_order>1</sort_order>
33
+ <children>
34
+ <apps translate="title">
35
+ <title>My Applications</title>
36
+ </apps>
37
+ <account translate="title">
38
+ <title>My Account</title>
39
+ </account>
40
+ <configuration translate="title">
41
+ <title>Configuration</title>
42
+ </configuration>
43
+ </children>
44
+ </tenbucks>
45
+ <system>
46
+ <children>
47
+ <config>
48
+ <children>
49
+ <tenbucks>
50
+ <title>Tenbucks.</title>
51
+ </tenbucks>
52
+ </children>
53
+ </config>
54
+ </children>
55
+ </system>
56
+ </children>
57
+ </admin>
58
+ </resources>
59
+ </acl>
60
+ </config>
app/code/community/Tb/Tenbucks/etc/api.xml ADDED
@@ -0,0 +1,182 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" ?>
2
+ <!--
3
+ <?php
4
+ /**
5
+ * Tenbucks
6
+ *
7
+ * NOTICE OF LICENSE
8
+ *
9
+ * This source file is subject to the Open Software License (OSL 3.0)
10
+ * that is bundled with this package in the file LICENSE.txt.
11
+ * It is also available through the world-wide-web at this URL:
12
+ * http://opensource.org/licenses/osl-3.0.php
13
+ * If you did not receive a copy of the license and are unable to
14
+ * obtain it through the world-wide-web, please send an email
15
+ * to hello@tenbucks.io so we can send you a copy immediately.
16
+ *
17
+ * DISCLAIMER
18
+ *
19
+ * Do not edit or add to this file if you wish to upgrade Tenbucks to newer
20
+ * versions in the future.
21
+ *
22
+ * @category Tenbucks
23
+ * @package Tb_Tenbucks
24
+ * @copyright Copyright (c) 2016 Tenbucks. (https://www.tenbucks.io)
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ * @author Tenbucks <hello@tenbucks.io>
27
+ */
28
+ -->
29
+ <config>
30
+ <api>
31
+ <resources>
32
+ <tenbucks_shipping translate="title" module="tenbucks">
33
+ <model>tenbucks/shipping_api</model>
34
+ <title>Shipping Method</title>
35
+ <acl>tenbucks/shipping</acl>
36
+ <methods>
37
+ <list translate="title" module="tenbucks">
38
+ <title>Retrieve Shipping Method List</title>
39
+ <method>getShippingMethodsList</method>
40
+ </list>
41
+ </methods>
42
+ <faults module="tenbucks">
43
+ <no_shipping_method_active>
44
+ <code>1001</code>
45
+ <message>Can not make operation because there is no shipping method active</message>
46
+ </no_shipping_method_active>
47
+ <shipping_methods_list_could_not_be_retrieved>
48
+ <code>1002</code>
49
+ <message>Can not receive list of shipping methods</message>
50
+ </shipping_methods_list_could_not_be_retrieved>
51
+ </faults>
52
+ </tenbucks_shipping>
53
+ <tenbucks_sales_status translate="title" module="tenbucks">
54
+ <model>tenbucks/sales_status_api</model>
55
+ <title>Order Status</title>
56
+ <acl>tenbucks/sales_status</acl>
57
+ <methods>
58
+ <list translate="title" module="tenbucks">
59
+ <title>Retrieve Order Status List</title>
60
+ <method>getOrderStatusList</method>
61
+ </list>
62
+ </methods>
63
+ <faults module="tenbucks">
64
+ </faults>
65
+ </tenbucks_sales_status>
66
+ <tenbucks_catalog_category translate="title" module="tenbucks">
67
+ <model>tenbucks/catalog_category_api</model>
68
+ <title>Product Category</title>
69
+ <acl>tenbucks/catalog_category</acl>
70
+ <methods>
71
+ <assignedProducts translate="title" module="tenbucks">
72
+ <title>Retrieve list of assigned products</title>
73
+ <method>assignedProducts</method>
74
+ </assignedProducts>
75
+ </methods>
76
+ <faults module="tenbucks">
77
+ </faults>
78
+ </tenbucks_catalog_category>
79
+ <tenbucks_catalog_product translate="title" module="tenbucks">
80
+ <model>tenbucks/catalog_product_api</model>
81
+ <title>Product</title>
82
+ <acl>tenbucks/catalog_product</acl>
83
+ <methods>
84
+ <itemsInCategory translate="title" module="tenbucks">
85
+ <title>Retrieve list of products assigned to at least one category</title>
86
+ <method>itemsInCategory</method>
87
+ </itemsInCategory>
88
+ </methods>
89
+ <faults module="tenbucks">
90
+ </faults>
91
+ </tenbucks_catalog_product>
92
+ <tenbucks_catalog_product_attribute translate="title" module="tenbucks">
93
+ <title>Product attributes API</title>
94
+ <model>tenbucks/catalog_product_attribute_api</model>
95
+ <acl>tenbucks/catalog_product</acl>
96
+ <methods>
97
+ <list translate="title" module="tenbucks">
98
+ <title>Retrieve attribute list</title>
99
+ <method>items</method>
100
+ </list>
101
+ </methods>
102
+ <faults module="tenbucks">
103
+ </faults>
104
+ </tenbucks_catalog_product_attribute>
105
+ <tenbucks_core_store translate="title" module="tenbucks">
106
+ <title>Store API</title>
107
+ <model>tenbucks/core_store_api</model>
108
+ <acl>tenbucks/core_store</acl>
109
+ <methods>
110
+ <list translate="title" module="tenbucks">
111
+ <title>Retrieve store list</title>
112
+ <method>items</method>
113
+ </list>
114
+ </methods>
115
+ <faults module="tenbucks">
116
+ </faults>
117
+ </tenbucks_core_store>
118
+ <tenbucks_directory_currency translate="title" module="tenbucks">
119
+ <title>Directory Currency</title>
120
+ <model>tenbucks/directory_currency_api</model>
121
+ <acl>tenbucks/directory_currency</acl>
122
+ <methods>
123
+ <list translate="title" module="tenbucks">
124
+ <title>Retrieve currency rates</title>
125
+ <method>getRates</method>
126
+ </list>
127
+ </methods>
128
+ <faults module="tenbucks">
129
+ </faults>
130
+ </tenbucks_directory_currency>
131
+ </resources>
132
+ <resources_alias>
133
+ <shipping>tenbucks_shipping</shipping>
134
+ <sales_status>tenbucks_sales_status</sales_status>
135
+ <catalog_category>tenbucks_catalog_category</catalog_category>
136
+ <catalog_product>tenbucks_catalog_product</catalog_product>
137
+ <catalog_product_attribute>tenbucks_catalog_product_attribute</catalog_product_attribute>
138
+ <core_store>tenbucks_core_store</core_store>
139
+ <directory_currency>tenbucks_directory_currency</directory_currency>
140
+ </resources_alias>
141
+ <v2>
142
+ <resources_function_prefix>
143
+ <shipping>tenbucksShipping</shipping>
144
+ <sales_status>tenbucksSalesStatus</sales_status>
145
+ <catalog_category>tenbucksCatalogCategory</catalog_category>
146
+ <catalog_product>tenbucksCatalogProduct</catalog_product>
147
+ <catalog_product_attribute>tenbucksCatalogProductAttribute</catalog_product_attribute>
148
+ <core_store>tenbucksCoreStore</core_store>
149
+ <directory_currency>tenbucksDirectoryCurrency</directory_currency>
150
+ </resources_function_prefix>
151
+ </v2>
152
+ <acl>
153
+ <resources>
154
+ <tenbucks translate="title" module="tenbucks">
155
+ <title>Tenbucks</title>
156
+ <sort_order>10</sort_order>
157
+ <shipping translate="title" module="tenbucks">
158
+ <title>Shipping Methods</title>
159
+ </shipping>
160
+ <sales_status translate="title" module="tenbucks">
161
+ <title>Order Status</title>
162
+ </sales_status>
163
+ <catalog_category translate="title" module="tenbucks">
164
+ <title>Product Category</title>
165
+ </catalog_category>
166
+ <catalog_product translate="title" module="tenbucks">
167
+ <title>Products</title>
168
+ </catalog_product>
169
+ <catalog_product_attribute translate="title" module="tenbucks">
170
+ <title>Catalog Product Attribute </title>
171
+ </catalog_product_attribute>
172
+ <core_store>
173
+ <title>Stores</title>
174
+ </core_store>
175
+ <directory_currency>
176
+ <title>Currency Rates</title>
177
+ </directory_currency>
178
+ </tenbucks>
179
+ </resources>
180
+ </acl>
181
+ </api>
182
+ </config>
app/code/community/Tb/Tenbucks/etc/config.xml ADDED
@@ -0,0 +1,128 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" ?>
2
+ <!--
3
+ <?php
4
+ /**
5
+ * Tenbucks
6
+ *
7
+ * NOTICE OF LICENSE
8
+ *
9
+ * This source file is subject to the Open Software License (OSL 3.0)
10
+ * that is bundled with this package in the file LICENSE.txt.
11
+ * It is also available through the world-wide-web at this URL:
12
+ * http://opensource.org/licenses/osl-3.0.php
13
+ * If you did not receive a copy of the license and are unable to
14
+ * obtain it through the world-wide-web, please send an email
15
+ * to hello@tenbucks.io so we can send you a copy immediately.
16
+ *
17
+ * DISCLAIMER
18
+ *
19
+ * Do not edit or add to this file if you wish to upgrade Tenbucks to newer
20
+ * versions in the future.
21
+ *
22
+ * @category Tenbucks
23
+ * @package Tb_Tenbucks
24
+ * @copyright Copyright (c) 2016 Tenbucks. (https://www.tenbucks.io)
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ * @author Tenbucks <hello@tenbucks.io>
27
+ */
28
+ -->
29
+ <config>
30
+ <modules>
31
+ <Tb_Tenbucks>
32
+ <version>1.1.4</version>
33
+ </Tb_Tenbucks>
34
+ </modules>
35
+ <global>
36
+ <blocks>
37
+ <tenbucks>
38
+ <class>Tb_Tenbucks_Block</class>
39
+ </tenbucks>
40
+ </blocks>
41
+ <helpers>
42
+ <tenbucks>
43
+ <class>Tb_Tenbucks_Helper</class>
44
+ </tenbucks>
45
+ </helpers>
46
+ <models>
47
+ <tenbucks>
48
+ <class>Tb_Tenbucks_Model</class>
49
+ </tenbucks>
50
+ </models>
51
+ <resources>
52
+ <tenbucks_setup>
53
+ <setup>
54
+ <module>Tb_Tenbucks</module>
55
+ <class>Mage_Core_Model_Resource_Setup</class>
56
+ </setup>
57
+ <connection>
58
+ <use>core_setup</use>
59
+ </connection>
60
+ </tenbucks_setup>
61
+ <tenbucks_write>
62
+ <connection>
63
+ <use>core_write</use>
64
+ </connection>
65
+ </tenbucks_write>
66
+ <tenbucks_read>
67
+ <connection>
68
+ <use>core_read</use>
69
+ </connection>
70
+ </tenbucks_read>
71
+ </resources>
72
+ </global>
73
+ <admin>
74
+ <routers>
75
+ <adminhtml>
76
+ <args>
77
+ <modules>
78
+ <Tb_Tenbucks after="Mage_Adminhtml">Tb_Tenbucks</Tb_Tenbucks>
79
+ </modules>
80
+ </args>
81
+ </adminhtml>
82
+ </routers>
83
+ </admin>
84
+ <adminhtml>
85
+ <events>
86
+ <admin_system_config_changed_section_tenbucks>
87
+ <observers>
88
+ <tenbucks_admin_system_config_changed_section>
89
+ <class>tenbucks/observer</class>
90
+ <type>singleton</type>
91
+ <method>handle_adminSystemConfigChangedSection</method>
92
+ </tenbucks_admin_system_config_changed_section>
93
+ </observers>
94
+ </admin_system_config_changed_section_tenbucks>
95
+ <catalog_product_save_after>
96
+ <observers>
97
+ <tenbucks_catalog_product_save_after>
98
+ <class>tenbucks/observer</class>
99
+ <type>singleton</type>
100
+ <method>handle_catalogProductSaveAfter</method>
101
+ </tenbucks_catalog_product_save_after>
102
+ </observers>
103
+ </catalog_product_save_after>
104
+ </events>
105
+ <translate>
106
+ <modules>
107
+ <tenbucks>
108
+ <files>
109
+ <default>Tb_Tenbucks.csv</default>
110
+ </files>
111
+ </tenbucks>
112
+ </modules>
113
+ </translate>
114
+ <layout>
115
+ <updates>
116
+ <tenbucks>
117
+ <file>tenbucks.xml</file>
118
+ </tenbucks>
119
+ </updates>
120
+ </layout>
121
+ </adminhtml>
122
+ <default>
123
+ <tenbucks>
124
+ <general>
125
+ </general>
126
+ </tenbucks>
127
+ </default>
128
+ </config>
app/code/community/Tb/Tenbucks/etc/system.xml ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <tabs>
4
+ <tenbucks translate="label">
5
+ <label>Tenbucks.</label>
6
+ <sort_order>401</sort_order>
7
+ <class>tenbucks</class>
8
+ </tenbucks>
9
+ </tabs>
10
+ <sections>
11
+ <tenbucks translate="label">
12
+ <label>Tenbucks.</label>
13
+ <tab>tenbucks</tab>
14
+ <class>tenbucks-section</class>
15
+ <header_css>tenbucks-header</header_css>
16
+ <frontend_type>text</frontend_type>
17
+ <sort_order>10</sort_order>
18
+ <show_in_default>1</show_in_default>
19
+ <show_in_website>1</show_in_website>
20
+ <show_in_store>1</show_in_store>
21
+ <groups>
22
+ <general translate="label">
23
+ <label>General</label>
24
+ <expanded>1</expanded>
25
+ <sort_order>1</sort_order>
26
+ <show_in_default>1</show_in_default>
27
+ <show_in_website>1</show_in_website>
28
+ <show_in_store>1</show_in_store>
29
+ <fields>
30
+ <gtin translate="label, comment">
31
+ <label>GTIN</label>
32
+ <frontend_type>select</frontend_type>
33
+ <sort_order>10</sort_order>
34
+ <show_in_default>1</show_in_default>
35
+ <show_in_website>0</show_in_website>
36
+ <show_in_store>0</show_in_store>
37
+ <validate>required-entry</validate>
38
+ <comment>Generally EAN, UPC or ASIN custom magento attributes</comment>
39
+ <source_model>tenbucks/system_config_source_attributes</source_model>
40
+ </gtin>
41
+ </fields>
42
+ </general>
43
+ </groups>
44
+ </tenbucks>
45
+ </sections>
46
+ </config>
app/code/community/Tb/Tenbucks/etc/wsdl.xml ADDED
@@ -0,0 +1,229 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <definitions xmlns:typens="urn:{{var wsdl.name}}" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
3
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
4
+ xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
5
+ xmlns="http://schemas.xmlsoap.org/wsdl/"
6
+ name="{{var wsdl.name}}" targetNamespace="urn:{{var wsdl.name}}">
7
+ <types>
8
+ <schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:Magento">
9
+ <import namespace="http://schemas.xmlsoap.org/soap/encoding/"
10
+ schemaLocation="http://schemas.xmlsoap.org/soap/encoding/"/>
11
+ <complexType name="tenbucksSalesStatusEntity">
12
+ <all>
13
+ <element name="status" type="xsd:string"/>
14
+ <element name="label" type="xsd:string"/>
15
+ <element name="state" type="xsd:string"/>
16
+ <element name="is_default" type="xsd:boolean"/>
17
+ </all>
18
+ </complexType>
19
+ <complexType name="tenbucksSalesStatusEntityArray">
20
+ <complexContent>
21
+ <restriction base="soapenc:Array">
22
+ <attribute ref="soapenc:arrayType" wsdl:arrayType="typens:tenbucksSalesStatusEntity[]"/>
23
+ </restriction>
24
+ </complexContent>
25
+ </complexType>
26
+ <complexType name="tenbuckscatalogAssignedProduct">
27
+ <all>
28
+ <element name="product_id" type="xsd:int"/>
29
+ <element name="sku" type="xsd:string"/>
30
+ <element name="name" type="xsd:string"/>
31
+ <element name="set" type="xsd:int"/>
32
+ <element name="type" type="xsd:string"/>
33
+ <element name="position" type="xsd:int"/>
34
+ </all>
35
+ </complexType>
36
+ <complexType name="tenbuckscatalogAssignedProductArray">
37
+ <complexContent>
38
+ <restriction base="soapenc:Array">
39
+ <attribute ref="soapenc:arrayType" wsdl:arrayType="typens:tenbuckscatalogAssignedProduct[]"/>
40
+ </restriction>
41
+ </complexContent>
42
+ </complexType>
43
+ <complexType name="tenbucksStoreEntity">
44
+ <all>
45
+ <element name="store_id" type="xsd:int"/>
46
+ <element name="code" type="xsd:string"/>
47
+ <element name="website_id" type="xsd:int"/>
48
+ <element name="group_id" type="xsd:int"/>
49
+ <element name="name" type="xsd:string"/>
50
+ <element name="sort_order" type="xsd:int"/>
51
+ <element name="is_active" type="xsd:int"/>
52
+ <element name="country_default" type="xsd:string"/>
53
+ <element name="locale_code" type="xsd:string"/>
54
+ <element name="base_currency" type="xsd:string"/>
55
+ </all>
56
+ </complexType>
57
+ <complexType name="tenbucksStoreEntityArray">
58
+ <complexContent>
59
+ <restriction base="soapenc:Array">
60
+ <attribute ref="soapenc:arrayType" wsdl:arrayType="typens:tenbucksStoreEntity[]"/>
61
+ </restriction>
62
+ </complexContent>
63
+ </complexType>
64
+ <complexType name="tenbucksCurrencyEntity">
65
+ <all>
66
+ <element name="base_currency" type="xsd:string"/>
67
+ <element name="to_currency" type="xsd:string"/>
68
+ <element name="rate" type="xsd:string"/>
69
+ </all>
70
+ </complexType>
71
+ <complexType name="tenbucksCurrencyEntityArray">
72
+ <complexContent>
73
+ <restriction base="soapenc:Array">
74
+ <attribute ref="soapenc:arrayType" wsdl:arrayType="typens:tenbucksCurrencyEntity[]"/>
75
+ </restriction>
76
+ </complexContent>
77
+ </complexType>
78
+ </schema>
79
+ </types>
80
+ <message name="tenbucksShippingListRequest">
81
+ <part name="sessionId" type="xsd:string"/>
82
+ <part name="storeId" type="xsd:string"/>
83
+ </message>
84
+ <message name="tenbucksShippingListResponse">
85
+ <part name="result" type="typens:shoppingCartShippingMethodEntityArray"/>
86
+ </message>
87
+ <message name="tenbucksSalesStatusListRequest">
88
+ <part name="sessionId" type="xsd:string"/>
89
+ </message>
90
+ <message name="tenbucksSalesStatusListResponse">
91
+ <part name="result" type="typens:tenbucksSalesStatusEntityArray"/>
92
+ </message>
93
+ <message name="tenbucksCatalogCategoryassignedProductsRequest">
94
+ <part name="sessionId" type="xsd:string"/>
95
+ <part name="categoryId" type="xsd:int"/>
96
+ </message>
97
+ <message name="tenbucksCatalogCategoryassignedProductsResponse">
98
+ <part name="result" type="typens:tenbuckscatalogAssignedProductArray"/>
99
+ </message>
100
+ <message name="tenbucksCoreStoreListRequest">
101
+ <part name="sessionId" type="xsd:string" />
102
+ </message>
103
+ <message name="tenbucksCoreStoreListResponse">
104
+ <part name="result" type="typens:tenbucksStoreEntityArray" />
105
+ </message>
106
+ <message name="tenbucksDirectoryCurrencyListRequest">
107
+ <part name="sessionId" type="xsd:string" />
108
+ </message>
109
+ <message name="tenbucksDirectoryCurrencyListResponse">
110
+ <part name="result" type="typens:tenbucksCurrencyEntityArray" />
111
+ </message>
112
+ <portType name="{{var wsdl.handler}}PortType">
113
+ <operation name="tenbucksShippingList">
114
+ <documentation>Get list of available shipping methods</documentation>
115
+ <input message="typens:tenbucksShippingListRequest"/>
116
+ <output message="typens:tenbucksShippingListResponse"/>
117
+ </operation>
118
+ <operation name="tenbucksSalesStatusList">
119
+ <documentation>Get list of available order status</documentation>
120
+ <input message="typens:tenbucksSalesStatusListRequest"/>
121
+ <output message="typens:typens:tenbucksSalesStatusListResponse"/>
122
+ </operation>
123
+ <operation name="tenbucksCatalogCategoryassignedProducts">
124
+ <documentation>Retrieve list of assigned products</documentation>
125
+ <input message="typens:tenbucksCatalogCategoryassignedProductsRequest"/>
126
+ <output message="typens:typens:tenbucksCatalogCategoryassignedProductsResponse"/>
127
+ </operation>
128
+ <operation name="tenbucksCatalogProductitemsInCategory">
129
+ <documentation>Retrieve list of products assigned to at least one category</documentation>
130
+ <input message="typens:catalogProductListRequest"/>
131
+ <output message="typens:catalogProductListResponse"/>
132
+ </operation>
133
+ <operation name="tenbucksCatalogProductAttributeList">
134
+ <documentation>Retrieve attribute list</documentation>
135
+ <input message="typens:catalogProductAttributeListRequest"/>
136
+ <output message="typens:catalogProductAttributeListResponse"/>
137
+ </operation>
138
+ <operation name="tenbucksCoreStoreList">
139
+ <documentation>List of stores</documentation>
140
+ <input message="typens:tenbucksCoreStoreListRequest" />
141
+ <output message="typens:tenbucksCoreStoreListResponse" />
142
+ </operation>
143
+ <operation name="tenbucksDirectoryCurrencyList">
144
+ <documentation>List of currencies</documentation>
145
+ <input message="typens:tenbucksDirectoryCurrencyListRequest" />
146
+ <output message="typens:tenbucksDirectoryCurrencyListResponse" />
147
+ </operation>
148
+ </portType>
149
+ <binding name="{{var wsdl.handler}}Binding" type="typens:{{var wsdl.handler}}PortType">
150
+ <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
151
+ <operation name="tenbucksShippingList">
152
+ <soap:operation soapAction="urn:{{var wsdl.handler}}Action"/>
153
+ <input>
154
+ <soap:body namespace="urn:{{var wsdl.name}}" use="encoded"
155
+ encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
156
+ </input>
157
+ <output>
158
+ <soap:body namespace="urn:{{var wsdl.name}}" use="encoded"
159
+ encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
160
+ </output>
161
+ </operation>
162
+ <operation name="tenbucksSalesStatusList">
163
+ <soap:operation soapAction="urn:{{var wsdl.handler}}Action"/>
164
+ <input>
165
+ <soap:body namespace="urn:{{var wsdl.name}}" use="encoded"
166
+ encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
167
+ </input>
168
+ <output>
169
+ <soap:body namespace="urn:{{var wsdl.name}}" use="encoded"
170
+ encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
171
+ </output>
172
+ </operation>
173
+ <operation name="tenbucksCatalogCategoryassignedProducts">
174
+ <soap:operation soapAction="urn:{{var wsdl.handler}}Action"/>
175
+ <input>
176
+ <soap:body namespace="urn:{{var wsdl.name}}" use="encoded"
177
+ encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
178
+ </input>
179
+ <output>
180
+ <soap:body namespace="urn:{{var wsdl.name}}" use="encoded"
181
+ encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
182
+ </output>
183
+ </operation>
184
+ <operation name="tenbucksCatalogProductitemsInCategory">
185
+ <soap:operation soapAction="urn:{{var wsdl.handler}}Action"/>
186
+ <input>
187
+ <soap:body namespace="urn:{{var wsdl.name}}" use="encoded"
188
+ encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
189
+ </input>
190
+ <output>
191
+ <soap:body namespace="urn:{{var wsdl.name}}" use="encoded"
192
+ encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
193
+ </output>
194
+ </operation>
195
+ <operation name="tenbucksCatalogProductAttributeList">
196
+ <soap:operation soapAction="urn:{{var wsdl.handler}}Action"/>
197
+ <input>
198
+ <soap:body namespace="urn:{{var wsdl.name}}" use="encoded"
199
+ encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
200
+ </input>
201
+ <output>
202
+ <soap:body namespace="urn:{{var wsdl.name}}" use="encoded"
203
+ encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
204
+ </output>
205
+ </operation>
206
+ <operation name="tenbucksCoreStoreList">
207
+ <soap:operation soapAction="urn:{{var wsdl.handler}}Action"/>
208
+ <input>
209
+ <soap:body namespace="urn:{{var wsdl.name}}" use="encoded"
210
+ encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
211
+ </input>
212
+ <output>
213
+ <soap:body namespace="urn:{{var wsdl.name}}" use="encoded"
214
+ encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
215
+ </output>
216
+ </operation>
217
+ <operation name="tenbucksDirectoryCurrencyList">
218
+ <soap:operation soapAction="urn:{{var wsdl.handler}}Action"/>
219
+ <input>
220
+ <soap:body namespace="urn:{{var wsdl.name}}" use="encoded"
221
+ encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
222
+ </input>
223
+ <output>
224
+ <soap:body namespace="urn:{{var wsdl.name}}" use="encoded"
225
+ encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
226
+ </output>
227
+ </operation>
228
+ </binding>
229
+ </definitions>
app/code/community/Tb/Tenbucks/etc/wsi.xml ADDED
@@ -0,0 +1,294 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <wsdl:definitions xmlns:typens="urn:{{var wsdl.name}}"
3
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
4
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
5
+ xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
6
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
7
+ name="{{var wsdl.name}}"
8
+ targetNamespace="urn:{{var wsdl.name}}">
9
+ <wsdl:types>
10
+ <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:{{var wsdl.name}}">
11
+ <xsd:complexType name="tenbucksSalesStatusEntity">
12
+ <xsd:sequence>
13
+ <xsd:element name="status" type="xsd:string" minOccurs="0" />
14
+ <xsd:element name="label" type="xsd:string" minOccurs="0" />
15
+ <xsd:element name="state" type="xsd:string" minOccurs="0" />
16
+ <xsd:element name="is_default" type="xsd:boolean" minOccurs="0" />
17
+ </xsd:sequence>
18
+ </xsd:complexType>
19
+ <xsd:complexType name="tenbucksSalesStatusEntityArray">
20
+ <xsd:sequence>
21
+ <xsd:element minOccurs="0" maxOccurs="unbounded" name="complexObjectArray" type="typens:tenbucksSalesStatusEntity" />
22
+ </xsd:sequence>
23
+ </xsd:complexType>
24
+ <xsd:complexType name="tenbuckscatalogAssignedProduct">
25
+ <xsd:sequence>
26
+ <xsd:element name="product_id" type="xsd:int" minOccurs="0" />
27
+ <xsd:element name="sku" type="xsd:string" minOccurs="0" />
28
+ <xsd:element name="name" type="xsd:string" minOccurs="0" />
29
+ <xsd:element name="set" type="xsd:int" minOccurs="0" />
30
+ <xsd:element name="type" type="xsd:string" minOccurs="0" />
31
+ <xsd:element name="position" type="xsd:int" minOccurs="0" />
32
+ </xsd:sequence>
33
+ </xsd:complexType>
34
+ <xsd:complexType name="tenbuckscatalogAssignedProductArray">
35
+ <xsd:sequence>
36
+ <xsd:element minOccurs="0" maxOccurs="unbounded" name="complexObjectArray" type="typens:tenbuckscatalogAssignedProduct" />
37
+ </xsd:sequence>
38
+ </xsd:complexType>
39
+ <xsd:complexType name="tenbucksStoreEntity">
40
+ <xsd:sequence>
41
+ <xsd:element name="store_id" type="xsd:int" minOccurs="0" />
42
+ <xsd:element name="code" type="xsd:string" minOccurs="0" />
43
+ <xsd:element name="website_id" type="xsd:int" minOccurs="0" />
44
+ <xsd:element name="group_id" type="xsd:int" minOccurs="0" />
45
+ <xsd:element name="name" type="xsd:string" minOccurs="0" />
46
+ <xsd:element name="sort_order" type="xsd:int" minOccurs="0" />
47
+ <xsd:element name="is_active" type="xsd:int" minOccurs="0" />
48
+ <xsd:element name="country_default" type="xsd:string" minOccurs="0" />
49
+ <xsd:element name="locale_code" type="xsd:string" minOccurs="0" />
50
+ <xsd:element name="currency_base" type="xsd:string" minOccurs="0" />
51
+ </xsd:sequence>
52
+ </xsd:complexType>
53
+ <xsd:complexType name="tenbucksStoreEntityArray">
54
+ <xsd:sequence>
55
+ <xsd:element minOccurs="0" maxOccurs="unbounded" name="complexObjectArray" type="typens:tenbucksStoreEntity" />
56
+ </xsd:sequence>
57
+ </xsd:complexType>
58
+ <xsd:complexType name="tenbucksCurrencyEntity">
59
+ <xsd:sequence>
60
+ <xsd:element name="currency" type="xsd:string" minOccurs="0" />
61
+ <xsd:element name="rate" type="xsd:string" minOccurs="0" />
62
+ </xsd:sequence>
63
+ </xsd:complexType>
64
+ <xsd:complexType name="tenbucksCurrencyEntityArray">
65
+ <xsd:sequence>
66
+ <xsd:element minOccurs="0" maxOccurs="unbounded" name="complexObjectArray" type="tenbucksCurrencyEntity" />
67
+ </xsd:sequence>
68
+ </xsd:complexType>
69
+
70
+ <xsd:element name="salesOrderListRequestParam">
71
+ <xsd:complexType>
72
+ <xsd:sequence>
73
+ <xsd:element minOccurs="1" maxOccurs="1" name="sessionId" type="xsd:string" />
74
+ <xsd:element minOccurs="1" maxOccurs="1" name="filters" type="typens:filters" />
75
+ </xsd:sequence>
76
+ </xsd:complexType>
77
+ </xsd:element>
78
+ <xsd:element name="salesOrderListResponseParam">
79
+ <xsd:complexType>
80
+ <xsd:sequence>
81
+ <xsd:element minOccurs="1" maxOccurs="1" name="result" type="typens:salesOrderListEntityArray" />
82
+ </xsd:sequence>
83
+ </xsd:complexType>
84
+ </xsd:element>
85
+
86
+
87
+ <xsd:element name="tenbucksShippingListRequestParam">
88
+ <xsd:complexType>
89
+ <xsd:sequence>
90
+ <xsd:element minOccurs="1" maxOccurs="1" name="sessionId" type="xsd:string" />
91
+ <xsd:element minOccurs="1" maxOccurs="1" name="storeId" type="xsd:string" />
92
+ </xsd:sequence>
93
+ </xsd:complexType>
94
+ </xsd:element>
95
+ <xsd:element name="tenbucksShippingListResponseParam">
96
+ <xsd:complexType>
97
+ <xsd:sequence>
98
+ <xsd:element minOccurs="1" maxOccurs="1" name="result" type="typens:shoppingCartShippingMethodEntityArray" />
99
+ </xsd:sequence>
100
+ </xsd:complexType>
101
+ </xsd:element>
102
+ <xsd:element name="tenbucksSalesStatusListRequestParam">
103
+ <xsd:complexType>
104
+ <xsd:sequence>
105
+ <xsd:element minOccurs="1" maxOccurs="1" name="sessionId" type="xsd:string" />
106
+ </xsd:sequence>
107
+ </xsd:complexType>
108
+ </xsd:element>
109
+ <xsd:element name="tenbucksSalesStatusListResponseParam">
110
+ <xsd:complexType>
111
+ <xsd:sequence>
112
+ <xsd:element minOccurs="1" maxOccurs="1" name="result" type="typens:tenbucksSalesStatusEntityArray" />
113
+ </xsd:sequence>
114
+ </xsd:complexType>
115
+ </xsd:element>
116
+ <xsd:element name="tenbucksCatalogCategoryassignedProductsRequestParam">
117
+ <xsd:complexType>
118
+ <xsd:sequence>
119
+ <xsd:element minOccurs="1" maxOccurs="1" name="sessionId" type="xsd:string" />
120
+ <xsd:element minOccurs="1" maxOccurs="1" name="categoryId" type="xsd:int" />
121
+ </xsd:sequence>
122
+ </xsd:complexType>
123
+ </xsd:element>
124
+ <xsd:element name="tenbucksCatalogCategoryassignedProductsResponseParam">
125
+ <xsd:complexType>
126
+ <xsd:sequence>
127
+ <xsd:element minOccurs="1" maxOccurs="1" name="result" type="typens:tenbuckscatalogAssignedProductArray" />
128
+ </xsd:sequence>
129
+ </xsd:complexType>
130
+ </xsd:element>
131
+ <xsd:element name="tenbucksStoreListRequestParam">
132
+ <xsd:complexType>
133
+ <xsd:sequence>
134
+ <xsd:element minOccurs="1" maxOccurs="1" name="sessionId" type="xsd:string" />
135
+ </xsd:sequence>
136
+ </xsd:complexType>
137
+ </xsd:element>
138
+ <xsd:element name="tenbucksStoreListResponseParam">
139
+ <xsd:complexType>
140
+ <xsd:sequence>
141
+ <xsd:element minOccurs="1" maxOccurs="1" name="result" type="typens:tenbucksStoreEntityArray" />
142
+ </xsd:sequence>
143
+ </xsd:complexType>
144
+ </xsd:element>
145
+ <xsd:element name="tenbucksCurrencyListRequestParam">
146
+ <xsd:complexType>
147
+ <xsd:sequence>
148
+ <xsd:element minOccurs="1" maxOccurs="1" name="sessionId" type="xsd:string" />
149
+ </xsd:sequence>
150
+ </xsd:complexType>
151
+ </xsd:element>
152
+ <xsd:element name="tenbucksCurrencyListResponseParam">
153
+ <xsd:complexType>
154
+ <xsd:sequence>
155
+ <xsd:element minOccurs="1" maxOccurs="1" name="result" type="typens:tenbucksCurrencyEntityArray" />
156
+ </xsd:sequence>
157
+ </xsd:complexType>
158
+ </xsd:element>
159
+ </xsd:schema>
160
+ </wsdl:types>
161
+ <wsdl:message name="tenbucksShippingListRequest">
162
+ <wsdl:part name="parameters" element="typens:tenbucksShippingListRequestParam" />
163
+ </wsdl:message>
164
+ <wsdl:message name="tenbucksShippingListResponse">
165
+ <wsdl:part name="parameters" element="typens:tenbucksShippingListResponseParam" />
166
+ </wsdl:message>
167
+ <wsdl:message name="tenbucksSalesStatusListRequest">
168
+ <wsdl:part name="parameters" element="typens:tenbucksSalesStatusListRequestParam" />
169
+ </wsdl:message>
170
+ <wsdl:message name="tenbucksSalesStatusListResponse">
171
+ <wsdl:part name="parameters" element="typens:tenbucksSalesStatusListResponseParam" />
172
+ </wsdl:message>
173
+ <wsdl:message name="tenbucksCatalogCategoryassignedProductsRequest">
174
+ <wsdl:part name="parameters" element="typens:tenbucksCatalogCategoryassignedProductsRequestParam" />
175
+ </wsdl:message>
176
+ <wsdl:message name="tenbucksCatalogCategoryassignedProductsResponse">
177
+ <wsdl:part name="parameters" element="typens:tenbucksCatalogCategoryassignedProductsResponseParam" />
178
+ </wsdl:message>
179
+ <wsdl:message name="tenbucksStoreListRequest">
180
+ <wsdl:part name="parameters" element="typens:tenbucksStoreListRequestRequestParam" />
181
+ </wsdl:message>
182
+ <wsdl:message name="tenbucksStoreListResponse">
183
+ <wsdl:part name="parameters" element="typens:tenbucksStoreListRequestResponseParam" />
184
+ </wsdl:message>
185
+ <wsdl:message name="tenbucksCurrencyListRequest">
186
+ <wsdl:part name="parameters" element="typens:tenbucksCurrencyListRequestRequestParam" />
187
+ </wsdl:message>
188
+ <wsdl:message name="tenbucksCurrencyListResponse">
189
+ <wsdl:part name="parameters" element="typens:tenbucksCurrencyListRequestResponseParam" />
190
+ </wsdl:message>
191
+ <wsdl:portType name="{{var wsdl.handler}}PortType">
192
+ <wsdl:operation name="tenbucksShippingList">
193
+ <wsdl:documentation>Get list of available shipping methods</wsdl:documentation>
194
+ <wsdl:input message="typens:tenbucksShippingListRequest"/>
195
+ <wsdl:output message="typens:tenbucksShippingListResponse"/>
196
+ </wsdl:operation>
197
+ <wsdl:operation name="tenbucksSalesStatusList">
198
+ <wsdl:documentation>Get list of available order status</wsdl:documentation>
199
+ <wsdl:input message="typens:tenbucksSalesStatusListRequest"/>
200
+ <wsdl:output message="typens:typens:tenbucksSalesStatusListResponse"/>
201
+ </wsdl:operation>
202
+ <wsdl:operation name="tenbucksCatalogCategoryassignedProducts">
203
+ <wsdl:documentation>Retrieve list of assigned products</wsdl:documentation>
204
+ <wsdl:input message="typens:tenbucksCatalogCategoryassignedProductsRequest"/>
205
+ <wsdl:output message="typens:typens:tenbucksCatalogCategoryassignedProductsResponse"/>
206
+ </wsdl:operation>
207
+ <wsdl:operation name="tenbucksCatalogProductitemsInCategory">
208
+ <wsdl:documentation>Retrieve list of products assigned to at least one category</wsdl:documentation>
209
+ <wsdl:input message="typens:catalogProductListRequest"/>
210
+ <wsdl:output message="typens:catalogProductListResponse"/>
211
+ </wsdl:operation>
212
+ <wsdl:operation name="tenbucksCatalogProductAttributeList">
213
+ <wsdl:documentation>Retrieve attribute list</wsdl:documentation>
214
+ <wsdl:input message="typens:catalogProductAttributeListRequest"/>
215
+ <wsdl:output message="typens:catalogProductAttributeListResponse"/>
216
+ </wsdl:operation>
217
+ <wsdl:operation name="tenbucksStoreList">
218
+ <wsdl:documentation>List of stores</wsdl:documentation>
219
+ <wsdl:input message="typens:tenbucksStoreListRequest" />
220
+ <wsdl:output message="typens:tenbucksStoreListResponse" />
221
+ </wsdl:operation>
222
+ <wsdl:operation name="tenbucksCurrencyList">
223
+ <wsdl:documentation>List of currencies</wsdl:documentation>
224
+ <wsdl:input message="typens:tenbucksCurrencyListRequest" />
225
+ <wsdl:output message="typens:tenbucksCurrencyListResponse" />
226
+ </wsdl:operation>
227
+ </wsdl:portType>
228
+ <wsdl:binding name="{{var wsdl.handler}}Binding" type="typens:{{var wsdl.handler}}PortType">
229
+ <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
230
+ <wsdl:operation name="tenbucksShippingList">
231
+ <soap:operation soapAction="" />
232
+ <wsdl:input>
233
+ <soap:body use="literal" />
234
+ </wsdl:input>
235
+ <wsdl:output>
236
+ <soap:body use="literal" />
237
+ </wsdl:output>
238
+ </wsdl:operation>
239
+ <wsdl:operation name="tenbucksSalesStatusList">
240
+ <soap:operation soapAction="" />
241
+ <wsdl:input>
242
+ <soap:body use="literal" />
243
+ </wsdl:input>
244
+ <wsdl:output>
245
+ <soap:body use="literal" />
246
+ </wsdl:output>
247
+ </wsdl:operation>
248
+ <wsdl:operation name="tenbucksCatalogCategoryassignedProducts">
249
+ <soap:operation soapAction="" />
250
+ <wsdl:input>
251
+ <soap:body use="literal" />
252
+ </wsdl:input>
253
+ <wsdl:output>
254
+ <soap:body use="literal" />
255
+ </wsdl:output>
256
+ </wsdl:operation>
257
+ <wsdl:operation name="tenbucksCatalogProductitemsInCategory">
258
+ <soap:operation soapAction="" />
259
+ <wsdl:input>
260
+ <soap:body use="literal" />
261
+ </wsdl:input>
262
+ <wsdl:output>
263
+ <soap:body use="literal" />
264
+ </wsdl:output>
265
+ </wsdl:operation>
266
+ <wsdl:operation name="tenbucksCatalogProductAttributeList">
267
+ <soap:operation soapAction="" />
268
+ <wsdl:input>
269
+ <soap:body use="literal" />
270
+ </wsdl:input>
271
+ <wsdl:output>
272
+ <soap:body use="literal" />
273
+ </wsdl:output>
274
+ </wsdl:operation>
275
+ <wsdl:operation name="tenbucksStoreList">
276
+ <soap:operation soapAction="" />
277
+ <wsdl:input>
278
+ <soap:body use="literal" />
279
+ </wsdl:input>
280
+ <wsdl:output>
281
+ <soap:body use="literal" />
282
+ </wsdl:output>
283
+ </wsdl:operation>
284
+ <wsdl:operation name="tenbucksCurrencyList">
285
+ <soap:operation soapAction="" />
286
+ <wsdl:input>
287
+ <soap:body use="literal" />
288
+ </wsdl:input>
289
+ <wsdl:output>
290
+ <soap:body use="literal" />
291
+ </wsdl:output>
292
+ </wsdl:operation>
293
+ </wsdl:binding>
294
+ </wsdl:definitions>
app/design/adminhtml/default/default/layout/tenbucks.xml ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!--
3
+ /**
4
+ * Tenbucks
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 hello@tenbucks.io 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 Tenbucks to newer
19
+ * versions in the future.
20
+ *
21
+ * @category Tenbucks
22
+ * @package Tenbucks_Connect
23
+ * @copyright Copyright (c) 2016 Tenbucks. (https://www.tenbucks.io)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ * @author Tenbucks <hello@tenbucks.io>
26
+ */
27
+ -->
28
+ <layout version="0.1.0">
29
+ <default>
30
+ <reference name="head">
31
+ <action method="addCss">
32
+ <name>tenbucks/css/styles.css</name>
33
+ </action>
34
+ </reference>
35
+ </default>
36
+ <adminhtml_tenbucks>
37
+ <reference name="content">
38
+ <block type="tenbucks/adminhtml_view" name="tenbucks_adminhtml_view" template="tenbucks/view.phtml"/>
39
+ </reference>
40
+ </adminhtml_tenbucks>
41
+ </layout>
app/design/adminhtml/default/default/template/tenbucks/view.phtml ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Tenbucks
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 hello@tenbucks.io so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Tenbucks to newer
18
+ * versions in the future.
19
+ *
20
+ * @category Tenbucks
21
+ * @package Tb_Tenbucks
22
+ * @copyright Copyright (c) 2016 Tenbucks. (https://www.tenbucks.io)
23
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
24
+ * @author Tenbucks <hello@tenbucks.io>
25
+ */
26
+ ?>
27
+ <div class="content-header">
28
+ <table cellspacing="0">
29
+ <tr>
30
+ <td><h3><?php echo $this->getHeaderText() ?></h3></td>
31
+ <td class="form-buttons">
32
+ <?php echo $this->getButtonsHtml() ?>
33
+ </td>
34
+ </tr>
35
+ </table>
36
+ </div>
37
+ <div class="content">
38
+ <iframe style="width:100%;height:100%;border:0 none;min-height:600px;" id="tenbucks_iframe" src="<?php echo $this->getIframeUrl() ?>"></iframe>
39
+ </div>
app/etc/modules/Tb_Tenbucks.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Tb_Tenbucks>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ </Tb_Tenbucks>
8
+ </modules>
9
+ </config>
app/locale/en_US/Tb_Tenbucks.csv ADDED
File without changes
app/locale/fr_FR/Tb_Tenbucks.csv ADDED
File without changes
lib/tenbucks/tenbucks_registration_client/LICENSE ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 Web In Color
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
lib/tenbucks/tenbucks_registration_client/README.md ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # TenbucksRegistrationClient
2
+ Send API keys TenBucks API server
3
+
4
+ # Usage
5
+ ```php
6
+ // Client
7
+ $client = new TenbucksRegistrationClient();
8
+
9
+ // Data
10
+ $opts = array(
11
+ 'email' => 'joe.doe@example.org',
12
+ 'sponsor' => 'jane.doe@example.org', // optionnal
13
+ 'company' => 'My company name',
14
+ 'platform' => 'WooCommerce',
15
+ 'locale' => 'fr',
16
+ 'country' => 'FR',
17
+ 'url' => 'http://localhost',
18
+ 'credentials' => array(
19
+ 'key' => md5('test_key'), // key
20
+ 'secret' => md5('test_secret'), // secret
21
+ )
22
+ );
23
+
24
+ $query = $client->send($opts);
25
+ $success = array_key_exists('success', $query) && (bool)$query['success'];
26
+ if ($success) {
27
+ // success
28
+ } else {
29
+ // Error
30
+ }
31
+ ```
32
+
33
+ # test
34
+ ```bash
35
+ $ phpunit --bootstrap src/TenbucksRegistrationClient.php tests/TenbucksRegistrationClientTest
36
+ ```
lib/tenbucks/tenbucks_registration_client/src/TenbucksRegistrationClient.php ADDED
@@ -0,0 +1,156 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * The MIT License
5
+ *
6
+ * Copyright 2016 tenbucks.
7
+ *
8
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
9
+ * of this software and associated documentation files (the "Software"), to deal
10
+ * in the Software without restriction, including without limitation the rights
11
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
+ * copies of the Software, and to permit persons to whom the Software is
13
+ * furnished to do so, subject to the following conditions:
14
+ *
15
+ * The above copyright notice and this permission notice shall be included in
16
+ * all copies or substantial portions of the Software.
17
+ *
18
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24
+ * THE SOFTWARE.
25
+ */
26
+
27
+ /**
28
+ * Send API keys TenBucks API server
29
+ *
30
+ * @author Gary P. <gary@webincolor.fr>
31
+ */
32
+ final class TenbucksRegistrationClient
33
+ {
34
+
35
+ const URL = 'https://apps.tenbucks.io/';
36
+
37
+ /**
38
+ * @var array Mandatory fields list
39
+ */
40
+ private $mandatoryFields = array(
41
+ 'email', // joe.doe@example.org
42
+ 'company', // My company name
43
+ 'platform', // WooCommerce|PrestaShop|Magento
44
+ 'locale', // fr|en
45
+ 'country', // FR, UK, US, ...
46
+ 'url' // https://www.example.org <- with protocol, no trailing-slash
47
+ );
48
+
49
+ /**
50
+ * @var array Mandatory fields list
51
+ */
52
+ private $supportedLocales = array(
53
+ 'en', // English - US
54
+ 'fr', // Français - France
55
+ );
56
+
57
+ /**
58
+ * @var string Key used to sign data
59
+ */
60
+ private $encryption_key;
61
+
62
+ /**
63
+ * Send API keys
64
+ * @param array $opts User data
65
+ * @return array server response
66
+ *
67
+ */
68
+ public function send(array $opts)
69
+ {
70
+ foreach ($this->mandatoryFields as $key) {
71
+ if (empty($opts[$key])) {
72
+ throw new Exception("Parameter $key is missing");
73
+ }
74
+ }
75
+ $locale = strtolower($opts['locale']);
76
+
77
+ if ( !in_array($locale, $this->supportedLocales) ) {
78
+ $locale = 'en';
79
+ }
80
+ $path = sprintf('registration/%s/site/new', $locale);
81
+
82
+ return $this->setKey($opts['url'])->call($path, $opts);
83
+ }
84
+
85
+ /**
86
+ * Retrieve encryption key
87
+ *
88
+ * @param string $url shop url
89
+ * @return \TenbucksKeysClient
90
+ * @throws Exception
91
+ */
92
+ private function setKey($url)
93
+ {
94
+ $query = $this->call('key_manager/new', array(
95
+ 'url' => $url
96
+ ));
97
+
98
+ if (!array_key_exists('key', $query)) {
99
+ $msg = 'Can\'t retrieve encryption key.';
100
+
101
+ if (array_key_exists('error', $query)) {
102
+ $msg .= ' ('.print_r($query['error'], true).')';
103
+ }
104
+ throw new Exception($msg);
105
+ }
106
+
107
+ $this->encryption_key = $query['key'];
108
+
109
+ return $this;
110
+ }
111
+
112
+
113
+ private function call($path, array $data = array())
114
+ {
115
+ $url = self::URL.preg_replace('/^\//', '', $path);
116
+
117
+ $request_headers = array(
118
+ 'Accept: application/json',
119
+ 'User-Agent: TenbucksKeys API Client'
120
+ );
121
+
122
+ if (!empty($this->encryption_key)) {
123
+ $request_headers[] = 'X-Tenbucks-Signature: '.$this->getSignature($data);
124
+ }
125
+
126
+ $ch = curl_init();
127
+ curl_setopt($ch, CURLOPT_URL, $url);
128
+ curl_setopt($ch, CURLOPT_HTTPHEADER, $request_headers);
129
+ curl_setopt($ch, CURLOPT_POST, true);
130
+ curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
131
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
132
+ curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
133
+ curl_setopt($ch, CURLOPT_TIMEOUT, 10);
134
+
135
+ // Process
136
+ $response = curl_exec($ch);
137
+ $http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
138
+
139
+ if ( empty( $response ) || !in_array($http_code, array(200, 201)) ) {
140
+ $response = array(
141
+ 'http_code' => $http_code,
142
+ 'error' => curl_error($ch)
143
+ );
144
+ }
145
+ curl_close($ch);
146
+
147
+ return is_array($response) ? $response : json_decode($response, true);
148
+ }
149
+
150
+ private function getSignature(array $data)
151
+ {
152
+ ksort($data);
153
+ return hash_hmac('sha256', http_build_query($data), $this->encryption_key);
154
+ }
155
+
156
+ }
lib/tenbucks/tenbucks_registration_client/tests/TenbucksRegistrationClientTest.php ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * The MIT License
5
+ *
6
+ * Copyright 2016 gary.
7
+ *
8
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
9
+ * of this software and associated documentation files (the "Software"), to deal
10
+ * in the Software without restriction, including without limitation the rights
11
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
+ * copies of the Software, and to permit persons to whom the Software is
13
+ * furnished to do so, subject to the following conditions:
14
+ *
15
+ * The above copyright notice and this permission notice shall be included in
16
+ * all copies or substantial portions of the Software.
17
+ *
18
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24
+ * THE SOFTWARE.
25
+ */
26
+
27
+ /**
28
+ * Test of TenbucksKeysClient class
29
+ *
30
+ * @author Gary P. <gary@webincolor.fr>
31
+ */
32
+ class TenbucksRegistrationClientTest extends PHPUnit_Framework_TestCase
33
+ {
34
+ public function testSend()
35
+ {
36
+ // Client
37
+ $client = new TenbucksRegistrationClient();
38
+ $opts = array(
39
+ 'email' => 'joe.doe@example.org',
40
+ 'sponsor' => 'jane.doe@example.org', // optionnal
41
+ 'company' => 'My company name',
42
+ 'platform' => 'WooCommerce',
43
+ 'locale' => 'fr',
44
+ 'country' => 'FR',
45
+ 'url' => 'http://localhost',
46
+ 'credentials' => array(
47
+ 'api_key' => md5('test_key'), // key
48
+ 'api_secret' => md5('test_secret'), // secret
49
+ )
50
+ );
51
+ $query = $client->send($opts);
52
+ $success = array_key_exists('success', $query) && (bool)$query['success'];
53
+ // Assert
54
+ $this->assertTrue($success);
55
+ }
56
+
57
+ }
lib/tenbucks/tenbuckswebhooks/.gitignore ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ composer.phar
2
+ /vendor/
3
+
4
+ # Commit your application's lock file http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file
5
+ # You may choose to ignore a library lock file http://getcomposer.org/doc/02-libraries.md#lock-file
6
+ # composer.lock
lib/tenbucks/tenbuckswebhooks/LICENSE ADDED
@@ -0,0 +1,201 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "{}"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright {yyyy} {name of copyright owner}
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
lib/tenbucks/tenbuckswebhooks/README.md ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # TenbucksWebhooks
2
+ Manage Webhooks and synchronize data with tenbucks.
3
+
4
+ # Usage
5
+ ```php
6
+ $client = new TenbucksWebhooks();
7
+ $query = array(
8
+ 'shop_url' => 'http://www.example.org',
9
+ 'model' => 'product',
10
+ 'external_id' => 1,
11
+ );
12
+ try {
13
+ if ($client->send($query)) {
14
+ // success
15
+ } else {
16
+ // error
17
+ }
18
+ } catch (Exception $e) {
19
+ // Network error / timeout
20
+ }
21
+ ```
22
+
23
+ # test
24
+ ```bash
25
+ $ phpunit --bootstrap src/TenbucksWebhooks.php tests/TenbucksWebhooksTest.php
26
+ ```
lib/tenbucks/tenbuckswebhooks/src/TenbucksWebhooks.php ADDED
@@ -0,0 +1,94 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * Copyright 2016 tenbucks.©
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License.
8
+ * You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */
18
+
19
+ /**
20
+ * Manage Webhooks and synchronize data with tenbucks.
21
+ *
22
+ * @author Gary PEGEOT <gary@webincolor.fr>
23
+ */
24
+ class TenbucksWebhooks
25
+ {
26
+ /**
27
+ * API url.
28
+ */
29
+ const URL = 'https://lezfd2kfmf.execute-api.eu-west-1.amazonaws.com/prod/webhooks';
30
+
31
+ /**
32
+ * Connection timeout.
33
+ */
34
+ const TIMEOUT_PERIOD = 15;
35
+
36
+ /**
37
+ * Query required fields.
38
+ *
39
+ * @var array
40
+ */
41
+ private $requiredFields = array(
42
+ 'shop_url', // Complete Url -> http://www.example.org
43
+ 'model', // Model name, in lowercase -> product | order
44
+ 'external_id', // Model ID in the shop -> 1
45
+ );
46
+
47
+ /**
48
+ * Send webhooks data.
49
+ *
50
+ * @param array $query Request details
51
+ *
52
+ * @return bool Operation success
53
+ *
54
+ * @throws Exception Bad request | network error
55
+ */
56
+ public function send(array $query)
57
+ {
58
+ foreach ($this->requiredFields as $key) {
59
+ if (empty($query[$key])) {
60
+ throw new Exception("Missing {$key} parameter in query.");
61
+ }
62
+ }
63
+
64
+ $headers = array(
65
+ 'POST '.self::URL.' HTTP/1.1',
66
+ 'Content-Type: application/json',
67
+ 'Accept: application/json',
68
+ 'Cache-Control: no-cache',
69
+ 'Pragma: no-cache',
70
+ );
71
+
72
+ $ch = curl_init();
73
+
74
+ curl_setopt($ch, CURLOPT_URL, self::URL);
75
+ curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
76
+ curl_setopt($ch, CURLOPT_POST, true);
77
+ curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($query));
78
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
79
+ curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, self::TIMEOUT_PERIOD);
80
+ curl_setopt($ch, CURLOPT_TIMEOUT, self::TIMEOUT_PERIOD);
81
+ $result = curl_exec($ch);
82
+
83
+ if (empty($result)) {
84
+ $http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
85
+ $error = curl_error($ch);
86
+ throw new Exception("Error {$http_code}: {$error}.");
87
+ }
88
+
89
+ curl_close($ch);
90
+ $data = json_decode($result, true);
91
+
92
+ return !empty($data) && isset($data['status']) && $data['status'] === 'success';
93
+ }
94
+ }
lib/tenbucks/tenbuckswebhooks/tests/TenbucksWebhooksTest.php ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * Copyright 2016 tenbucks.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License.
8
+ * You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */
18
+
19
+ /**
20
+ * Test of TenbucksKeysClient class.
21
+ *
22
+ * @author Gary PEGEOT <gary@webincolor.fr>
23
+ */
24
+ class TenbucksWebhooksTest extends PHPUnit_Framework_TestCase
25
+ {
26
+ public function testSend()
27
+ {
28
+ $client = new TenbucksWebhooks();
29
+ $query = array(
30
+ 'shop_url' => 'http://www.example.org',
31
+ 'model' => 'product',
32
+ 'external_id' => 1,
33
+ );
34
+
35
+ $this->assertTrue($client->send($query));
36
+ }
37
+
38
+ /**
39
+ * @expectedException Exception
40
+ * @expectedExceptionMessage Missing shop_url parameter in query.
41
+ */
42
+ public function testBadRequest()
43
+ {
44
+ $client = new TenbucksWebhooks();
45
+ $query = array(
46
+ 'model' => 'product',
47
+ 'external_id' => 1,
48
+ );
49
+
50
+ $client->send($query);
51
+ }
52
+ }
package.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Tb_Tenbucks</name>
4
+ <version>1.1.4</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://opensource.org/licenses/osl-3.0.php">The Open Software License 3.0 (OSL-3.0)</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>tenbucks.&#xA9; is the unique toolset for your shop.</summary>
10
+ <description>tenbucks.&#xA9; is a unique toolset full of possibilities for your shop.</description>
11
+ <notes>Add new set of API</notes>
12
+ <authors><author><name>Web In Color</name><user>webincolor</user><email>contact@webincolor.fr</email></author></authors>
13
+ <date>2016-03-08</date>
14
+ <time>09:13:22</time>
15
+ <contents><target name="magecommunity"><dir name="Tb"><dir name="Tenbucks"><dir name="Block"><dir name="Adminhtml"><dir name="Register"><file name="Form.php" hash="2e718b2d8d5a43fa8a7e87a3fea985c2"/></dir><file name="Register.php" hash="d545402ea72bd10b01dc89475978d24c"/><file name="View.php" hash="1102c9d2f1df9f97dbeff569c4d9b7d1"/><file name=".DS_Store" hash="194577a7e20bdcc7afbb718f502c134c"/></dir><file name=".DS_Store" hash="7c907aab4b40213a0f905a8e6d5d258e"/></dir><dir name="Helper"><file name="Api.php" hash="271a5dfab2946ec7ea4fe1cf5bc837c9"/><file name="Data.php" hash="b04e66b8e0f252bc847d63698e4e224c"/></dir><dir name="Model"><dir name="Catalog"><dir name="Category"><dir name="Api"><file name="V2.php" hash="49d9d40e4dafa21a92b64082e8c8ddfa"/></dir><file name="Api.php" hash="cc6e5f2fc99d16bca9c98c0c4771e85c"/></dir><dir name="Product"><dir name="Api"><file name="V2.php" hash="29ad500550cd166f52dba8c750b55d0c"/></dir><file name="Api.php" hash="bae75a24ef2c8360af1a4eccb2f0800f"/><dir name="Attribute"><dir name="Api"><file name="V2.php" hash="f154b527458dd17fd85b828d02b9783b"/></dir><file name="Api.php" hash="0b71fa8fb2a6e97125746a553b1314c7"/></dir></dir><file name=".DS_Store" hash="194577a7e20bdcc7afbb718f502c134c"/></dir><dir name="Core"><dir name="Store"><dir name="Api"><file name="V2.php" hash="fae3ef660626a61456ee25c55d0fa6d3"/></dir><file name="Api.php" hash="2546de11859c1419450c4c7c549c5f00"/></dir></dir><dir name="Directory"><dir name="Currency"><dir name="Api"><file name="V2.php" hash="9d40e8bb57f23d8b1882664031b1753b"/></dir><file name="Api.php" hash="d84b79881aba8c56688d212e9e483d41"/></dir></dir><file name="Observer.php" hash="1963edb27579ec097da56658612400b4"/><dir name="Sales"><dir name="Status"><dir name="Api"><file name="V2.php" hash="3136d8fbc7137617d857a78c8309d723"/></dir><file name="Api.php" hash="f7b72664950cc324b48715b16ad4b8ea"/></dir></dir><dir name="Shipping"><dir name="Api"><file name="V2.php" hash="f51b5907cbc1c3a90883acefe57df855"/></dir><file name="Api.php" hash="50c538f25fa7f5d1036d2ebda55cf45b"/></dir><dir name="System"><dir name="Config"><dir name="Source"><file name="Attributes.php" hash="43710ac656236e71696779a8af3df668"/></dir></dir><file name=".DS_Store" hash="42ef7c5c50244bbd4ccc4fbb3d6212f6"/></dir><file name="Webhooks.php" hash="a9ecef6004b2d286be8a3ef053b97a80"/><file name=".DS_Store" hash="58472e16a4d9c6265556f5c7465654be"/></dir><dir name="controllers"><file name="TenbucksController.php" hash="b9c2f10cb077c89e75f771fcce8841e1"/><file name=".DS_Store" hash="194577a7e20bdcc7afbb718f502c134c"/></dir><dir name="data"><dir name="tenbucks_connect_setup"><file name="data-install-1.0.0.php" hash="d3180a176b3baddc484c2c32068fe643"/></dir><file name=".DS_Store" hash="fdf4fb192d465f815deebce206906f82"/></dir><dir name="etc"><file name="adminhtml.xml" hash="ac684c7d04c114922fcf981adc83b809"/><file name="api.xml" hash="4dc7c4b3616c82506300852d9a95c95a"/><file name="config.xml" hash="8945dd7db86137d8d762587f359a12ba"/><file name="system.xml" hash="eaec009b795a3a9de5b5c1b9506a1e8f"/><file name="wsdl.xml" hash="a285c0ce787a85c0d902097cf0414983"/><file name="wsi.xml" hash="3d2d757403f852a342ad6647b31e3d23"/><file name=".DS_Store" hash="194577a7e20bdcc7afbb718f502c134c"/></dir><file name=".DS_Store" hash="0eeb40c9a3ad9d24f2648a68c93c29aa"/></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Tb_Tenbucks.xml" hash="d1e621dbaec2584c01e50738ea28f5e6"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="tenbucks.xml" hash="c12d441f12fee495dfc480d980e60970"/></dir><dir name="template"><dir name="tenbucks"><file name="view.phtml" hash="5bd7e791b4d47035973e598d01f6c2bc"/></dir></dir></dir></dir></dir></target><target name="magelocale"><dir><dir name="en_US"><file name="Tb_Tenbucks.csv" hash="d41d8cd98f00b204e9800998ecf8427e"/></dir><dir name="fr_FR"><file name="Tb_Tenbucks.csv" hash="d41d8cd98f00b204e9800998ecf8427e"/></dir></dir></target><target name="magelib"><dir name="tenbucks"><dir name="tenbucks_registration_client"><file name="LICENSE" hash="e5e42d8c0b95ed2a7fe79d034d7b27f1"/><file name="README.md" hash="ce14ce4a9d0231081be01e5998470770"/><dir name="src"><file name="TenbucksRegistrationClient.php" hash="ed74a1257c8ef5e6ac833b4bb1cfe135"/></dir><dir name="tests"><file name="TenbucksRegistrationClientTest.php" hash="06cede1a813430f068720ad2cd4c5cda"/></dir><file name=".git" hash="c54f2102053d494d24a8ca185e241fcb"/></dir><dir name="tenbuckswebhooks"><file name="LICENSE" hash="e3fc50a88d0a364313df4b21ef20c29e"/><file name="README.md" hash="5d3ba0eaa58a069103a51841c121fbb8"/><dir name="src"><file name="TenbucksWebhooks.php" hash="c96f5cdc276dd3a3faf7b109371b3acb"/></dir><dir name="tests"><file name="TenbucksWebhooksTest.php" hash="4cca53a50fd3ddd7255a2c3b8e425ff6"/></dir><file name=".git" hash="12feba45285af7c478cf30a50cac3c35"/><file name=".gitignore" hash="039c53d3d311fca134bbfe43f6daec03"/></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="tenbucks"><dir name="css"><file name="styles.css" hash="aef66df41d76bcfcb4510a2bddba1caa"/></dir><dir name="images"><file name="logo_220x50.png" hash="331e2c81bd8b12000ef25a7c43d8f5fc"/></dir></dir></dir></dir></dir></target></contents>
16
+ <compatible/>
17
+ <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
18
+ </package>
skin/adminhtml/default/default/tenbucks/css/styles.css ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ h3.tenbucks-header { background: url(../images/logo_220x50.png) no-repeat 0 0;height: 0;overflow: hidden;padding: 40px 0 0;background-size: 100%; width: 180px;}
2
+ ul.tabs a.tenbucks-section, ul.tabs a.tenbucks-section:hover{
3
+ background: url(../../images/tabs_span_bg.gif) repeat-x 0 100%;
4
+ border-bottom: none;
5
+ padding: 0.5em 0.5em 0.28em 1.5em;
6
+ }
7
+ ul.tabs a.tenbucks-section:hover { background-color:#d8e6e6; }
8
+ ul.tabs a.tenbucks-section.active, ul.tabs a.tenbucks-section.active:hover { background-color:#fff; }
9
+
10
+ ul.tabs a.tenbucks-section span, ul.tabs a.tenbucks-section:hover span {
11
+ background: url(../images/logo_220x50.png) no-repeat;
12
+ background-size: 100%;
13
+ height: 0;
14
+ width: 90px;
15
+ overflow: hidden;
16
+ padding: 25px 0 0;
17
+ }
skin/adminhtml/default/default/tenbucks/images/logo_220x50.png ADDED
Binary file