/**
  * @param TakePaymentCommand $command
  *
  * @return Payment
  */
 protected function convertCommandToPayment(TakePaymentCommand $command)
 {
     $payment = Payment::createUnpaid($command->getCost(), $command->getToken(), $command->getDescription(), $command->getUserEmail(), $command->getMetaData());
     return $payment;
 }
 /**
  * @uses TakePaymentCommandHandler::__construct()
  */
 function let(ValidatorInterface $validator, EmitterInterface $emitter, TakePaymentCommand $command, Gateway $gateway, PurchaseRequest $purchaseRequest, Response $response, PaymentRepositoryInterface $repository)
 {
     // Command
     /** @noinspection PhpUndefinedMethodInspection */
     $command->getCost()->willReturn($this->cost);
     /** @noinspection PhpUndefinedMethodInspection */
     $command->getToken()->willReturn(self::TOKEN);
     /** @noinspection PhpUndefinedMethodInspection */
     $command->getDescription()->willReturn(self::DESCRIPTION);
     /** @noinspection PhpUndefinedMethodInspection */
     $command->getUserEmail()->willReturn($this->userEmail);
     /** @noinspection PhpUndefinedMethodInspection */
     $command->getMetaData()->willReturn($this->metadata);
     // Gateway request/response
     /** @noinspection PhpUndefinedMethodInspection */
     $gateway->purchase(Argument::any())->willReturn($purchaseRequest);
     /** @noinspection PhpUndefinedMethodInspection */
     $purchaseRequest->send()->willReturn($response);
     /** @noinspection PhpUndefinedMethodInspection */
     $response->isSuccessful()->willReturn(true);
     /** @noinspection PhpUndefinedMethodInspection */
     $response->getTransactionReference()->willReturn(self::STRIPE_PAYMENT_ID);
     /** @see TakePaymentCommandHandler::create() */
     /** @noinspection PhpMethodParametersCountMismatchInspection */
     $this->beConstructedThrough('create', [$validator, $emitter, $gateway, $repository]);
 }