This commit is contained in:
@@ -1,11 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<module>
|
||||
<name>gcheckout</name>
|
||||
<displayName>Google Checkout</displayName>
|
||||
<version>1.1</version>
|
||||
<description>Google Checkout API implementation</description>
|
||||
<author>PrestaShop</author>
|
||||
<tab>payments_gateways</tab>
|
||||
<is_configurable>1</is_configurable>
|
||||
<need_instance>1</need_instance>
|
||||
</module>
|
||||
@@ -1,56 +0,0 @@
|
||||
{*
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License (AFL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/afl-3.0.php
|
||||
* 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 <contact@prestashop.com>
|
||||
* @copyright 2007-2011 PrestaShop SA
|
||||
* @version Release: $Revision: 1.4 $
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*}
|
||||
|
||||
{capture name=path}<a href="{$link->getPageLink('order', true)}">{l s='Your shopping cart' mod='gcheckout'}</a><span class="navigation-pipe">{$navigationPipe}</span>{l s='Google Checkout' mod='gcheckout'}{/capture}
|
||||
{include file="$tpl_dir./breadcrumb.tpl"}
|
||||
|
||||
<h2>{l s='Order summary' mod='gcheckout'}</h2>
|
||||
|
||||
{assign var='current_step' value='payment'}
|
||||
{include file="$tpl_dir./order-steps.tpl"}
|
||||
|
||||
<p>
|
||||
<img src="gcheckout.gif" alt="{l s='Google Checkout' mod='gcheckout'}" style="margin-bottom: 5px" />
|
||||
<br />{l s='You have chosen to pay with Google Checkout.' mod='gcheckout'}
|
||||
<br/><br />
|
||||
{l s='Here is a short summary of your order:' mod='gcheckout'}
|
||||
</p>
|
||||
<p style="margin-top:20px;">
|
||||
- {l s='The total amount of your order is' mod='gcheckout'}
|
||||
<span class="price">{convertPriceWithCurrency price=$total currency=$currency}</span> {if $use_taxes == 1}{l s='(tax incl.)' mod='gcheckout'}{/if}
|
||||
</p>
|
||||
<p>
|
||||
- {l s='We accept the following currency to be sent by Google Checkout:' mod='gcheckout'} <b>{$currency->name}</b>
|
||||
</p>
|
||||
<p>
|
||||
<b>{l s='Please confirm your order by clicking \'I confirm my order\'' mod='gcheckout'}.</b>
|
||||
</p>
|
||||
<p class="cart_navigation">
|
||||
<a href="{$link->getPageLink('order', true)}?step=3" class="button_large">{l s='Other payment methods' mod='gcheckout'}</a>
|
||||
<a href="#" class="exclusive_large" onclick="$('#gcheckout_form').submit();return false;">{l s='I confirm my order' mod='gcheckout'}</a>
|
||||
</p>
|
||||
|
||||
{$googleCheckoutExtraForm}
|
||||
@@ -1,42 +0,0 @@
|
||||
<?php
|
||||
|
||||
global $_MODULE;
|
||||
$_MODULE = array();
|
||||
$_MODULE['<{gcheckout}prestashop>confirm_a40cab5994f36d4c48103a22ca082e8f'] = 'Ihr Warenkorb';
|
||||
$_MODULE['<{gcheckout}prestashop>confirm_6c132b5e262594950586ae13a7d3aa94'] = 'Google Checkout';
|
||||
$_MODULE['<{gcheckout}prestashop>confirm_f1d3b424cd68795ecaa552883759aceb'] = 'Bestellsumme';
|
||||
$_MODULE['<{gcheckout}prestashop>confirm_3575814f89e55ba8061c55dd93214aae'] = 'Sie haben Google Checkout für Ihre Zahlung ausgewählt.';
|
||||
$_MODULE['<{gcheckout}prestashop>confirm_c884ed19483d45970c5bf23a681e2dd2'] = 'Hier eine kurze Zusammenfassung Ihrer Bestellung:';
|
||||
$_MODULE['<{gcheckout}prestashop>confirm_e2867a925cba382f1436d1834bb52a1c'] = 'Der Gesamtbetrag Ihrer Bestellung beträgt';
|
||||
$_MODULE['<{gcheckout}prestashop>confirm_1f87346a16cf80c372065de3c54c86d9'] = '(Inkl. Mwst.)';
|
||||
$_MODULE['<{gcheckout}prestashop>confirm_eecc59d9ca953545b6c5ac9bf11ded00'] = 'Wir akzeptieren die folgende Währung bei einer Zahlung mit Google Checkout:';
|
||||
$_MODULE['<{gcheckout}prestashop>confirm_0881a11f7af33bc1b43e437391129d66'] = 'Bitte bestätigen Sie Ihre Bestellung durch Klicken auf \"Ich bestätige meine Bestellung\"';
|
||||
$_MODULE['<{gcheckout}prestashop>confirm_569fd05bdafa1712c4f6be5b153b8418'] = 'Andere Zahlungsmethoden';
|
||||
$_MODULE['<{gcheckout}prestashop>confirm_46b9e3665f187c739c55983f757ccda0'] = 'Ich bestätige meine Bestellung';
|
||||
$_MODULE['<{gcheckout}prestashop>gcheckout_6c132b5e262594950586ae13a7d3aa94'] = 'Google Checkout';
|
||||
$_MODULE['<{gcheckout}prestashop>gcheckout_3f3c0194c5adbe6953eb571f125af16d'] = 'Google Checkout-API-Implementierung';
|
||||
$_MODULE['<{gcheckout}prestashop>gcheckout_4402acab1c8f90dcf4a31dc96833bd86'] = 'Keine Währung für dieses Modul eingestellt';
|
||||
$_MODULE['<{gcheckout}prestashop>gcheckout_82b8bb0d807e6d2e43a068f954c3559f'] = 'Händler-ID scheint falsch zu sein';
|
||||
$_MODULE['<{gcheckout}prestashop>gcheckout_9dd37c2106ceacbf0a40778b2109c386'] = 'Händler-Schlüssel scheint falsch zu sein';
|
||||
$_MODULE['<{gcheckout}prestashop>gcheckout_f4f70727dc34561dfde1a3c529b6205c'] = 'Einstellungen';
|
||||
$_MODULE['<{gcheckout}prestashop>gcheckout_a1ffd2dc2538ea3093532029514d42ac'] = 'Nutzen Sie zuerst die Sandbox, um das Modul zu testen, dann können Sie den Echtbetrieb-Modus benutzen, wenn alles in Ordnung ist. Vergessen Sie nicht, je nach Modus Händler-Schlüssel und -ID zu ändern!';
|
||||
$_MODULE['<{gcheckout}prestashop>gcheckout_650be61892bf690026089544abbd9d26'] = 'Modus';
|
||||
$_MODULE['<{gcheckout}prestashop>gcheckout_7f80fcc452c2f1ed2bb51b39d0864df1'] = 'Echtzeit';
|
||||
$_MODULE['<{gcheckout}prestashop>gcheckout_2652eec977dcb2a5aea85f5bec235b05'] = 'Sandbox';
|
||||
$_MODULE['<{gcheckout}prestashop>gcheckout_76055653a95e0a559b734ec322d89632'] = 'Sie finden diese Schlüssel in Ihrem Google Checkout-Konto> Einstellungen> Integration. Sowohl Sandkasten als auch Echtzeit-Modus haben diese Tasten.';
|
||||
$_MODULE['<{gcheckout}prestashop>gcheckout_229a7ec501323b94db7ff3157a7623c9'] = 'Händler-ID';
|
||||
$_MODULE['<{gcheckout}prestashop>gcheckout_795acb9a0c89791314d3032fe65eeb92'] = 'Händler-Schlüssel';
|
||||
$_MODULE['<{gcheckout}prestashop>gcheckout_a7ba8619e32091c343b340ec5b80e541'] = 'Wenn Sie dieses Feld ankreuzen, werden die Käufer in der Lage sein, die Versandkosten zu sehen, die Sie in Google Checkout auf der Kaufseite eingerichtet haben.';
|
||||
$_MODULE['<{gcheckout}prestashop>gcheckout_de6fa0b14f259108c4b38e5be0374f46'] = 'Google Versandkosten benutzen';
|
||||
$_MODULE['<{gcheckout}prestashop>gcheckout_74692aae1cff5dc9dfd44f8c4e0540ad'] = 'Sie können die Server-zu-Server-Kommunikation protokollieren. Die Protokolldateien sind';
|
||||
$_MODULE['<{gcheckout}prestashop>gcheckout_be5d5d37542d75f93a87094459f76678'] = 'und';
|
||||
$_MODULE['<{gcheckout}prestashop>gcheckout_f2f19b2cbcb395e254ebb1d9bf7cccd4'] = 'Wenn Sie sie aktivieren, vergewissern Sie sich, dass Sie sie schützen, indem Sie eine .htaccess-Datei ins gleiche Verzeichnis speichern. Wenn Sie dies vergessen, werden sie von jedermann lesbar sein';
|
||||
$_MODULE['<{gcheckout}prestashop>gcheckout_b2d37ae1cedf42ff874289b721860af2'] = 'Logs';
|
||||
$_MODULE['<{gcheckout}prestashop>gcheckout_38fb7d24e0d60a048f540ecb18e13376'] = 'Speichern';
|
||||
$_MODULE['<{gcheckout}prestashop>gcheckout_a82be0f551b8708bc08eb33cd9ded0cf'] = 'Information';
|
||||
$_MODULE['<{gcheckout}prestashop>gcheckout_968913ba2d4e25f3589d4c612ecbaa8d'] = 'Um Ihr Google Checkout-Modul zu verwenden, müssen Sie in Ihr Google Checkout-Konto (Sandbox-Konto sowie Live-Konto) konfigurieren. Melden Sie sich bei Google Checkout an, gehen Sie dann auf Einstellungen> Integration. Die API-Rückruf-URL lautet:';
|
||||
$_MODULE['<{gcheckout}prestashop>gcheckout_dba727a9adc372723baef4533a7fc9da'] = 'Die Callback-Methode muss eingestellt werden auf';
|
||||
$_MODULE['<{gcheckout}prestashop>gcheckout_0d46d15f70a7cfa670545b308c022840'] = 'Die bestellungen müssen mit der gleichen Währung wie Ihr Verkäufer-Konto eingestelltwerden. Warenkörbe in anderen Währungen werden umgerechnet, wenn der Kunde mit diesem Modul bezahlen möchte.';
|
||||
$_MODULE['<{gcheckout}prestashop>gcheckout_8dd85f4218069de952672fe3180dacdb'] = 'Bezahlen Sie mit GoogleCheckout';
|
||||
$_MODULE['<{gcheckout}prestashop>gcheckout_ba794350deb07c0c96fe73bd12239059'] = 'Verpackung';
|
||||
$_MODULE['<{gcheckout}prestashop>gcheckout_9f06b28a40790c4c4df5739bce3c1eb0'] = 'Versandkosten';
|
||||
@@ -1,4 +0,0 @@
|
||||
<?php
|
||||
|
||||
global $_MODULE;
|
||||
$_MODULE = array();
|
||||
@@ -1,42 +0,0 @@
|
||||
<?php
|
||||
|
||||
global $_MODULE;
|
||||
$_MODULE = array();
|
||||
$_MODULE['<{gcheckout}prestashop>confirm_a40cab5994f36d4c48103a22ca082e8f'] = 'Su carrito de la compra';
|
||||
$_MODULE['<{gcheckout}prestashop>confirm_6c132b5e262594950586ae13a7d3aa94'] = 'Google Checkout';
|
||||
$_MODULE['<{gcheckout}prestashop>confirm_f1d3b424cd68795ecaa552883759aceb'] = 'Resumen del pedido ';
|
||||
$_MODULE['<{gcheckout}prestashop>confirm_3575814f89e55ba8061c55dd93214aae'] = 'Ha elegido pagar con Google Checkout. ';
|
||||
$_MODULE['<{gcheckout}prestashop>confirm_c884ed19483d45970c5bf23a681e2dd2'] = 'Breve resumen del pedido: ';
|
||||
$_MODULE['<{gcheckout}prestashop>confirm_e2867a925cba382f1436d1834bb52a1c'] = 'El importe total de su pedido es de';
|
||||
$_MODULE['<{gcheckout}prestashop>confirm_1f87346a16cf80c372065de3c54c86d9'] = '(TTC)';
|
||||
$_MODULE['<{gcheckout}prestashop>confirm_eecc59d9ca953545b6c5ac9bf11ded00'] = 'Aceptamos esta divisa para el pago : ';
|
||||
$_MODULE['<{gcheckout}prestashop>confirm_0881a11f7af33bc1b43e437391129d66'] = 'Confirme su pedido pulsando \"Confirmar pedido\"';
|
||||
$_MODULE['<{gcheckout}prestashop>confirm_569fd05bdafa1712c4f6be5b153b8418'] = 'Otras formas de pago';
|
||||
$_MODULE['<{gcheckout}prestashop>confirm_46b9e3665f187c739c55983f757ccda0'] = 'Confirmar pedido';
|
||||
$_MODULE['<{gcheckout}prestashop>gcheckout_6c132b5e262594950586ae13a7d3aa94'] = 'Google checkout';
|
||||
$_MODULE['<{gcheckout}prestashop>gcheckout_3f3c0194c5adbe6953eb571f125af16d'] = 'Implementación de API de Google Checkout ';
|
||||
$_MODULE['<{gcheckout}prestashop>gcheckout_4402acab1c8f90dcf4a31dc96833bd86'] = 'No hay moneda configurada para este módulo';
|
||||
$_MODULE['<{gcheckout}prestashop>gcheckout_82b8bb0d807e6d2e43a068f954c3559f'] = 'La ID del comerciante parece incorrecta';
|
||||
$_MODULE['<{gcheckout}prestashop>gcheckout_9dd37c2106ceacbf0a40778b2109c386'] = 'La contraseña del comerciante parece incorrecta';
|
||||
$_MODULE['<{gcheckout}prestashop>gcheckout_f4f70727dc34561dfde1a3c529b6205c'] = 'Ajustes';
|
||||
$_MODULE['<{gcheckout}prestashop>gcheckout_a1ffd2dc2538ea3093532029514d42ac'] = 'Primero utilice el sandbox para probar el múdulo, luego podrá utilizarlo en modo real si toda la configuración se hizo correctamente. No olvide cambiar su contraseña e identificación mercantil según el modo';
|
||||
$_MODULE['<{gcheckout}prestashop>gcheckout_650be61892bf690026089544abbd9d26'] = 'Modo';
|
||||
$_MODULE['<{gcheckout}prestashop>gcheckout_7f80fcc452c2f1ed2bb51b39d0864df1'] = 'Real';
|
||||
$_MODULE['<{gcheckout}prestashop>gcheckout_2652eec977dcb2a5aea85f5bec235b05'] = 'Sandbox';
|
||||
$_MODULE['<{gcheckout}prestashop>gcheckout_76055653a95e0a559b734ec322d89632'] = 'Puede encontrar estas claves en su cuenta de comprobación de Google > Ajustes > Integración. En Sandbox y modo real tiene las mismas claves.';
|
||||
$_MODULE['<{gcheckout}prestashop>gcheckout_229a7ec501323b94db7ff3157a7623c9'] = 'ID comerciante';
|
||||
$_MODULE['<{gcheckout}prestashop>gcheckout_795acb9a0c89791314d3032fe65eeb92'] = 'Contraseña comerciante';
|
||||
$_MODULE['<{gcheckout}prestashop>gcheckout_a7ba8619e32091c343b340ec5b80e541'] = 'Si marca esta casilla, los compradores podrán ver en la página de compra los gastos de transporte que usted ha pagado en Google Checkout';
|
||||
$_MODULE['<{gcheckout}prestashop>gcheckout_de6fa0b14f259108c4b38e5be0374f46'] = 'Utilice los gastos de transporte Google';
|
||||
$_MODULE['<{gcheckout}prestashop>gcheckout_74692aae1cff5dc9dfd44f8c4e0540ad'] = 'Usted puede registrar la comunicación del servidor-a-servidor. Los ficheros de diario son';
|
||||
$_MODULE['<{gcheckout}prestashop>gcheckout_be5d5d37542d75f93a87094459f76678'] = 'y';
|
||||
$_MODULE['<{gcheckout}prestashop>gcheckout_f2f19b2cbcb395e254ebb1d9bf7cccd4'] = 'Si usted lo activa, está seguro de protegerlos poniendo un archivo .htaccess en el mismo directorio. Si usted olvida hacer eso, cualquiera podrá leerlos';
|
||||
$_MODULE['<{gcheckout}prestashop>gcheckout_b2d37ae1cedf42ff874289b721860af2'] = 'Registros';
|
||||
$_MODULE['<{gcheckout}prestashop>gcheckout_38fb7d24e0d60a048f540ecb18e13376'] = 'Guardar';
|
||||
$_MODULE['<{gcheckout}prestashop>gcheckout_a82be0f551b8708bc08eb33cd9ded0cf'] = 'Información';
|
||||
$_MODULE['<{gcheckout}prestashop>gcheckout_968913ba2d4e25f3589d4c612ecbaa8d'] = 'Para utilizar su módulo de la comprobación de Google, tiene que configurar su cuenta Google (cuenta de sandbox y su cuenta). La conexión a la comprobación de la cuenta Google > ajustes; Integración. La URL del servicio repetido del API es:';
|
||||
$_MODULE['<{gcheckout}prestashop>gcheckout_dba727a9adc372723baef4533a7fc9da'] = 'El método de callback debe fijarse a ';
|
||||
$_MODULE['<{gcheckout}prestashop>gcheckout_0d46d15f70a7cfa670545b308c022840'] = 'Los pedidos deben pasarse con la misma moneda que la cuenta del vendedor. Los carritos en otras monedas serán convertidas si el cliente elige pagar con este módulo.';
|
||||
$_MODULE['<{gcheckout}prestashop>gcheckout_8dd85f4218069de952672fe3180dacdb'] = 'Pagar con GoogleCheckout';
|
||||
$_MODULE['<{gcheckout}prestashop>gcheckout_ba794350deb07c0c96fe73bd12239059'] = 'Embalaje ';
|
||||
$_MODULE['<{gcheckout}prestashop>gcheckout_9f06b28a40790c4c4df5739bce3c1eb0'] = 'Costos de envío';
|
||||
@@ -1,42 +0,0 @@
|
||||
<?php
|
||||
|
||||
global $_MODULE;
|
||||
$_MODULE = array();
|
||||
$_MODULE['<{gcheckout}prestashop>confirm_a40cab5994f36d4c48103a22ca082e8f'] = 'Votre panier';
|
||||
$_MODULE['<{gcheckout}prestashop>confirm_6c132b5e262594950586ae13a7d3aa94'] = 'Google Checkout';
|
||||
$_MODULE['<{gcheckout}prestashop>confirm_f1d3b424cd68795ecaa552883759aceb'] = 'Résumé de la commande';
|
||||
$_MODULE['<{gcheckout}prestashop>confirm_3575814f89e55ba8061c55dd93214aae'] = 'Vous avez choisi de payer avec Google Checkout';
|
||||
$_MODULE['<{gcheckout}prestashop>confirm_c884ed19483d45970c5bf23a681e2dd2'] = 'Voici un court résumé de votre commande :';
|
||||
$_MODULE['<{gcheckout}prestashop>confirm_e2867a925cba382f1436d1834bb52a1c'] = 'Le montant total de votre commande s\'élève à';
|
||||
$_MODULE['<{gcheckout}prestashop>confirm_1f87346a16cf80c372065de3c54c86d9'] = '(TTC)';
|
||||
$_MODULE['<{gcheckout}prestashop>confirm_eecc59d9ca953545b6c5ac9bf11ded00'] = 'Nous acceptons la devise suivante pour votre paiement :';
|
||||
$_MODULE['<{gcheckout}prestashop>confirm_0881a11f7af33bc1b43e437391129d66'] = 'Merci de confirmer votre commande en cliquant sur \"Je confirme ma commande\"';
|
||||
$_MODULE['<{gcheckout}prestashop>confirm_569fd05bdafa1712c4f6be5b153b8418'] = 'Autres moyens de paiement';
|
||||
$_MODULE['<{gcheckout}prestashop>confirm_46b9e3665f187c739c55983f757ccda0'] = 'Je confirme ma commande';
|
||||
$_MODULE['<{gcheckout}prestashop>gcheckout_6c132b5e262594950586ae13a7d3aa94'] = 'Google Checkout';
|
||||
$_MODULE['<{gcheckout}prestashop>gcheckout_3f3c0194c5adbe6953eb571f125af16d'] = 'Implémentation de l\'API de Google Checkout';
|
||||
$_MODULE['<{gcheckout}prestashop>gcheckout_4402acab1c8f90dcf4a31dc96833bd86'] = 'Aucune devise disponible pour ce module';
|
||||
$_MODULE['<{gcheckout}prestashop>gcheckout_82b8bb0d807e6d2e43a068f954c3559f'] = 'L\'ID marchand semble incorrect';
|
||||
$_MODULE['<{gcheckout}prestashop>gcheckout_9dd37c2106ceacbf0a40778b2109c386'] = 'La clé marchand semble incorrecte';
|
||||
$_MODULE['<{gcheckout}prestashop>gcheckout_f4f70727dc34561dfde1a3c529b6205c'] = 'Paramètres';
|
||||
$_MODULE['<{gcheckout}prestashop>gcheckout_a1ffd2dc2538ea3093532029514d42ac'] = 'Utilisez le mode bac à sable pour tester le module avant de l\'utiliser en mode réel. N\'oubliez pas de changer vos clés et ID marchand selon le mode !';
|
||||
$_MODULE['<{gcheckout}prestashop>gcheckout_650be61892bf690026089544abbd9d26'] = 'Mode';
|
||||
$_MODULE['<{gcheckout}prestashop>gcheckout_7f80fcc452c2f1ed2bb51b39d0864df1'] = 'Réel';
|
||||
$_MODULE['<{gcheckout}prestashop>gcheckout_2652eec977dcb2a5aea85f5bec235b05'] = 'Bac à sable';
|
||||
$_MODULE['<{gcheckout}prestashop>gcheckout_76055653a95e0a559b734ec322d89632'] = 'Vous trouverez ces identifiants dans votre compte Google Checkout > Settings > Integration. Les modes réel et bac à sable ont tous les deux besoin de ces clés.';
|
||||
$_MODULE['<{gcheckout}prestashop>gcheckout_229a7ec501323b94db7ff3157a7623c9'] = 'ID marchand';
|
||||
$_MODULE['<{gcheckout}prestashop>gcheckout_795acb9a0c89791314d3032fe65eeb92'] = 'Clé marchand';
|
||||
$_MODULE['<{gcheckout}prestashop>gcheckout_a7ba8619e32091c343b340ec5b80e541'] = 'Si vous cochez cette case, les acheteurs pourront voir sur la page d\'achat les frais de transport que vous avez réglé dans Google Checkout';
|
||||
$_MODULE['<{gcheckout}prestashop>gcheckout_de6fa0b14f259108c4b38e5be0374f46'] = 'Utilisez les frais de transport Google';
|
||||
$_MODULE['<{gcheckout}prestashop>gcheckout_74692aae1cff5dc9dfd44f8c4e0540ad'] = 'Vous pouvez archiver les échanges de serveur à serveur. Les fichiers d\'archives sont';
|
||||
$_MODULE['<{gcheckout}prestashop>gcheckout_be5d5d37542d75f93a87094459f76678'] = 'et';
|
||||
$_MODULE['<{gcheckout}prestashop>gcheckout_f2f19b2cbcb395e254ebb1d9bf7cccd4'] = 'Si vous activez les logs, soyez certain de protéger ces fichiers en plaçant un fichier .htaccess dans le même répertoire. Si vous ne le faites pas, ils seront lisibles par tous vos clients.';
|
||||
$_MODULE['<{gcheckout}prestashop>gcheckout_b2d37ae1cedf42ff874289b721860af2'] = 'Archivage';
|
||||
$_MODULE['<{gcheckout}prestashop>gcheckout_38fb7d24e0d60a048f540ecb18e13376'] = 'Enregistrer';
|
||||
$_MODULE['<{gcheckout}prestashop>gcheckout_a82be0f551b8708bc08eb33cd9ded0cf'] = 'Informations';
|
||||
$_MODULE['<{gcheckout}prestashop>gcheckout_968913ba2d4e25f3589d4c612ecbaa8d'] = 'Pour utiliser votre module Google Checkout, vous devez configurer votre compte marchand (en mode bac à sable comme en mode réel). Accédez à votre compte Google Checkout puis allez dans Settings > Integration. L\'API callback URL doit être :';
|
||||
$_MODULE['<{gcheckout}prestashop>gcheckout_dba727a9adc372723baef4533a7fc9da'] = 'La \"callback method\" doit être réglée sur';
|
||||
$_MODULE['<{gcheckout}prestashop>gcheckout_0d46d15f70a7cfa670545b308c022840'] = 'Les commandes doivent être passées en utilisant la même devise que celle indiquée dans votre compte marchand. Les paniers utilisant d\'autres devises seront convertis si l\'utilisateur décide de payer par le biais de ce module.';
|
||||
$_MODULE['<{gcheckout}prestashop>gcheckout_8dd85f4218069de952672fe3180dacdb'] = 'Payer par GoogleCheckout';
|
||||
$_MODULE['<{gcheckout}prestashop>gcheckout_ba794350deb07c0c96fe73bd12239059'] = 'Emballage';
|
||||
$_MODULE['<{gcheckout}prestashop>gcheckout_9f06b28a40790c4c4df5739bce3c1eb0'] = 'Frais de port';
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 2.5 KiB |
@@ -1,206 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License (AFL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/afl-3.0.php
|
||||
* 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 <contact@prestashop.com>
|
||||
* @copyright 2007-2011 PrestaShop SA
|
||||
* @version Release: $Revision: 1.4 $
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
if (!defined('_CAN_LOAD_FILES_'))
|
||||
exit;
|
||||
|
||||
class GCheckout extends PaymentModule
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
$this->name = 'gcheckout';
|
||||
$this->tab = 'payments_gateways';
|
||||
$this->version = 1.1;
|
||||
$this->author = 'PrestaShop';
|
||||
|
||||
$this->currencies = true;
|
||||
$this->currencies_mode = 'radio';
|
||||
|
||||
parent::__construct();
|
||||
|
||||
$this->displayName = $this->l('Google Checkout');
|
||||
$this->description = $this->l('Google Checkout API implementation');
|
||||
|
||||
if (!sizeof(Currency::checkPaymentCurrencies($this->id)))
|
||||
$this->warning = $this->l('No currency set for this module');
|
||||
}
|
||||
|
||||
function install()
|
||||
{
|
||||
if (!parent::install() OR !$this->registerHook('payment') OR !$this->registerHook('paymentReturn') OR !Configuration::updateValue('GCHECKOUT_MERCHANT_ID', '822305931131113')
|
||||
OR !Configuration::updateValue('GCHECKOUT_MERCHANT_KEY', '2Lv_osMomVIocnLK0aif3A') OR !Configuration::updateValue('GCHECKOUT_LOGS', '1') OR !Configuration::updateValue('GCHECKOUT_MODE', 'real')
|
||||
OR !Configuration::updateValue('GCHECKOUT_NO_SHIPPING', '0'))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
function uninstall()
|
||||
{
|
||||
return (parent::uninstall() AND Configuration::deleteByName('GCHECKOUT_MERCHANT_ID') AND Configuration::deleteByName('GCHECKOUT_MERCHANT_KEY') AND
|
||||
Configuration::deleteByName('GCHECKOUT_MODE') AND Configuration::deleteByName('GCHECKOUT_LOGS') AND Configuration::deleteByName('GCHECKOUT_NO_SHIPPING'));
|
||||
}
|
||||
|
||||
function getContent()
|
||||
{
|
||||
global $currentIndex, $cookie;
|
||||
|
||||
if (Tools::isSubmit('submitGoogleCheckout'))
|
||||
{
|
||||
$errors = array();
|
||||
if (($merchant_id = Tools::getValue('gcheckout_merchant_id')) AND preg_match('/[0-9]{15}/', $merchant_id))
|
||||
Configuration::updateValue('GCHECKOUT_MERCHANT_ID', $merchant_id);
|
||||
else
|
||||
$errors[] = '<div class="warning warn"><h3>'.$this->l('Merchant ID seems to be wrong').'</h3></div>';
|
||||
if (($merchant_key = Tools::getValue('gcheckout_merchant_key')) AND preg_match('/[a-zA-Z0-9_-]{22}/', $merchant_key))
|
||||
Configuration::updateValue('GCHECKOUT_MERCHANT_KEY', $merchant_key);
|
||||
else
|
||||
$errors[] = '<div class="warning warn"><h3>'.$this->l('Merchant key seems to be wrong').'</h3></div>';
|
||||
if ($mode = (Tools::getValue('gcheckout_mode') == 'real' ? 'real' : 'sandbox'))
|
||||
Configuration::updateValue('GCHECKOUT_MODE', $mode);
|
||||
if (Tools::getValue('gcheckout_logs'))
|
||||
Configuration::updateValue('GCHECKOUT_LOGS', 1);
|
||||
else
|
||||
Configuration::updateValue('GCHECKOUT_LOGS', 0);
|
||||
if (!sizeof($errors))
|
||||
Tools::redirectAdmin($currentIndex.'&configure=gcheckout&token='.Tools::getValue('token').'&conf=4');
|
||||
foreach ($errors as $error)
|
||||
echo $error;
|
||||
}
|
||||
|
||||
$html = '<h2>'.$this->displayName.'</h2>
|
||||
<form action="'.$_SERVER['REQUEST_URI'].'" method="post">
|
||||
<fieldset>
|
||||
<legend><img src="'.__PS_BASE_URI__.'modules/gcheckout/logo.gif" />'.$this->l('Settings').'</legend>
|
||||
<p>'.$this->l('Use the sandbox to test out the module then you can use the real mode if no problems arise. Remember to change your merchant key and ID according to the mode.').'</p>
|
||||
<label>
|
||||
'.$this->l('Mode').'
|
||||
</label>
|
||||
<div class="margin-form">
|
||||
<select name="gcheckout_mode">
|
||||
<option value="real"'.(Configuration::get('GCHECKOUT_MODE') == 'real' ? ' selected="selected"' : '').'>'.$this->l('Real').' </option>
|
||||
<option value="sandbox"'.(Configuration::get('GCHECKOUT_MODE') == 'sandbox' ? ' selected="selected"' : '').'>'.$this->l('Sandbox').' </option>
|
||||
</select>
|
||||
</div>
|
||||
<p>'.$this->l('You can find these keys in your Google Checkout account > Settings > Integration. Sandbox and real mode both have these keys.').'</p>
|
||||
<label>
|
||||
'.$this->l('Merchant ID').'
|
||||
</label>
|
||||
<div class="margin-form">
|
||||
<input type="text" name="gcheckout_merchant_id" value="'.Tools::getValue('gcheckout_merchant_id', Configuration::get('GCHECKOUT_MERCHANT_ID')).'" />
|
||||
</div>
|
||||
<label>
|
||||
'.$this->l('Merchant Key').'
|
||||
</label>
|
||||
<div class="margin-form">
|
||||
<input type="text" name="gcheckout_merchant_key" value="'.Tools::getValue('gcheckout_merchant_key', Configuration::get('GCHECKOUT_MERCHANT_KEY')).'" />
|
||||
</div>
|
||||
<p>'.$this->l('If you click this box, buyers will be able to see the shipping fees you have setup in Google Checkout on the purchase page.').'</p>
|
||||
<label>
|
||||
'.$this->l('Use Google shipping fees').'
|
||||
</label>
|
||||
<div class="margin-form" style="margin-top:5px">
|
||||
<input type="checkbox" name="gcheckout_no_shipping"'.(Tools::getValue('gcheckout_no_shipping', Configuration::get('GCHECKOUT_NO_SHIPPING')) ? ' checked="checked"' : '').' />
|
||||
</div>
|
||||
<p>'.$this->l('You can log the server-to-server communication. The log files are').' '.__PS_BASE_URI__.'modules/gcheckout/googleerror.log '.$this->l('and').' '.__PS_BASE_URI__.'modules/gcheckout/googlemessage.log. '.$this->l('If activated, be sure to protect them by putting a .htaccess file in the same directory. If not, they will be readable by everyone.').'</p>
|
||||
<label>
|
||||
'.$this->l('Logs').'
|
||||
</label>
|
||||
<div class="margin-form" style="margin-top:5px">
|
||||
<input type="checkbox" name="gcheckout_logs"'.(Tools::getValue('gcheckout_logs', Configuration::get('GCHECKOUT_LOGS')) ? ' checked="checked"' : '').' />
|
||||
</div>
|
||||
<div class="clear center"><input type="submit" name="submitGoogleCheckout" class="button" value="'.$this->l(' Save ').'" /></div>
|
||||
</fieldset>
|
||||
</form>
|
||||
<br /><br />
|
||||
<fieldset>
|
||||
<legend><img src="../img/admin/warning.gif" />'.$this->l('Information').'</legend>
|
||||
<p>- '.$this->l('In order to use your Google Checkout module, you must configure your Google Checkout account (sandbox account as well as live account). Log in to Google Checkout then go to Settings > Integration. The API callback URL is:').'<br />
|
||||
<b>'.Tools::getShopDomainSsl(true, true).__PS_BASE_URI__.'modules/gcheckout/validation.php</b>
|
||||
</p>
|
||||
<p>- '.$this->l('The callback method must be set to').' <b>XML</b>.</p>
|
||||
<p>- '.$this->l('Orders must be placed with the same currency as your seller account. Carts in other currencies will be converted if the customer chooses to pay with this module.').'<p>
|
||||
</fieldset>';
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
function hookPayment($params)
|
||||
{
|
||||
if (!$this->active)
|
||||
return;
|
||||
|
||||
global $smarty;
|
||||
|
||||
$smarty->assign('buttonText', $this->l('Pay with GoogleCheckout'));
|
||||
return $this->display(__FILE__, 'payment.tpl');
|
||||
}
|
||||
|
||||
function hookPaymentReturn($params)
|
||||
{
|
||||
if (!$this->active)
|
||||
return;
|
||||
|
||||
return $this->display(__FILE__, 'payment_return.tpl');
|
||||
}
|
||||
|
||||
function preparePayment()
|
||||
{
|
||||
global $smarty, $cart, $cookie;
|
||||
|
||||
require_once(dirname(__FILE__).'/library/googlecart.php');
|
||||
require_once(dirname(__FILE__).'/library/googleitem.php');
|
||||
require_once(dirname(__FILE__).'/library/googleshipping.php');
|
||||
|
||||
$currency = $this->getCurrency((int)$cart->id_currency);
|
||||
if ($cart->id_currency != $currency->id)
|
||||
{
|
||||
$cart->id_currency = (int)$currency->id;
|
||||
$cookie->id_currency = (int)$cart->id_currency;
|
||||
$cart->update();
|
||||
Tools::redirect('modules/'.$this->name.'/payment.php');
|
||||
}
|
||||
$googleCart = new GoogleCart(Configuration::get('GCHECKOUT_MERCHANT_ID'), Configuration::get('GCHECKOUT_MERCHANT_KEY'), Configuration::get('GCHECKOUT_MODE'), $currency->iso_code);
|
||||
foreach ($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')), (float)$product['weight']));
|
||||
if ($wrapping = $cart->getOrderTotal(true, Cart::ONLY_WRAPPING))
|
||||
$googleCart->AddItem(new GoogleItem(utf8_decode($this->l('Wrapping')), '', 1, $wrapping));
|
||||
foreach ($cart->getDiscounts() AS $voucher)
|
||||
$googleCart->AddItem(new GoogleItem(utf8_decode($voucher['name']), utf8_decode($voucher['description']), 1, '-'.$voucher['value_real']));
|
||||
|
||||
if (!Configuration::get('GCHECKOUT_NO_SHIPPING'))
|
||||
$googleCart->AddShipping(new GooglePickUp($this->l('Shipping costs'), $cart->getOrderShippingCost($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($cart->id.'|'.$cart->secure_key);
|
||||
$smarty->assign(array(
|
||||
'googleCheckoutExtraForm' => $googleCart->CheckoutButtonCode($this->l('Pay with GoogleCheckout'), 'LARGE'),
|
||||
'total' => $cart->getOrderTotal()
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
<?php
|
||||
|
||||
global $_MODULE;
|
||||
$_MODULE = array();
|
||||
$_MODULE['<{gcheckout}prestashop>confirm_a40cab5994f36d4c48103a22ca082e8f'] = 'Il tuo carrello';
|
||||
$_MODULE['<{gcheckout}prestashop>confirm_6c132b5e262594950586ae13a7d3aa94'] = 'Google Checkout';
|
||||
$_MODULE['<{gcheckout}prestashop>confirm_f1d3b424cd68795ecaa552883759aceb'] = 'Riepilogo ordine';
|
||||
$_MODULE['<{gcheckout}prestashop>confirm_3575814f89e55ba8061c55dd93214aae'] = 'Hai scelto di pagare con Google Checkout.';
|
||||
$_MODULE['<{gcheckout}prestashop>confirm_c884ed19483d45970c5bf23a681e2dd2'] = 'Ecco un breve riepilogo del tuo ordine:';
|
||||
$_MODULE['<{gcheckout}prestashop>confirm_e2867a925cba382f1436d1834bb52a1c'] = 'L\'importo totale del tuo ordine è';
|
||||
$_MODULE['<{gcheckout}prestashop>confirm_1f87346a16cf80c372065de3c54c86d9'] = '(Tasse incl.)';
|
||||
$_MODULE['<{gcheckout}prestashop>confirm_eecc59d9ca953545b6c5ac9bf11ded00'] = 'Accettiamo le seguente valuta da inviare tramite Google Checkout:';
|
||||
$_MODULE['<{gcheckout}prestashop>confirm_0881a11f7af33bc1b43e437391129d66'] = 'Si prega di confermare l\'ordine cliccando su \'confermo il mio ordine\'';
|
||||
$_MODULE['<{gcheckout}prestashop>confirm_569fd05bdafa1712c4f6be5b153b8418'] = 'Altri metodi di pagamento';
|
||||
$_MODULE['<{gcheckout}prestashop>confirm_46b9e3665f187c739c55983f757ccda0'] = 'Confermo il mio ordine';
|
||||
$_MODULE['<{gcheckout}prestashop>gcheckout_6c132b5e262594950586ae13a7d3aa94'] = 'Google Checkout';
|
||||
$_MODULE['<{gcheckout}prestashop>gcheckout_3f3c0194c5adbe6953eb571f125af16d'] = 'Attuazione API di Google Checkout ';
|
||||
$_MODULE['<{gcheckout}prestashop>gcheckout_4402acab1c8f90dcf4a31dc96833bd86'] = 'Nessuna valuta impostata per questo modulo';
|
||||
$_MODULE['<{gcheckout}prestashop>gcheckout_82b8bb0d807e6d2e43a068f954c3559f'] = 'ID commerciante sembra essere sbagliato';
|
||||
$_MODULE['<{gcheckout}prestashop>gcheckout_9dd37c2106ceacbf0a40778b2109c386'] = 'Chiave commerciante sembra essere sbagliata';
|
||||
$_MODULE['<{gcheckout}prestashop>gcheckout_f4f70727dc34561dfde1a3c529b6205c'] = 'Impostazioni';
|
||||
$_MODULE['<{gcheckout}prestashop>gcheckout_a1ffd2dc2538ea3093532029514d42ac'] = 'In primo luogo, utilizza la pagina per testare il modulo, poi puoi utilizzare la modalità reale se va tutto bene. Non dimenticare di cambiare la chiave e l\'ID commerciante secondo la modalità!';
|
||||
$_MODULE['<{gcheckout}prestashop>gcheckout_650be61892bf690026089544abbd9d26'] = 'Modalità';
|
||||
$_MODULE['<{gcheckout}prestashop>gcheckout_7f80fcc452c2f1ed2bb51b39d0864df1'] = 'Reale';
|
||||
$_MODULE['<{gcheckout}prestashop>gcheckout_2652eec977dcb2a5aea85f5bec235b05'] = 'Sandbox';
|
||||
$_MODULE['<{gcheckout}prestashop>gcheckout_76055653a95e0a559b734ec322d89632'] = 'È possibile trovare queste chiavi nel tuo account Google Checkout> Impostazioni> Integrazione. Sandbox e modalità reale hanno entrambe queste chiavi.';
|
||||
$_MODULE['<{gcheckout}prestashop>gcheckout_229a7ec501323b94db7ff3157a7623c9'] = 'ID commerciante';
|
||||
$_MODULE['<{gcheckout}prestashop>gcheckout_795acb9a0c89791314d3032fe65eeb92'] = 'Chiave commerciante';
|
||||
$_MODULE['<{gcheckout}prestashop>gcheckout_a7ba8619e32091c343b340ec5b80e541'] = 'Se si spunta questa casella, gli acquirenti saranno in grado di vedere le spese di spedizione che hai configurato in Google Checkout nella pagina di acquisto.';
|
||||
$_MODULE['<{gcheckout}prestashop>gcheckout_de6fa0b14f259108c4b38e5be0374f46'] = 'Usa spese di spedizione Google';
|
||||
$_MODULE['<{gcheckout}prestashop>gcheckout_74692aae1cff5dc9dfd44f8c4e0540ad'] = 'È possibile registrare la comunicazione server-to-server. I file di registro sono';
|
||||
$_MODULE['<{gcheckout}prestashop>gcheckout_be5d5d37542d75f93a87094459f76678'] = 'e';
|
||||
$_MODULE['<{gcheckout}prestashop>gcheckout_f2f19b2cbcb395e254ebb1d9bf7cccd4'] = 'Se lo attivi, assicurati di proteggerli mettendo un file. Htaccess nella stessa directory. Se dimentichi di farlo, sarà leggibile da tutti';
|
||||
$_MODULE['<{gcheckout}prestashop>gcheckout_b2d37ae1cedf42ff874289b721860af2'] = 'Archivi ';
|
||||
$_MODULE['<{gcheckout}prestashop>gcheckout_38fb7d24e0d60a048f540ecb18e13376'] = 'Salva';
|
||||
$_MODULE['<{gcheckout}prestashop>gcheckout_a82be0f551b8708bc08eb33cd9ded0cf'] = 'Informazioni';
|
||||
$_MODULE['<{gcheckout}prestashop>gcheckout_968913ba2d4e25f3589d4c612ecbaa8d'] = 'Per poter utilizzare il modulo Google Checkout, è necessario configurare il tuo account Google Checkout (account sandbox così come account live). Accedi a Google Checkout poi vai su Settings > Integration. L\'URL callback API è:';
|
||||
$_MODULE['<{gcheckout}prestashop>gcheckout_dba727a9adc372723baef4533a7fc9da'] = 'Il metodo di callback deve essere impostato su';
|
||||
$_MODULE['<{gcheckout}prestashop>gcheckout_0d46d15f70a7cfa670545b308c022840'] = 'Gli ordini devono essere posizionati con la stessa valuta del tuo account venditore. Carrelli in altre valute saranno convertiti se il cliente sceglie di pagare con questo modulo.';
|
||||
$_MODULE['<{gcheckout}prestashop>gcheckout_8dd85f4218069de952672fe3180dacdb'] = 'Paga con GoogleCheckout';
|
||||
$_MODULE['<{gcheckout}prestashop>gcheckout_ba794350deb07c0c96fe73bd12239059'] = 'Confezione';
|
||||
$_MODULE['<{gcheckout}prestashop>gcheckout_9f06b28a40790c4c4df5739bce3c1eb0'] = 'Costi di spedizione';
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,161 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright (C) 2007 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Classes used to represent an item to be used for Google Checkout
|
||||
* @version $Id: googleitem.php 1234 2007-09-25 14:58:57Z ropu $
|
||||
*/
|
||||
|
||||
/**
|
||||
* Creates an item to be added to the shopping cart.
|
||||
* A new instance of the class must be created for each item to be added.
|
||||
*
|
||||
* Required fields are the item name, description, quantity and price
|
||||
* The private-data and tax-selector for each item can be set in the
|
||||
* constructor call or using individual Set functions
|
||||
*/
|
||||
class GoogleItem {
|
||||
|
||||
var $item_name;
|
||||
var $item_description;
|
||||
var $unit_price;
|
||||
var $quantity;
|
||||
var $merchant_private_item_data;
|
||||
var $merchant_item_id;
|
||||
var $tax_table_selector;
|
||||
var $email_delivery;
|
||||
var $digital_content=false;
|
||||
var $digital_description;
|
||||
var $digital_key;
|
||||
var $digital_url;
|
||||
|
||||
var $item_weight;
|
||||
var $numeric_weight;
|
||||
|
||||
/**
|
||||
* {@link http://code.google.com/apis/checkout/developer/index.html#tag_item <item>}
|
||||
*
|
||||
* @param string $name the name of the item -- required
|
||||
* @param string $desc the description of the item -- required
|
||||
* @param integer $qty the number of units of this item the customer has
|
||||
* in its shopping cart -- required
|
||||
* @param double $price the unit price of the item -- required
|
||||
* @param string $item_weight the weight unit used to specify the item's
|
||||
* weight,
|
||||
* one of 'LB' (pounds) or 'KG' (kilograms)
|
||||
* @param double $numeric_weight the weight of the item
|
||||
*
|
||||
*/
|
||||
function GoogleItem($name, $desc, $qty, $price, $item_weight='', $numeric_weight='') {
|
||||
$this->item_name = $name;
|
||||
$this->item_description= $desc;
|
||||
$this->unit_price = $price;
|
||||
$this->quantity = $qty;
|
||||
|
||||
if($item_weight != '' && $numeric_weight !== '') {
|
||||
switch(strtoupper($item_weight)){
|
||||
case 'KG':
|
||||
$this->item_weight = strtoupper($item_weight);
|
||||
break;
|
||||
case 'LB':
|
||||
default:
|
||||
$this->item_weight = 'LB';
|
||||
}
|
||||
$this->numeric_weight = (double)$numeric_weight;
|
||||
}
|
||||
}
|
||||
|
||||
function SetMerchantPrivateItemData($private_data) {
|
||||
$this->merchant_private_item_data = $private_data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the merchant item id that the merchant uses to uniquely identify an
|
||||
* item. Google Checkout will include this value in the
|
||||
* merchant calculation callbacks
|
||||
*
|
||||
* GC tag: {@link http://code.google.com/apis/checkout/developer/index.html#tag_merchant-item-id <merchant-item-id>}
|
||||
*
|
||||
* @param mixed $item_id the value that identifies this item on the
|
||||
* merchant's side
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function SetMerchantItemId($item_id) {
|
||||
$this->merchant_item_id = $item_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the tax table selector which identifies an alternate tax table that
|
||||
* should be used to calculate tax for a particular item.
|
||||
*
|
||||
* GC tag: {@link http://code.google.com/apis/checkout/developer/index.html#tag_tax-table-selector <tax-table-selector>}
|
||||
*
|
||||
* @param string $tax_selector this value should correspond to the name
|
||||
* of an alternate-tax-table.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function SetTaxTableSelector($tax_selector) {
|
||||
$this->tax_table_selector = $tax_selector;
|
||||
}
|
||||
|
||||
/**
|
||||
* Used when the item's content is digital, sets whether the merchant will
|
||||
* send an email to the buyer explaining how to access the digital content.
|
||||
* Email delivery allows the merchant to charge the buyer for an order
|
||||
* before allowing the buyer to access the digital content.
|
||||
*
|
||||
* GC tag: {@link http://code.google.com/apis/checkout/developer/index.html#tag_email-delivery <email-delivery>}
|
||||
*
|
||||
* @param bool $email_delivery true if email_delivery applies, defaults to
|
||||
* false
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function SetEmailDigitalDelivery($email_delivery='false') {
|
||||
$this->digital_url = '';
|
||||
$this->digital_key = '';
|
||||
$this->digital_description = '';
|
||||
$this->email_delivery = $email_delivery;
|
||||
$this->digital_content=true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the information related to the digital delivery of the item.
|
||||
*
|
||||
* GC tag: {@link http://code.google.com/apis/checkout/developer/index.html#tag_digital-content <digital-content>}
|
||||
*
|
||||
* @param string $digital_url the url the customer must go to download the
|
||||
* item. --optional
|
||||
* @param string $digital_key the key which allows to download or unlock the
|
||||
* digital content item -- optional
|
||||
* @param string $digital_description instructions for downloading adigital
|
||||
* content item, 1024 characters max, can
|
||||
* contain xml-escaped HTML -- optional
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function SetURLDigitalContent($digital_url, $digital_key, $digital_description) {
|
||||
$this->digital_url = $digital_url;
|
||||
$this->digital_key = $digital_key;
|
||||
$this->digital_description = $digital_description;
|
||||
$this->email_delivery = 'false';
|
||||
$this->digital_content = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,96 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (C) 2007 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
// Log levels
|
||||
define("L_OFF", 0); // No log
|
||||
define("L_ERR", 1); // Log Errors
|
||||
define("L_RQST", 2); // Log Request from GC
|
||||
define("L_RESP", 4); // Log Resoponse To Google
|
||||
define("L_ERR_RQST", L_ERR | L_RQST);
|
||||
define("L_ALL", L_ERR | L_RQST | L_RESP);
|
||||
|
||||
class GoogleLog {
|
||||
|
||||
var $errorLogFile;
|
||||
var $messageLogFile;
|
||||
// L_ALL (err+requests+responses), L_ERR, L_RQST, L_RESP, L_OFF
|
||||
var $logLevel = L_ERR_RQST;
|
||||
|
||||
/**
|
||||
* SetLogFiles
|
||||
*/
|
||||
function GoogleLog($errorLogFile, $messageLogFile, $logLevel=L_ERR_RQST, $die=true){
|
||||
$this->logLevel = $logLevel;
|
||||
if($logLevel == L_OFF) {
|
||||
$this->logLevel = L_OFF;
|
||||
} else {
|
||||
if (!$this->errorLogFile = @fopen($errorLogFile, "a")) {
|
||||
header('HTTP/1.0 500 Internal Server Error');
|
||||
$log = "Cannot open " . $errorLogFile . " file.\n" .
|
||||
"Logs are not writable, set them to 777";
|
||||
error_log($log, 0);
|
||||
if($die) {
|
||||
die($log);
|
||||
}else {
|
||||
echo $log;
|
||||
$this->logLevel = L_OFF;
|
||||
}
|
||||
}
|
||||
if (!$this->messageLogFile = @fopen($messageLogFile, "a")) {
|
||||
fclose($this->errorLogFile);
|
||||
header('HTTP/1.0 500 Internal Server Error');
|
||||
$log = "Cannot open " . $messageLogFile . " file.\n" .
|
||||
"Logs are not writable, set them to 777";
|
||||
error_log($log, 0);
|
||||
if($die) {
|
||||
die($log);
|
||||
}else {
|
||||
echo $log;
|
||||
$this->logLevel = L_OFF;
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->logLevel = $logLevel;
|
||||
}
|
||||
|
||||
function LogError($log){
|
||||
if($this->logLevel & L_ERR){
|
||||
fwrite($this->errorLogFile,
|
||||
sprintf("\n%s:- %s\n",date("D M j G:i:s T Y"),$log));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function LogRequest($log){
|
||||
if($this->logLevel & L_RQST){
|
||||
fwrite($this->messageLogFile,
|
||||
sprintf("\n%s:- %s\n",date("D M j G:i:s T Y"),$log));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function LogResponse($log) {
|
||||
if($this->logLevel & L_RESP){
|
||||
$this->LogRequest($log);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,115 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* Copyright (C) 2006 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Used to create the merchant callback results when a
|
||||
* merchant-calculated feedback structure is received.
|
||||
*
|
||||
* Multiple results are generated depending on the possible
|
||||
* combinations for shipping options and address ids
|
||||
*
|
||||
* More info: {@link http://code.google.com/apis/checkout/developer/index.html#understanding_merchant_calculation_results}
|
||||
*/
|
||||
// refer to demo/responsehandler.php for generating these results
|
||||
class GoogleMerchantCalculations {
|
||||
var $results_arr;
|
||||
var $currency;
|
||||
var $schema_url = "http://checkout.google.com/schema/2";
|
||||
|
||||
/**
|
||||
* @param string $currency the currency used for the calculations,
|
||||
* one of "USD" or "GBP"
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function GoogleMerchantCalculations($currency = "USD") {
|
||||
$this->results_arr = array();
|
||||
$this->currency = $currency;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a result of a merchant calculation to the response to be sent.
|
||||
*
|
||||
* @param GoogleResult $results the result of a particular merchant
|
||||
* calculation
|
||||
* @return void
|
||||
*/
|
||||
function AddResult($results) {
|
||||
$this->results_arr[] = $results;
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds the merchant calculation response xml to be sent to
|
||||
* Google Checkout.
|
||||
*
|
||||
* @return string the response xml
|
||||
*/
|
||||
function GetXML() {
|
||||
require_once('xml-processing/gc_xmlbuilder.php');
|
||||
|
||||
$xml_data = new gc_XmlBuilder();
|
||||
$xml_data->Push('merchant-calculation-results',
|
||||
array('xmlns' => $this->schema_url));
|
||||
$xml_data->Push('results');
|
||||
|
||||
foreach($this->results_arr as $result) {
|
||||
if($result->shipping_name != "") {
|
||||
$xml_data->Push('result', array('shipping-name' =>
|
||||
$result->shipping_name, 'address-id' => $result->address_id));
|
||||
$xml_data->Element('shipping-rate', $result->ship_price,
|
||||
array('currency' => $this->currency));
|
||||
$xml_data->Element('shippable', $result->shippable);
|
||||
} else
|
||||
$xml_data->Push('result', array('address-id' => $result->address_id));
|
||||
|
||||
if($result->tax_amount != "")
|
||||
$xml_data->Element('total-tax', $result->tax_amount,
|
||||
array('currency' => $this->currency));
|
||||
|
||||
if((count($result->coupon_arr) != 0) ||
|
||||
(count($result->giftcert_arr) != 0) ) {
|
||||
$xml_data->Push('merchant-code-results');
|
||||
|
||||
foreach($result->coupon_arr as $curr_coupon) {
|
||||
$xml_data->Push('coupon-result');
|
||||
$xml_data->Element('valid', $curr_coupon->coupon_valid);
|
||||
$xml_data->Element('code', $curr_coupon->coupon_code);
|
||||
$xml_data->Element('calculated-amount', $curr_coupon->coupon_amount,
|
||||
array('currency'=> $this->currency));
|
||||
$xml_data->Element('message', $curr_coupon->coupon_message);
|
||||
$xml_data->Pop('coupon-result');
|
||||
}
|
||||
foreach($result->giftcert_arr as $curr_gift) {
|
||||
$xml_data->Push('gift-result');
|
||||
$xml_data->Element('valid', $curr_gift->gift_valid);
|
||||
$xml_data->Element('code', $curr_gift->gift_code);
|
||||
$xml_data->Element('calculated-amount', $curr_gift->gift_amount,
|
||||
array('currency'=> $this->currency));
|
||||
$xml_data->Element('message', $curr_gift->gift_message);
|
||||
$xml_data->Pop('gift-result');
|
||||
}
|
||||
$xml_data->Pop('merchant-code-results');
|
||||
}
|
||||
$xml_data->Pop('result');
|
||||
}
|
||||
$xml_data->Pop('results');
|
||||
$xml_data->Pop('merchant-calculation-results');
|
||||
return $xml_data->GetXML();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,757 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* Copyright (C) 2007 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
/** This class is instantiated everytime any notification or
|
||||
* order processing commands are received.
|
||||
*
|
||||
* @version $Id: googlerequest.php 1234 2007-09-25 14:58:57Z ropu $
|
||||
* It has a SendReq function to post different requests to the Google Server
|
||||
* Send functions are provided for most of the commands that are supported
|
||||
* by the server for this code
|
||||
*/
|
||||
define('PHP_SAMPLE_CODE_VERSION', 'v1.2.5');
|
||||
define('ENTER', "\r\n");
|
||||
define('DOUBLE_ENTER', ENTER.ENTER);
|
||||
// Max size of the Google Messsage string
|
||||
define('GOOGLE_MESSAGE_LENGTH', 254);
|
||||
define('GOOGLE_REASON_LENGTH', 140);
|
||||
|
||||
/**
|
||||
* Send requests to the Google Checkout server to perform different actions
|
||||
*/
|
||||
// refer demo/responsehandlerdemo.php for different use case scenarios
|
||||
class GoogleRequest {
|
||||
var $merchant_id;
|
||||
var $merchant_key;
|
||||
var $currency;
|
||||
var $server_url;
|
||||
var $schema_url;
|
||||
var $base_url;
|
||||
var $checkout_url;
|
||||
var $checkout_diagnose_url;
|
||||
var $request_url;
|
||||
var $request_diagnose_url;
|
||||
var $merchant_checkout;
|
||||
var $proxy = array();
|
||||
|
||||
var $certPath='';
|
||||
var $log;
|
||||
|
||||
/**
|
||||
* @param string $id the merchant id
|
||||
* @param string $key the merchant key
|
||||
* @param string $server_type the server type of the server to be used, one
|
||||
* of 'sandbox' or 'production'.
|
||||
* defaults to 'sandbox'
|
||||
* @param string $currency the currency of the items to be added to the cart
|
||||
* , as of now values can be 'USD' or 'GBP'.
|
||||
* defaults to 'USD'
|
||||
*/
|
||||
function GoogleRequest($id, $key, $server_type="sandbox", $currency="USD") {
|
||||
$this->merchant_id = $id;
|
||||
$this->merchant_key = $key;
|
||||
$this->currency = $currency;
|
||||
|
||||
if(strtolower($server_type) == "sandbox") {
|
||||
$this->server_url = "https://sandbox.google.com/checkout/";
|
||||
} else {
|
||||
$this->server_url = "https://checkout.google.com/";
|
||||
}
|
||||
|
||||
|
||||
$this->schema_url = "http://checkout.google.com/schema/2";
|
||||
$this->base_url = $this->server_url . "api/checkout/v2/";
|
||||
$this->request_url = $this->base_url . "request/Merchant/" . $this->merchant_id;
|
||||
$this->merchant_checkout = $this->base_url . "merchantCheckout/Merchant/" . $this->merchant_id;
|
||||
|
||||
ini_set('include_path', ini_get('include_path').PATH_SEPARATOR.'.');
|
||||
require_once('googlelog.php');
|
||||
$this->log = new GoogleLog('', '', L_OFF);
|
||||
|
||||
}
|
||||
|
||||
function SetLogFiles($errorLogFile, $messageLogFile, $logLevel=L_ERR_RQST) {
|
||||
$this->log = new GoogleLog($errorLogFile, $messageLogFile, $logLevel);
|
||||
}
|
||||
/**
|
||||
* Submit a SetCertificatePath request.
|
||||
*
|
||||
* GC Accepted SSL Certs:
|
||||
* {@link http://googlecheckoutapi.blogspot.com/2007/07/accepting-50-additional-ssl-root-cas.html}
|
||||
*
|
||||
* @param string $certPath The name of a file holding one or more certificates
|
||||
* to verify the peer with
|
||||
*/
|
||||
|
||||
function SetCertificatePath($certPath) {
|
||||
$this->certPath = $certPath;
|
||||
}
|
||||
|
||||
/**
|
||||
* Submit a server-to-server request.
|
||||
*
|
||||
* more info:
|
||||
* {@link http://code.google.com/apis/checkout/developer/index.html#alternate_technique}
|
||||
*
|
||||
* @param string $xml_cart the cart's xml
|
||||
* @param bool $die whether to die() or not after performing the request,
|
||||
* defaults to true
|
||||
*
|
||||
* @return array with the returned http status code (200 if OK) in index 0
|
||||
* and the redirect url returned by the server in index 1
|
||||
*/
|
||||
public function SendServer2ServerCart($xml_cart, $die=true) {
|
||||
list($status, $body) = $this->SendReq($this->merchant_checkout,
|
||||
$this->GetAuthenticationHeaders(), $xml_cart);
|
||||
if($status != 200 ){
|
||||
return array($status, $body);
|
||||
} else {
|
||||
ini_set('include_path', ini_get('include_path').PATH_SEPARATOR.'.');
|
||||
require_once('xml-processing/gc_xmlparser.php');
|
||||
|
||||
$xml_parser = new gc_xmlparser($body);
|
||||
$root = $xml_parser->GetRoot();
|
||||
$data = $xml_parser->GetData();
|
||||
|
||||
$this->log->logRequest("Redirecting to: ".
|
||||
$data[$root]['redirect-url']['VALUE']);
|
||||
header('Location: ' . $data[$root]['redirect-url']['VALUE']);
|
||||
if($die) {
|
||||
die($data[$root]['redirect-url']['VALUE']);
|
||||
}
|
||||
else {
|
||||
return array(200, $data[$root]['redirect-url']['VALUE']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a <charge-order> command to the Google Checkout server
|
||||
*
|
||||
* info: {@link http://code.google.com/apis/checkout/developer/index.html#charge_order_example}
|
||||
*
|
||||
* @param string $google_order the google id of the order
|
||||
* @param double $amount the amount to be charged, if empty the whole
|
||||
* amount of the order will be charged
|
||||
*
|
||||
* @return array the status code and body of the response
|
||||
*/
|
||||
function SendChargeOrder($google_order, $amount='') {
|
||||
$postargs = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
|
||||
<charge-order xmlns=\"".$this->schema_url.
|
||||
"\" google-order-number=\"". $google_order. "\">";
|
||||
if ($amount != '') {
|
||||
$postargs .= "<amount currency=\"" . $this->currency . "\">" .
|
||||
$amount . "</amount>";
|
||||
}
|
||||
$postargs .= "</charge-order>";
|
||||
return $this->SendReq($this->request_url,
|
||||
$this->GetAuthenticationHeaders(), $postargs);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a <refund-order> command to the Google Checkout server
|
||||
*
|
||||
* info: {@link http://code.google.com/apis/checkout/developer/index.html#refund_order_example}
|
||||
*
|
||||
* @param string $google_order the google id of the order
|
||||
* @param double $amount the amount to be refunded, if empty the whole
|
||||
* amount of the order will be refunded
|
||||
* @param string $reason the reason why the refund is taking place
|
||||
* @param string $comment a comment about the refund
|
||||
*
|
||||
* @return array the status code and body of the response
|
||||
*/
|
||||
function SendRefundOrder($google_order, $amount, $reason,
|
||||
$comment='') {
|
||||
$postargs = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
|
||||
<refund-order xmlns=\"".$this->schema_url.
|
||||
"\" google-order-number=\"". $google_order. "\">" .
|
||||
"<reason>". $reason . "</reason>";
|
||||
if($amount!=0) {
|
||||
$postargs .= "<amount currency=\"" . $this->currency . "\">".
|
||||
htmlentities($amount)."</amount>";
|
||||
}
|
||||
$postargs .= "<comment>". htmlentities($comment) . "</comment>
|
||||
</refund-order>";
|
||||
return $this->SendReq($this->request_url,
|
||||
$this->GetAuthenticationHeaders(), $postargs);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a <cancel-order> command to the Google Checkout server
|
||||
*
|
||||
* info: {@link http://code.google.com/apis/checkout/developer/index.html#refund_order_example}
|
||||
*
|
||||
* @param string $google_order the google id of the order
|
||||
* @param string $reason the reason why the order is being cancelled
|
||||
* @param string $comment a comment about the cancellation
|
||||
*
|
||||
* @return array the status code and body of the response
|
||||
*/
|
||||
function SendCancelOrder($google_order, $reason, $comment) {
|
||||
$postargs = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
|
||||
<cancel-order xmlns=\"".$this->schema_url.
|
||||
"\" google-order-number=\"". $google_order. "\">
|
||||
<reason>".
|
||||
(substr(htmlentities(strip_tags($reason)),0,GOOGLE_REASON_LENGTH)) .
|
||||
"</reason>
|
||||
<comment>".
|
||||
(substr(htmlentities(strip_tags($comment)),0,GOOGLE_REASON_LENGTH)) .
|
||||
"</comment>
|
||||
</cancel-order>";
|
||||
return $this->SendReq($this->request_url,
|
||||
$this->GetAuthenticationHeaders(), $postargs);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send an <add-tracking-data> command to the Google Checkout server, which
|
||||
* will associate a shipper's tracking number with an order.
|
||||
*
|
||||
* info: {@link http://code.google.com/apis/checkout/developer/index.html#add_tracking_data_example}
|
||||
*
|
||||
* @param string $google_order the google id of the order
|
||||
* @param string $carrier the carrier, valid values are "DHL", "FedEx",
|
||||
* "UPS", "USPS" and "Other"
|
||||
* @param string $tracking_no the shipper's tracking number
|
||||
*
|
||||
* @return array the status code and body of the response
|
||||
*/
|
||||
function SendTrackingData($google_order, $carrier,
|
||||
$tracking_no) {
|
||||
$postargs = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
|
||||
<add-tracking-data xmlns=\"". $this->schema_url .
|
||||
"\" google-order-number=\"". $google_order . "\">
|
||||
<tracking-data>
|
||||
<carrier>". htmlentities($carrier) . "</carrier>
|
||||
<tracking-number>". $tracking_no . "</tracking-number>
|
||||
</tracking-data>
|
||||
</add-tracking-data>";
|
||||
return $this->SendReq($this->request_url,
|
||||
$this->GetAuthenticationHeaders(), $postargs);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send an <add-merchant-order-number> command to the Google Checkout
|
||||
* server, which will associate a merchant order number with an order
|
||||
*
|
||||
* info: {@link http://code.google.com/apis/checkout/developer/index.html#add_merchant_order_number_example}
|
||||
*
|
||||
* @param string $google_order the google id of the order
|
||||
* @param string $merchant_order the merchant id of the order
|
||||
*
|
||||
* @return array the status code and body of the response
|
||||
*/
|
||||
function SendMerchantOrderNumber($google_order,
|
||||
$merchant_order, $timeout=false) {
|
||||
$postargs = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
|
||||
<add-merchant-order-number xmlns=\"". $this->schema_url .
|
||||
"\" google-order-number=\"". $google_order . "\">
|
||||
<merchant-order-number>" . $merchant_order .
|
||||
"</merchant-order-number>
|
||||
</add-merchant-order-number>";
|
||||
return $this->SendReq($this->request_url,
|
||||
$this->GetAuthenticationHeaders(), $postargs, $timeout);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a <send-buyer-message> command to the Google Checkout
|
||||
* server, which will place a message in the customer's Google Checkout
|
||||
* account
|
||||
*
|
||||
* info: {@link http://code.google.com/apis/checkout/developer/index.html#send_buyer_message_example}
|
||||
*
|
||||
* @param string $google_order the google id of the order
|
||||
* @param string $message the message to be sent to the customer
|
||||
* @param string $send_email whether Google should send an email to
|
||||
* the buyer, use "true" or"false",
|
||||
* defaults to "true"
|
||||
*
|
||||
* @return array the status code and body of the response
|
||||
*/
|
||||
function SendBuyerMessage($google_order, $message,
|
||||
$send_mail="true", $timeout=false) {
|
||||
$postargs = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
|
||||
<send-buyer-message xmlns=\"". $this->schema_url .
|
||||
"\" google-order-number=\"". $google_order . "\">
|
||||
<message>" .
|
||||
(substr(htmlentities(strip_tags($message)),0,GOOGLE_MESSAGE_LENGTH))
|
||||
. "</message>
|
||||
<send-email>" . strtolower($send_mail) . "</send-email>
|
||||
</send-buyer-message>";
|
||||
return $this->SendReq($this->request_url,
|
||||
$this->GetAuthenticationHeaders(), $postargs, $timeout);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a <process-order> command to the Google Checkout
|
||||
* server, which will update an order's fulfillment state from NEW to
|
||||
* PROCESSING
|
||||
*
|
||||
* info: {@link http://code.google.com/apis/checkout/developer/index.html#process_order_example}
|
||||
*
|
||||
* @param string $google_order the google id of the order
|
||||
*
|
||||
* @return array the status code and body of the response
|
||||
*/
|
||||
function SendProcessOrder($google_order) {
|
||||
$postargs = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
|
||||
<process-order xmlns=\"".$this->schema_url .
|
||||
"\" google-order-number=\"". $google_order. "\"/> ";
|
||||
return $this->SendReq($this->request_url,
|
||||
$this->GetAuthenticationHeaders(), $postargs);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a <deliver-order> command to the Google Checkout server, which
|
||||
* will update an order's fulfillment state from either NEW or PROCESSING
|
||||
* to DELIVERED
|
||||
*
|
||||
* info: {@link http://code.google.com/apis/checkout/developer/index.html#deliver_order_example}
|
||||
*
|
||||
* @param string $google_order the google id of the order
|
||||
* @param string $carrier the carrier, valid values are "DHL", "FedEx",
|
||||
* "UPS", "USPS" and "Other"
|
||||
* @param string $tracking_no the shipper's tracking number
|
||||
* @param string $send_email whether Google should send an email to
|
||||
* the buyer, use "true" or"false",
|
||||
* defaults to "true"
|
||||
*
|
||||
* @return array the status code and body of the response
|
||||
*/
|
||||
function SendDeliverOrder($google_order, $carrier="",
|
||||
$tracking_no="", $send_mail = "true") {
|
||||
$postargs = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
|
||||
<deliver-order xmlns=\"". $this->schema_url .
|
||||
"\" google-order-number=\"". $google_order . "\">";
|
||||
if($carrier != "" && $tracking_no != "") {
|
||||
$postargs .= "<tracking-data>
|
||||
<carrier>". htmlentities($carrier) . "</carrier>
|
||||
<tracking-number>". htmlentities($tracking_no) . "</tracking-number>
|
||||
</tracking-data>";
|
||||
}
|
||||
$postargs .= "<send-email>". strtolower($send_mail) . "</send-email>
|
||||
</deliver-order>";
|
||||
return $this->SendReq($this->request_url,
|
||||
$this->GetAuthenticationHeaders(), $postargs);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a <archive-order> command to the Google Checkout
|
||||
* server, which removes an order from the merchant's Merchant Center Inbox
|
||||
*
|
||||
* info: {@link http://code.google.com/apis/checkout/developer/index.html#archive_order_example}
|
||||
*
|
||||
* @param string $google_order the google id of the order
|
||||
*
|
||||
* @return array the status code and body of the response
|
||||
*/
|
||||
function SendArchiveOrder($google_order) {
|
||||
$postargs = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
|
||||
<archive-order xmlns=\"".$this->schema_url.
|
||||
"\" google-order-number=\"". $google_order. "\"/>";
|
||||
return $this->SendReq($this->request_url,
|
||||
$this->GetAuthenticationHeaders(), $postargs);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a <archive-order> command to the Google Checkout
|
||||
* server, which returns a previously archived order to the merchant's
|
||||
* Merchant Center Inbox
|
||||
*
|
||||
* info: {@link http://code.google.com/apis/checkout/developer/index.html#unarchive_order_example}
|
||||
*
|
||||
* @param string $google_order the google id of the order
|
||||
*
|
||||
* @return array the status code and body of the response
|
||||
*/
|
||||
function SendUnarchiveOrder($google_order) {
|
||||
$postargs = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
|
||||
<unarchive-order xmlns=\"".
|
||||
$this->schema_url."\" google-order-number=\"".
|
||||
$google_order. "\"/>";
|
||||
return $this->SendReq($this->request_url,
|
||||
$this->GetAuthenticationHeaders(), $postargs);
|
||||
}
|
||||
|
||||
/**
|
||||
* Ship items API Commands
|
||||
* info: {@link http://code.google.com/apis/checkout/developer/Google_Checkout_XML_API_Line_Item_Shipping.html}
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Send a <ship-items> command to the Google Checkout
|
||||
* server,
|
||||
*
|
||||
* info: {@link http://code.google.com/apis/checkout/developer/Google_Checkout_XML_API_Line_Item_Shipping.html#tag_ship-items}
|
||||
*
|
||||
* @param string $google_order the google id of the order
|
||||
* @param array $items_list a list of GoogleShipItem classes.
|
||||
* @param string $send_email whether Google should send an email to
|
||||
* the buyer, use "true" or"false",
|
||||
* defaults to "true"
|
||||
*
|
||||
* @return array the status code and body of the response
|
||||
*/
|
||||
|
||||
function SendShipItems($google_order, $items_list=array(), $send_mail="true") {
|
||||
$postargs = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
|
||||
<ship-items xmlns=\"". $this->schema_url .
|
||||
"\" google-order-number=\"". $google_order . "\">" .
|
||||
"<item-shipping-information-list>\n";
|
||||
foreach($items_list as $item) {
|
||||
$postargs .= "<item-shipping-information>
|
||||
<item-id>
|
||||
<merchant-item-id>" . $item->merchant_item_id . "</merchant-item-id>
|
||||
</item-id>\n";
|
||||
|
||||
if(count($item->tracking_data_list)) {
|
||||
$postargs .= "<tracking-data-list>\n";
|
||||
foreach($item->tracking_data_list as $tracking_data) {
|
||||
$postargs .= "<tracking-data>
|
||||
<carrier>". htmlentities($tracking_data['carrier']) . "</carrier>
|
||||
<tracking-number>". $tracking_data['tracking-number'] . "</tracking-number>
|
||||
</tracking-data>\n";
|
||||
}
|
||||
$postargs .= "</tracking-data-list>\n";
|
||||
}
|
||||
$postargs .= "</item-shipping-information>\n";
|
||||
}
|
||||
$postargs .= "</item-shipping-information-list>\n" .
|
||||
"<send-email>". strtolower($send_mail) . "</send-email>
|
||||
</ship-items>";
|
||||
return $this->SendReq($this->request_url,
|
||||
$this->GetAuthenticationHeaders(), $postargs);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a <backorder-items> command to the Google Checkout
|
||||
*
|
||||
* info: {@link http://code.google.com/apis/checkout/developer/Google_Checkout_XML_API_Line_Item_Shipping.html#tag_backorder-items}
|
||||
*
|
||||
* @param string $google_order the google id of the order
|
||||
* @param array $items_list a list of GoogleShipItem classes.
|
||||
* @param string $send_email whether Google should send an email to
|
||||
* the buyer, use "true" or"false",
|
||||
* defaults to "true"
|
||||
*
|
||||
* @return array the status code and body of the response
|
||||
*/
|
||||
function SendBackorderItems($google_order, $items_list=array(), $send_mail="true") {
|
||||
$postargs = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
|
||||
<backorder-items xmlns=\"".
|
||||
$this->schema_url."\" google-order-number=\"".
|
||||
$google_order. "\">";
|
||||
$postargs .= "<item-ids>";
|
||||
foreach($items_list as $item) {
|
||||
$postargs .= "<item-id>
|
||||
<merchant-item-id>" . $item->merchant_item_id . "</merchant-item-id>
|
||||
</item-id>";
|
||||
}
|
||||
$postargs .= "</item-ids>";
|
||||
$postargs .= "<send-email>". strtolower($send_mail) . "</send-email>
|
||||
</backorder-items>";
|
||||
return $this->SendReq($this->request_url,
|
||||
$this->GetAuthenticationHeaders(), $postargs);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a <cancel-items> command to the Google Checkout
|
||||
*
|
||||
* info: {@link http://code.google.com/apis/checkout/developer/Google_Checkout_XML_API_Line_Item_Shipping.html#tag_cancel-items}
|
||||
*
|
||||
* @param string $google_order the google id of the order
|
||||
* @param array $items_list a list of GoogleShipItem classes.
|
||||
* @param string $reason the reason why the refund is taking place
|
||||
* @param string $comment a comment about the refund
|
||||
* @param string $send_email whether Google should send an email to
|
||||
* the buyer, use "true" or"false",
|
||||
* defaults to "true"
|
||||
*
|
||||
* @return array the status code and body of the response
|
||||
*/
|
||||
function SendCancelItems($google_order, $items_list=array(), $reason,
|
||||
$comment='', $send_mail="true") {
|
||||
$postargs = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
|
||||
<cancel-items xmlns=\"".
|
||||
$this->schema_url."\" google-order-number=\"".
|
||||
$google_order. "\">";
|
||||
$postargs .= "<item-ids>";
|
||||
foreach($items_list as $item) {
|
||||
$postargs .= "<item-id>
|
||||
<merchant-item-id>" . $item->merchant_item_id . "</merchant-item-id>
|
||||
</item-id>";
|
||||
}
|
||||
$postargs .= "</item-ids>";
|
||||
$postargs .= "<send-email>". strtolower($send_mail) . "</send-email>
|
||||
<reason>".
|
||||
(substr(htmlentities(strip_tags($reason)),0,GOOGLE_REASON_LENGTH)) .
|
||||
"</reason>
|
||||
<comment>".
|
||||
(substr(htmlentities(strip_tags($comment)),0,GOOGLE_REASON_LENGTH)) .
|
||||
"</comment>
|
||||
</cancel-items>";
|
||||
return $this->SendReq($this->request_url,
|
||||
$this->GetAuthenticationHeaders(), $postargs);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a <return-items> command to the Google Checkout
|
||||
*
|
||||
* info: {@link http://code.google.com/apis/checkout/developer/Google_Checkout_XML_API_Line_Item_Shipping.html#tag_return-items}
|
||||
*
|
||||
* @param string $google_order the google id of the order
|
||||
* @param array $items_list a list of GoogleShipItem classes.
|
||||
* @param string $send_email whether Google should send an email to
|
||||
* the buyer, use "true" or"false",
|
||||
* defaults to "true"
|
||||
*
|
||||
* @return array the status code and body of the response
|
||||
*/
|
||||
function SendReturnItems($google_order, $items_list=array(), $send_mail="true") {
|
||||
$postargs = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
|
||||
<return-items xmlns=\"".
|
||||
$this->schema_url."\" google-order-number=\"".
|
||||
$google_order. "\">";
|
||||
$postargs .= "<item-ids>";
|
||||
foreach($items_list as $item) {
|
||||
$postargs .= "<item-id>
|
||||
<merchant-item-id>" . $item->merchant_item_id . "</merchant-item-id>
|
||||
</item-id>";
|
||||
}
|
||||
$postargs .= "</item-ids>";
|
||||
$postargs .= "<send-email>". strtolower($send_mail) . "</send-email>
|
||||
</return-items>";
|
||||
return $this->SendReq($this->request_url,
|
||||
$this->GetAuthenticationHeaders(), $postargs);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a <reset-items-shipping-information> command to the Google Checkout
|
||||
*
|
||||
* info: {@link http://code.google.com/apis/checkout/developer/Google_Checkout_XML_API_Line_Item_Shipping.html#tag_reset-items-shipping-information}
|
||||
*
|
||||
* @param string $google_order the google id of the order
|
||||
* @param array $items_list a list of GoogleShipItem classes.
|
||||
* @param string $send_email whether Google should send an email to
|
||||
* the buyer, use "true" or"false",
|
||||
* defaults to "true"
|
||||
*
|
||||
* @return array the status code and body of the response
|
||||
*/
|
||||
function SendResetItemsShippingInformation($google_order, $items_list=array(), $send_mail="true") {
|
||||
$postargs = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
|
||||
<reset-items-shipping-information xmlns=\"".
|
||||
$this->schema_url."\" google-order-number=\"".
|
||||
$google_order. "\">";
|
||||
$postargs .= "<item-ids>";
|
||||
foreach($items_list as $item) {
|
||||
$postargs .= "<item-id>
|
||||
<merchant-item-id>" . $item->merchant_item_id . "</merchant-item-id>
|
||||
</item-id>";
|
||||
}
|
||||
$postargs .= "</item-ids>";
|
||||
$postargs .= "<send-email>". strtolower($send_mail) . "</send-email>
|
||||
</reset-items-shipping-information>";
|
||||
return $this->SendReq($this->request_url,
|
||||
$this->GetAuthenticationHeaders(), $postargs);
|
||||
}
|
||||
|
||||
/**
|
||||
* @access private
|
||||
*/
|
||||
function GetAuthenticationHeaders() {
|
||||
$headers = array();
|
||||
$headers[] = "Authorization: Basic ".base64_encode(
|
||||
$this->merchant_id.':'.$this->merchant_key);
|
||||
$headers[] = "Content-Type: application/xml; charset=UTF-8";
|
||||
$headers[] = "Accept: application/xml; charset=UTF-8";
|
||||
$headers[] = "User-Agent: GC-PHP-Sample_code (" . PHP_SAMPLE_CODE_VERSION . "/ropu)";
|
||||
return $headers;
|
||||
}
|
||||
/**
|
||||
* Set the proxy to be used by the connections to the outside
|
||||
*
|
||||
* @param array $proxy Array('host' => 'proxy-host', 'port' => 'proxy-port')
|
||||
*
|
||||
*/
|
||||
function SetProxy($proxy=array()) {
|
||||
if(is_array($proxy) && count($proxy)) {
|
||||
$this->proxy['host'] = $proxy['host'];
|
||||
$this->proxy['port'] = $proxy['port'];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @access private
|
||||
*/
|
||||
function SendReq($url, $header_arr, $postargs, $timeout=false) {
|
||||
// Get the curl session object
|
||||
$session = curl_init($url);
|
||||
$this->log->LogRequest($postargs);
|
||||
// Set the POST options.
|
||||
curl_setopt($session, CURLOPT_POST, true);
|
||||
curl_setopt($session, CURLOPT_HTTPHEADER, $header_arr);
|
||||
curl_setopt($session, CURLOPT_POSTFIELDS, $postargs);
|
||||
curl_setopt($session, CURLOPT_HEADER, true);
|
||||
curl_setopt($session, CURLOPT_RETURNTRANSFER, true);
|
||||
|
||||
if(!empty($this->certPath) && file_exists($this->certPath)) {
|
||||
curl_setopt($session, CURLOPT_SSL_VERIFYPEER, true);
|
||||
curl_setopt($session, CURLOPT_CAINFO, $this->certPath);
|
||||
}
|
||||
else {
|
||||
curl_setopt($session, CURLOPT_SSL_VERIFYPEER, false);
|
||||
}
|
||||
|
||||
if(is_array($this->proxy) && count($this->proxy)) {
|
||||
curl_setopt($session, CURLOPT_PROXY,
|
||||
$this->proxy['host'] . ":" . $this->proxy['port']);
|
||||
}
|
||||
if($timeout != false){
|
||||
curl_setopt($session, CURLOPT_TIMEOUT, $timeout);
|
||||
|
||||
}
|
||||
// Do the POST and then close the session
|
||||
$response = curl_exec($session);
|
||||
if (curl_errno($session)) {
|
||||
$this->log->LogError(curl_error($session));
|
||||
return array("CURL_ERR", curl_error($session));
|
||||
} else {
|
||||
curl_close($session);
|
||||
}
|
||||
$heads = $this->parse_headers($response);
|
||||
$body = $this->get_body_x($response);
|
||||
|
||||
// // Get HTTP Status code from the response
|
||||
$status_code = array();
|
||||
preg_match('/\d\d\d/', $heads[0], $status_code);
|
||||
|
||||
// Check for errors
|
||||
switch( $status_code[0] ) {
|
||||
case 200:
|
||||
// Success
|
||||
$this->log->LogResponse($response);
|
||||
return array(200, $body);
|
||||
break;
|
||||
case 503:
|
||||
$this->log->LogError($response);
|
||||
return array(503, htmlentities($body));
|
||||
break;
|
||||
case 403:
|
||||
$this->log->LogError($response);
|
||||
return array(403, htmlentities($body));
|
||||
break;
|
||||
case 400:
|
||||
$this->log->LogError($response);
|
||||
return array(400, htmlentities($body));
|
||||
break;
|
||||
default:
|
||||
$this->log->LogError($response);
|
||||
return array("ERR", htmlentities($body));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Private functions
|
||||
// Function to get HTTP headers,
|
||||
// will also work with HTTP 200 status added by some proxy servers
|
||||
/**
|
||||
* @access private
|
||||
*/
|
||||
function parse_headers($message) {
|
||||
$head_end = strpos($message, DOUBLE_ENTER);
|
||||
$headers = $this->get_headers_x(substr($message,0,
|
||||
$head_end + strlen(DOUBLE_ENTER)));
|
||||
if(!is_array($headers) || empty($headers)){
|
||||
return null;
|
||||
}
|
||||
if(!preg_match('%[HTTP/\d\.\d] (\d\d\d)%', $headers[0], $status_code)) {
|
||||
return null;
|
||||
}
|
||||
switch( $status_code[1] ) {
|
||||
case '200':
|
||||
$parsed = $this->parse_headers(substr($message,
|
||||
$head_end + strlen(DOUBLE_ENTER)));
|
||||
return is_null($parsed)?$headers:$parsed;
|
||||
break;
|
||||
default:
|
||||
return $headers;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @access private
|
||||
*/
|
||||
function get_headers_x($heads, $format=0) {
|
||||
$fp = explode(ENTER, $heads);
|
||||
foreach($fp as $header){
|
||||
if($header == "") {
|
||||
$eoheader = true;
|
||||
break;
|
||||
} else {
|
||||
$header = trim($header);
|
||||
}
|
||||
|
||||
if($format == 1) {
|
||||
$key = array_shift(explode(':',$header));
|
||||
if($key == $header) {
|
||||
$headers[] = $header;
|
||||
} else {
|
||||
$headers[$key]=substr($header,strlen($key)+2);
|
||||
}
|
||||
unset($key);
|
||||
} else {
|
||||
$headers[] = $header;
|
||||
}
|
||||
}
|
||||
return $headers;
|
||||
}
|
||||
|
||||
/**
|
||||
* @access private
|
||||
*/
|
||||
function get_body_x($heads){
|
||||
$fp = explode(DOUBLE_ENTER, $heads, 2);
|
||||
return $fp[1];
|
||||
}
|
||||
}
|
||||
|
||||
class GoogleShipItem {
|
||||
var $merchant_item_id;
|
||||
var $tracking_data_list;
|
||||
var $tracking_no;
|
||||
|
||||
function GoogleShipItem($merchant_item_id, $tracking_data_list=array()) {
|
||||
$this->merchant_item_id = $merchant_item_id;
|
||||
$this->tracking_data_list = $tracking_data_list;
|
||||
}
|
||||
|
||||
function AddTrackingData($carrier, $tracking_no) {
|
||||
if($carrier != "" && $tracking_no != "") {
|
||||
$this->tracking_data_list[] = array('carrier' => $carrier,
|
||||
'tracking-number' => $tracking_no);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,221 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* Copyright (C) 2007 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/* This class is instantiated everytime any notification or
|
||||
* order processing commands are received.
|
||||
*
|
||||
* Refer demo/responsehandlerdemo.php for different use case scenarios
|
||||
* for this code
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Handles the response to notifications sent by the Google Checkout server.
|
||||
*/
|
||||
class GoogleResponse {
|
||||
var $merchant_id;
|
||||
var $merchant_key;
|
||||
var $schema_url;
|
||||
|
||||
var $log;
|
||||
var $response;
|
||||
var $root='';
|
||||
var $data=array();
|
||||
var $xml_parser;
|
||||
|
||||
/**
|
||||
* @param string $id the merchant id
|
||||
* @param string $key the merchant key
|
||||
*/
|
||||
function GoogleResponse($id=null, $key=null) {
|
||||
$this->merchant_id = $id;
|
||||
$this->merchant_key = $key;
|
||||
$this->schema_url = "http://checkout.google.com/schema/2";
|
||||
ini_set('include_path', ini_get('include_path').PATH_SEPARATOR.'.');
|
||||
require_once('googlelog.php');
|
||||
$this->log = new GoogleLog('', '', L_OFF);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $id the merchant id
|
||||
* @param string $key the merchant key
|
||||
*/
|
||||
function SetMerchantAuthentication($id, $key){
|
||||
$this->merchant_id = $id;
|
||||
$this->merchant_key = $key;
|
||||
}
|
||||
|
||||
function SetLogFiles($errorLogFile, $messageLogFile, $logLevel=L_ERR_RQST) {
|
||||
$this->log = new GoogleLog($errorLogFile, $messageLogFile, $logLevel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Verifies that the authentication sent by Google Checkout matches the
|
||||
* merchant id and key
|
||||
*
|
||||
* @param string $headers the headers from the request
|
||||
*/
|
||||
function HttpAuthentication($headers=null, $die=true) {
|
||||
if(!is_null($headers)) {
|
||||
$_SERVER = $headers;
|
||||
}
|
||||
if(isset($_SERVER['PHP_AUTH_USER']) && isset($_SERVER['PHP_AUTH_PW'])) {
|
||||
$compare_mer_id = $_SERVER['PHP_AUTH_USER'];
|
||||
$compare_mer_key = $_SERVER['PHP_AUTH_PW'];
|
||||
}
|
||||
// IIS Note:: For HTTP Authentication to work with IIS,
|
||||
// the PHP directive cgi.rfc2616_headers must be set to 0 (the default value).
|
||||
else if(isset($_SERVER['HTTP_AUTHORIZATION'])){
|
||||
list($compare_mer_id, $compare_mer_key) = explode(':',
|
||||
base64_decode(substr($_SERVER['HTTP_AUTHORIZATION'],
|
||||
strpos($_SERVER['HTTP_AUTHORIZATION'], " ") + 1)));
|
||||
} else if(isset($_SERVER['Authorization'])) {
|
||||
list($compare_mer_id, $compare_mer_key) = explode(':',
|
||||
base64_decode(substr($_SERVER['Authorization'],
|
||||
strpos($_SERVER['Authorization'], " ") + 1)));
|
||||
} else {
|
||||
$this->SendFailAuthenticationStatus(
|
||||
"Failed to Get Basic Authentication Headers",$die);
|
||||
return false;
|
||||
}
|
||||
if($compare_mer_id != $this->merchant_id
|
||||
|| $compare_mer_key != $this->merchant_key) {
|
||||
$this->SendFailAuthenticationStatus("Invalid Merchant Id/Key Pair",$die);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function ProcessMerchantCalculations($merchant_calc) {
|
||||
$this->SendOKStatus();
|
||||
$result = $merchant_calc->GetXML();
|
||||
echo $result;
|
||||
}
|
||||
|
||||
// Notification API
|
||||
function ProcessNewOrderNotification() {
|
||||
$this->SendAck();
|
||||
}
|
||||
function ProcessRiskInformationNotification() {
|
||||
$this->SendAck();
|
||||
}
|
||||
function ProcessOrderStateChangeNotification() {
|
||||
$this->SendAck();
|
||||
}
|
||||
// Amount Notifications
|
||||
function ProcessChargeAmountNotification() {
|
||||
$this->SendAck();
|
||||
}
|
||||
function ProcessRefundAmountNotification() {
|
||||
$this->SendAck();
|
||||
}
|
||||
function ProcessChargebackAmountNotification() {
|
||||
$this->SendAck();
|
||||
}
|
||||
function ProcessAuthorizationAmountNotification() {
|
||||
$this->SendAck();
|
||||
}
|
||||
|
||||
function SendOKStatus() {
|
||||
header('HTTP/1.0 200 OK');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the response header indicating an erroneous authentication from
|
||||
* Google Checkout
|
||||
*
|
||||
* @param string $msg the message to log
|
||||
*/
|
||||
function SendFailAuthenticationStatus($msg="401 Unauthorized Access",
|
||||
$die=true) {
|
||||
$this->log->logError($msg);
|
||||
header('WWW-Authenticate: Basic realm="GoogleCheckout PHPSample Code"');
|
||||
header('HTTP/1.0 401 Unauthorized');
|
||||
if($die) {
|
||||
die($msg);
|
||||
} else {
|
||||
echo $msg;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the response header indicating a malformed request from Google
|
||||
* Checkout
|
||||
*
|
||||
* @param string $msg the message to log
|
||||
*/
|
||||
function SendBadRequestStatus($msg="400 Bad Request", $die=true) {
|
||||
$this->log->logError($msg);
|
||||
header('HTTP/1.0 400 Bad Request');
|
||||
if($die) {
|
||||
die($msg);
|
||||
} else {
|
||||
echo $msg;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the response header indicating that an internal error ocurred and
|
||||
* the notification sent by Google Checkout can't be processed right now
|
||||
*
|
||||
* @param string $msg the message to log
|
||||
*/
|
||||
function SendServerErrorStatus($msg="500 Internal Server Error",
|
||||
$die=true) {
|
||||
$this->log->logError($msg);
|
||||
header('HTTP/1.0 500 Internal Server Error');
|
||||
if($die) {
|
||||
die($msg);
|
||||
} else {
|
||||
echo $msg;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Send an acknowledgement in response to Google Checkout's request
|
||||
*/
|
||||
function SendAck($die=true) {
|
||||
$this->SendOKStatus();
|
||||
$acknowledgment = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" .
|
||||
"<notification-acknowledgment xmlns=\"" .
|
||||
$this->schema_url . "\"/>";
|
||||
$this->log->LogResponse($acknowledgment);
|
||||
if($die) {
|
||||
die($acknowledgment);
|
||||
} else {
|
||||
echo $acknowledgment;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @access private
|
||||
*/
|
||||
function GetParsedXML($request=null){
|
||||
if(!is_null($request)) {
|
||||
$this->log->LogRequest($request);
|
||||
$this->response = $request;
|
||||
ini_set('include_path', ini_get('include_path').PATH_SEPARATOR.'.');
|
||||
require_once('xml-processing/gc_xmlparser.php');
|
||||
|
||||
$this->xml_parser = new gc_xmlparser($request);
|
||||
$this->root = $this->xml_parser->GetRoot();
|
||||
$this->data = $this->xml_parser->GetData();
|
||||
}
|
||||
return array($this->root, $this->data);
|
||||
}
|
||||
}
|
||||
@@ -1,105 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* Copyright (C) 2006 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Used to create a Google Checkout result as a response to a
|
||||
* merchant-calculations feedback structure, i.e shipping, tax, coupons and
|
||||
* gift certificates.
|
||||
*
|
||||
* GC tag: {@link http://code.google.com/apis/checkout/developer/index.html#tag_result <result>}
|
||||
*/
|
||||
// refer to demo/responsehandlerdemo.php for usage of this code
|
||||
class GoogleResult {
|
||||
var $shipping_name;
|
||||
var $address_id;
|
||||
var $shippable;
|
||||
var $ship_price;
|
||||
|
||||
var $tax_amount;
|
||||
|
||||
var $coupon_arr = array();
|
||||
var $giftcert_arr = array();
|
||||
|
||||
/**
|
||||
* @param integer $address_id the id of the anonymous address sent by
|
||||
* Google Checkout.
|
||||
*/
|
||||
function GoogleResult($address_id) {
|
||||
$this->address_id = $address_id;
|
||||
}
|
||||
|
||||
function SetShippingDetails($name, $price, $shippable = "true") {
|
||||
$this->shipping_name = $name;
|
||||
$this->ship_price = $price;
|
||||
$this->shippable = $shippable;
|
||||
}
|
||||
|
||||
function SetTaxDetails($amount) {
|
||||
$this->tax_amount = $amount;
|
||||
}
|
||||
|
||||
function AddCoupons($coupon) {
|
||||
$this->coupon_arr[] = $coupon;
|
||||
}
|
||||
|
||||
function AddGiftCertificates($gift) {
|
||||
$this->giftcert_arr[] = $gift;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This is a class used to return the results of coupons the buyer supplied in
|
||||
* the order page.
|
||||
*
|
||||
* GC tag: {@link http://code.google.com/apis/checkout/developer/index.html#tag_coupon-result <coupon-result>}
|
||||
*/
|
||||
class GoogleCoupons {
|
||||
var $coupon_valid;
|
||||
var $coupon_code;
|
||||
var $coupon_amount;
|
||||
var $coupon_message;
|
||||
|
||||
function googlecoupons($valid, $code, $amount, $message) {
|
||||
$this->coupon_valid = $valid;
|
||||
$this->coupon_code = $code;
|
||||
$this->coupon_amount = $amount;
|
||||
$this->coupon_message = $message;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This is a class used to return the results of gift certificates
|
||||
* supplied by the buyer on the place order page
|
||||
*
|
||||
* GC tag: {@link http://code.google.com/apis/checkout/developer/index.html#tag_gift-certificate-result} <gift-certificate-result>
|
||||
*/
|
||||
|
||||
class GoogleGiftcerts {
|
||||
var $gift_valid;
|
||||
var $gift_code;
|
||||
var $gift_amount;
|
||||
var $gift_message;
|
||||
|
||||
function googlegiftcerts($valid, $code, $amount, $message) {
|
||||
$this->gift_valid = $valid;
|
||||
$this->gift_code = $code;
|
||||
$this->gift_amount = $amount;
|
||||
$this->gift_message = $message;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,532 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright (C) 2007 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
/**
|
||||
* Classes used to represent shipping types
|
||||
* @version $Id: googleshipping.php 1234 2007-09-25 14:58:57Z ropu $
|
||||
*/
|
||||
|
||||
/**
|
||||
* Class that represents flat rate shipping
|
||||
*
|
||||
* info:
|
||||
* {@link http://code.google.com/apis/checkout/developer/index.html#tag_flat-rate-shipping}
|
||||
* {@link http://code.google.com/apis/checkout/developer/index.html#shipping_xsd}
|
||||
*
|
||||
*/
|
||||
class GoogleFlatRateShipping {
|
||||
|
||||
var $price;
|
||||
var $name;
|
||||
var $type = "flat-rate-shipping";
|
||||
var $shipping_restrictions;
|
||||
|
||||
/**
|
||||
* @param string $name a name for the shipping
|
||||
* @param double $price the price for this shipping
|
||||
*/
|
||||
function GoogleFlatRateShipping($name, $price) {
|
||||
$this->name = $name;
|
||||
$this->price = $price;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a restriction to this shipping.
|
||||
*
|
||||
* @param GoogleShippingFilters $restrictions the shipping restrictions
|
||||
*/
|
||||
function AddShippingRestrictions($restrictions) {
|
||||
$this->shipping_restrictions = $restrictions;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents a merchant calculated shipping
|
||||
*
|
||||
* info:
|
||||
* {@link http://code.google.com/apis/checkout/developer/index.html#shipping_xsd}
|
||||
* {@link http://code.google.com/apis/checkout/developer/index.html#merchant_calculations_specifying}
|
||||
*/
|
||||
class GoogleMerchantCalculatedShipping {
|
||||
|
||||
var $price;
|
||||
var $name;
|
||||
var $type = "merchant-calculated-shipping";
|
||||
var $shipping_restrictions;
|
||||
var $address_filters;
|
||||
|
||||
/**
|
||||
* @param string $name a name for the shipping
|
||||
* @param double $price the default price for this shipping, used if the
|
||||
* calculation can't be made for some reason.
|
||||
*/
|
||||
function GoogleMerchantCalculatedShipping($name, $price) {
|
||||
$this->price = $price;
|
||||
$this->name = $name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a restriction to this shipping.
|
||||
*
|
||||
* @param GoogleShippingFilters $restrictions the shipping restrictions
|
||||
*/
|
||||
function AddShippingRestrictions($restrictions) {
|
||||
$this->shipping_restrictions = $restrictions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds an address filter to this shipping.
|
||||
*
|
||||
* @param GoogleShippingFilters $filters the address filters
|
||||
*/
|
||||
function AddAddressFilters($filters) {
|
||||
$this->address_filters = $filters;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents carrier calculated shipping
|
||||
*/
|
||||
class GoogleCarrierCalculatedShipping {
|
||||
|
||||
var $name;
|
||||
var $type = "carrier-calculated-shipping";
|
||||
|
||||
var $CarrierCalculatedShippingOptions = array();
|
||||
// var $ShippingPackages = array();
|
||||
var $ShippingPackage;
|
||||
|
||||
/**
|
||||
* @param string $name the name of this shipping
|
||||
*/
|
||||
function GoogleCarrierCalculatedShipping($name) {
|
||||
$this->name = $name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param GoogleCarrierCalculatedShippingOption $option the option to be
|
||||
* added to the carrier calculated shipping
|
||||
*/
|
||||
function addCarrierCalculatedShippingOptions($option){
|
||||
$this->CarrierCalculatedShippingOptions[] = $option;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param GoogleShippingPackage $package
|
||||
*/
|
||||
function addShippingPackage($package){
|
||||
// $this->ShippingPackages[] = $package;
|
||||
$this->ShippingPackage = $package;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents a shipping method for which Google Checkout will obtain
|
||||
* shipping costs for the order.
|
||||
*/
|
||||
class GoogleCarrierCalculatedShippingOption {
|
||||
|
||||
var $price;
|
||||
var $shipping_company;
|
||||
var $shipping_type;
|
||||
var $carrier_pickup;
|
||||
var $additional_fixed_charge;
|
||||
var $additional_variable_charge_percent;
|
||||
// var $shipping_restrictions;
|
||||
// var $address_filters;
|
||||
|
||||
/**
|
||||
* @param double $price the default shipping cost to be used if Google is
|
||||
* unable to obtain the shipping_company's shipping rate for
|
||||
* the option
|
||||
* @param string $shipping_company the name of the shipping_company
|
||||
* @param string $shipping_type the shipping option, valid values are here:
|
||||
* http://code.google.com/apis/checkout/developer/Google_Checkout_XML_API_Carrier_Calculated_Shipping.html#tag_shipping-type
|
||||
* @param double $additional_fixed_charge a handling charge that will be
|
||||
* added to the total cost of the order if this shipping option is selected.
|
||||
* defaults to 0
|
||||
* @param double $additional_variable_charge_percent A percentage by which
|
||||
* the shipping rate will be adjusted. The value may be positive or
|
||||
* negative. defaults to 0.
|
||||
* @param string $carrier_pickup Specifies how the package will be
|
||||
* transfered from the merchand to the shipper. Valid values are
|
||||
* "REGULAR_PICKUP", "SPECIAL_PICKUP", "DROP_OFF". Defaults to "DROP_OFF".
|
||||
*
|
||||
*/
|
||||
function GoogleCarrierCalculatedShippingOption($price, $shipping_company,
|
||||
$shipping_type, $additional_fixed_charge=0,
|
||||
$additional_variable_charge_percent=0, $carrier_pickup='DROP_OFF') {
|
||||
$this->price = (double)$price;
|
||||
$this->shipping_company = $shipping_company;
|
||||
$this->shipping_type = trim($shipping_type);
|
||||
switch(strtoupper($carrier_pickup)){
|
||||
case 'DROP_OFF':
|
||||
case 'REGULAR_PICKUP':
|
||||
case 'SPECIAL_PICKUP':
|
||||
$this->carrier_pickup = $carrier_pickup;
|
||||
break;
|
||||
default:
|
||||
$this->carrier_pickup = 'DROP_OFF';
|
||||
}
|
||||
if($additional_fixed_charge){
|
||||
$this->additional_fixed_charge = (double)$additional_fixed_charge;
|
||||
}
|
||||
if($additional_variable_charge_percent){
|
||||
$this->additional_variable_charge_percent = (double)$additional_variable_charge_percent;
|
||||
}
|
||||
}
|
||||
|
||||
// function AddShippingRestrictions($restrictions) {
|
||||
// $this->shipping_restrictions = $restrictions;
|
||||
// }
|
||||
//
|
||||
// function AddAddressFilters($filters) {
|
||||
// $this->address_filters = $filters;
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents an individual package that will be shipped to the buyer.
|
||||
*/
|
||||
class GoogleShippingPackage {
|
||||
|
||||
var $width;
|
||||
var $length;
|
||||
var $height;
|
||||
var $unit;
|
||||
var $ship_from;
|
||||
var $delivery_address_category;
|
||||
|
||||
/**
|
||||
* @param GoogleShipFrom $ship_from where the package ships from
|
||||
* @param double $width the width of the package
|
||||
* @param double $length the length of the package
|
||||
* @param double $height the height of the package
|
||||
* @param string $unit the unit used to measure the width/length/height
|
||||
* of the package, valid values "IN", "CM"
|
||||
* @param string $delivery_address_category indicates whether the shipping
|
||||
* method should be applied to a residential or commercial address, valid
|
||||
* values are "RESIDENTIAL", "COMMERCIAL"
|
||||
*/
|
||||
function GoogleShippingPackage($ship_from, $width, $length, $height, $unit,
|
||||
$delivery_address_category='RESIDENTIAL') {
|
||||
$this->width = (double)$width;
|
||||
$this->length = (double)$length;
|
||||
$this->height = (double)$height;
|
||||
switch(strtoupper($unit)){
|
||||
case 'CM':
|
||||
$this->unit = strtoupper($unit);
|
||||
break;
|
||||
case 'IN':
|
||||
default:
|
||||
$this->unit = 'IN';
|
||||
}
|
||||
|
||||
$this->ship_from = $ship_from;
|
||||
switch(strtoupper($delivery_address_category)){
|
||||
case 'COMMERCIAL':
|
||||
$this->delivery_address_category = strtoupper($delivery_address_category);
|
||||
break;
|
||||
case 'RESIDENTIAL':
|
||||
default:
|
||||
$this->delivery_address_category = 'RESIDENTIAL';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents the location from where packages will be shipped from.
|
||||
* Used with {@link GoogleShippingPackage}.
|
||||
*/
|
||||
class GoogleShipFrom {
|
||||
var $id;
|
||||
var $city;
|
||||
var $country_code;
|
||||
var $postal_code;
|
||||
var $region;
|
||||
|
||||
/**
|
||||
* @param string $id an id for this address
|
||||
* @param string $city the city
|
||||
* @param string $country_code a 2-letter iso country code
|
||||
* @param string $postal_code the zip
|
||||
* @param string $region the region
|
||||
*/
|
||||
function GoogleShipFrom($id, $city, $country_code,
|
||||
$postal_code, $region) {
|
||||
$this->id = $id;
|
||||
$this->city = $city;
|
||||
$this->country_code = $country_code;
|
||||
$this->postal_code = $postal_code;
|
||||
$this->region = $region;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Shipping restrictions contain information about particular areas where
|
||||
* items can (or cannot) be shipped.
|
||||
*
|
||||
* More info:
|
||||
* {@link http://code.google.com/apis/checkout/developer/index.html#tag_shipping-restrictions}
|
||||
*
|
||||
* Address filters identify areas where a particular merchant-calculated
|
||||
* shipping method is available or unavailable. Address filters are applied
|
||||
* before Google Checkout sends a <merchant-calculation-callback> to the
|
||||
* merchant. Google Checkout will not ask you to calculate the cost of a
|
||||
* particular shipping method for an address if the address filters in the
|
||||
* Checkout API request indicate that the method is not available for the
|
||||
* address.
|
||||
*
|
||||
* More info:
|
||||
* {@link http://code.google.com/apis/checkout/developer/index.html#tag_address-filters}
|
||||
*/
|
||||
class GoogleShippingFilters {
|
||||
|
||||
var $allow_us_po_box = true;
|
||||
|
||||
var $allowed_restrictions = false;
|
||||
var $excluded_restrictions = false;
|
||||
|
||||
var $allowed_world_area = false;
|
||||
var $allowed_country_codes_arr;
|
||||
var $allowed_postal_patterns_arr;
|
||||
var $allowed_country_area;
|
||||
var $allowed_state_areas_arr;
|
||||
var $allowed_zip_patterns_arr;
|
||||
|
||||
var $excluded_country_codes_arr;
|
||||
var $excluded_postal_patterns_arr;
|
||||
var $excluded_country_area;
|
||||
var $excluded_state_areas_arr;
|
||||
var $excluded_zip_patterns_arr;
|
||||
|
||||
function GoogleShippingFilters() {
|
||||
$this->allowed_country_codes_arr = array();
|
||||
$this->allowed_postal_patterns_arr = array();
|
||||
$this->allowed_state_areas_arr = array();
|
||||
$this->allowed_zip_patterns_arr = array();
|
||||
|
||||
$this->excluded_country_codes_arr = array();
|
||||
$this->excluded_postal_patterns_arr = array();
|
||||
$this->excluded_state_areas_arr = array();
|
||||
$this->excluded_zip_patterns_arr = array();
|
||||
}
|
||||
|
||||
/**
|
||||
* GC tag: {@link http://code.google.com/apis/checkout/developer/index.html#tag_allow-us-po-box <allow-us-po-box>}
|
||||
*
|
||||
* @param bool $allow_us_po_box whether to allow delivery to PO boxes in US,
|
||||
* defaults to true
|
||||
*/
|
||||
function SetAllowUsPoBox($allow_us_po_box = true) {
|
||||
$this->allow_us_po_box = $allow_us_po_box;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the world as allowed delivery area.
|
||||
*
|
||||
* GC tag: {@link http://code.google.com/apis/checkout/developer/index.html#tag_world-area <world-area>}
|
||||
*
|
||||
* @param bool $world_area Set worldwide allowed shipping, defaults to true
|
||||
*/
|
||||
function SetAllowedWorldArea($world_area = true) {
|
||||
$this->allowed_restrictions = true;
|
||||
$this->allowed_world_area = $world_area;
|
||||
}
|
||||
|
||||
// Allows
|
||||
/**
|
||||
* Add a postal area to be allowed for delivery.
|
||||
*
|
||||
* GC tag: {@link http://code.google.com/apis/checkout/developer/index.html#tag_postal-area <postal-area>}
|
||||
*
|
||||
* @param string $country_code 2-letter iso country code
|
||||
* @param string $postal_pattern Pattern that matches the postal areas to
|
||||
* be allowed, as defined in {@link http://code.google.com/apis/checkout/developer/index.html#tag_postal-code-pattern}
|
||||
*/
|
||||
function AddAllowedPostalArea($country_code, $postal_pattern = "") {
|
||||
$this->allowed_restrictions = true;
|
||||
$this->allowed_country_codes_arr[] = $country_code;
|
||||
$this->allowed_postal_patterns_arr[]= $postal_pattern;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a us country area to be allowed for delivery.
|
||||
*
|
||||
* GC tag: {@link http://code.google.com/apis/checkout/developer/index.html#tag_us-country-area <us-country-area>}
|
||||
*
|
||||
* @param string $country_area the area to allow, one of "CONTINENTAL",
|
||||
* "FULL_50_STATES" or "ALL"
|
||||
*
|
||||
*/
|
||||
function SetAllowedCountryArea($country_area) {
|
||||
switch ($country_area) {
|
||||
case "CONTINENTAL_48":
|
||||
case "FULL_50_STATES":
|
||||
case "ALL":
|
||||
$this->allowed_country_area = $country_area;
|
||||
$this->allowed_restrictions = true;
|
||||
break;
|
||||
default:
|
||||
$this->allowed_country_area = "";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Allow shipping to areas specified by state.
|
||||
*
|
||||
* GC tag: {@link http://code.google.com/apis/checkout/developer/index.html#tag_us-state-area <us-state-area>}
|
||||
*
|
||||
* @param array $areas Areas to be allowed
|
||||
*/
|
||||
function SetAllowedStateAreas($areas) {
|
||||
$this->allowed_restrictions = true;
|
||||
$this->allowed_state_areas_arr = $areas;
|
||||
}
|
||||
|
||||
/**
|
||||
* Allow shipping to areas specified by state.
|
||||
*
|
||||
* GC tag: {@link http://code.google.com/apis/checkout/developer/index.html#tag_us-state-area <us-state-area>}
|
||||
*
|
||||
* @param string $area Area to be allowed
|
||||
*/
|
||||
function AddAllowedStateArea($area) {
|
||||
$this->allowed_restrictions = true;
|
||||
$this->allowed_state_areas_arr[] = $area;
|
||||
}
|
||||
|
||||
/**
|
||||
* Allow shipping to areas specified by zip patterns.
|
||||
*
|
||||
* GC tag: {@link http://code.google.com/apis/checkout/developer/index.html#tag_us-zip-area <us-zip-area>}
|
||||
*
|
||||
* @param array $zips
|
||||
*/
|
||||
function SetAllowedZipPatterns($zips) {
|
||||
$this->allowed_restrictions = true;
|
||||
$this->allowed_zip_patterns_arr = $zips;
|
||||
}
|
||||
|
||||
/**
|
||||
* Allow shipping to area specified by zip pattern.
|
||||
*
|
||||
* GC tag: {@link http://code.google.com/apis/checkout/developer/index.html#tag_us-zip-area <us-zip-area>}
|
||||
*
|
||||
* @param string
|
||||
*/
|
||||
function AddAllowedZipPattern($zip) {
|
||||
$this->allowed_restrictions = true;
|
||||
$this->allowed_zip_patterns_arr[] = $zip;
|
||||
}
|
||||
|
||||
/**
|
||||
* Exclude postal areas from shipping.
|
||||
*
|
||||
* @see AddAllowedPostalArea
|
||||
*/
|
||||
function AddExcludedPostalArea($country_code, $postal_pattern = "") {
|
||||
$this->excluded_restrictions = true;
|
||||
$this->excluded_country_codes_arr[] = $country_code;
|
||||
$this->excluded_postal_patterns_arr[]= $postal_pattern;
|
||||
}
|
||||
|
||||
/**
|
||||
* Exclude state areas from shipping.
|
||||
*
|
||||
* @see SetAllowedStateAreas
|
||||
*/
|
||||
function SetExcludedStateAreas($areas) {
|
||||
$this->excluded_restrictions = true;
|
||||
$this->excluded_state_areas_arr = $areas;
|
||||
}
|
||||
|
||||
/**
|
||||
* Exclude state area from shipping.
|
||||
*
|
||||
* @see AddAllowedStateArea
|
||||
*/
|
||||
function AddExcludedStateArea($area) {
|
||||
$this->excluded_restrictions = true;
|
||||
$this->excluded_state_areas_arr[] = $area;
|
||||
}
|
||||
|
||||
/**
|
||||
* Exclude shipping to area specified by zip pattern.
|
||||
*
|
||||
* @see SetAllowedZipPatterns
|
||||
*/
|
||||
function SetExcludedZipPatternsStateAreas($zips) {
|
||||
$this->excluded_restrictions = true;
|
||||
$this->excluded_zip_patterns_arr = $zips;
|
||||
}
|
||||
|
||||
/**
|
||||
* Exclude shipping to area specified by zip pattern.
|
||||
*
|
||||
* @see AddExcludedZipPattern
|
||||
*/
|
||||
function SetAllowedZipPatternsStateArea($zip) {
|
||||
$this->excluded_restrictions = true;
|
||||
$this->excluded_zip_patterns_arr[] = $zip;
|
||||
}
|
||||
|
||||
/**
|
||||
* Exclude shipping to country area
|
||||
*
|
||||
* @see SetAllowedCountryArea
|
||||
*/
|
||||
function SetExcludedCountryArea($country_area) {
|
||||
switch ($country_area) {
|
||||
case "CONTINENTAL_48":
|
||||
case "FULL_50_STATES":
|
||||
case "ALL":
|
||||
$this->excluded_country_area = $country_area;
|
||||
$this->excluded_restrictions = true;
|
||||
break;
|
||||
|
||||
default:
|
||||
$this->excluded_country_area = "";
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Used as a shipping option in which neither a carrier nor a ship-to
|
||||
* address is specified
|
||||
*
|
||||
* GC tag: {@link http://code.google.com/apis/checkout/developer/index.html#tag_pickup} <pickup>
|
||||
*/
|
||||
class GooglePickUp {
|
||||
|
||||
var $price;
|
||||
var $name;
|
||||
var $type = "pickup";
|
||||
|
||||
/**
|
||||
* @param string $name the name of this shipping option
|
||||
* @param double $price the handling cost (if there is one)
|
||||
*/
|
||||
function GooglePickUp($name, $price) {
|
||||
$this->price = $price;
|
||||
$this->name = $name;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,146 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* Copyright (C) 2006 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Classes used to handle tax rules and tables
|
||||
*/
|
||||
|
||||
/**
|
||||
* Represents a tax rule
|
||||
*
|
||||
* @see GoogleDefaultTaxRule
|
||||
* @see GoogleAlternateTaxRule
|
||||
*
|
||||
* @abstract
|
||||
*/
|
||||
class GoogleTaxRule {
|
||||
|
||||
var $tax_rate;
|
||||
|
||||
var $world_area = false;
|
||||
var $country_codes_arr;
|
||||
var $postal_patterns_arr;
|
||||
var $state_areas_arr;
|
||||
var $zip_patterns_arr;
|
||||
var $country_area;
|
||||
|
||||
function GoogleTaxRule() {
|
||||
}
|
||||
|
||||
function SetWorldArea($world_area = true) {
|
||||
$this->world_area = $world_area;
|
||||
}
|
||||
|
||||
function AddPostalArea($country_code, $postal_pattern = "") {
|
||||
$this->country_codes_arr[] = $country_code;
|
||||
$this->postal_patterns_arr[]= $postal_pattern;
|
||||
}
|
||||
|
||||
function SetStateAreas($areas) {
|
||||
if(is_array($areas))
|
||||
$this->state_areas_arr = $areas;
|
||||
else
|
||||
$this->state_areas_arr = array($areas);
|
||||
}
|
||||
|
||||
function SetZipPatterns($zips) {
|
||||
if(is_array($zips))
|
||||
$this->zip_patterns_arr = $zips;
|
||||
else
|
||||
$this->zip_patterns_arr = array($zips);
|
||||
}
|
||||
|
||||
function SetCountryArea($country_area) {
|
||||
switch ($country_area) {
|
||||
case "CONTINENTAL_48":
|
||||
case "FULL_50_STATES":
|
||||
case "ALL":
|
||||
$this->country_area = $country_area;
|
||||
break;
|
||||
default:
|
||||
$this->country_area = "";
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents a default tax rule
|
||||
*
|
||||
* GC tag: {@link http://code.google.com/apis/checkout/developer/index.html#tag_default-tax-rule <default-tax-rule>}
|
||||
*/
|
||||
class GoogleDefaultTaxRule extends GoogleTaxRule {
|
||||
|
||||
var $shipping_taxed = false;
|
||||
|
||||
function GoogleDefaultTaxRule($tax_rate, $shipping_taxed = "false") {
|
||||
$this->tax_rate = $tax_rate;
|
||||
$this->shipping_taxed= $shipping_taxed;
|
||||
|
||||
$this->country_codes_arr = array();
|
||||
$this->postal_patterns_arr = array();
|
||||
$this->state_areas_arr = array();
|
||||
$this->zip_patterns_arr = array();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents an alternate tax rule
|
||||
*
|
||||
* GC tag: {@link http://code.google.com/apis/checkout/developer/index.html#tag_alternate-tax-rule <alternate-tax-rule>}
|
||||
*/
|
||||
class GoogleAlternateTaxRule extends GoogleTaxRule {
|
||||
|
||||
function GoogleAlternateTaxRule($tax_rate) {
|
||||
$this->tax_rate = $tax_rate;
|
||||
|
||||
$this->country_codes_arr = array();
|
||||
$this->postal_patterns_arr = array();
|
||||
$this->state_areas_arr = array();
|
||||
$this->zip_patterns_arr = array();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Represents an alternate tax table
|
||||
*
|
||||
* GC tag: {@link http://code.google.com/apis/checkout/developer/index.html#tag_alternate-tax-table <alternate-tax-table>}
|
||||
*/
|
||||
class GoogleAlternateTaxTable {
|
||||
|
||||
var $name;
|
||||
var $tax_rules_arr;
|
||||
var $standalone;
|
||||
|
||||
function GoogleAlternateTaxTable($name = "", $standalone = "false") {
|
||||
if($name != "") {
|
||||
$this->name = $name;
|
||||
$this->tax_rules_arr = array();
|
||||
$this->standalone = $standalone;
|
||||
}
|
||||
}
|
||||
|
||||
function AddAlternateTaxRules($rules) {
|
||||
$this->tax_rules_arr[] = $rules;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,94 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
Copyright (C) 2006 Google Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Classes used to generate XML data
|
||||
* Based on sample code available at http://simon.incutio.com/code/php/XmlWriter.class.php.txt
|
||||
*/
|
||||
|
||||
/**
|
||||
* Generates xml data
|
||||
*/
|
||||
class gc_XmlBuilder {
|
||||
var $xml;
|
||||
var $indent;
|
||||
var $stack = array();
|
||||
|
||||
function gc_XmlBuilder($indent = ' ') {
|
||||
$this->indent = $indent;
|
||||
$this->xml = '<?xml version="1.0" encoding="utf-8"?>'."\n";
|
||||
}
|
||||
|
||||
function _indent() {
|
||||
for ($i = 0, $j = count($this->stack); $i < $j; $i++) {
|
||||
$this->xml .= $this->indent;
|
||||
}
|
||||
}
|
||||
|
||||
//Used when an element has sub-elements
|
||||
// This function adds an open tag to the output
|
||||
function Push($element, $attributes = array()) {
|
||||
$this->_indent();
|
||||
$this->xml .= '<'.$element;
|
||||
foreach ($attributes as $key => $value) {
|
||||
$this->xml .= ' '.$key.'="'.htmlentities($value).'"';
|
||||
}
|
||||
$this->xml .= ">\n";
|
||||
$this->stack[] = $element;
|
||||
}
|
||||
|
||||
//Used when an element has no subelements.
|
||||
//Data within the open and close tags are provided with the
|
||||
//contents variable
|
||||
function Element($element, $content, $attributes = array()) {
|
||||
$this->_indent();
|
||||
$this->xml .= '<'.$element;
|
||||
foreach ($attributes as $key => $value) {
|
||||
$this->xml .= ' '.$key.'="'.htmlentities($value).'"';
|
||||
}
|
||||
$this->xml .= '>'.htmlentities($content).'</'.$element.'>'."\n";
|
||||
}
|
||||
|
||||
function EmptyElement($element, $attributes = array()) {
|
||||
$this->_indent();
|
||||
$this->xml .= '<'.$element;
|
||||
foreach ($attributes as $key => $value) {
|
||||
$this->xml .= ' '.$key.'="'.htmlentities($value).'"';
|
||||
}
|
||||
$this->xml .= " />\n";
|
||||
}
|
||||
|
||||
//Used to close an open tag
|
||||
function Pop($pop_element) {
|
||||
$element = array_pop($this->stack);
|
||||
$this->_indent();
|
||||
if($element !== $pop_element)
|
||||
die('XML Error: Tag Mismatch when trying to close "'. $pop_element. '"');
|
||||
else
|
||||
$this->xml .= "</$element>\n";
|
||||
}
|
||||
|
||||
function GetXML() {
|
||||
if(count($this->stack) != 0)
|
||||
die ('XML Error: No matching closing tag found for " '. array_pop($this->stack). '"');
|
||||
else
|
||||
return $this->xml;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,202 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Classes used to parse xml data
|
||||
*/
|
||||
/*
|
||||
Copyright (C) 2007 Google Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
For more info: http://code.google.com/p/google-checkout-php-sample-code/
|
||||
|
||||
Upgrades (05/23/2007) ropu:
|
||||
Remove UpdateRecursive()
|
||||
Support for empty tags (like <world-area/>)
|
||||
Accept multiple options in a second parameter
|
||||
*
|
||||
**/
|
||||
|
||||
/* This uses SAX parser to convert XML data into PHP associative arrays
|
||||
* When invoking the constructor with the input data, strip out the first XML line
|
||||
*
|
||||
* Member field Description:
|
||||
* $params: This stores the XML data. The attributes and contents of XML tags
|
||||
* can be accessed as follows
|
||||
*
|
||||
* <addresses>
|
||||
* <anonymous-address id="123"> <test>data 1 </test>
|
||||
* </anonymous-address>
|
||||
* <anonymous-address id="456"> <test>data 2 </test>
|
||||
* </anonymous-address>
|
||||
* </addresses>
|
||||
*
|
||||
* print_r($this->params) will return
|
||||
Array
|
||||
(
|
||||
[addresses] => Array
|
||||
(
|
||||
[anonymous-address] => Array
|
||||
(
|
||||
[0] => Array
|
||||
(
|
||||
[id] => 123
|
||||
[test] => Array
|
||||
(
|
||||
[VALUE] => data 1
|
||||
)
|
||||
|
||||
)
|
||||
|
||||
[1] => Array
|
||||
(
|
||||
[id] => 456
|
||||
[test] => Array
|
||||
(
|
||||
[VALUE] => data 2
|
||||
)
|
||||
|
||||
)
|
||||
|
||||
)
|
||||
|
||||
)
|
||||
|
||||
)
|
||||
* gc_xmlparser returns an empty params array if it encounters
|
||||
* any error during parsing
|
||||
*/
|
||||
// XML to Array
|
||||
class gc_xmlparser {
|
||||
|
||||
var $params = array(); //Stores the object representation of XML data
|
||||
var $root = NULL;
|
||||
var $global_index = -1;
|
||||
var $fold = false;
|
||||
|
||||
/* Constructor for the class
|
||||
* Takes in XML data as input( do not include the <xml> tag
|
||||
*/
|
||||
function gc_xmlparser($input, $xmlParams=array(XML_OPTION_CASE_FOLDING => 0)) {
|
||||
$xmlp = xml_parser_create();
|
||||
foreach($xmlParams as $opt => $optVal) {
|
||||
switch( $opt ) {
|
||||
case XML_OPTION_CASE_FOLDING:
|
||||
$this->fold = $optVal;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
xml_parser_set_option($xmlp, $opt, $optVal);
|
||||
}
|
||||
|
||||
if(xml_parse_into_struct($xmlp, $input, $vals, $index)) {
|
||||
$this->root = $this->_foldCase($vals[0]['tag']);
|
||||
$this->params = $this->xml2ary($vals);
|
||||
}
|
||||
xml_parser_free($xmlp);
|
||||
}
|
||||
|
||||
function _foldCase($arg) {
|
||||
return( $this->fold ? strtoupper($arg) : $arg);
|
||||
}
|
||||
|
||||
/*
|
||||
* Credits for the structure of this function
|
||||
* http://mysrc.blogspot.com/2007/02/php-xml-to-array-and-backwards.html
|
||||
*
|
||||
* Adapted by Ropu - 05/23/2007
|
||||
*
|
||||
*/
|
||||
function xml2ary($vals) {
|
||||
|
||||
$mnary=array();
|
||||
$ary=&$mnary;
|
||||
foreach ($vals as $r) {
|
||||
$t=$r['tag'];
|
||||
if ($r['type']=='open') {
|
||||
if (isset($ary[$t]) && !empty($ary[$t])) {
|
||||
if (isset($ary[$t][0])){
|
||||
$ary[$t][]=array();
|
||||
}
|
||||
else {
|
||||
$ary[$t]=array($ary[$t], array());
|
||||
}
|
||||
$cv=&$ary[$t][count($ary[$t])-1];
|
||||
}
|
||||
else {
|
||||
$cv=&$ary[$t];
|
||||
}
|
||||
$cv=array();
|
||||
if (isset($r['attributes'])) {
|
||||
foreach ($r['attributes'] as $k=>$v) {
|
||||
$cv[$k]=$v;
|
||||
}
|
||||
}
|
||||
|
||||
$cv['_p']=&$ary;
|
||||
$ary=&$cv;
|
||||
|
||||
} else if ($r['type']=='complete') {
|
||||
if (isset($ary[$t]) && !empty($ary[$t])) { // same as open
|
||||
if (isset($ary[$t][0])) {
|
||||
$ary[$t][]=array();
|
||||
}
|
||||
else {
|
||||
$ary[$t]=array($ary[$t], array());
|
||||
}
|
||||
$cv=&$ary[$t][count($ary[$t])-1];
|
||||
}
|
||||
else {
|
||||
$cv=&$ary[$t];
|
||||
}
|
||||
if (isset($r['attributes'])) {
|
||||
foreach ($r['attributes'] as $k=>$v) {
|
||||
$cv[$k]=$v;
|
||||
}
|
||||
}
|
||||
$cv['VALUE'] = (isset($r['value']) ? $r['value'] : '');
|
||||
|
||||
} elseif ($r['type']=='close') {
|
||||
$ary=&$ary['_p'];
|
||||
}
|
||||
}
|
||||
|
||||
$this->_del_p($mnary);
|
||||
return $mnary;
|
||||
}
|
||||
|
||||
// _Internal: Remove recursion in result array
|
||||
function _del_p(&$ary) {
|
||||
foreach ($ary as $k=>$v) {
|
||||
if ($k==='_p') {
|
||||
unset($ary[$k]);
|
||||
}
|
||||
else if(is_array($ary[$k])) {
|
||||
$this->_del_p($ary[$k]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Returns the root of the XML data */
|
||||
function GetRoot() {
|
||||
return $this->root;
|
||||
}
|
||||
|
||||
/* Returns the array representing the XML data */
|
||||
function GetData() {
|
||||
return $this->params;
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 378 B |
@@ -1,47 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License (AFL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/afl-3.0.php
|
||||
* 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 <contact@prestashop.com>
|
||||
* @copyright 2007-2011 PrestaShop SA
|
||||
* @version Release: $Revision: 1.4 $
|
||||
* @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('index.php/authentication?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');
|
||||
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
{*
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License (AFL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/afl-3.0.php
|
||||
* 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 <contact@prestashop.com>
|
||||
* @copyright 2007-2011 PrestaShop SA
|
||||
* @version Release: $Revision: 1.4 $
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*}
|
||||
|
||||
<p class="payment_module">
|
||||
<a href="{$base_dir_ssl}modules/gcheckout/payment.php" title="{$buttonText}">
|
||||
<img src="modules/gcheckout/gcheckout.gif" alt="{$buttonText}" />
|
||||
{$buttonText}
|
||||
</a>
|
||||
</p>
|
||||
@@ -1,27 +0,0 @@
|
||||
{*
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License (AFL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/afl-3.0.php
|
||||
* 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 <contact@prestashop.com>
|
||||
* @copyright 2007-2011 PrestaShop SA
|
||||
* @version Release: $Revision: 1.4 $
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*}
|
||||
|
||||
Page de retour de paiement
|
||||
@@ -1,159 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License (AFL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/afl-3.0.php
|
||||
* 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 <contact@prestashop.com>
|
||||
* @copyright 2007-2011 PrestaShop SA
|
||||
* @version Release: $Revision: 1.4 $
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
require_once(dirname(__FILE__).'/../../config/config.inc.php');
|
||||
require_once(dirname(__FILE__).'/gcheckout.php');
|
||||
require_once(dirname(__FILE__).'/library/googleresponse.php');
|
||||
require_once(dirname(__FILE__).'/library/googlemerchantcalculations.php');
|
||||
require_once(dirname(__FILE__).'/library/googleresult.php');
|
||||
require_once(dirname(__FILE__).'/library/googlerequest.php');
|
||||
require_once(dirname(__FILE__).'/library/googlecart.php');
|
||||
|
||||
|
||||
$merchant_id = Configuration::get('GCHECKOUT_MERCHANT_ID');
|
||||
$merchant_key = Configuration::get('GCHECKOUT_MERCHANT_KEY');
|
||||
$server_type = Configuration::get('GCHECKOUT_MODE');
|
||||
|
||||
$Gresponse = new GoogleResponse($merchant_id, $merchant_key);
|
||||
//$Grequest = new GoogleRequest($merchant_id, $merchant_key, $server_type, $currency);
|
||||
|
||||
//Setup the log file
|
||||
if (Configuration::get('GCHECKOUT_LOGS'))
|
||||
$Gresponse->SetLogFiles('googleerror.log', 'googlemessage.log', L_ALL);
|
||||
|
||||
// Retrieve the XML sent in the HTTP POST request to the ResponseHandler
|
||||
$xml_response = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA:file_get_contents("php://input");
|
||||
if (get_magic_quotes_gpc())
|
||||
$xml_response = stripslashes($xml_response);
|
||||
|
||||
list($root, $data) = $Gresponse->GetParsedXML($xml_response);
|
||||
$Gresponse->SetMerchantAuthentication($merchant_id, $merchant_key);
|
||||
|
||||
$status = $Gresponse->HttpAuthentication();
|
||||
if(!$status)
|
||||
die('authentication failed');
|
||||
|
||||
/* Commands to send the various order processing APIs
|
||||
* Send charge order : $Grequest->SendChargeOrder($data[$root]
|
||||
* ['google-order-number']['VALUE'], <amount>);
|
||||
* Send process order : $Grequest->SendProcessOrder($data[$root]
|
||||
* ['google-order-number']['VALUE']);
|
||||
* Send deliver order: $Grequest->SendDeliverOrder($data[$root]
|
||||
* ['google-order-number']['VALUE'], <carrier>, <tracking-number>,
|
||||
* <send_mail>);
|
||||
* Send archive order: $Grequest->SendArchiveOrder($data[$root]
|
||||
* ['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": {
|
||||
// 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 = (float)($data[$root]['order-total']['VALUE']);
|
||||
$gcheckout->validateOrder((int)$secure_cart[0], _PS_OS_PAYMENT_, (float)$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": {
|
||||
$Gresponse->SendAck();
|
||||
break;
|
||||
}
|
||||
case "refund-amount-notification": {
|
||||
$Gresponse->SendAck();
|
||||
break;
|
||||
}
|
||||
case "risk-information-notification": {
|
||||
$Gresponse->SendAck();
|
||||
break;
|
||||
}
|
||||
default:
|
||||
$Gresponse->SendBadRequestStatus("Invalid or not supported Message");
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
/* In case the XML API contains multiple open tags
|
||||
with the same value, then invoke this function and
|
||||
perform a foreach on the resultant array.
|
||||
This takes care of cases when there is only one unique tag
|
||||
or multiple tags.
|
||||
Examples of this are "anonymous-address", "merchant-code-string"
|
||||
from the merchant-calculations-callback API
|
||||
*/
|
||||
function get_arr_result($child_node) {
|
||||
$result = array();
|
||||
if(isset($child_node)) {
|
||||
if(is_associative_array($child_node)) {
|
||||
$result[] = $child_node;
|
||||
}
|
||||
else {
|
||||
foreach($child_node as $curr_node){
|
||||
$result[] = $curr_node;
|
||||
}
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
/* Returns true if a given variable represents an associative array */
|
||||
function is_associative_array( $var ) {
|
||||
return is_array( $var ) && !is_numeric( implode( '', array_keys( $var ) ) );
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user