Skip to content

Commit

Permalink
Refactoring IPN Response code
Browse files Browse the repository at this point in the history
  • Loading branch information
srmklive committed Jan 5, 2017
1 parent 840fa20 commit 9633ff7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 13 deletions.
11 changes: 3 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -351,14 +351,9 @@ Suppose you have set IPN URL to **http://example.com/ipn/notify/** in PayPal. To
*/
public function postNotify(Request $request)
{
$request->merge(['cmd' => '_notify-validate']);
$post = $request->all();

$response = $this->verifyIPN($post);

session([
'ipn' => $response
]);
$response = $this->parsePayPalIPN($request);

// Parse IPN response accordingly to your requirements.
}
```

Expand Down
8 changes: 3 additions & 5 deletions src/Traits/IPNResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,13 @@ trait IPNResponse
* Retrieve IPN Response From PayPal.
*
* @param \Illuminate\Http\Request $request
* @return array
*/
public function postNotify(Request $request)
protected function parsePayPalIPN(Request $request)
{
$request->merge(['cmd' => '_notify-validate']);
$post = $request->all();
$response = $this->verifyIPN($post);

session([
'ipn' => $response,
]);
return $this->verifyIPN($post);
}
}

0 comments on commit 9633ff7

Please sign in to comment.