/**
  * @param TransferFundsRequest $request
  */
 public function transfer(TransferFundsRequest $request)
 {
     $fromMember = $this->members->with($request->fromMemberId());
     $toMember = $this->members->with($request->toMemberId());
     $fromMember->transfer($request->amount(), $toMember);
     $this->members->update($fromMember);
     $this->members->update($toMember);
     $this->publisher()->publish($fromMember->events());
     $this->notifier()->transferCompleted(new TransferFundsResponse($fromMember, $toMember));
 }
 function it_should_transfer_funds_between_accounts(Members $members, TransferFundsNotifier $notifier)
 {
     $fromMember = A::member()->withBalance(2000)->build();
     $toMember = A::member()->withBalance(1000)->build();
     $members->with($fromMember->information()->id())->willReturn($fromMember);
     $members->with($toMember->information()->id())->willReturn($toMember);
     $members->update($fromMember)->shouldBeCalled();
     $members->update($toMember)->shouldBeCalled();
     $this->beConstructedWith($members);
     $this->attach($notifier);
     $this->transfer(TransferFundsRequest::from(['fromMemberId' => (string) $fromMember->information()->id(), 'toMemberId' => (string) $toMember->information()->id(), 'amount' => 5]));
     $notifier->transferCompleted(Argument::type(TransferFundsResponse::class))->shouldHaveBeenCalled();
 }