-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BB-20150: Move the AlternativeCheckoutBundle to a separate package
- added the package directory, README, composer, etc.
- Loading branch information
0 parents
commit b097895
Showing
37 changed files
with
2,932 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
Please refer first to [UPGRADE.md](UPGRADE.md) for the most important items that should be addressed before attempting to upgrade or during the upgrade of a vanilla Oro application. | ||
|
||
The current file describes significant changes in the code that may affect the upgrade of your customizations. | ||
|
||
## 4.2.0 | ||
|
||
OroAlternativeCheckoutBundle has been moved from oro/commerce package to oro/commerce-demo-checkouts package. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
OroCommerce | ||
|
||
The Open Software License version 3.0 | ||
|
||
Copyright (c) 2020, Oro, Inc. | ||
|
||
Full license is at: http://opensource.org/licenses/OSL-3.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
OroCommerce Checkout Customization Examples | ||
=========================================== | ||
|
||
This package includes examples of OroCommerce storefront checkout customizations. | ||
|
||
OroAlternativeCheckoutBundle | ||
---------------------------- | ||
|
||
OroAlternativeCheckoutBundle adds review and approval steps to the checkout workflow in the OroCommerce storefront if the order amount exceeds the order approval threshold value set by an application administrator in the alternative checkout workflow configuration UI. | ||
|
||
Installation | ||
------------ | ||
|
||
This package can be added to an existing installation of an OroCommerce application. | ||
|
||
Use composer to add the package code: | ||
|
||
``` | ||
composer require oro/commerce-demo-checkouts | ||
``` | ||
|
||
Perform the installation: | ||
|
||
``` | ||
php bin/console oro:platform:update --env=prod | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
This file includes only the most important items that should be addressed before attempting to upgrade or during the upgrade of a vanilla Oro application. | ||
|
||
Please refer to [CHANGELOG.md](CHANGELOG.md) for a list of significant changes in the code that may affect the upgrade of some customizations. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
{ | ||
"name": "oro/commerce-demo-checkouts", | ||
"description": "OroCommerce checkout customization examples", | ||
"homepage": "https://github.com/oroinc/commerce-demo-checkouts", | ||
"license": "OSL-3.0", | ||
"authors": [ | ||
{ | ||
"name": "Oro, Inc", | ||
"homepage": "https://www.orocommerce.com" | ||
} | ||
], | ||
"autoload": { | ||
"psr-4": {"Oro\\Bundle\\AlternativeCheckoutBundle\\": "src/Oro/Bundle/AlternativeCheckoutBundle"}, | ||
"exclude-from-classmap": ["/Tests/"] | ||
}, | ||
"require": { | ||
"oro/commerce": "4.2.*" | ||
}, | ||
"repositories": { | ||
"oro": { | ||
"type": "composer", | ||
"url": "https://packagist.oroinc.com" | ||
} | ||
}, | ||
"minimum-stability": "dev", | ||
"prefer-stable": true, | ||
"extra": { | ||
"branch-alias": { | ||
"dev-master": "4.2-dev" | ||
} | ||
} | ||
} |
68 changes: 68 additions & 0 deletions
68
src/Oro/Bundle/AlternativeCheckoutBundle/Condition/OrderTotalLimit.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace Oro\Bundle\AlternativeCheckoutBundle\Condition; | ||
|
||
use Oro\Bundle\CheckoutBundle\DataProvider\Manager\CheckoutLineItemsManager; | ||
use Oro\Bundle\OrderBundle\Entity\Order; | ||
use Oro\Bundle\PricingBundle\SubtotalProcessor\TotalProcessorProvider; | ||
use Oro\Component\ConfigExpression\Condition\AbstractComparison; | ||
|
||
/** | ||
* Checks that order with subtotal exceeding the specified value. | ||
* | ||
* Usage: | ||
* '@less_order_total_limit': | ||
* - $checkout # any instance of the Checkout entity | ||
* - 5000 # the value of the order approval threshold | ||
*/ | ||
class OrderTotalLimit extends AbstractComparison | ||
{ | ||
private TotalProcessorProvider $totalsProvider; | ||
private CheckoutLineItemsManager $checkoutLineItemsManager; | ||
|
||
/** | ||
* @param TotalProcessorProvider $totalsProvider | ||
* @param CheckoutLineItemsManager $checkoutLineItemsManager | ||
*/ | ||
public function __construct( | ||
TotalProcessorProvider $totalsProvider, | ||
CheckoutLineItemsManager $checkoutLineItemsManager | ||
) { | ||
$this->totalsProvider = $totalsProvider; | ||
$this->checkoutLineItemsManager = $checkoutLineItemsManager; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getName(): string | ||
{ | ||
return 'less_order_total_limit'; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
protected function isConditionAllowed($context): bool | ||
{ | ||
return $this->doCompare( | ||
$this->resolveValue($context, $this->left), | ||
$this->resolveValue($context, $this->right) | ||
); | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
protected function doCompare($left, $right): bool | ||
{ | ||
$orderLineItems = $this->checkoutLineItemsManager->getData($left); | ||
$order = new Order(); | ||
$order->setLineItems($orderLineItems); | ||
|
||
$orderTotalAmount = $this->totalsProvider->enableRecalculation()->getTotal($order)->getAmount(); | ||
|
||
return $orderTotalAmount <= $right; | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
.../Bundle/AlternativeCheckoutBundle/DependencyInjection/OroAlternativeCheckoutExtension.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace Oro\Bundle\AlternativeCheckoutBundle\DependencyInjection; | ||
|
||
use Symfony\Component\Config\FileLocator; | ||
use Symfony\Component\DependencyInjection\ContainerBuilder; | ||
use Symfony\Component\DependencyInjection\Loader; | ||
use Symfony\Component\HttpKernel\DependencyInjection\Extension; | ||
|
||
/** | ||
* Loads service definitions. | ||
*/ | ||
class OroAlternativeCheckoutExtension extends Extension | ||
{ | ||
/** | ||
* {@inheritDoc} | ||
*/ | ||
public function load(array $configs, ContainerBuilder $container): void | ||
{ | ||
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config')); | ||
$loader->load('services.yml'); | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
src/Oro/Bundle/AlternativeCheckoutBundle/EventListener/QuantityToOrderConditionListener.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace Oro\Bundle\AlternativeCheckoutBundle\EventListener; | ||
|
||
use Oro\Bundle\InventoryBundle\EventListener\QuantityToOrderConditionListener as BaseListener; | ||
|
||
/** | ||
* Handles line items inventory validation events of the alternative checkout workflow. | ||
*/ | ||
class QuantityToOrderConditionListener extends BaseListener | ||
{ | ||
/** @var array */ | ||
protected const ALLOWED_WORKFLOWS = [ | ||
'b2b_flow_alternative_checkout', | ||
]; | ||
} |
46 changes: 46 additions & 0 deletions
46
...nativeCheckoutBundle/Migrations/Data/Demo/ORM/UpdateAlternativeCheckoutWorkflowStatus.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace Oro\Bundle\AlternativeCheckoutBundle\Migrations\Data\Demo\ORM; | ||
|
||
use Doctrine\Common\DataFixtures\AbstractFixture; | ||
use Doctrine\Common\DataFixtures\DependentFixtureInterface; | ||
use Doctrine\Persistence\ObjectManager; | ||
use Oro\Bundle\CustomerBundle\Migrations\Data\Demo\ORM\LoadCustomerDemoData; | ||
use Oro\Bundle\WorkflowBundle\Entity\WorkflowDefinition; | ||
use Symfony\Component\DependencyInjection\ContainerAwareInterface; | ||
use Symfony\Component\DependencyInjection\ContainerAwareTrait; | ||
|
||
/** | ||
* Aсtivates the alternative checkout workflow. | ||
*/ | ||
class UpdateAlternativeCheckoutWorkflowStatus extends AbstractFixture implements | ||
DependentFixtureInterface, | ||
ContainerAwareInterface | ||
{ | ||
use ContainerAwareTrait; | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getDependencies(): array | ||
{ | ||
return [LoadCustomerDemoData::class]; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function load(ObjectManager $manager): void | ||
{ | ||
/** @var WorkflowDefinition $workflowDefinition */ | ||
$workflowDefinition = $manager->getRepository('OroWorkflowBundle:WorkflowDefinition') | ||
->find('b2b_flow_alternative_checkout'); | ||
|
||
if (!$workflowDefinition) { | ||
return; | ||
} | ||
|
||
$this->container->get('oro_workflow.manager.system')->activateWorkflow($workflowDefinition->getName()); | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
...ro/Bundle/AlternativeCheckoutBundle/Migrations/Data/Demo/ORM/data/acme_frontend_roles.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
ACME_BUYER: | ||
permissions: | ||
action|oro_alternativecheckout_checkout_approve: [NONE] | ||
workflow|b2b_flow_alternative_checkout: [VIEW_WORKFLOW_BASIC, PERFORM_TRANSITIONS_BASIC] | ||
|
||
ACME_ADMINISTRATOR: | ||
permissions: | ||
workflow|b2b_flow_alternative_checkout: [VIEW_WORKFLOW_DEEP, PERFORM_TRANSITIONS_DEEP] | ||
|
||
ACME_ANONYMOUS: | ||
permissions: | ||
workflow|b2b_flow_alternative_checkout: [VIEW_WORKFLOW_BASIC, PERFORM_TRANSITIONS_BASIC] |
30 changes: 30 additions & 0 deletions
30
src/Oro/Bundle/AlternativeCheckoutBundle/Migrations/Data/ORM/UpdateWorkflowsPermissions.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace Oro\Bundle\AlternativeCheckoutBundle\Migrations\Data\ORM; | ||
|
||
use Oro\Bundle\CustomerBundle\Migrations\Data\ORM\AbstractMassUpdateCustomerUserRolePermissions; | ||
|
||
/** | ||
* Update workflow default permissions for predefined roles. | ||
*/ | ||
class UpdateWorkflowsPermissions extends AbstractMassUpdateCustomerUserRolePermissions | ||
{ | ||
/** | ||
* {@inheritdoc} | ||
*/ | ||
protected function getACLData(): array | ||
{ | ||
return [ | ||
'ROLE_FRONTEND_ADMINISTRATOR' => [ | ||
'workflow:b2b_flow_alternative_checkout' => ['VIEW_WORKFLOW_DEEP', 'PERFORM_TRANSITIONS_DEEP'] | ||
], | ||
'ROLE_FRONTEND_BUYER' => [ | ||
'workflow:b2b_flow_alternative_checkout' => ['VIEW_WORKFLOW_BASIC', 'PERFORM_TRANSITIONS_BASIC'] | ||
], | ||
'ROLE_FRONTEND_ANONYMOUS' => [ | ||
'workflow:b2b_flow_alternative_checkout' => ['VIEW_WORKFLOW_BASIC', 'PERFORM_TRANSITIONS_BASIC'] | ||
] | ||
]; | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
src/Oro/Bundle/AlternativeCheckoutBundle/Migrations/Data/ORM/data/frontend_roles.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
BUYER: | ||
permissions: | ||
action|oro_alternativecheckout_checkout_approve: [NONE] | ||
workflow|b2b_flow_alternative_checkout: [VIEW_WORKFLOW_BASIC, PERFORM_TRANSITIONS_BASIC] | ||
|
||
ADMINISTRATOR: | ||
permissions: | ||
workflow|b2b_flow_alternative_checkout: [VIEW_WORKFLOW_DEEP, PERFORM_TRANSITIONS_DEEP] | ||
|
||
ANONYMOUS: | ||
permissions: | ||
workflow|b2b_flow_alternative_checkout: [VIEW_WORKFLOW_BASIC, PERFORM_TRANSITIONS_BASIC] |
26 changes: 26 additions & 0 deletions
26
...dle/AlternativeCheckoutBundle/Migrations/Schema/OroAlternativeCheckoutBundleInstaller.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace Oro\Bundle\AlternativeCheckoutBundle\Migrations\Schema; | ||
|
||
use Doctrine\DBAL\Schema\Schema; | ||
use Oro\Bundle\MigrationBundle\Migration\Installation; | ||
use Oro\Bundle\MigrationBundle\Migration\QueryBag; | ||
|
||
class OroAlternativeCheckoutBundleInstaller implements Installation | ||
{ | ||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getMigrationVersion(): string | ||
{ | ||
return 'v1_4'; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function up(Schema $schema, QueryBag $queries): void | ||
{ | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
src/Oro/Bundle/AlternativeCheckoutBundle/OroAlternativeCheckoutBundle.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace Oro\Bundle\AlternativeCheckoutBundle; | ||
|
||
use Symfony\Component\HttpKernel\Bundle\Bundle; | ||
|
||
/** | ||
* Bundle entry point | ||
*/ | ||
class OroAlternativeCheckoutBundle extends Bundle | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# OroAlternativeCheckoutBundle | ||
|
||
OroAlternativeCheckoutBundle adds seller approval steps to the checkout workflow in the OroCommerce storefront if the order amount exceeds the order approval threshold value set by an application administrator in the alternative checkout workflow configuration UI. | ||
|
||
Note: The checkout workflow in the OroCommerce storefront helps gather necessary information from the customer when they are creating a new order. |
6 changes: 6 additions & 0 deletions
6
src/Oro/Bundle/AlternativeCheckoutBundle/Resources/config/oro/acls.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
acls: | ||
oro_alternativecheckout_checkout_approve: | ||
label: oro.alternativecheckout.security.permission.checkout_approve | ||
type: action | ||
group_name: "commerce" | ||
category: "checkout" |
2 changes: 2 additions & 0 deletions
2
src/Oro/Bundle/AlternativeCheckoutBundle/Resources/config/oro/bundles.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
bundles: | ||
- { name: Oro\Bundle\AlternativeCheckoutBundle\OroAlternativeCheckoutBundle, priority: 60 } |
8 changes: 8 additions & 0 deletions
8
src/Oro/Bundle/AlternativeCheckoutBundle/Resources/config/oro/datagrids.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
datagrids: | ||
frontend-customer-user-shopping-lists-grid: | ||
action_configuration: | ||
b2b_flow_alternative_checkout_start_from_shoppinglist: false | ||
|
||
frontend-customer-user-shopping-list-select-grid: | ||
action_configuration: | ||
b2b_flow_alternative_checkout_start_from_shoppinglist: false |
Oops, something went wrong.