Skip to content

Commit

Permalink
minor #325 [Maintenance] Update README (GSadee)
Browse files Browse the repository at this point in the history
This PR was merged into the 1.0-dev branch.

Discussion
----------



Commits
-------

466ddd7 [Maintenance] Update screenshots in README
3272bc5 [Maintenance] Update README and installation guides
  • Loading branch information
AdamKasp authored Jul 14, 2021
2 parents a0f10ec + 3272bc5 commit 350b689
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 132 deletions.
85 changes: 15 additions & 70 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@

![Screenshot showing order's refund section](docs/refunds.png)

![Screenshot showing order's credit memos and refund payments](docs/credit_memo.png)
![Screenshot showing order's credit memos and refund payments](docs/credit_memo_refund_payment.png)

![Screenshot showing credit memo details page](docs/credit_memo.png)

## Business value

Expand All @@ -39,79 +41,23 @@ It is used by `KnpSnappyBundle` and can be configured according to [their documm
1. Require plugin with composer:

```bash
composer require sylius/refund-plugin:1.0.0-RC.9
composer require sylius/refund-plugin
```

> Remember to allow community recipes with `composer config extra.symfony.allow-contrib true` or during plugin installation process

2. Apply migration to your database:
1. Apply migration to your database:

```bash
bin/console doctrine:migrations:migrate
```

3. Copy Sylius templates overridden in plugin to your templates directory (e.g `templates/bundles/`):
1. Copy Sylius templates overridden in plugin to your templates directory (e.g `templates/bundles/`):

```bash
mkdir -p templates/bundles/SyliusAdminBundle/
cp -R vendor/sylius/refund-plugin/src/Resources/views/SyliusAdminBundle/* templates/bundles/SyliusAdminBundle/
```

4. If you use Sylius v1.8 you also need to change files `src/Entity/Shipping/Shipment.php` and `src/Entity/Order/Adjustment.php` to use proper traits and interfaces:

```php
<?php
declare(strict_types=1);
namespace App\Entity\Order;
use Doctrine\ORM\Mapping as ORM;
use Sylius\Component\Order\Model\Adjustment as BaseAdjustment;
use Sylius\RefundPlugin\Entity\AdjustmentInterface as RefundAdjustmentInterface;
use Sylius\RefundPlugin\Entity\AdjustmentTrait;
/**
* @ORM\Entity
* @ORM\Table(name="sylius_adjustment")
*/
class Adjustment extends BaseAdjustment implements RefundAdjustmentInterface
{
use AdjustmentTrait;
}
```

```php
<?php
declare(strict_types=1);
namespace App\Entity\Shipping;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM;
use Sylius\Component\Core\Model\AdjustmentInterface as BaseAdjustmentInterface;
use Sylius\Component\Core\Model\Shipment as BaseShipment;
use Sylius\RefundPlugin\Entity\ShipmentTrait;
use Sylius\RefundPlugin\Entity\ShipmentInterface as RefundShipmentInterface;
/**
* @ORM\Entity
* @ORM\Table(name="sylius_shipment")
*/
class Shipment extends BaseShipment implements RefundShipmentInterface
{
use ShipmentTrait;
public function __construct()
{
parent::__construct();
/** @var ArrayCollection<array-key, BaseAdjustmentInterface> $this->adjustments */
$this->adjustments = new ArrayCollection();
}
}
```

#### Beware!

Expand Down Expand Up @@ -149,13 +95,12 @@ In case your custom refund logic allows a different type of gateway (for example
as shown below:
```yaml
# config/services.yaml
parameters:
sylius_refund.supported_gateways:
- offline
- stripe
# config/services.yaml
parameters:
sylius_refund.supported_gateways:
- offline
- stripe
```
Online refund logic should be implemented if you need it.
Expand All @@ -171,9 +116,9 @@ fails, related **CreditMemo** should not be created as well.
a service implementing `Sylius\RefundPlugin\ProcessManager\UnitsRefundedProcessStepInterface`, and register if with proper tag:

```yaml
App\ProcessManager\CustomAfterRefundProcessManager:
tags:
- { name: sylius_refund.units_refunded.process_step, priority: 0 }
App\ProcessManager\CustomAfterRefundProcessManager:
tags:
- { name: sylius_refund.units_refunded.process_step, priority: 0 }
```
Tagged services would be executed according to their priority (descending).
Expand Down
Binary file modified docs/credit_memo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/credit_memo_refund_payment.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
68 changes: 6 additions & 62 deletions docs/legacy_installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@

1. Require plugin with composer:

```bash
composer require sylius/refund-plugin:1.0.0-RC.7
```
```bash
composer require sylius/refund-plugin
```

1. Add plugin class and other required bundles to your `AppKernel`:
1. Add plugin class and other required bundles to your `config/bundles.php`:

```php
$bundles = [
new \Knp\Bundle\SnappyBundle\KnpSnappyBundle(),
new \Sylius\RefundPlugin\SyliusRefundPlugin(),
new \Knp\Bundle\SnappyBundle\KnpSnappyBundle(),
new \Sylius\RefundPlugin\SyliusRefundPlugin(),
];
```

Expand Down Expand Up @@ -51,62 +51,6 @@
cp -R vendor/sylius/refund-plugin/src/Resources/views/SyliusAdminBundle/* templates/bundles/SyliusAdminBundle/
```

1. If you use Sylius v1.8 you also need to change files `src/Entity/Shipping/Shipment.php` and `src/Entity/Order/Adjustment.php` to use proper traits and interfaces:
```php
<?php
declare(strict_types=1);
namespace App\Entity\Order;
use Doctrine\ORM\Mapping as ORM;
use Sylius\Component\Order\Model\Adjustment as BaseAdjustment;
use Sylius\RefundPlugin\Entity\AdjustmentInterface as RefundAdjustmentInterface;
use Sylius\RefundPlugin\Entity\AdjustmentTrait;
/**
* @ORM\Entity
* @ORM\Table(name="sylius_adjustment")
*/
class Adjustment extends BaseAdjustment implements RefundAdjustmentInterface
{
use AdjustmentTrait;
}
```
```php
<?php
declare(strict_types=1);
namespace App\Entity\Shipping;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM;
use Sylius\Component\Core\Model\AdjustmentInterface as BaseAdjustmentInterface;
use Sylius\Component\Core\Model\Shipment as BaseShipment;
use Sylius\RefundPlugin\Entity\ShipmentTrait;
use Sylius\RefundPlugin\Entity\ShipmentInterface as RefundShipmentInterface;
/**
* @ORM\Entity
* @ORM\Table(name="sylius_shipment")
*/
class Shipment extends BaseShipment implements RefundShipmentInterface
{
use ShipmentTrait;
public function __construct()
{
parent::__construct();
/** @var ArrayCollection<array-key, BaseAdjustmentInterface> $this->adjustments */
$this->adjustments = new ArrayCollection();
}
}
```
1. Clear cache:

```bash
Expand Down
Binary file modified docs/refunds.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 350b689

Please sign in to comment.