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
68a2dd63
Commit
68a2dd63
authored
Jun 04, 2018
by
Angel MAS
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
desceunto con paypal
parent
0a524135
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
7 deletions
+40
-7
CartController.php
src/controllers/CartController.php
+39
-7
order.blade.php
src/views/mail/resumen/order.blade.php
+1
-0
No files found.
src/controllers/CartController.php
View file @
68a2dd63
...
@@ -551,8 +551,7 @@ public function shipping()
...
@@ -551,8 +551,7 @@ public function shipping()
$products
=
$sale
->
products
;
$products
=
$sale
->
products
;
$addres
=
$client
->
shipping
;
$addres
=
$client
->
shipping
;
$detail
=
''
;
$detail
=
''
;
$descuento
=
0
;
$apiContext
=
new
ApiContext
(
$apiContext
=
new
ApiContext
(
new
OAuthTokenCredential
(
new
OAuthTokenCredential
(
...
@@ -599,17 +598,38 @@ public function shipping()
...
@@ -599,17 +598,38 @@ public function shipping()
array_push
(
$items
,
$item2
);
array_push
(
$items
,
$item2
);
if
(
$request
->
coupon
!=
null
)
{
$data
=
$this
->
getDiscount
(
$sale
,
$request
->
coupon
);
if
(
$data
[
'valid'
])
{
$descuento
=
$data
[
'amount_unformated'
];
$sale
->
total
=
$data
[
'total_unformated'
];
$sale
->
coupon
=
$request
->
coupon
;
//Descuento en caso de haber
$item3
=
new
PaypalItem
();
$item3
->
setName
(
'Código de descuento: '
.
$request
->
coupon
)
->
setDescription
(
'Código de descuento: '
.
$request
->
coupon
)
->
setCurrency
(
'MXN'
)
->
setQuantity
(
1
)
->
setPrice
((
$descuento
*
-
1
));
array_push
(
$items
,
$item3
);
}
}
$itemList
=
new
ItemList
();
$itemList
=
new
ItemList
();
$itemList
->
setItems
(
$items
);
$itemList
->
setItems
(
$items
);
$details
=
new
Details
();
$details
=
new
Details
();
$details
->
setSubtotal
(
$this
->
total
()
+
$addres
->
shipping_price
->
cost
);
$details
->
setSubtotal
(
(
$this
->
total
()
+
$addres
->
shipping_price
->
cost
)
-
$descuento
);
$amount
=
new
\PayPal\Api\Amount
();
$amount
=
new
\PayPal\Api\Amount
();
$amount
->
setCurrency
(
"MXN"
)
$amount
->
setCurrency
(
"MXN"
)
->
setTotal
(
$this
->
total
()
+
$addres
->
shipping_price
->
cost
)
->
setTotal
(
(
$this
->
total
()
+
$addres
->
shipping_price
->
cost
)
-
$descuento
)
->
setDetails
(
$details
);
->
setDetails
(
$details
);
...
@@ -665,6 +685,16 @@ public function shipping()
...
@@ -665,6 +685,16 @@ public function shipping()
$sale
->
status
=
3
;
$sale
->
status
=
3
;
$sale
->
transaction_id
=
null
;
$sale
->
transaction_id
=
null
;
$sale
->
payment_type
=
'Acordar con vendedor'
;
$sale
->
payment_type
=
'Acordar con vendedor'
;
if
(
$request
->
coupon
!=
null
)
{
$data
=
$this
->
getDiscount
(
$sale
,
$request
->
coupon
);
if
(
$data
[
'valid'
])
{
$sale
->
total
=
$data
[
'total_unformated'
];
$sale
->
coupon
=
$request
->
coupon
;
}
}
$sale
->
save
();
$sale
->
save
();
\Session
::
forget
(
'client'
);
\Session
::
forget
(
'client'
);
...
@@ -762,7 +792,7 @@ public function shipping()
...
@@ -762,7 +792,7 @@ public function shipping()
if
(
$coupon
!=
null
)
{
if
(
$coupon
!=
null
)
{
if
(
$today
<=
$coupon
->
expiration
)
{
if
(
$today
<=
$coupon
->
expiration
)
{
if
(
$t
his
->
total
()
>=
$coupon
->
min_sale
)
{
if
(
$t
otal
>=
$coupon
->
min_sale
)
{
if
(
$coupon
->
type
==
'Efectivo'
)
{
if
(
$coupon
->
type
==
'Efectivo'
)
{
$descuento
=
$coupon
->
value
;
$descuento
=
$coupon
->
value
;
...
@@ -791,10 +821,12 @@ public function shipping()
...
@@ -791,10 +821,12 @@ public function shipping()
'valid'
=>
$valid
,
'valid'
=>
$valid
,
'msg'
=>
$msg
,
'msg'
=>
$msg
,
'amount'
=>
money_format
(
'%(#10n'
,
$descuento
),
'amount'
=>
money_format
(
'%(#10n'
,
$descuento
),
'total'
=>
money_format
(
'%(#10n'
,
((
$total
+
$cost_shipping
)
-
$descuento
))
'amount_unformated'
=>
$descuento
,
'total'
=>
money_format
(
'%(#10n'
,
((
$total
+
$cost_shipping
)
-
$descuento
)),
'total_unformated'
=>
(
$total
+
$cost_shipping
)
-
$descuento
];
];
return
$data
;
return
$data
;
}
}
}
}
src/views/mail/resumen/order.blade.php
View file @
68a2dd63
...
@@ -10,6 +10,7 @@ setlocale(LC_MONETARY, 'en_US');
...
@@ -10,6 +10,7 @@ setlocale(LC_MONETARY, 'en_US');
-
Numero
de
orden
:
# {{$order->id}}
-
Numero
de
orden
:
# {{$order->id}}
-
Fecha
:
{{
$order
->
created_at
->
format
(
'd/m/Y'
)}}
-
Fecha
:
{{
$order
->
created_at
->
format
(
'd/m/Y'
)}}
-
Forma
de
pago
:
{{
$order
->
payment_type
}}
-
Forma
de
pago
:
{{
$order
->
payment_type
}}
-
Cupon
de
descuento
:
{{
$order
->
coupon
!=
null
?
$order
->
coupon
:
'N/A'
}}
@
endcomponent
@
endcomponent
...
...
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