-
Notifications
You must be signed in to change notification settings - Fork 40
/
pagarme.php
executable file
·53 lines (36 loc) · 1.02 KB
/
pagarme.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
<?php
// 2019: This never worked. I ended up using Paypal. I'm keeping this here anyway
require 'config.php';
require '/var/www/classes/Session.class.php';
require '/var/www/classes/Player.class.php';
require '/var/www/classes/System.class.php';
require '/var/www/classes/Premium.class.php';
$session = new Session();
$system = new System();
$premium = new Premium();
if($_SERVER['REQUEST_METHOD'] != 'POST' || !isset($_POST)){
exit();
}
if(!isset($_POST['id']) || !isset($_POST['fingerprint'])){
exit();
}
require 'pagarme-php/Pagarme.php';
Pagarme::setApiKey("REDACTED");
$premium->debug();
$id = $_POST['id'];
$fingerprint = $_POST['fingerprint'];
if(!PagarMe::validateFingerprint($id, $fingerprint)) {
//TODO: report
exit();
}
$status = $_POST['current_status'];
if($status == 'paid'){
$premium->setAsPaid($id);
} else {
if(isset($_POST['refuse_reason'])){
$reason = $_POST['refuse_reason'];
} else {
$reason = '';
}
$premium->refused($id, $reason);
}