Auctane_ShipStation - Version 1.3.0

Version Notes

Official release.
Export custom attributes as custom options to API.

Download this release

Release Info

Developer Clockworkgeek
Extension Auctane_ShipStation
Version 1.3.0
Comparing to
See all releases


Version 1.3.0

Files changed (37) hide show
  1. app/code/community/Auctane/Api/Helper/Data.php +75 -0
  2. app/code/community/Auctane/Api/LICENSE.html +42 -0
  3. app/code/community/Auctane/Api/LICENSE.txt +48 -0
  4. app/code/community/Auctane/Api/LICENSE_AFL.txt +48 -0
  5. app/code/community/Auctane/Api/Model/Server/Adapter.php +435 -0
  6. app/code/community/Auctane/Api/Model/System/Source/Config/Customattributes.php +43 -0
  7. app/code/community/Auctane/Api/controllers/AuctaneController.php +27 -0
  8. app/code/community/Auctane/Api/etc/api.xml +29 -0
  9. app/code/community/Auctane/Api/etc/config.xml +159 -0
  10. app/code/community/Auctane/Api/etc/system.xml +42 -0
  11. app/code/community/Auctane/ShipStation/Block/Adminhtml/Linkup.php +33 -0
  12. app/code/community/Auctane/ShipStation/Block/Adminhtml/Linkup/Form.php +56 -0
  13. app/code/community/Auctane/ShipStation/Block/Adminhtml/Pending.php +36 -0
  14. app/code/community/Auctane/ShipStation/Helper/Data.php +49 -0
  15. app/code/community/Auctane/ShipStation/LICENSE.html +42 -0
  16. app/code/community/Auctane/ShipStation/LICENSE.txt +48 -0
  17. app/code/community/Auctane/ShipStation/LICENSE_AFL.txt +48 -0
  18. app/code/community/Auctane/ShipStation/Model/Mysql4/User.php +27 -0
  19. app/code/community/Auctane/ShipStation/Model/Mysql4/User/Collection.php +28 -0
  20. app/code/community/Auctane/ShipStation/Model/Observer.php +32 -0
  21. app/code/community/Auctane/ShipStation/Model/User.php +100 -0
  22. app/code/community/Auctane/ShipStation/controllers/Adminhtml/ShipstationController.php +93 -0
  23. app/code/community/Auctane/ShipStation/etc/adminhtml.xml +46 -0
  24. app/code/community/Auctane/ShipStation/etc/api.xml +46 -0
  25. app/code/community/Auctane/ShipStation/etc/config.xml +115 -0
  26. app/code/community/Auctane/ShipStation/sql/auctaneshipstation_setup/mysql4-install-1.0.0.php +46 -0
  27. app/design/adminhtml/default/default/layout/auctaneshipstation.xml +45 -0
  28. app/design/adminhtml/default/default/template/auctane/shipstation/container.phtml +40 -0
  29. app/design/adminhtml/default/default/template/auctane/shipstation/launch.phtml +31 -0
  30. app/design/adminhtml/default/default/template/auctane/shipstation/launchform.phtml +59 -0
  31. app/design/adminhtml/default/default/template/auctane/shipstation/linkup.phtml +28 -0
  32. app/design/adminhtml/default/default/template/auctane/shipstation/pending.phtml +41 -0
  33. app/etc/modules/Auctane_Api.xml +9 -0
  34. app/etc/modules/Auctane_ShipStation.xml +9 -0
  35. app/locale/en_US/Auctane_ShipStation.csv +23 -0
  36. package.xml +20 -0
  37. skin/adminhtml/default/default/images/shipstation.png +0 -0
