<?php
$request = new HttpRequest();
$request->setUrl('http://aotg.cloud:8080/api/public/v1/ARInvoice/CreateARInvoice');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders(array(
'cache-control' => 'no-cache',
'Content-Type' => 'application/json',
'SOTC_AUTH' => 'SAMc13a36d2-a139-e911-b8b3-000d3aa04f3d'
));
$request->setBody('{
"DebtorCode": "300-A001",
"Description": "AOTG IMPORT TEST A",
"DocDate": "01-01-2019",
"DocNo": "AOTG007",
"JournalType": "SALES",
"RefNo2": "AOTG Web API",
"InclusiveTax": true,
"Agent": "TOM",
"CreditTerm": "Net 30 days",
"CurrencyCode": "MYR",
"DetailsLine": [
{
"LineState": 1,
"AccNo": "500-0000",
"Description": "AOTG Sales Detail 1",
"Tax": "S-10",
"Amount": 350
},
{
"LineState": 1,
"AccNo": "500-0000",
"Description": "AOTG Sales Detail 2",
"Tax": "S-10",
"Amount": 5
}
]
}');
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}