Nuevos cambios hechos de diseño
This commit is contained in:
@@ -0,0 +1,99 @@
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title></title>
|
||||
<meta name="viewport" content="width=device-width, height=device-height, initial-scale=1.0, user-scalable=no"/>
|
||||
<link rel="stylesheet" href="{{ static_asset('assets/css/vendors.css') }}">
|
||||
<link rel="stylesheet" href="{{ static_asset('assets/css/aiz-core.css') }}">
|
||||
<link rel="stylesheet" href="{{ static_asset('assets/css/custom-style.css') }}">
|
||||
</head>
|
||||
<body>
|
||||
<section class="py-4 mb-4 bg-light">
|
||||
<div class="container text-center">
|
||||
<form action="{{route('api.bkash.checkout',['token'=>$token,'amount'=>$amount])}}" method="get">
|
||||
<button id="bKash_button" class="d-none">Pay With bKash</button>
|
||||
</form>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- SCRIPTS -->
|
||||
<script src="{{ static_asset('assets/js/vendors.js') }}"></script>
|
||||
|
||||
@if (get_setting('bkash_sandbox') == 1)
|
||||
<script src="https://scripts.sandbox.bka.sh/versions/1.2.0-beta/checkout/bKash-checkout-sandbox.js"></script>
|
||||
@else
|
||||
<script src="https://scripts.pay.bka.sh/versions/1.2.0-beta/checkout/bKash-checkout.js"></script>
|
||||
@endif
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
$(document).ready(function(){
|
||||
$('#bKash_button').trigger('click');
|
||||
});
|
||||
|
||||
|
||||
|
||||
/* var paymentID = '';
|
||||
bKash.init({
|
||||
paymentMode: 'checkout', //fixed value ‘checkout’
|
||||
//paymentRequest format: {amount: AMOUNT, intent: INTENT}
|
||||
//intent options
|
||||
//1) ‘sale’ – immediate transaction (2 API calls)
|
||||
//2) ‘authorization’ – deferred transaction (3 API calls)
|
||||
paymentRequest: {
|
||||
amount: '{{ $amount }}', //max two decimal points allowed
|
||||
intent: 'sale'
|
||||
},
|
||||
createRequest: function(request) { //request object is basically the paymentRequest object, automatically pushed by the script in createRequest method
|
||||
$.ajax({
|
||||
url: '{{ route('api.bkash.checkout',['token'=>$token, 'amount'=>$amount]) }}',
|
||||
type: 'POST',
|
||||
contentType: 'application/json',
|
||||
success: function(data) {
|
||||
|
||||
data = JSON.parse(data);
|
||||
if (data && data.paymentID != null) {
|
||||
paymentID = data.paymentID;
|
||||
bKash.create().onSuccess(data); //pass the whole response data in bKash.create().onSucess() method as a parameter
|
||||
} else {
|
||||
|
||||
alert(data.errorMessage);
|
||||
bKash.create().onError();
|
||||
}
|
||||
},
|
||||
error: function() {
|
||||
bKash.create().onError();
|
||||
}
|
||||
});
|
||||
},
|
||||
executeRequestOnAuthorization: function() {
|
||||
$.ajax({
|
||||
url: '{{ route('api.bkash.execute', $token) }}',
|
||||
type: 'POST',
|
||||
contentType: 'application/json',
|
||||
data: JSON.stringify({
|
||||
"paymentID": paymentID
|
||||
}),
|
||||
success: function(data) {
|
||||
console.log('execute s');
|
||||
console.log(data);
|
||||
console.log('execute en');
|
||||
var result = JSON.parse(data);
|
||||
if (result && result.paymentID != null) {
|
||||
window.location.href = "{{ route('api.bkash.success') }}?payment_details="+data; //Merchant’s success page
|
||||
} else {
|
||||
alert(result.errorMessage);
|
||||
bKash.execute().onError();
|
||||
}
|
||||
},
|
||||
error: function() {
|
||||
bKash.execute().onError();
|
||||
}
|
||||
});
|
||||
}
|
||||
});*/
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
BIN
desarrollo2/resources/views/frontend/payment/desktop.ini
Normal file
BIN
desarrollo2/resources/views/frontend/payment/desktop.ini
Normal file
Binary file not shown.
@@ -0,0 +1,91 @@
|
||||
@php
|
||||
|
||||
require base_path('/vendor/autoload.php');
|
||||
|
||||
MercadoPago\SDK::setAccessToken(config('mercadopago.access'));
|
||||
|
||||
$preference = new MercadoPago\Preference();
|
||||
|
||||
$payer = new MercadoPago\Payer();
|
||||
$payer->name = $first_name;
|
||||
$payer->email = $email;
|
||||
$payer->phone = array(
|
||||
"area_code" => "",
|
||||
"number" => $phone
|
||||
);
|
||||
|
||||
// Crea un ítem en la preferencia
|
||||
|
||||
$item = new MercadoPago\Item();
|
||||
$item->title = $billname;
|
||||
$item->quantity = 1;
|
||||
$item->unit_price = $amount;
|
||||
$preference->payer = $payer;
|
||||
$preference->items = array($item);
|
||||
|
||||
$preference->back_urls = array(
|
||||
"success" => $success_url,
|
||||
"failure" => $fail_url,
|
||||
"pending" => $fail_url
|
||||
);
|
||||
|
||||
$preference->save();
|
||||
|
||||
@endphp
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Mercadopago Payment</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<style>
|
||||
.loader {
|
||||
border: 16px solid #f3f3f3;
|
||||
border-radius: 50%;
|
||||
border-top: 16px solid #3498db;
|
||||
width: 120px;
|
||||
height: 120px;
|
||||
-webkit-animation: spin 2s linear infinite; /* Safari */
|
||||
animation: spin 2s linear infinite;
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
/* Safari */
|
||||
@-webkit-keyframes spin {
|
||||
0% { -webkit-transform: rotate(0deg); }
|
||||
100% { -webkit-transform: rotate(360deg); }
|
||||
}
|
||||
|
||||
@keyframes spin {
|
||||
0% { transform: rotate(0deg); }
|
||||
100% { transform: rotate(360deg); }
|
||||
}
|
||||
</style>
|
||||
<script src="https://sdk.mercadopago.com/js/v2"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="cho-container"style="display: none;"></div>
|
||||
<br>
|
||||
<br>
|
||||
<script>
|
||||
// Agrega credenciales de SDK
|
||||
const mp = new MercadoPago('{{ env("MERCADOPAGO_KEY") }}', {
|
||||
locale: "{{ env('MERCADOPAGO_CURRENCY') }}",
|
||||
advancedFraudPrevention:true,
|
||||
});
|
||||
|
||||
// Inicializa el checkout
|
||||
const checkout = mp.checkout({
|
||||
|
||||
preference: {
|
||||
id: '{{ $preference->id }}',
|
||||
},
|
||||
autoOpen: true,
|
||||
render: {
|
||||
container: ".cho-container", // Indica el nombre de la clase donde se mostrará el botón de pago
|
||||
label: "Pagar", // Cambia el texto del botón de pago (opcional)
|
||||
},
|
||||
});
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,86 @@
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<title>Stripe Payment</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<style>
|
||||
.loader {
|
||||
border: 16px solid #f3f3f3;
|
||||
border-radius: 50%;
|
||||
border-top: 16px solid #3498db;
|
||||
width: 120px;
|
||||
height: 120px;
|
||||
-webkit-animation: spin 2s linear infinite;
|
||||
/* Safari */
|
||||
animation: spin 2s linear infinite;
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
/* Safari */
|
||||
@-webkit-keyframes spin {
|
||||
0% {
|
||||
-webkit-transform: rotate(0deg);
|
||||
}
|
||||
|
||||
100% {
|
||||
-webkit-transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes spin {
|
||||
0% {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
|
||||
100% {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<script src="https://js.stripe.com/v3/"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<button id="checkout-button" style="display: none;"></button>
|
||||
<div class="loader"></div>
|
||||
<br>
|
||||
<br>
|
||||
<p style="width: 250px; margin: auto;">Don't close the tab. The payment is being processed . . .</p>
|
||||
<script type="text/javascript">
|
||||
// Create an instance of the Stripe object with your publishable API key
|
||||
var stripe = Stripe('{{ env('STRIPE_KEY') }}');
|
||||
var checkoutButton = document.getElementById('checkout-button');
|
||||
|
||||
checkoutButton.addEventListener('click', function() {
|
||||
// Create a new Checkout Session using the server-side endpoint you
|
||||
// created in step 3.
|
||||
fetch('{{ route('stripe.get_token') }}', {
|
||||
method: 'POST',
|
||||
})
|
||||
.then(function(response) {
|
||||
return response.json();
|
||||
})
|
||||
.then(function(session) {
|
||||
return stripe.redirectToCheckout({
|
||||
sessionId: session.id
|
||||
});
|
||||
})
|
||||
.then(function(result) {
|
||||
console.log(result);
|
||||
// If `redirectToCheckout` fails due to a browser or network
|
||||
// error, you should display the localized error message to your
|
||||
// customer using `error.message`.
|
||||
if (result.error) {
|
||||
alert(result.error.message);
|
||||
}
|
||||
})
|
||||
.catch(function(error) {
|
||||
console.error('Error:', error);
|
||||
});
|
||||
});
|
||||
|
||||
document.getElementById("checkout-button").click();
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -0,0 +1,90 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Stripe Payment</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<style>
|
||||
.loader {
|
||||
border: 16px solid #f3f3f3;
|
||||
border-radius: 50%;
|
||||
border-top: 16px solid #3498db;
|
||||
width: 120px;
|
||||
height: 120px;
|
||||
-webkit-animation: spin 2s linear infinite; /* Safari */
|
||||
animation: spin 2s linear infinite;
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
/* Safari */
|
||||
@-webkit-keyframes spin {
|
||||
0% {
|
||||
-webkit-transform: rotate(0deg);
|
||||
}
|
||||
100% {
|
||||
-webkit-transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes spin {
|
||||
0% {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
100% {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<script src="https://js.stripe.com/v3/"></script>
|
||||
</head>
|
||||
<body>
|
||||
<button id="checkout-button" style="display: none;"></button>
|
||||
<div class="loader"></div>
|
||||
<br>
|
||||
<br>
|
||||
<p style="width: 250px; margin: auto;">Don't close the tab. The payment is being processed . . .</p>
|
||||
<script type="text/javascript">
|
||||
// Create an instance of the Stripe object with your publishable API key
|
||||
var stripe = Stripe('{{ env("STRIPE_KEY") }}');
|
||||
var checkoutButton = document.getElementById('checkout-button');
|
||||
|
||||
checkoutButton.addEventListener('click', function () {
|
||||
// Create a new Checkout Session using the server-side endpoint you
|
||||
// created in step 3.
|
||||
const data = {
|
||||
payment_type: '{{$payment_type}}',
|
||||
combined_order_id: '{{$combined_order_id}}',
|
||||
amount: '{{$amount}}',
|
||||
user_id: '{{$user_id}}',
|
||||
package_id: '{{$package_id}}'
|
||||
};
|
||||
fetch('{{ route('api.stripe.get_token') }}', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify(data),
|
||||
})
|
||||
.then(function (response) {
|
||||
return response.json();
|
||||
})
|
||||
.then(function (session) {
|
||||
return stripe.redirectToCheckout({sessionId: session.id});
|
||||
})
|
||||
.then(function (result) {
|
||||
console.log(result);
|
||||
// If `redirectToCheckout` fails due to a browser or network
|
||||
// error, you should display the localized error message to your
|
||||
// customer using `error.message`.
|
||||
if (result.error) {
|
||||
alert(result.error.message);
|
||||
}
|
||||
})
|
||||
.catch(function (error) {
|
||||
alert(error.message);
|
||||
console.error('Error:', error);
|
||||
});
|
||||
});
|
||||
|
||||
document.getElementById("checkout-button").click();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user