コード例 #1
0
 public function initContent()
 {
     $this->display_column_left = false;
     include_once _PS_MODULE_DIR_ . 'gcheckout/gcheckout.php';
     include_once _PS_MODULE_DIR_ . 'gcheckout/library/googlecart.php';
     include_once _PS_MODULE_DIR_ . 'gcheckout/library/googleitem.php';
     include_once _PS_MODULE_DIR_ . 'gcheckout/library/googleshipping.php';
     parent::initContent();
     $gcheckout = new GCheckout();
     /*if (_PS_VERSION_ >= '1.5' && !Context::getContext()->customer->isLogged(true))
     			Tools::redirect('index.php?co:q:q:qntroller=authentication&back=order.php');
     		else if (_PS_VERSION_ < '1.5' && !$cookie->isLogged(true))
     			Tools::redirect('authentication.php?back=order.php');
     		else if (!$gcheckout->context->cart->getOrderTotal(true, Cart::BOTH))
     			Tools::displayError('Error: Empty cart');*/
     // Prepare payment
     $currency = $gcheckout->getCurrency($this->context->cart->id_currency);
     if ($this->context->cart->id_currency != $currency->id) {
         $this->context->cart->id_currency = (int) $currency->id;
         $this->context->cookie->id_currency = (int) $this->context->cart->id_currency;
         $this->context->cart->update();
         //Tools::redirect('modules/'.$this->name.'/payment.php');
         Tools::redirect($link->getModuleLink('gcheckout', 'payment'));
     }
     $googleCart = new GoogleCart(Configuration::get('GCHECKOUT_MERCHANT_ID'), Configuration::get('GCHECKOUT_MERCHANT_KEY'), Configuration::get('GCHECKOUT_MODE'), $currency->iso_code);
     foreach ($this->context->cart->getProducts() as $product) {
         $googleCart->AddItem(new GoogleItem(utf8_decode($product['name'] . ((isset($product['attributes']) and !empty($product['attributes'])) ? ' - ' . $product['attributes'] : '')), utf8_decode($product['description_short']), (int) $product['cart_quantity'], $product['price_wt'], strtoupper(Configuration::get('PS_WEIGHT_UNIT')), (double) $product['weight']));
     }
     if ($wrapping = $this->context->cart->getOrderTotal(true, Cart::ONLY_WRAPPING)) {
         $googleCart->AddItem(new GoogleItem(utf8_decode($this->l('Wrapping')), '', 1, $wrapping));
     }
     if (_PS_VERSION_ < '1.5') {
         foreach ($this->context->cart->getDiscounts() as $voucher) {
             $googleCart->AddItem(new GoogleItem(utf8_decode($voucher['name']), utf8_decode($voucher['description']), 1, '-' . $voucher['value_real']));
         }
     } else {
         foreach ($this->context->cart->getCartRules() as $cart_tule) {
             $googleCart->AddItem(new GoogleItem(utf8_decode($cart_tule['code']), utf8_decode($cart_tule['name']), 1, '-' . $cart_tule['value_real']));
         }
     }
     if (!Configuration::get('GCHECKOUT_NO_SHIPPING')) {
         $carrier = new Carrier((int) $this->context->cart->id_carrier, $this->context->language->id);
         $googleCart->AddShipping(new GoogleFlatRateShipping(utf8_decode($carrier->name), $this->context->cart->getOrderShippingCost($this->context->cart->id_carrier)));
     }
     $googleCart->SetEditCartUrl(Tools::getShopDomainSsl(true, true) . __PS_BASE_URI__ . 'order.php');
     $googleCart->SetContinueShoppingUrl(Tools::getShopDomainSsl(true, true) . __PS_BASE_URI__ . 'order-confirmation.php');
     $googleCart->SetRequestBuyerPhone(false);
     $googleCart->SetMerchantPrivateData($this->context->cart->id . '|' . $this->context->cart->secure_key);
     $total = $this->context->cart->getOrderTotal();
     $this->context->smarty->assign(array('googleCheckoutExtraForm' => $googleCart->CheckoutButtonCode(), 'total' => $total, 'googleTotal' => $total, 'GC_Link' => $this->context->link->getPageLink('order', true, NULL)));
     $this->setTemplate('confirm.tpl');
 }
