Download as pdf or txt
Download as pdf or txt
You are on page 1of 10

1/8/2020 Usuario final puede pagar con PayU (ddddde31) · Commits · Guillermo Agudelo / transito-frontend · GitLab

Please ensure your account's recovery settings are up to date.

Commit ddddde31 authored 3 weeks ago by Guillermo Agudelo

Usuario final puede pagar con PayU

parent 3f1d8573 master

No related merge requests found

Showing 17 changed files  with 439 additions and 30 deletions

  app/Http/Controllers/Admin/PaymentController.php 0 → 100644
1 + <?php
2 +
3 + namespace App\Http\Controllers\Admin;
4 +
5 + use App\Http\Controllers\Controller;
6 + use App\Invoice;
7 + use App\InvoicePaid;
8 + use App\Service;
9 + use Illuminate\Http\Request;
10 +
11 + class PaymentController extends Controller
12 +{
13 + public function index()
14 + {
15 + $invoicesPaid = InvoicePaid::getMostRecent(\State::get('branch.id'));
16 +
17 + $invoicesIds = $invoicesPaid->map(fn($ip) => $ip->field('idInvoice'))->toArray();
18 + $invoices = Invoice::whereIdIn($invoicesIds);
19 +
20 + $servicesIds = $invoicesPaid->map(fn($ip) => $ip->field('idService'))->toArray();
21 + $services = Service::whereIdIn($servicesIds);
22 +
23 + return view('admin.payments.index', compact('invoicesPaid', 'invoices', 'services'));
24 + }
25 +
26 + public function updateInfo(Request $request)
27 + {
28 + $request->validate([
29 + 'ref1' => 'required',
30 + 'ref2' => 'required',
31 + 'ref3' => 'required'
32 + ]);
33 +
34 +
35 + }
36 +}

  app/Http/Controllers/Portal/PaymentController.php