app/code/community/Auctane/Api/Helper/Data.php ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * ShipStation
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@auctane.com so we can send you a copy immediately.
14
+ *
15
+ * @category Shipping
16
+ * @package Auctane_Api
17
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
18
+ */
19
+
20
+ class Auctane_Api_Helper_Data extends Mage_Core_Helper_Data
21
+ {
22
+
23
+ /**
24
+ * Write a source object to an XML stream, mapping fields via a fieldset.
25
+ * Fieldsets are nodes in config.xml
26
+ *
27
+ * @param string $fieldset
28
+ * @param array|Varien_Object $source
29
+ * @param XMLWriter $xml
30
+ */
31
+ public function fieldsetToXml($fieldset, $source, XMLWriter $xml)
32
+ {
33
+ $fields = (array) Mage::getConfig()->getFieldset($fieldset);
34
+ foreach ($fields as $field => $dest) {
35
+ if (!$dest->auctaneapi) continue;
36
+
37
+ $name = $dest->auctaneapi == '*' ? $field : $dest->auctaneapi;
38
+ $value = $source instanceof Varien_Object
39
+ ? $source->getDataUsingMethod($field)
40
+ : @$source[$field];
41
+ $xml->writeElement((string) $name, (string) $value);
42
+ }
43
+ }
44
+
45
+ /**
46
+ * @return array of string names
47
+ * @see "auctane_exclude" nodes in config.xml
48
+ */
49
+ public function getIncludedProductTypes()
50
+ {
51
+ static $types;
52
+ if (!isset($types)) {
53
+ $types = Mage::getModel('catalog/product_type')->getTypes();
54
+ $types = array_filter($types, create_function('$type', 'return !@$type["auctane_exclude"];'));
55
+ }
56
+ return array_keys($types);
57
+ }
58
+
59
+ /**
60
+ * Indicate if a {$type} is specifically excluded by config
61
+ *
62
+ * @param string $type
63
+ * @return bool
64
+ */
65
+ public function isExcludedProductType($type)
66
+ {
67
+ static $types;
68
+ if (!isset($types)) {
69
+ $types = Mage::getModel('catalog/product_type')->getTypes();
70
+ $types = array_filter($types, create_function('$type', 'return (bool) @$type["auctane_exclude"];'));
71
+ }
72
+ return isset($types[$type]);
73
+ }
74
+
75
+ }
app/code/community/Auctane/Api/LICENSE.html ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <h4>Open Software License ("OSL") v. 3.0</h4>
2
+
3
+ <p>This Open Software License (the "License") applies to any original work of authorship (the "Original Work") whose owner (the "Licensor") has placed the following licensing notice adjacent to the copyright notice for the Original Work:</p>
4
+ <h5>Licensed under the Open Software License version 3.0</h5>
5
+ <p>Grant of Copyright License. Licensor grants You a worldwide, royalty-free, non-exclusive, sublicensable license, for the duration of the copyright, to do the following:</p>
6
+ <ul class="disc">
7
+ <li>to reproduce the Original Work in copies, either alone or as part of a collective work</li>
8
+ <li>to translate, adapt, alter, transform, modify, or arrange the Original Work, thereby creating derivative works ("Derivative Works") based upon the Original Work</li>
9
+ <li>to distribute or communicate copies of the Original Work and Derivative Works to the public, with the proviso that copies of Original Work or Derivative Works that You distribute or communicate shall be licensed under this Open Software License</li>
10
+ <li>to perform the Original Work publicly</li>
11
+ <li>to display the Original Work publicly</li>
12
+ </ul>
13
+
14
+ <p><strong>Grant of Patent License.</strong> Licensor grants You a worldwide, royalty-free, non-exclusive, sublicensable license, under patent claims owned or controlled by the Licensor that are embodied in the Original Work as furnished by the Licensor, for the duration of the patents, to make, use, sell, offer for sale, have made, and import the Original Work and Derivative Works.</p>
15
+
16
+ <p><strong>Grant of Source Code License.</strong> The term "Source Code" means the preferred form of the Original Work for making modifications to it and all available documentation describing how to modify the Original Work. Licensor agrees to provide a machine-readable copy of the Source Code of the Original Work along with each copy of the Original Work that Licensor distributes. Licensor reserves the right to satisfy this obligation by placing a machine-readable copy of the Source Code in an information repository reasonably calculated to permit inexpensive and convenient access by You for as long as Licensor continues to distribute the Original Work.</p>
17
+
18
+ <p><strong>Exclusions From License Grant.</strong> Neither the names of Licensor, nor the names of any contributors to the Original Work, nor any of their trademarks or service marks, may be used to endorse or promote products derived from this Original Work without express prior permission of the Licensor. Except as expressly stated herein, nothing in this License grants any license to Licensor's trademarks, copyrights, patents, trade secrets or any other intellectual property. No patent license is granted to make, use, sell, offer for sale, have made, or import embodiments of any patent claims other than the licensed claims defined in Section 2. No license is granted to the trademarks of Licensor even if such marks are included in the Original Work. Nothing in this License shall be interpreted to prohibit Licensor from licensing under terms different from this License any Original Work that Licensor otherwise would have a right to license.</p>
19
+
20
+ <p><strong>External Deployment.</strong> The term "External Deployment" means the use, distribution, or communication of the Original Work or Derivative Works in any way such that the Original Work or Derivative Works may be used by anyone other than You, whether those works are distributed or communicated to those persons or made available as an application intended for use over a network. As an express condition for the grants of license hereunder, You must treat any External Deployment by You of the Original Work or a Derivative Work as a distribution under section 1(c).</p>
21
+
22
+ <p><strong>Attribution Rights.</strong> You must retain, in the Source Code of any Derivative Works that You create, all copyright, patent, or trademark notices from the Source Code of the Original Work, as well as any notices of licensing and any descriptive text identified therein as an "Attribution Notice." You must cause the Source Code for any Derivative Works that You create to carry a prominent Attribution Notice reasonably calculated to inform recipients that You have modified the Original Work.</p>
23
+
24
+ <p><strong>Warranty of Provenance and Disclaimer of Warranty.</strong> Licensor warrants that the copyright in and to the Original Work and the patent rights granted herein by Licensor are owned by the Licensor or are sublicensed to You under the terms of this License with the permission of the contributor(s) of those copyrights and patent rights. Except as expressly stated in the immediately preceding sentence, the Original Work is provided under this License on an "AS IS" BASIS and WITHOUT WARRANTY, either express or implied, including, without limitation, the warranties of non-infringement, merchantability or fitness for a particular purpose. THE ENTIRE RISK AS TO THE QUALITY OF THE ORIGINAL WORK IS WITH YOU. This DISCLAIMER OF WARRANTY constitutes an essential part of this License. No license to the Original Work is granted by this License except under this disclaimer.</p>
25
+
26
+ <p><strong>Limitation of Liability.</strong> Under no circumstances and under no legal theory, whether in tort (including negligence), contract, or otherwise, shall the Licensor be liable to anyone for any indirect, special, incidental, or consequential damages of any character arising as a result of this License or the use of the Original Work including, without limitation, damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses. This limitation of liability shall not apply to the extent applicable law prohibits such limitation.</p>
27
+
28
+ <p><strong>Acceptance and Termination.</strong> If, at any time, You expressly assented to this License, that assent indicates your clear and irrevocable acceptance of this License and all of its terms and conditions. If You distribute or communicate copies of the Original Work or a Derivative Work, You must make a reasonable effort under the circumstances to obtain the express assent of recipients to the terms of this License. This License conditions your rights to undertake the activities listed in Section 1, including your right to create Derivative Works based upon the Original Work, and doing so without honoring these terms and conditions is prohibited by copyright law and international treaty. Nothing in this License is intended to affect copyright exceptions and limitations (including 'fair use' or 'fair dealing'). This License shall terminate immediately and You may no longer exercise any of the rights granted to You by this License upon your failure to honor the conditions in Section 1(c).</p>
29
+
30
+ <p><strong>Termination for Patent Action.</strong> This License shall terminate automatically and You may no longer exercise any of the rights granted to You by this License as of the date You commence an action, including a cross-claim or counterclaim, against Licensor or any licensee alleging that the Original Work infringes a patent. This termination provision shall not apply for an action alleging patent infringement by combinations of the Original Work with other software or hardware.</p>
31
+
32
+ <p><strong>Jurisdiction, Venue and Governing Law.</strong> Any action or suit relating to this License may be brought only in the courts of a jurisdiction wherein the Licensor resides or in which Licensor conducts its primary business, and under the laws of that jurisdiction excluding its conflict-of-law provisions. The application of the United Nations Convention on Contracts for the International Sale of Goods is expressly excluded. Any use of the Original Work outside the scope of this License or after its termination shall be subject to the requirements and penalties of copyright or patent law in the appropriate jurisdiction. This section shall survive the termination of this License.</p>
33
+
34
+ <p><strong>Attorneys Fees.</strong> In any action to enforce the terms of this License or seeking damages relating thereto, the prevailing party shall be entitled to recover its costs and expenses, including, without limitation, reasonable attorneys' fees and costs incurred in connection with such action, including any appeal of such action. This section shall survive the termination of this License.</p>
35
+
36
+ <p><strong>Miscellaneous.</strong> If any provision of this License is held to be unenforceable, such provision shall be reformed only to the extent necessary to make it enforceable.</p>
37
+
38
+ <p><strong>Definition of "You" in This License.</strong> "You" throughout this License, whether in upper or lower case, means an individual or a legal entity exercising rights under, and complying with all of the terms of, this License. For legal entities, "You" includes any entity that controls, is controlled by, or is under common control with you. For purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.</p>
39
+
40
+ <p><strong>Right to Use.</strong> You may use the Original Work in all ways not otherwise restricted or conditioned by this License or by law, and Licensor promises not to interfere with or be responsible for such uses by You.</p>
41
+
42
+ <p><strong>Modification of This License.</strong> This License is Copyright &copy; 2005 Lawrence Rosen. Permission is granted to copy, distribute, or communicate this License without modification. Nothing in this License permits You to modify this License as applied to the Original Work or to Derivative Works. However, You may modify the text of this License and copy, distribute or communicate your modified version (the "Modified License") and apply it to other original works of authorship subject to the following conditions: (i) You may not indicate in any way that your Modified License is the "Open Software License" or "OSL" and you may not use those names in the name of your Modified License; (ii) You must replace the notice specified in the first paragraph above with the notice "Licensed under Open Software License ("OSL") v. 3.0" or with a notice of your own that is not confusingly similar to the notice in this License; and (iii) You may not claim that your original works are open source software unless your Modified License has been approved by Open Source Initiative (OSI) and You comply with its license review and certification process.</p>
app/code/community/Auctane/Api/LICENSE.txt ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ Open Software License ("OSL") v. 3.0
3
+
4
+ This Open Software License (the "License") applies to any original work of authorship (the "Original Work") whose owner (the "Licensor") has placed the following licensing notice adjacent to the copyright notice for the Original Work:
5
+
6
+ Licensed under the Open Software License version 3.0
7
+
8
+ 1. Grant of Copyright License. Licensor grants You a worldwide, royalty-free, non-exclusive, sublicensable license, for the duration of the copyright, to do the following:
9
+
10
+ 1. to reproduce the Original Work in copies, either alone or as part of a collective work;
11
+
12
+ 2. to translate, adapt, alter, transform, modify, or arrange the Original Work, thereby creating derivative works ("Derivative Works") based upon the Original Work;
13
+
14
+ 3. to distribute or communicate copies of the Original Work and Derivative Works to the public, with the proviso that copies of Original Work or Derivative Works that You distribute or communicate shall be licensed under this Open Software License;
15
+
16
+ 4. to perform the Original Work publicly; and
17
+
18
+ 5. to display the Original Work publicly.
19
+
20
+ 2. Grant of Patent License. Licensor grants You a worldwide, royalty-free, non-exclusive, sublicensable license, under patent claims owned or controlled by the Licensor that are embodied in the Original Work as furnished by the Licensor, for the duration of the patents, to make, use, sell, offer for sale, have made, and import the Original Work and Derivative Works.
21
+
22
+ 3. Grant of Source Code License. The term "Source Code" means the preferred form of the Original Work for making modifications to it and all available documentation describing how to modify the Original Work. Licensor agrees to provide a machine-readable copy of the Source Code of the Original Work along with each copy of the Original Work that Licensor distributes. Licensor reserves the right to satisfy this obligation by placing a machine-readable copy of the Source Code in an information repository reasonably calculated to permit inexpensive and convenient access by You for as long as Licensor continues to distribute the Original Work.
23
+
24
+ 4. Exclusions From License Grant. Neither the names of Licensor, nor the names of any contributors to the Original Work, nor any of their trademarks or service marks, may be used to endorse or promote products derived from this Original Work without express prior permission of the Licensor. Except as expressly stated herein, nothing in this License grants any license to Licensor's trademarks, copyrights, patents, trade secrets or any other intellectual property. No patent license is granted to make, use, sell, offer for sale, have made, or import embodiments of any patent claims other than the licensed claims defined in Section 2. No license is granted to the trademarks of Licensor even if such marks are included in the Original Work. Nothing in this License shall be interpreted to prohibit Licensor from licensing under terms different from this License any Original Work that Licensor otherwise would have a right to license.
25
+
26
+ 5. External Deployment. The term "External Deployment" means the use, distribution, or communication of the Original Work or Derivative Works in any way such that the Original Work or Derivative Works may be used by anyone other than You, whether those works are distributed or communicated to those persons or made available as an application intended for use over a network. As an express condition for the grants of license hereunder, You must treat any External Deployment by You of the Original Work or a Derivative Work as a distribution under section 1(c).
27
+
28
+ 6. Attribution Rights. You must retain, in the Source Code of any Derivative Works that You create, all copyright, patent, or trademark notices from the Source Code of the Original Work, as well as any notices of licensing and any descriptive text identified therein as an "Attribution Notice." You must cause the Source Code for any Derivative Works that You create to carry a prominent Attribution Notice reasonably calculated to inform recipients that You have modified the Original Work.
29
+
30
+ 7. Warranty of Provenance and Disclaimer of Warranty. Licensor warrants that the copyright in and to the Original Work and the patent rights granted herein by Licensor are owned by the Licensor or are sublicensed to You under the terms of this License with the permission of the contributor(s) of those copyrights and patent rights. Except as expressly stated in the immediately preceding sentence, the Original Work is provided under this License on an "AS IS" BASIS and WITHOUT WARRANTY, either express or implied, including, without limitation, the warranties of non-infringement, merchantability or fitness for a particular purpose. THE ENTIRE RISK AS TO THE QUALITY OF THE ORIGINAL WORK IS WITH YOU. This DISCLAIMER OF WARRANTY constitutes an essential part of this License. No license to the Original Work is granted by this License except under this disclaimer.
31
+
32
+ 8. Limitation of Liability. Under no circumstances and under no legal theory, whether in tort (including negligence), contract, or otherwise, shall the Licensor be liable to anyone for any indirect, special, incidental, or consequential damages of any character arising as a result of this License or the use of the Original Work including, without limitation, damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses. This limitation of liability shall not apply to the extent applicable law prohibits such limitation.
33
+
34
+ 9. Acceptance and Termination. If, at any time, You expressly assented to this License, that assent indicates your clear and irrevocable acceptance of this License and all of its terms and conditions. If You distribute or communicate copies of the Original Work or a Derivative Work, You must make a reasonable effort under the circumstances to obtain the express assent of recipients to the terms of this License. This License conditions your rights to undertake the activities listed in Section 1, including your right to create Derivative Works based upon the Original Work, and doing so without honoring these terms and conditions is prohibited by copyright law and international treaty. Nothing in this License is intended to affect copyright exceptions and limitations (including 'fair use' or 'fair dealing'). This License shall terminate immediately and You may no longer exercise any of the rights granted to You by this License upon your failure to honor the conditions in Section 1(c).
35
+
36
+ 10. Termination for Patent Action. This License shall terminate automatically and You may no longer exercise any of the rights granted to You by this License as of the date You commence an action, including a cross-claim or counterclaim, against Licensor or any licensee alleging that the Original Work infringes a patent. This termination provision shall not apply for an action alleging patent infringement by combinations of the Original Work with other software or hardware.
37
+
38
+ 11. Jurisdiction, Venue and Governing Law. Any action or suit relating to this License may be brought only in the courts of a jurisdiction wherein the Licensor resides or in which Licensor conducts its primary business, and under the laws of that jurisdiction excluding its conflict-of-law provisions. The application of the United Nations Convention on Contracts for the International Sale of Goods is expressly excluded. Any use of the Original Work outside the scope of this License or after its termination shall be subject to the requirements and penalties of copyright or patent law in the appropriate jurisdiction. This section shall survive the termination of this License.
39
+
40
+ 12. Attorneys' Fees. In any action to enforce the terms of this License or seeking damages relating thereto, the prevailing party shall be entitled to recover its costs and expenses, including, without limitation, reasonable attorneys' fees and costs incurred in connection with such action, including any appeal of such action. This section shall survive the termination of this License.
41
+
42
+ 13. Miscellaneous. If any provision of this License is held to be unenforceable, such provision shall be reformed only to the extent necessary to make it enforceable.
43
+
44
+ 14. Definition of "You" in This License. "You" throughout this License, whether in upper or lower case, means an individual or a legal entity exercising rights under, and complying with all of the terms of, this License. For legal entities, "You" includes any entity that controls, is controlled by, or is under common control with you. For purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
45
+
46
+ 15. Right to Use. You may use the Original Work in all ways not otherwise restricted or conditioned by this License or by law, and Licensor promises not to interfere with or be responsible for such uses by You.
47
+
48
+ 16. Modification of This License. This License is Copyright � 2005 Lawrence Rosen. Permission is granted to copy, distribute, or communicate this License without modification. Nothing in this License permits You to modify this License as applied to the Original Work or to Derivative Works. However, You may modify the text of this License and copy, distribute or communicate your modified version (the "Modified License") and apply it to other original works of authorship subject to the following conditions: (i) You may not indicate in any way that your Modified License is the "Open Software License" or "OSL" and you may not use those names in the name of your Modified License; (ii) You must replace the notice specified in the first paragraph above with the notice "Licensed under <insert your license name here>" or with a notice of your own that is not confusingly similar to the notice in this License; and (iii) You may not claim that your original works are open source software unless your Modified License has been approved by Open Source Initiative (OSI) and You comply with its license review and certification process.
app/code/community/Auctane/Api/LICENSE_AFL.txt ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ Academic Free License ("AFL") v. 3.0
3
+
4
+ This Academic Free License (the "License") applies to any original work of authorship (the "Original Work") whose owner (the "Licensor") has placed the following licensing notice adjacent to the copyright notice for the Original Work:
5
+
6
+ Licensed under the Academic Free License version 3.0
7
+
8
+ 1. Grant of Copyright License. Licensor grants You a worldwide, royalty-free, non-exclusive, sublicensable license, for the duration of the copyright, to do the following:
9
+
10
+ 1. to reproduce the Original Work in copies, either alone or as part of a collective work;
11
+
12
+ 2. to translate, adapt, alter, transform, modify, or arrange the Original Work, thereby creating derivative works ("Derivative Works") based upon the Original Work;
13
+
14
+ 3. to distribute or communicate copies of the Original Work and Derivative Works to the public, under any license of your choice that does not contradict the terms and conditions, including Licensor's reserved rights and remedies, in this Academic Free License;
15
+
16
+ 4. to perform the Original Work publicly; and
17
+
18
+ 5. to display the Original Work publicly.
19
+
20
+ 2. Grant of Patent License. Licensor grants You a worldwide, royalty-free, non-exclusive, sublicensable license, under patent claims owned or controlled by the Licensor that are embodied in the Original Work as furnished by the Licensor, for the duration of the patents, to make, use, sell, offer for sale, have made, and import the Original Work and Derivative Works.
21
+
22
+ 3. Grant of Source Code License. The term "Source Code" means the preferred form of the Original Work for making modifications to it and all available documentation describing how to modify the Original Work. Licensor agrees to provide a machine-readable copy of the Source Code of the Original Work along with each copy of the Original Work that Licensor distributes. Licensor reserves the right to satisfy this obligation by placing a machine-readable copy of the Source Code in an information repository reasonably calculated to permit inexpensive and convenient access by You for as long as Licensor continues to distribute the Original Work.
23
+
24
+ 4. Exclusions From License Grant. Neither the names of Licensor, nor the names of any contributors to the Original Work, nor any of their trademarks or service marks, may be used to endorse or promote products derived from this Original Work without express prior permission of the Licensor. Except as expressly stated herein, nothing in this License grants any license to Licensor's trademarks, copyrights, patents, trade secrets or any other intellectual property. No patent license is granted to make, use, sell, offer for sale, have made, or import embodiments of any patent claims other than the licensed claims defined in Section 2. No license is granted to the trademarks of Licensor even if such marks are included in the Original Work. Nothing in this License shall be interpreted to prohibit Licensor from licensing under terms different from this License any Original Work that Licensor otherwise would have a right to license.
25
+
26
+ 5. External Deployment. The term "External Deployment" means the use, distribution, or communication of the Original Work or Derivative Works in any way such that the Original Work or Derivative Works may be used by anyone other than You, whether those works are distributed or communicated to those persons or made available as an application intended for use over a network. As an express condition for the grants of license hereunder, You must treat any External Deployment by You of the Original Work or a Derivative Work as a distribution under section 1(c).
27
+
28
+ 6. Attribution Rights. You must retain, in the Source Code of any Derivative Works that You create, all copyright, patent, or trademark notices from the Source Code of the Original Work, as well as any notices of licensing and any descriptive text identified therein as an "Attribution Notice." You must cause the Source Code for any Derivative Works that You create to carry a prominent Attribution Notice reasonably calculated to inform recipients that You have modified the Original Work.
29
+
30
+ 7. Warranty of Provenance and Disclaimer of Warranty. Licensor warrants that the copyright in and to the Original Work and the patent rights granted herein by Licensor are owned by the Licensor or are sublicensed to You under the terms of this License with the permission of the contributor(s) of those copyrights and patent rights. Except as expressly stated in the immediately preceding sentence, the Original Work is provided under this License on an "AS IS" BASIS and WITHOUT WARRANTY, either express or implied, including, without limitation, the warranties of non-infringement, merchantability or fitness for a particular purpose. THE ENTIRE RISK AS TO THE QUALITY OF THE ORIGINAL WORK IS WITH YOU. This DISCLAIMER OF WARRANTY constitutes an essential part of this License. No license to the Original Work is granted by this License except under this disclaimer.
31
+
32
+ 8. Limitation of Liability. Under no circumstances and under no legal theory, whether in tort (including negligence), contract, or otherwise, shall the Licensor be liable to anyone for any indirect, special, incidental, or consequential damages of any character arising as a result of this License or the use of the Original Work including, without limitation, damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses. This limitation of liability shall not apply to the extent applicable law prohibits such limitation.
33
+
34
+ 9. Acceptance and Termination. If, at any time, You expressly assented to this License, that assent indicates your clear and irrevocable acceptance of this License and all of its terms and conditions. If You distribute or communicate copies of the Original Work or a Derivative Work, You must make a reasonable effort under the circumstances to obtain the express assent of recipients to the terms of this License. This License conditions your rights to undertake the activities listed in Section 1, including your right to create Derivative Works based upon the Original Work, and doing so without honoring these terms and conditions is prohibited by copyright law and international treaty. Nothing in this License is intended to affect copyright exceptions and limitations (including "fair use" or "fair dealing"). This License shall terminate immediately and You may no longer exercise any of the rights granted to You by this License upon your failure to honor the conditions in Section 1(c).
35
+
36
+ 10. Termination for Patent Action. This License shall terminate automatically and You may no longer exercise any of the rights granted to You by this License as of the date You commence an action, including a cross-claim or counterclaim, against Licensor or any licensee alleging that the Original Work infringes a patent. This termination provision shall not apply for an action alleging patent infringement by combinations of the Original Work with other software or hardware.
37
+
38
+ 11. Jurisdiction, Venue and Governing Law. Any action or suit relating to this License may be brought only in the courts of a jurisdiction wherein the Licensor resides or in which Licensor conducts its primary business, and under the laws of that jurisdiction excluding its conflict-of-law provisions. The application of the United Nations Convention on Contracts for the International Sale of Goods is expressly excluded. Any use of the Original Work outside the scope of this License or after its termination shall be subject to the requirements and penalties of copyright or patent law in the appropriate jurisdiction. This section shall survive the termination of this License.
39
+
40
+ 12. Attorneys' Fees. In any action to enforce the terms of this License or seeking damages relating thereto, the prevailing party shall be entitled to recover its costs and expenses, including, without limitation, reasonable attorneys' fees and costs incurred in connection with such action, including any appeal of such action. This section shall survive the termination of this License.
41
+
42
+ 13. Miscellaneous. If any provision of this License is held to be unenforceable, such provision shall be reformed only to the extent necessary to make it enforceable.
43
+
44
+ 14. Definition of "You" in This License. "You" throughout this License, whether in upper or lower case, means an individual or a legal entity exercising rights under, and complying with all of the terms of, this License. For legal entities, "You" includes any entity that controls, is controlled by, or is under common control with you. For purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
45
+
46
+ 15. Right to Use. You may use the Original Work in all ways not otherwise restricted or conditioned by this License or by law, and Licensor promises not to interfere with or be responsible for such uses by You.
47
+
48
+ 16. Modification of This License. This License is Copyright � 2005 Lawrence Rosen. Permission is granted to copy, distribute, or communicate this License without modification. Nothing in this License permits You to modify this License as applied to the Original Work or to Derivative Works. However, You may modify the text of this License and copy, distribute or communicate your modified version (the "Modified License") and apply it to other original works of authorship subject to the following conditions: (i) You may not indicate in any way that your Modified License is the "Academic Free License" or "AFL" and you may not use those names in the name of your Modified License; (ii) You must replace the notice specified in the first paragraph above with the notice "Licensed under <insert your license name here>" or with a notice of your own that is not confusingly similar to the notice in this License; and (iii) You may not claim that your original works are open source software unless your Modified License has been approved by Open Source Initiative (OSI) and You comply with its license review and certification process.
app/code/community/Auctane/Api/Model/Server/Adapter.php ADDED
@@ -0,0 +1,435 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * ShipStation
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@auctane.com so we can send you a copy immediately.
14
+ *
15
+ * @category Shipping
16
+ * @package Auctane_Api
17
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
18
+ */
19
+
20
+ class Auctane_Api_Model_Server_Adapter
21
+ extends Varien_Object
22
+ implements Mage_Api_Model_Server_Adapter_Interface
23
+ {
24
+ /**
25
+ * Set handler class name for webservice
26
+ * Regular handlers are ignored because this adapter only performs one service.
27
+ *
28
+ * @param string $handler
29
+ * @return Auctane_Api_Model_Server_Adapter
30
+ */
31
+ public function setHandler($handler)
32
+ {
33
+ $this->setData('handler', $handler);
34
+ return $this;
35
+ }
36
+
37
+ /**
38
+ * Retreive handler class name for webservice
39
+ *
40
+ * @return string
41
+ */
42
+ public function getHandler()
43
+ {
44
+ return $this->getData('handler');
45
+ }
46
+
47
+ /**
48
+ * Set webservice api controller
49
+ *
50
+ * @param Auctane_Api_AuctaneController $controller
51
+ * @return Auctane_Api_Model_Server_Adapter
52
+ */
53
+ public function setController(Mage_Api_Controller_Action $controller)
54
+ {
55
+ $this->setData('controller', $controller);
56
+ return $this;
57
+ }
58
+
59
+ /**
60
+ * Retrive webservice api controller
61
+ *
62
+ * @return Auctane_Api_AuctaneController
63
+ */
64
+ public function getController()
65
+ {
66
+ return $this->getData('controller');
67
+ }
68
+
69
+ /**
70
+ * Run webservice
71
+ *
72
+ * @return Auctane_Api_Model_Server_Adapter
73
+ */
74
+ public function run()
75
+ {
76
+ // Basic HTTP Authentication is used here, check on every request.
77
+ // Unlike RPC services there is no session
78
+ /* @var $user Mage_Api_Model_User */
79
+ $user = Mage::getModel('api/user');
80
+ $auth_user = isset($_SERVER['HTTP_SS_AUTH_USER']) ? $_SERVER['HTTP_SS_AUTH_USER'] : @$_SERVER['PHP_AUTH_USER'];
81
+ $auth_password = isset($_SERVER['HTTP_SS_AUTH_PW']) ? $_SERVER['HTTP_SS_AUTH_PW'] : @$_SERVER['PHP_AUTH_PW'];
82
+ if (!$user->authenticate($auth_user, $auth_password)) {
83
+ header(sprintf('WWW-Authenticate: Basic realm="%s"', Mage::getStoreConfig('auctaneapi/config/realm')));
84
+ $this->fault(401, 'Unauthorized');
85
+ }
86
+
87
+ // In case store is part of URL path use it to choose config.
88
+ $store = $this->getController()->getRequest()->get('store');
89
+ if ($store) $store = Mage::app()->getStore($store);
90
+
91
+ $apiConfigCharset = Mage::getStoreConfig("api/config/charset", $store);
92
+
93
+ try { switch ($this->getController()->getRequest()->getParam('action', 'export')) {
94
+ case 'export':
95
+ $start_date = strtotime($this->getController()->getRequest()->getParam('start_date'));
96
+ $end_date = strtotime($this->getController()->getRequest()->getParam('end_date'));
97
+ if (!$start_date || !$end_date) throw new Exception('Start and end dates are required', 400);
98
+
99
+ /* @var $orders Mage_Sales_Model_Mysql4_Order_Collection */
100
+ $orders = Mage::getResourceModel('sales/order_collection');
101
+ // might use 'created_at' attribute instead
102
+ $orders->addAttributeToFilter('updated_at',
103
+ array(
104
+ 'from' => date('Y-m-d H:i:s', $start_date),
105
+ 'to' => date('Y-m-d H:i:s', $end_date)
106
+ ));
107
+ if ($store) $orders->addAttributeToFilter('store_id', $store->getId());
108
+
109
+ $xml = new XMLWriter;
110
+ $xml->openMemory();
111
+ $xml->startDocument('1.0', $apiConfigCharset);
112
+ $this->_writeOrders($orders, $xml, $store ? $store->getId() : 0);
113
+ $xml->endDocument();
114
+
115
+ $this->getController()->getResponse()
116
+ ->clearHeaders()
117
+ ->setHeader('Content-Type','text/xml; charset='.$apiConfigCharset)
118
+ ->setBody($xml->outputMemory(true));
119
+ break;
120
+ case 'shipnotify':
121
+ // Raw XML is POSTed to this stream
122
+ $xml = simplexml_load_file('php://input');
123
+
124
+ // load some objects
125
+ $order = $this->_getOrder($xml->OrderNumber);
126
+ $carrier = $this->_getCarrier(@$xml->Carrier);
127
+ $qtys = $this->_getOrderItemQtys(@$xml->Items, $order);
128
+ $shipment = $this->_getOrderShipment($order, $qtys);
129
+
130
+ // this is where tracking is actually added
131
+ $track = Mage::getModel('sales/order_shipment_track')
132
+ ->setNumber($xml->TrackingNumber)
133
+ ->setCarrierCode($xml->Carrier)
134
+ ->setTitle($xml->Service);
135
+ $shipment->addTrack($track);
136
+
137
+ // Internal notes are only visible to admin
138
+ if (@$xml->InternalNotes) {
139
+ $shipment->addComment($xml->InternalNotes);
140
+ }
141
+ // Customer notes have 'Visible On Frontend' set
142
+ // 'NotifyCustomer' must be "true" or "yes" to trigger an email
143
+ if (@$xml->NotesToCustomer) {
144
+ $notify = filter_var(@$xml->NotifyCustomer, FILTER_VALIDATE_BOOLEAN);
145
+ if ($notify) {
146
+ $shipment
147
+ ->sendEmail(true, $xml->NotesToCustomer)
148
+ ->setEmailSent(true);
149
+ }
150
+ $shipment->addComment($xml->NotesToCustomer, $notify, true);
151
+ }
152
+
153
+ Mage::getModel('core/resource_transaction')
154
+ ->addObject($shipment)
155
+ ->addObject($track)
156
+ ->save();
157
+ // if there hasn't been an error yet the work is done and a "200 OK" is given
158
+ break;
159
+ }}
160
+ catch (Exception $e) {
161
+ $this->fault($e->getCode(), $e->getMessage());
162
+ }
163
+
164
+ return $this;
165
+ }
166
+
167
+ /**
168
+ * Dispatch webservice fault
169
+ *
170
+ * @param int $code
171
+ * @param string $message
172
+ */
173
+ public function fault($code, $message)
174
+ {
175
+ if (is_numeric($code) && strlen((int) $code) === 3) {
176
+ header(sprintf('%s %03d Fault', $_SERVER['SERVER_PROTOCOL'], $code));
177
+ }
178
+ header('Content-Type: text/xml; charset=UTF-8');
179
+ die('<?xml version="1.0" encoding="UTF-8"?>
180
+ <fault>
181
+ <faultcode>' . $code . '</faultcode>
182
+ <faultstring>' . $message . '</faultstring>
183
+ </fault>
184
+ ');
185
+ }
186
+
187
+ protected function _writeOrders(Varien_Data_Collection $orders, XMLWriter $xml, $storeId = null)
188
+ {
189
+ $xml->startElement('Orders');
190
+ foreach ($orders as $order) {
191
+ $this->_writeOrder($order, $xml, $storeId);
192
+ }
193
+ $xml->endElement(); // Orders
194
+ }
195
+
196
+ protected function _writeOrder(Mage_Sales_Model_Order $order, XMLWriter $xml, $storeId = null)
197
+ {
198
+ $history = '';
199
+ /* @var $status Mage_Sales_Model_Order_Status */
200
+ foreach ($order->getStatusHistoryCollection() as $status) {
201
+ if ($status->getComment()) {
202
+ $history .= $status->getCreatedAt() . PHP_EOL;
203
+ $history .= $status->getComment() . PHP_EOL . PHP_EOL;
204
+ }
205
+ }
206
+ $history = trim($history);
207
+ if ($history) {
208
+ $order->setStatusHistoryText($history);
209
+ }
210
+
211
+ /* @var $gift Mage_GiftMessage_Model_Message */
212
+ $gift = Mage::helper('giftmessage/message')->getGiftMessage($order->getGiftMessageId());
213
+ $order->setGift($gift->isObjectNew() ? 'false' : 'true');
214
+ if (!$gift->isObjectNew()) {
215
+ $order->setGiftMessage(sprintf("From: %s\nTo: %s\nMessage: %s",
216
+ $gift->getSender(), $gift->getRecipient(), $gift->getMessage()));
217
+ }
218
+
219
+ $helper = Mage::helper('auctaneapi');
220
+
221
+ $xml->startElement('Order');
222
+ $helper->fieldsetToXml('sales_order', $order, $xml);
223
+
224
+ $xml->startElement('Customer');
225
+ $xml->writeElement('CustomerCode', $order->getCustomerEmail());
226
+
227
+ $xml->startElement('BillTo');
228
+ $helper->fieldsetToXml('sales_order_billing_address',
229
+ $order->getBillingAddress(), $xml);
230
+ $xml->endElement(); // BillTo
231
+
232
+ $xml->startElement('ShipTo');
233
+ $helper->fieldsetToXml('sales_order_shipping_address',
234
+ $order->getShippingAddress(), $xml);
235
+ $xml->endElement(); // ShipTo
236
+
237
+ $xml->endElement(); // Customer
238
+
239
+ $xml->startElement('Items');
240
+ /* @var $item Mage_Sales_Model_Order_Item */
241
+ foreach ($order->getItemsCollection($helper->getIncludedProductTypes()) as $item) {
242
+ $this->_writeOrderItem($item, $xml, $storeId);
243
+ }
244
+ $xml->endElement(); // Items
245
+
246
+ $xml->endElement(); // Order
247
+ }
248
+
249
+ protected function _writeOrderItem(Mage_Sales_Model_Order_Item $item, XMLWriter $xml, $storeId = null)
250
+ {
251
+ // inherit some attributes from parent order item
252
+ if ($item->getParentItemId() && !$item->getParentItem()) {
253
+ $item->setParentItem(Mage::getModel('sales/order_item')->load($item->getParentItemId()));
254
+ }
255
+ // only inherit if parent has been hidden
256
+ if ($item->getParentItem() && ($item->getPrice() == 0.000)
257
+ && (Mage::helper('auctaneapi')->isExcludedProductType($item->getParentItem()->getProductType())))
258
+ {
259
+ $item->setPrice($item->getParentItem()->getPrice());
260
+ }
261
+
262
+ /* @var $gift Mage_GiftMessage_Model_Message */
263
+ $gift = Mage::helper('giftmessage/message')->getGiftMessage(
264
+ !$item->getGiftMessageId() && $item->getParentItem()
265
+ ? $item->getParentItem()->getGiftMessageId()
266
+ : $item->getGiftMessageId());
267
+ $item->setGift($gift->isObjectNew() ? 'false' : 'true');
268
+ if (!$gift->isObjectNew()) {
269
+ $item->setGiftMessage(sprintf("From: %s\nTo: %s\nMessage: %s",
270
+ $gift->getSender(), $gift->getRecipient(), $gift->getMessage()));
271
+ }
272
+
273
+ /* @var $product Mage_Catalog_Model_Product */
274
+ $product = Mage::getModel('catalog/product')
275
+ ->setStoreId($storeId)
276
+ ->load($item->getProductId());
277
+ // inherit some attributes from parent product item
278
+ if (($parentProduct = $this->_getOrderItemParentProduct($item, $storeId))) {
279
+ if (!$product->getImage() || ($product->getImage() == 'no_selection'))
280
+ $product->setImage($parentProduct->getImage());
281
+ if (!$product->getSmallImage() || ($product->getSmallImage() == 'no_selection'))
282
+ $product->setSmallImage($parentProduct->getSmallImage());
283
+ if (!$product->getThumbnail() || ($product->getThumbnail() == 'no_selection'))
284
+ $product->setThumbnail($parentProduct->getThumbnail());
285
+ }
286
+
287
+ $xml->startElement('Item');
288
+ Mage::helper('auctaneapi')->fieldsetToXml('sales_order_item', $item, $xml);
289
+ Mage::helper('auctaneapi')->fieldsetToXml('sales_order_item_product',
290
+ $product, $xml);
291
+
292
+ $xml->startElement('Options');
293
+ $this->_writeOrderProductAttribute($product, $xml, $storeId);
294
+ // items may have several custom options chosen by customer
295
+ foreach ((array) $item->getProductOptionByCode('options') as $option) {
296
+ $this->_writeOrderItemOption($option, $xml, $storeId);
297
+ }
298
+ $xml->endElement(); // Options
299
+
300
+ $xml->endElement(); // Item
301
+ }
302
+
303
+ protected function _writeOrderProductAttribute(Mage_Catalog_Model_Product $product, XMLWriter $xml, $storeId = null)
304
+ {
305
+ // custom attributes are specified in Admin > Configuration > Sales > Auctane Shipstation API
306
+ // static because attributes can be cached, they do not change during a request
307
+ static $attrs = null;
308
+ if (is_null($attrs)) {
309
+ $attrs = Mage::getResourceModel('eav/entity_attribute_collection');
310
+ $attrIds = explode(',', Mage::getStoreConfig('sales/auctaneapi/customattributes', $storeId));
311
+ $attrs->addFieldToFilter('attribute_id', $attrIds);
312
+ }
313
+
314
+ /* @var $attr Mage_Eav_Model_Entity_Attribute */
315
+ foreach ($attrs as $attr) {
316
+ if ($product->hasData($attr->getName())) {
317
+ // if an attribute has options/labels
318
+ if (in_array($attr->getFrontendInput(), array('select', 'multiselect'))) {
319
+ $value = $product->getAttributeText($attr->getName());
320
+ if (is_array($value)) $value = implode(',', $value);
321
+ }
322
+ // else is a static value
323
+ else {
324
+ $value = $product->getDataUsingMethod($attr->getName());
325
+ }
326
+ // fake an item option
327
+ $option = array(
328
+ 'value' => $value,
329
+ 'label' => $attr->getFrontendLabel()
330
+ );
331
+ $this->_writeOrderItemOption($option, $xml, $storeId);
332
+ }
333
+ }
334
+ }
335
+
336
+ protected function _writeOrderItemOption($option, XMLWriter $xml)
337
+ {
338
+ $xml->startElement('Option');
339
+ Mage::helper('auctaneapi')->fieldsetToXml('sales_order_item_option', $option, $xml);
340
+ $xml->endElement(); // Option
341
+ }
342
+
343
+ /**
344
+ * @param string $carrierCode
345
+ * @return Mage_Shipping_Model_Carrier_Interface
346
+ */
347
+ protected function _getCarrier($carrierCode)
348
+ {
349
+ $carrierCode = strtolower($carrierCode);
350
+ $carrierModel = Mage::getStoreConfig("carriers/{$carrierCode}/model");
351
+ if (!$carrierModel) throw new Exception('Invalid carrier specified.', 400);
352
+ /* @var $carrier Mage_Shipping_Model_Carrier_Interface */
353
+ $carrier = Mage::getModel($carrierModel);
354
+ if (!$carrier) throw new Exception('Invalid carrier specified.', 400);
355
+ if (!$carrier->isTrackingAvailable()) throw new Exception('Carrier does not supported tracking.', 400);
356
+ return $carrier;
357
+ }
358
+
359
+ /**
360
+ * @param string $orderIncrementId
361
+ * @return Mage_Sales_Model_Order
362
+ */
363
+ protected function _getOrder($orderIncrementId)
364
+ {
365
+ $order = Mage::getModel('sales/order')->loadByIncrementId($orderIncrementId);
366
+ if ($order->isObjectNew()) throw new Exception("Order '{$orderIncrementId}' does not exist", 400);
367
+ return $order;
368
+ }
369
+
370
+ protected function _getOrderItemQtys(SimpleXMLElement $xmlItems, Mage_Sales_Model_Order $order)
371
+ {
372
+ /* @var $items Mage_Sales_Model_Mysql4_Order_Item_Collection */
373
+ $items = $order->getItemsCollection();
374
+ $qtys = array();
375
+ /* @var $item Mage_Sales_Model_Order_Item */
376
+ foreach ($items as $item) {
377
+ // search for item by SKU
378
+ @list($xmlItem) = $xmlItems->xpath(sprintf('//Item/SKU[text()="%s"]/..',
379
+ addslashes($item->getSku())));
380
+ if ($xmlItem) {
381
+ // store quantity by order item ID, not by SKU
382
+ $qtys[$item->getId()] = (float) $xmlItem->Quantity;
383
+ }
384
+ }
385
+ return $qtys;
386
+ }
387
+
388
+ /**
389
+ * @param Mage_Sales_Model_Order_Item $item
390
+ * @param mixed $storeId
391
+ * @return Mage_Catalog_Model_Product
392
+ */
393
+ protected function _getOrderItemParentProduct(Mage_Sales_Model_Order_Item $item, $storeId = null)
394
+ {
395
+ if ($item->getParentItemId()) {
396
+ // cannot use getParentItem() because we stripped parents from the order
397
+ $parentItem = Mage::getModel('sales/order_item')
398
+ ->load($item->getParentItemId());
399
+ // initialise with store so that images are correct
400
+ return Mage::getModel('catalog/product')
401
+ ->setStoreId($storeId)
402
+ ->load($parentItem->getProductId());
403
+ }
404
+ return null;
405
+ }
406
+
407
+ /**
408
+ * @param Mage_Sales_ModelOrder $order
409
+ * @param array $qtys
410
+ * @return Mage_Sales_Model_Order_Shipment
411
+ */
412
+ protected function _getOrderShipment(Mage_Sales_Model_Order $order, $qtys)
413
+ {
414
+ /* @var $shipments Mage_Sales_Model_Mysql4_Order_Shipment_Collection */
415
+ $shipments = $order->getShipmentsCollection();
416
+ /* @var $shipment Mage_Sales_Model_Order_Shipment */
417
+ if (($shipments === false) || ($shipments->count() === 0)) {
418
+ // order has no shipments yet, create one
419
+ $shipment = $order->prepareShipment($qtys);
420
+ $shipment->register();
421
+ $order->setIsInProgress(true);
422
+ // shipment must have an ID before proceeding
423
+ Mage::getModel('core/resource_transaction')
424
+ ->addObject($shipment)
425
+ ->addObject($order)
426
+ ->save();
427
+ }
428
+ else {
429
+ // probably only one shipment for all items, assume the last is most recent
430
+ $shipment = $shipments->getLastItem();
431
+ }
432
+ return $shipment;
433
+ }
434
+
435
+ }
app/code/community/Auctane/Api/Model/System/Source/Config/Customattributes.php ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * ShipStation
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@auctane.com so we can send you a copy immediately.
14
+ *
15
+ * @category Shipping
16
+ * @package Auctane_Api
17
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
18
+ */
19
+
20
+ class Auctane_Api_Model_System_Source_Config_Customattributes
21
+ {
22
+
23
+ public function toOptionArray()
24
+ {
25
+ $type = Mage::getModel('eav/entity_type');
26
+ $type->loadByCode('catalog_product');
27
+
28
+ $attrs = Mage::getResourceModel('eav/entity_attribute_collection');
29
+ $attrs->setEntityTypeFilter($type);
30
+ $attrs->addFieldToFilter('is_user_defined', true);
31
+
32
+ $array = array();
33
+ /* @var $attr Mage_Eav_Model_Entity_Attribute */
34
+ foreach ($attrs as $id => $attr) {
35
+ $array[$id] = array(
36
+ 'value' => $attr->getId(),
37
+ 'label' => $attr->getFrontendLabel()
38
+ );
39
+ }
40
+ return $array;
41
+ }
42
+
43
+ }
app/code/community/Auctane/Api/controllers/AuctaneController.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * ShipStation
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@auctane.com so we can send you a copy immediately.
14
+ *
15
+ * @category Shipping
16
+ * @package Auctane_Api
17
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
18
+ */
19
+
20
+ class Auctane_Api_AuctaneController extends Mage_Api_Controller_Action
21
+ {
22
+ public function indexAction()
23
+ {
24
+ $this->_getServer()->init($this, 'auctane')
25
+ ->run();
26
+ }
27
+ }
app/code/community/Auctane/Api/etc/api.xml ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!--
3
+ * ShipStation
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@auctane.com so we can send you a copy immediately.
14
+ *
15
+ * @category Shipping
16
+ * @package Auctane_Api
17
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
18
+ -->
19
+ <config>
20
+ <api>
21
+ <adapters>
22
+ <auctane>
23
+ <model>auctaneapi/server_adapter</model>
24
+ <handler>default</handler>
25
+ <active>1</active>
26
+ </auctane>
27
+ </adapters>
28
+ </api>
29
+ </config>
app/code/community/Auctane/Api/etc/config.xml ADDED
@@ -0,0 +1,159 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
+ <!--
3
+ * ShipStation
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@auctane.com so we can send you a copy immediately.
14
+ *
15
+ * @category Shipping
16
+ * @package Auctane_Api
17
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
18
+ -->
19
+ <config>
20
+ <modules>
21
+ <Auctane_Api>
22
+ <version>0.2.0</version>
23
+ </Auctane_Api>
24
+ </modules>
25
+
26
+ <global>
27
+ <helpers>
28
+ <auctaneapi>
29
+ <class>Auctane_Api_Helper</class>
30
+ </auctaneapi>
31
+ </helpers>
32
+ <models>
33
+ <auctaneapi>
34
+ <class>Auctane_Api_Model</class>
35
+ <resourceModel>auctaneapi_mysql4</resourceModel>
36
+ </auctaneapi>
37
+ <auctaneapi_mysql4>
38
+ <class>Auctane_Api_Model_Mysql4</class>
39
+ </auctaneapi_mysql4>
40
+ </models>
41
+ <resources>
42
+ <!-- Adapters don't need to be specified in modern versions of Magento, but included here for compatibility -->
43
+ <auctaneapi_write>
44
+ <connection><use>core_write</use></connection>
45
+ </auctaneapi_write>
46
+ <auctaneapi_read>
47
+ <connection><use>core_read</use></connection>
48
+ </auctaneapi_read>
49
+ </resources>
50
+
51
+ <fieldsets>
52
+ <sales_order>
53
+ <increment_id><auctaneapi>OrderNumber</auctaneapi></increment_id>
54
+ <created_at><auctaneapi>OrderDate</auctaneapi></created_at>
55
+ <status><auctaneapi>OrderStatus</auctaneapi></status>
56
+ <updated_at><auctaneapi>LastModified</auctaneapi></updated_at>
57
+ <shipping_description><auctaneapi>ShippingMethod</auctaneapi></shipping_description>
58
+ <grand_total><auctaneapi>OrderTotal</auctaneapi></grand_total>
59
+ <tax_amount><auctaneapi>TaxAmount</auctaneapi></tax_amount>
60
+ <shipping_amount><auctaneapi>ShippingAmount</auctaneapi></shipping_amount>
61
+ <!-- status_history_text & gift_message are provided by Auctane, it is not standard Magento -->
62
+ <status_history_text><auctaneapi>InternalNotes</auctaneapi></status_history_text>
63
+ <gift_message><auctaneapi>GiftMessage</auctaneapi></gift_message>
64
+ <!-- Change "gift" to "gift_message_available" to show when customer had the choice, even if they did not enter a message. -->
65
+ <gift><auctaneapi>Gift</auctaneapi></gift>
66
+ </sales_order>
67
+ <sales_order_billing_address>
68
+ <name><auctaneapi>Name</auctaneapi></name>
69
+ <company><auctaneapi>Company</auctaneapi></company>
70
+ <telephone><auctaneapi>Phone</auctaneapi></telephone>
71
+ <email><auctaneapi>Email</auctaneapi></email>
72
+ </sales_order_billing_address>
73
+ <sales_order_shipping_address>
74
+ <name><auctaneapi>Name</auctaneapi></name>
75
+ <company><auctaneapi>Company</auctaneapi></company>
76
+ <telephone><auctaneapi>Phone</auctaneapi></telephone>
77
+ <street1><auctaneapi>Address1</auctaneapi></street1>
78
+ <street2><auctaneapi>Address2</auctaneapi></street2>
79
+ <city><auctaneapi>City</auctaneapi></city>
80
+ <region_code><auctaneapi>State</auctaneapi></region_code>
81
+ <postcode><auctaneapi>PostalCode</auctaneapi></postcode>
82
+ <country_id><auctaneapi>Country</auctaneapi></country_id>
83
+ <telephone><auctaneapi>Phone</auctaneapi></telephone>
84
+ </sales_order_shipping_address>
85
+ <sales_order_item>
86
+ <sku><auctaneapi>SKU</auctaneapi></sku>
87
+ <name><auctaneapi>Name</auctaneapi></name>
88
+ <weight><auctaneapi>Weight</auctaneapi></weight>
89
+ <qty_ordered><auctaneapi>Quantity</auctaneapi></qty_ordered>
90
+ <price><auctaneapi>UnitPrice</auctaneapi></price>
91
+ <!-- gift_message is provided by Auctane, it is not standard Magento -->
92
+ <gift><auctaneapi>Gift</auctaneapi></gift>
93
+ <gift_message><auctaneapi>GiftMessage</auctaneapi></gift_message>
94
+ </sales_order_item>
95
+ <sales_order_item_product>
96
+ <!-- Any product attributes listed here will be output as order item fields -->
97
+ <!-- Note: Product attributes may change after an order is placed -->
98
+
99
+ <!-- image_url is a built in function, can also be small_image_url or thumbnail_url -->
100
+ <image_url><auctaneapi>ImageUrl</auctaneapi></image_url>
101
+ <!-- There are many product functions that can be used here such as:
102
+ category_id, category_ids, website_ids, formatted_price, url_path -->
103
+ </sales_order_item_product>
104
+ <sales_order_item_option>
105
+ <label><auctaneapi>Name</auctaneapi></label>
106
+ <value><auctaneapi>Value</auctaneapi></value>
107
+ </sales_order_item_option>
108
+ </fieldsets>
109
+
110
+ <catalog>
111
+ <product>
112
+ <type>
113
+ <!-- Specify any product types here to exclude them from export -->
114
+ <configurable>
115
+ <auctane_exclude>1</auctane_exclude>
116
+ </configurable>
117
+ </type>
118
+ </product>
119
+ </catalog>
120
+
121
+ <!-- The following node is only necessary for versions of Magento older than 1.3
122
+ <rewrite>
123
+ <auctaneapi>
124
+ <from><![CDATA[#^api/auctane/#]]></from>
125
+ <to>auctaneapi/auctane/</to>
126
+ </auctaneapi>
127
+ </rewrite>
128
+ -->
129
+ </global>
130
+
131
+ <frontend>
132
+ <routers>
133
+ <!-- The following node is only necessary for versions of Magento older than 1.3
134
+ <auctaneapi>
135
+ <use>standard</use>
136
+ <args>
137
+ <module>Auctane_Api</module>
138
+ <frontName>auctanceapi</frontName>
139
+ </args>
140
+ </auctaneapi>
141
+ -->
142
+ <api>
143
+ <args>
144
+ <modules>
145
+ <auctaneapi before="Mage_Api">Auctane_Api</auctaneapi>
146
+ </modules>
147
+ </args>
148
+ </api>
149
+ </routers>
150
+ </frontend>
151
+
152
+ <default>
153
+ <auctaneapi>
154
+ <config>
155
+ <realm>Auctane ShipStation</realm>
156
+ </config>
157
+ </auctaneapi>
158
+ </default>
159
+ </config>
app/code/community/Auctane/Api/etc/system.xml ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
+ <!--
3
+ * ShipStation
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@auctane.com so we can send you a copy immediately.
14
+ *
15
+ * @category Shipping
16
+ * @package Auctane_Api
17
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
18
+ -->
19
+ <config>
20
+ <sections>
21
+ <sales>
22
+ <groups>
23
+ <auctaneapi translate="label" module="auctaneapi">
24
+ <label>Auctane Shipstation API</label>
25
+ <show_in_default>1</show_in_default>
26
+ <show_in_website>1</show_in_website>
27
+ <show_in_store>1</show_in_store>
28
+ <fields>
29
+ <customattributes translate="label">
30
+ <label>Export custom attributes as custom options</label>
31
+ <frontend_type>multiselect</frontend_type>
32
+ <source_model>auctaneapi/system_source_config_customattributes</source_model>
33
+ <show_in_default>1</show_in_default>
34
+ <show_in_website>1</show_in_website>
35
+ <show_in_store>1</show_in_store>
36
+ </customattributes>
37
+ </fields>
38
+ </auctaneapi>
39
+ </groups>
40
+ </sales>
41
+ </sections>
42
+ </config>
app/code/community/Auctane/ShipStation/Block/Adminhtml/Linkup.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * ShipStation
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@auctane.com so we can send you a copy immediately.
14
+ *
15
+ * @category Shipping
16
+ * @package Auctane_ShipStation
17
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
18
+ */
19
+
20
+ class Auctane_ShipStation_Block_Adminhtml_Linkup extends Mage_Adminhtml_Block_Widget_Form_Container
21
+ {
22
+
23
+ protected $_blockGroup = 'auctaneshipstation';
24
+ protected $_controller = 'adminhtml';
25
+ protected $_mode = 'linkup';
26
+
27
+ public function __construct()
28
+ {
29
+ parent::__construct();
30
+ $this->updateButton('save', 'label', $this->__('Link up with ShipStation'));
31
+ }
32
+
33
+ }
app/code/community/Auctane/ShipStation/Block/Adminhtml/Linkup/Form.php ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * ShipStation
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@auctane.com so we can send you a copy immediately.
14
+ *
15
+ * @category Shipping
16
+ * @package Auctane_ShipStation
17
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
18
+ */
19
+
20
+ class Auctane_ShipStation_Block_Adminhtml_Linkup_Form extends Mage_Adminhtml_Block_Widget_Form
21
+ {
22
+
23
+ protected function _prepareForm()
24
+ {
25
+ $stores = Mage::getSingleton('adminhtml/system_config_source_store')->toOptionArray();
26
+
27
+ $form = new Varien_Data_Form(array(
28
+ 'id' => 'edit_form',
29
+ 'action'=> $this->getUrl('*/shipstation/linkup'),
30
+ 'method'=> 'post'
31
+ ));
32
+ if (count($stores) > 1) {
33
+ $form->addField('store_id', 'select', array(
34
+ 'name' => 'store_id',
35
+ 'label' => $this->__('Store View:'),
36
+ 'values' => $stores
37
+ ));
38
+ }
39
+ $form->addField('request_username', 'text', array(
40
+ 'name' => 'request_username',
41
+ 'label' => $this->__('ShipStation Username:')
42
+ ));
43
+ $form->addField('request_password', 'password', array(
44
+ 'name' => 'request_password',
45
+ 'label' => $this->__('Password:')
46
+ ));
47
+ if (($id = $this->getRequest()->getParam('id'))) {
48
+ $form->setValues(Mage::getModel('auctaneshipstation/user')->load($id)->getData());
49
+ }
50
+ $form->setUseContainer(true);
51
+
52
+ $this->setForm($form);
53
+ return parent::_prepareForm();
54
+ }
55
+
56
+ }
app/code/community/Auctane/ShipStation/Block/Adminhtml/Pending.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * ShipStation
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@auctane.com so we can send you a copy immediately.
14
+ *
15
+ * @category Shipping
16
+ * @package Auctane_ShipStation
17
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
18
+ */
19
+
20
+ class Auctane_ShipStation_Block_Adminhtml_Pending extends Mage_Adminhtml_Block_Template
21
+ {
22
+
23
+ protected function _construct()
24
+ {
25
+ parent::_construct();
26
+
27
+ $this->setOrders(
28
+ Mage::getResourceModel('sales/order_collection')
29
+ ->addAttributeToSelect("*")
30
+ ->addAttributeToFilter('status', array('processing','pending'))
31
+ );
32
+
33
+ return $this;
34
+ }
35
+
36
+ }
app/code/community/Auctane/ShipStation/Helper/Data.php ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Auctane_ShipStation_Helper_Data extends Mage_Core_Helper_Data
4
+ {
5
+
6
+ /**
7
+ * Get current admin from session
8
+ *
9
+ * @return Mage_Admin_Model_User
10
+ */
11
+ public function getAdminUser()
12
+ {
13
+ $session = Mage::getSingleton('admin/session');
14
+ if (!$session->isLoggedIn()) {
15
+ return false;
16
+ }
17
+
18
+ return $session->getUser();
19
+ }
20
+
21
+ /**
22
+ * Get ShipStation user object from current admin session
23
+ *
24
+ * @param Mage_Admin_Model_User $admin
25
+ * @return Auctane_ShipStation_Model_User
26
+ */
27
+ public function getUser($admin = null)
28
+ {
29
+ if (!$admin) $admin = $this->getAdminUser();
30
+ return Mage::getModel('auctaneshipstation/user')->load($admin);
31
+ }
32
+
33
+ public function setupRequired()
34
+ {
35
+ $admin = $this->getAdminUser();
36
+ if (!$admin) return false;
37
+
38
+ $user = $this->getUser($admin);
39
+
40
+ return $user->isObjectNew() || !$user->hasAuthToken() || !$user->hasAuthUrl();
41
+ }
42
+
43
+ public function getStoreDomain($storeId)
44
+ {
45
+ $url = Mage::getStoreConfig('web/unsecure/base_url', $storeId);
46
+ return preg_replace('/^https?:\/\/([[:alnum:]\.]+).*/', '\\1', $url);
47
+ }
48
+
49
+ }
app/code/community/Auctane/ShipStation/LICENSE.html ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <h4>Open Software License ("OSL") v. 3.0</h4>
2
+
3
+ <p>This Open Software License (the "License") applies to any original work of authorship (the "Original Work") whose owner (the "Licensor") has placed the following licensing notice adjacent to the copyright notice for the Original Work:</p>
4
+ <h5>Licensed under the Open Software License version 3.0</h5>
5
+ <p>Grant of Copyright License. Licensor grants You a worldwide, royalty-free, non-exclusive, sublicensable license, for the duration of the copyright, to do the following:</p>
6
+ <ul class="disc">
7
+ <li>to reproduce the Original Work in copies, either alone or as part of a collective work</li>
8
+ <li>to translate, adapt, alter, transform, modify, or arrange the Original Work, thereby creating derivative works ("Derivative Works") based upon the Original Work</li>
9
+ <li>to distribute or communicate copies of the Original Work and Derivative Works to the public, with the proviso that copies of Original Work or Derivative Works that You distribute or communicate shall be licensed under this Open Software License</li>
10
+ <li>to perform the Original Work publicly</li>
11
+ <li>to display the Original Work publicly</li>
12
+ </ul>
13
+
14
+ <p><strong>Grant of Patent License.</strong> Licensor grants You a worldwide, royalty-free, non-exclusive, sublicensable license, under patent claims owned or controlled by the Licensor that are embodied in the Original Work as furnished by the Licensor, for the duration of the patents, to make, use, sell, offer for sale, have made, and import the Original Work and Derivative Works.</p>
15
+
16
+ <p><strong>Grant of Source Code License.</strong> The term "Source Code" means the preferred form of the Original Work for making modifications to it and all available documentation describing how to modify the Original Work. Licensor agrees to provide a machine-readable copy of the Source Code of the Original Work along with each copy of the Original Work that Licensor distributes. Licensor reserves the right to satisfy this obligation by placing a machine-readable copy of the Source Code in an information repository reasonably calculated to permit inexpensive and convenient access by You for as long as Licensor continues to distribute the Original Work.</p>
17
+
18
+ <p><strong>Exclusions From License Grant.</strong> Neither the names of Licensor, nor the names of any contributors to the Original Work, nor any of their trademarks or service marks, may be used to endorse or promote products derived from this Original Work without express prior permission of the Licensor. Except as expressly stated herein, nothing in this License grants any license to Licensor's trademarks, copyrights, patents, trade secrets or any other intellectual property. No patent license is granted to make, use, sell, offer for sale, have made, or import embodiments of any patent claims other than the licensed claims defined in Section 2. No license is granted to the trademarks of Licensor even if such marks are included in the Original Work. Nothing in this License shall be interpreted to prohibit Licensor from licensing under terms different from this License any Original Work that Licensor otherwise would have a right to license.</p>
19
+
20
+ <p><strong>External Deployment.</strong> The term "External Deployment" means the use, distribution, or communication of the Original Work or Derivative Works in any way such that the Original Work or Derivative Works may be used by anyone other than You, whether those works are distributed or communicated to those persons or made available as an application intended for use over a network. As an express condition for the grants of license hereunder, You must treat any External Deployment by You of the Original Work or a Derivative Work as a distribution under section 1(c).</p>
21
+
22
+ <p><strong>Attribution Rights.</strong> You must retain, in the Source Code of any Derivative Works that You create, all copyright, patent, or trademark notices from the Source Code of the Original Work, as well as any notices of licensing and any descriptive text identified therein as an "Attribution Notice." You must cause the Source Code for any Derivative Works that You create to carry a prominent Attribution Notice reasonably calculated to inform recipients that You have modified the Original Work.</p>
23
+
24
+ <p><strong>Warranty of Provenance and Disclaimer of Warranty.</strong> Licensor warrants that the copyright in and to the Original Work and the patent rights granted herein by Licensor are owned by the Licensor or are sublicensed to You under the terms of this License with the permission of the contributor(s) of those copyrights and patent rights. Except as expressly stated in the immediately preceding sentence, the Original Work is provided under this License on an "AS IS" BASIS and WITHOUT WARRANTY, either express or implied, including, without limitation, the warranties of non-infringement, merchantability or fitness for a particular purpose. THE ENTIRE RISK AS TO THE QUALITY OF THE ORIGINAL WORK IS WITH YOU. This DISCLAIMER OF WARRANTY constitutes an essential part of this License. No license to the Original Work is granted by this License except under this disclaimer.</p>
25
+
26
+ <p><strong>Limitation of Liability.</strong> Under no circumstances and under no legal theory, whether in tort (including negligence), contract, or otherwise, shall the Licensor be liable to anyone for any indirect, special, incidental, or consequential damages of any character arising as a result of this License or the use of the Original Work including, without limitation, damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses. This limitation of liability shall not apply to the extent applicable law prohibits such limitation.</p>
27
+
28
+ <p><strong>Acceptance and Termination.</strong> If, at any time, You expressly assented to this License, that assent indicates your clear and irrevocable acceptance of this License and all of its terms and conditions. If You distribute or communicate copies of the Original Work or a Derivative Work, You must make a reasonable effort under the circumstances to obtain the express assent of recipients to the terms of this License. This License conditions your rights to undertake the activities listed in Section 1, including your right to create Derivative Works based upon the Original Work, and doing so without honoring these terms and conditions is prohibited by copyright law and international treaty. Nothing in this License is intended to affect copyright exceptions and limitations (including 'fair use' or 'fair dealing'). This License shall terminate immediately and You may no longer exercise any of the rights granted to You by this License upon your failure to honor the conditions in Section 1(c).</p>
29
+
30
+ <p><strong>Termination for Patent Action.</strong> This License shall terminate automatically and You may no longer exercise any of the rights granted to You by this License as of the date You commence an action, including a cross-claim or counterclaim, against Licensor or any licensee alleging that the Original Work infringes a patent. This termination provision shall not apply for an action alleging patent infringement by combinations of the Original Work with other software or hardware.</p>
31
+
32
+ <p><strong>Jurisdiction, Venue and Governing Law.</strong> Any action or suit relating to this License may be brought only in the courts of a jurisdiction wherein the Licensor resides or in which Licensor conducts its primary business, and under the laws of that jurisdiction excluding its conflict-of-law provisions. The application of the United Nations Convention on Contracts for the International Sale of Goods is expressly excluded. Any use of the Original Work outside the scope of this License or after its termination shall be subject to the requirements and penalties of copyright or patent law in the appropriate jurisdiction. This section shall survive the termination of this License.</p>
33
+
34
+ <p><strong>Attorneys Fees.</strong> In any action to enforce the terms of this License or seeking damages relating thereto, the prevailing party shall be entitled to recover its costs and expenses, including, without limitation, reasonable attorneys' fees and costs incurred in connection with such action, including any appeal of such action. This section shall survive the termination of this License.</p>
35
+
36
+ <p><strong>Miscellaneous.</strong> If any provision of this License is held to be unenforceable, such provision shall be reformed only to the extent necessary to make it enforceable.</p>
37
+
38
+ <p><strong>Definition of "You" in This License.</strong> "You" throughout this License, whether in upper or lower case, means an individual or a legal entity exercising rights under, and complying with all of the terms of, this License. For legal entities, "You" includes any entity that controls, is controlled by, or is under common control with you. For purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.</p>
39
+
40
+ <p><strong>Right to Use.</strong> You may use the Original Work in all ways not otherwise restricted or conditioned by this License or by law, and Licensor promises not to interfere with or be responsible for such uses by You.</p>
41
+
42
+ <p><strong>Modification of This License.</strong> This License is Copyright &copy; 2005 Lawrence Rosen. Permission is granted to copy, distribute, or communicate this License without modification. Nothing in this License permits You to modify this License as applied to the Original Work or to Derivative Works. However, You may modify the text of this License and copy, distribute or communicate your modified version (the "Modified License") and apply it to other original works of authorship subject to the following conditions: (i) You may not indicate in any way that your Modified License is the "Open Software License" or "OSL" and you may not use those names in the name of your Modified License; (ii) You must replace the notice specified in the first paragraph above with the notice "Licensed under Open Software License ("OSL") v. 3.0" or with a notice of your own that is not confusingly similar to the notice in this License; and (iii) You may not claim that your original works are open source software unless your Modified License has been approved by Open Source Initiative (OSI) and You comply with its license review and certification process.</p>
app/code/community/Auctane/ShipStation/LICENSE.txt ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ Open Software License ("OSL") v. 3.0
3
+
4
+ This Open Software License (the "License") applies to any original work of authorship (the "Original Work") whose owner (the "Licensor") has placed the following licensing notice adjacent to the copyright notice for the Original Work:
5
+
6
+ Licensed under the Open Software License version 3.0
7
+
8
+ 1. Grant of Copyright License. Licensor grants You a worldwide, royalty-free, non-exclusive, sublicensable license, for the duration of the copyright, to do the following:
9
+
10
+ 1. to reproduce the Original Work in copies, either alone or as part of a collective work;
11
+
12
+ 2. to translate, adapt, alter, transform, modify, or arrange the Original Work, thereby creating derivative works ("Derivative Works") based upon the Original Work;
13
+
14
+ 3. to distribute or communicate copies of the Original Work and Derivative Works to the public, with the proviso that copies of Original Work or Derivative Works that You distribute or communicate shall be licensed under this Open Software License;
15
+
16
+ 4. to perform the Original Work publicly; and
17
+
18
+ 5. to display the Original Work publicly.
19
+
20
+ 2. Grant of Patent License. Licensor grants You a worldwide, royalty-free, non-exclusive, sublicensable license, under patent claims owned or controlled by the Licensor that are embodied in the Original Work as furnished by the Licensor, for the duration of the patents, to make, use, sell, offer for sale, have made, and import the Original Work and Derivative Works.
21
+
22
+ 3. Grant of Source Code License. The term "Source Code" means the preferred form of the Original Work for making modifications to it and all available documentation describing how to modify the Original Work. Licensor agrees to provide a machine-readable copy of the Source Code of the Original Work along with each copy of the Original Work that Licensor distributes. Licensor reserves the right to satisfy this obligation by placing a machine-readable copy of the Source Code in an information repository reasonably calculated to permit inexpensive and convenient access by You for as long as Licensor continues to distribute the Original Work.
23
+
24
+ 4. Exclusions From License Grant. Neither the names of Licensor, nor the names of any contributors to the Original Work, nor any of their trademarks or service marks, may be used to endorse or promote products derived from this Original Work without express prior permission of the Licensor. Except as expressly stated herein, nothing in this License grants any license to Licensor's trademarks, copyrights, patents, trade secrets or any other intellectual property. No patent license is granted to make, use, sell, offer for sale, have made, or import embodiments of any patent claims other than the licensed claims defined in Section 2. No license is granted to the trademarks of Licensor even if such marks are included in the Original Work. Nothing in this License shall be interpreted to prohibit Licensor from licensing under terms different from this License any Original Work that Licensor otherwise would have a right to license.
25
+
26
+ 5. External Deployment. The term "External Deployment" means the use, distribution, or communication of the Original Work or Derivative Works in any way such that the Original Work or Derivative Works may be used by anyone other than You, whether those works are distributed or communicated to those persons or made available as an application intended for use over a network. As an express condition for the grants of license hereunder, You must treat any External Deployment by You of the Original Work or a Derivative Work as a distribution under section 1(c).
27
+
28
+ 6. Attribution Rights. You must retain, in the Source Code of any Derivative Works that You create, all copyright, patent, or trademark notices from the Source Code of the Original Work, as well as any notices of licensing and any descriptive text identified therein as an "Attribution Notice." You must cause the Source Code for any Derivative Works that You create to carry a prominent Attribution Notice reasonably calculated to inform recipients that You have modified the Original Work.
29
+
30
+ 7. Warranty of Provenance and Disclaimer of Warranty. Licensor warrants that the copyright in and to the Original Work and the patent rights granted herein by Licensor are owned by the Licensor or are sublicensed to You under the terms of this License with the permission of the contributor(s) of those copyrights and patent rights. Except as expressly stated in the immediately preceding sentence, the Original Work is provided under this License on an "AS IS" BASIS and WITHOUT WARRANTY, either express or implied, including, without limitation, the warranties of non-infringement, merchantability or fitness for a particular purpose. THE ENTIRE RISK AS TO THE QUALITY OF THE ORIGINAL WORK IS WITH YOU. This DISCLAIMER OF WARRANTY constitutes an essential part of this License. No license to the Original Work is granted by this License except under this disclaimer.
31
+
32
+ 8. Limitation of Liability. Under no circumstances and under no legal theory, whether in tort (including negligence), contract, or otherwise, shall the Licensor be liable to anyone for any indirect, special, incidental, or consequential damages of any character arising as a result of this License or the use of the Original Work including, without limitation, damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses. This limitation of liability shall not apply to the extent applicable law prohibits such limitation.
33
+
34
+ 9. Acceptance and Termination. If, at any time, You expressly assented to this License, that assent indicates your clear and irrevocable acceptance of this License and all of its terms and conditions. If You distribute or communicate copies of the Original Work or a Derivative Work, You must make a reasonable effort under the circumstances to obtain the express assent of recipients to the terms of this License. This License conditions your rights to undertake the activities listed in Section 1, including your right to create Derivative Works based upon the Original Work, and doing so without honoring these terms and conditions is prohibited by copyright law and international treaty. Nothing in this License is intended to affect copyright exceptions and limitations (including 'fair use' or 'fair dealing'). This License shall terminate immediately and You may no longer exercise any of the rights granted to You by this License upon your failure to honor the conditions in Section 1(c).
35
+
36
+ 10. Termination for Patent Action. This License shall terminate automatically and You may no longer exercise any of the rights granted to You by this License as of the date You commence an action, including a cross-claim or counterclaim, against Licensor or any licensee alleging that the Original Work infringes a patent. This termination provision shall not apply for an action alleging patent infringement by combinations of the Original Work with other software or hardware.
37
+
38
+ 11. Jurisdiction, Venue and Governing Law. Any action or suit relating to this License may be brought only in the courts of a jurisdiction wherein the Licensor resides or in which Licensor conducts its primary business, and under the laws of that jurisdiction excluding its conflict-of-law provisions. The application of the United Nations Convention on Contracts for the International Sale of Goods is expressly excluded. Any use of the Original Work outside the scope of this License or after its termination shall be subject to the requirements and penalties of copyright or patent law in the appropriate jurisdiction. This section shall survive the termination of this License.
39
+
40
+ 12. Attorneys' Fees. In any action to enforce the terms of this License or seeking damages relating thereto, the prevailing party shall be entitled to recover its costs and expenses, including, without limitation, reasonable attorneys' fees and costs incurred in connection with such action, including any appeal of such action. This section shall survive the termination of this License.
41
+
42
+ 13. Miscellaneous. If any provision of this License is held to be unenforceable, such provision shall be reformed only to the extent necessary to make it enforceable.
43
+
44
+ 14. Definition of "You" in This License. "You" throughout this License, whether in upper or lower case, means an individual or a legal entity exercising rights under, and complying with all of the terms of, this License. For legal entities, "You" includes any entity that controls, is controlled by, or is under common control with you. For purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
45
+
46
+ 15. Right to Use. You may use the Original Work in all ways not otherwise restricted or conditioned by this License or by law, and Licensor promises not to interfere with or be responsible for such uses by You.
47
+
48
+ 16. Modification of This License. This License is Copyright � 2005 Lawrence Rosen. Permission is granted to copy, distribute, or communicate this License without modification. Nothing in this License permits You to modify this License as applied to the Original Work or to Derivative Works. However, You may modify the text of this License and copy, distribute or communicate your modified version (the "Modified License") and apply it to other original works of authorship subject to the following conditions: (i) You may not indicate in any way that your Modified License is the "Open Software License" or "OSL" and you may not use those names in the name of your Modified License; (ii) You must replace the notice specified in the first paragraph above with the notice "Licensed under <insert your license name here>" or with a notice of your own that is not confusingly similar to the notice in this License; and (iii) You may not claim that your original works are open source software unless your Modified License has been approved by Open Source Initiative (OSI) and You comply with its license review and certification process.
app/code/community/Auctane/ShipStation/LICENSE_AFL.txt ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ Academic Free License ("AFL") v. 3.0
3
+
4
+ This Academic Free License (the "License") applies to any original work of authorship (the "Original Work") whose owner (the "Licensor") has placed the following licensing notice adjacent to the copyright notice for the Original Work:
5
+
6
+ Licensed under the Academic Free License version 3.0
7
+
8
+ 1. Grant of Copyright License. Licensor grants You a worldwide, royalty-free, non-exclusive, sublicensable license, for the duration of the copyright, to do the following:
9
+
10
+ 1. to reproduce the Original Work in copies, either alone or as part of a collective work;
11
+
12
+ 2. to translate, adapt, alter, transform, modify, or arrange the Original Work, thereby creating derivative works ("Derivative Works") based upon the Original Work;
13
+
14
+ 3. to distribute or communicate copies of the Original Work and Derivative Works to the public, under any license of your choice that does not contradict the terms and conditions, including Licensor's reserved rights and remedies, in this Academic Free License;
15
+
16
+ 4. to perform the Original Work publicly; and
17
+
18
+ 5. to display the Original Work publicly.
19
+
20
+ 2. Grant of Patent License. Licensor grants You a worldwide, royalty-free, non-exclusive, sublicensable license, under patent claims owned or controlled by the Licensor that are embodied in the Original Work as furnished by the Licensor, for the duration of the patents, to make, use, sell, offer for sale, have made, and import the Original Work and Derivative Works.
21
+
22
+ 3. Grant of Source Code License. The term "Source Code" means the preferred form of the Original Work for making modifications to it and all available documentation describing how to modify the Original Work. Licensor agrees to provide a machine-readable copy of the Source Code of the Original Work along with each copy of the Original Work that Licensor distributes. Licensor reserves the right to satisfy this obligation by placing a machine-readable copy of the Source Code in an information repository reasonably calculated to permit inexpensive and convenient access by You for as long as Licensor continues to distribute the Original Work.
23
+
24
+ 4. Exclusions From License Grant. Neither the names of Licensor, nor the names of any contributors to the Original Work, nor any of their trademarks or service marks, may be used to endorse or promote products derived from this Original Work without express prior permission of the Licensor. Except as expressly stated herein, nothing in this License grants any license to Licensor's trademarks, copyrights, patents, trade secrets or any other intellectual property. No patent license is granted to make, use, sell, offer for sale, have made, or import embodiments of any patent claims other than the licensed claims defined in Section 2. No license is granted to the trademarks of Licensor even if such marks are included in the Original Work. Nothing in this License shall be interpreted to prohibit Licensor from licensing under terms different from this License any Original Work that Licensor otherwise would have a right to license.
25
+
26
+ 5. External Deployment. The term "External Deployment" means the use, distribution, or communication of the Original Work or Derivative Works in any way such that the Original Work or Derivative Works may be used by anyone other than You, whether those works are distributed or communicated to those persons or made available as an application intended for use over a network. As an express condition for the grants of license hereunder, You must treat any External Deployment by You of the Original Work or a Derivative Work as a distribution under section 1(c).
27
+
28
+ 6. Attribution Rights. You must retain, in the Source Code of any Derivative Works that You create, all copyright, patent, or trademark notices from the Source Code of the Original Work, as well as any notices of licensing and any descriptive text identified therein as an "Attribution Notice." You must cause the Source Code for any Derivative Works that You create to carry a prominent Attribution Notice reasonably calculated to inform recipients that You have modified the Original Work.
29
+
30
+ 7. Warranty of Provenance and Disclaimer of Warranty. Licensor warrants that the copyright in and to the Original Work and the patent rights granted herein by Licensor are owned by the Licensor or are sublicensed to You under the terms of this License with the permission of the contributor(s) of those copyrights and patent rights. Except as expressly stated in the immediately preceding sentence, the Original Work is provided under this License on an "AS IS" BASIS and WITHOUT WARRANTY, either express or implied, including, without limitation, the warranties of non-infringement, merchantability or fitness for a particular purpose. THE ENTIRE RISK AS TO THE QUALITY OF THE ORIGINAL WORK IS WITH YOU. This DISCLAIMER OF WARRANTY constitutes an essential part of this License. No license to the Original Work is granted by this License except under this disclaimer.
31
+
32
+ 8. Limitation of Liability. Under no circumstances and under no legal theory, whether in tort (including negligence), contract, or otherwise, shall the Licensor be liable to anyone for any indirect, special, incidental, or consequential damages of any character arising as a result of this License or the use of the Original Work including, without limitation, damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses. This limitation of liability shall not apply to the extent applicable law prohibits such limitation.
33
+
34
+ 9. Acceptance and Termination. If, at any time, You expressly assented to this License, that assent indicates your clear and irrevocable acceptance of this License and all of its terms and conditions. If You distribute or communicate copies of the Original Work or a Derivative Work, You must make a reasonable effort under the circumstances to obtain the express assent of recipients to the terms of this License. This License conditions your rights to undertake the activities listed in Section 1, including your right to create Derivative Works based upon the Original Work, and doing so without honoring these terms and conditions is prohibited by copyright law and international treaty. Nothing in this License is intended to affect copyright exceptions and limitations (including "fair use" or "fair dealing"). This License shall terminate immediately and You may no longer exercise any of the rights granted to You by this License upon your failure to honor the conditions in Section 1(c).
35
+
36
+ 10. Termination for Patent Action. This License shall terminate automatically and You may no longer exercise any of the rights granted to You by this License as of the date You commence an action, including a cross-claim or counterclaim, against Licensor or any licensee alleging that the Original Work infringes a patent. This termination provision shall not apply for an action alleging patent infringement by combinations of the Original Work with other software or hardware.
37
+
38
+ 11. Jurisdiction, Venue and Governing Law. Any action or suit relating to this License may be brought only in the courts of a jurisdiction wherein the Licensor resides or in which Licensor conducts its primary business, and under the laws of that jurisdiction excluding its conflict-of-law provisions. The application of the United Nations Convention on Contracts for the International Sale of Goods is expressly excluded. Any use of the Original Work outside the scope of this License or after its termination shall be subject to the requirements and penalties of copyright or patent law in the appropriate jurisdiction. This section shall survive the termination of this License.
39
+
40
+ 12. Attorneys' Fees. In any action to enforce the terms of this License or seeking damages relating thereto, the prevailing party shall be entitled to recover its costs and expenses, including, without limitation, reasonable attorneys' fees and costs incurred in connection with such action, including any appeal of such action. This section shall survive the termination of this License.
41
+
42
+ 13. Miscellaneous. If any provision of this License is held to be unenforceable, such provision shall be reformed only to the extent necessary to make it enforceable.
43
+
44
+ 14. Definition of "You" in This License. "You" throughout this License, whether in upper or lower case, means an individual or a legal entity exercising rights under, and complying with all of the terms of, this License. For legal entities, "You" includes any entity that controls, is controlled by, or is under common control with you. For purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
45
+
46
+ 15. Right to Use. You may use the Original Work in all ways not otherwise restricted or conditioned by this License or by law, and Licensor promises not to interfere with or be responsible for such uses by You.
47
+
48
+ 16. Modification of This License. This License is Copyright � 2005 Lawrence Rosen. Permission is granted to copy, distribute, or communicate this License without modification. Nothing in this License permits You to modify this License as applied to the Original Work or to Derivative Works. However, You may modify the text of this License and copy, distribute or communicate your modified version (the "Modified License") and apply it to other original works of authorship subject to the following conditions: (i) You may not indicate in any way that your Modified License is the "Academic Free License" or "AFL" and you may not use those names in the name of your Modified License; (ii) You must replace the notice specified in the first paragraph above with the notice "Licensed under <insert your license name here>" or with a notice of your own that is not confusingly similar to the notice in this License; and (iii) You may not claim that your original works are open source software unless your Modified License has been approved by Open Source Initiative (OSI) and You comply with its license review and certification process.
app/code/community/Auctane/ShipStation/Model/Mysql4/User.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * ShipStation
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@auctane.com so we can send you a copy immediately.
14
+ *
15
+ * @category Shipping
16
+ * @package Auctane_ShipStation
17
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
18
+ */
19
+
20
+ class Auctane_ShipStation_Model_Mysql4_User extends Mage_Core_Model_Mysql4_Abstract {
21
+
22
+ protected function _construct()
23
+ {
24
+ $this->_init('auctaneshipstation/user', 'entity_id');
25
+ }
26
+
27
+ }
app/code/community/Auctane/ShipStation/Model/Mysql4/User/Collection.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * ShipStation
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@auctane.com so we can send you a copy immediately.
14
+ *
15
+ * @category Shipping
16
+ * @package Auctane_ShipStation
17
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
18
+ */
19
+
20
+ class Auctane_ShipStation_Model_Mysql4_User_Collection extends Mage_Eav_Model_Entity_Collection
21
+ {
22
+
23
+ protected function _construct()
24
+ {
25
+ $this->_init('auctaneshipstation/user');
26
+ }
27
+
28
+ }
app/code/community/Auctane/ShipStation/Model/Observer.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * ShipStation
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@auctane.com so we can send you a copy immediately.
14
+ *
15
+ * @category Shipping
16
+ * @package Auctane_ShipStation
17
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
18
+ */
19
+
20
+ class Auctane_ShipStation_Model_Observer {
21
+
22
+ public function appendDashboardSalesHtml(Varien_Event_Observer $observer)
23
+ {
24
+ $block = $observer->getBlock();
25
+ $transport = $observer->getTransport();
26
+ /* @var $block Mage_Adminhtml_Block_Dashboard_Sales */
27
+ if ($block->getType() == 'adminhtml/dashboard_sales') {
28
+ $transport->setHtml($transport->getHtml() . $block->getLayout()->getBlock('pendingorders')->toHtml());
29
+ }
30
+ }
31
+
32
+ }
app/code/community/Auctane/ShipStation/Model/User.php ADDED
@@ -0,0 +1,100 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * ShipStation
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@auctane.com so we can send you a copy immediately.
14
+ *
15
+ * @category Shipping
16
+ * @package Auctane_ShipStation
17
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
18
+ */
19
+
20
+ class Auctane_ShipStation_Model_User extends Mage_Core_Model_Abstract
21
+ {
22
+
23
+ protected function _construct()
24
+ {
25
+ $this->_init('auctaneshipstation/user');
26
+ }
27
+
28
+ public function load($user, $field=null)
29
+ {
30
+ if (is_object($user)) {
31
+ return parent::load($user->getUserId(), 'admin_user_id');
32
+ }
33
+ else {
34
+ return parent::load($user, $field);
35
+ }
36
+ }
37
+
38
+ /**
39
+ * Perform authentication with remote server
40
+ * @return unknown
41
+ */
42
+ public function authenticate()
43
+ {
44
+ $client = new Varien_Http_Client(Mage::getStoreConfig('auctane/shipstation/authenticate_url'), array(
45
+ 'storeresponse' => true
46
+ ));
47
+ $request = '<AuthenticationRequest StoreUrl="' . $this->getRequestUrl() . '"'
48
+ . ' Username="' . $this->getRequestUsername() . '"'
49
+ . ' Password="' . $this->getRequestPassword() . '"'
50
+ . ' />';
51
+ $client->setRawData($request, 'text/xml')
52
+ ->request(Varien_Http_Client::POST);
53
+
54
+ $response = $client->getLastResponse();
55
+ if ($response->isError()) {
56
+ throw new Exception($response->getMessage());
57
+ }
58
+
59
+ $xml = new SimpleXMLElement($response->getBody());
60
+ if ($xml['Success'] != 'true') {
61
+ if ($xml['ErrorMessage'])
62
+ throw new Exception($xml['ErrorMessage']);
63
+ else
64
+ throw new Exception(Mage::helper('auctaneshipstation')->__('Unable to authenticate'));
65
+ }
66
+
67
+ $this->setAuthToken($xml['AuthToken'])
68
+ ->setAuthUrl($xml['AuthUrl']);
69
+ if (!$this->hasAdminUserId()) {
70
+ $user = Mage::helper('auctaneshipstation')->getAdminUser();
71
+ if ($user) {
72
+ $this->setAdminUserId($user->getUserId());
73
+ }
74
+ }
75
+
76
+ return $this;
77
+ }
78
+
79
+ // Shortcuts for encrypted field
80
+ public function getAuthToken()
81
+ {
82
+ return Mage::helper('auctaneshipstation')->decrypt($this->getAuthTokenEnc());
83
+ }
84
+
85
+ public function setAuthToken($token)
86
+ {
87
+ return $this->setAuthTokenEnc(Mage::helper('auctaneshipstation')->encrypt($token));
88
+ }
89
+
90
+ public function hasAuthToken()
91
+ {
92
+ return $this->hasAuthTokenEnc();
93
+ }
94
+
95
+ public function unsAuthToken()
96
+ {
97
+ return $this->unsAuthTokenEnc();
98
+ }
99
+
100
+ }
app/code/community/Auctane/ShipStation/controllers/Adminhtml/ShipstationController.php ADDED
@@ -0,0 +1,93 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * ShipStation
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@auctane.com so we can send you a copy immediately.
14
+ *
15
+ * @category Shipping
16
+ * @package Auctane_ShipStation
17
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
18
+ */
19
+
20
+ class Auctane_ShipStation_Adminhtml_ShipstationController extends Mage_Adminhtml_Controller_Action
21
+ {
22
+
23
+ /**
24
+ * Ensure all pages have a decent title
25
+ */
26
+ public function preDispatch()
27
+ {
28
+ $this->_title($this->__('ShipStation'));
29
+ return parent::preDispatch();
30
+ }
31
+
32
+ /**
33
+ * Display a launch page, or redirect to setup page if necessary
34
+ */
35
+ public function indexAction()
36
+ {
37
+ if (Mage::helper('auctaneshipstation')->setupRequired()) {
38
+ $this->_redirect('*/shipstation/setup');
39
+ return;
40
+ }
41
+
42
+ $this->loadLayout();
43
+ $this->renderLayout();
44
+ }
45
+
46
+ /**
47
+ * Launch page needs a GMT value and javascript is not timezone aware
48
+ * This is an AJAX action
49
+ *
50
+ * @deprecated
51
+ */
52
+ public function timestampAction()
53
+ {
54
+ $timestamp = new DateTime();
55
+ $timestamp->setTimezone(new DateTimeZone('UTC'));
56
+ $this->getResponse()->setBody($timestamp->format('m/d/Y H:i:s'));
57
+ }
58
+
59
+ /**
60
+ * Display a setup page for registering
61
+ */
62
+ public function setupAction()
63
+ {
64
+ $this->_title($this->__('Register'));
65
+ $this->loadLayout();
66
+ $this->renderLayout();
67
+ }
68
+
69
+ /**
70
+ * The setup's "linkup" button goes here, register with shipstation server.
71
+ */
72
+ public function linkupAction()
73
+ {
74
+ try {
75
+
76
+ $user = Mage::getModel('auctaneshipstation/user');
77
+ $user->setData($this->getRequest()->getPost());
78
+ $user->setRequestUrl(Mage::helper('auctaneshipstation')->getStoreDomain($user->getStoreId()));
79
+ $user->authenticate();
80
+ // If there is an error it will abort here, no save.
81
+ $user->save();
82
+ $this->_redirect('*/shipstation');
83
+
84
+ } catch (Exception $e) {
85
+
86
+ $this->_getSession()->addException($e, $e->getMessage());
87
+ $this->_redirect('*/shipstation/setup');
88
+
89
+ }
90
+ }
91
+
92
+ }
93
+
app/code/community/Auctane/ShipStation/etc/adminhtml.xml ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!--
3
+ * ShipStation
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@auctane.com so we can send you a copy immediately.
14
+ *
15
+ * @category Shipping
16
+ * @package Auctane_ShipStation
17
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
18
+ -->
19
+ <config>
20
+ <menu>
21
+ <sales>
22
+ <children>
23
+ <auctane_shipstation translate="title" module="auctaneshipstation">
24
+ <title>ShipStation</title>
25
+ <sort_order>0</sort_order><!-- Place as first item -->
26
+ <action>adminhtml/shipstation</action>
27
+ </auctane_shipstation>
28
+ </children>
29
+ </sales>
30
+ </menu>
31
+ <acl>
32
+ <resources>
33
+ <admin>
34
+ <children>
35
+ <sales>
36
+ <children>
37
+ <auctane_shipstation translate="title" module="auctaneshipstation">
38
+ <title>ShipStation</title>
39
+ </auctane_shipstation>
40
+ </children>
41
+ </sales>
42
+ </children>
43
+ </admin>
44
+ </resources>
45
+ </acl>
46
+ </config>
app/code/community/Auctane/ShipStation/etc/api.xml ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!--
3
+ * ShipStation
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@auctane.com so we can send you a copy immediately.
14
+ *
15
+ * @category Shipping
16
+ * @package Auctane_ShipStation
17
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
18
+ -->
19
+ <config>
20
+ <menu>
21
+ <sales>
22
+ <children>
23
+ <auctane_shipstation translate="title" module="auctaneshipstation">
24
+ <title>ShipStation</title>
25
+ <sort_order>0</sort_order><!-- Place as first item -->
26
+ <action>adminhtml/shipstation</action>
27
+ </auctane_shipstation>
28
+ </children>
29
+ </sales>
30
+ </menu>
31
+ <acl>
32
+ <resources>
33
+ <admin>
34
+ <children>
35
+ <sales>
36
+ <children>
37
+ <auctane_shipstation translate="title" module="auctaneshipstation">
38
+ <title>ShipStation</title>
39
+ </auctane_shipstation>
40
+ </children>
41
+ </sales>
42
+ </children>
43
+ </admin>
44
+ </resources>
45
+ </acl>
46
+ </config>
app/code/community/Auctane/ShipStation/etc/config.xml ADDED
@@ -0,0 +1,115 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
+ <!--
3
+ * ShipStation
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@auctane.com so we can send you a copy immediately.
14
+ *
15
+ * @category Shipping
16
+ * @package Auctane_ShipStation
17
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
18
+ -->
19
+ <config>
20
+ <modules>
21
+ <Auctane_ShipStation>
22
+ <version>1.3.0</version>
23
+ </Auctane_ShipStation>
24
+ </modules>
25
+
26
+ <default>
27
+ <auctane>
28
+ <shipstation>
29
+ <authenticate_url><![CDATA[https://app.shipstation.com/Marketplace/MagentoAuthenticate]]></authenticate_url>
30
+ </shipstation>
31
+ </auctane>
32
+ </default>
33
+
34
+ <global>
35
+ <blocks>
36
+ <auctaneshipstation>
37
+ <class>Auctane_ShipStation_Block</class>
38
+ </auctaneshipstation>
39
+ </blocks>
40
+ <helpers>
41
+ <auctaneshipstation>
42
+ <class>Auctane_ShipStation_Helper</class>
43
+ </auctaneshipstation>
44
+ </helpers>
45
+ <models>
46
+ <auctaneshipstation>
47
+ <class>Auctane_ShipStation_Model</class>
48
+ <resourceModel>auctaneshipstation_mysql4</resourceModel>
49
+ </auctaneshipstation>
50
+ <auctaneshipstation_mysql4>
51
+ <class>Auctane_ShipStation_Model_Mysql4</class>
52
+ <entities>
53
+ <user><table>auctaneshipstation_user</table></user>
54
+ </entities>
55
+ </auctaneshipstation_mysql4>
56
+ </models>
57
+ <resources>
58
+ <auctaneshipstation_setup>
59
+ <setup>
60
+ <module>Auctane_ShipStation</module>
61
+ <!-- Not specifying a class yet because only flat tables are used -->
62
+ </setup>
63
+ </auctaneshipstation_setup>
64
+ <!-- Adapters don't need to be specified in modern versions of Magento, but included here for compatibility -->
65
+ <auctaneshipstation_write>
66
+ <connection><use>core_write</use></connection>
67
+ </auctaneshipstation_write>
68
+ <auctaneshipstation_read>
69
+ <connection><use>core_read</use></connection>
70
+ </auctaneshipstation_read>
71
+ </resources>
72
+ </global>
73
+
74
+ <admin>
75
+ <routers>
76
+ <adminhtml>
77
+ <args>
78
+ <modules>
79
+ <auctaneshipstation before="Mage_Adminhtml">Auctane_ShipStation_Adminhtml</auctaneshipstation>
80
+ </modules>
81
+ </args>
82
+ </adminhtml>
83
+ </routers>
84
+ </admin>
85
+
86
+ <adminhtml>
87
+ <layout>
88
+ <updates>
89
+ <auctaneshipstation>
90
+ <file>auctaneshipstation.xml</file>
91
+ </auctaneshipstation>
92
+ </updates>
93
+ </layout>
94
+ <translate>
95
+ <modules>
96
+ <auctaneshipstation>
97
+ <files>
98
+ <default>Auctane_ShipStation.csv</default>
99
+ </files>
100
+ </auctaneshipstation>
101
+ </modules>
102
+ </translate>
103
+ <events>
104
+ <core_block_abstract_to_html_after>
105
+ <observers>
106
+ <auctaneshipstation_dashboard_sales_after>
107
+ <class>auctaneshipstation/observer</class>
108
+ <method>appendDashboardSalesHtml</method>
109
+ <type>singleton</type>
110
+ </auctaneshipstation_dashboard_sales_after>
111
+ </observers>
112
+ </core_block_abstract_to_html_after>
113
+ </events>
114
+ </adminhtml>
115
+ </config>
app/code/community/Auctane/ShipStation/sql/auctaneshipstation_setup/mysql4-install-1.0.0.php ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * ShipStation
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@auctane.com so we can send you a copy immediately.
14
+ *
15
+ * @category Shipping
16
+ * @package Auctane_ShipStation
17
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
18
+ */
19
+ /* @var $this Mage_Core_Model_Resource_Setup */
20
+
21
+ $this->startSetup();
22
+
23
+ $this->run("
24
+
25
+ DROP TABLE IF EXISTS {$this->getTable('auctaneshipstation_user')};
26
+ CREATE TABLE {$this->getTable('auctaneshipstation_user')} (
27
+ `entity_id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
28
+ `store_id` SMALLINT(5) NOT NULL DEFAULT 0 COMMENT 'Store 0 is admin',
29
+ `admin_user_id` MEDIUMINT(9) UNSIGNED,
30
+ `request_url` VARCHAR(255),
31
+ `request_username` VARCHAR(255),
32
+ `auth_token_enc` VARCHAR(255),
33
+ `auth_url` VARCHAR(255),
34
+ PRIMARY KEY (`entity_id`),
35
+ UNIQUE KEY (`admin_user_id`, `store_id`)
36
+ -- CONSTRAINT `FK_shipstation_core_store_id` FOREIGN KEY (`store_id`)
37
+ -- REFERENCES {$this->getTable('core_store')} (`store_id`)
38
+ -- ON DELETE CASCADE ON UPDATE CASCADE,
39
+ -- CONSTRAINT `FK_shipstation_admin_user_id` FOREIGN KEY (`admin_user_id`)
40
+ -- REFERENCES {$this->getTable('admin_user')} (`user_id`)
41
+ -- ON DELETE CASCADE ON UPDATE CASCADE
42
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
43
+
44
+ ");
45
+
46
+ $this->endSetup();
app/design/adminhtml/default/default/layout/auctaneshipstation.xml ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!--
3
+ * ShipStation
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@auctane.com so we can send you a copy immediately.
14
+ *
15
+ * @category Shipping
16
+ * @package Auctane_ShipStation
17
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
18
+ -->
19
+ <layout>
20
+
21
+ <adminhtml_dashboard_index>
22
+ <reference name="dashboard">
23
+ <block type="auctaneshipstation/adminhtml_pending" name="pendingorders" template="auctane/shipstation/pending.phtml">
24
+ <block type="adminhtml/template" name="launchform" template="auctane/shipstation/launchform.phtml" />
25
+ </block>
26
+ </reference>
27
+ </adminhtml_dashboard_index>
28
+
29
+ <adminhtml_shipstation_index>
30
+ <reference name="content">
31
+ <block type="adminhtml/template" name="launch" template="auctane/shipstation/launch.phtml">
32
+ <block type="adminhtml/template" name="launchform" template="auctane/shipstation/launchform.phtml" />
33
+ </block>
34
+ </reference>
35
+ </adminhtml_shipstation_index>
36
+
37
+ <adminhtml_shipstation_setup>
38
+ <reference name="content">
39
+ <block type="adminhtml/template" name="container" template="auctane/shipstation/container.phtml">
40
+ <block type="auctaneshipstation/adminhtml_linkup" name="linkup" template="auctane/shipstation/linkup.phtml" />
41
+ </block>
42
+ </reference>
43
+ </adminhtml_shipstation_setup>
44
+
45
+ </layout>
app/design/adminhtml/default/default/template/auctane/shipstation/container.phtml ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * ShipStation
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@auctane.com so we can send you a copy immediately.
14
+ *
15
+ * @category Shipping
16
+ * @package Auctane_ShipStation
17
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
18
+ */
19
+ ?>
20
+ <table>
21
+ <col width="50%" />
22
+ <col width="50%" />
23
+ <tbody><tr>
24
+ <td><?php echo $this->getChildHtml('linkup') ?></td>
25
+ <td>
26
+ <p><b><?php echo $this->__('Don\'t have a ShipStation account yet?') ?></b></p>
27
+ <p><?php echo $this->__('Please go to %s to select a plan. You can try it for free for 30 days!', '<a href="http://www.shipstation.com/pricing" target="_blank">http://www.shipstation.com/pricing</a>') ?></p>
28
+ <p><?php echo $this->__('Here are some highlights:') ?></p>
29
+ <ol style="list-style: decimal; padding-left: 20px;">
30
+ <li><?php echo $this->__('Consolidate your orders from Magento and other marketplaces such as eBay, Amazon, Buy.com and more.') ?></li>
31
+ <li><?php echo $this->__('Print shipping labels for both USPS and UPS.') ?></li>
32
+ <li><?php echo $this->__('Receive deep discounts on USPS Priority and Express Mail postage.') ?></li>
33
+ <li><?php echo $this->__('Create labels and packing slips in batch.') ?></li>
34
+ <li><?php echo $this->__('Automate your business with order automation rules.') ?></li>
35
+ </ol>
36
+ <br />
37
+ <img src="//app.shipstation.com/images/home-screen-shot.png" />
38
+ </td>
39
+ </tr></tbody>
40
+ </table>
app/design/adminhtml/default/default/template/auctane/shipstation/launch.phtml ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * ShipStation
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@auctane.com so we can send you a copy immediately.
14
+ *
15
+ * @category Shipping
16
+ * @package Auctane_ShipStation
17
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
18
+ */
19
+ ?>
20
+ <?php /* @var $this Mage_Adminhtml_Block_Template */ ?>
21
+ <img alt="<?php echo $this->__('ShipStation') ?>" src="<?php echo $this->getSkinUrl('images/shipstation.png') ?>">
22
+ <p><?php echo $this->__('Click the button below to launch ShipStation!') ?></p>
23
+ <?php
24
+ $form = $this->getLayout()->getBlock('launchform');
25
+ $form->setLabel($this->__('Launch ShipStation'));
26
+ echo $form->toHtml();
27
+ ?>
28
+ <p>&nbsp;</p>
29
+ <p>&nbsp;</p>
30
+ <p>&nbsp;</p>
31
+ <p><a href="<?php echo $this->getUrl('*/shipstation/setup') ?>"><?php echo $this->__('Click here to set a new ShipStation account') ?></a></p>
app/design/adminhtml/default/default/template/auctane/shipstation/launchform.phtml ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * ShipStation
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@auctane.com so we can send you a copy immediately.
14
+ *
15
+ * @category Shipping
16
+ * @package Auctane_ShipStation
17
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
18
+ */
19
+ ?>
20
+ <?php /* @var $this Mage_Adminhtml_Block_Template */ ?>
21
+ <?php $helper = Mage::helper('auctaneshipstation') ?>
22
+ <?php if ($helper->setupRequired()):
23
+
24
+ $button = $this->getLayout()->createBlock('adminhtml/widget_button', 'launch_button', array(
25
+ 'label' => $this->getLabel(),
26
+ 'onclick' => "setLocation('{$this->getUrl('*/shipstation/setup')}');"
27
+ ));
28
+ echo $button->toHtml();
29
+
30
+ else:
31
+
32
+ $user = $helper->getUser();
33
+ $timestamp = new DateTime();
34
+ $timestamp->setTimezone(new DateTimeZone('UTC'));
35
+
36
+ // Use own container otherwise private form key is revealed.
37
+ $form = new Varien_Data_Form();
38
+ $form->addField('shipstationusername', 'hidden', array(
39
+ 'name' => 'Username',
40
+ 'value' => $user->getRequestUsername()
41
+ ));
42
+ $form->addField('shipstationauthtoken', 'hidden', array(
43
+ 'name' => 'AuthToken',
44
+ 'value' => $user->getAuthToken()
45
+ ));
46
+ $form->addField('shipstationtimestamp', 'hidden', array(
47
+ 'name' => 'Timestamp',
48
+ 'value' => $timestamp->format('m/d/Y H:i:s')
49
+ ));
50
+ $form->addField('shipstationsubmit', 'submit', array(
51
+ 'class' => 'form-button',
52
+ 'value' => $this->getLabel()
53
+ ));
54
+
55
+ ?>
56
+ <form action="<?php echo $user->getAuthUrl() ?>" method="post" target="_blank">
57
+ <?php echo $form->toHtml() ?>
58
+ </form>
59
+ <?php endif; ?>
app/design/adminhtml/default/default/template/auctane/shipstation/linkup.phtml ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * ShipStation
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@auctane.com so we can send you a copy immediately.
14
+ *
15
+ * @category Shipping
16
+ * @package Auctane_ShipStation
17
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
18
+ */
19
+ ?>
20
+ <?php /* @var $this Auctane_ShipStation_Block_Adminhtml_Linkup */ ?>
21
+ <img alt="<?php echo $this->__('ShipStation') ?>" src="<?php echo $this->getSkinUrl('images/shipstation.png') ?>">
22
+ <p><?php echo $this->__('It looks like you have not linked up your ShipStation account yet. Please fill out the following form:') ?></p>
23
+ <?php echo $this->getFormHtml() ?>
24
+ <?php $this->getButtonsHtml(); echo $this->getChildHtml('save_button') ?>
25
+ <script type="text/javascript">
26
+ editForm = new varienForm('edit_form', '<?php echo $this->getValidationUrl() ?>');
27
+ </script>
28
+ <?php echo $this->getFormScripts() ?>
app/design/adminhtml/default/default/template/auctane/shipstation/pending.phtml ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * ShipStation
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@auctane.com so we can send you a copy immediately.
14
+ *
15
+ * @category Shipping
16
+ * @package Auctane_ShipStation
17
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
18
+ */
19
+ ?>
20
+ <?php /* @var $this Mage_Adminhtml_Block_Template */ ?>
21
+ <div class="entry-edit">
22
+ <div class="entry-edit-head"><h4><?php echo $this->__('Orders Awaiting Shipment') ?></h4></div>
23
+ <fieldset>
24
+ <table style="width: 100%">
25
+ <col width="50%">
26
+ <col width="50%">
27
+ <tr>
28
+ <td class="v-middle">
29
+ <?php if (($numOrders = $this->getOrders()->getSize()) == 1): ?>
30
+ <p><?php echo $this->__('%d order awaiting shipment', $numOrders) ?></p>
31
+ <?php elseif ($numOrders > 1): ?>
32
+ <p><?php echo $this->__('%d orders awaiting shipment', $numOrders) ?></p>
33
+ <?php endif; ?>
34
+ <?php echo $this->getLayout()->getBlock('launchform')->setLabel($this->__('Ship Now'))->toHtml() ?>
35
+ </td>
36
+ <td class="v-middle">
37
+ <img alt="<?php echo $this->__('ShipStation') ?>" src="<?php echo $this->getSkinUrl('images/shipstation.png') ?>">
38
+ </td>
39
+ </tr></table>
40
+ </fieldset>
41
+ </div>
app/etc/modules/Auctane_Api.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
+ <config>
3
+ <modules>
4
+ <Auctane_Api>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ </Auctane_Api>
8
+ </modules>
9
+ </config>
app/etc/modules/Auctane_ShipStation.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
+ <config>
3
+ <modules>
4
+ <Auctane_ShipStation>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ </Auctane_ShipStation>
8
+ </modules>
9
+ </config>
app/locale/en_US/Auctane_ShipStation.csv ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "ShipStation","ShipStation"
2
+ "Register","Register"
3
+ "Click the button below to launch ShipStation!","Click the button below to launch ShipStation!"
4
+ "Launch ShipStation","Launch ShipStation"
5
+ "Click here to set a new ShipStation account","Click here to set a new ShipStation account"
6
+ "Link up with ShipStation","Link up with ShipStation"
7
+ "Store View:","Store View:"
8
+ "ShipStation Username:","ShipStation Username:"
9
+ "Password:","Password:"
10
+ "Don't have a ShipStation account yet?","Don't have a ShipStation account yet?"
11
+ "Please go to %s to select a plan. You can try it for free for 30 days!","Please go to %s to select a plan. You can try it for free for 30 days!"
12
+ "Here are some highlights:","Here are some highlights:"
13
+ "Consolidate your orders from Magento and other marketplaces such as eBay, Amazon, Buy.com and more.","Consolidate your orders from Magento and other marketplaces such as eBay, Amazon, Buy.com and more."
14
+ "Print shipping labels for both USPS and UPS.","Print shipping labels for both USPS and UPS."
15
+ "Receive deep discounts on USPS Priority and Express Mail postage.","Receive deep discounts on USPS Priority and Express Mail postage."
16
+ "Create labels and packing slips in batch.","Create labels and packing slips in batch."
17
+ "Automate your business with order automation rules.","Automate your business with order automation rules."
18
+ "It looks like you have not linked up your ShipStation account yet. Please fill out the following form:","It looks like you have not linked up your ShipStation account yet. Please fill out the following form:"
19
+ "Unable to authenticate","Unable to authenticate"
20
+ "Orders Awaiting Shipment","Orders Awaiting Shipment"
21
+ "Ship Now","Ship Now"
22
+ "%d order awaiting shipment","%d order awaiting shipment"
23
+ "%d orders awaiting shipment","%d orders awaiting shipment"
package.xml ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Auctane_ShipStation</name>
4
+ <version>1.3.0</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>ShipStation is a web-based shipping solution that is integrated with the Magento API for retrieving order information and updating shipping details.</summary>
10
+ <description>ShipStation is a web-based shipping solution that is integrated with the Magento API for retrieving order information and updating shipping details.</description>
11
+ <notes>Official release.&#xD;
12
+ Export custom attributes as custom options to API.&#xD;
13
+ </notes>
14
+ <authors><author><name>clockworkgeek</name><user>nonproffessional</user><email>nonproffessional@clockworkgeek.com</email></author></authors>
15
+ <date>2013-02-21</date>
16
+ <time>15:38:18</time>
17
+ <contents><target name="magecommunity"><dir name="Auctane"><dir name="ShipStation"><dir name="Block"><dir name="Adminhtml"><dir name="Linkup"><file name="Form.php" hash="68b7c7bc627e89c304cf630c24aa5164"/></dir><file name="Linkup.php" hash="f280d1f6a26e74244898ea16cdf29c9b"/><file name="Pending.php" hash="6bc7a07b5d0b5192db32fefc55b94b08"/></dir></dir><dir name="Helper"><file name="Data.php" hash="cf2bd6a04dd7b88cae8096c2dd548214"/></dir><file name="LICENSE.html" hash="caf0a79ffb5e4719f9f4de286f253a61"/><file name="LICENSE.txt" hash="59563e7be45096d0833dade102989042"/><file name="LICENSE_AFL.txt" hash="45a399f2095030865fb962263ccd7506"/><dir name="Model"><dir name="Mysql4"><dir name="User"><file name="Collection.php" hash="eee6af3b0c7ecf4f4a42eb0b50605d29"/></dir><file name="User.php" hash="296427f3d22c7cc18c0ece7c1afbc278"/></dir><file name="Observer.php" hash="ffb797d5cfc2f0724d20a44140661bed"/><file name="User.php" hash="9e3fad822b8adcd79dd5438d995fc61a"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="ShipstationController.php" hash="c7cd0029ed2a0a46d7b16821b1e6a683"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="3021b17f108f3f50230194ff63975481"/><file name="api.xml" hash="3021b17f108f3f50230194ff63975481"/><file name="config.xml" hash="cf916c5f657f8ed1d4d6fe26932d49d5"/></dir><dir name="sql"><dir name="auctaneshipstation_setup"><file name="mysql4-install-1.0.0.php" hash="ab307db58a6d8ec97b5efc8d4eedb349"/></dir></dir></dir><dir name="Api"><dir name="Helper"><file name="Data.php" hash="58f95c074ed97db15d564c973dae5d43"/></dir><file name="LICENSE.html" hash="caf0a79ffb5e4719f9f4de286f253a61"/><file name="LICENSE.txt" hash="59563e7be45096d0833dade102989042"/><file name="LICENSE_AFL.txt" hash="45a399f2095030865fb962263ccd7506"/><dir name="Model"><dir name="Server"><file name="Adapter.php" hash="f0dcba3ca9c9801d42fc52c0d9fefab7"/></dir><dir name="System"><dir name="Source"><dir name="Config"><file name="Customattributes.php" hash="a10dff7d323044151803ce2e30313615"/></dir></dir></dir></dir><dir name="controllers"><file name="AuctaneController.php" hash="b7100ac35e0b3a5d737cde7ef96e19c0"/></dir><dir name="etc"><file name="api.xml" hash="3b6279da3c6a4e5fc71c72f1caf94ae1"/><file name="config.xml" hash="e2d66690c9ac4714d9d10b9a09f0b454"/><file name="system.xml" hash="37d6921d13f1410dbb98f53925fba200"/></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="auctaneshipstation.xml" hash="d89f79f6de41bb4b23866356f16f48a1"/></dir><dir name="template"><dir name="auctane"><dir name="shipstation"><file name="container.phtml" hash="fb3df40a0baa33a21f6a51d52a90066c"/><file name="launch.phtml" hash="c3fbbc817cbf307fbd500defb2ab9f8e"/><file name="launchform.phtml" hash="b77583e98de80857b185d19a8ce03987"/><file name="linkup.phtml" hash="282a2114ca36efb68f1e681a29739a87"/><file name="pending.phtml" hash="100ec728f3b5ce479e09361bb22960bb"/></dir></dir></dir></dir></dir></dir></target><target name="magelocale"><dir name="en_US"><file name="Auctane_ShipStation.csv" hash="0f9582a3124a762cd6d9531f714d2f82"/></dir></target><target name="mageetc"><dir name="modules"><file name="Auctane_ShipStation.xml" hash="25f744e3243f8472445f3b73f95895c7"/><file name="Auctane_Api.xml" hash="a27b534a3ad08732488959f8bdb72a03"/></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="images"><file name="shipstation.png" hash="e19a42099ef020edaf7c10d9a068c1c0"/></dir></dir></dir></dir></target></contents>
18
+ <compatible/>
19
+ <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
20
+ </package>
skin/adminhtml/default/default/images/shipstation.png ADDED
Binary file