public function generate() { //get Revenue Model object $revenueReportModel = RevenueReportUtils::getRevenueModel($this->revenueReportFile); //get Dw, WMS, Suplizer data from Db $dbData = $this->getDbData(array_keys($revenueReportModel->getOrders())); //get Cybersource data for each order $csTxnInfoArray = Transaction::getCyberSourceTxnSummary($revenueReportModel); $reportDataArray = ConsolidatedReportOrders2Array::getReportDataInArray($dbData, $revenueReportModel, $csTxnInfoArray); $this->logger->debug("reportData" . print_r($reportDataArray, true)); $reportFile = $this->getReportFile(); //$reportFile = $this->reportsFilename; $this->logger->debug("Report file = " . $reportFile); $consolidateReportFile = (new OfficeExcelFactory())->createDocument($this->templateReportSheet, $reportFile, "0", $reportDataArray, "A3"); $this->logger->debug("Report file generated " . $reportFile); $this->emailReport($reportFile); }
/** * @dataProvider getOrders */ public function testOrder($revenueOrder) { $this->logger = QCLogger::getInstance(); $this->logger->info("BEGIN " . __METHOD__); $this->logger->debug("Received Revenue Order :" . print_r($revenueOrder, true)); //check if the txn is a refund and if so ignore the Cybersource validation if ($revenueOrder->isTxnARefund()) { $this->logger->debug("Transaction is a refund and ignoring the verification"); return; } $orderId = $revenueOrder->getOrderId(); $revOrderDate = date_create($revenueOrder->getOrderDate()); $revOrderDateFormatted = date_format($revOrderDate, 'Ymd'); $this->logger->info("Testing Order #" . $orderId . "with orderDate = " . $revOrderDateFormatted); $this->logger->info("Sum of all prices for this order # - present in the report = " . $revenueOrder->getSumOfLinePrice()); $this->logger->info("Checking against the payment registered in Payment Gateway"); $txnPaidAmount = Transaction::getTxnPaymentAmount($orderId, $revOrderDateFormatted); $this->assertEquals($revenueOrder->getSumOfAllRecords(), $txnPaidAmount, "Total of all records for orderId " . $orderId . " in the report is not same as the Payment done in Payment-Gateway, which is " . $txnPaidAmount); }