Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

initial commit comment

  • Loading branch information...
commit f916821c29ec0f090e38e96de96d21c4b95fb5f4 1 parent b6f7828
Allie Micka authored
View
9 AdvantageLabsQuickbooksBundle.php
@@ -0,0 +1,9 @@
+<?php
+
+namespace AdvantageLabs\QuickbooksBundle;
+
+use Symfony\Component\HttpKernel\Bundle\Bundle;
+
+class AdvantageLabsQuickbooksBundle extends Bundle
+{
+}
View
84 Controller/DefaultController.php
@@ -0,0 +1,84 @@
+<?php
+
+namespace AdvantageLabs\QuickbooksBundle\Controller;
+
+use Symfony\Bundle\FrameworkBundle\Controller\Controller;
+
+// This file defines some important constants.
+require '../vendor/intuit/php_devkit/Quickbooks.php';
+
+class DefaultController extends Controller
+{
+ public function indexAction($name)
+ {
+ return $this->render('AdvantageLabsQuickbooksBundle:Default:index.html.twig', array('name' => $name));
+ }
+
+ public function qbwcAction()
+ {
+ // TODO these are all hard-coded for now.
+ // See docs at http://www.consolibyte.com/wiki/doku.php/quickbooks_web_connector
+ $response = '<?xml version="1.0"?>
+ <QBWCXML>
+ <AppName>Advantage Labs contact manager</AppName>
+ <AppID></AppID>
+ <AppURL>https://manage/quickbooks/server.php</AppURL>
+ <AppDescription></AppDescription>
+ <AppSupport>http://www.advantagelabs.com/</AppSupport>
+ <UserName>username</UserName>
+ <OwnerID>{3f557aa0-999c-11e1-a8b0-0800200c9a66}</OwnerID>
+ <FileID>{54c72230-999c-11e1-a8b0-0800200c9a66}</FileID>
+ <QBType>QBFS</QBType>
+ <Scheduler>
+ <RunEveryNMinutes>2</RunEveryNMinutes>
+ </Scheduler>
+ <IsReadOnly>false</IsReadOnly>
+ </QBWCXML>';
+
+ return new Response($response);
+ }
+
+ public function serverAction()
+ {
+ new \QuickBooks_WebConnector_Server();
+
+ // Map QuickBooks actions to handler functions
+ $map = array(
+ QUICKBOOKS_ADD_CUSTOMER => array( '_quickbooks_customer_add_request', '_quickbooks_customer_add_response' ),
+ );
+
+ // This is entirely optional, use it to trigger actions when an error is returned by QuickBooks
+ $errmap = array(
+ '*' => '_quickbooks_error_catchall', // Using a key value of '*' will catch any errors which were not caught by another error handler
+ );
+
+ // An array of callback hooks
+ $hooks = array(
+ );
+
+ // Logging level
+ $log_level = QUICKBOOKS_LOG_DEVELOP; // Use this level until you're sure everything works!!!
+
+ // What SOAP server you're using
+ $soapserver = QUICKBOOKS_SOAPSERVER_BUILTIN; // A pure-PHP SOAP server (no PHP ext/soap extension required, also makes debugging easier)
+
+ $soap_options = array( // See http://www.php.net/soap
+ );
+
+ $handler_options = array(
+ 'deny_concurrent_logins' => false,
+ ); // See the comments in the QuickBooks/Server/Handlers.php file
+
+ $driver_options = array( // See the comments in the QuickBooks/Driver/<YOUR DRIVER HERE>.php file ( i.e. 'Mysql.php', etc. )
+ );
+
+ $callback_options = array(
+ );
+
+ // Create a new server and tell it to handle the requests
+ // __construct($dsn_or_conn, $map, $errmap = array(), $hooks = array(), $log_level = QUICKBOOKS_LOG_NORMAL, $soap = QUICKBOOKS_SOAPSERVER_PHP, $wsdl = QUICKBOOKS_WSDL, $soap_options = array(), $handler_options = array(), $driver_options = array(), $callback_options = array()
+ $Server = new \QuickBooks_WebConnector_Server($dsn, $map, $errmap, $hooks, $log_level, $soapserver, QUICKBOOKS_WSDL, $soap_options, $handler_options, $driver_options, $callback_options);
+ $response = $Server->handle(true, true);
+
+ }
+ }
View
28 DependencyInjection/AdvantageLabsQuickbooksExtension.php
@@ -0,0 +1,28 @@
+<?php
+
+namespace AdvantageLabs\QuickbooksBundle\DependencyInjection;
+
+use Symfony\Component\DependencyInjection\ContainerBuilder;
+use Symfony\Component\Config\FileLocator;
+use Symfony\Component\HttpKernel\DependencyInjection\Extension;
+use Symfony\Component\DependencyInjection\Loader;
+
+/**
+ * This is the class that loads and manages your bundle configuration
+ *
+ * To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html}
+ */
+class AdvantageLabsQuickbooksExtension extends Extension
+{
+ /**
+ * {@inheritDoc}
+ */
+ public function load(array $configs, ContainerBuilder $container)
+ {
+ $configuration = new Configuration();
+ $config = $this->processConfiguration($configuration, $configs);
+
+ $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
+ $loader->load('services.yml');
+ }
+}
View
29 DependencyInjection/Configuration.php
@@ -0,0 +1,29 @@
+<?php
+
+namespace AdvantageLabs\QuickbooksBundle\DependencyInjection;
+
+use Symfony\Component\Config\Definition\Builder\TreeBuilder;
+use Symfony\Component\Config\Definition\ConfigurationInterface;
+
+/**
+ * This is the class that validates and merges configuration from your app/config files
+ *
+ * To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html#cookbook-bundles-extension-config-class}
+ */
+class Configuration implements ConfigurationInterface
+{
+ /**
+ * {@inheritDoc}
+ */
+ public function getConfigTreeBuilder()
+ {
+ $treeBuilder = new TreeBuilder();
+ $rootNode = $treeBuilder->root('advantage_labs_quickbooks');
+
+ // Here you should define the parameters that are allowed to
+ // configure your bundle. See the documentation linked above for
+ // more information on that topic.
+
+ return $treeBuilder;
+ }
+}
View
7 Resources/config/routing.yml
@@ -0,0 +1,7 @@
+AdvantageLabsQuickbooksBundle_homepage:
+ pattern: /qb/qbwc
+ defaults: { _controller: AdvantageLabsQuickbooksBundle:Default:qbwc }
+
+AdvantageLabsQuickbooksBundle_server:
+ pattern: /qb/server
+ defaults: { _controller: AdvantageLabsQuickbooksBundle:Default:server }
View
7 Resources/config/services.yml
@@ -0,0 +1,7 @@
+parameters:
+# advantage_labs_quickbooks.example.class: AdvantageLabs\QuickbooksBundle\Example
+
+services:
+# advantage_labs_quickbooks.example:
+# class: %advantage_labs_quickbooks.example.class%
+# arguments: [@service_id, "plain_value", %parameter%]
View
0  Resources/doc/index.rst
No changes.
View
11 Resources/translations/messages.fr.xlf
@@ -0,0 +1,11 @@
+<?xml version="1.0"?>
+<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
+ <file source-language="en" datatype="plaintext" original="file.ext">
+ <body>
+ <trans-unit id="1">
+ <source>Symfony2 is great</source>
+ <target>J'aime Symfony2</target>
+ </trans-unit>
+ </body>
+ </file>
+</xliff>
View
1  Resources/views/Default/index.html.twig
@@ -0,0 +1 @@
+Hello {{ name }}!
View
17 Tests/Controller/DefaultControllerTest.php
@@ -0,0 +1,17 @@
+<?php
+
+namespace AdvantageLabs\QuickbooksBundle\Tests\Controller;
+
+use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
+
+class DefaultControllerTest extends WebTestCase
+{
+ public function testIndex()
+ {
+ $client = static::createClient();
+
+ $crawler = $client->request('GET', '/hello/Fabien');
+
+ $this->assertTrue($crawler->filter('html:contains("Hello Fabien")')->count() > 0);
+ }
+}
Please sign in to comment.
Something went wrong with that request. Please try again.