当前位置: 首页>>代码示例>>PHP>>正文


PHP Rest::getUUID方法代码示例

本文整理汇总了PHP中Rest::getUUID方法的典型用法代码示例。如果您正苦于以下问题:PHP Rest::getUUID方法的具体用法?PHP Rest::getUUID怎么用?PHP Rest::getUUID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Rest的用法示例。


在下文中一共展示了Rest::getUUID方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: process

    public function process()
    {
        parent::process();
        $address = new Address((int) self::$cart->id_address_delivery);
        $country = new Country((int) $address->id_country);
        $current_offer = Db::getInstance()->getValue('
		SELECT c.rateoffer_id
		FROM ' . _DB_PREFIX_ . 'currency c
		WHERE c.iso_code = \'' . pSQL($this->context->cookie->interpay_currency_code) . '\' AND deleted = 0');
        $id_rate = 0;
        if ($current_offer) {
            $id_rate = $current_offer;
        }
        $customer = new Customer((int) self::$cart->id_customer);
        $address_shipping = new Address((int) self::$cart->id_address_delivery);
        $state = new State((int) $address->id_state);
        $link = new Link();
        $products = '';
        $i = 1;
        $cart_currency = new Currency((int) self::$cart->id_currency);
        foreach (self::$cart->getProducts() as $val) {
            $products .= 'itemDescription' . $i . '=' . urlencode($val['name']) . '&';
            // .': '.$val['description_short']
            $products .= 'itemQuantity' . $i . '=' . (int) $val['quantity'] . '&';
            $products .= 'itemUnitPrice' . $i . '=' . (double) number_format($val['price'] / $cart_currency->conversion_rate, 2, '.', '') . '&';
            $products .= 'itemImageURL' . $i . '=' . urlencode('https://' . $link->getImageLink($val['id_product'], $val['id_image'])) . '&';
            $products .= 'itemSkuN' . $i . '=' . '' . '&';
            $products .= 'itemProductId' . $i . '=' . (int) $val['id_product'] . '&';
            $products .= 'itemWeight' . $i . '=' . (double) $val['weight'] . '&';
            $products .= 'itemLength' . $i . '=' . (double) $val['depth'] . '&';
            $products .= 'itemWidth' . $i . '=' . (double) $val['width'] . '&';
            $products .= 'itemHeight' . $i . '=' . (double) $val['height'] . '&';
            $products .= 'itemStatus' . $i . '=' . '' . '&';
            $products .= 'itemCountryOfOrigin' . $i . '=' . '' . '&';
            $products .= 'itemURL' . $i . '=' . '' . '&';
            $i++;
        }
        $discounts = _PS_VERSION_ >= 1.5 ? self::$cart->getCartRules() : self::$cart->getDiscounts();
        foreach ($discounts as $val) {
            $products .= 'itemDescription' . $i . '=' . urlencode($val['name'] . ': ' . $val['description']) . '&';
            $products .= 'itemQuantity' . $i . '=' . (int) $val['quantity'] . '&';
            $products .= 'itemUnitPrice' . $i . '=' . (double) $val['value_real'] . '&';
            $products .= 'itemImageURL' . $i . '=' . '' . '&';
            $products .= 'itemSkuN' . $i . '=' . '' . '&';
            $products .= 'itemProductId' . $i . '=' . 'discount_' . (int) $val['id_cart_rule'] . '&';
            $products .= 'itemWeight' . $i . '=' . '' . '&';
            $products .= 'itemLength' . $i . '=' . '' . '&';
            $products .= 'itemWidth' . $i . '=' . '' . '&';
            $products .= 'itemHeight' . $i . '=' . '' . '&';
            $products .= 'itemStatus' . $i . '=' . '' . '&';
            $products .= 'itemCountryOfOrigin' . $i . '=' . '' . '&';
            $products .= 'itemURL' . $i . '=' . '' . '&';
            $i++;
        }
        self::$cart->id_carrier = (int) Configuration::get('GOINTERPAY_SHIPPING_CARRIER');
        self::$cart->update();
        $carrierPrice = (double) self::$cart->getOrderTotal(true, Cart::ONLY_SHIPPING);
        if ($carrierPrice === false) {
            self::$smarty->assign('error', true);
            return false;
        }
        $account = 'store' . '=' . (int) Configuration::get('GOINTERPAY_STORE') . '&';
        $account .= 'secret' . '=' . urlencode(Configuration::get('GOINTERPAY_SECRET')) . '&';
        $data = 'misc1' . '=' . (int) self::$cart->id . '&';
        $data .= 'misc2' . '=' . (double) $carrierPrice . '&';
        $data .= 'domesticShippingCharge' . '=' . (double) $carrierPrice . '&';
        $data .= 'interpayRateOfferId' . '=' . urlencode($id_rate) . '&';
        $data .= 'customerName' . '=' . urlencode($customer->firstname . ' ' . $customer->lastname) . '&';
        $data .= 'customerCompany' . '=' . urlencode($address->company) . '&';
        $data .= 'customerEmail' . '=' . urlencode($customer->email) . '&';
        $data .= 'customerPhone' . '=' . urlencode($address->phone) . '&';
        $data .= 'CustomerAltPhone' . '=' . urlencode($address->phone_mobile) . '&';
        $data .= 'customerAddress1' . '=' . urlencode($address->address1) . '&';
        $data .= 'customerAddress2' . '=' . urlencode($address->address2) . '&';
        $data .= 'customerCity' . '=' . urlencode($address->city) . '&';
        $data .= 'customerState' . '=' . ($address->id_state ? urlencode($state->name) : '') . '&';
        $data .= 'customerZip' . '=' . urlencode($address->postcode);
        $address_country = new Country((int) $address->id_country);
        if (Validate::isLoadedObject($address_country)) {
            $address_country_iso = $address_country->iso_code;
        }
        $post = $account . $products . $data;
        include_once _PS_MODULE_DIR_ . 'gointerpay/Rest.php';
        $uuid = Rest::getUUID($post);
        if ($uuid) {
            self::$smarty->assign(array('pathInterpaySsl' => _GOINTERPAY_MAIN_URL_ . (isset($address_country_iso) ? '?country=' . $address_country->iso_code : '') . '#Destination', 'store' => (int) Configuration::get('GOINTERPAY_STORE'), 'tempCartUUID' => Tools::safeOutput($uuid), 'country' => urlencode($country->iso_code), 'modulePath' => './'));
        } else {
            self::$smarty->assign('error', 'An error has occured, please try again later.');
        }
    }
开发者ID:juniorhq88,项目名称:PrestaShop-modules,代码行数:90,代码来源:payment.php


注:本文中的Rest::getUUID方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。