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_Xml_Order extends Mage_GoogleCheckout_Model_Api_Xml_Abstract
 28: {
 29:     protected function _getApiUrl()
 30:     {
 31:         $url = $this->_getBaseApiUrl();
 32:         $url .= 'request/Merchant/'.Mage::getStoreConfig('google/checkout/merchant_id', $this->getStoreId());
 33:         return $url;
 34:     }
 35: 
 36:     protected function _processGResponse($response)
 37:     {
 38:         if ($response[0]===200) {
 39:             return true;
 40:         } else {
 41:             $xml = simplexml_load_string(html_entity_decode($response[1]));
 42:             if (!$xml || !$xml->{'error-message'}) {
 43:                 return false;
 44:             }
 45:             Mage::throwException($this->__('Google Checkout: %s', (string)$xml->{'error-message'}));
 46:         }
 47:     }
 48: 
 49: // FINANCIAL
 50: 
 51:     public function authorize()
 52:     {
 53:         $GRequest = $this->getGRequest();
 54: 
 55:         $postargs = '<?xml version="1.0" encoding="UTF-8"?>
 56:             <authorize-order xmlns="'
 57:             . $GRequest->schema_url
 58:             . '" google-order-number="'
 59:             . $this->getGoogleOrderNumber()
 60:             . '"/>';
 61: 
 62:         $response = $GRequest->SendReq($GRequest->request_url,
 63:                    $GRequest->GetAuthenticationHeaders(), $postargs);
 64:         return $this->_processGResponse($response);
 65:     }
 66: 
 67:     public function charge($amount)
 68:     {
 69:         $response = $this->getGRequest()
 70:             ->SendChargeOrder($this->getGoogleOrderNumber(), $amount);
 71:         return $this->_processGResponse($response);
 72:     }
 73: 
 74:     public function refund($amount, $reason, $comment = '')
 75:     {
 76:         $response = $this->getGRequest()
 77:             ->SendRefundOrder($this->getGoogleOrderNumber(), $amount, $reason, $comment);
 78:         return $this->_processGResponse($response);
 79:     }
 80: 
 81:     public function cancel($reason, $comment = '')
 82:     {
 83:         $response = $this->getGRequest()
 84:             ->SendCancelOrder($this->getGoogleOrderNumber(), $reason, $comment);
 85:         return $this->_processGResponse($response);
 86:     }
 87: 
 88: // FULFILLMENT
 89: 
 90:     public function process()
 91:     {
 92:         $response = $this->getGRequest()
 93:             ->SendProcessOrder($this->getGoogleOrderNumber());
 94:         return $this->_processGResponse($response);
 95:     }
 96: 
 97:     public function deliver($carrier, $trackingNo, $sendMail = true)
 98:     {
 99:         $response = $this->getGRequest()
100:             ->SendDeliverOrder($this->getGoogleOrderNumber(), $carrier, $trackingNo, $sendMail ? 'true' : 'false');
101:         return $this->_processGResponse($response);
102:     }
103: 
104:     public function addTrackingData($carrier, $trackingNo)
105:     {
106:         $response = $this->getGRequest()
107:             ->SendTrackingData($this->getGoogleOrderNumber(), $carrier, $trackingNo);
108:         return $this->_processGResponse($response);
109:     }
110: 
111:     public function shipItems($items, $sendMail = true)
112:     {
113:         $googleShipItems = array();
114:         foreach ($items as $item) {
115:             $googleShipItems[] = new GoogleShipItem($item);
116:         }
117: 
118:         $response = $this->getGRequest()
119:             ->SendShipItems($this->getGoogleOrderNumber(), $googleShipItems, $sendMail ? 'true' : 'false');
120:         return $this->_processGResponse($response);
121:     }
122: 
123:     public function backorderItems($items, $sendMail = true)
124:     {
125:         $response = $this->getGRequest()
126:             ->SendBackorderItems($this->getGoogleOrderNumber(), $items, $sendMail ? 'true' : 'false');
127:         return $this->_processGResponse($response);
128:     }
129: 
130:     public function cancelItems($items, $reason, $comment = '', $sendMail = true)
131:     {
132:         $response = $this->getGRequest()
133:             ->SendCancelItems($this->getGoogleOrderNumber(), $items, $reason, $comment, $sendMail ? 'true' : 'false');
134:         return $this->_processGResponse($response);
135:     }
136: 
137:     public function returnItems($items, $sendMail = true)
138:     {
139:         $response = $this->getGRequest()
140:             ->SendReturnItems($this->getGoogleOrderNumber(), $items, $sendMail ? 'true' : 'false');
141:         return $this->_processGResponse($response);
142:     }
143: 
144:     public function resetItems($items, $sendMail = true)
145:     {
146:         $response = $this->getGRequest()
147:             ->SendRResetItemsShippingInformation($this->getGoogleOrderNumber(), $items, $sendMail ? 'true' : 'false');
148:         return $this->_processGResponse($response);
149:     }
150: 
151: // MISC
152: 
153:     public function archive()
154:     {
155:         $response = $this->getGRequest()
156:             ->SendArchiveOrder($this->getGoogleOrderNumber());
157:         return $this->_processGResponse($response);
158:     }
159: 
160:     public function unarchive()
161:     {
162:         $response = $this->getGRequest()
163:             ->SendUnarchiveOrder($this->getGoogleOrderNumber());
164:         return $this->_processGResponse($response);
165:     }
166: 
167:     public function addOrderNumber($merchantOrder)
168:     {
169:         $response = $this->getGRequest()
170:             ->SendMerchantOrderNumber($this->getGoogleOrderNumber(), $merchantOrder);
171:         return $this->_processGResponse($response);
172:     }
173: 
174: 
175:     public function addBuyerMessage($message, $sendMail = true)
176:     {
177:         $response = $this->getGRequest()
178:             ->SendBuyerMessage($this->getGoogleOrderNumber(), $message, $sendMail ? 'true' : 'false');
179:         return $this->_processGResponse($response);
180:     }
181: }
182: 
Magento 1.7.0.2 API documentation generated by ApiGen 2.8.0