private function _createCustomerDownlineTreeSnap() { /* calculate snapshots */ $this->_logger->debug("Calculate snapshots."); $req = new SnapCalcRequest(); $req->setDatestampTo(self::DS_CUSTOMER_ADDED); $respCalc = $this->_callDownlineSnap->calc($req); $this->assertTrue($respCalc->isSucceed()); }
protected function _createDownlineSnapshots($dsUpTo) { $req = new DownlineSnapCalcRequest(); $req->setDatestampTo($dsUpTo); $resp = $this->_callDownlineSnap->calc($req); $this->assertTrue($resp->isSucceed()); }
private function _changeC13ToRoot() { $this->_logger->debug("Change parent to root for customer #13."); $this->_dayIsOver(); /** @var $period \Praxigento\Core\Tool\IPeriod */ $period = $this->_toolPeriod; $customerId = $this->_mapCustomerMageIdByIndex[13]; /* get snapshot before calculation */ $reqSnap = new SnapGetStateOnDateRequest(); $reqSnap->setDatestamp($this->_dtToday); $respSnap = $this->_callSnap->getStateOnDate($reqSnap); $this->assertTrue($respSnap->isSucceed()); $beforeData = $respSnap->getData($customerId); $beforeParentId = $beforeData[Snap::ATTR_PARENT_ID]; $this->assertNotEquals($customerId, $beforeParentId); $this->_logger->debug("Mage ID of the #10 customer's parent is {$beforeParentId} (before update)."); /* change parent */ $reqChange = new CustomerChangeParentRequest(); $reqChange->setCustomerId($customerId); $reqChange->setNewParentId($customerId); $reqChange->setDate($period->getTimestampFrom($this->_dtToday)); $respChange = $this->_callDownlineCustomer->changeParent($reqChange); $this->assertTrue($respChange->isSucceed()); /* calculate snapshots */ $this->_logger->debug("Calculate snapshots."); $req = new SnapCalcRequest(); $req->setDatestampTo($this->_dtToday); $respCalc = $this->_callSnap->calc($req); $this->assertTrue($respCalc->isSucceed()); /* get snapshot after calculation */ $reqSnap->datestamp = $this->_dtToday; $respSnap = $this->_callSnap->getStateOnDate($reqSnap); $this->assertTrue($respSnap->isSucceed()); $afterData = $respSnap->getData($customerId); $afterParentId = $afterData[Snap::ATTR_PARENT_ID]; $this->assertNotEquals($beforeParentId, $afterParentId); $this->_logger->debug("Mage ID of the #13 customer's parent is {$afterParentId} (after update)."); }