Skip to content

Instantly share code, notes, and snippets.

@guillermoprojaslema
Created May 24, 2018 16:26
Show Gist options
  • Save guillermoprojaslema/a56927a5f5eab3199e462b864aa8cd6c to your computer and use it in GitHub Desktop.
Save guillermoprojaslema/a56927a5f5eab3199e462b864aa8cd6c to your computer and use it in GitHub Desktop.
/7WEbPayController.php
public function init(Request $values)
{
// Guardando orden en base de datos
$order = OrdenPago::find($values->orden_id);
/** URL de retorno */
$urlReturn = route('webpay.voucher');
/** URL Final */
$urlFinal = route('webpay.finish');
$values->ordenId = $order->id;
/** Data de la transaccion */
/* Inicializamos los valores webpay */
$init = [
'buyId' => $order->id,
'amount' => $order->monto,
'urlReturn' => $urlReturn,
'urlFinal' => $urlFinal
];
/** Creacion Objeto Webpay */
$webpay = new WebPay($init);
$webpay->process($init); <---- Acá se cae
/* Comprobamos que los certificados sean válidos */
if ($webpay->getError() != '') {
return Redirect::route('webpay.rechazo')
->with('orden_id', $order->id);
}
// Guardando orden en base de datos
return Redirect::route("webpay.token")
->with('token', $webpay->getToken())
->with('url', $webpay->getUrl());
}
// Webpay.php
public function process(){
$result = $this->_webpay
->getNormalTransaction() <- Acá es la función donde pierde el flujo
->initTransaction(
$this->getAmount(),
$this->getBuyId(),
$this->getSessionId(),
$this->getUrlReturn(),
$this->getUrlFinal()
);
if(!empty($result->token) && isset($result->token)) {
$this->token = $result->token;
$this->url = $result->url;
} else {
$this->error = 'Error Token'.var_dump($result);
}
}
//soapclient.php
class WSSecuritySoapClient extends SoapClient {
private $useSSL = false;
private $privateKey = "";
private $publicCert = "";
function __construct($wsdl, $privateKey, $publicCert, $options) {
$locationparts = parse_url($wsdl);
$this->useSSL = $locationparts['scheme'] == "https" ? true : false;
$this->privateKey = $privateKey;
$this->publicCert = $publicCert;
return parent::__construct($wsdl, $options); // <-- Acá se rompe según la consola de phpstorm y me cierra el server :(
}
....
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment