public function tearDown() { parent::tearDown(); $this->vendorManager->checkProphecyMethodsPredictions(); $this->operationManager->checkProphecyMethodsPredictions(); $this->hipay->checkProphecyMethodsPredictions(); $this->mirakl->checkProphecyMethodsPredictions(); $this->documentManager->checkProphecyMethodsPredictions(); }
/** * Fetch the operation to transfer from the storage * @return OperationInterface[] */ protected function getTransferableOperations() { $previousDay = new DateTime('-1 day'); //Transfer $toTransfer = $this->operationManager->findByStatus(new Status(Status::CREATED)); $toTransfer = array_merge($toTransfer, $this->operationManager->findByStatusAndBeforeUpdatedAt(new Status(Status::TRANSFER_FAILED), $previousDay)); return $toTransfer; }
/** * Validate an operation * * @param OperationInterface $operation * * @return bool */ public function isOperationValid(OperationInterface $operation) { try { if ($this->operationManager->findByMiraklIdAndPaymentVoucherNumber($operation->getMiraklId(), $operation->getPaymentVoucher())) { throw new AlreadyCreatedOperationException($operation); } if (!$this->operationManager->isValid($operation)) { throw new InvalidOperationException($operation); } ModelValidator::validate($operation); } catch (Exception $e) { $this->handleException($e); return false; } return true; }
/** * @param int $withdrawalId * @param int $hipayId * @param DateTime $date * @param bool $status * * @throws Exception */ protected function withdrawalValidation($hipayId, DateTime $date, $withdrawalId, $status) { $operation = $this->operationManager->findByWithdrawalId($withdrawalId); if (!$operation) { throw new OperationNotFound($withdrawalId); } if ($operation->getStatus() != Status::WITHDRAW_REQUESTED) { throw new WrongOperationStatus($operation); } if ($status) { $operation->setStatus(new Status(Status::WITHDRAW_SUCCESS)); $this->logger->info("Withdraw {$operation->getWithdrawId()} successful"); $eventName = 'withdraw.notification.success'; } else { $operation->setStatus(new Status(Status::WITHDRAW_CANCELED)); $this->logger->info("Withdraw {$operation->getWithdrawId()} canceled"); $eventName = 'withdraw.notification.canceled'; } $this->operationManager->save($operation); $event = new Withdraw($hipayId, $date, $operation); $this->dispatcher->dispatch($eventName, $event); }