Skip to content

Commit

Permalink
Merge pull request #2 from Vendic/develop
Browse files Browse the repository at this point in the history
Renamed package to VueStorefront/CartSync
  • Loading branch information
Tjitse-E committed Feb 8, 2019
2 parents 74e6488 + 0a6c6a1 commit 635825d
Show file tree
Hide file tree
Showing 17 changed files with 92 additions and 147 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
.idea/*
.php_cs.cache
.idea/*
*~
15 changes: 5 additions & 10 deletions Controller/Cart/Sync.php
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
<?php
/**
* @package Divante\CartSync
* @author Mateusz Bukowski <[email protected]>
* @copyright 2018 Divante Sp. z o.o.
* @license See LICENSE_DIVANTE.txt for license details.
*/
declare(strict_types=1);

namespace Divante\CartSync\Controller\Cart;
namespace VueStorefront\CartSync\Controller\Cart;

use Divante\CartSync\Model\Config;
use Divante\CartSync\Service\SyncInterface;
use Divante\CartSync\Service\SyncLoggerFactory;
use VueStorefront\CartSync\Model\Config;
use VueStorefront\CartSync\Service\SyncInterface;
use VueStorefront\CartSync\Service\SyncLoggerFactory;
use Magento\Customer\Api\CustomerRepositoryInterface;
use Magento\Customer\Model\Session as CustomerSession;
use Magento\Framework\App\Action\Action;
Expand Down
25 changes: 21 additions & 4 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,21 @@
Copyright (c) 2018 Divante Sp. z o.o. http://divante.co
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
MIT License

Copyright (c) 2018 Divante Ltd.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
2 changes: 1 addition & 1 deletion Model/Config.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
declare(strict_types=1);

namespace Divante\CartSync\Model;
namespace VueStorefront\CartSync\Model;

use Magento\Framework\App\Config\ScopeConfigInterface;
use Magento\Store\Model\ScopeInterface;
Expand Down
13 changes: 4 additions & 9 deletions Observer/SuccessObserver.php
Original file line number Diff line number Diff line change
@@ -1,20 +1,15 @@
<?php
/**
* @package Divante\CartSync
* @author Maciej Daniłowicz <mdanił[email protected]>
* @copyright 2018 Divante Sp. z o.o.
* @license See LICENSE_DIVANTE.txt for license details.
*/
declare(strict_types=1);

namespace Divante\CartSync\Observer;
namespace VueStorefront\CartSync\Observer;

use Divante\CartSync\Model\Config;
use VueStorefront\CartSync\Model\Config;
use Magento\Framework\Event\ObserverInterface;

