-
Notifications
You must be signed in to change notification settings - Fork 0
/
novalnet_auto_config.php
73 lines (64 loc) · 2.82 KB
/
novalnet_auto_config.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
<?php
/**
* NOTICE OF LICENSE
*
* This source file is subject to Novalnet End User License Agreement
*
* DISCLAIMER
*
* If you wish to customize Novalnet payment extension for your needs, please contact [email protected] for more information.
*
* @author Novalnet AG
* @copyright Novalnet
* @license https://www.novalnet.de/payment-plugins/kostenlos/lizenz
*
* Script : auto_config.php
*
*/
$request = array_map('trim', $_REQUEST);
$config = new AutoConfig();
$config->sendRequest($request);
class AutoConfig {
public function sendRequest($data)
{
$request = http_build_query($data);
$ch = curl_init('https://payport.novalnet.de/autoconfig');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $request);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, '240');
$response = curl_exec($ch);
curl_close($ch);
$response = json_decode($response);
$jsonerror = json_last_error();
if (empty($jsonerror))
{
if (isset($response->status) && $response->status == '100') {
$merchant_details = array(
'auto_key' => $data['hash'],
'vendor_id' => $response->vendor,
'auth_code' => $response->auth_code,
'product_id' => $response->product,
'access_key' => $response->access_key,
'test_mode' => $response->test_mode,
'tariff' => $response->tariff,
'payment_type' => $response->payment,
'notify_url' => $response->notify_url,
);
echo json_encode($merchant_details);
exit();
} elseif (isset($response->status) && $response->status == '106') {
$result = 'You need to configure your outgoing server IP address '.$_SERVER['REMOTE_ADDR'].' at Novalnet. Please configure it in Novalnet admin portal or contact [email protected]';
} else {
$result = !empty($response->config_result) ? $response->config_result : $response->status_desc;
}
echo json_encode(array('status_desc' => $result));
exit();
}
}
}
?>