... ... @@ -5,6 +5,7 @@ namespace App\Http\Controllers\Portal;
5 5 use App\Company;
6 6 use App\Http\Controllers\Controller;
7 7 use App\Invoice;
8 + use App\InvoicePaid;
8 9 use App\Service;
9 10 use Illuminate\Http\Request;
10 11
... ... @@ -13,10 +14,12 @@ class PaymentController extends Controller
13 14 public function index()
14 15 {
15 16 $invoices = Invoice::whereGetInstances([
16 - ['state', '=', \InvoiceState::ACTIVO],
17 + ['state', 'in', [\InvoiceState::ACTIVO, \InvoiceState::PAGADO]],

https://gitlab.com/guille.agudelo/transito-frontend/-/commit/ddddde3195ed51b059f7e4c36dfef230b82f0303 1/10
1/8/2020 Usuario final puede pagar con PayU (ddddde31) · Commits · Guillermo Agudelo / transito-frontend · GitLab

17 18 ['idClient', '=', \State::get('client.id')]


18 19 ]);
19 20
21 + $invoices = $invoices->sortByDesc(fn($i) => $i->field('createAt'));
22 +
20 23 $servicesIds = $invoices->map(fn($i) => $i->field('idService'))->toArray();
21 24 $companiesIds = $invoices->map(fn($i) => $i->field('idCompany'))->toArray();
22 25
... ... @@ -29,4 +32,100 @@ class PaymentController extends Controller
29 32 'companies'
30 33 ));
31 34 }
35 +
36 + public function pay(Request $request, $invoiceId)
37 + {
38 + $invoice = Invoice::findOrFail($invoiceId);
39 +
40 + $apiKey = '4Vj8eK4rloUd272L48hsrarnUA';
41 + $merchantId = '508029';
42 + $referenceCode = 'T-'.\Str::random(20).'-'.$invoiceId;
43 + $amount = $invoice->field('valor');
44 + $currency = 'COP';
45 + $signature = md5("{$apiKey}~{$merchantId}~{$referenceCode}~{$amount}~{$currency}");
46 +
47 + $data = [
48 + 'merchantId' => $merchantId,
49 + 'accountId' => '512321',
50 + 'description' => "Factura #{$invoice->field('companyIdInvoice')}, periodo {$invoice-
>field('month')}/{$invoice->field('year')}",
51 + 'referenceCode' => $referenceCode,
52 + 'amount' => $amount,
53 + 'tax' => '0',
54 + 'taxReturnBase' => '0',
55 + 'currency' => $currency,
56 + 'signature' => $signature,
57 + 'test' => '1',
58 + 'buyerEmail' => \State::get('user.email'),
59 + 'buyerFullName' => \State::get('user.displayName'),
60 + 'responseUrl' => route('payment-response'),
61 + 'confirmationUrl' => secure_url(route('payment-confirmation')),
62 + 'extra1' => "Factura #{$invoice->field('companyIdInvoice')}, {$invoice->service()-
>field('name')} ({$invoice->company()->field('name')}), periodo {$invoice->field('month')}/{$invoice-
>field('year')}",
63 + 'extra2' => $invoice->id(),
64 + ];
65 +
66 + return view('portal.payments.payment-redirect', compact('data'));
67 + }
68 +
69 + public function paymentResponse(Request $request) {
70 + switch($request->get('transactionState')) {
71 + case '4':
72 + $transactionStatus = 'APROBADA';
73 + $statusMessage = null;
74 + break;
75 + case '6':
76 + $transactionStatus = 'DECLINADA';
77 + $statusMessage = $request->get('lapResponseCode');
78 + break;
79 + case '104':
80 + $transactionStatus = 'ERROR';
81 + $statusMessage = $request->get('lapResponseCode');
82 + break;
83 + case '5':
84 + $transactionStatus = 'EXPIRADA';
85 + $statusMessage = $request->get('lapResponseCode');
86 + break;
87 + case '7':
88 + $transactionStatus = 'PENDIENTE';
89 + $statusMessage = $request->get('lapResponseCode');
90 + break;
91 + }
92 +
93 + $invoiceId = explode('-', $request->get('referenceCode'))[2];
94 + $invoice = Invoice::findOrFail($invoiceId);

https://gitlab.com/guille.agudelo/transito-frontend/-/commit/ddddde3195ed51b059f7e4c36dfef230b82f0303 2/10
1/8/2020 Usuario final puede pagar con PayU (ddddde31) · Commits · Guillermo Agudelo / transito-frontend · GitLab

95 + $description = $request->get('extra1');
96 +
97 + return view('portal.payments.payment-response', compact(
98 + 'transactionStatus',
99 + 'statusMessage',
100 + 'invoice',
101 + 'description'
102 + ));
103 + }
104 +
105 + public function paymentConfirmation(Request $request) {
106 + // \Log::info($request->all());
107 + $invoiceId = explode('-', $request->get('reference_sale'))[2];
108 + $invoice = Invoice::findOrFail($invoiceId);
109 +
110 + if($request->get('state_pol') == '4') { // APPROVED
111 + $invoice->updateInstance([
112 + ['path' => 'state', 'value' => \InvoiceState::PAGADO]
113 + ]);
114 +
115 + InvoicePaid::create([
116 + 'createAt' => date_create(),
117 + 'creteBy' => null,
118 + 'idBranch' => $invoice->field('idBranch'),
119 + 'idClient' => $invoice->field('idClient'),
120 + 'idCompany' => $invoice->field('idCompany'),
121 + 'idInvoice' => $invoice->id(),
122 + 'idService' => $invoice->field('idService'),
123 + 'numConfirmation' => $request->get('reference_pol'),
124 + 'state' => \InvoiceState::ACTIVO,
125 + 'valor' => $invoice->field('valor')
126 + ]);
127 + }
128 +
129 + // \Log::info($invoice->toArray());
130 + }
32 131 }

  app/Http/Middleware/VerifyCsrfToken.php

... ... @@ -12,6 +12,6 @@ class VerifyCsrfToken extends Middleware


12 12 * @var array
13 13 */
14 14 protected $except = [
15 - //
15 + '/payment-confirmation'
16 16 ];
17 17 }

  app/Invoice.php
... ... @@ -7,4 +7,19 @@ use App\Support\LarafireModel;
7 7 class Invoice extends LarafireModel
8 8 {
9 9 protected $collectionName = 'invoices';
10 +
11 + public function service()
12 + {
13 + return Service::findOrFail($this->field('idService'));
14 + }
15 +
16 + public function company()
17 + {
18 + return Company::findOrFail($this->field('idCompany'));
19 + }
20 +
21 + public function details()
22 + {
23 + return InvoiceDetail::whereGetInstances('idInvoice', '=', $this->id());
24 + }
10 25 }

  app/InvoicePaid.php 0 → 100644
