alexlcdee vor 8 Jahren
Ursprung
Commit
30e0342370

+ 3 - 1
.gitignore

@@ -1,2 +1,4 @@
 vendor/
-composer.lock
+composer.lock
+
+.idea

+ 6 - 0
bootstrap.php

@@ -0,0 +1,6 @@
+<?php
+
+require __DIR__ . '/vendor/autoload.php';
+
+define('__TEST_DIR__', __DIR__ . '/tests');
+

+ 8 - 2
composer.json

@@ -9,14 +9,20 @@
         "dpd soap"
     ],
     "require": {
-        "php": ">= 5.4"
+        "php": ">= 5.6"
     },
     "require-dev": {
-        "phpdocumentor/phpdocumentor": "~2.8.0"
+        "phpdocumentor/phpdocumentor": "~2.8.0",
+        "phpunit/phpunit": "5.7.26"
     },
     "autoload": {
         "psr-4": {
             "Ipol\\DPD\\": "src/lib"
         }
+    },
+    "autoload-dev": {
+        "psr-4": {
+            "Ipol\\DPD\\Tests\\": "tests/"
+        }
     }
 }

+ 12 - 0
phpunit.xml

@@ -0,0 +1,12 @@
+<phpunit bootstrap="./bootstrap.php"
+         colors="false"
+         convertErrorsToExceptions="true"
+         convertNoticesToExceptions="true"
+         convertWarningsToExceptions="true"
+         stopOnFailure="false">
+    <filter>
+        <whitelist processUncoveredFilesFromWhitelist="false">
+            <directory suffix=".php">src/</directory>
+        </whitelist>
+    </filter>
+</phpunit>

+ 14 - 13
src/lib/API/Client/Soap.php

@@ -69,20 +69,21 @@ class Soap extends \SoapClient implements ClientInterface
 		return $this;
 	}
 
