public function testSetGetWithValidData()
 {
     $payCompleteParameter = new PayCompleteParameter();
     $payCompleteParameter->set('ID', self::ID)->set('AMOUNT', self::AMOUNT)->set('ACCOUNTID', self::ACCOUNTID)->set('ACTION', self::ACTION);
     $this->assertEquals(self::ID, $payCompleteParameter->get('ID'));
     $this->assertEquals(self::AMOUNT, $payCompleteParameter->get('AMOUNT'));
     $this->assertEquals(self::ACCOUNTID, $payCompleteParameter->get('ACCOUNTID'));
     $this->assertEquals(self::ACTION, $payCompleteParameter->get('ACTION'));
     $this->assertCount(0, $payCompleteParameter->getInvalidData());
 }
Exemple #2
0
 /**
  * @param  CollectionItemInterface            $payConfirmParameter
  * @param  string                             $action
  * @param  null                               $spPassword
  * @param  CollectionItemInterface            $payCompleteParameter
  * @param  CollectionItemInterface            $payCompleteResponse
  * @return CollectionItemInterface
  * @throws Exception\NoPasswordGivenException
  * @throws \Exception
  */
 public function payCompleteV2(CollectionItemInterface $payConfirmParameter, $action = PayCompleteParameterInterface::ACTION_SETTLEMENT, $spPassword = null, CollectionItemInterface $payCompleteParameter = null, CollectionItemInterface $payCompleteResponse = null)
 {
     if (is_null($payConfirmParameter->get('ID'))) {
         $this->getLogger()->critical('Saferpay: call confirm before complete!');
         throw new \Exception('Saferpay: call confirm before complete!');
     }
     if (is_null($payCompleteParameter)) {
         $payCompleteParameter = new PayCompleteParameter();
     }
     $payCompleteParameter->set('ID', $payConfirmParameter->get('ID'));
     $payCompleteParameter->set('AMOUNT', $payConfirmParameter->get('AMOUNT'));
     $payCompleteParameter->set('ACCOUNTID', $payConfirmParameter->get('ACCOUNTID'));
     $payCompleteParameter->set('ACTION', $action);
     $payCompleteParameterData = $payCompleteParameter->getData();
     if ($this->isTestAccountId($payCompleteParameter->get('ACCOUNTID'))) {
         $payCompleteParameterData = array_merge($payCompleteParameterData, array('spPassword' => PayInitParameterInterface::SAFERPAYTESTACCOUNT_SPPASSWORD));
     } elseif ($action != PayCompleteParameterInterface::ACTION_SETTLEMENT && !$spPassword) {
         throw new NoPasswordGivenException();
     }
     $response = $this->request($payCompleteParameter->getRequestUrl(), $payCompleteParameterData);
     if (is_null($payCompleteResponse)) {
         $payCompleteResponse = new PayCompleteResponse();
     }
     $this->fillDataFromXML($payCompleteResponse, substr($response, 3));
     return $payCompleteResponse;
 }