function TestGoogleCartSimple()
    {
        $Gcart = new googlecart('123', 'abc', "sandbox", 'GBP');
        $Gitem = new GoogleItem('Name', 'description', '3', '12.34');
        $Gitem->SetMerchantPrivateItemData(new MerchantPrivateItemData('PrivateItemData'));
        $Gitem->SetMerchantItemId('123-4321');
        //    $Gitem->SetTaxTableSelector('TaxableGood');
        $Gcart->AddItem($Gitem);
        $this->assertEquals(trim($Gcart->getXML()), trim('<?xml version="1.0" encoding="utf-8"?>
<checkout-shopping-cart xmlns="http://checkout.google.com/schema/2">
  <shopping-cart>
    <items>
      <item>
        <item-name>Name</item-name>
        <item-description>description</item-description>
        <unit-price currency="GBP">12.34</unit-price>
        <quantity>3</quantity>
        <merchant-private-item-data>PrivateItemData</merchant-private-item-data>
        <merchant-item-id>123-4321</merchant-item-id>
      </item>
    </items>
  </shopping-cart>
  <checkout-flow-support>
    <merchant-checkout-flow-support>
    </merchant-checkout-flow-support>
  </checkout-flow-support>
</checkout-shopping-cart>'));
    }
Exemple #2
0
{
    return settype($val, 'integer') ? $val : 0;
}
function makeSqlFloat($val)
{
    return settype($val, 'float') ? $val : 0;
}
$googlepayment = new googlecheckout();
$cart = $_SESSION['cart'];
$total_weight = $cart->show_weight();
$total_count = $cart->count_contents();
require 'googlecheckout/library/googlecart.php';
require 'googlecheckout/library/googleitem.php';
require 'googlecheckout/library/googleshipping.php';
require 'googlecheckout/library/googletax.php';
$Gcart = new googlecart($googlepayment->merchantid, $googlepayment->merchantkey, MODULE_PAYMENT_GOOGLECHECKOUT_MODE == 'https://sandbox.google.com/checkout/' ? "sandbox" : "production", DEFAULT_CURRENCY);
$Gwarnings = array();
if (MODULE_PAYMENT_GOOGLECHECKOUT_MODE == 'https://sandbox.google.com/checkout/') {
    $Gwarnings[] = GOOGLECHECKOUT_STRING_WARN_USING_SANDBOX;
}
// Check installed Version
if (MODULE_PAYMENT_GOOGLECHECKOUT_VERSION != GOOGLECHECKOUT_FILES_VERSION) {
    $Gcart->SetButtonVariant(false);
    $Gwarnings[] = sprintf(GOOGLECHECKOUT_STRING_WARN_MIX_VERSIONS, MODULE_PAYMENT_GOOGLECHECKOUT_VERSION, GOOGLECHECKOUT_FILES_VERSION);
}
if ($googlepayment->merchantid == '' || $googlepayment->merchantkey == '') {
    $Gcart->SetButtonVariant(false);
    $Gwarnings[] = GOOGLECHECKOUT_STRING_WARN_NO_MERCHANT_ID_KEY;
}
$products = $cart->get_products();
require_once DIR_WS_CLASSES . 'order.php';