-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnotify.php
36 lines (27 loc) · 915 Bytes
/
notify.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
<?php
/**
* Payment Response
* Automatic response send by Sips server
* Tips: Debug or show $_REQUEST with "echo http_build_query($_REQUEST);"
*/
require 'config/config.php';
require 'vendor/autoload.php';
require 'helper/debug.php';
use Sips\Passphrase;
use Sips\PaymentResponse;
use Sips\ShaComposer\AllParametersShaComposer;
// Log cfg
$path = 'logs/sips_notify.log';
// Payment return
$paymentResponse = new PaymentResponse($_REQUEST);
$passphrase = new Passphrase($sips_config['secretKey']);
$shaComposer = new AllParametersShaComposer($passphrase);
if ($paymentResponse->isValid($shaComposer) && $paymentResponse->isSuccessful()) {
// handle payment confirmation
$message = 'Success => '.$paymentResponse->getResponseMsg();
} else {
// perform logic when the validation fails
$message = 'Error => '.$paymentResponse->getResponseMsg();
}
// Log response
write_log($path, $message);