/**
     * Return the HTML code for the iframe.
     */
    function render()
    {
        $url = \dlds\thepay\api\TpEscaper::htmlEntityEncode($this->payment->getMerchantConfig()->gateUrl . 'iframe/');
        $queryArgs = array_filter(array('css' => $this->cssUrl, 'skin' => $this->skin));
        $ret = '<script type="text/javascript" src="' . $url . 'js/jquery.js?v=' . time() . '" async="async"></script>
		<script type="text/javascript" src="' . $url . 'js/iframe.js?v=' . time() . '" async="async"></script>';
        // The iframe is auto-sized to fit the height of the content, because the content height can change.
        $ret .= '<iframe src="' . $url . '?' . $this->buildQuery($queryArgs) . '" style="border: 0; width: 374px; height: 150px;" class="thepay-iframe"></iframe>';
        $ret .= '<p>Rychlý bankovní převod zajišťuje společnost <a href="http://www.thepay.cz/" target="_blank">ThePay&nbsp;s.r.o.</a></p>';
        return $ret;
    }
示例#2
0
 /**
  * Returns object as JSON.
  * Note that numeric values are without decimal point, ie 12.34 will be written as 1234.
  * @return string
  */
 public function toJSON()
 {
     $result = '{';
     $result .= '"first_name": ' . \dlds\thepay\api\TpEscaper::jsonEncode($this->customer->getFirstName()) . ', ';
     $result .= '"last_name": ' . \dlds\thepay\api\TpEscaper::jsonEncode($this->customer->getLastName()) . ', ';
     $result .= '"currency": ' . \dlds\thepay\api\TpEscaper::jsonEncode($this->cart->getCurrency()) . ', ';
     $result .= '"amount": ' . \dlds\thepay\api\TpEscaper::jsonEncode($this->cart->getTotalAmountWithoutDecimal()) . ', ';
     $mobilePhone = $this->customer->getMobilePhone();
     if (!is_null($mobilePhone) && $mobilePhone != "") {
         $result .= '"mobile_phone": ' . \dlds\thepay\api\TpEscaper::jsonEncode($mobilePhone) . ', ';
     }
     $result .= '"city": ' . \dlds\thepay\api\TpEscaper::jsonEncode($this->customer->getCity()) . ', ';
     $result .= '"postal_code": ' . \dlds\thepay\api\TpEscaper::jsonEncode($this->customer->getPostalCode()) . ', ';
     $result .= '"address": ' . \dlds\thepay\api\TpEscaper::jsonEncode($this->customer->getAddress()) . ', ';
     $result .= '"email": ' . \dlds\thepay\api\TpEscaper::jsonEncode($this->customer->getEmail()) . ',';
     $result .= '"shopping_cart": ' . $this->cart->toJSON() . '}';
     return $result;
 }
 /**
  * Return the HTML code for the button.
  */
 public function render()
 {
     $gateUrl = $this->payment->getMerchantConfig()->gateUrl;
     $targetUrl = \dlds\thepay\api\TpEscaper::htmlEntityEncode("{$gateUrl}iframe/");
     $targetUrl = "{$targetUrl}?" . $this->buildQuery();
     switch ($this->buttonStyle) {
         case "":
             return "<a href=\"{$targetUrl}\">{$this->buttonText}</a>";
             break;
         default:
             $buttonStyle = rawurlencode($this->buttonStyle);
             $src = "{$gateUrl}buttons/{$buttonStyle}.png";
             $src = \dlds\thepay\api\TpEscaper::htmlEntityEncode($src);
             $title = \dlds\thepay\api\TpEscaper::htmlEntityEncode($this->buttonText);
             return "<a href=\"" . $targetUrl . "\"><img src=\"{$src}\" alt=\"{$title}\" title=\"{$title}\" /></a>";
             break;
     }
 }
 /**
  * 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(\dlds\thepay\api\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 = \dlds\thepay\api\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 = \dlds\thepay\api\TpEscaper::jsonEncode($thepayGateUrl);
     $out .= "\tvar thepayGateUrl = {$thepayGateUrl},\n";
     $thepayDisablePopupCss = \dlds\thepay\api\TpEscaper::jsonEncode($this->disablePopupCss);
     $out .= "\tthepayDisablePopupCss = {$thepayDisablePopupCss};\n";
     $out .= "</script>\n";
     $src = "{$this->config->gateUrl}radiobuttons/js/jquery.js?v=" . time();
     $src = \dlds\thepay\api\TpEscaper::htmlEntityEncode($src);
     $out .= "<script type=\"text/javascript\" src=\"{$src}\" async=\"async\"></script>";
     $src = "{$this->config->gateUrl}radiobuttons/js/radiobuttons.js?v=" . time();
     $src = \dlds\thepay\api\TpEscaper::htmlEntityEncode($src);
     $out .= "<script type=\"text/javascript\" src=\"{$src}\" async=\"async\"></script>";
     $out .= "<div id=\"thepay-method-result\"></div>";
     return $out;
 }
示例#5
0
 /**
  * Return the HTML code for the iframe.
  */
 function render()
 {
     $url = $this->payment->getMerchantConfig()->gateUrl;
     $queryArgs = array_filter(array('skin' => $this->skin));
     $out = "";
     if (!$this->disableButtonCss) {
         $skin = $this->skin == "" ? "" : "/{$this->skin}";
         $href = "{$url}div/style{$skin}/div.css?v=" . time();
         $href = \dlds\thepay\api\TpEscaper::htmlEntityEncode($href);
         $out .= "<link href=\"{$href}\" type=\"text/css\" rel=\"stylesheet\" />\n";
     }
     $thepayGateUrl = $url . 'div/index.php?' . $this->buildQuery($queryArgs);
     $thepayGateUrl = \dlds\thepay\api\TpEscaper::jsonEncode($thepayGateUrl);
     $disableThepayPopupCss = \dlds\thepay\api\TpEscaper::jsonEncode($this->disablePopupCss);
     $out .= "<script type=\"text/javascript\">";
     $out .= "\tvar thepayGateUrl = {$thepayGateUrl},\n";
     $out .= "\t\tdisableThepayPopupCss = {$disableThepayPopupCss};\n";
     $out .= "</script>\n";
     $src = "{$url}div/js/jquery.js?v=" . time();
     $src = \dlds\thepay\api\TpEscaper::htmlEntityEncode($src);
     $out .= "<script type=\"text/javascript\" src=\"{$src}\" async=\"async\"></script>\n";
     $src = "{$url}div/js/div.js?v=" . time();
     $src = \dlds\thepay\api\TpEscaper::htmlEntityEncode($src);
     $out .= "<script type=\"text/javascript\" src=\"{$src}\" async=\"async\"></script>\n";
     $out .= "<div id=\"thepay-method-box\" style=\"border: 0;\"></div>\n";
     return $out;
 }
示例#6
0
 /**
  * Returns object as JSON.
  * Note that numeric values are without decimal point, ie 12.34 will be written as 1234.
  * @return string
  */
 public function toJSON()
 {
     return \dlds\thepay\api\TpEscaper::jsonEncode(array('name' => $this->name, 'description' => $this->description, 'quantity' => $this->quantity, 'price' => $this->price));
 }