Beispiel #1
0
 /**
  * Builds repeat request data array.
  *
  * This method checks all given data and generates correct request data
  * array or raises WebToPayException on failure.
  *
  * Method accepts single parameter $data of array type. All possible array
  * keys are described here:
  * https://www.mokejimai.lt/makro_specifikacija.html
  *
  * @param  array $data Information about current payment request
  *
  * @return array
  *
  * @throws WebToPayException on data validation error
  */
 public static function buildRepeatRequest($data)
 {
     if (!isset($data['sign_password']) || !isset($data['projectid']) || !isset($data['orderid'])) {
         throw new WebToPayException('sign_password, projectid or orderid is not provided');
     }
     $password = $data['sign_password'];
     $projectId = $data['projectid'];
     $orderId = $data['orderid'];
     $factory = new WebToPay_Factory(array('projectId' => $projectId, 'password' => $password));
     $requestBuilder = $factory->getRequestBuilder();
     return $requestBuilder->buildRepeatRequest($orderId);
 }
 /**
  * Tests exception
  *
  * @expectedException WebToPay_Exception_Configuration
  */
 public function testGetRequestBuilderWithoutConfiguration()
 {
     $this->factoryWithoutConfiguration->getRequestBuilder();
 }