-
Notifications
You must be signed in to change notification settings - Fork 1
/
PublicController.php
43 lines (32 loc) · 1.04 KB
/
PublicController.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php
/**
* @package ImpressPages
*/
namespace Plugin\PayPalSubscription;
class PublicController extends \Ip\Controller
{
public function ipn()
{
$this->processPayPalNotification();
}
public function userBack()
{
$this->processPayPalNotification();
$customData = json_decode(ipRequest()->getPost('custom'), true);
if (empty($customData['paymentId'])) {
throw new \Ip\Exception("Unknown order ID");
}
if (empty($customData['securityCode'])) {
throw new \Ip\Exception("Unknown order security code");
}
$response = PayPalModel::instance()->successStatusPage($customData['paymentId'], $customData['securityCode']);
return $response;
}
protected function processPayPalNotification()
{
$paypalModel = PayPalModel::instance();
$postData = ipRequest()->getPost();
ipLog()->info('PayPalSubscription.ipn: PayPal notification', $postData);
$paypalModel->processPayPalCallback($postData);
}
}