60 lines
1.9 KiB
Plaintext
Executable File
60 lines
1.9 KiB
Plaintext
Executable File
<!--<head>-->
|
|
<!--<meta name="viewport" content="width=device-width, initial-scale=1">-->
|
|
<!--<meta http-equiv="X-UA-Compatible" content="IE=edge" />-->
|
|
<!--</head>-->
|
|
%stash css=>["/home/tst/tst.css"];
|
|
<section class="item"> <section class="transp flex">
|
|
<article class=iimage>
|
|
<img class="small" src= "home/store/img/libro.jpg">
|
|
</article>
|
|
<article class=iinfo>
|
|
<p class="txt"><%= $descripcion %></p>
|
|
<p class="promo"><%= $promo %></p>
|
|
<p class="precio">Precio:$<%= $precio %> pesos</p>
|
|
<p class="existencia">
|
|
<% if ($existencia > 10) { =%> <p class="eok"></p> <% } =%>
|
|
<% elsif ($existencia >= 1) { =%> <p class="elow">¡Nos quedan pocos!</p> <% } =%>
|
|
<% elsif ($existencia == 0) { =%> <p class="eldep">¡Agotado!</p> <% } =%>
|
|
<div class=ppl>
|
|
<div id="paypal-button-container"></div>
|
|
</div>
|
|
</article>
|
|
</section> </section>
|
|
<section class="ibottom">
|
|
<p class="nombre"><%= $nombre %></p>
|
|
<p class="tit"><%= $titulo %></p>
|
|
</section>
|
|
<section class="bdat"> </section>
|
|
|
|
|
|
<script src="https://www.paypal.com/sdk/js?client-id=AQdZ1JJL-GNBgGTI3W6cXChmj6MnZsInRGlWeHw1kbGiE_49eTtZ2fPvEq9ersU2y6O5WpxccdsyAQw7¤cy=MXN"></script>
|
|
<script>
|
|
paypal.Buttons({
|
|
// Set up the transaction
|
|
createOrder: function(data, actions) {
|
|
return actions.order.create({
|
|
purchase_units: [{
|
|
amount: {
|
|
value: '0.18'
|
|
}
|
|
}]
|
|
}); },
|
|
onApprove: function(data, actions) {
|
|
return actions.order.capture().then(function(details) {
|
|
return fetch('/tst', {
|
|
method: 'post',
|
|
headers: {
|
|
'content-type': 'application/json'
|
|
},
|
|
body: JSON.stringify({
|
|
orderID: data.orderID
|
|
})
|
|
})
|
|
// .then(response=>response.json())
|
|
// .then(data => {alert(data)})
|
|
});
|
|
}
|
|
}).render('#paypal-button-container');
|
|
</script>
|
|
|