Skip to content

Commit 31b08e8

Browse files
committed
- inital commit; added bridge bundle for extending the OroCommerce API resources
0 parents  commit 31b08e8

File tree

11 files changed

+252
-0
lines changed

11 files changed

+252
-0
lines changed

.gitignore

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/.settings
2+
/.buildpath
3+
/.project
4+
/.idea
5+
/composer.phar
6+
composer.lock
7+
/vendor
8+
/components
9+
phpunit.xml
10+
*~

LICENSE

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Extension of OroCommerce's API resources in order to integrate with Marello.
2+
3+
The Open Software License version 3.0
4+
5+
Copyright (c) 2015-2018, Madia B.V.
6+
7+
Full license is at: http://opensource.org/licenses/OSL-3.0

README.md

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
Marello OroCommerce Bridge Api
2+
========================
3+
4+
Package that contains bundles related to the extension of OroCommerce's API resources in order to integrate with Marello.
5+
This package should be present on the OroCommerce instance whenever integrating with Marello either in a single instance or as separate instances.
6+
7+
8+
Requirements
9+
------------
10+
11+
This package requires you to have OroCommerce 1.5.x or above installed in order to extend the API Data resources

composer.json

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"name": "marellocommerce/marello-orocommerce-api-bridge",
3+
"description": "Api Bridge for exposing additional resources from OroCommerce to integrate with Marello",
4+
"homepage": "https://github.com/marellocommerce/marello-orocommerce-api-bridge.git",
5+
"license": "OSL-3.0",
6+
"authors": [
7+
{
8+
"name": "Madia B.V.",
9+
"homepage": "https://www.marello.com"
10+
}
11+
],
12+
"repositories": [
13+
{
14+
"type": "composer",
15+
"url": "https://packagist.orocrm.com"
16+
}
17+
],
18+
"require": {
19+
"php": ">=7.0",
20+
"oro/commerce": "1.5.*"
21+
},
22+
"minimum-stability": "dev",
23+
"prefer-stable": true,
24+
"extra": {
25+
"branch-alias": {
26+
"dev-master": "1.x-dev"
27+
}
28+
},
29+
"autoload": {
30+
"psr-4": {"": "src/"},
31+
"exclude-from-classmap": ["/Tests/"]
32+
}
33+
}

