protected function execute(InputInterface $input, OutputInterface $output) { try { $this->processor->recordVendor($input->getArgument(self::EMAIL), $input->getArgument(self::MIRAKLID)); } catch (\Exception $e) { $this->logger->critical($e->getMessage()); } }
public function execute(InputInterface $input, OutputInterface $output) { $io = new SymfonyStyle($input, $output); $pastDate = $input->getOption(self::PAST_DATE) ? new DateTime($input->getOption(self::PAST_DATE)) : null; $data = $this->vendorProcessor->getWallets($this->merchantGroupId, $pastDate); $io->title("Hipay Wallets"); $io->table(array_keys(reset($data)), $data); }
protected function execute(InputInterface $input, OutputInterface $output) { $inputedDate = $input->getArgument(self::LAST_UPDATE); $lastUpdate = $inputedDate ? new DateTime($inputedDate) : null; $this->logger->debug("Inputed last update {date}", array('date' => $lastUpdate)); $tmpPath = $input->getOption(self::TMP_PATH) ?: static::DEFAULT_TMP_PATH; $this->logger->debug("Arguments \n lastUpdate : {$inputedDate} \n tmpPath : {$tmpPath} ", array('tmpPath' => $tmpPath, 'lastUpdated' => $lastUpdate)); try { $this->processor->process($tmpPath, $lastUpdate); } catch (\Exception $e) { $this->logger->critical($e->getMessage()); } }
public function execute(InputInterface $input, OutputInterface $output) { $io = new SymfonyStyle($input, $output); $io->title("Banking information"); $hipayID = $input->getArgument(self::HIPAY_ID); $vendor = new Vendor(false, false, $hipayID); $status = $this->vendorProcessor->getBankInfoStatus($vendor); $io->writeln($status); if (trim($status) == BankInfo::VALIDATED) { $bankData = $this->vendorProcessor->getBankInfo($vendor)->getData(); $rows = array(); foreach ($bankData as $key => $value) { $rows[] = array($key, $value); } $io->table(array('key', 'value'), $rows); } }
/** * @covers ::transferFiles */ public function testTransferFiles() { $shops = array(119200, 1321); $tmpDir = '/tmp/dir'; $docContent1 = 'data1'; $docContent2 = 'data2'; $docContent3 = 'data3'; $vendor1 = new Vendor('*****@*****.**', mt_rand(), mt_rand(), 771); $vendor2 = new Vendor('*****@*****.**', mt_rand(), mt_rand(), 772); $document1 = new Document(2006); $document2 = new Document(3011); // Getting documents list $this->mirakl->getFiles($shops)->willReturn(Mirakl::getShopDocuments($shops))->shouldBeCalled(); // Retrieving vendors $this->vendorManager->findByMiraklId(119200)->willReturn($vendor1)->shouldBeCalledTimes(1); $this->vendorManager->findByMiraklId(1321)->willReturn($vendor2)->shouldBeCalledTimes(1); // Checking documents $this->documentManager->findByVendor($vendor1)->willReturn(array(new Document(2008, "LEGAL_IDENTITY_OF_REPRESENTATIVE")))->shouldBeCalledTimes(1); $this->documentManager->findByVendor($vendor2)->willReturn(array(new Document(3006, "ALL_PROOF_OF_BANK_ACCOUNT")))->shouldBeCalledTimes(1); // Download missing documents $this->mirakl->downloadDocuments(array(2006), Argument::any())->willReturn($docContent1)->shouldBeCalledTimes(1); $this->mirakl->downloadDocuments(array(3008), Argument::any())->willReturn($docContent2)->shouldBeCalledTimes(1); $this->mirakl->downloadDocuments(array(3011), Argument::any())->willReturn($docContent3)->shouldBeCalledTimes(1); // Save files on disk $prophet = new PHPProphet(); $prophecy = $prophet->prophesize('HiPay\\Wallet\\Mirakl\\Vendor'); $prophecy->file_put_contents(Argument::containingString('/tmp/dir/'), Argument::containingString('data'))->willReturn(true)->shouldBeCalledTimes(3); $prophecy->reveal(); // Sending documents to HiPay Wallet $this->hipay->uploadDocument(771, HiPay::DOCUMENT_ALL_PROOF_OF_BANK_ACCOUNT, Argument::any(), Argument::any())->shouldBeCalledTimes(1); $this->hipay->uploadDocument(772, HiPay::DOCUMENT_LEGAL_IDENTITY_OF_REPRESENTATIVE, Argument::any(), Argument::any())->willThrow(new ClientErrorResponseException())->shouldBeCalledTimes(1); $this->hipay->uploadDocument(772, HiPay::DOCUMENT_LEGAL_PROOF_OF_REGISTRATION_NUMBER, Argument::any(), Argument::any())->shouldBeCalledTimes(1); // Save document in DB $this->documentManager->create(2006, Argument::type("DateTime"), "ALL_PROOF_OF_BANK_ACCOUNT", $vendor1)->willReturn($document1)->shouldBeCalledTimes(1); $this->documentManager->create(3011, Argument::type("DateTime"), "LEGAL_PROOF_OF_REGISTRATION_NUMBER", $vendor2)->willReturn($document2)->shouldBeCalledTimes(1); $this->documentManager->save(Argument::exact($document1))->shouldBeCalledTimes(1); $this->documentManager->save(Argument::exact($document2))->shouldBeCalledTimes(1); $this->vendorProcessor->transferFiles($shops, $tmpDir); $prophet->checkPredictions(); }