1 + <?php
2 +
https://gitlab.com/guille.agudelo/transito-frontend/-/commit/ddddde3195ed51b059f7e4c36dfef230b82f0303 3/10
1/8/2020 Usuario final puede pagar con PayU (ddddde31) · Commits · Guillermo Agudelo / transito-frontend · GitLab

3 + namespace App;
4 +
5 + use App\Support\LarafireModel;
6 +
7 + class InvoicePaid extends LarafireModel
8 +{
9 + protected $collectionName = 'invoicesPaids';
10 +
11 + public static function getMostRecent($branchId)
12 + {
13 + $invoices = InvoicePaid::where('idBranch', '=', $branchId)
14 + ->orderBy('createAt', 'DESC')
15 + ->limit(10)
16 + ->documents()
17 + ->rows();
18 +
19 + return InvoicePaid::rowsToInstances($invoices);
20 + }
21 +}

  app/PaymentServiceInfo.php 0 → 100644
1 + <?php
2 +
3 + namespace App;
4 +
5 + use App\Support\LarafireModel;
6 +
7 + class PaymentServiceInfo extends LarafireModel
8 +{
9 + protected $collectionName = 'invoicesDetails';
10 +}

  app/Support/Globals.php
... ... @@ -34,6 +34,7 @@ abstract class Roles
34 34 abstract class InvoiceState
35 35 {
36 36 const ACTIVO = 'Activo';
37 + const PENDIENTE = 'Pendiente';
37 38 const PAGADO = 'Pagado';
38 39 const INACTIVO = 'Inactivo';
39 40 }
... ...

  config/services.php

... ... @@ -30,4 +30,9 @@ return [


30 30 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
31 31 ],
32 32
33 + 'payulatam' => [
34 + 'merchantId' => env('PAYU_MERCHANT_ID'),
35 + 'accountId' => env('PAYU_ACCOUNT_ID'),
36 + 'apiKey' => env('PAYU_API_KEY')
37 + ],
33 38 ];

  notas.txt

... ... @@ -4,15 +4,17 @@


4 4 . que la importacion de facturas y conceptos se haga en una transaction
5 5 . que muestre ayuda sobre los .csv en admin.invoices
6 6 . portal: que no permite crear mas de un turno para hoy ni agendar mas de uno para el mismo dia
7 + . terminar seccion "Recaudos en linea"
7 8
8 9 notas edwin
9 - .que las entidades tengan logo ¿entidades o sucursales?
10 + .mandar mensaje de archivo de cargue con mal formato
11 + .variable que indique si la sucursal recauda o no
12 + .pedir cedula en primer inicio sesion
10 13
11 14 ui
12 - . arreglar posicion icono usuario cuando responsive
13 - . cambiar datos navbar arriba cuando mobile
14 15

https://gitlab.com/guille.agudelo/transito-frontend/-/commit/ddddde3195ed51b059f7e4c36dfef230b82f0303 4/10
1/8/2020 Usuario final puede pagar con PayU (ddddde31) · Commits · Guillermo Agudelo / transito-frontend · GitLab

15 16 fix
17 + . usuario final no puede agendar para mañana si lo hace tarde en la noche
16 18
17 19 largo
18 20 . que cuando recupere un turno pendiente en estado 'atendiendo' en pantalla turno, muestre el tiempo
transcurrido desde que empezo el turno en el timer
... ...

  resources/views/admin/dashboard.blade.php
... ... @@ -38,6 +38,9 @@
38 38 <i class="fa fa-file-invoice-dollar text-info"></i>
39 39 Administrar Facturas
40 40 </a>
41 + <a class="btn btn-outline-primary btn-xl mb-3" href="{{ route('admin.payments.index') }}">
42 + <i class="fa fa-money-bill-alt text-danger"></i> Configurar Recaudo En línea
43 + </a>
41 44 @endadmin
42 45 </div>
43 46
... ...

  resources/views/admin/payments/index.blade.php 0 → 100644
