1. Go to this page and download the library: Download firebed/aade-mydata 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/ */
firebed / aade-mydata example snippets
$env = "dev"; // For production use "prod"
$user_id = "your-user-id";
$subscription_key = "your-subscription-key";
MyDataRequest::setEnvironment($env);
MyDataRequest::setCredentials($user_id, $subscription_key);
MyDataRequest::verifyClient(false);
use Firebed\AadeMyData\Http\SendInvoices;
use Firebed\AadeMyData\Models\Invoice;
use Firebed\AadeMyData\Exceptions\MyDataException;
// Prepare your invoices, for simplicity we will use an array of empty
// Invoice objects. You should populate these objects with your own data.
$invoices = [new Invoice(), new Invoice()];
$sender = new SendInvoices();
try {
$responses = $sender->handle($invoices);
$errors = [];
foreach ($responses as $response) {
if ($response->isSuccessful()) {
// This invoice was successfully sent to myDATA.
// Each response has an index value which corresponds
// to the index (-1) of the $invoices array.
$index = $response->getIndex();
$uid = $response->getInvoiceUid();
$mark = $response->getInvoiceMark();
$cancelledByMark = $response->getCancellationMark();
$qrUrl = $response->getQrUrl();
// If you need to relate the response to your local invoice
// $invoice = $invoices[$index - 1];
print_r(compact('index', 'uid', 'mark', 'cancelledByMark', 'qrUrl'));
} else {
// There were some errors for a specific invoice. See errors for details.
foreach ($response->getErrors() as $error) {
$errors[$response->getIndex() - 1][] = $error->getCode() . ': ' . $error->getMessage();
}
}
}
} catch (MyDataException $e) {
// There was a communication error. None of the invoices were sent.
echo "Σφάλμα επικοινωνίας: " . $e->getMessage();
}
use Firebed\AadeMyData\Http\DigitalGoodsMovement\RegisterTransfer;
use Firebed\AadeMyData\Models\DigitalGoodsMovement\Transport;
use Firebed\AadeMyData\Models\DigitalGoodsMovement\TransportDetails;
use Firebed\AadeMyData\Models\DigitalGoodsMovement\Location;
use Firebed\AadeMyData\Enums\DigitalGoodsMovement\TransportType;
$details = new TransportDetails();
$details->setVehicleNumber('AHN0011');
$details->setTransportType(TransportType::PRIVATE_USE_TRUCK);
$details->setCarrierVatNumber('777777777');
$details->setLocation(new Location(41.303921, -81.901693));
$transport = new Transport();
$transport->setMark(900001234567890);
$transport->setTransportDetails($details);
$request = new RegisterTransfer();
$response = $request->handle($transport);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.