Esempio n. 1
0
 /**
  * Build the query part of the URL from payment data and optional
  * helper data.
  * @param array $args Associative array of optional arguments that should
  *   be appended to the URL.
  * @return string Query part of the URL with all parameters correctly escaped
  *
  */
 function buildQuery($args = array())
 {
     $out = array_merge($this->payment->getArgs(), $args, array("signature" => $this->payment->getSignature()));
     $str = array();
     foreach ($out as $key => $val) {
         $str[] = rawurlencode($key) . "=" . rawurlencode($val);
     }
     return implode('&', $str);
 }
 /**
  * Show instruction for offline payment if ThePay payment method is selected and this method is offline.
  * Show output of this method somewhere on page with order confirmation.
  *
  * @param TpPayment $payment
  * @return string HTML code with component
  */
 public function showPaymentInstructions(TpPayment $payment)
 {
     if (empty($_REQUEST['tp_radio_value']) || empty($_REQUEST['tp_radio_is_offline'])) {
         return '';
     }
     $this->clearCookies();
     $href = "{$this->config->gateUrl}radiobuttons/style/radiobuttons.css?v=" . time();
     $href = TpEscaper::htmlEntityEncode($href);
     $out = "<link href=\"{$href}\" type=\"text/css\" rel=\"stylesheet\" />\n";
     $out .= "<script type=\"text/javascript\">\n";
     $payment->setMethodId(intval($_REQUEST['tp_radio_value']));
     $queryArgs = $payment->getArgs();
     $queryArgs['signature'] = $payment->getSignature();
     $thepayGateUrl = "{$this->config->gateUrl}?" . http_build_query($queryArgs);
     $thepayGateUrl = TpEscaper::jsonEncode($thepayGateUrl);
     $out .= "\tvar thepayGateUrl = {$thepayGateUrl},\n";
     $thepayDisablePopupCss = TpEscaper::jsonEncode($this->disablePopupCss);
     $out .= "\tthepayDisablePopupCss = {$thepayDisablePopupCss};\n";
     $out .= "</script>\n";
     $src = "{$this->config->gateUrl}radiobuttons/js/jquery.js?v=" . time();
     $src = TpEscaper::htmlEntityEncode($src);
     $out .= "<script type=\"text/javascript\" src=\"{$src}\" async=\"async\"></script>";
     $src = "{$this->config->gateUrl}radiobuttons/js/radiobuttons.js?v=" . time();
     $src = TpEscaper::htmlEntityEncode($src);
     $out .= "<script type=\"text/javascript\" src=\"{$src}\" async=\"async\"></script>";
     $out .= "<div id=\"thepay-method-result\"></div>";
     return $out;
 }