Skip to content

Commit

Permalink
PR review fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Zales0123 committed May 26, 2021
1 parent 7cf06b7 commit f12bc21
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 15 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,13 +167,13 @@ After units are refunded, there are multiple other processes that should be trig
**RefundPayment** generated. As they're strictly coupled with each other, **RefundPayment** is always created after the **CreditMemo**. Moreover, if **RefundPayment**
fails, related **CreditMemo** should not be created as well.

`\Sylius\RefundPlugin\ProcessManager\UnitsRefundedProcessManager` service facilitates the whole process. If you want to add one or more steps to it, you should create
a service implementing `\Sylius\RefundPlugin\ProcessManager\UnitsRefundedProcessStepInterface`, and register if with proper tag:
`Sylius\RefundPlugin\ProcessManager\UnitsRefundedProcessManager` service facilitates the whole process. If you want to add one or more steps to it, you should create
a service implementing `Sylius\RefundPlugin\ProcessManager\UnitsRefundedProcessStepInterface`, and register if with proper tag:

```xml
<service id="App\ProcessManager\CustomAfterRefundProcessManager">
<tag name="sylius_refund.units_refunded.process_step" priority="0" />
</service>
```yaml
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
8 changes: 4 additions & 4 deletions UPGRADE.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ is created by `Sylius\RefundPlugin\Factory\CreditMemoFactory`.
}
```

1. Post-units refunded process (containing credit memo and refund payment generation) was changed to synchronous step. Refund payment is therfore
1. Post-units refunded process (containing credit memo and refund payment generation) was changed to synchronous step. Refund payment is therefore
always generated after credit memo. Technical changes:
* `\Sylius\RefundPlugin\ProcessManager\CreditMemoProcessManager` and `\Sylius\RefundPlugin\ProcessManager\RefundPaymentProcessManager` no longer
directly listen to `\Sylius\RefundPlugin\Event\UnitsRefunded` event. `\Sylius\RefundPlugin\ProcessManager\UnitsRefundedProcessManager` uses them to
* `Sylius\RefundPlugin\ProcessManager\CreditMemoProcessManager` and `Sylius\RefundPlugin\ProcessManager\RefundPaymentProcessManager` no longer
directly listen to `Sylius\RefundPlugin\Event\UnitsRefunded` event. `Sylius\RefundPlugin\ProcessManager\UnitsRefundedProcessManager` uses them to
facilitate post-units refunding process.
* Their `__invoke` methods were replaced by `\Sylius\RefundPlugin\ProcessManager\UnitsRefundedProcessStepInterface::next(UnitsRefunded $unitsRefunded)`.
* Their `__invoke` methods were replaced by `Sylius\RefundPlugin\ProcessManager\UnitsRefundedProcessStepInterface::next(UnitsRefunded $unitsRefunded)`.

### UPGRADE FROM 1.0.0-RC.7 TO 1.0.0-RC.8

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
@refunds
Feature: Not seeing refund payments and credit memos on admin order view
In order to be prevented from having incorrectly generated credit memos or refund payments
In order to have consistent documents and payment in a refunded order
As an Administrator
I want not to see them if process fails on any step
I don't want to have a credit memo or refund payment generated alone

Background:
Given the store operates on a single green channel in "United States"
Expand All @@ -22,12 +22,12 @@ Feature: Not seeing refund payments and credit memos on admin order view
And I decided to refund 1st "Mr. Meeseeks T-Shirt" product of the order "00000023" with "Space money" payment
When I view the summary of the order "#00000023"
Then I should not see any refund payments
Then I should not see any credit memos
And I should not see any credit memos

@ui
Scenario: Not seeing credit memo and refund payment on order view if refund generation failed
Given the refund payment generation is broken
And I decided to refund 1st "Mr. Meeseeks T-Shirt" product of the order "00000023" with "Space money" payment
When I view the summary of the order "#00000023"
Then I should not see any refund payments
Then I should not see any credit memos
And I should not see any credit memos
2 changes: 1 addition & 1 deletion tests/Behat/Context/Setup/RefundingContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ public function shipmentFromOrderHasAlreadyRefundedWithPayment(
*/
public function theCreditMemoGenerationIsBroken(): void
{
$this->failedCreditMemoGenerator->failCreditMemoGeneration();;
$this->failedCreditMemoGenerator->failCreditMemoGeneration();
}

/**
Expand Down
4 changes: 4 additions & 0 deletions tests/Behat/Services/Factory/FailedRefundPaymentFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ final class FailedRefundPaymentFactory implements RefundPaymentFactoryInterface
public function __construct(RefundPaymentFactoryInterface $baseRefundPaymentFactory)
{
$this->baseRefundPaymentFactory = $baseRefundPaymentFactory;

if (file_exists(self::FAILED_FILE)) {
unlink(self::FAILED_FILE);
}
}

public function createWithData(
Expand Down
4 changes: 4 additions & 0 deletions tests/Behat/Services/Generator/FailedCreditMemoGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ final class FailedCreditMemoGenerator implements CreditMemoGeneratorInterface
public function __construct(CreditMemoGeneratorInterface $baseCreditMemoGenerator)
{
$this->baseCreditMemoGenerator = $baseCreditMemoGenerator;

if (file_exists(self::FAILED_FILE)) {
unlink(self::FAILED_FILE);
}
}

public function generate(
Expand Down

0 comments on commit f12bc21

Please sign in to comment.