1 + @extends('layouts.app', ['title' => 'Configurar Recaudos en Línea'])
2 + @section('content')
3 + <div class="container">
4 +
5 + <h2>Recaudos en línea mas recientes</h2>
6 + <div class="w-100 mt-3 mb-5" style="overflow-x: scroll">
7 + <table class="table">
8 + <thead>
9 + <th class="text-center">#Factura</th>
10 + <th>Trámite</th>
11 + <th>Periodo</th>
12 + <th class="text-center">Valor</th>
13 + <th class="text-center">Estado</th>
14 + </thead>
15 + <tbody>
16 + @forelse($invoicesPaid as $invoice)
17 + <tr>
18 + <td class="text-center">
19 + {{$invoice->foreign($invoices, 'idInvoice')->field('companyIdInvoice')}}
20 + </td>
21 + <td>{{$invoice->foreign($services, 'idService')->field('name')}}</td>
22 + <td>
23 + {{$invoice->foreign($invoices, 'idInvoice')->field('month')}} /
24 + {{$invoice->foreign($invoices, 'idInvoice')->field('year')}}
25 + </td>
26 + <td class="text-right">
27 + @money($invoice->foreign($invoices, 'idInvoice')->field('valor'))
28 + </td>
29 + <td class="text-center">
30 + <span class="badge badge-success">
31 + {{$invoice->foreign($invoices, 'idInvoice')->field('state')}}
32 + </span>
33 + </td>
34 + </tr>
35 + @empty
36 + <tr>
37 + <td colspan="4">No hay facturas pagadas que mostrar</td>
38 + </tr>
39 + @endforelse
40 + </tbody>
41 + </table>
42 + </div>
43 +
44 +
45 + <h3 class="mb-0">Datos de la pasarela de pago PayULatam</h3>
46 + <p class="mb-1">
47 + Estos datos son los que usará la app para registrar los recaudos a nombre de esta sucursal.
48 + Busque esta información en las configuraciones de su cuenta PayULatam
49 + </p>
50 + <form class="form-inline" action="{{route('admin.payments.info')}}" method="post">
51 + @csrf

https://gitlab.com/guille.agudelo/transito-frontend/-/commit/ddddde3195ed51b059f7e4c36dfef230b82f0303 5/10
1/8/2020 Usuario final puede pagar con PayU (ddddde31) · Commits · Guillermo Agudelo / transito-frontend · GitLab

52 + <input class="form-control mb-2 mr-sm-2" type="text" name="ref1" placeholder="MerchantId">


53 + <input class="form-control mb-2 mr-sm-2" type="text" name="ref2" placeholder="AccountId">
54 + <input class="form-control mb-2 mr-sm-2" type="text" name="ref3" placeholder="API Key">
55 + <button type="submit" class="btn btn-primary mb-2">Guardar</button>
56 + </form>
57 + </div>
58 + @endsection

  resources/views/layouts/navbars/navs/auth.blade.php
... ... @@ -38,10 +38,10 @@
38 38 <div class=" dropdown-header noti-title">
39 39 <h6 class="text-overflow m-0">Bienvenido/a</h6>
40 40 </div>
41 - <a href="{{ route('profile.edit') }}" class="dropdown-item">
42 - <i class="ni ni-single-02"></i>
43 - <span>Mi perfil</span>
44 - </a>
41 + {{-- <a href="{{ route('profile.edit') }}" class="dropdown-item"> --}}
42 + {{-- <i class="ni ni-single-02"></i> --}}
43 + {{-- <span>Mi perfil</span> --}}
44 + {{-- </a> --}}
45 45 <div class="dropdown-divider"></div>
46 46 <a href="{{ route('logout') }}" class="dropdown-item" onclick="event.preventDefault();
47 47 document.getElementById('logout-form').submit();">
... ...

  resources/views/layouts/navbars/sidebar.blade.php
... ... @@ -29,10 +29,10 @@
29 29 <div class=" dropdown-header noti-title">
30 30 <h6 class="text-overflow m-0">Bienvenido/a!</h6>
31 31 </div>
32 - <a href="{{ route('profile.edit') }}" class="dropdown-item">
33 - <i class="ni ni-single-02"></i>
34 - <span>Mi perfil</span>
35 - </a>
32 + {{-- <a href="{{ route('profile.edit') }}" class="dropdown-item"> --}}
33 + {{-- <i class="ni ni-single-02"></i> --}}
34 + {{-- <span>Mi perfil</span> --}}
35 + {{-- </a> --}}
36 36 <!-- <a href="#" class="dropdown&#45;item"> -->
37 37 <!-- <i class="ni ni&#45;settings&#45;gear&#45;65"></i> -->
38 38 <!-- <span>Opciones</span> -->
... ... @@ -154,6 +154,11 @@
154 154 <i class="fa fa-file-invoice-dollar text-info"></i>Facturas
155 155 </a>
156 156 </li>
157 + <li class="nav-item">
158 + <a class="nav-link" href="{{ route('admin.payments.index') }}">
159 + <i class="fa fa-money-bill-alt text-danger"></i>Recaudo En línea
160 + </a>
161 + </li>
157 162 @endadmin
158 163 @endif
159 164
... ...

  resources/views/portal/payments/index.blade.php
