/
callUpdateOrderS2S.php
122 lines (102 loc) · 2.91 KB
/
callUpdateOrderS2S.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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
<!DOCTYPE HTML>
<html>
<head>
<style>
html, body {
margin: 0;
padding: 0;
}
.error {
width: 100%;
margin: 0;
border-bottom: 1px solid black;
background-color: #FFEC8B;
text-align: center;
font-size: 1em;
font-weight: bold;
color: red;
padding: 0;
}
</style>
</head>
<body>
<?php
/**
* Created by Gestpay.
* Date: 09/03/17
* Time: 12:32
*
* This example shows a way to use CallUpdateOrderS2S with the minimum required parameters.
* the API: http://api.gestpay.it/#CallUpdateOrderS2S
*
*/
//display errors.
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
/*****************************************************************
* TEST ENVIRONMENT: if set to false, this example will launch
* against the production server.
*****************************************************************/
$testEnv = true;
/*****************************************************************
* INPUT DATA
*****************************************************************/
$shopLogin = 'GESPAY65987';
//$shopTransactionId = null;
$bankTransactionId = '112';
$OrderDetails = array(
'CustomerDetail' => array(
'FirstName' => 'Peppa',
'Lastname' => 'Pig'
)
);
/****************************************************************
* CREATING SOAP ARGUMENTS
* The $param variable will contain the argument for the S2S call.
* If you add more parameters you must add them here.
****************************************************************/
//Set up the parameters array. This array will be the argument for the SOAP call.
$param = array(
'shopLogin' => $shopLogin,
'bankTransactionId' => $bankTransactionId,
'OrderDetails' => $OrderDetails
);
/****************************************************************
* CALL CallUpdateOrderS2S
****************************************************************/
//setting up the WSDL url
$wsdl = "https://ecomms2s.sella.it/gestpay/gestpayws/WSs2s.asmx?WSDL";
if ($testEnv) {
//Test
$wsdl = "https://testecomm.sella.it/gestpay/gestpayws/WSs2s.asmx?WSDL";
}
//Soap client
$client = new SoapClient($wsdl);
//do the call to Encrypt method
try {
$objectResult = $client->CallUpdateOrderS2S($param);
} //catch SOAP exceptions
catch (SoapFault $fault) {
die($fault);
}
//parse the XML result
$result = simplexml_load_string($objectResult->CallUpdateOrderS2SResult->any);
//Error Check
$errCode = (string)$result->ErrorCode;
$errDesc = (string)$result->ErrorDescription;
if ($errCode != "0") {
//An error has occurred; check ErrorCode and ErrorDescription
echo '<div class="error">Error: ';
echo $errCode;
echo '<br>ErrorDesc: ';
echo $errDesc;
echo '</div>';
}
//this is the output
echo '<pre>';
print_r($result);
echo '</pre>';
?>
</body>
</html>