Constants

DEFAULT_TIMEOUT

DEFAULT_TIMEOUT = 5.0

GLOBAL_SUCCESS_CODE

GLOBAL_SUCCESS_CODE = 200

GLOBAL_SUCCESS_MSG

GLOBAL_SUCCESS_MSG = 'OK'

Properties

$company

$company

$config

$config : array

Type

array

Methods

__construct()

__construct(array  $config) : mixed

Base constructor.

Parameters

array $config

Returns

mixed —

query()

query( $no, null  $company = null) : \Finecho\Logistics\Order

Parameters

$no
null $company

Throws

\Finecho\Logistics\Exceptions\HttpException
\Finecho\Logistics\Exceptions\InquiryErrorException
\Finecho\Logistics\Exceptions\InvalidArgumentException

Returns

\Finecho\Logistics\Order —

getLogisticsCompanyAliases()

getLogisticsCompanyAliases(string  $company) : string

Parameters

string $company

Throws

\Finecho\Logistics\Exceptions\InvalidArgumentException

Returns

string —

companies()

companies() : array

Returns

array —

abstractLogisticsStatus()

abstractLogisticsStatus( $status) : array

Parameters

$status

Returns

array —

getProviderName()

getProviderName() : string

Returns

string —

claimLogisticsStatus()

claimLogisticsStatus( $status) : array

Parameters

$status

Returns

array —

get()

get(string  $endpoint, array  $query = [], array  $headers = []) : array

Make a get request.

Parameters

string $endpoint
array $query
array $headers

Returns

array —

post()

post(string  $endpoint, array  $params = [], array  $headers = []) : array

Make a post request.

Parameters

string $endpoint
array $params
array $headers

Returns

array —

postJson()

postJson( $endpoint, array  $params = [], array  $headers = []) : array

Make a post request with json params.

Parameters

$endpoint
array $params
array $headers

Returns

array —

request()

request(string  $method, string  $endpoint, array  $options = []) : array

Make a http request.

Parameters

string $method
string $endpoint
array $options

http://docs.guzzlephp.org/en/latest/request-options.html

Returns

array —

getBaseOptions()

getBaseOptions() : array

Return base Guzzle options.

Returns

array —

getHttpClient()

getHttpClient(array  $options = []) : \GuzzleHttp\Client

Return http client.

Parameters

array $options

Returns

\GuzzleHttp\Client —

unwrapResponse()

unwrapResponse(\Psr\Http\Message\ResponseInterface  $response) : \Psr\Http\Message\ResponseInterface|array|string

Convert response contents to json.

Parameters

\Psr\Http\Message\ResponseInterface $response

Returns

\Psr\Http\Message\ResponseInterface|array|string —

mapLogisticsOrderToObject()

mapLogisticsOrderToObject( $logisticsOrder) : \Finecho\Logistics\Order

Parameters

$logisticsOrder

Returns

\Finecho\Logistics\Order —

resetList()

resetList(array  $list) : array

Parameters

array $list

Returns

array —

sendRequestGet()

sendRequestGet(string  $url, array  $params, array  $headers) : array

Parameters

string $url
array $params
array $headers

Throws

\Finecho\Logistics\Exceptions\HttpException

Returns

array —

sendRequestPost()

sendRequestPost( $url,  $params,  $headers, int  $SUCCESS_STATUS = self::GLOBAL_SUCCESS_CODE) : array

Parameters

$url
$params
$headers
int $SUCCESS_STATUS

Throws

\Finecho\Logistics\Exceptions\HttpException
\Finecho\Logistics\Exceptions\InquiryErrorException

Returns

array —

generateSign()

generateSign( $param,  $key,  $customer) : string

Parameters

$param
$key
$customer

Returns

string —