private function _calcPvWriteOffPeriod($nextPeriodBegin, $expectedBegin, $expectedEnd)
 {
     /* perform operation by the first date of the next period */
     $datePerformed = $this->_toolPeriod->getTimestampTo($nextPeriodBegin);
     $request = new BonusCalcPvWriteOffRequest();
     $request->setDatePerformed($datePerformed);
     $response = $this->_callCalc->pvWriteOff($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]);
 }
 private function _calcPvWriteOff()
 {
     $request = new BonusCalcPvWriteOffRequest();
     $response = $this->_callCalc->pvWriteOff($request);
     $this->assertTrue($response->isSucceed());
 }