phpunit.xml.dist

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<!-- http://www.phpunit.de/manual/current/en/appendixes.configuration.html -->
4+
<phpunit
5+
backupGlobals = "false"
6+
backupStaticAttributes = "false"
7+
colors = "false"
8+
convertErrorsToExceptions = "true"
9+
convertNoticesToExceptions = "true"
10+
convertWarningsToExceptions = "true"
11+
processIsolation = "false"
12+
stopOnFailure = "false"
13+
syntaxCheck = "false"
14+
bootstrap = "vendor/autoload.php">
15+
16+
<testsuites>
17+
<testsuite name="Project Unit Tests">
18+
<directory suffix="Test.php">src/Marello/Bridge/*/Tests/Unit</directory>
19+
</testsuite>
20+
</testsuites>
21+
22+
<!--
23+
<php>
24+
<server name="KERNEL_DIR" value="/path/to/your/app/" />
25+
</php>
26+
-->
27+
<filter>
28+
<whitelist>
29+
<directory>src</directory>
30+
<exclude>
31+
<directory>vendor</directory>
32+
<directory>src/Marello/Bridge/*/DataFixtures</directory>
33+
<directory>src/Marello/Bridge/*/Resources</directory>
34+
<directory>src/Marello/Bridge/*/Tests</directory>
35+
<directory>src/Marello/Bridge/*/vendor</directory>
36+
</exclude>
37+
</whitelist>
38+
</filter>
39+
40+
</phpunit>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php
2+
3+
namespace Marello\Bridge\MarelloOroCommerceApi\DependencyInjection;
4+
5+
use Symfony\Component\Config\FileLocator;
6+
use Symfony\Component\DependencyInjection\ContainerBuilder;
7+
use Symfony\Component\DependencyInjection\Loader;
8+
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
9+
10+
class MarelloOroCommerceApiBridgeExtension extends Extension
11+
{
12+
/**
13+
* {@inheritdoc}
14+
*/
15+
public function load(array $config, ContainerBuilder $container)
16+
{
17+
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
18+
$loader->load('services.yml');
19+
}
20+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?php
2+
3+
namespace Marello\Bridge\MarelloOroCommerceApi;
4+
5+
use Symfony\Component\HttpKernel\Bundle\Bundle;
6+
7+
class MarelloOroCommerceApiBridgeBundle extends Bundle
8+
{
9+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
api:
2+
entities:
3+
Extend\Entity\EV_Order_Internal_Status:
4+
actions:
5+
get: true
6+
get_list: true
7+
create: false
8+
delete: false
9+
delete_list: false
10+
update: false
11+
Oro\Bundle\EntityConfigBundle\Attribute\Entity\AttributeFamily:
12+
filters:
13+
fields:
14+
entityClass:
15+
data_type: string
16+
Oro\Bundle\OrderBundle\Entity\Order:
17+
filters:
18+
fields:
19+
currency:
20+
data_type: string
21+
updatedAt:
22+
data_type: datetime
23+
Oro\Bundle\PaymentBundle\Entity\PaymentStatus:
24+
actions:
25+
delete: false
26+
delete_list: false
27+
filters:
28+
fields:
29+
entityIdentifier:
30+
data_type: string
31+
entityClass:
32+
data_type: string
33+
Oro\Bundle\TaxBundle\Entity\CustomerTaxCode:
34+
actions:
35+
create: false
36+
delete: false
37+
delete_list: false
38+
update: false
39+
Oro\Bundle\TaxBundle\Entity\ProductTaxCode:
40+
actions:
41+
create: true
42+
delete: true
43+
update: true
44+
Oro\Bundle\TaxBundle\Entity\TaxJurisdiction: ~
45+
Oro\Bundle\TaxBundle\Entity\ZipCode: ~
46+
Oro\Bundle\TaxBundle\Entity\Tax: ~
47+
Oro\Bundle\TaxBundle\Entity\TaxRule: ~
48+
Oro\Bundle\TaxBundle\Entity\TaxValue:
49+
actions:
50+
create: false
51+
delete: false
52+
delete_list: false
53+
update: false
54+
filters:
55+
fields:
56+
entityId:
57+
data_type: string
58+
updatedAt:
59+
data_type: datetime
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
bundles:
2+
- { name: Marello\Bridge\MarelloOroCommerceApi\MarelloOroCommerceApiBridgeBundle, priority: 60 }
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
services:
2+
marello_commerce_bridge.workflow.action.send_email_template.marello_decorator:
3+
class: 'Marello\Bridge\MarelloOroCommerceApi\Workflow\Action\SendEmailTemplateMarelloDecorator'
4+
public: false
5+
decorates: oro_email.workflow.action.send_email_template
6+
arguments:
7+
- '@marello_commerce_bridge.workflow.action.send_email_template.marello_decorator.inner'
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
<?php
2+
3+
namespace Marello\Bridge\MarelloOroCommerceApi\Workflow\Action;
4+
5+
use Oro\Component\Action\Action\ActionInterface;
6+
use Oro\Component\ConfigExpression\ExpressionInterface;
7+
8+
class SendEmailTemplateMarelloDecorator implements ActionInterface
9+
{
10+
/**
11+
* @var string
12+
*/
13+
private $template;
14+
15+
/**
16+
* @var ActionInterface
17+
*/
18+
private $originalAction;
19+
20+
public function __construct(ActionInterface $originalAction)
21+
{
22+
$this->originalAction = $originalAction;
23+
}
24+
25+
/**
26+
* {@inheritdoc}
27+
*/
28+
public function execute($context)
29+
{
30+
if ($this->template !== 'order_confirmation_email') {
31+
$this->originalAction->execute($context);
32+
}
33+
}
34+
35+
/**
36+
* {@inheritdoc}
37+
*/
38+
public function initialize(array $options)
39+
{
40+
if (!empty($options['template'])) {
41+
$this->template = $options['template'];
42+
}
43+
44+
return $this->originalAction->initialize($options);
45+
}
46+
47+
/**
48+
* {@inheritdoc}
49+
*/
50+
public function setCondition(ExpressionInterface $condition)
51+
{
52+
$this->originalAction->setCondition($condition);
53+
}
54+
}

0 commit comments

Comments
 (0)