-
Notifications
You must be signed in to change notification settings - Fork 1
/
PaypalIPNHandlerModel.php
91 lines (76 loc) · 2.79 KB
/
PaypalIPNHandlerModel.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
<?php
define('DATABASE_NAME', '');
define('DATABASE_USER', '');
define('DATABASE_PASS', '}');
define('DATABASE_HOST', '');
require_once './DBPDO.php';
class PaypalIPNHandlerModel {
function __construct() {
$this->DB = new DBPDO();
}
public function getUserByEmail( $email ){
}
public function isSubscriptionActive( $paymentMail ){
$query = $this->DB->fetchAll('SELECT * FROM subscriptionCancelations WHERE deleted=0 AND paymentMail="'. $paymentMail .'"');
if( count( $query ) > 0 ){
return false;
} else {
$query = $this->DB->fetchAll( 'SELECT * FROM subscriptionUpdates WHERE paymentMail="'. $paymentMail . '"');
if( count( $query ) > 0 ){
return true;
} else {
return false;
}
}
}
public function addCancelation( $paymentMail, $transactionId ){
$this->DB->execute( 'INSERT INTO subscriptionCancelations (paymentMail, transactionId, deleted) VALUES ("'.$paymentMail.'", "'. $transactionId .'", 0 )');
}
public function removeCancelations( $paymentMail ){
$this->DB->execute( 'UPDATE subscriptionCancelations SET deleted=1 WHERE paymentMail="'. $paymentMail .'"');
}
public function addSubscriptionUpdate(
$paymentMail,
$transactionId,
$firstName,
$lastName,
$userCountry,
$userCiy,
$transactionType,
$transactionDate,
$subscriptionType,
$ipnTrackId,
$itemName
){
$this->DB->execute(
'INSERT INTO subscriptionUpdates
(
paymentMail,
transactionId,
firstName,
lastName,
userCountry,
userCity,
transactionType,
transactionDate,
subscriptionType,
ipnTrackId,
itemName
)
VALUES ("'
.$paymentMail.'", "'
.$transactionId.'", "'
.$firstName.'", "'
.$lastName.'", "'
.$userCountry.'", "'
.$userCity.'", "'
.$transactionType.'", "'
.$transactionDate.'", "'
.$subscriptionType.'", "'
.$ipnTrackId.'", "'
.$itemName
.'" )'
);
}
}
?>