1818
1919class GoPayClient
2020{
21- public const RESPONSE_STATUS_CODE_OK = 200 ;
21+ protected const int RESPONSE_STATUS_CODE_OK = 200 ;
2222
2323 protected GoPay $ goPay ;
2424
@@ -56,9 +56,9 @@ protected function sendApiRequest(
5656 if ($ token ->token ) {
5757 return $ this ->goPay ->call (
5858 $ urlPath ,
59- $ contentType ,
6059 'Bearer ' . $ token ->token ,
6160 $ method ,
61+ $ contentType ,
6262 $ data ,
6363 );
6464 }
@@ -98,11 +98,11 @@ public function getStatus(string $id): Response
9898
9999 $ response = $ this ->sendApiRequest ($ urlPath , GoPay::FORM , RequestMethods::GET );
100100
101- if ((int )$ response ->statusCode !== ( int ) self ::RESPONSE_STATUS_CODE_OK ) {
101+ if ((int )$ response ->statusCode !== self ::RESPONSE_STATUS_CODE_OK ) {
102102 throw new GoPayPaymentDownloadException (
103103 $ this ->goPay ->buildUrl ($ urlPath ),
104104 RequestMethods::GET ,
105- self ::RESPONSE_STATUS_CODE_OK ,
105+ static ::RESPONSE_STATUS_CODE_OK ,
106106 null ,
107107 $ response ,
108108 );
@@ -130,11 +130,11 @@ public function refundTransaction(string $id, int $amount): Response
130130 $ body ,
131131 );
132132
133- if ((int )$ response ->statusCode !== ( int ) self ::RESPONSE_STATUS_CODE_OK ) {
133+ if ((int )$ response ->statusCode !== self ::RESPONSE_STATUS_CODE_OK ) {
134134 throw new GoPayPaymentDownloadException (
135135 $ this ->goPay ->buildUrl ($ urlPath ),
136136 RequestMethods::POST ,
137- self ::RESPONSE_STATUS_CODE_OK ,
137+ static ::RESPONSE_STATUS_CODE_OK ,
138138 $ body ,
139139 $ response ,
140140 );
@@ -157,17 +157,17 @@ public function downloadGoPayPaymentMethodsByCurrency(Currency $currency): array
157157 RequestMethods::GET ,
158158 );
159159
160- if ((int )$ response ->statusCode !== ( int ) self ::RESPONSE_STATUS_CODE_OK ) {
160+ if ((int )$ response ->statusCode !== self ::RESPONSE_STATUS_CODE_OK ) {
161161 throw new GoPayPaymentDownloadException (
162162 $ this ->goPay ->buildUrl ($ urlPath ),
163163 RequestMethods::GET ,
164- self ::RESPONSE_STATUS_CODE_OK ,
164+ static ::RESPONSE_STATUS_CODE_OK ,
165165 null ,
166166 $ response ,
167167 );
168168 }
169169
170- return $ response ->json ['enabledPaymentInstruments ' ];
170+ return $ response ->json ['enabledPaymentInstruments ' ] ?? [] ;
171171 }
172172
173173 /**
0 commit comments