Skip to content

Commit 2cc54ad

Browse files
committed
made string the output of generateForm method
1 parent d5856c9 commit 2cc54ad

File tree

9 files changed

+32
-21
lines changed

9 files changed

+32
-21
lines changed

src/Adapter/AdapterAbstract.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ public function getParameters(): array
144144
/**
145145
* @return string
146146
*/
147-
public function form(): \Illuminate\View\View
147+
public function form(): string
148148
{
149149
return $this->generateForm();
150150
}

src/Adapter/AdapterInterface.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ interface AdapterInterface
1111
public function setParameters(array $parameters = []): AdapterInterface;
1212

1313
/**
14-
* @return \Illuminate\View\View
14+
* @return string
1515
*/
16-
public function form(): \Illuminate\View\View;
16+
public function form(): string;
1717

1818
/**
1919
* @return array

src/Adapter/Mellat.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,19 +82,21 @@ protected function requestToken()
8282
}
8383

8484
/**
85-
* @return mixed
85+
* @return string
8686
* @throws Exception
8787
*/
88-
protected function generateForm(): \Illuminate\View\View
88+
protected function generateForm(): string
8989
{
9090
$refId = $this->requestToken();
9191

92-
return view('larapay::mellat-form', [
92+
$form = view('larapay::mellat-form', [
9393
'endPoint' => $this->getEndPoint(),
9494
'refId' => $refId,
9595
'submitLabel' => !empty($this->submit_label) ? $this->submit_label : trans("larapay::larapay.goto_gate"),
9696
'autoSubmit' => boolval($this->auto_submit),
9797
]);
98+
99+
return $form->toHtml();
98100
}
99101

100102
/**

src/Adapter/Parsian.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -179,20 +179,22 @@ private function requestTokenWithSharing($sendParams)
179179
}
180180

181181
/**
182-
* @return mixed
182+
* @return string
183183
* @throws Exception
184184
* @throws \Tartan\Larapay\Adapter\Exception
185185
*/
186-
protected function generateForm(): \Illuminate\View\View
186+
protected function generateForm(): string
187187
{
188188
$authority = $this->requestToken();
189189

190-
return view('larapay::parsian-form', [
190+
$form = view('larapay::parsian-form', [
191191
'endPoint' => $this->getEndPoint(),
192192
'refId' => $authority,
193193
'submitLabel' => !empty($this->submit_label) ? $this->submit_label : trans("larapay::larapay.goto_gate"),
194194
'autoSubmit' => boolval($this->auto_submit),
195195
]);
196+
197+
return $form->toHtml();
196198
}
197199

198200
/**

src/Adapter/Pasargad.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class Pasargad extends AdapterAbstract implements AdapterInterface
3131
* @return string
3232
* @throws Exception
3333
*/
34-
protected function generateForm(): \Illuminate\View\View
34+
protected function generateForm(): string
3535
{
3636
$this->checkRequiredParameters([
3737
'amount',
@@ -56,7 +56,7 @@ protected function generateForm(): \Illuminate\View\View
5656
$data = $processor->sign($data); // امضاي ديجيتال
5757
$sign = base64_encode($data); // base64_encode
5858

59-
return view('larapay::pasargad-form')->with(compact(
59+
$form = view('larapay::pasargad-form')->with(compact(
6060
'url',
6161
'redirectUrl',
6262
'invoiceNumber',
@@ -68,6 +68,8 @@ protected function generateForm(): \Illuminate\View\View
6868
'action',
6969
'sign'
7070
));
71+
72+
return $form->toHtml();
7173
}
7274

7375
/**

src/Adapter/Payir.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,19 +74,20 @@ protected function requestToken(): string
7474

7575

7676
/**
77-
* @return mixed
77+
* @return string
7878
* @throws Exception
7979
* @throws \Tartan\Larapay\Adapter\Exception
8080
*/
81-
protected function generateForm(): \Illuminate\View\View
81+
protected function generateForm(): string
8282
{
8383
$authority = $this->requestToken();
8484

85-
return view('larapay::payir-form', [
85+
$form = view('larapay::payir-form', [
8686
'endPoint' => $this->endPointForm . $authority,
8787
'submitLabel' => !empty($this->submit_label) ? $this->submit_label : trans("larapay::larapay.goto_gate"),
8888
'autoSubmit' => true,
8989
]);
90+
return $form->toHtml();
9091
}
9192

9293
/**

src/Adapter/Saderat.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,19 +122,21 @@ protected function requestToken(): array
122122
}
123123

124124
/**
125-
* @return mixed
125+
* @return string
126126
* @throws Exception
127127
*/
128-
protected function generateForm()
128+
protected function generateForm(): string
129129
{
130130
$token = $this->requestToken();
131131

132-
return view('larapay::saderat-form', [
132+
$form = view('larapay::saderat-form', [
133133
'endPoint' => $this->getEndPoint(),
134134
'token' => $token,
135135
'submitLabel' => !empty($this->submit_label) ? $this->submit_label : trans("larapay::larapay.goto_gate"),
136136
'autoSubmit' => boolval($this->auto_submit)
137137
]);
138+
139+
return $form->toHtml();
138140
}
139141

140142
/**

src/Adapter/Saman.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ protected function requestToken(): string
7676
}
7777
}
7878

79-
public function generateForm(): \Illuminate\View\View
79+
public function generateForm(): string
8080
{
8181
XLog::debug(__METHOD__);
8282

src/Adapter/Zarinpal.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,19 +80,21 @@ protected function requestToken(): string
8080

8181

8282
/**
83-
* @return mixed
83+
* @return string
8484
* @throws Exception
8585
* @throws \Tartan\Larapay\Adapter\Exception
8686
*/
87-
protected function generateForm(): \Illuminate\View\View
87+
protected function generateForm(): string
8888
{
8989
$authority = $this->requestToken();
9090

91-
return view('larapay::zarinpal-form', [
91+
$form = view('larapay::zarinpal-form', [
9292
'endPoint' => strtr($this->getEndPoint(), ['{authority}' => $authority]),
9393
'submitLabel' => !empty($this->submit_label) ? $this->submit_label : trans("larapay::larapay.goto_gate"),
9494
'autoSubmit' => boolval($this->auto_submit),
9595
]);
96+
97+
return $form->toHtml();
9698
}
9799

98100
/**

0 commit comments

Comments
 (0)