Overview

Packages

  • currencysymbol
  • MAbout
  • Mage
    • Admin
    • Adminhtml
    • AdminNotification
    • Api
    • Api2
    • Authorizenet
    • Backup
    • Bundle
    • Captcha
    • Catalog
    • CatalogIndex
    • CatalogInventory
    • CatalogRule
    • CatalogSearch
    • Centinel
    • Checkout
    • Cms
    • Compiler
    • Connect
    • Contacts
    • Core
    • Cron
    • CurrencySymbol
    • Customer
    • Dataflow
    • Directory
    • DirtectPost
    • Downloadable
    • Eav
    • GiftMessage
    • GoogleAnalytics
    • GoogleBase
    • GoogleCheckout
    • ImportExport
    • Index
    • Install
    • Log
    • Media
    • Newsletter
    • Oauth
    • Page
    • PageCache
    • Paygate
    • Payment
    • Paypal
    • PaypalUk
    • Persistent
    • Poll
    • ProductAlert
    • Rating
    • Reports
    • Review
    • Rss
    • Rule
    • Sales
    • SalesRule
    • Sedfriend
    • Sendfriend
    • Shipping
    • Sitemap
    • Tag
    • Tax
    • Usa
    • Weee
    • Widget
    • Wishlist
    • XmlConnect
  • None
  • Phoenix
    • Moneybookers
  • PHP
  • Zend
    • Date
    • Mime
    • XmlRpc

Classes

  • Mage_GoogleCheckout_ApiController
  • Mage_GoogleCheckout_Block_Adminhtml_Shipping_Applicable_Countries
  • Mage_GoogleCheckout_Block_Adminhtml_Shipping_Merchant
  • Mage_GoogleCheckout_Block_Form
  • Mage_GoogleCheckout_Block_Link
  • Mage_GoogleCheckout_Block_Redirect
  • Mage_GoogleCheckout_Helper_Data
  • Mage_GoogleCheckout_Model_Api
  • Mage_GoogleCheckout_Model_Api_Debug
  • Mage_GoogleCheckout_Model_Api_Xml_Abstract
  • Mage_GoogleCheckout_Model_Api_Xml_Calculate
  • Mage_GoogleCheckout_Model_Api_Xml_Callback
  • Mage_GoogleCheckout_Model_Api_Xml_Checkout
  • Mage_GoogleCheckout_Model_Api_Xml_Order
  • Mage_GoogleCheckout_Model_Mysql4_Api_Debug
  • Mage_GoogleCheckout_Model_Mysql4_Api_Debug_Collection
  • Mage_GoogleCheckout_Model_Mysql4_Notification
  • Mage_GoogleCheckout_Model_Mysql4_Setup
  • Mage_GoogleCheckout_Model_Mysql4_Tax
  • Mage_GoogleCheckout_Model_Notification
  • Mage_GoogleCheckout_Model_Observer
  • Mage_GoogleCheckout_Model_Payment
  • Mage_GoogleCheckout_Model_Resource_Api_Debug
  • Mage_GoogleCheckout_Model_Resource_Api_Debug_Collection
  • Mage_GoogleCheckout_Model_Resource_Notification
  • Mage_GoogleCheckout_Model_Resource_Setup
  • Mage_GoogleCheckout_Model_Resource_Tax
  • Mage_GoogleCheckout_Model_Shipping
  • Mage_GoogleCheckout_Model_Source_Checkout_Image
  • Mage_GoogleCheckout_Model_Source_Locale
  • Mage_GoogleCheckout_Model_Source_Shipping_Carrier
  • Mage_GoogleCheckout_Model_Source_Shipping_Category
  • Mage_GoogleCheckout_Model_Source_Shipping_Units
  • Mage_GoogleCheckout_Model_Source_Shipping_Virtual_Method
  • Mage_GoogleCheckout_Model_Source_Shipping_Virtual_Schedule
  • Mage_GoogleCheckout_RedirectController

