@@ -116,6 +116,284 @@ public function getConfig()
116116 return $ this ->config ;
117117 }
118118
119+ /**
120+ * Operation getSuggestedTopUpAmount
121+ *
122+ * Get suggested top up amount
123+ *
124+ *
125+ * @throws \Openprovider\Api\Rest\Client\Billing\ApiException on non-2xx response or if the response body is not in the expected format
126+ * @throws \InvalidArgumentException
127+ * @return \Openprovider\Api\Rest\Client\Billing\Model\PaymentGetSuggestedTopUpAmountResponse|\Openprovider\Api\Rest\Client\Billing\Model\ErrorError
128+ */
129+ public function getSuggestedTopUpAmount ()
130+ {
131+ list ($ response ) = $ this ->getSuggestedTopUpAmountWithHttpInfo ();
132+ return $ response ;
133+ }
134+
135+ /**
136+ * Operation getSuggestedTopUpAmountWithHttpInfo
137+ *
138+ * Get suggested top up amount
139+ *
140+ *
141+ * @throws Openprovider\Api\Rest\Client\Base\ApiException; on non-2xx response
142+ * @throws \InvalidArgumentException
143+ * @return array of \Openprovider\Api\Rest\Client\Billing\Model\PaymentGetSuggestedTopUpAmountResponse|\Openprovider\Api\Rest\Client\Billing\Model\ErrorError, HTTP status code, HTTP response headers (array of strings)
144+ */
145+ public function getSuggestedTopUpAmountWithHttpInfo ()
146+ {
147+ $ request = $ this ->getSuggestedTopUpAmountRequest ();
148+
149+ try {
150+ $ options = $ this ->createHttpClientOption ();
151+ try {
152+ $ response = $ this ->client ->send ($ request , $ options );
153+ } catch (RequestException $ e ) {
154+ throw new ApiException (
155+ "[ {$ e ->getCode ()}] {$ e ->getMessage ()}" ,
156+ $ e ->getCode (),
157+ $ e ->getResponse () ? $ e ->getResponse ()->getHeaders () : null ,
158+ $ e ->getResponse () ? $ e ->getResponse ()->getBody ()->getContents () : null
159+ );
160+ }
161+
162+ $ statusCode = $ response ->getStatusCode ();
163+
164+ if ($ statusCode < 200 || $ statusCode > 299 ) {
165+ throw new ApiException (
166+ sprintf (
167+ '[%d] Error connecting to the API (%s) ' ,
168+ $ statusCode ,
169+ $ request ->getUri ()
170+ ),
171+ $ statusCode ,
172+ $ response ->getHeaders (),
173+ $ response ->getBody ()
174+ );
175+ }
176+
177+ $ responseBody = $ response ->getBody ();
178+ switch ($ statusCode ) {
179+ case 200 :
180+ if ('\Openprovider\Api\Rest\Client\Billing\Model\PaymentGetSuggestedTopUpAmountResponse ' === '\SplFileObject ' ) {
181+ $ content = $ responseBody ; //stream goes to serializer
182+ } else {
183+ $ content = $ responseBody ->getContents ();
184+ }
185+
186+ return [
187+ ObjectSerializer::deserialize ($ content , '\Openprovider\Api\Rest\Client\Billing\Model\PaymentGetSuggestedTopUpAmountResponse ' , []),
188+ $ response ->getStatusCode (),
189+ $ response ->getHeaders ()
190+ ];
191+ default :
192+ if ('\Openprovider\Api\Rest\Client\Billing\Model\ErrorError ' === '\SplFileObject ' ) {
193+ $ content = $ responseBody ; //stream goes to serializer
194+ } else {
195+ $ content = $ responseBody ->getContents ();
196+ }
197+
198+ return [
199+ ObjectSerializer::deserialize ($ content , '\Openprovider\Api\Rest\Client\Billing\Model\ErrorError ' , []),
200+ $ response ->getStatusCode (),
201+ $ response ->getHeaders ()
202+ ];
203+ }
204+
205+ $ returnType = '\Openprovider\Api\Rest\Client\Billing\Model\PaymentGetSuggestedTopUpAmountResponse ' ;
206+ $ responseBody = $ response ->getBody ();
207+ if ($ returnType === '\SplFileObject ' ) {
208+ $ content = $ responseBody ; //stream goes to serializer
209+ } else {
210+ $ content = $ responseBody ->getContents ();
211+ }
212+
213+ return [
214+ ObjectSerializer::deserialize ($ content , $ returnType , []),
215+ $ response ->getStatusCode (),
216+ $ response ->getHeaders ()
217+ ];
218+
219+ } catch (ApiException $ e ) {
220+ switch ($ e ->getCode ()) {
221+ case 200 :
222+ $ data = ObjectSerializer::deserialize (
223+ $ e ->getResponseBody (),
224+ '\Openprovider\Api\Rest\Client\Billing\Model\PaymentGetSuggestedTopUpAmountResponse ' ,
225+ $ e ->getResponseHeaders ()
226+ );
227+ $ e ->setResponseObject ($ data );
228+ break ;
229+ default :
230+ $ data = ObjectSerializer::deserialize (
231+ $ e ->getResponseBody (),
232+ '\Openprovider\Api\Rest\Client\Billing\Model\ErrorError ' ,
233+ $ e ->getResponseHeaders ()
234+ );
235+ $ e ->setResponseObject ($ data );
236+ break ;
237+ }
238+ throw $ e ;
239+ }
240+ }
241+
242+ /**
243+ * Operation getSuggestedTopUpAmountAsync
244+ *
245+ * Get suggested top up amount
246+ *
247+ *
248+ * @throws \InvalidArgumentException
249+ * @return \GuzzleHttp\Promise\PromiseInterface
250+ */
251+ public function getSuggestedTopUpAmountAsync ()
252+ {
253+ return $ this ->getSuggestedTopUpAmountAsyncWithHttpInfo ()
254+ ->then (
255+ function ($ response ) {
256+ return $ response [0 ];
257+ }
258+ );
259+ }
260+
261+ /**
262+ * Operation getSuggestedTopUpAmountAsyncWithHttpInfo
263+ *
264+ * Get suggested top up amount
265+ *
266+ *
267+ * @throws \InvalidArgumentException
268+ * @return \GuzzleHttp\Promise\PromiseInterface
269+ */
270+ public function getSuggestedTopUpAmountAsyncWithHttpInfo ()
271+ {
272+ $ returnType = '\Openprovider\Api\Rest\Client\Billing\Model\PaymentGetSuggestedTopUpAmountResponse ' ;
273+ $ request = $ this ->getSuggestedTopUpAmountRequest ();
274+
275+ return $ this ->client
276+ ->sendAsync ($ request , $ this ->createHttpClientOption ())
277+ ->then (
278+ function ($ response ) use ($ returnType ) {
279+ $ responseBody = $ response ->getBody ();
280+ if ($ returnType === '\SplFileObject ' ) {
281+ $ content = $ responseBody ; //stream goes to serializer
282+ } else {
283+ $ content = $ responseBody ->getContents ();
284+ }
285+
286+ return [
287+ ObjectSerializer::deserialize ($ content , $ returnType , []),
288+ $ response ->getStatusCode (),
289+ $ response ->getHeaders ()
290+ ];
291+ },
292+ function ($ exception ) {
293+ $ response = $ exception ->getResponse ();
294+ $ statusCode = $ response ->getStatusCode ();
295+ throw new ApiException (
296+ sprintf (
297+ '[%d] Error connecting to the API (%s) ' ,
298+ $ statusCode ,
299+ $ exception ->getRequest ()->getUri ()
300+ ),
301+ $ statusCode ,
302+ $ response ->getHeaders (),
303+ $ response ->getBody ()
304+ );
305+ }
306+ );
307+ }
308+
309+ /**
310+ * Create request for operation 'getSuggestedTopUpAmount'
311+ *
312+ *
313+ * @throws \InvalidArgumentException
314+ * @return \GuzzleHttp\Psr7\Request
315+ */
316+ protected function getSuggestedTopUpAmountRequest ()
317+ {
318+
319+ $ resourcePath = '/v1beta/payments/suggested-top-up-amount ' ;
320+ $ formParams = [];
321+ $ queryParams = [];
322+ $ headerParams = [];
323+ $ httpBody = '' ;
324+ $ multipart = false ;
325+
326+
327+
328+ // body params
329+ $ _tempBody = null ;
330+
331+ if ($ multipart ) {
332+ $ headers = $ this ->headerSelector ->selectHeadersForMultipart (
333+ ['application/json ' ]
334+ );
335+ } else {
336+ $ headers = $ this ->headerSelector ->selectHeaders (
337+ ['application/json ' ],
338+ []
339+ );
340+ }
341+
342+ // for model (json/xml)
343+ if (isset ($ _tempBody )) {
344+ // $_tempBody is the method argument, if present
345+ if ($ headers ['Content-Type ' ] === 'application/json ' ) {
346+ $ httpBody = \GuzzleHttp \json_encode (ObjectSerializer::sanitizeForSerialization ($ _tempBody ));
347+ } else {
348+ $ httpBody = $ _tempBody ;
349+ }
350+ } elseif (count ($ formParams ) > 0 ) {
351+ if ($ multipart ) {
352+ $ multipartContents = [];
353+ foreach ($ formParams as $ formParamName => $ formParamValue ) {
354+ $ multipartContents [] = [
355+ 'name ' => $ formParamName ,
356+ 'contents ' => $ formParamValue
357+ ];
358+ }
359+ // for HTTP post (form)
360+ $ httpBody = new MultipartStream ($ multipartContents );
361+
362+ } elseif ($ headers ['Content-Type ' ] === 'application/json ' ) {
363+ $ httpBody = \GuzzleHttp \json_encode ($ formParams );
364+
365+ } else {
366+ // for HTTP post (form)
367+ $ httpBody = Query::build ($ formParams );
368+ }
369+ }
370+
371+ // this endpoint requires API key authentication
372+ $ apiKey = $ this ->config ->getApiKeyWithPrefix ('Authorization ' );
373+ if ($ apiKey !== null ) {
374+ $ headers ['Authorization ' ] = $ apiKey ;
375+ }
376+
377+ $ defaultHeaders = [];
378+ if ($ this ->config ->getUserAgent ()) {
379+ $ defaultHeaders ['User-Agent ' ] = $ this ->config ->getUserAgent ();
380+ }
381+
382+ $ headers = array_merge (
383+ $ defaultHeaders ,
384+ $ headerParams ,
385+ $ headers
386+ );
387+
388+ $ query = Query::build ($ queryParams );
389+ return new Request (
390+ 'GET ' ,
391+ $ this ->config ->getHost () . $ resourcePath . ($ query ? "? {$ query }" : '' ),
392+ $ headers ,
393+ $ httpBody
394+ );
395+ }
396+
119397 /**
120398 * Operation listPayments
121399 *
0 commit comments