public function compress(Request\Compress $req)
 {
     $result = new Response\Compress();
     $calcTypeCode = Cfg::CODE_TYPE_CALC_COMPRESSION;
     $this->_logger->info("'Loyalty Compression' calculation is started.");
     $reqGetLatest = new PeriodGetLatestForPvBasedCalcRequest();
     $reqGetLatest->setCalcTypeCode($calcTypeCode);
     $respGetLatest = $this->_callBasePeriod->getForPvBasedCalc($reqGetLatest);
     if ($respGetLatest->isSucceed()) {
         $def = $this->_manTrans->begin();
         try {
             /* get tree snapshot and orders data */
             $periodData = $respGetLatest->getPeriodData();
             $dsBegin = $periodData->getDstampBegin();
             $dsEnd = $periodData->getDstampEnd();
             $tree = $this->_getDownlineSnapshot($dsEnd);
             $orders = $this->_repoMod->getSalesOrdersForPeriod($dsBegin, $dsEnd);
             /* match orders to customers  */
             foreach ($orders as $order) {
                 $custId = $order[Cfg::E_SALE_ORDER_A_CUSTOMER_ID];
                 $tree[$custId][Sub\CompressQualifier::AS_HAS_ORDERS] = true;
             }
             /* call to compression operation from bonus base module */
             $reqCompress = new BonusBaseQualifyByUserDataRequest();
             $calcData = $respGetLatest->getCalcData();
             $calcId = $calcData->getId();
             $reqCompress->setCalcId($calcId);
             $reqCompress->setFlatTree($tree);
             $reqCompress->setSkipTreeExpand(true);
             $reqCompress->setQualifier(new Sub\CompressQualifier());
             $respCompress = $this->_callBaseCompress->qualifyByUserData($reqCompress);
             if ($respCompress->isSucceed()) {
                 $this->_repoBonusService->markCalcComplete($calcId);
                 $this->_manTrans->commit($def);
                 $result->setPeriodId($periodData->getId());
                 $result->setCalcId($calcId);
                 $result->markSucceed();
             }
         } finally {
             $this->_manTrans->end($def);
         }
     }
     $this->_logger->info("'Loyalty Compression' calculation is complete.");
     return $result;
 }