Untitled

 avatar
unknown
plain_text
5 months ago
1.9 kB
5
Indexable
$particulars = [];
//add to moses api
$endpointurl = config('app.myra_endpoint_url_moses_api');
$token = config('app.myra_auth_token_moses_api');
$paymentrequest = config('app.myra_endpoint_payment_request_moses_api');
$requestMoses['account_name'] = 'Placewell'; //Always "Placewell"
$requestMoses['ref_no'] = ''; //"Batch No." sa Print Preview ng Request na to. If wala blank/empty
$requestMoses['purpose'] = 'agent_commission'; //The Request Name
$requestMoses['due_date'] = ''; //Always "N/A", make it blank/empty
$requestMoses['kind'] = 'others'; //Always "others"
$requestMoses['posting_date'] = ''; //"Date Paid" sa Print Preview ng Request na to. If wala blank/empty
$requestMoses['amount'] = number_format('100',2); //"Total Amoung" sa Print Preview ng Request na to. If wala blank/empty
$requestMoses['issue_date'] = ''; //Always "N/A", make it blank/empty
$requestMoses['status'] = 'Approved'; //Always "Approved"
$requestMoses['payee_name'] = 'Payee'; //Always "Payee"
$requestMoses['currency'] = 'PHP'; //Always "PHP"
$requestMoses['source_id'] = 1; //ID if the request
$requestMoses['source'] = 'api'; //Always "api"
$requestMoses['metadata'] = '';
$requestMoses['particulars'] = $particulars;
/* API URL */
$url = $endpointurl.$paymentrequest;
/* Init cURL resource */
$ch = curl_init($url);
/* pass encoded JSON string to the POST fields */
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($requestMoses));
/* set the content type json */
$headers = [];
$headers[] = 'Content-Type:application/json';            
$headers[] = "Authorization: Bearer ".$token;
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
/* set return type json */
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
/* execute request */
$result = curl_exec($ch);
/* close cURL resource */
curl_close($ch);
return response(array('resultapi'=>$result,'requestMoses'=>$requestMoses))->header('Content-Type', 'application/json');
Editor is loading...
Leave a Comment