hasan-22/tapin

此包可帮助您使用Toppin的运输服务

v1.0.0 2024-02-25 18:30 UTC

This package is auto-updated.

Last update: 2024-09-25 19:50:02 UTC


README

使用方法

  • 安装包
  • composer require hasan-22/tapin.

设置令牌和商店标识符

use Tapin\Tapin;

$authKey = "jwt ***********************************************";
$shopId = "********-****-****-****-***********";

Tapin::setAuthKey($authKey);
$response = Tapin::shopInfo($shopId);
var_dump($response);

获取省份

参数

$count = 5;
$page = 1;
$response = \Tapin\Tapin::getProvinces($count, $page); 

获取县

参数

$count = 5;
$page = 1;
$response = \Tapin\Tapin::getCities($count, $page); 

同时获取省份和县

$response = \Tapin\Tapin::getProvinceAndCity(); 

获取商店列表

参数

$response = \Tapin\Tapin::shopList(); 

$count = 5;
$page = 1;
$response = \Tapin\Tapin::shopList($count, $page); 

获取亭子列表

参数

$shopId = "fc45949a-921d-4b4f-1ade-ab5180f7dcve";

$response = \Tapin\Tapin::kioskList($shopId, 1, 1);

获取商店详细信息

参数

$shopId = "fc45949a-921d-4b4f-1ade-ab5180f7dcve";

$response = \Tapin\Tapin::shopInfo($shopId);

获取商店余额(显示您的面板余额)

参数

$shopId = "fc45949a-921d-4b4f-1ade-ab5180f7dcve";

$response = \Tapin\Tapin::shopValidity($shopId);

分类列表

参数

$count = 10;
$page = 1;
$response = \Tapin\Tapin::categories($count, $page);

产品列表

参数

$shopId = "fc45949a-921d-4b4f-1ade-ab5180f7dcve";
$count = 10;
$page = 1;
$response = \Tapin\Tapin::products($shopId, $count, $page);

创建新产品

参数

$shopId = "fc45949a-921d-4b4f-1ade-ab5180f7dcve";
$title = "My first product";
$price = 250000; // It should be 'rial'
$weight = 500; // It should be 'gram'
$categoryId = "3d65e6eb-ca0d-47b3-9934-6295a355872f";
$description = ''; // It is not required
$response = \Tapin\Tapin::createProduct($shopId, $title, $price, $weight, $categoryId, $description);

编辑产品

参数

$shopId = "fc45949a-921d-4b4f-1ade-ab5180f7dcve";
$productId = 322;
$title = "update...";
$price = 200000; // It should be 'rial'
$weight = 550; // It should be 'gram'
$categoryId = "3d65e6eb-ca0d-47b3-9934-6295a355872f";
$description = ''; // It is not required
$response = \Tapin\Tapin::updateProduct($shopId, $productId, $title, $price, $weight, $categoryId, $description);

删除产品

参数

$shopId = "fc45949a-921d-4b4f-1ade-ab5180f7dcve";
$productId = 322;
$response = \Tapin\Tapin::deleteProduct($shopId, $productId);

查询运费

参数

订单类型列表

支付类型列表

$shopId = "fc45949a-921d-4b4f-1ade-ab5180f7dcve";
// نمونه محصولات (دقت کنید این لیست آرایه از آرایه ها میباشد)
$products = [
    [
        "count" => 1,
        "discount" => 0,
        "price" => 5000, // It should be `rial`
        "title" => "my product title",
        "weight" =>500, // It should be `grams` not `kilograms`
        "product_id" => null
    ]
];
$address = "تهیران ...";
$provinceCode = 1;
$cityCode = 1; 
$employeeCode='-1';
$firstName='Hasan';
$lastName="Bahrami";
$mobile="09168963472";
$postalCode="1111111111";
$payType=1;
$orderType=1;
$packageWeight=900; // It should be `grams` not `kilograms`
// This is optional
$kiosk=[
    "kiosk_id"=>101,
    "height"=>101,
    "width"=>101,
    "length"=>101,
    "turning"=>true
];
// This is optional
$email="armiaevil@gmail.com";
// This is optional
$phone="02111111111";
// This is optional
$description="سفارش شکستنی است لطفا در ارسال آن بیشتر دقت کنید";

$response = \Tapin\Tapin::priceInquiry($shopId, $products, $address, $provinceCode, $cityCode, $employeeCode, $firstName, $lastName, $mobile, $postalCode, $payType, $orderType, $packageWeight, $kiosk, $email, $phone, $description);

注册订单

参数

订单类型列表

支付类型列表

商品内容类型列表

订单注册类型

