Difference between revisions of "AOTG API: Create AR Invoice"

Jump to navigation Jump to search
 
(9 intermediate revisions by the same user not shown)
url = "http://aotg.cloud:8080/api/public/v1/ARInvoice/CreateARInvoice"
 
payload = "{\r\n \"DebtorCode\": \"300-A001\",\r\n \"Description\": \"AOTG IMPORT TEST A\",\r\n \"DocDate\": \"01-01-2019\",\r\n \"DocNo\": \"AOTG007\",\r\n \"JournalType\": \"SALES\",\r\n \"RefNo2\": \"AOTG Web API\",\r\n \"InclusiveTax\": true,\r\n \"Agent\": \"TOM\",\r\n \"CreditTerm\": \"Net 30 days\",\r\n \"CurrencyCode\": \"MYR\",\r\n \"DetailsLine\": [\r\n {\r\n \"LineState\": 01,\r\n \"AccNo\": \"500-0000\",\r\n \"Description\": \"AOTG Sales Detail 1\",\r\n \"Tax\": \"S-10\",\r\n \"Amount\": 350\r\n },\r\n {\r\n \"LineState\": 1,\r\n \"AccNo\": \"500-0000\",\r\n \"Description\": \"AOTG Sales Detail 2\",\r\n \"Tax\": \"S-10\",\r\n \"Amount\": 5\r\n }\r\n ]\r\n}"
headers = {
'SOTC_AUTH': "SAMc13a36d2-a139-e911-b8b3-000d3aa04f3d",
"DetailsLine": [
{
"LineState": 01,
"AccNo": "500-0000",
"Description": "AOTG Sales Detail 1",
request.AddHeader("Content-Type", "application/json");
request.AddHeader("SOTC_AUTH", "SAMc13a36d2-a139-e911-b8b3-000d3aa04f3d");
request.AddParameter("undefined", "{\r\n \"DebtorCode\": \"300-A001\",\r\n \"Description\": \"AOTG IMPORT TEST A\",\r\n \"DocDate\": \"01-01-2019\",\r\n \"DocNo\": \"AOTG007\",\r\n \"JournalType\": \"SALES\",\r\n \"RefNo2\": \"AOTG Web API\",\r\n \"InclusiveTax\": true,\r\n \"Agent\": \"TOM\",\r\n \"CreditTerm\": \"Net 30 days\",\r\n \"CurrencyCode\": \"MYR\",\r\n \"DetailsLine\": [\r\n {\r\n \"LineState\": 01,\r\n \"AccNo\": \"500-0000\",\r\n \"Description\": \"AOTG Sales Detail 1\",\r\n \"Tax\": \"S-10\",\r\n \"Amount\": 350\r\n },\r\n {\r\n \"LineState\": 1,\r\n \"AccNo\": \"500-0000\",\r\n \"Description\": \"AOTG Sales Detail 2\",\r\n \"Tax\": \"S-10\",\r\n \"Amount\": 5\r\n }\r\n ]\r\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
</syntaxhighlight>
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "{\r\n \"DebtorCode\": \"300-A001\",\r\n \"Description\": \"AOTG IMPORT TEST A\",\r\n \"DocDate\": \"01-01-2019\",\r\n \"DocNo\": \"AOTG007\",\r\n \"JournalType\": \"SALES\",\r\n \"RefNo2\": \"AOTG Web API\",\r\n \"InclusiveTax\": true,\r\n \"Agent\": \"TOM\",\r\n \"CreditTerm\": \"Net 30 days\",\r\n \"CurrencyCode\": \"MYR\",\r\n \"DetailsLine\": [\r\n {\r\n \"LineState\": 01,\r\n \"AccNo\": \"500-0000\",\r\n \"Description\": \"AOTG Sales Detail 1\",\r\n \"Tax\": \"S-10\",\r\n \"Amount\": 350\r\n },\r\n {\r\n \"LineState\": 1,\r\n \"AccNo\": \"500-0000\",\r\n \"Description\": \"AOTG Sales Detail 2\",\r\n \"Tax\": \"S-10\",\r\n \"Amount\": 5\r\n }\r\n ]\r\n}",
CURLOPT_HTTPHEADER => array(
"Content-Type: application/json",
 
<br/>
 
==Get Status of the Create Debtor==
===Code Snippets===
}}
 
====Response Status====
{{AOTGResponseStatus|"def14c1a-cdb5-4aa4-834d-0b9c1faa1532"}}
200 OK
=====Completed status=====
*'''Completed''' status Indicates that the Create AR Invoice request has been performed and succeeded.
<syntaxhighlight lang="json-object">
{
"RequestId": "def14c1a-cdb5-4aa4-834d-0b9c1faa1532",
"Status": "Completed"
}
</syntaxhighlight>
=====Failed status=====
*'''Failed''' status Indicates that the Create AR Invoice request has been performed but has error.
<syntaxhighlight lang="json-object">
{
"RequestId": "def14c1a-cdb5-4aa4-834d-0b9c1faa1532",
"Status": "Failed"
}
</syntaxhighlight>
 
<br/>
 
==Use RESULT method to get the failed reason of Create Debtor request==
===Code Snippets===
<syntaxhighlight lang="json-object">
{
"RequestId": "252daceedef14c1a-59ddcdb5-4ac14aa4-85eb834d-450fc71ef78d0b9c1faa1532",
"RequestName": "CreateARInvoice",
"HostName": "---",
<syntaxhighlight lang="json-object">
{
"RequestId": "e7600918def14c1a-8d9bcdb5-47084aa4-9513834d-c510601efa140b9c1faa1532",
"RequestName": "CreateARInvoice",
"HostName": "---",
</syntaxhighlight>
</tabber>
 
=====Unknown Sql Exception...=====
'''Unknonw Sql Exception''' is a general sql error. Therefore, the solution can be varied.<br/>
<syntaxhighlight lang="json-object">
{
"RequestId": "ffd14c1adef14c1a-cdb5-4aa4-834d-0b9c0fea1e500b9c1faa1532",
"RequestName": "CreateARInvoice",
"HostName": "---",
"StackTrace": " at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)rn at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)rn at PSW.SOTC.Accounting.InProcess.AppServiceDispatcher.<DispatchRequest>d__13.MoveNext()",
"Source": "BCE.Utils"
}
</syntaxhighlight>
</tabber>
 
====Result of Successful and Completed====
*'''Id''' in the master data of AR Invoice can be used to retrieve and delete of this AR Invoice.
*:Click ''Readable of ResultJson'' to see the highlight of '''Id'''
*:See [[AOTG API: Get AR Invoice]] to get AR Invoice with '''Id'''
<tabber>
Body=
<syntaxhighlight lang="json-object">
{
"RequestId": "def14c1a-cdb5-4aa4-834d-0b9c1faa1532",
"RequestName": "CreateARInvoice",
"HostName": "---",
"IPAddress": "---",
"RequestTypeName": "ARInvoice",
"ResultJson": "{\"DebtorCode\":\"300-A001\",\"CompanyName\":\"ABC CUSTOMER\",\"Description\":\"AOTG IMPORT TEST A\",\"DocDate\":\"2019-03-03T00:00:00\",\"JournalType\":\"SALES\",\"DueDate\":\"2019-04-02T00:00:00\",\"DocNo\":\"I-000046\",\"LocalAmount\":0.00,\"TaxableAmount\":322.73,\"OutstandingAmount\":355.00,\"CurrencyCode\":\"MYR\",\"Agent\":\"TOM\",\"SourceType\":\"\",\"SourceKey\":\"\",\"CurrencyRate\":1.000000000000,\"Id\":\"1455\",\"RefNo2\":\"AOTG Web API\",\"CreditTerm\":\"Net 30 days\",\"InclusiveTax\":true,\"Note\":\"\",\"Total\":0.0,\"Amount\":355.00,\"TaxAmount\":32.27,\"DetailsLine\":[{\"Id\":\"1456\",\"LineState\":0,\"AccNo\":\"500-0000\",\"Description\":\"AOTG Sales Detail 1\",\"Project\":\"\",\"Dept\":\"\",\"Tax\":\"S-10\",\"Amount\":350.00,\"TaxRate\":10.000000,\"TaxAmount\":31.82,\"TaxAdjustment\":0.00,\"LocalTaxAdjustment\":0.0,\"SubTotal\":318.18,\"TaxableAmount\":350.00,\"LocalTaxAmount\":31.82,\"LocalSubTotal\":318.18,\"ToAccountRate\":1.000000000000,\"LocalTaxableAmount\":350.00,\"NetAmount\":350.00,\"LocalNetAmount\":350.00},{\"Id\":\"1457\",\"LineState\":0,\"AccNo\":\"500-0000\",\"Description\":\"AOTG Sales Detail 2\",\"Project\":\"\",\"Dept\":\"\",\"Tax\":\"S-10\",\"Amount\":5.00,\"TaxRate\":10.000000,\"TaxAmount\":0.45,\"TaxAdjustment\":0.00,\"LocalTaxAdjustment\":0.0,\"SubTotal\":4.55,\"TaxableAmount\":5.00,\"LocalTaxAmount\":0.45,\"LocalSubTotal\":4.55,\"ToAccountRate\":1.000000000000,\"LocalTaxableAmount\":5.00,\"NetAmount\":5.00,\"LocalNetAmount\":5.00}]}",
"RequestParamJson": null,
"ResultStream": null,
"ResultTypeName": "PSW.SOTC.Accounting.Provider.Models.ARInvoiceEntity",
"Status": "Completed",
"Version": "1.2.19051.12002",
"AccountBookInfo": "Plug-In 1.9 Test;1.0.9.77",
"AccountBookDBInfo": "1.0.9.77",
"Timestamp": "2019-03-05T00:35:51.2088399Z",
"ResultedTimestamp": "2019-03-05T00:35:51.2992057Z",
"ProcessingInterval": 0.922091,
"InQueueInterval": 1.7717965999999998,
"ResultFileURL": null
}
</syntaxhighlight>
|-|
Readable of ResultJson=
<syntaxhighlight lang="json-object" highlight="17">
{
"DebtorCode": "300-A001",
"CompanyName": "ABC CUSTOMER",
"Description": "AOTG IMPORT TEST A",
"DocDate": "2019-03-03T00:00:00",
"JournalType": "SALES",
"DueDate": "2019-04-02T00:00:00",
"DocNo": "I-000046",
"LocalAmount": 0,
"TaxableAmount": 322.73,
"OutstandingAmount": 355,
"CurrencyCode": "MYR",
"Agent": "TOM",
"SourceType": "",
"SourceKey": "",
"CurrencyRate": 1,
"Id": "1455",
"RefNo2": "AOTG Web API",
"CreditTerm": "Net 30 days",
"InclusiveTax": true,
"Note": "",
"Total": 0,
"Amount": 355,
"TaxAmount": 32.27,
"DetailsLine": [
{
"Id": "1456",
"LineState": 0,
"AccNo": "500-0000",
"Description": "AOTG Sales Detail 1",
"Project": "",
"Dept": "",
"Tax": "S-10",
"Amount": 350,
"TaxRate": 10,
"TaxAmount": 31.82,
"TaxAdjustment": 0,
"LocalTaxAdjustment": 0,
"SubTotal": 318.18,
"TaxableAmount": 350,
"LocalTaxAmount": 31.82,
"LocalSubTotal": 318.18,
"ToAccountRate": 1,
"LocalTaxableAmount": 350,
"NetAmount": 350,
"LocalNetAmount": 350
},
{
"Id": "1457",
"LineState": 0,
"AccNo": "500-0000",
"Description": "AOTG Sales Detail 2",
"Project": "",
"Dept": "",
"Tax": "S-10",
"Amount": 5,
"TaxRate": 10,
"TaxAmount": 0.45,
"TaxAdjustment": 0,
"LocalTaxAdjustment": 0,
"SubTotal": 4.55,
"TaxableAmount": 5,
"LocalTaxAmount": 0.45,
"LocalSubTotal": 4.55,
"ToAccountRate": 1,
"LocalTaxableAmount": 5,
"NetAmount": 5,
"LocalNetAmount": 5
}
]
}
</syntaxhighlight>
Cookies help us deliver our services. By using our services, you agree to our use of cookies.

Navigation menu