AOTG API: Payment Method Lookup: Difference between revisions

no edit summary
(Created page with "==Payment Method Lookup== Get a list of Payment Method in account book. *Payment method is used for selection of payment that is link to specific account. *Payment method is m...")
 
No edit summary
 
(One intermediate revision by the same user not shown)
Line 3:
*Payment method is used for selection of payment that is link to specific account.
*Payment method is maintained in ''General Maintenance | Payment Method Maintenance''.
{{AOTGApiMethodsSpec|GET|/api/public/v1/Lookup/PaymentMethodLookup|Params=None}}
<br/>
==Code Snippets==
*Add header of '''"SOTC_AUTH"''', and assign value of '''AccessToken'''.
<br/>
{{AOTGApiCodeSnippetTab
|Python=
<syntaxhighlight lang="Python">
import requests
 
url = "http://aotg.cloud:8080/api/public/v1/Lookup/PaymentMethodLookup"
 
payload = ""
headers = {
'SOTC_AUTH': "SAMs1a36d2-a139-e911-b8b3-000aa03t3d",
'Content-Type': "application/json",
'cache-control': "no-cache"
}
 
response = requests.request("GET", url, data=payload, headers=headers)
 
print(response.text)
</syntaxhighlight>
|PHPHttp=
<syntaxhighlight lang="PHP">
<?php
 
$request = new HttpRequest();
$request->setUrl('http://aotg.cloud:8080/api/public/v1/Lookup/PaymentMethodLookup');
$request->setMethod(HTTP_METH_GET);
 
$request->setHeaders(array(
'cache-control' => 'no-cache',
'Content-Type' => 'application/json',
'SOTC_AUTH' => 'SAMs1a36d2-a139-e911-b8b3-000aa03t3d'
));
 
try {
$response = $request->send();
 
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
</syntaxhighlight>
|RestSharp=
<syntaxhighlight lang="C#">
var client = new RestClient("http://aotg.cloud:8080/api/public/v1/Lookup/PaymentMethodLookup");
var request = new RestRequest(Method.GET);
request.AddHeader("cache-control", "no-cache");
request.AddHeader("Content-Type", "application/json");
request.AddHeader("SOTC_AUTH", "SAMs1a36d2-a139-e911-b8b3-000aa03t3d");
IRestResponse response = client.Execute(request);
</syntaxhighlight>
|PHPcURL=
<syntaxhighlight lang="PHP">
<?php
 
$curl = curl_init();
 
curl_setopt_array($curl, array(
CURLOPT_PORT => "8080",
CURLOPT_URL => "http://aotg.cloud:8080/api/public/v1/Lookup/PaymentMethodLookup",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_POSTFIELDS => "",
CURLOPT_HTTPHEADER => array(
"Content-Type: application/json",
"SOTC_AUTH: SAMs1a36d2-a139-e911-b8b3-000aa03t3d",
"cache-control: no-cache"
),
));
 
$response = curl_exec($curl);
$err = curl_error($curl);
 
curl_close($curl);
 
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
</syntaxhighlight>
}}
 
===Response===
====Response Successful HTTP Request====
200 OK
====Response Successful Body====
Sample data returns from '''PaymentMethodLookup'''.
<syntaxhighlight lang="json-object">
[
{
"DataStructureVersion": 2,
"Code": "CASH",
"Description": "",
"BankAccount": "320-0000",
"PaymentType": "Cash",
"IsActive": true,
"CurrencyCode": "MYR"
},
{
"DataStructureVersion": 2,
"Code": "CHQ",
"Description": "CHEQUE",
"BankAccount": "310-B001",
"PaymentType": "Cheque",
"IsActive": true,
"CurrencyCode": "MYR"
},
{
"DataStructureVersion": 2,
"Code": "BANK",
"Description": "CHEQUE",
"BankAccount": "310-B001",
"PaymentType": "Cheque",
"IsActive": true,
"CurrencyCode": "MYR"
}
]
</syntaxhighlight>