PHP code example of adjemin / smartlivraison-php

1. Go to this page and download the library: Download adjemin/smartlivraison-php library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

adjemin / smartlivraison-php example snippets




$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
                        );

bash
composer