Skip to content

Commit

Permalink
logo upload feature
Browse files Browse the repository at this point in the history
logo upload feature
  • Loading branch information
wontone18 committed May 5, 2024
1 parent 824e4f3 commit 95ffe8e
Show file tree
Hide file tree
Showing 3 changed files with 81 additions and 9 deletions.
16 changes: 12 additions & 4 deletions src/Config/system.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,34 @@
'title' => 'RazorPay Payment Gateway',
'type' => 'text',
'validation' => 'required',
'channel_based' => false,
'channel_based' => true,
'locale_based' => true,
], [
'name' => 'description',
'title' => '',
'type' => 'textarea',
'channel_based' => false,
'channel_based' => true,
'locale_based' => true,
],
[
'name' => 'image',
'title' => 'Logo',
'type' => 'image',
'channel_based' => false,
'locale_based' => false,
'validation' => 'mimes:bmp,jpeg,jpg,png,webp',
],
[
'name' => 'key_id',
'title' => 'key-id',
'title' => 'key id',
'type' => 'text',
'validation' => 'required',
'channel_based' => false,
'locale_based' => true,
],
[
'name' => 'secret',
'title' => 'key-secret',
'title' => 'key secret',
'type' => 'text',
'validation' => 'required',
'channel_based' => false,
Expand Down
29 changes: 28 additions & 1 deletion src/Payment/Razorpay.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Wontonee\Razorpay\Payment;

use Webkul\Payment\Payment\Payment;
use Illuminate\Support\Facades\Storage;

class Razorpay extends Payment
{
Expand All @@ -16,6 +17,32 @@ class Razorpay extends Payment
public function getRedirectUrl()
{
return route('razorpay.process');
}

/**
* Is available.
*
* @return bool
*/
public function isAvailable()
{
if (!$this->cart) {
$this->setCart();
}

return $this->getConfigData('active') && $this->cart?->haveStockableItems();
}

/**
* Get payment method image.
*
* @return array
*/
public function getImage()
{
$url = $this->getConfigData('image');

return $url ? Storage::url($url) : '';

}
}
}
45 changes: 41 additions & 4 deletions src/Resources/views/razorpay-redirect.blade.php
Original file line number Diff line number Diff line change
@@ -1,19 +1,55 @@
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Razorpay Gateway</title>
<style>
body {
display: flex;
flex-direction: column;
align-items: center;
height: 100vh;
margin: 0;
justify-content: flex-start;
}
.message {
text-align: center;
margin-top: 20px;
/* Adjust margin-top as needed */
animation: slideIn 1s ease-out forwards;
/* Animation */
}
@keyframes slideIn {
0% {
transform: translateY(-50px);
opacity: 0;
}
100% {
transform: translateY(0);
opacity: 1;
}
}
</style>
</head>

<body>
<form name='razorpayform' action="razorpaycheck" method="POST">
<div class="message">
<strong>Note: Don't close this window or refresh it. After processing the payment, wait for
redirection...</strong>
</div>
<input type="hidden" name="razorpay_payment_id" id="razorpay_payment_id">
<input type="hidden" name="razorpay_signature" id="razorpay_signature" >
<input type="hidden" name="razorpay_signature" id="razorpay_signature">
</form>
<script src="https://checkout.razorpay.com/v1/checkout.js"></script>
<script>
// Checkout details as a json
<script>
// Checkout details as a json
var options = <?php echo $json?>;
/**
Expand Down Expand Up @@ -49,6 +85,7 @@
event.preventDefault();
}
</script>
</script>
</body>

</html>

0 comments on commit 95ffe8e

Please sign in to comment.