Skip to content

Commit

Permalink
Drop unused order sm transtion to fully refunded
Browse files Browse the repository at this point in the history
  • Loading branch information
Dmitri Perunov committed Nov 25, 2020
1 parent 02d9399 commit d344bd8
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 50 deletions.
25 changes: 0 additions & 25 deletions spec/CommandHandler/RefundUnitsHandlerSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,31 +61,6 @@ function it_handles_command_and_create_refund_for_each_refunded_unit(
$this(new RefundUnits('000222', $unitRefunds, $shipmentRefunds, 1, 'Comment'));
}

function it_changes_order_state_to_fully_refunded_when_whole_order_total_is_refunded(
RefunderInterface $orderItemUnitsRefunder,
RefunderInterface $orderShipmentsRefunder,
MessageBusInterface $eventBus,
OrderRepositoryInterface $orderRepository,
RefundUnitsCommandValidatorInterface $refundUnitsCommandValidator,
OrderInterface $order
): void {
$unitRefunds = [new OrderItemUnitRefund(1, 1000), new OrderItemUnitRefund(3, 500)];
$shipmentRefunds = [new ShipmentRefund(3, 500), new ShipmentRefund(4, 1000)];

$orderItemUnitsRefunder->refundFromOrder($unitRefunds, '000222')->willReturn(1000);
$orderShipmentsRefunder->refundFromOrder($shipmentRefunds, '000222')->willReturn(500);

$orderRepository->findOneByNumber('000222')->willReturn($order);
$order->getCurrencyCode()->willReturn('USD');

$refundUnitsCommandValidator->validate(Argument::type(RefundUnits::class))->shouldBeCalled();

$event = new UnitsRefunded('000222', $unitRefunds, $shipmentRefunds, 1, 1500, 'USD', 'Comment');
$eventBus->dispatch($event)->willReturn(new Envelope($event))->shouldBeCalled();

$this(new RefundUnits('000222', $unitRefunds, $shipmentRefunds, 1, 'Comment'));
}

function it_throws_an_exception_if_order_is_not_available_for_refund(
RefundUnitsCommandValidatorInterface $refundUnitsCommandValidator
): void {
Expand Down
7 changes: 0 additions & 7 deletions src/Resources/config/app/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,6 @@ framework:
default_middleware: allow_no_handlers

winzou_state_machine:
sylius_order:
states:
fully_refunded: ~
transitions:
refund:
from: [new, fulfilled]
to: fully_refunded
sylius_refund_refund_payment:
class: Sylius\RefundPlugin\Entity\RefundPayment
property_path: state
Expand Down
18 changes: 0 additions & 18 deletions src/StateResolver/OrderTransitions.php

This file was deleted.

0 comments on commit d344bd8

Please sign in to comment.