@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | * @param string $publicKeyId llave publica |
| 64 | 64 | * Requeridas. |
| 65 | 65 | */ |
| 66 | - public function __construct ($keyId,$publicKeyId) |
|
| 66 | + public function __construct($keyId, $publicKeyId) |
|
| 67 | 67 | { |
| 68 | 68 | |
| 69 | 69 | try { |
@@ -72,12 +72,12 @@ discard block |
||
| 72 | 72 | throw new InstapagoException('Los parámetros "keyId" y "publicKeyId" son requeridos para procesar la petición.'); |
| 73 | 73 | }elseif (empty($keyId)) { |
| 74 | 74 | throw new InstapagoException('El parámetro "keyId" es requerido para procesar la petición. '); |
| 75 | - }else{ |
|
| 75 | + } else { |
|
| 76 | 76 | $this->keyId = $keyId; |
| 77 | 77 | } |
| 78 | 78 | if (empty($publicKeyId)) { |
| 79 | 79 | throw new InstapagoException('El parámetro "publicKeyId" es requerido para procesar la petición.'); |
| 80 | - }else{ |
|
| 80 | + } else { |
|
| 81 | 81 | $this->publicKeyId = $publicKeyId; |
| 82 | 82 | } |
| 83 | 83 | |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | * Efectúa un pago con tarjeta de crédito, una vez procesado retornar una respuesta. |
| 95 | 95 | * https://github.com/abr4xas/php-instapago/blob/master/help/DOCUMENTACION.md#crear-un-pago |
| 96 | 96 | */ |
| 97 | - public function payment($Amount,$Description,$CardHolder,$CardHolderId,$CardNumber,$CVC,$ExpirationDate,$StatusId,$ip_addres) |
|
| 97 | + public function payment($Amount, $Description, $CardHolder, $CardHolderId, $CardNumber, $CVC, $ExpirationDate, $StatusId, $ip_addres) |
|
| 98 | 98 | { |
| 99 | 99 | try { |
| 100 | 100 | |
@@ -107,9 +107,9 @@ discard block |
||
| 107 | 107 | $this->CardHolder = $CardHolder; |
| 108 | 108 | $this->CardHolderId = $CardHolderId; |
| 109 | 109 | $this->CardNumber = $CardNumber; |
| 110 | - $this->CVC = $CVC; |
|
| 110 | + $this->CVC = $CVC; |
|
| 111 | 111 | $this->ExpirationDate = $ExpirationDate; |
| 112 | - $this->StatusId = $StatusId; |
|
| 112 | + $this->StatusId = $StatusId; |
|
| 113 | 113 | $this->ip_addres = $ip_addres; |
| 114 | 114 | |
| 115 | 115 | $url = $this->root . 'payment'; // endpoint |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | * https://github.com/abr4xas/php-instapago/blob/master/help/DOCUMENTACION.md#completar-pago |
| 152 | 152 | */ |
| 153 | 153 | |
| 154 | - public function continuePayment($Amount,$idpago) |
|
| 154 | + public function continuePayment($Amount, $idpago) |
|
| 155 | 155 | { |
| 156 | 156 | try { |
| 157 | 157 | |
@@ -243,10 +243,10 @@ discard block |
||
| 243 | 243 | $url = $this->root . 'payment'; // endpoint |
| 244 | 244 | |
| 245 | 245 | $ch = curl_init(); |
| 246 | - curl_setopt($ch, CURLOPT_URL, $url.'?'.'KeyID='. $this->keyId .'&PublicKeyId='. $this->publicKeyId .'&id=' . $this->idpago); |
|
| 246 | + curl_setopt($ch, CURLOPT_URL, $url . '?' . 'KeyID=' . $this->keyId . '&PublicKeyId=' . $this->publicKeyId . '&id=' . $this->idpago); |
|
| 247 | 247 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); |
| 248 | 248 | $server_output = curl_exec($ch); |
| 249 | - curl_close ($ch); |
|
| 249 | + curl_close($ch); |
|
| 250 | 250 | $obj = json_decode($server_output); |
| 251 | 251 | $result = $this->checkResponseCode($obj); |
| 252 | 252 | |
@@ -267,7 +267,7 @@ discard block |
||
| 267 | 267 | * https://github.com/abr4xas/php-instapago/blob/master/help/DOCUMENTACION.md#parámetros-opcionales-para-crear-el-pago |
| 268 | 268 | */ |
| 269 | 269 | |
| 270 | - public function fullPayment($Amount,$Description,$CardHolder,$CardHolderId,$CardNumber,$CVC,$ExpirationDate,$StatusId,$ip_addres,$order_number,$address,$city,$zip_code,$state) |
|
| 270 | + public function fullPayment($Amount, $Description, $CardHolder, $CardHolderId, $CardNumber, $CVC, $ExpirationDate, $StatusId, $ip_addres, $order_number, $address, $city, $zip_code, $state) |
|
| 271 | 271 | { |
| 272 | 272 | try { |
| 273 | 273 | |
@@ -337,12 +337,12 @@ discard block |
||
| 337 | 337 | public function curlTransaccion($url, $fields) |
| 338 | 338 | { |
| 339 | 339 | $ch = curl_init(); |
| 340 | - curl_setopt($ch, CURLOPT_URL,$url ); |
|
| 340 | + curl_setopt($ch, CURLOPT_URL, $url); |
|
| 341 | 341 | curl_setopt($ch, CURLOPT_POST, 1); |
| 342 | - curl_setopt($ch, CURLOPT_POSTFIELDS,http_build_query($fields)); |
|
| 342 | + curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($fields)); |
|
| 343 | 343 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); |
| 344 | - $server_output = curl_exec ($ch); |
|
| 345 | - curl_close ($ch); |
|
| 344 | + $server_output = curl_exec($ch); |
|
| 345 | + curl_close($ch); |
|
| 346 | 346 | $obj = json_decode($server_output); |
| 347 | 347 | return $obj; |
| 348 | 348 | } |
@@ -370,7 +370,7 @@ discard block |
||
| 370 | 370 | throw new InstapagoException('Ha Ocurrido un error al procesar los parámetros de entrada. Revise los datos enviados y vuelva a intentarlo.'); |
| 371 | 371 | }elseif ($code == 201) { |
| 372 | 372 | return [ |
| 373 | - 'code' => $code , |
|
| 373 | + 'code' => $code, |
|
| 374 | 374 | 'msg_banco' => $obj->message, |
| 375 | 375 | 'voucher' => html_entity_decode($obj->voucher), |
| 376 | 376 | 'id_pago' => $obj->id, |
@@ -70,14 +70,14 @@ discard block |
||
| 70 | 70 | |
| 71 | 71 | if (empty($keyId) && empty($publicKeyId)) { |
| 72 | 72 | throw new InstapagoException('Los parámetros "keyId" y "publicKeyId" son requeridos para procesar la petición.'); |
| 73 | - }elseif (empty($keyId)) { |
|
| 73 | + } elseif (empty($keyId)) { |
|
| 74 | 74 | throw new InstapagoException('El parámetro "keyId" es requerido para procesar la petición. '); |
| 75 | - }else{ |
|
| 75 | + } else{ |
|
| 76 | 76 | $this->keyId = $keyId; |
| 77 | 77 | } |
| 78 | 78 | if (empty($publicKeyId)) { |
| 79 | 79 | throw new InstapagoException('El parámetro "publicKeyId" es requerido para procesar la petición.'); |
| 80 | - }else{ |
|
| 80 | + } else{ |
|
| 81 | 81 | $this->publicKeyId = $publicKeyId; |
| 82 | 82 | } |
| 83 | 83 | |
@@ -360,15 +360,15 @@ discard block |
||
| 360 | 360 | |
| 361 | 361 | if ($code == 400) { |
| 362 | 362 | throw new InstapagoException('Error al validar los datos enviados.'); |
| 363 | - }elseif ($code == 401) { |
|
| 363 | + } elseif ($code == 401) { |
|
| 364 | 364 | throw new InstapagoException('Error de autenticación, ha ocurrido un error con las llaves utilizadas.'); |
| 365 | - }elseif ($code == 403) { |
|
| 365 | + } elseif ($code == 403) { |
|
| 366 | 366 | throw new InstapagoException('Pago Rechazado por el banco.'); |
| 367 | - }elseif ($code == 500) { |
|
| 367 | + } elseif ($code == 500) { |
|
| 368 | 368 | throw new InstapagoException('Ha Ocurrido un error interno dentro del servidor.'); |
| 369 | - }elseif ($code == 503) { |
|
| 369 | + } elseif ($code == 503) { |
|
| 370 | 370 | throw new InstapagoException('Ha Ocurrido un error al procesar los parámetros de entrada. Revise los datos enviados y vuelva a intentarlo.'); |
| 371 | - }elseif ($code == 201) { |
|
| 371 | + } elseif ($code == 201) { |
|
| 372 | 372 | return [ |
| 373 | 373 | 'code' => $code , |
| 374 | 374 | 'msg_banco' => $obj->message, |
@@ -31,7 +31,7 @@ |
||
| 31 | 31 | |
| 32 | 32 | spl_autoload_register(function($class) |
| 33 | 33 | { |
| 34 | - $file = dirname(__DIR__). DIRECTORY_SEPARATOR . str_replace('\\', DIRECTORY_SEPARATOR, $class) . '.php'; |
|
| 34 | + $file = dirname(__DIR__) . DIRECTORY_SEPARATOR . str_replace('\\', DIRECTORY_SEPARATOR, $class) . '.php'; |
|
| 35 | 35 | |
| 36 | 36 | return ( ! is_file($file)) ?: require $file; |
| 37 | 37 | }); |
| 38 | 38 | \ No newline at end of file |