-	/**
-	 * Выполняет запрос к внешнему API
-	 * 
-	 * @param  string $method выполняемый метод API
-	 * @param  array  $args   параметры для передачи
-	 * @param  string $wrap   название эл-та обертки
-	 * @param  string $keys
-	 * 
-	 * @return mixed
-	 */
+    /**
+     * Выполняет запрос к внешнему API
+     *
+     * @param  string $method выполняемый метод API
+     * @param  array $args параметры для передачи
+     * @param  string $wrap название эл-та обертки
+     * @param  string|bool $keys
+     *
+     * @return mixed
+     * @throws \Exception
+     */
 	public function invoke($method, array $args = array(), $wrap = 'request', $keys = false)
 	{
-		$parms   = array_merge($args, array('auth' => $this->auth));
-		$request = $wrap ? array($wrap => $parms) : $parms;
+		$params   = array_merge($args, array('auth' => $this->auth));
+		$request = $wrap ? array($wrap => $params) : $params;
 		$request = $this->convertDataForService($request);
 
 		// $cache_id = serialize($request) . ($keys ? serialize($keys) : '');
@@ -110,7 +111,7 @@ class Soap extends \SoapClient implements ClientInterface
 	/**
 	 * Возвращает инстанс кэша
 	 * 
-	 * @return 
+	 * @return null
 	 */
 	protected function cache()
 	{

+ 78 - 72
src/lib/API/Service/Geography.php

@@ -1,4 +1,5 @@
 <?php
+
 namespace Ipol\DPD\API\Service;
 
 use \Ipol\DPD\API\User\UserInterface;
@@ -9,88 +10,93 @@ use \Ipol\DPD\API\Client\Factory as ClientFactory;
  */
 class Geography implements ServiceInterface
 {
-	protected $wdsl = 'http://ws.dpd.ru/services/geography2?wsdl';
+    protected $wdsl = [
+        'http://ws.dpd.ru/services/geography2?wsdl',
+        'http://wstest.dpd.ru/services/geography2?wsdl',
+    ];
 
-	protected $clientOld;
+    protected $clientOld;
+    private $client;
 
-	/**
+    /**
      * Конструктор класса
-     * 
+     *
      * @param \Ipol\DPD\API\User\UserInterface
+     * @throws \Exception
      */
-	public function __construct(UserInterface $user)
-	{
-		// По не известным причинам данный сервис в тестовом режиме
-		// выдает soap ошибку. В боевом - этой ошибки нет. 
-		// Поэтому для этого сервиса мы отключаем тестовый режим всегда
-		// $user = new User($user->getClientNumber(), $user->getSecretKey(), false);
+    public function __construct(UserInterface $user)
+    {
+        // По не известным причинам данный сервис в тестовом режиме
+        // выдает soap ошибку. В боевом - этой ошибки нет.
+        // Поэтому для этого сервиса мы отключаем тестовый режим всегда
+        // $user = new User($user->getClientNumber(), $user->getSecretKey(), false);
 
-		$this->client = ClientFactory::create($this->wdsl, $user);
-	}
+        $this->client = ClientFactory::create($this->wdsl[$user->isTestMode()], $user);
+    }
 
-	/**
-	 * Возвращает список городов с возможностью доставки наложенным платежом
-	 * 
-	 * @param string $countryCode код страны
-	 * 
-	 * @return array
-	 */
-	public function getCitiesCashPay($countryCode = 'RU')
-	{
-		return $this->client->invoke('getCitiesCashPay', array(
-			'countryCode' => $countryCode
-		), 'request', 'cityCode');
-	}
+    /**
+     * Возвращает список городов с возможностью доставки наложенным платежом
+     *
+     * @param string $countryCode код страны
+     *
+     * @return array
+     */
+    public function getCitiesCashPay($countryCode = 'RU')
+    {
+        return $this->client->invoke('getCitiesCashPay', array(
+            'countryCode' => $countryCode,
+        ), 'request', 'cityCode');
+    }
 
-	/**
-	 * Возвращает список пунктов приема/выдачи посылок, имеющих ограничения по габаритам и весу, 
-	 * с указанием режима работы пункта и доступностью выполнения самопривоза/самовывоза.
-	 * При работе с  методом  необходимо проводить получение информации по списку подразделений ежедневно.
-	 * 
-	 * @param string $countryCode код страны
-	 * @param string $regionCode  код региона
-	 * @param string $cityCode    код города
-	 * @param string $cityName    название города
-	 * 
-	 * @return array
-	 */
-	public function getParcelShops($countryCode = 'RU', $regionCode = false, $cityCode = false, $cityName = false)
-	{
-		$ret = $this->client->invoke('getParcelShops', array_filter(array(
-			'countryCode' => $countryCode,
-			'regionCode'  => $regionCode,
-			'cityCode'    => $cityCode,
-			'cityName'    => $cityName
-		)));
+    /**
+     * Возвращает список пунктов приема/выдачи посылок, имеющих ограничения по габаритам и весу,
+     * с указанием режима работы пункта и доступностью выполнения самопривоза/самовывоза.
+     * При работе с  методом  необходимо проводить получение информации по списку подразделений ежедневно.
+     *
+     * @param string $countryCode код страны
+     * @param string $regionCode код региона
+     * @param string $cityCode код города
+     * @param string $cityName название города
+     *
+     * @return array
+     */
+    public function getParcelShops($countryCode = 'RU', $regionCode = false, $cityCode = false, $cityName = false)
+    {
+        $ret = $this->client->invoke('getParcelShops', array_filter(array(
+            'countryCode' => $countryCode,
+            'regionCode'  => $regionCode,
+            'cityCode'    => $cityCode,
+            'cityName'    => $cityName,
+        )));
 
-		return $ret ? $ret['PARCEL_SHOP'] : $ret;
-	}
+        return $ret ? $ret['PARCEL_SHOP'] : $ret;
+    }
 
-	/**
-	 * Возвращает список подразделений DPD, не имеющих ограничений по габаритам и весу посылок приема/выдачи
-	 *
-	 * @return array
-	 */
-	public function getTerminalsSelfDelivery2()
-	{
-		$ret = $this->client->invoke('getTerminalsSelfDelivery2', array(), false);
+    /**
+     * Возвращает список подразделений DPD, не имеющих ограничений по габаритам и весу посылок приема/выдачи
+     *
+     * @return array
+     */
+    public function getTerminalsSelfDelivery2()
+    {
+        $ret = $this->client->invoke('getTerminalsSelfDelivery2', array(), false);
 
-		return $ret ? $ret['TERMINAL'] : $ret;
-	}
+        return $ret ? $ret['TERMINAL'] : $ret;
+    }
 
-	/**
-	 * Возвращает информацию о сроке бесплатного хранения на пункте
-	 *
-	 * @param array $terminalCodes
-	 * @param array $serviceCode
-	 * 
-	 * @return array
-	 */
-	public function getStoragePeriod(array $terminalCodes = array(), array $serviceCode = array())
-	{
-		return $this->client->invoke('getStoragePeriod', array_filter(array(
-			'terminalCоdes' => implode(',', $terminalCоdes),
-			'serviceCode'   => implode(',', $serviceCode)
-		)));
-	}
+    /**
+     * Возвращает информацию о сроке бесплатного хранения на пункте
+     *
+     * @param array $terminalCodes
+     * @param array $serviceCode
+     *
+     * @return array
+     */
+    public function getStoragePeriod(array $terminalCodes = array(), array $serviceCode = array())
+    {
+        return $this->client->invoke('getStoragePeriod', array_filter(array(
+            'terminalCоdes' => implode(',', $terminalCodes),
+            'serviceCode'   => implode(',', $serviceCode),
+        )));
+    }
 }

+ 16 - 12
src/lib/API/User/User.php

@@ -53,7 +53,7 @@ class User implements UserInterface
 	 * 
 	 * @param string $alias
 	 * 
-	 * @return \Ipol\DPD\User\UserInterface
+	 * @return \Ipol\DPD\API\User\UserInterface
 	 */
 	public static function getInstanceByAlias($alias)
 	{
@@ -67,7 +67,7 @@ class User implements UserInterface
     /**
 	 * Возвращает инстанс класса с параметрами доступа указанными в настройках
 	 * 
-	 * @return \Ipol\DPD\User\UserInterface
+	 * @return \Ipol\DPD\API\User\UserInterface
 	 */
 	public static function getInstanceByConfig(ConfigInterface $config, $account = false)
 	{
@@ -96,8 +96,8 @@ class User implements UserInterface
 	 * @param string  $clientNumber номер клиента
 	 * @param string  $secretKey    ключ доступа к API
 	 * @param boolean $testMode     тестовый режим
-	 * @param string  $currency     используемая валюта в API
-	 * @param string  $alias        псевдоним под которым зарегистрируется текущий инстанс
+	 * @param string|bool  $currency     используемая валюта в API
+	 * @param string|bool  $alias        псевдоним под которым зарегистрируется текущий инстанс
 	 */
 	public function __construct($clientNumber, $secretKey, $testMode = false, $currency = false, $alias = false)
 	{
@@ -150,17 +150,21 @@ class User implements UserInterface
 		return $this->currency;
 	}
 
-	/**
-	 * Возвращает конкретную службу API
-	 * 
-	 * @param  string $serviceName имя службы
-	 * 
-	 * @return \Ipol\API\Service\ServiceInterface
-	 */
+    /**
+     * Возвращает конкретную службу API
+     *
+     * @param  string $serviceName имя службы
+     *
+     * @return \Ipol\DPD\API\Service\ServiceInterface
+     * @throws \Exception
+     */
 	public function getService($serviceName)
 	{
 		if (isset(static::$classmap[$serviceName])) {
-			return $this->services[$serviceName] ?: $this->services[$serviceName] = new static::$classmap[$serviceName]($this);
+		    if(!isset($this->services[$serviceName])) {
+                $this->services[$serviceName] = new static::$classmap[$serviceName]($this);
+            }
+			return $this->services[$serviceName];
 		}
 
 		throw new \Exception("Service {$serviceName} not found");

+ 65 - 66
src/lib/DB/AbstractTable.php

@@ -1,4 +1,5 @@
 <?php
+
 namespace Ipol\DPD\DB;
 
 /**
@@ -10,7 +11,7 @@ abstract class AbstractTable implements TableInterface
 
     /**
      * Конструктор класса
-     * 
+     *
      * @param \Ipol\DPD\DB\ConnectionInterface
      */
     public function __construct(ConnectionInterface $connection)
@@ -20,17 +21,17 @@ abstract class AbstractTable implements TableInterface
 
     /**
      * Возвращает соединение с БД
-     * 
+     *
      * @return \Ipol\DPD\DB\ConnectionInterface
      */
-    public function getConnection() 
+    public function getConnection()
     {
         return $this->connection;
     }
 
     /**
      * Возвращает конфиг
-     * 
+     *
      * @return \Ipol\DPD\Config\ConfigInterface
      */
     public function getConfig()
@@ -40,7 +41,7 @@ abstract class AbstractTable implements TableInterface
 
     /**
      * Возвращает инстанс PDO
-     * 
+     *
      * @return \PDO
      */
     public function getPDO()
@@ -50,7 +51,7 @@ abstract class AbstractTable implements TableInterface
 
     /**
      * Возвращает имя класса модели
-     * 
+     *
      * @return array
      */
     public function getModelClass()
@@ -60,7 +61,7 @@ abstract class AbstractTable implements TableInterface
 
     /**
      * Возвращает инстанс модели ассоциированной с таблицой
-     * 
+     *
      * @return \Ipol\DPD\DB\Model
      */
     public function makeModel($id = false)
@@ -72,11 +73,11 @@ abstract class AbstractTable implements TableInterface
 
     /**
      * Создание таблицы при необходимости
-     * 
+     *
      * @return void
      */
     public function checkTableSchema()
-	{
+    {
         $sqlPath = sprintf('%s/db/install/%s/%s.sql',
             $this->getConfig()->get('DATA_DIR'),
             $this->getConnection()->getDriver(),
@@ -87,83 +88,81 @@ abstract class AbstractTable implements TableInterface
             $sql = file_get_contents($sqlPath);
             $this->getPDO()->query($sql);
         }
-	}
+    }
 
-	
 
     /**
      * Добавление записи
-     * 
+     *
      * @param array $values
-     * 
+     *
      * @return bool
      */
     public function add($values)
     {
-        $fields       = array_keys($values);
-        $values       = $this->prepareParms($values);
+        $fields = array_keys($values);
+        $values = $this->prepareParms($values);
         $placeholders = array_keys($values);
-        
+
         $sql = 'INSERT INTO '
-            . $this->getTableName() 
-            . ' ('. implode(',', $fields) .') VALUES ('
-            . implode(',', $placeholders) .')'
-        ;
+            . $this->getTableName()
+            . ' (' . implode(',', $fields) . ') VALUES ('
+            . implode(',', $placeholders) . ')';
 
         return $this->getPDO()
-                    ->prepare($sql)
-                    ->execute($values)
-                ? $this->getPDO()->lastInsertId()
-                : false;
+            ->prepare($sql)
+            ->execute($values)
+            ? $this->getPDO()->lastInsertId()
+            : false;
     }
 
     /**
      * Обновление записи
-     * 
-     * @param int   $id
+     *
+     * @param int $id
      * @param array $values
-     * 
+     *
      * @return bool
      */
     public function update($id, $values)
     {
-        $fields       = array_keys($values);
-        $values       = $this->prepareParms($values);
+        $fields = array_keys($values);
+        $values = $this->prepareParms($values);
         $placeholders = array_keys($values);
-        
-        $sql = 'UPDATE '. $this->getTableName() .' SET ';
+
+        $sql = 'UPDATE ' . $this->getTableName() . ' SET ';
         foreach ($fields as $i => $field) {
-            $sql .= $field .'='. $placeholders[$i] .',';
+            $sql .= $field . '=' . $placeholders[$i] . ',';
         }
         $sql = trim($sql, ',') . ' WHERE id = :id_where';
 
         return $this->getPDO()
-                    ->prepare($sql)
-                    ->execute(array_merge(
-                        $values, 
-                        [':id_where' => $id]
-                    ));
+            ->prepare($sql)
+            ->execute(array_merge(
+                $values,
+                [':id_where' => $id]
+            ));
     }
 
     /**
      * Удаление записи
-     * 
+     *
      * @param int $id
-     * 
+     *
      * @return bool
      */
     public function delete($id)
     {
-        $sql = 'DELETE FROM '. $this->getTableName .' WHERE id = :id';
+        $sql = 'DELETE FROM ' . $this->getTableName . ' WHERE id = :id';
 
         return $this->getPDO()
-                    ->prepare($sql)
-                    ->execute([':id' => $id]);
+            ->prepare($sql)
+            ->execute([':id' => $id]);
     }
-    
+
     /**
      * Выборка записей
-     * 
+     *
      * $parms = "id = 1" or
      * $parms = [
      *  'select' => '*',
@@ -172,41 +171,41 @@ abstract class AbstractTable implements TableInterface
      *  'limit'  => '0,1',
      *  'bind'   => [':id' => 1]
      * ]
-     * 
-     * @param string|array $parms
-     * 
+     *
+     * @param string|array $params
+     *
      * @return \PDOStatement
      */
-    public function find($parms = [])
+    public function find($params = [])
     {
-        $parms = is_array($parms)
-            ? $parms
+        $params = is_array($params)
+            ? $params
             : [
-                'where' => $parms,
-            ]
-        ;
-        
+                'where' => $params,
+            ];
+
         $sql = sprintf('SELECT %s FROM %s %s %s %s',
-            isset($parms['select'])     ? $parms['select']               : '*',
+            isset($params['select']) ? $params['select'] : '*',
             $this->getTableName(),
-            isset($parms['where'])      ? "WHERE {$parms['where']}" : '',
-            isset($parms['order'])      ? "ORDER BY {$parms['order']}"   : '',
-            isset($parms['limit'])      ? "LIMIT {$parms['limit']}"      : ''
+            isset($params['where']) ? "WHERE {$params['where']}" : '',
+            isset($params['order']) ? "ORDER BY {$params['order']}" : '',
+            isset($params['limit']) ? "LIMIT {$params['limit']}" : ''
         );
 
         $query = $this->getPDO()->prepare($sql);
 
-        return $query->execute($parms['bind'])
+        $params['bind'] = !isset($params['bind']) ? null : $params['bind'];
+
+        return $query->execute($params['bind'])
             ? $query
-            : false
-        ;
+            : false;
     }
 
     /**
      * Выборка одной записи, псевдномим над find limit 0,1
-     * 
+     *
      * @param int|string|array $parms
-     * 
+     *
      * @return array
      */
     public function findFirst($parms = [])
@@ -224,16 +223,16 @@ abstract class AbstractTable implements TableInterface
 
     /**
      * Составляет массив bind-values для передачи в PDO
-     * 
+     *
      * @param array $parms
-     * 
+     *
      * @return array
      */
     protected function prepareParms($parms)
     {
         $ret = array();
         foreach ($parms as $k => $v) {
-            $ret[':'. $k] = $v;
+            $ret[':' . $k] = $v;
         }
 
         return $ret;

+ 5 - 8
src/lib/DB/Connection.php

@@ -24,10 +24,11 @@ class Connection implements ConnectionInterface
      * @var array
      */
     protected $tables = array();
-    
+
     /**
      * Возвращает инстанс подключения
-     * 
+     *
+     * @param ConfigInterface $config
      * @return \Ipol\DPD\DB\ConnectionInterface
      */
     public static function getInstance(ConfigInterface $config)
@@ -37,12 +38,8 @@ class Connection implements ConnectionInterface
 
     /**
      * Конструктор класса
-     * 
-     * @param   string  $dsn        The DSN string
-     * @param   string  $username   (optional) Username
-     * @param   string  $password   (optional) Password
-     * @param   string  $driver     (optional) Driver's name
-     * @param   PDO     $pdo        (optional) PDO object
+     *
+     * @param ConfigInterface $config
      */
     public function __construct(ConfigInterface $config)
     {

+ 12 - 8
src/lib/DB/Location/Agent.php

@@ -1,6 +1,7 @@
 <?php
 namespace Ipol\DPD\DB\Location;
 
+use Ipol\DPD\API\Service\Geography;
 use \Ipol\DPD\Config\ConfigInterface;
 use \Ipol\DPD\API\User\UserInterface;
 use \Ipol\DPD\DB\TableInterface;
@@ -19,7 +20,7 @@ class Agent
 	/**
 	 * Конструктор
 	 * 
-	 * @param \Ipol\DPD\User\UserInterface $api   инстанс API
+	 * @param \Ipol\DPD\Api\User\UserInterface $api   инстанс API
 	 * @param \Ipol\DPD\DB\TableInterface  $table инстанс таблицы для записи данных в БД
 	 */
 	public function __construct(UserInterface $api, TableInterface $table)
@@ -29,7 +30,7 @@ class Agent
 	}
 
 	/**
-	 * @return \Ipol\DPD\User\UserInterface
+	 * @return \Ipol\DPD\API\User\UserInterface
 	 */
 	public function getApi()
 	{
@@ -37,7 +38,7 @@ class Agent
 	}
 
 	/**
-	 * @return \Ipol\DPD\DB\Location\Table
+	 * @return \Ipol\DPD\DB\TableInterface
 	 */
 	public function getTable()
 	{
@@ -47,7 +48,7 @@ class Agent
 	/**
 	 * Возвращает normalizer адресов
 	 * 
-	 * @return \Ipol\DPD\DB\Location\Normilizer
+	 * @return Normalizer
 	 */
 	public function getNormalizer()
 	{
@@ -57,9 +58,9 @@ class Agent
 	/**
 	 * Обновляет список всех городов обслуживания
 	 * 
-	 * @param integer $position Стартовая позиция курсора в файле
+	 * @param int $position Стартовая позиция курсора в файле
 	 * 
-	 * @return void
+	 * @return bool
 	 */
 	public function loadAll($position = 0)
 	{
@@ -77,10 +78,11 @@ class Agent
 				return ftell($file);
 			}
 
+            $_tmp_region_name_array = explode(',', $row[4]);
 			$this->loadLocation(
 				$this->getNormalizer()->normilize(
 					$country    = $row[5],
-					$regionName = end(explode(',', $row[4])),
+					$regionName = end($_tmp_region_name_array),
 					$cityName   = $row[2] .' '. $row[3]
 				),
 
@@ -114,7 +116,9 @@ class Agent
 			}
 
 			$started  = true;
-			$arCities = $this->getApi()->getService('geography')->getCitiesCashPay($countryCode);
+			/** @var Geography $service */
+			$service = $this->getApi()->getService('geography');
+			$arCities = $service->getCitiesCashPay($countryCode);
 
 			foreach ($arCities as $arCity) {
 				if ($index++ < $position[1]) {

+ 2 - 2
src/lib/DB/TableInterface.php

@@ -84,11 +84,11 @@ interface TableInterface
      *  'bind'   => [':id' => 1]
      * ]
      * 
-     * @param string|array $parms
+     * @param string|array $params
      * 
      * @return \PDOStatement
      */
-    public function find($parms = []);
+    public function find($params = []);
 
     /**
      * Выборка одной записи, псевдномим над find([limit => 0,1])

+ 1 - 0
tests/.gitignore

@@ -0,0 +1 @@
+test.db

+ 63 - 0
tests/DB/Location/AgentTest.php

@@ -0,0 +1,63 @@
+<?php
+
+namespace Ipol\DPD\Tests;
+
+use \Ipol\DPD\API\User\User as API;
+use Ipol\DPD\Config\Config;
+use Ipol\DPD\DB\Connection;
+use Ipol\DPD\DB\Location\Agent;
+use Ipol\DPD\DB\Location\Table;
+use PHPUnit\Framework\TestCase;
+
+class AgentTest extends TestCase
+{
+
+    public function test_can_load_all()
+    {
+        $config = new Config([
+            'DB' =>[
+                'DSN'      => 'sqlite:'. __TEST_DIR__ .'/test.db',
+                'USERNAME' => '',
+                'PASSWORD' => '',
+                'DRIVER'   => null,
+                'PDO'      => null,
+            ]
+        ]);
+
+        $api = API::getInstanceByConfig($config);
+        /** @var Table $locationTable */
+        $locationTable  = Connection::getInstance($config)->getTable('location');
+
+        $locationLoader = new Agent($api, $locationTable);
+
+        $locationLoader->loadAll();
+
+        $expectedCount = count(file(__TEST_DIR__ .'/../data/cities.csv'));
+        $actualCount = count($locationTable->find()->fetchAll());
+
+        $this->assertEquals($expectedCount, $actualCount);
+    }
+
+    public function test_can_load_cash_pay()
+    {
+        $config = new Config([
+            'DB' =>[
+                'DSN'      => 'sqlite:'. __TEST_DIR__ .'/test.db',
+                'USERNAME' => '',
+                'PASSWORD' => '',
+                'DRIVER'   => null,
+                'PDO'      => null,
+            ],
+            'IS_TEST' => true,
+            'KLIENT_NUMBER' => '',
+            'KLIENT_KEY' => ''
+        ]);
+
+        $api = API::getInstanceByConfig($config);
+        $locationTable  = Connection::getInstance($config)->getTable('location');
+
+        $locationLoader = new Agent($api, $locationTable);
+
+        $locationLoader->loadCashPay();
+    }
+}