Ejemplo n.º 1
0
 /**
  * This reorders parameters and removes the ones that are not set (empty values are allowed)
  *
  * @param Dataset $dataset
  * @param string $service What service parameters to return (array key)
  * @return array
  * @throws \dlds\payment\Exception
  */
 public function getNormalizedMacParams(Dataset $dataset, $service)
 {
     $params = $this->getParamMacOrderDefinition();
     if (!isset($params[$service])) {
         throw new Exception("Cannot normalize MAC params, unknown service: {$service}");
     }
     $currentOrder = $params[$service];
     $normalizedMacParams = array();
     // reorder mac params
     foreach ($currentOrder as $param) {
         if ($dataset->offsetExists($param)) {
             $normalizedMacParams[$param] = $dataset->getParam($param);
         }
     }
     return $normalizedMacParams;
 }