private function _expandTree($data) { $req = new DownlineSnapExtendMinimalRequest(); $req->setKeyCustomerId(Compress::ATTR_CUSTOMER_ID); $req->setKeyParentId(Compress::ATTR_PARENT_ID); $req->setTree($data); $resp = $this->_callDownlineSnap->expandMinimal($req); return $resp->getSnapData(); }
protected function _createDownlineSnapshots($dsUpTo) { $req = new DownlineSnapCalcRequest(); $req->setDatestampTo($dsUpTo); $resp = $this->_callDownlineSnap->calc($req); $this->assertTrue($resp->isSucceed()); }
/** * Get Downline Tree snapshot on the $ds (datestamp). Result is an array [$customerId => [...], ...] * * @param $dstamp 'YYYYMMDD' * * @return array|null */ private function _getDownlineSnapshot($dstamp) { $req = new DownlineSnapGetStateOnDateRequest(); $req->setDatestamp($dstamp); $resp = $this->_callDownlineSnap->getStateOnDate($req); $result = $resp->getData(); return $result; }
/** * Populate data with depth & path values. * * @param $data array of customer data with customer ID & parent ID * @param $labelCustomerId string label for customerId * @param $labelParentId string label for parentId * * @return array Downline Snap: [ $custId => [customer_id, depth, parent_id, path], ...] */ private function _getExpandedTreeSnap($data, $labelCustomerId, $labelParentId) { /* populate compressed data with depth & path values */ $tree = []; foreach ($data as $one) { $custId = $one[$labelCustomerId]; $parentId = $one[$labelParentId]; $tree[$custId] = $parentId; } $reqExt = new DownlineSnapExtendMinimalRequest(); $reqExt->setTree($tree); $respExt = $this->_callDownlineSnap->expandMinimal($reqExt); $result = $respExt->getSnapData(); return $result; }