private function _calcBonusPersonal($nextPeriodBegin, $expectedBegin, $expectedEnd) { /* perform operation by the first date of the next period */ $datePerformed = $this->_toolPeriod->getTimestampTo($nextPeriodBegin); $request = new BonusCalcPersonalBonusRequest(); $request->setDatePerformed($datePerformed); $response = $this->_callCalc->bonusPersonal($request); $this->assertTrue($response->isSucceed()); $periodId = $response->getPeriodId(); $calcId = $response->getCalcId(); /* validate period */ $this->assertNotNull($periodId); $data = $this->_repoBasic->getEntityByPk(Period::ENTITY_NAME, [Period::ATTR_ID => $periodId]); $this->assertEquals($expectedBegin, $data[Period::ATTR_DSTAMP_BEGIN]); $this->assertEquals($expectedEnd, $data[Period::ATTR_DSTAMP_END]); /* validate calculation */ $this->assertNotNull($calcId); $data = $this->_repoBasic->getEntityByPk(Calculation::ENTITY_NAME, [Calculation::ATTR_ID => $calcId]); $this->assertEquals(Cfg::CALC_STATE_COMPLETE, $data[Calculation::ATTR_STATE]); /* validate WALLET_ACTIVE balances */ $this->_validateWalletsAfterPersonal(); }
private function _calcBonusPersonal() { $request = new BonusCalcBonusPersonalRequest(); /* DEFAULT scheme */ $request->setScheme(Def::SCHEMA_DEFAULT); $response = $this->_callCalc->bonusPersonal($request); $this->_calcIdBonusPersonalDef = $response->getCalcId(); $this->assertTrue($response->isSucceed()); /* EU scheme */ $request->setScheme(Def::SCHEMA_EU); $response = $this->_callCalc->bonusPersonal($request); $this->_calcIdBonusPersonalEu = $response->getCalcId(); $this->assertTrue($response->isSucceed()); }