... ... @@ -19,7 +19,7 @@
19 19 <th class="text-center">Acciones</th>
20 20 </thead>
21 21 <tbody>
22 - @forelse($invoices as $invoice)
22 + @forelse($invoices->filter(fn($i) => $i->field('state') == \InvoiceState::ACTIVO) as
$invoice)
23 23 <tr>
24 24 <td>{{$invoice->foreign($services, 'idService')->field('name')}}</td>
25 25 <td>{{$invoice->field('companyIdInvoice')}}</td>
... ... @@ -33,24 +33,24 @@
33 33 title="Ver detalles de factura"
34 34 @click.prevent="details('{{$invoice->id()}}',
35 35 '{{$invoice->field('companyIdInvoice')}}',
36 - '{{$invoice->field('valor')}}')">
36 + '{{$invoice->field('valor')}}',
https://gitlab.com/guille.agudelo/transito-frontend/-/commit/ddddde3195ed51b059f7e4c36dfef230b82f0303 6/10
1/8/2020 Usuario final puede pagar con PayU (ddddde31) · Commits · Guillermo Agudelo / transito-frontend · GitLab

37 + '{{$invoice->field('state')}}')">
37 38 <i class="fa fa-file-invoice"></i> Detalles
38 39 </a>
39 40
40 41 <a href="#"
41 42 class="btn btn-primary btn-sm"
42 - title="Pagar Factura"
43 - @click.prevent="pay('{{$invoice->id()}}')">
43 + @click.prevent="pay('{{$invoice->id()}}')"
44 + title="Pagar Factura">
44 45 <i class="fa fa-credit-card"></i> Pagar
45 46 </a>
46 47
47 - {{-- <form action="#" --}}
48 - {{-- method="post" --}}
49 - {{-- class="d-none" --}}
50 - {{-- id="cancel-form-{{$queue->id()}}"> --}}
51 - {{-- @csrf --}}
52 - {{-- @method('put') --}}
53 - {{-- </form> --}}
48 + <form action="{{route('portal.payments.pay', $invoice->id())}}"
49 + method="post"
50 + class="d-none"
51 + id="pay-form-{{$invoice->id()}}">
52 + @csrf
53 + </form>
54 54 </td>
55 55 </tr>
56 56 @empty
... ... @@ -62,6 +62,51 @@
62 62 </table>
63 63 </div>
64 64
65 + @php $invoicesPaid = $invoices->filter(fn($i) => $i->field('state') == \InvoiceState::PAGADO);
@endphp
66 + @if(count($invoicesPaid) > 0)
67 + <h2 class="mt-5">Facturas pagadas</h2>
68 +
69 + <div class="w-100" style="overflow-x: scroll">
70 + <table class="table table-hover">
71 + <thead>
72 + <th>Trámite</th>
73 + <th>#Factura</th>
74 + <th>Nombre</th>
75 + <th>Periodo</th>
76 + <th class="text-center">Valor</th>
77 + <th>Entidad</th>
78 + <th class="text-center">Acciones</th>
79 + </thead>
80 + <tbody>
81 + @forelse($invoicesPaid as $invoice)
82 + <tr>
83 + <td>{{$invoice->foreign($services, 'idService')->field('name')}}</td>
84 + <td>{{$invoice->field('companyIdInvoice')}}</td>
85 + <td>{{$invoice->field('companyName')}}</td>
86 + <td>{{$invoice->field('month')}}/{{$invoice->field('year')}}</td>
87 + <td class="text-right">@money($invoice->field('valor'))</td>
88 + <td>{{$invoice->foreign($companies, 'idCompany')->field('name')}}</td>
89 + <td class="text-center">
90 + <a href="#"
91 + class="btn btn-sm"
92 + title="Ver detalles de factura"
93 + @click.prevent="details('{{$invoice->id()}}',
94 + '{{$invoice->field('companyIdInvoice')}}',
95 + '{{$invoice->field('valor')}}',
96 + '{{$invoice->field('state')}}')">
97 + <i class="fa fa-file-invoice"></i> Detalles
98 + </a>
99 + </td>
100 + </tr>
101 + @empty
102 + <tr>
103 + <td colspan="4">No hay facturas pagadas en el momento</td>
104 + </tr>
105 + @endforelse

