Answer the question
In order to leave comments, you need to log in
How to send response to accepted post from another server?
All the best! tell me, the point is that I receive data from the bank in the form of xml parsed took what I need, and now I need to send the same xml to the bank with a purchase order, I know how to do it manually)) by pressing a button)) but I need to somehow immediately in the same controller where i receive the xml from the bank send them a response, here is the controller
public function offpaysuccess(Request $request){
if(isset($request->input('response'))){
$response = simplexml_load_string($request->input('response'));
$order_id = $response[0]->bank[0]->customer[0]->merchant[0]->order['order_id'];
$reference = $response[0]->bank[0]->results[0]->payment['reference'];
$approval_code = $response[0]->bank[0]->results[0]->payment['approval_code'];
$amount = $response[0]->bank[0]->results[0]->payment['amount'];
Offmkpays::where('offmkpay_code_tranzaction','=',$order_id)->update(['offmkpay_paysuccess'=>true]);
$payMkCours = Offmkpays::where()->first();
$userEmail = $payMkCours->offmkpay_user_email;
$userName = $payMkCours->offmkpay_user_name;
Mail::send('rus.mail.paymksuccess', ['payMkCours' => $payMkCours], function($message) use ($userName,$userEmail){
$message->to($userEmail, $userName)->subject('Успешная запись!');
});
//ПЫТАЮСЬ ОТПРАВИТЬ ОТВЕТ)) <--------------------------------------------------------------------------------
$apruve = '<document><merchant id="93745451">
<command type="complete"/>
<payment reference="'.$reference.'" approval_code="'.$approval_code.'" orderid="'.$order_id.'" amount="'.$amount.'" currency_code="398"/>
</merchant>
<merchant_sign type="RSA" cert_id="c233e074"></merchant_sign>
</document>';
$mainXML = base64_encode($apruve);
return Redirect::to('https://epay.kkb.kz/jsp/remote/control.jsp?'.$mainXML);
//return redirect('https://epay.kkb.kz/jsp/remote/control.jsp')->withInput($mainXML);
}
}
Answer the question
In order to leave comments, you need to log in
Redirect is performed by the GET method, but do you need a post? Either curl or via file_get_contents() . In the case of curl, the encode is not needed.
in case of a get request, change
Redirect::to('https://epay.kkb.kz/jsp/remote/control.jsp?'.$mainXML);
on the$response = file_get_contents('https://epay.kkb.kz/jsp/remote/control.jsp?'.$mainXML);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question