@@ -14,6 +14,11 @@ class VerifyPaymentRequest extends AbstractRequest
1414 */
1515 protected $ verifyEndPoint = 'epay/transrec ' ;
1616
17+ /**
18+ * @var string
19+ */
20+ protected $ userAgent = 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36 ' ;
21+
1722 /**
1823 * @return string
1924 */
@@ -27,20 +32,40 @@ public function getData()
2732 ];
2833 }
2934
35+ /**
36+ * @return string
37+ */
38+ public function getUserAgent ()
39+ {
40+ $ userAgent = $ this ->userAgent ;
41+
42+ if (isset ($ _SERVER ['HTTP_USER_AGENT ' ])) {
43+ $ userAgent = $ _SERVER ['HTTP_USER_AGENT ' ];
44+ }
45+
46+ return $ userAgent ;
47+ }
48+
3049 /**
3150 * @param $data
3251 *
33- * @return \Omnipay\Esewa\Message\OrderResponse
52+ * @return \Omnipay\Esewa\Message\VerifyPaymentResponse
3453 */
3554 public function sendData ($ data )
3655 {
37- $ endPoint = $ this ->getEndpoint ().'? ' .http_build_query ($ data );
56+ $ endPoint = $ this ->getEndpoint ();
57+
58+ $ headers = [
59+ 'User-Agent ' => $ this ->getUserAgent (),
60+ 'Accept ' => 'application/xml ' ,
61+ 'Content-Type ' => 'application/x-www-form-urlencoded; charset=utf-8 ' ,
62+ ];
3863
39- $ httpResponse = $ this ->httpClient ->request ('GET ' , $ endPoint );
64+ $ httpResponse = $ this ->httpClient ->request ('POST ' , $ endPoint, $ headers , http_build_query ( $ data ) );
4065
41- $ data = new SimpleXMLElement ($ httpResponse ->getBody ()->getContents ());
66+ $ content = new SimpleXMLElement ($ httpResponse ->getBody ()->getContents ());
4267
43- return $ this ->response = new VerifyPaymentResponse ($ this , $ data );
68+ return $ this ->response = new VerifyPaymentResponse ($ this , $ content );
4469 }
4570
4671 /**
0 commit comments