Beispiel #1
0
 /**
  *
  */
 public function processRequest()
 {
     $dataField = \Yii::$app->request->post('Data');
     $interfaceVersion = \Yii::$app->request->post('InterfaceVersion');
     $seal = \Yii::$app->request->post('Seal');
     // Check InterfaceVersion and validate Data-field integrity
     if ($dataField === null || $interfaceVersion !== $this->interfaceVersion || hash('sha256', $dataField . $this->secretKey) !== $seal) {
         throw new \yii\web\BadRequestHttpException();
     }
     // Parse Data-field
     $data = [];
     $dataField = explode('|', $dataField);
     foreach ($dataField as $concat) {
         $field = explode('=', $concat, 2);
         if (count($field) == 2) {
             $data[$field[0]] = $field[1];
         }
     }
     // Create the response object and make sure everything's there
     $paymentResponse = new PaymentResponse($data);
     if ($paymentResponse->validate()) {
         return $paymentResponse;
     }
     throw new \yii\web\BadRequestHttpException();
 }