(,), editor, administrador
This commit is contained in:
@@ -22,11 +22,21 @@ class ShowRecarga extends Component
|
||||
use LivewireAlert;
|
||||
public $numero_nequi;
|
||||
public $valor_recarga;
|
||||
public $valor_recarga_format;
|
||||
public $nequi =false;
|
||||
public $cobrar = false;
|
||||
public $monto = 0;
|
||||
|
||||
|
||||
|
||||
public function updatedValorRecargaFormat($value)
|
||||
{
|
||||
// Limpiar el valor formatado quitando los puntos
|
||||
$cleanValue = str_replace(',', '', $value);
|
||||
|
||||
// Asignar el valor limpio a valor_recarga
|
||||
$this->valor_recarga = $cleanValue;
|
||||
}
|
||||
|
||||
|
||||
public function render()
|
||||
{
|
||||
// $this->fechaActual = date('d/m/Y');
|
||||
@@ -37,7 +47,7 @@ class ShowRecarga extends Component
|
||||
$consulta_historial = recarga::where('usuario_id',Auth::user()->id)->orderBy('id','DESC')->limit(20)->get();
|
||||
|
||||
$consulta_saldo = User::where('id',Auth::user()->id)->with('saldo')->first();
|
||||
|
||||
|
||||
return view('livewire.show-recarga',[
|
||||
'user' => $consulta_saldo,
|
||||
'historial_recargas' => $consulta_historial
|
||||
@@ -46,7 +56,7 @@ class ShowRecarga extends Component
|
||||
|
||||
|
||||
public function pagar(){
|
||||
|
||||
|
||||
//auth2.0
|
||||
$client_id='5ml5b35ijjk13f4q99utnsm97e';
|
||||
$client_secret='1b3703aq0o6t1rrfti13q7uf7f42glik3gsf81s0d783shblmt8l';
|
||||
@@ -54,8 +64,8 @@ class ShowRecarga extends Component
|
||||
$endpoint="https://oauth.sandbox.nequi.com/oauth2/token?grant_type=client_credentials";
|
||||
$date= Carbon::now()->format('Y-m-d\TH:i:s.z\Z');
|
||||
//dd($date);
|
||||
|
||||
//dd($this->numero_nequi);
|
||||
|
||||
//dd($this->numero_nequi);
|
||||
//push
|
||||
$RestEndpoint = '/payments/v2/-services-paymentservice-unregisteredpayment';
|
||||
|
||||
@@ -66,8 +76,8 @@ class ShowRecarga extends Component
|
||||
'Accept' => 'application/json',
|
||||
'Authorization' => $authorization
|
||||
);
|
||||
|
||||
//Solicitud
|
||||
|
||||
//Solicitud
|
||||
$request = Requests::post($endpoint, $headers);
|
||||
|
||||
|
||||
@@ -98,7 +108,7 @@ class ShowRecarga extends Component
|
||||
|
||||
$options1 = array(
|
||||
'timeout' => 30
|
||||
|
||||
|
||||
);
|
||||
$endpoint1 = 'https://api.sandbox.nequi.com' . $RestEndpoint;
|
||||
|
||||
@@ -135,7 +145,7 @@ $request1 = Requests::post($endpoint1, $headers1, $body1, $options1);
|
||||
|
||||
if (isset($request1->status_code) && $request1->status_code == 200 && isset($request1->body) && !empty($request1->body)
|
||||
) {
|
||||
|
||||
|
||||
|
||||
try {
|
||||
$response1 = json_decode($request1->body);
|
||||
@@ -143,18 +153,18 @@ if (isset($request1->status_code) && $request1->status_code == 200 && isset($req
|
||||
$status = $response1->ResponseMessage->ResponseHeader->Status;
|
||||
$statusCode = isset($status) ? $status->StatusCode : '';
|
||||
$statusDesc = isset($status) ? $status->StatusDesc : '';
|
||||
|
||||
|
||||
if ($statusCode == 0) {
|
||||
|
||||
$this->alert('success', 'Solicitud de pago enviada', [
|
||||
'position' => 'top'
|
||||
]);
|
||||
|
||||
|
||||
$payment = $response1->ResponseMessage->ResponseBody->any->unregisteredPaymentRS;
|
||||
$trnId = isset($payment) ? trim($payment->transactionId) : '';
|
||||
|
||||
|
||||
if ( !empty($trnId)) {
|
||||
|
||||
|
||||
$recarga = new recarga;
|
||||
$recarga-> payment_type_id= '';
|
||||
$recarga-> payment_method_id= '';
|
||||
@@ -172,7 +182,7 @@ if (isset($request1->status_code) && $request1->status_code == 200 && isset($req
|
||||
]);
|
||||
|
||||
$this->nequi = false;
|
||||
}
|
||||
}
|
||||
$this->alert('success', $trnId, [
|
||||
'position' => 'top'
|
||||
]);
|
||||
@@ -181,7 +191,7 @@ if (isset($request1->status_code) && $request1->status_code == 200 && isset($req
|
||||
$this->alert('warning', $statusCode . ' = ' . $statusDesc, [
|
||||
'position' => 'top'
|
||||
]);
|
||||
|
||||
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
throw $e;
|
||||
|
||||
Reference in New Issue
Block a user