https://gitlab.com/guille.agudelo/transito-frontend/-/commit/ddddde3195ed51b059f7e4c36dfef230b82f0303 7/10
1/8/2020 Usuario final puede pagar con PayU (ddddde31) · Commits · Guillermo Agudelo / transito-frontend · GitLab

106 + </tbody>
107 + </table>
108 + </div>
109 + @endif
65 110 <div class="modal fade" id="detailsModal" tabindex="-1" role="dialog" aria-
labelledby="detailsModalLabel" aria-hidden="true">
66 111 <div class="modal-dialog" role="document">
67 112 <div class="modal-content">
... ... @@ -95,9 +140,13 @@
95 140 </div>
96 141 <div class="modal-footer">
97 142 <button type="button" class="btn btn-secondary" data-
dismiss="modal">Cerrar</button>
98 - <button type="button" class="btn btn-primary">
143 + <a href="#"
144 + type="button"
145 + class="btn btn-primary"
146 + v-show="state != 'Pagado'"
147 + @click.prevent="pay(invoiceId)">
99 148 <i class="fa fa-credit-card"></i> Pagar
100 - </button>
149 + </a>
101 150 </div>
102 151 </div>
103 152 </div>
... ... @@ -112,28 +161,33 @@
112 161 el: '#payments',
113 162 data() {
114 163 return {
164 + invoiceId: null,
115 165 invoiceNumber: null,
116 166 value: null,
167 + state: null,
117 168 concepts: [],
118 169 }
119 170 },
120 171 methods: {
121 - pay(invoiceId) {
122 - console.log('paying')
123 - },
124 - details(invoiceId, invoiceNumber, value) {
172 + details(invoiceId, invoiceNumber, value, state) {
173 + console.log(state)
125 174 Progress.start()
126 175 axios.get('/api/invoice-details/by-invoice-id/'+invoiceId)
127 176 .then(res => {
128 177 if (res.data.status == 'success') {
178 + this.invoiceId = invoiceId
129 179 this.invoiceNumber = invoiceNumber
130 180 this.value = value
181 + this.state = state
131 182 this.concepts = res.data.data.concepts
132 183 $('#detailsModal').modal('show')
133 184 }
134 185 }).catch(err => {
135 186 console.log(err)
136 187 }).then(() => Progress.done())
188 + },
189 + pay(invoiceId) {
190 + $('#pay-form-'+invoiceId).submit()
137 191 }
138 192 },
139 193 filters: {
... ...

  resources/views/portal/payments/payment-redirect.blade.php 0 → 100644

1 + <html>
2 + <body>
3 + <!-- <form method="post" action="https://checkout.payulatam.com/ppp&#45;web&#45;gateway&#45;payu/"
id="checkout&#45;form"> -->
4 + <form method="post" action="https://sandbox.checkout.payulatam.com/ppp-web-gateway-payu/">
5 + @foreach($data as $name => $value)
6 + <input type="hidden" name="{{$name}}" value="{{$value}}">
7 + @endforeach

https://gitlab.com/guille.agudelo/transito-frontend/-/commit/ddddde3195ed51b059f7e4c36dfef230b82f0303 8/10
1/8/2020 Usuario final puede pagar con PayU (ddddde31) · Commits · Guillermo Agudelo / transito-frontend · GitLab

8 + </form>
9 + <script>
10 + document.querySelector('form').submit()
11 + </script>
12 + </body>
13 + </html>

  resources/views/portal/payments/payment-response.blade.php 0 → 100644

1 + @extends('layouts.app', ['title' => 'Resultado del pago'])


2 + @php
3 + switch($transactionStatus) {
4 + case 'APROBADA':
5 + $color = 'success'; break;
6 + case 'DECLINADA':
7 + $color = 'danger'; break;
8 + case 'ERROR':
9 + $color = 'danger'; break;
10 + case 'EXPIRADA':
11 + $color = 'danger'; break;
12 + case 'PENDIENTE':
13 + $color = 'warning'; break;
14 + }
15 + @endphp
16 + @section('content')
17 + @include('layouts.headers.cards')
18 + <div class="container-fluid pl-5 d-block">
19 +
20 + <p class="h4 text-center">
21 + El estado de su transacción es <span class="h4 text-{{$color}}">{{$transactionStatus}}</span>
22 + </p>
23 +
24 + @if($transactionStatus == 'APROBADA')
25 + <p class="text-center">¡Su factura ha sido pagada satisfactoriamente!</p>
26 + @endif
27 +
28 + @if($statusMessage)
29 + <p class="text-center">{{$statusMessage}}</p>
30 + @endif
31 +
32 +
33 +
34 + <p class="mb-0 mt-5 ml-2 text-center">{{$description}}</p>
35 + <p class="text-center mb-0">
36 + <span class="h4">Estado de la factura:</span>
37 + @if($invoice->field('state') == \InvoiceState::ACTIVO)
38 + <span class="text-danger">No Pagado</span>
39 + @endif
40 + @if($invoice->field('state') == \InvoiceState::PENDIENTE)
41 + <span class="text-warning">No Pagado</span>
42 + @endif
43 + @if($invoice->field('state') == \InvoiceState::PAGADO)
44 + <span class="text-success">Pagado</span>
45 + @endif
46 + </p>
47 + <table class="table w-50 mx-auto">
48 + <thead>
49 + <th class="text-center">Concepto</th>
50 + <th class="text-center">Subtotal</th>
51 + </thead>
52 + <tbody>
53 + @foreach($invoice->details() as $detail)
54 + <tr>
55 + <td>{{$detail->field('concept')}}</td>
56 + <td class="text-right">@money($detail->field('valor'))</td>
57 + </tr>
58 + @endforeach
59 + </tbody>
60 + <tfoot>
61 + <tr>
62 + <th>Total:</th>
63 + <th class="text-right">@money($invoice->field('valor'))</th>
64 + </tr>
65 + </tfoot>
66 + </table>

https://gitlab.com/guille.agudelo/transito-frontend/-/commit/ddddde3195ed51b059f7e4c36dfef230b82f0303 9/10
1/8/2020 Usuario final puede pagar con PayU (ddddde31) · Commits · Guillermo Agudelo / transito-frontend · GitLab

67 +
68 + <div class="d-flex justify-content-center">
69 + <a class="mt-3 btn btn-outline-primary" href="{{route('portal.payments.index')}}">
70 + Volver a lista de facturas
71 + </a>
72 + </div>
73 +
74 + </div>
75 + @endsection

  routes/web.php

... ... @@ -101,6 +101,14 @@ Route::group([


101 101 Route::post('upload-details', 'InvoiceController@uploadDetails')->name('upload-details');
102 102 Route::put('deactivate', 'InvoiceController@deactivate')->name('deactivate');
103 103 });
104 +
105 + Route::group([
106 + 'prefix' => 'payments',
107 + 'as' => 'payments.'
108 + ], function() {
109 + Route::get('', 'PaymentController@index')->name('index');
110 + Route::post('info', 'PaymentController@updateInfo')->name('info');
111 + });
104 112 });
105 113
106 114
... ... @@ -127,6 +135,7 @@ Route::group([
127 135 'as' => 'payments.',
128 136 ], function() {
129 137 Route::get('', 'PaymentController@index')->name('index');
138 + Route::post('pay/{invoiceId}', 'PaymentController@pay')->name('pay');
130 139 });
131 140 });
132 141
... ... @@ -196,3 +205,6 @@ Route::group([
196 205 });
197 206 });
198 207
208 + // Payment response route
209 + Route::get('payment-response', 'Portal\PaymentController@paymentResponse')->name('payment-response');
210 + Route::post('payment-confirmation', 'Portal\PaymentController@paymentConfirmation')->name('payment-
confirmation');

Write a comment or drag your files here…

Markdown and quick actions are supported

https://gitlab.com/guille.agudelo/transito-frontend/-/commit/ddddde3195ed51b059f7e4c36dfef230b82f0303 10/10

You might also like