-
Notifications
You must be signed in to change notification settings - Fork 0
/
request.php
45 lines (31 loc) · 886 Bytes
/
request.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
<?php
if (!isset($_COOKIE["ambient"])) {
exit;
}
include '../../../wp-load.php';
require_once( __DIR__ . "/libwebpay/healthcheck.php");
$type = $_POST['type'];
switch($type)
{
case 'checkInit':
$response = [];
$arg = [
'MODO' => $_POST['MODE'],
'COMMERCE_CODE' => $_POST['C_CODE'],
'PUBLIC_CERT' => $_POST['PUBLIC_CERT'],
'PRIVATE_KEY' => $_POST['PRIVATE_KEY'],
'WEBPAY_CERT' => $_POST['WEBPAY_CERT'],
'ECOMMERCE' => 'woocommerce'
];
$healthcheck = new HealthCheck($arg);
try
{
$response = $healthcheck->getInitTransaction();
echo json_encode(['success' => true, 'msg' => json_decode($response)]);
}
catch (Exception $e)
{
echo json_encode(['success' => false, 'msg' => $e->getMessage()]);
}
break;
}