Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
O
onestartup-shop
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Angel Martin
onestartup-shop
Commits
a0774dcc
Commit
a0774dcc
authored
May 17, 2018
by
Angel MAS
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
payment cash, mercado pago
parent
591ef1ff
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
111 additions
and
4 deletions
+111
-4
AdminProductController.php
src/controllers/AdminProductController.php
+2
-2
CartController.php
src/controllers/CartController.php
+60
-0
routes.php
src/routes.php
+11
-2
finish.blade.php
src/views/public/cart/finish.blade.php
+4
-0
fields-payment-cash.blade.php
src/views/public/forms/fields-payment-cash.blade.php
+21
-0
layout.blade.php
src/views/public/layout.blade.php
+13
-0
No files found.
src/controllers/AdminProductController.php
View file @
a0774dcc
...
...
@@ -227,7 +227,7 @@ class AdminProductController extends Controller
}
public
function
showVars
()
/*
public function showVars()
{
$variable = Variable::first();
...
...
@@ -256,7 +256,7 @@ class AdminProductController extends Controller
return redirect()
->back()
->with('message_success', 'Información actualizada');
}
}
*/
public
function
extraInfo
(
Request
$request
)
{
...
...
src/controllers/CartController.php
View file @
a0774dcc
...
...
@@ -300,6 +300,66 @@ class CartController extends Controller
return
$request
;
}
public
function
paymentCash
(
Request
$request
)
{
if
(
!
\Session
::
has
(
'client'
))
{
return
redirect
()
->
route
(
'cart.shipping'
);
}
if
(
!
\Session
::
has
(
'sale'
))
{
return
redirect
()
->
route
(
'cart.shipping'
);
}
$sale
=
Sale
::
find
(
\Session
::
get
(
'sale'
)
->
id
);
$client
=
$sale
->
client
;
$items
=
$sale
->
items
;
$addres
=
$client
->
shipping
;
$detail
=
''
;
foreach
(
$sale
->
items
as
$item
)
{
$detail
=
$detail
.
" "
.
$item
->
quantity
.
" "
.
$item
->
product
->
name
.
", "
;
}
$detail
=
$detail
.
" Envio "
.
$addres
->
shipping_price
->
name
.
" $"
.
$addres
->
shipping_price
->
cost
.
".00"
;
$mp
=
new
MP
(
'TEST-7957752184054483-101318-9bbc7ef53f975318d2521f05257cb66a__LB_LC__-60150825'
);
$payment_data
=
array
(
"transaction_amount"
=>
$this
->
total
()
+
$addres
->
shipping_price
->
cost
,
"description"
=>
$detail
,
"payment_method_id"
=>
$request
->
payment_id
,
"payer"
=>
array
(
"email"
=>
$client
->
email
,
"first_name"
=>
$client
->
name
,
"last_name"
=>
$client
->
lastname
)
);
$payment
=
$mp
->
post
(
"/v1/payments"
,
$payment_data
);
$url_ficha
=
$payment
[
'response'
][
'transaction_details'
][
'external_resource_url'
];
$sale
->
status
=
3
;
$sale
->
transaction_id
=
$payment
[
'response'
][
'id'
];
$sale
->
save
();
\Session
::
forget
(
'client'
);
\Session
::
forget
(
'cart'
);
\Session
::
forget
(
'sale'
);
return
redirect
()
->
route
(
'main.shop'
)
->
with
(
'url_ficha'
,
$url_ficha
);
}
private
function
total
()
{
...
...
src/routes.php
View file @
a0774dcc
...
...
@@ -29,13 +29,13 @@ Route::group(['middleware' => ['web', 'auth', 'is_admin']], function(){
'Onestartup\Shop\Controller\AdminProductController@deleteCover'
)
->
name
(
'admin-shop-product.delete.cover'
);
Route
::
get
(
'admin/product/variable'
,
/*
Route::get('admin/product/variable',
'Onestartup\Shop\Controller\AdminProductController@showVars')
->name('admin-shop-product.view.vars');
Route::post('admin/product/variable',
'Onestartup\Shop\Controller\AdminProductController@postVars')
->
name
(
'admin-shop-product.store.vars'
);
->name('admin-shop-product.store.vars');
*/
Route
::
post
(
'admin/shop/product-extra'
,
'Onestartup\Shop\Controller\AdminProductController@extraInfo'
)
...
...
@@ -60,6 +60,7 @@ Route::group(['middleware' => ['web']], function(){
Route
::
post
(
'cart/store/client'
,
'Onestartup\Shop\Controller\CartController@storeClient'
)
->
name
(
'cart.store.client'
);
Route
::
post
(
'cart/payment'
,
'Onestartup\Shop\Controller\CartController@payment'
)
->
name
(
'cart.payment'
);
Route
::
post
(
'cart/paymentCash'
,
'Onestartup\Shop\Controller\CartController@paymentCash'
)
->
name
(
'cart.paymentCash'
);
Route
::
get
(
'cart/update/{product_slug}/{quantity}'
,
'Onestartup\Shop\Controller\CartController@update'
)
->
where
(
'quantity'
,
'[0-9]+'
)
...
...
@@ -69,4 +70,12 @@ Route::group(['middleware' => ['web']], function(){
Route
::
get
(
'producto/{slug}'
,
'Onestartup\Shop\Controller\ProductController@show'
)
->
name
(
'show.shop'
);
Route
::
get
(
'shop'
,
'Onestartup\Shop\Controller\ProductController@index'
)
->
name
(
'main.shop'
);
//Route::get('cart/{product_id}')
Route
::
get
(
'test/payments'
,
function
()
{
$mp
=
new
Onestartup\Shop\Payment\MP
(
"TEST-7957752184054483-101318-9bbc7ef53f975318d2521f05257cb66a__LB_LC__-60150825"
);
$payment_methods
=
$mp
->
get
(
"/v1/payment_methods"
);
dd
(
$payment_methods
);
});
});
src/views/public/cart/finish.blade.php
View file @
a0774dcc
...
...
@@ -59,6 +59,10 @@ setlocale(LC_MONETARY, 'en_US');
@include('shop-public::forms.fields-payment')
<br>
@include('shop-public::forms.fields-payment-cash')
</section>
...
...
src/views/public/forms/fields-payment-cash.blade.php
0 → 100644
View file @
a0774dcc
<form
action=
"{{route('cart.paymentCash')}}"
method=
"POST"
>
{{ csrf_field() }}
<div
class=
"group"
>
<label>
Selecciona la opcion deseada
</label>
<select
name=
"payment_id"
>
<option
value=
"oxxo"
>
Oxxo
</option>
<option
value=
"bancomer"
>
Bancomer
</option>
<option
value=
"serfin"
>
Santander
</option>
<option
value=
"banamex"
>
Banamex
</option>
</select>
</div>
<button>
Pagar {{ money_format('%(#10n', ($total + $addres->shipping_price->cost)) }}
</button>
</form>
\ No newline at end of file
src/views/public/layout.blade.php
View file @
a0774dcc
...
...
@@ -46,6 +46,19 @@
swal
(
"Pago pendiente"
,
"Estamos procesando tu pago, te notificaremos por correo el estatus"
,
"warning"
)
</script>
@endif
@if(Session::has('url_ficha'))
<script>
$
(
function
()
{
var
url
=
"{{Session::get('url_ficha')}}"
;
swal
(
"Pago pendiente"
,
"Descarga tu ficha y llevala a pagar al lugar correspodiente"
,
"warning"
)
console
.
log
(
url
);
window
.
open
(
url
,
'_blank'
);
})
</script>
@endif
<!-- ******************************************* -->
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment