Exemplo n.º 1
0
 /**
  * Constructor for PayzenResponse class. Prepare to analyse check url or return url call.
  * @param array[string]string $parameters $_REQUEST by default
  * @param string $ctx_mode
  * @param string $key_test
  * @param string $key_prod
  * @param string $encoding
  */
 function __construct($parameters = null, $ctx_mode = null, $key_test = null, $key_prod = null)
 {
     $this->api = new PayzenApi();
     // Use default API encoding (UTF-8) since the payment platform returns UTF-8 data
     if (is_null($parameters)) {
         $parameters = $_REQUEST;
     }
     $parameters = $this->api->uncharm($parameters);
     // Load site credentials if provided
     if (!is_null($ctx_mode)) {
         $this->api->set('vads_ctx_mode', $ctx_mode);
     }
     if (!is_null($key_test)) {
         $this->api->set('vads_key_test', $key_test);
     }
     if (!is_null($key_prod)) {
         $this->api->set('vads_key_prod', $key_prod);
     }
     $this->load($parameters, $this->api->getCertificate());
 }