PHP code example of alsaloul / microtec
1. Go to this page and download the library: Download alsaloul/microtec 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/ */
alsaloul / microtec example snippets
use Alsaloul\Microtec\OrderData;
use Alsaloul\Microtec\Microtec;
$products = [
[
'id' => 122,
'name' => 'product name',
'itemPrice' => 100,
'qty' => 1,
'totalPrice' => 100,
]
];
$orderData = new OrderData(
1212,
'2024-08-20T12:12:01.310Z',
'Mohammed Alsaloul',
'+967774411357',
10,
15,
125,
$products
);
$response = Microtec::sendOrder($orderData);
return $response;
use Alsaloul\Microtec\Data\InvoiceOrdersData;
use Alsaloul\Microtec\Microtec;
$ordersData = [
new InvoiceOrdersData([
'id' => 1,
'date' => '2024-08-20T12:12:01.310Z',
'Mohammed Alsaloul',
'+967774411357',
'deliveryPrice' => 20,
'totalTax' => 5,
'totalPrice' => 105,
'totalDiscount' => 10,
'deliveryDiscount' => 5,
'isDeliveryTaxable' => true,
'referenceId' => 'INV12345',
'products' => [
[
'id' => 101,
'name' => 'Product 1',
'itemPrice' => 50,
'qty' => 2,
'totalPrice' => 100,
]
]
]),
// Add more InvoiceOrdersData objects as needed
];
$responses = Microtec::sendInvoiceOrders($ordersData);
return $responses;
use Alsaloul\Microtec\Data\ReturnOrdersData;
use Alsaloul\Microtec\Microtec;
$returnOrdersData = [
new ReturnOrdersData([
'id' => 2,
'date' => '2024-08-21T14:15:00.000Z',
'Mohammed Alsaloul',
'+967774411357',
'deliveryPrice' => 10,
'totalTax' => 2,
'totalPrice' => 50,
'totalDiscount' => 5,
'deliveryDiscount' => 2,
'isDeliveryTaxable' => false,
'referenceId' => 'RET67890',
'sourceIntegrationId' => 'SRC98765',
'products' => [
[
'id' => 102,
'name' => 'Returned Product',
'itemPrice' => 25,
'qty' => 2,
'totalPrice' => 50,
'sourceLineId' => 'SL123'
]
]
]),
// Add more ReturnOrdersData objects as needed
];
$responses = Microtec::sendReturnOrders($returnOrdersData);
return $responses;
bash
php artisan vendor:publish --provider="Alsaloul\Microtec\MicrotecServiceProvider"