$shopId = "fc45949a-921d-4b4f-1ade-ab5180f7dcve";
// نمونه محصولات (دقت کنید این لیست آرایه از آرایه ها میباشد)
$products = [
    [
        "count" => 1,
        "discount" => 0,
        "price" => 5000, // It should be `rial`
        "title" => "my product title",
        "weight" =>500, // It should be `grams` not `kilograms`
        "product_id" => null // This must be null
    ]
];
$address = "تهیران ...";
$provinceCode = 1;
$cityCode = 1; 
$firstName='Hasan';
$lastName="Bahrami";
$mobile="09168963472";
$postalCode="1111111111";
$payType=1;
$orderType=1;
$packageWeight=900; // It should be `grams` not `kilograms`
$presenterCode=999;
$manualId=1;
$contentType=1;
// It is set to `0` by default
$registerType=0;
// It is set to `-1` by default
$employeeCode='-1';
// This is optional
$kiosk=[
    "kiosk_id"=>101,
    "height"=>101,
    "width"=>101,
    "length"=>101,
    "turning"=>true
];
// This is optional
$insuranceId=null,
// This is optional
$email="armiaevil@gmail.com";
// This is optional
$phone="02111111111";
// This is optional
$description="سفارش شکستنی است لطفا در ارسال آن بیشتر دقت کنید";

$response = \Tapin\Tapin::createOrder(
    $shopId,
    $products,
    $address,
    $provinceCode,
    $cityCode,
    $firstName,
    $lastName,
    $mobile,
    $postalCode,
    $payType,
    $orderType,
    $packageWeight,
    $presenterCode,
    $manualId,
    $contentType,
    $registerType,
    $employeeCode,
    $kiosk,
    $insuranceId,
    $email,
    $phone,
    $description
);

注册一批订单

参数

订单类型列表

支付类型列表

商品内容类型列表

订单注册类型

$shopId = "fc45949a-921d-4b4f-1ade-ab5180f7dcve";
$orders = [
    [
        "address"=> "tehran-...",
        "city_code"=> "1",
        "province_code"=> "1",
        "first_name"=> "hasan",
        "last_name"=> "bahrami",
        "mobile"=> "09168963472",
        "postal_code"=> "1313131313",
        "pay_type"=> "1",
        "order_type"=> "1",
        "package_weight"=> 10,
        "presenter_code"=>999,
        "content_type"=>1,
        "register_type"=> 0, // It is set to `0` by default
        "employee_code"=> "-1", // It is set to `-1` by default
        "insurance_id"=>null, // This is optional
        "description"=> null, // This is optional
        "email"=> null, // This is optional
        "phone"=> null, // This is optional
        // Products must be an array of arrays
        "products"=> [
            [
                "count"=> 1,
                "discount"=> 0,
                "price"=> 5000,
                "title"=> "my product title",
                "weight"=> 500,
                "product_id"=> null // This must be null
            ]
        ]

    ]
];
$response = \Tapin\Tapin::createBatchOfOrders($shopId, $orders);

保险金额列表

$response = \Tapin\Tapin::insuranceAmounts();

更改订单状态

参数

订单状态

$shopId= "fc45949a-921d-4b4f-1ade-ab5180f7dcve";
$orderId = 165;
$status = 1
$response = \Tapin\Tapin::changeOrderStatus($shopId, $orderId, $status);

批量更改订单状态

参数

订单状态

$shopId = "fc45949a-921d-4b4f-1ade-ab5180f7dcve";
$orders = [
    [
        // این باید آیدی سفارش باشد 
        "id"=>"d95d0f45-6162-4ec3-bd29-09452c148b40" 
    ],
    [
        // این باید آیدی سفارش باشد 
        "id"=>"d95d0f46-6162-4ec3-bd29-09452c148b46" 
    ]
]
$status = 80;
$response = \Tapin\Tapin::changeBatchOfOrderStatus($shopId, $orders, $status);

订单列表

参数

$shopId = "fc45949a-921d-4b4f-1ade-ab5180f7dcve";
$count = 10;
$page = 1;
$response = \Tapin\Tapin::orders($shopId, $count, $page);

订单详情

参数

$shopId = "fc45949a-921d-4b4f-1ade-ab5180f7dcve";
$orderId = 10;
$response = \Tapin\Tapin::orderDetail($shopId, $orderId);

用于账户充值的链接

参数

$shopId = "fc45949a-921d-4b4f-1ade-ab5180f7dcve";
$price = 500000;
$callback="https://domain.com/callback";
$response = \Tapin\Tapin::paymentLink($shopId, $price, $callback);

交易列表

参数

$shopId = "fc45949a-921d-4b4f-1ade-ab5180f7dcve";
$count = 10;
$page = 1;
$response = \Tapin\Tapin::transactions($shopId, $count, $page);

根据日期获取最新订单状态变更

参数

$shopId = "fc45949a-921d-4b4f-1ade-ab5180f7dcve";
$date = "1402-12-07";
$count = 10;
$page = 1;
$response = \Tapin\Tapin::getOrderStatusByDate($shopId, $date, $count, $page);

在指定日期范围内获取最新订单状态变更

参数

$shopId = "fc45949a-921d-4b4f-1ade-ab5180f7dcve";
$fromDate = "2024-02-20";
$toDate = "2024-02-25";
$count = 10;
$page = 1;
$response = \Tapin\Tapin::getOrderStatusBetweenDate($shopId, $fromDate, $toDate, $count, $page);