fetchr / shiphappy
Fetchr 是一种技术解决方案,让发货过程像购物一样愉快。
这个包的官方仓库似乎已经消失,因此该包已被冻结。
dev-master
2016-03-02 10:42 UTC
Requires
- php: >=5.3.0
- nategood/httpful: *
Requires (Dev)
- phpunit/phpunit: 4.0.*
This package is not auto-updated.
Last update: 2024-08-09 18:42:40 UTC
README
简要介绍
Fetchr PHP/SDK 允许 PHP 开发者在代码中使用 Fetchr 发货和跟踪 API。
需求
- PHP >= 5.3.0
- curl 已启用
安装
您可以通过 Composer 在 require 部分添加此包来安装此包
"require": {
"fetchr/php-sdk": "1.0.0"
}
入门
初始化 SDK
#!php
<?php
require 'vendor/autoload.php';
$fetchr = new \fetchr\php_sdk\Shiphappy("CLIENT_USERNAME","CLIENT_PASSWORD");
获取订单状态
#!php
$fetchr->getOrderStatus('TRACKING_ID');
获取多个订单的状态
#!php
$fetchr->getBulkStatus(array('TRACKING_ID_1', 'TRACKING_ID_2'));
*注意:您可以在数组中添加任意数量的跟踪订单
创建配送订单
#!php
<?php
$dataErp = array(
'username' => 'CLIENT_USERNAME', // Provided by Fetchr Account Manager
'password' => 'CLIENT_PASSWORD', // Provided by Fetchr Account Manager
'method' => 'create_orders',
'pickup_location' => 'CLIENT_STORE_ADDRESS', // Your Store Address
'data' => array(
array(
'order_reference' => 'CLIENT_USERNAME'.'_'.'ORDER_ID',
'name' => 'CUSTOMER_FIRST_NAME'.' '.'CUSTOMER_LAST_NAME',
'email' => 'CUSTOMER_EMAIL',
'phone_number' => ('CUSTOMER_PHONE'?'CUSTOMER_PHONE':'N/A'),
'address' => 'CUSTOMER_ADDRESS',
'city' => CUSTOMER_CITY,
'payment_type' => PAYMENT_TYPE, // If cash on delivery then COD otherwise CD
'amount' => 'GRAND_TOTAL',// If the payment type was credit card then it must be 0 else put the real value of the total,
'description' => 'DESCRIPTION',
'comments' => 'COMMENTS',
),
),
);
$fetchr->createDeliveryOrder($dataErp);
*注意:所有大写字母单词必须替换为变量
创建履约订单
#!php
<?php
$dataErp[] = array(
'order' => array(
'items' => array(
'client_ref' => 'ORDER_ID',
'name' => 'ITEM_NAME',
'sku' => 'ITEM_SKU',
'quantity' => 'QUANITITY'
'merchant_details' => array(
'mobile' => 'STORE_MOBILE_NUMBER',
'phone' => 'STORE_PHONE_NUMBER',
'name' => 'STPRE_NAME',
'address' => 'STORE_ADDRESS',
),
'COD' => 'DELIVERY_RATE',
'price' => 'ITEM_PRICE',
'is_voucher' => 'NO',
),
'details' => array(
'status' => '',
'discount' => 'DISCOUNT_VALUE',
'grand_total' => 'GRAND_TOTAL',// If the payment type was credit card then it must be 0 else put the real value of the total
'customer_email' => 'CUSTOMER_EMAIL',
'order_id' => 'CLIENT_USERNAME'.'_'.'ORDER_ID',
'customer_firstname' => 'CUSTOMER_FIRST_NAME',
'payment_method' => PAYMENT_TYPE, // If cash on delivery then COD otherwise CD
'customer_mobile' => ('CUSTOMER_PHONE'?'CUSTOMER_PHONE':'N/A'),
'customer_lastname' => 'CUSTOMER_LAST_NAME',
'order_country' => 'COUNTRY_CODE', // Two letters code, ex: United Arab Emarites => AE, Jordan => JO ...etc
'order_address' => CUSTOMER_ADDRESS.', '.CUSTOMER_CITY.', '.CUSTOMER_COUNTRY_CODE_TWO_LETTERS,
),
),
);
$fetchr->createFulfilmentOrder($dataErp);
*注意:您可以在 items 数组中添加任意数量的项目