示例#1
0
 public function __construct()
 {
     /** @var Fontis_Australia_Helper_Address $helper */
     $helper = Mage::helper('australia/address');
     $options = array();
     if ($helper->isDeliveryChoicesDeveloperMode()) {
         $options['developer_mode'] = true;
     } else {
         $options['email_address'] = Mage::getStoreConfig('fontis_australia/address_validation/delivery_choices_account_email');
         $options['password'] = Mage::getStoreConfig('fontis_australia/address_validation/delivery_choices_account_password');
     }
     $this->setClient(Auspost::factory($options)->get('deliverychoice'));
 }
 public function __construct()
 {
     /** @var Fontis_Australia_Helper_Australiapost $helper */
     $helper = Mage::helper('australia/australiapost');
     $apiKey = $this->getConfigData('api_key');
     $config = array();
     if ($helper->isAustraliaPostDeveloperMode()) {
         $config = array('developer_mode' => true);
     } else {
         if ($apiKey) {
             $config = array('auth_key' => Mage::helper('core')->decrypt($apiKey));
         } else {
             Mage::log('You need a valid API key in order to use this feature.', null, 'fontis_australia.log');
         }
     }
     if (!empty($config)) {
         $this->_client = Auspost::factory($config)->get('postage');
     }
     $this->_result = Mage::getModel('shipping/rate_result');
 }
 public function __construct()
 {
     /** @var Fontis_Australia_Helper_Australiapost $helper */
     $helper = Mage::helper('australia/australiapost');
     $apiKey = $this->getConfigData('api_key');
     $config = array();
     if ($helper->isAustraliaPostDeveloperMode()) {
         $config = array('developer_mode' => true);
     } else {
         if ($apiKey) {
             //TODO: Specify the encrypted backend model in config.xml so we no longer need to decrypt this manually. This will be a breaking change.
             $config = array('auth_key' => Mage::helper('core')->decrypt($apiKey));
         } else {
             Mage::log('You need a valid API key in order to use this feature.', null, 'fontis_australia.log');
         }
     }
     if (!empty($config)) {
         $this->_client = Auspost::factory($config)->get('postage');
     }
     $this->_result = Mage::getModel('shipping/rate_result');
 }
 /**
  * @covers \Auspost\Common\Auspost::getDefaultServiceDefinition
  */
 public function testReturnsDefaultConfigPath()
 {
     $this->assertContains('config.json', Auspost::getDefaultServiceDefinition());
 }
示例#5
0
 * This file is part of Auspost API Client Library for PHP.
 *
 * The Auspost API Client Library for PHP is free software: you can redistribute
 * it and/or modify it under the terms of the GNU Lesser General Public License
 * as published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 *
 * The Auspost API Client Library for PHP 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 Lesser
 * General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with the Auspost API Client Library for PHP.  If not, see
 * <http://www.gnu.org/licenses/>.
 *
 * @category   Fontis
 * @package    auspost-api-php
 * @author     Thai Phan
 * @copyright  Copyright (c) 2013 Fontis Pty Ltd (http://www.fontis.com.au)
 * @license    http://opensource.org/licenses/LGPL-3.0 GNU Lesser General Public License (LGPL 3.0)
 */
// Include the composer autoloader
$loader = (require dirname(__DIR__) . '/vendor/autoload.php');
$loader->add('Auspost\\Tests', __DIR__);
// Register services with the GuzzleTestCase
Guzzle\Tests\GuzzleTestCase::setMockBasePath(__DIR__ . '/mock');
// Instantiate the service builder
$auspost = \Auspost\Common\Auspost::factory(array('developer_mode' => true));
// Configure the tests to use the instantiated Auspost service builder
Guzzle\Tests\GuzzleTestCase::setServiceBuilder($auspost);