11<?php 
2- 
2+ namespace   MercadoPago \ Core \ Lib ; 
33/** 
44 * MercadoPago Integration Library 
55 * Access MercadoPago for payments integration 
99 */ 
1010
1111
12- class  MercadoPago_Core_Lib_Api  {
12+ class  Api  {
1313
1414    /** 
1515     * 
@@ -52,7 +52,7 @@ class MercadoPago_Core_Lib_Api {
5252
5353
5454    /** 
55-      * MercadoPago_Core_Lib_Api  constructor. 
55+      * \MercadoPago\Core\Lib\Api  constructor. 
5656     */ 
5757    public  function  __construct () {
5858        $ ifunc_num_args ();
@@ -98,10 +98,10 @@ public function get_access_token() {
9898            'grant_type '  => 'client_credentials ' 
9999        ));
100100
101-         $ access_dataMercadoPago_Core_Lib_RestClient ::post ("/oauth/token " , $ app_client_values"application/x-www-form-urlencoded " );
101+         $ access_data\ MercadoPago \ Core \ Lib \RestClient ::post ("/oauth/token " , $ app_client_values"application/x-www-form-urlencoded " );
102102
103103        if  ($ access_data"status " ] != 200 ) {
104-             throw  new  Exception  ($ access_data'response ' ]['message ' ], $ access_data'status ' ]);
104+             throw  new  \ Exception  ($ access_data'response ' ]['message ' ], $ access_data'status ' ]);
105105        }
106106
107107        $ this access_data  = $ access_data'response ' ];
@@ -119,7 +119,7 @@ public function get_payment($id) {
119119
120120        $ uri_prefix$ this sandbox  ? "/sandbox "  : "" ;
121121
122-         $ payment_infoMercadoPago_Core_Lib_RestClient ::get ($ uri_prefix"/collections/notifications/ "  . $ id"?access_token= "  . $ access_token
122+         $ payment_info\ MercadoPago \ Core \ Lib \RestClient ::get ($ uri_prefix"/collections/notifications/ "  . $ id"?access_token= "  . $ access_token
123123        return  $ payment_info
124124    }
125125
@@ -140,7 +140,7 @@ public function get_payment_info($id) {
140140    public  function  get_authorized_payment ($ id
141141        $ access_token$ this get_access_token ();
142142
143-         $ authorized_payment_infoMercadoPago_Core_Lib_RestClient ::get ("/authorized_payments/ "  . $ id"?access_token= "  . $ access_token
143+         $ authorized_payment_info\ MercadoPago \ Core \ Lib \RestClient ::get ("/authorized_payments/ "  . $ id"?access_token= "  . $ access_token
144144        return  $ authorized_payment_info
145145    }
146146
@@ -156,7 +156,7 @@ public function refund_payment($id) {
156156            "status "  => "refunded " 
157157        );
158158
159-         $ responseMercadoPago_Core_Lib_RestClient ::put ("/collections/ "  . $ id"?access_token= "  . $ access_token$ refund_status
159+         $ response\ MercadoPago \ Core \ Lib \RestClient ::put ("/collections/ "  . $ id"?access_token= "  . $ access_token$ refund_status
160160        return  $ response
161161    }
162162
@@ -172,7 +172,7 @@ public function cancel_payment($id) {
172172            "status "  => "cancelled " 
173173        );
174174
175-         $ responseMercadoPago_Core_Lib_RestClient ::put ("/collections/ "  . $ id"?access_token= "  . $ access_token$ cancel_status
175+         $ response\ MercadoPago \ Core \ Lib \RestClient ::put ("/collections/ "  . $ id"?access_token= "  . $ access_token$ cancel_status
176176        return  $ response
177177    }
178178
@@ -188,7 +188,7 @@ public function cancel_preapproval_payment($id) {
188188            "status "  => "cancelled " 
189189        );
190190
191-         $ responseMercadoPago_Core_Lib_RestClient ::put ("/preapproval/ "  . $ id"?access_token= "  . $ access_token$ cancel_status
191+         $ response\ MercadoPago \ Core \ Lib \RestClient ::put ("/preapproval/ "  . $ id"?access_token= "  . $ access_token$ cancel_status
192192        return  $ response
193193    }
194194
@@ -209,7 +209,7 @@ public function search_payment($filters, $offset = 0, $limit = 0) {
209209
210210        $ uri_prefix$ this sandbox  ? "/sandbox "  : "" ;
211211
212-         $ collection_resultMercadoPago_Core_Lib_RestClient ::get ($ uri_prefix"/collections/search? "  . $ filters"&access_token= "  . $ access_token
212+         $ collection_result\ MercadoPago \ Core \ Lib \RestClient ::get ($ uri_prefix"/collections/search? "  . $ filters"&access_token= "  . $ access_token
213213        return  $ collection_result
214214    }
215215
@@ -222,7 +222,7 @@ public function create_preference($preference) {
222222        $ access_token$ this get_access_token ();
223223
224224        $ extra_paramsarray ('platform:  '  . $ this _platform , 'so; ' , 'type:  '  .  $ this _type );
225-         $ preference_resultMercadoPago_Core_Lib_RestClient ::post ("/checkout/preferences?access_token= "  . $ access_token$ preference"application/json " , $ extra_params
225+         $ preference_result\ MercadoPago \ Core \ Lib \RestClient ::post ("/checkout/preferences?access_token= "  . $ access_token$ preference"application/json " , $ extra_params
226226        return  $ preference_result
227227    }
228228
@@ -235,7 +235,7 @@ public function create_preference($preference) {
235235    public  function  update_preference ($ id$ preference
236236        $ access_token$ this get_access_token ();
237237
238-         $ preference_resultMercadoPago_Core_Lib_RestClient ::put ("/checkout/preferences/ {$ id?access_token= "  . $ access_token$ preference
238+         $ preference_result\ MercadoPago \ Core \ Lib \RestClient ::put ("/checkout/preferences/ {$ id?access_token= "  . $ access_token$ preference
239239        return  $ preference_result
240240    }
241241
@@ -247,7 +247,7 @@ public function update_preference($id, $preference) {
247247    public  function  get_preference ($ id
248248        $ access_token$ this get_access_token ();
249249
250-         $ preference_resultMercadoPago_Core_Lib_RestClient ::get ("/checkout/preferences/ {$ id?access_token= "  . $ access_token
250+         $ preference_result\ MercadoPago \ Core \ Lib \RestClient ::get ("/checkout/preferences/ {$ id?access_token= "  . $ access_token
251251        return  $ preference_result
252252    }
253253
@@ -259,7 +259,7 @@ public function get_preference($id) {
259259    public  function  create_preapproval_payment ($ preapproval_payment
260260        $ access_token$ this get_access_token ();
261261
262-         $ preapproval_payment_resultMercadoPago_Core_Lib_RestClient ::post ("/preapproval?access_token= "  . $ access_token$ preapproval_payment
262+         $ preapproval_payment_result\ MercadoPago \ Core \ Lib \RestClient ::post ("/preapproval?access_token= "  . $ access_token$ preapproval_payment
263263        return  $ preapproval_payment_result
264264    }
265265
@@ -271,7 +271,7 @@ public function create_preapproval_payment($preapproval_payment) {
271271    public  function  get_preapproval_payment ($ id
272272        $ access_token$ this get_access_token ();
273273
274-         $ preapproval_payment_resultMercadoPago_Core_Lib_RestClient ::get ("/preapproval/ {$ id?access_token= "  . $ access_token
274+         $ preapproval_payment_result\ MercadoPago \ Core \ Lib \RestClient ::get ("/preapproval/ {$ id?access_token= "  . $ access_token
275275        return  $ preapproval_payment_result
276276    }
277277
@@ -284,7 +284,7 @@ public function get_preapproval_payment($id) {
284284    public  function  update_preapproval_payment ($ id$ preapproval_payment
285285        $ access_token$ this get_access_token ();
286286
287-         $ preapproval_payment_resultMercadoPago_Core_Lib_RestClient ::put ("/preapproval/ "  . $ id"?access_token= "  . $ access_token$ preapproval_payment
287+         $ preapproval_payment_result\ MercadoPago \ Core \ Lib \RestClient ::put ("/preapproval/ "  . $ id"?access_token= "  . $ access_token$ preapproval_payment
288288        return  $ preapproval_payment_result
289289    }
290290
@@ -296,7 +296,7 @@ public function update_preapproval_payment($id, $preapproval_payment) {
296296    public  function  create_custon_payment ($ info
297297        $ access_token$ this get_access_token ();
298298
299-         $ preference_resultMercadoPago_Core_Lib_RestClient ::post ("/checkout/custom/create_payment?access_token= "  . $ access_token$ info
299+         $ preference_result\ MercadoPago \ Core \ Lib \RestClient ::post ("/checkout/custom/create_payment?access_token= "  . $ access_token$ info
300300        return  $ preference_result
301301    }
302302
@@ -322,7 +322,7 @@ public function get($uri, $params = null, $authenticate = true) {
322322            $ uri$ this build_query ($ params
323323        }
324324
325-         $ resultMercadoPago_Core_Lib_RestClient ::get ($ uri
325+         $ result\ MercadoPago \ Core \ Lib \RestClient ::get ($ uri
326326        return  $ result
327327    }
328328
@@ -344,7 +344,7 @@ public function post($uri, $data, $params = null) {
344344        }
345345
346346        $ extra_paramsarray ('platform:  '  . $ this _platform , 'so; ' , 'type:  '  .  $ this _type );
347-         $ resultMercadoPago_Core_Lib_RestClient ::post ($ uri$ data"application/json " , $ extra_params
347+         $ result\ MercadoPago \ Core \ Lib \RestClient ::post ($ uri$ data"application/json " , $ extra_params
348348        return  $ result
349349    }
350350
@@ -365,7 +365,7 @@ public function put($uri, $data, $params = null) {
365365            $ uri$ this build_query ($ params
366366        }
367367
368-         $ resultMercadoPago_Core_Lib_RestClient ::put ($ uri$ data
368+         $ result\ MercadoPago \ Core \ Lib \RestClient ::put ($ uri$ data
369369        return  $ result
370370    }
371371
@@ -386,7 +386,7 @@ public function delete($uri, $params = null) {
386386            $ uri$ this build_query ($ params
387387        }
388388
389-         $ resultMercadoPago_Core_Lib_RestClient ::delete ($ uri
389+         $ result\ MercadoPago \ Core \ Lib \RestClient ::delete ($ uri
390390        return  $ result
391391    }
392392
0 commit comments