コード例 #2
0
ファイル: payment.php プロジェクト: priyankajsr19/indusdiva2
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
*  @author PrestaShop SA <*****@*****.**>
*  @copyright  2007-2011 PrestaShop SA
*  @version  Release: $Revision: 6898 $
*  @license    http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
*  International Registered Trademark & Property of PrestaShop SA
*/
include dirname(__FILE__) . '/../../config/config.inc.php';
include dirname(__FILE__) . '/../../init.php';
include dirname(__FILE__) . '/gcheckout.php';
if (!$cookie->isLogged(true)) {
    Tools::redirect('authentication.php?back=order.php');
} elseif (!$cart->getOrderTotal(true, Cart::BOTH)) {
    Tools::displayError('Error: Empty cart');
}
$gcheckout = new GCheckout();
// Prepare payment
$gcheckout->preparePayment();
include dirname(__FILE__) . '/../../header.php';
// Display
echo $gcheckout->display('gcheckout.php', 'confirm.tpl');
include_once dirname(__FILE__) . '/../../footer.php';
コード例 #3
0
ファイル: validation.php プロジェクト: sealence/local
 *    ['google-order-number']['VALUE']);
 *
 */
switch ($root) {
    case "request-received":
        break;
    case "error":
        break;
    case "diagnosis":
        break;
    case "checkout-redirect":
        break;
    case "merchant-calculation-callback":
        break;
    case "new-order-notification":
        $gcheckout = new GCheckout();
        $id_cart = intval($data[$root]['shopping-cart']['merchant-private-data']['VALUE']);
        $cart = new Cart($id_cart);
        $orderTotal = floatval($data[$root]['order-total']['VALUE']);
        $gcheckout->validateOrder($id_cart, _PS_OS_PAYMENT_, $cart->getOrderTotal(), $gcheckout->displayName);
        $Gresponse->SendAck();
        break;
    case "order-state-change-notification":
        $Gresponse->SendAck();
        break;
    case "charge-amount-notification":
        $Gresponse->SendAck();
        break;
    case "chargeback-amount-notification":
        $Gresponse->SendAck();
        break;
コード例 #4
0
 */
switch ($root) {
    case "request-received":
        break;
    case "error":
        break;
    case "diagnosis":
        break;
    case "checkout-redirect":
        break;
    case "merchant-calculation-callback":
        break;
    case "new-order-notification":
        // secure_cart[0] => id_cart
        // secure_cart[1] => secure_key
        $gcheckout = new GCheckout();
        $secure_cart = explode('|', $data[$root]['shopping-cart']['merchant-private-data']['VALUE']);
        $cart = new Cart((int) $secure_cart[0]);
        $currency = $gcheckout->getCurrency((int) $cart->id_currency);
        unset($cart);
        $orderTotal = (double) $data[$root]['order-total']['VALUE'];
        $gcheckout->validateOrder((int) $secure_cart[0], Configuration::get('PS_OS_PAYMENT'), (double) $orderTotal, $gcheckout->displayName, NULL, array(), NULL, false, $secure_cart[1]);
        $Gresponse->SendAck();
        break;
    case "order-state-change-notification":
        $Gresponse->SendAck();
        break;
    case "charge-amount-notification":
        $Gresponse->SendAck();
        break;
    case "chargeback-amount-notification":
コード例 #5
0
ファイル: payment.php プロジェクト: Bruno-2M/prestashop
<?php

include dirname(__FILE__) . '/../../config/config.inc.php';
include dirname(__FILE__) . '/../../header.php';
include dirname(__FILE__) . '/gcheckout.php';
if (!$cookie->isLogged()) {
    Tools::redirect('authentication.php?back=order.php');
}
$gcheckout = new GCheckout();
echo $gcheckout->execPayment($cart);
include_once dirname(__FILE__) . '/../../footer.php';