Exceptions

  • Mage_GoogleCheckout_Exception
  • Overview
  • Package
  • Class
  • Tree
  1: <?php
  2: /**
  3:  * Magento
  4:  *
  5:  * NOTICE OF LICENSE
  6:  *
  7:  * This source file is subject to the Open Software License (OSL 3.0)
  8:  * that is bundled with this package in the file LICENSE.txt.
  9:  * It is also available through the world-wide-web at this URL:
 10:  * http://opensource.org/licenses/osl-3.0.php
 11:  * If you did not receive a copy of the license and are unable to
 12:  * obtain it through the world-wide-web, please send an email
 13:  * to license@magentocommerce.com so we can send you a copy immediately.
 14:  *
 15:  * DISCLAIMER
 16:  *
 17:  * Do not edit or add to this file if you wish to upgrade Magento to newer
 18:  * versions in the future. If you wish to customize Magento for your
 19:  * needs please refer to http://www.magentocommerce.com for more information.
 20:  *
 21:  * @category    Mage
 22:  * @package     Mage_GoogleCheckout
 23:  * @copyright   Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
 24:  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
 25:  */
 26: 
 27: class Mage_GoogleCheckout_Model_Api extends Varien_Object
 28: {
 29:     /**
 30:      * Fields that should be replaced in debug with '***'
 31:      *
 32:      * @var array
 33:      */
 34:     protected $_debugReplacePrivateDataKeys = array();
 35: 
 36:     protected function _getApi($area)
 37:     {
 38:         $api = Mage::getModel('googlecheckout/api_xml_' . $area)->setStoreId($this->getStoreId());
 39:         $api->setApi($this);
 40:         return $api;
 41:     }
 42: 
 43: // CHECKOUT
 44:     public function checkout(Mage_Sales_Model_Quote $quote)
 45:     {
 46:         $api = $this->_getApi('checkout')
 47:             ->setQuote($quote)
 48:             ->checkout();
 49:         return $api;
 50:     }
 51: 
 52: // FINANCIAL COMMANDS
 53:     public function authorize($gOrderId)
 54:     {
 55:         $api = $this->_getApi('order')
 56:             ->setGoogleOrderNumber($gOrderId)
 57:             ->authorize();
 58:         return $api;
 59:     }
 60: 
 61:     public function charge($gOrderId, $amount)
 62:     {
 63:         $api = $this->_getApi('order')
 64:             ->setGoogleOrderNumber($gOrderId)
 65:             ->charge($amount);
 66:         return $api;
 67:     }
 68: 
 69:     public function refund($gOrderId, $amount, $reason, $comment = '')
 70:     {
 71:         $api = $this->_getApi('order')
 72:             ->setGoogleOrderNumber($gOrderId)
 73:             ->refund($amount, $reason, $comment);
 74:         return $api;
 75:     }
 76: 
 77:     public function cancel($gOrderId, $reason, $comment = '')
 78:     {
 79:         $api = $this->_getApi('order')
 80:             ->setGoogleOrderNumber($gOrderId)
 81:             ->cancel($reason, $comment);
 82:         return $api;
 83:     }
 84: 
 85: // FULFILLMENT COMMANDS (ORDER BASED)
 86: 
 87:     public function process($gOrderId)
 88:     {
 89:         $api = $this->_getApi('order')
 90:             ->setGoogleOrderNumber($gOrderId)
 91:             ->process();
 92:         return $api;
 93:     }
 94: 
 95:     public function deliver($gOrderId, $carrier, $trackingNo, $sendMail = true)
 96:     {
 97:         $gCarriers = array('dhl' => 'DHL', 'fedex' => 'FedEx', 'ups' => 'UPS', 'usps' => 'USPS');
 98:         $carrier = strtolower($carrier);
 99:         $carrier = isset($gCarriers[$carrier]) ? $gCarriers[$carrier] : 'Other';
100: 
101:         $api = $this->_getApi('order')
102:             ->setGoogleOrderNumber($gOrderId)
103:             ->deliver($carrier, $trackingNo, $sendMail);
104:         return $api;
105:     }
106: 
107:     public function addTrackingData($gOrderId, $carrier, $trackingNo)
108:     {
109:         $api = $this->_getApi('order')
110:             ->setGoogleOrderNumber($gOrderId)
111:             ->addTrackingData($carrier, $trackingNo);
112:         return $api;
113:     }
114: 
115: // FULFILLMENT COMMANDS (ITEM BASED)
116: 
117:     public function shipItems($gOrderId, array $items)
118:     {
119:         $api = $this->_getApi('order')
120:             ->setGoogleOrderNumber($gOrderId)
121:             ->shipItems($items);
122:         return $api;
123:     }
124: 
125:     public function backorderItems()
126:     {
127:         $api = $this->_getApi('order')
128:             ->setOrder($order)
129:             ->setItems($items)
130:             ->shipItems();
131:         return $api;
132:     }
133: 
134:     public function returnItems()
135:     {
136:         $api = $this->_getApi('order')
137:             ->setOrder($order)
138:             ->setItems($items)
139:             ->shipItems();
140:         return $api;
141:     }
142: 
143:     public function cancelItems()
144:     {
145:         $api = $this->_getApi('order')
146:             ->setOrder($order)
147:             ->setItems($items)
148:             ->shipItems();
149:         return $api;
150:     }
151: 
152:     public function resetItemsShippingInformation()
153:     {
154: 
155:     }
156: 
157:     public function addMerchantOrderNumber()
158:     {
159: 
160:     }
161: 
162:     public function sendBuyerMessage()
163:     {
164:         $api = $this->_getApi('order')
165:             ->setOrder($order)
166:             ->setItems($items)
167:             ->shipItems();
168:         return $api;
169:     }
170: 
171: // OTHER ORDER COMMANDS
172: 
173:     public function archiveOrder()
174:     {
175:         $api = $this->_getApi('order')
176:             ->setOrder($order)
177:             ->setItems($items)
178:             ->shipItems();
179:         return $api;
180:     }
181: 
182:     public function unarchiveOrder()
183:     {
184:         $api = $this->_getApi('order')
185:             ->setOrder($order)
186:             ->setItems($items)
187:             ->shipItems();
188:         return $api;
189:     }
190: 
191: // WEB SERVICE SERVER PROCEDURES
192: 
193:     public function processCallback()
194:     {
195:         $api = $this->_getApi('callback')->process();
196:         return $api;
197:     }
198: 
199:     /**
200:      * @deprecated after 1.4.1.0
201:      *
202:      */
203:     public function processBeacon(){}
204: 
205:     /**
206:      * Log debug data to file
207:      *
208:      * @param mixed $debugData
209:      */
210:     public function debugData($debugData)
211:     {
212:         if ($this->getDebugFlag()) {
213:             Mage::getModel('core/log_adapter', 'payment_googlecheckout.log')
214:                ->setFilterDataKeys($this->_debugReplacePrivateDataKeys)
215:                ->log($debugData);
216:         }
217:     }
218: 
219:     /**
220:      * Define if debugging is enabled
221:      *
222:      * @return bool
223:      */
224:     public function getDebugFlag()
225:     {
226:         if (!$this->hasData('debug_flag')) {
227:             $this->setData('debug_flag', Mage::getStoreConfig('google/checkout/debug', $this->getStoreId()));
228:         }
229:         return $this->getData('debug_flag');
230:     }
231: }
232: 
Magento 1.7.0.2 API documentation generated by ApiGen 2.8.0