/**
* Class SuccessObserver
*
* @package Divante\CartSync\Observer
* @package VueStorefront\CartSync\Observer
*/
class SuccessObserver implements ObserverInterface
{
Expand Down
22 changes: 14 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,27 @@

This Magento extension allow You to merge given shopping cart with current's user session. It performs a auto-login if user-token provided.

This module is designed to work with: [Vue Storefront External Checkout](https://github.com/filrak/vsf-external-checkout).
This module is designed to work with: [Vue Storefront External Checkout](https://github.com/Vendic/vsf-external-checkout).

This extension allows the user to start the session within the Vue Storefront shop and finalize the order in Magento2. It's great when You have very extended/customized Magento checkout which will be hard to port to Vue Storefront.

![External checkout for Vue Storefront](https://github.com/filrak/vsf-external-checkout/raw/master/diagram.png)
![External checkout for Vue Storefront](https://raw.githubusercontent.com/Vendic/vsf-external-checkout/master/media/diagram.png)

## Demo
You can check this extension in action on: https://demo-magento-checkout.vuestorefront.io
Please add some items to the cart and then go to **Cart -> Go to chechkout**. You will be redirected to the [Magento2 instance](http://demo-magento2.vuestorefront.io/) synchronized with the [Vue Storefront instance](demo-magento-checkout.vuestorefront.io). Shopping carts, logged in user, totals, item prices - should be alligned.
### Demo
[A demo is not yet available.](https://github.com/Vendic/magento2-external-checkout/issues/1)

### Compatibility
- Magento 2.2 or Magento 2.3

## Installation guide
### Prerequisites (the Vue Storefront part)
1. Integrate Your Magento2 instance with Vue Storefront: [tutorial](https://medium.com/@piotrkarwatka/vue-storefront-cart-totals-orders-integration-with-magento2-6fbe6860fcd), [video tutorial](https://www.youtube.com/watch?v=CtDXddsyxvM)
2. Install [Vue Storefront External Checkout](https://github.com/Vendic/vsf-external-checkout) on your Vue Storefront instance

0. Integrate Your Magento2 instance with Vue Storefront: [tutorial](https://medium.com/@piotrkarwatka/vue-storefront-cart-totals-orders-integration-with-magento2-6fbe6860fcd), [video tutorial](https://www.youtube.com/watch?v=CtDXddsyxvM)
1. Copy the module files from the repo to `app/code/Divante/CartSync`
### Installation guide (the Magento 2 part)
1. Install the module with composer:
```bash
composer require vuestorefront/magento2-vue-cart-sync
```
3. Run `php bin/magento setup:upgrade`
4. Please install the [`vsf-external-checkout`](https://github.com/filrak/vsf-external-checkout) module for Vue Storefront. [See the instruction](https://github.com/filrak/vsf-external-checkout).
5. Go to: Stores -> Configuration | VueStorefront -> External Checkout and set URL
Expand Down
12 changes: 3 additions & 9 deletions Service/Sync.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
<?php
/**
* @package Divante\CartSync
* @author Mateusz Bukowski <[email protected]>
* @copyright 2018 Divante Sp. z o.o.
* @license See LICENSE_DIVANTE.txt for license details.
*/
declare(strict_types=1);

namespace Divante\CartSync\Service;
namespace VueStorefront\CartSync\Service;

use Magento\Checkout\Model\Session;
use Magento\Customer\Api\CustomerRepositoryInterface;
Expand Down Expand Up @@ -82,8 +77,7 @@ public function __construct(
QuoteIdMaskFactory $quoteIdMaskFactory,
QuoteFactory $quoteFactory,
QuoteRepository $quoteRepository
)
{
) {
$this->cartRepository = $cartRepository;
$this->checkoutSession = $checkoutSession;
$this->customerRepository = $customerRepository;
Expand Down
9 changes: 2 additions & 7 deletions Service/SyncInterface.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
<?php
/**
* @package Divante\CartSync
* @author Mateusz Bukowski <[email protected]>
* @copyright 2018 Divante Sp. z o.o.
* @license See LICENSE_DIVANTE.txt for license details.
*/
declare(strict_types=1);

namespace Divante\CartSync\Service;
namespace VueStorefront\CartSync\Service;

/**
* Interface SyncInterface
Expand Down
11 changes: 2 additions & 9 deletions Service/SyncLoggerFactory.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
<?php
/**
* @package Divante\CartSync
* @author Mateusz Bukowski <[email protected]>
* @copyright 2018 Divante Sp. z o.o.
* @license See LICENSE_DIVANTE.txt for license details.
*/
declare(strict_types=1);

namespace Divante\CartSync\Service;
namespace VueStorefront\CartSync\Service;

use Monolog\Handler\StreamHandler;
use Monolog\Logger;
Expand All @@ -24,9 +19,7 @@ class SyncLoggerFactory

/**
* @param string $channelName
*
* @return Logger
*
* @throws \Exception
*/
public function create(string $channelName = 'cart-sync'): Logger
Expand Down
30 changes: 13 additions & 17 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,36 +1,32 @@
{
"name": "divante/magento2-vue-cart-sync",
"name": "vuestorefront/magento2-vue-cart-sync",
"description": "Synchronize Magento cart between Vue Storefront",
"require": {
"php": "7.0.2|7.0.4|~7.0.6|~7.1.0",
"magento/module-store": "100.2.*",
"magento/module-customer": "101.0.*",
"magento/module-authorization": "100.2.*",
"magento/module-checkout": "100.2.*",
"magento/module-backend": "100.2.*",
"magento/module-eav": "101.0.*",
"magento/module-config": "101.0.*",
"magento/framework": "101.0.*",
"magento/module-quote": "101.0.*"
"php": "~/7.1|~7.2",
"magento/magento2-base": "~2.2|~2.3"
},
"type": "magento2-module",
"version": "1.0.0",
"license": [
"OSL-3.0",
"AFL-3.0"
],
"version": "2.0.0",
"license": "MIT",
"authors": [
{
"name": "Mateusz Bukowski",
"email": "[email protected]"
},
{
"name": "Tjitse Efde",
"email": "[email protected]"
}
],
"autoload": {
"files": [
"registration.php"
],
"psr-4": {
"Divante\\CartSync\\": ""
"VueStorefront\\CartSync\\": ""
}
},
"suggest": {
"vendic/magento2-checkoutonly": "A module that enables you to limit access only the Magento checkout. Usefull for a PWA setup that uses the default Magento 2 checkout"
}
}
13 changes: 3 additions & 10 deletions etc/acl.xml
Original file line number Diff line number Diff line change
@@ -1,17 +1,10 @@
<?xml version="1.0" ?>
<!--
/**
* @author       Maciej Daniłowicz <[email protected]>
* @package       Divante/CartSync
* @copyright      Copyright(C) 2018 Divante
* @license       See LICENSE.txt for license details.
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Acl/etc/acl.xsd">
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:Acl/etc/acl.xsd">
<acl>
<resources>
<resource id="Magento_Backend::admin">
<resource id="Divante_CartSync::configuration" title="VueStorefront external checkout" />
<resource id="VueStorefront_CartSync::configuration" title="VueStorefront external checkout"/>
</resource>
</resources>
</acl>
Expand Down
16 changes: 4 additions & 12 deletions etc/adminhtml/system.xml
Original file line number Diff line number Diff line change
@@ -1,12 +1,4 @@
<?xml version="1.0" ?>
<!--
/**
* @author       Maciej Daniłowicz <[email protected]>
* @package       Divante/CartSync
* @copyright      Copyright(C) 2018 Divante
* @license       See LICENSE.txt for license details.
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd">
<system>
Expand All @@ -17,24 +9,24 @@
showInWebsite="1" showInStore="1">
<label>External Checkout</label>
<tab>vuestorefront_config</tab>
<resource>Divante_CartSync::configuration</resource>
<resource>VueStorefront_CartSync::configuration</resource>
<group id="externalcheckout_general" translate="label" type="text" sortOrder="1" showInDefault="1"
showInWebsite="1" showInStore="1">
<label>General</label>
<field id="externalcheckout_link" translate="label" sortOrder="1" type="text" showInDefault="1"
showInWebsite="1" showInStore="1">
<label>VueStorefront succespage</label>
<comment>After a transaction, we will redirect the traffic to this URL. For example
<comment>After a transaction, we will redirect the traffic to this URL. For example:
'https://demo.vuestorefront.io/succespage'
</comment>
</field>
<field id="checkout_path" translate="label" sortOrder="1" type="text" showInDefault="1"
showInWebsite="1" showInStore="1">
<label>Checkout path</label>
<comment>We will redirect the traffic from VueStorefront to this path. For example 'checkout/cart'
<comment>We will redirect the traffic from VueStorefront to this path. For example 'checkout/cart' or 'checkout'
</comment>
</field>
</group>
</section>
</system>
</config>
</config>
16 changes: 5 additions & 11 deletions etc/di.xml
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?><!--
/**
* @author       Mateusz Bukowski
* @package       Divante/CartSync
* @copyright      Copyright(C) 2018 Divante
* @license       See LICENSE.txt for license details.
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<preference for="Divante\CartSync\Service\SyncInterface" type="Divante\CartSync\Service\Sync"/>
</config>
<?xml version="1.0" encoding="UTF-8" ?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<preference for="VueStorefront\CartSync\Service\SyncInterface" type="VueStorefront\CartSync\Service\Sync"/>
</config>
15 changes: 4 additions & 11 deletions etc/events.xml
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
<?xml version="1.0" ?>
<!--
/**
* @author       Maciej Daniłowicz <[email protected]>
* @package       Divante/CartSync
* @copyright      Copyright(C) 2018 Divante
* @license       See LICENSE.txt for license details.
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
<event name="checkout_onepage_controller_success_action">
<observer name="successObserver" instance="Divante\CartSync\Observer\SuccessObserver" />
<observer name="successObserver" instance="VueStorefront\CartSync\Observer\SuccessObserver"/>
</event>
</config>
</config>
14 changes: 4 additions & 10 deletions etc/frontend/routes.xml
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@
<?xml version="1.0"?><!--
/**
* @package Divante_CartSync
* @author Mateusz Bukowski <[email protected]>
* @copyright 2018 Divante Sp. z o.o.
* @license See LICENSE_DIVANTE.txt for license details.
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd">
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd">
<router id="standard">
<route id="vue" frontName="vue">
<module name="Divante_CartSync"/>
<module name="VueStorefront_CartSync"/>
</route>
</router>
</config>
13 changes: 3 additions & 10 deletions etc/module.xml
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
<?xml version="1.0"?>
<!--
/**
* @author       Mateusz Bukowski
* @package       Divante/CartSync
* @copyright      Copyright(C) 2018 Divante
* @license       See LICENSE.txt for license details.
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Divante_CartSync" setup_version="1.0.0"/>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="VueStorefront_CartSync" setup_version="1.0.0"/>
</config>
9 changes: 1 addition & 8 deletions registration.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
<?php
/**
* @author       Wojtek Brożyna
* @package       Addwish\Awext 
* @copyright      Copyright(C) 2018 Addwish
* @license       See LICENSE.txt for license details.
*/

\Magento\Framework\Component\ComponentRegistrar::register(
\Magento\Framework\Component\ComponentRegistrar::MODULE,
'Divante_CartSync',
'VueStorefront_CartSync',
__DIR__
);

0 comments on commit 635825d

Please sign in to comment.