@@ -33,9 +33,9 @@ public function getData()
3333 {
3434 $ this ->validate ('amount ' , 'transactionReference ' );
3535
36- $ data = array () ;
36+ $ data = [] ;
3737
38- $ data ['Payment ' ] = array () ;
38+ $ data ['Payment ' ] = [] ;
3939 $ data ['Payment ' ]['TotalAmount ' ] = $ this ->getAmountInteger ();
4040 $ data ['Payment ' ]['InvoiceNumber ' ] = $ this ->getTransactionId ();
4141 $ data ['Payment ' ]['InvoiceDescription ' ] = $ this ->getDescription ();
@@ -49,20 +49,15 @@ public function getData()
4949
5050 public function getEndpoint ()
5151 {
52- return $ this ->getEndpointBase (). '/CapturePayment ' ;
52+ return $ this ->getEndpointBase () . '/CapturePayment ' ;
5353 }
5454
5555 public function sendData ($ data )
5656 {
57- // This request uses the REST endpoint and requires the JSON content type header
58- $ httpResponse = $ this ->httpClient ->post (
59- $ this ->getEndpoint (),
60- array ('content-type ' => 'application/json ' ),
61- json_encode ($ data )
62- )
63- ->setAuth ($ this ->getApiKey (), $ this ->getPassword ())
64- ->send ();
57+ $ httpResponse = $ this ->httpClient ->request ('POST ' , $ this ->getEndpoint (), [
58+ 'content-type ' => 'application/json ' ,
59+ ], json_encode ($ data ));
6560
66- return $ this ->response = new RapidResponse ($ this , $ httpResponse ->json ( ));
61+ return $ this ->response = new RapidResponse ($ this , json_decode (( string ) $ httpResponse ->getBody (), true ));
6762 }
6863}
0 commit comments