Skip to content

Commit c36f33a

Browse files
author
Hashemi Rafsan
committed
update helpers
1 parent d16f47e commit c36f33a

File tree

3 files changed

+20
-17
lines changed

3 files changed

+20
-17
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.idea

composer.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
"type": "library",
66
"require": {
77
"php": ">=5.5.9",
8-
"guzzlehttp/guzzle": "^6.2",
9-
"laravelcollective/html": "^5.4.0"
8+
"guzzlehttp/guzzle": "^6.2"
109
},
1110

1211
"license": "CC(1.0)",

src/helpers.php

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,26 @@
11
<?php
22
use \Shipu\SslWPayment\Payment;
33

4-
function ssl_wireless_post_button($input, $amount , $buttonText = 'Payment', $class = '') {
5-
return \Form::open([
6-
'method' => 'POST',
7-
'url' => ssl_wireless_payment_url(),
8-
'style' => 'display:inline'
9-
]) . ssl_wireless_hidden_input($input, $amount) .
10-
\Form::button($buttonText,
11-
[ 'type' => 'submit', 'class' => $class ]) .
12-
\Form::close();
4+
if (! function_exists('ssl_wireless_post_button')) {
5+
function ssl_wireless_post_button( $input, $amount, $buttonText = 'Payment', $class = '' )
6+
{
7+
return '<form action="'.ssl_wireless_payment_url().'" method="POST" style="display:inline">' .
8+
ssl_wireless_hidden_input($input, $amount) .
9+
'<button type="submit" class="'.$class.'">'.$buttonText.'</button>' .
10+
'</form>';
11+
}
1312
}
1413

15-
function ssl_wireless_hidden_input($input, $amount) {
16-
$payment = new Payment(config('sslwpayment'));
17-
return $payment->customer($input)->amount($amount)->hiddenValue();
14+
if (! function_exists('ssl_wireless_hidden_input')) {
15+
function ssl_wireless_hidden_input($input, $amount) {
16+
$payment = new Payment(config('sslwpayment'));
17+
return $payment->customer($input)->amount($amount)->hiddenValue();
18+
}
1819
}
1920

20-
function ssl_wireless_payment_url() {
21-
$payment = new Payment(config('sslwpayment'));
22-
return $payment->paymentUrl();
21+
if (! function_exists('ssl_wireless_payment_url')) {
22+
function ssl_wireless_payment_url() {
23+
$payment = new Payment(config('sslwpayment'));
24+
return $payment->paymentUrl();
25+
}
2326
}

0 commit comments

Comments
 (0)