adjemin/

smartlivraison-php

Smart Livraison PHP 库

1.0.4 2020-06-28 11:48 UTC

This package is auto-updated.

Last update: 2024-09-13 02:23:37 UTC


README

Latest Stable Version Total Downloads Latest Unstable Version License

Smart Livraison PHP 库为用 PHP 编写的应用程序提供了便捷的 Smart Livraison API 访问方式。它包含一组预定义的类,这些类从 API 响应中动态初始化,使其与多种版本的 Smart Livraison API 兼容

要求

PHP 5.6.0 及以上。

Composer

您可以通过 Composer 安装绑定。运行以下命令

composer require adjemin/smartlivraison-php

入门指南

简单用法如下

创建商户任务并将其分配给配送服务

$customer_name = "Ange Bagui"; 
$customer_phone = "+22501000000";
$customer_email = "";
$location_name = "Immeuble Maiko, Rue L84, 8ᵉ tranche, Caféier, Cocody, Abidjan, 28, Côte d'Ivoire";
$location_latitude = 5.396215700000001; 
$location_longitude = -3.9768630282901785; 
$order_id = "1ebf79e3-da47-4f73-aefc-9557afa22e33";
$order_description = "Savon 200g Catégorie: Beauté Quantité: 1";
$order_price = "2000";
$currency_code = "XOF";
$has_pickup = true;
$delivery_fees = "1500";

$job_datetime = "2020-07-15 11:35:51";

$images = ["https://i.imgur.com/UbFukAq.jpg"];
$description = "Ramassage ";

$pickup = SmartLivraison::paramJob(
    $customer_name, 
    $customer_phone,
    $customer_email,
    $location_name, 
    $location_latitude, 
    $location_longitude, 
    $order_id, 
    $order_description,
    $order_price,
    $currency_code,
    $has_pickup,
    $delivery_fees,
    $job_datetime ,
    $images,
    $description
);

$customer_name = "Ange Bagui"; 
$customer_phone = "+22501000000";
$customer_email = "";
$location_name = "Pharmacie du Bonheur, Rue I168, Riviéra Palmeraie, Les Palmeraies, Palmeraie, Cocody, Abidjan, BP 51 CIDEX 3 ABIDJAN, Côte d'Ivoire";
$location_latitude = 5.3695041; 
$location_longitude = -3.9590591; 
$order_id = "1ebf79e3-da47-4f73-aefc-9557afa22e33";
$order_description = "Savon 200g Catégorie: Beauté Quantité: 1";
$order_price = "2000";
$currency_code = "XOF";
$has_pickup = false;
$delivery_fees = "1500";
$job_delivery_datetime =  "2020-07-15 13:35:51";
$images = ["https://i.imgur.com/UbFukAq.jpg"];
$description = "Livraison ";

$delivery = SmartLivraison::paramJob(
    $customer_name, 
    $customer_phone,
    $customer_email,
    $location_name, 
    $location_latitude, 
    $location_longitude, 
    $order_id, 
    $order_description,
    $order_price,
    $currency_code,
    $has_pickup,
    $delivery_fees,
    $job_delivery_datetime,
    $images,
    $description
);

 $client_id = '11211111'; //Your CLIENT ID
 $client_secret = '10997210-b096-4dd7-b834-837856e4fe25'; //Your CLIENT SECRET
 $smartLivraison = new SmartLivraison($client_id, $client_secret);

 $merchant_id = "21121"; //Your merchant ID
 $merchant_notification_url = "http://example.com/sl_notify"; //Your merchant notification url

 $delivery_service_username = "adjemin"; // The username of the delivery service in Smart Livraison
 $customer_payment_method_code = "cash"; //cash or online
 $customer_paid = false; // if true so the customer will not paid at the delivery

/** var array $result */
$result = $smartLivraison->merchantCreateTask(
                            $merchant_id,
                            $pickup,
                            $delivery,
                            $delivery_service_username,
                            $customer_payment_method_code, 
                            $customer_paid,
                            $merchant_notification_url
                        );