|
@@ 170-193 (lines=24) @@
|
| 167 |
|
* Este método funciona para procesar una anulación de un pago o un bloqueo. |
| 168 |
|
* https://github.com/abr4xas/php-instapago/blob/master/help/DOCUMENTACION.md#anular-pago. |
| 169 |
|
*/ |
| 170 |
|
public function cancelPayment($idPago) |
| 171 |
|
{ |
| 172 |
|
try { |
| 173 |
|
$params = [$idPago]; |
| 174 |
|
$this->checkRequiredParams($params); |
| 175 |
|
|
| 176 |
|
$this->idPago = $idPago; |
| 177 |
|
|
| 178 |
|
$url = 'payment'; // endpoint |
| 179 |
|
|
| 180 |
|
$fields = [ |
| 181 |
|
'KeyID' => $this->keyId, //required |
| 182 |
|
'PublicKeyId' => $this->publicKeyId, //required |
| 183 |
|
'Id' => $this->idPago, //required |
| 184 |
|
]; |
| 185 |
|
$obj = $this->curlTransaccion($url, $fields, 'DELETE'); |
| 186 |
|
|
| 187 |
|
$result = $this->checkResponseCode($obj); |
| 188 |
|
return $result; |
| 189 |
|
|
| 190 |
|
} catch (InstapagoException $e) { |
| 191 |
|
echo $e->getMessage(); |
| 192 |
|
} // end try/catch |
| 193 |
|
} |
| 194 |
|
|
| 195 |
|
// cancelPayment |
| 196 |
|
|
|
@@ 203-228 (lines=26) @@
|
| 200 |
|
* Requiere como parámetro el `id` que es el código de referencia de la transacción |
| 201 |
|
* https://github.com/abr4xas/php-instapago/blob/master/help/DOCUMENTACION.md#información-del-pago. |
| 202 |
|
*/ |
| 203 |
|
public function paymentInfo($idPago) |
| 204 |
|
{ |
| 205 |
|
try { |
| 206 |
|
$params = [$idPago]; |
| 207 |
|
$this->checkRequiredParams($params); |
| 208 |
|
|
| 209 |
|
$this->idPago = $idPago; |
| 210 |
|
|
| 211 |
|
$url = 'payment'; // endpoint |
| 212 |
|
|
| 213 |
|
$fields = [ |
| 214 |
|
'KeyID' => $this->keyId, //required |
| 215 |
|
'PublicKeyId' => $this->publicKeyId, //required |
| 216 |
|
'id' => $this->idPago, //required |
| 217 |
|
]; |
| 218 |
|
|
| 219 |
|
$obj = $this->curlTransaccion($url, $fields, 'GET'); |
| 220 |
|
|
| 221 |
|
$result = $this->checkResponseCode($obj); |
| 222 |
|
|
| 223 |
|
return $result; |
| 224 |
|
|
| 225 |
|
} catch (InstapagoException $e) { |
| 226 |
|
echo $e->getMessage(); |
| 227 |
|
} // end try/catch |
| 228 |
|
} |
| 229 |
|
|
| 230 |
|
// paymentInfo |
| 231 |
|
|