Skip to content

Commit

Permalink
Merge pull request #18 from majidfeiz/add-paystar-gateway
Browse files Browse the repository at this point in the history
Add paystar gateway
  • Loading branch information
omalizadeh committed Oct 23, 2023
2 parents 21dbf19 + 6bdfeba commit b23645c
Show file tree
Hide file tree
Showing 7 changed files with 338 additions and 19 deletions.
1 change: 1 addition & 0 deletions README-FA.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
- [آیدی پی](https://idpay.ir)
- [زیبال](https://zibal.ir)
- [شبکه پرداخت پی](https://pay.ir)
- [پی استار](https://paystar.ir)

## نصب

Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ Supports laravel **v8.0+** and requires php **v8.1+**
- [IDPay](https://idpay.ir)
- [Pay.ir](https://pay.ir)
- [Zibal](https://zibal.ir)
- [PayStar](https://paystar.ir)


## Installation & Configuration

Expand Down
29 changes: 29 additions & 0 deletions config/gateway_paystar.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

return [

/**
* driver class namespace.
*/
'driver' => Omalizadeh\MultiPayment\Drivers\Paystar\Paystar::class,

/**
* gateway configurations.
*/
'main' => [
'gateway_id' => '',
'secret_key' => '', // If you use sign is true fill this value, It's your gateway secret key for generate sign
'type' => '', // Type is required => direct | pardakht
'use_sign' => false,
'callback' => 'https://yoursite.com/path/to',
'description' => 'payment using Paystar',
],
'other' => [
'gateway_id' => '',
'secret_key' => '',
'type' => '',
'use_sign' => false,
'callback' => 'https://yoursite.com/path/to',
'description' => 'payment using Paystar',
],
];
2 changes: 1 addition & 1 deletion config/multipayment.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* set default gateway.
*
* valid pattern --> GATEWAY_NAME.GATEWAY_CONFIG_KEY
* valid GATEWAY_NAME --> zarinpal, saman, mellat, novin, parsian, pasargad, zibal, payir, idpay
* valid GATEWAY_NAME --> zarinpal, saman, mellat, novin, parsian, pasargad, zibal, payir, idpay, paystar
*/
'default_gateway' => env('DEFAULT_PAYMENT_GATEWAY', 'zarinpal.main'),

Expand Down
70 changes: 52 additions & 18 deletions resources/views/redirect_to_gateway.blade.php
Original file line number Diff line number Diff line change
@@ -1,22 +1,25 @@
<!DOCTYPE html>
<html lang="fa">
<html lang="en">

<head>
<title>انتقال به درگاه پرداخت</title>
<meta charset="UTF-8">
<title>درحال انتقال به درگاه پرداخت</title>
<style>
.message {
.text-center {
text-align: center;
margin-top: 4em;
font-size: 24px;
font-weight: bold;
}
.mt-2 {
margin-top: 2em;
}
.spinner {
margin: 50px auto 0;
margin: 100px auto 0;
width: 70px;
text-align: center;
}
.spinner > div {
.spinner>div {
width: 18px;
height: 18px;
background-color: #333;
Expand All @@ -37,49 +40,80 @@
}
@-webkit-keyframes sk-bouncedelay {
0%,
80%,
100% {
-webkit-transform: scale(0)
}
40% {
-webkit-transform: scale(1.0)
}
}
@keyframes sk-bouncedelay {
0%,
80%,
100% {
-webkit-transform: scale(0);
transform: scale(0);
}
40% {
-webkit-transform: scale(1.0);
transform: scale(1.0);
}
}
</style>
</head>
<body dir="rtl" onload="submitForm()">
<div class="message">در حال انتقال به درگاه پرداخت. لطفا چند ثانیه صبر کنید...</div>

<body onload="submitForm();">
<div class="spinner">
<div class="bounce1"></div>
<div class="bounce2"></div>
<div class="bounce3"></div>
</div>
<form id="hidden-form" action="@php htmlentities($action) @endphp" method="@php $method @endphp">
@foreach($inputs as $key => $value)
<input type="hidden" name="@php $key @endphp" value="@php $value @endphp">
@endforeach
</form>
<form class="text-center mt-2" method="<?php echo htmlentities($method) ?>"
action="<?php echo htmlentities($action) ?>">
<p>در حال انتقال به درگاه پرداخت</p>
<p>
اگر بصورت اتوماتیک به درگاه منتقل نشدید بعد از
<span id="countdown">10</span>
ثانیه ...
</p>

<?php foreach ($inputs as $name => $value): ?>
<input type="hidden" name="<?php echo htmlentities($name) ?>" value="<?php echo htmlentities($value) ?>">
<?php endforeach; ?>

<button type="submit">کلیک کنید</button>
</form>
<script>
// Total seconds to wait
var seconds = 10;
function submitForm() {
document.getElementById("hidden-form").submit();
document.forms[0].submit();
}
</script>
function countdown() {
seconds = seconds - 1;
if (seconds <= 0) {
// submit the form
submitForm();
} else {
// Update remaining seconds
document.getElementById("countdown").innerHTML = seconds;
// Count down using javascript
window.setTimeout("countdown()", 1000);
}
}
// Run countdown function
countdown();
</script>
</body>

</html>

0 comments on commit b23645c

Please sign in to comment.