Skip to content

Commit e30d4e7

Browse files
committed
Added ItnValidator::flush() method.
1 parent 1527903 commit e30d4e7

2 files changed

Lines changed: 14 additions & 4 deletions

File tree

README.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,13 +130,12 @@ class PayFastController
130130
{
131131
public function webhook(Request $request)
132132
{
133-
// From the PayFast docs... Send a 200 response right away...
134-
header('HTTP/1.0 200 OK');
135-
flush();
136-
137133
// Create a new validator
138134
$validator = new \TPG\PayFast\ItnValidator($request->input());
139135

136+
// From the PayFast docs... Send a 200 response right away...
137+
$validator->flush();
138+
140139
// You have access to all the response data through the `PayfastResponse` class.
141140
$response = $validator->response();
142141

src/ItnValidator.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,17 @@ public function __construct(array $responseData)
2121
$this->response = new PayFastResponse($responseData);
2222
}
2323

24+
/**
25+
* @deprecated Version 1 will flush on ItnValidator construction. Won't need to call this at all.
26+
*/
27+
public function flush(): self
28+
{
29+
header('HTTP/1.0 200 OK');
30+
flush();
31+
32+
return $this;
33+
}
34+
2435
public function testing(bool $testing = true): self
2536
{
2637
$this->testing = $testing;

0 commit comments

Comments
 (0)