@@ -16,24 +16,37 @@ class Signhost
16
16
*/
17
17
private $ client ;
18
18
19
+ /**
20
+ * Signhost constructor.
21
+ *
22
+ * @param $appName
23
+ * @param $appKey
24
+ * @param $apiKey
25
+ * @param null $sharedSecret
26
+ * @param string $environment
27
+ */
19
28
public function __construct ($ appName , $ appKey , $ apiKey , $ sharedSecret = null , $ environment = 'production ' )
20
29
{
21
30
$ this ->client = new SignhostClient ($ appName , $ appKey , $ apiKey , $ sharedSecret , $ environment );
22
31
}
23
32
24
33
/**
34
+ * createTransaction
35
+ *
25
36
* @param $transaction
26
37
* @return mixed
27
38
* @throws SignHostException
28
39
*/
29
- public function CreateTransaction ($ transaction )
40
+ public function createTransaction ($ transaction )
30
41
{
31
42
$ response = $ this ->client ->execute ("/transaction " , "POST " , $ transaction );
32
43
33
44
return json_decode ($ response );
34
45
}
35
46
36
47
/**
48
+ * getTransaction
49
+ *
37
50
* @param $transactionId
38
51
* @return mixed
39
52
* @throws SignHostException
@@ -46,6 +59,8 @@ public function GetTransaction($transactionId)
46
59
}
47
60
48
61
/**
62
+ * deleteTransaction
63
+ *
49
64
* @param $transactionId
50
65
* @return mixed
51
66
* @throws SignHostException
@@ -58,6 +73,8 @@ public function DeleteTransaction($transactionId)
58
73
}
59
74
60
75
/**
76
+ * startTransaction
77
+ *
61
78
* @param $transactionId
62
79
* @return mixed
63
80
* @throws SignHostException
@@ -70,6 +87,8 @@ public function StartTransaction($transactionId)
70
87
}
71
88
72
89
/**
90
+ * addOrReplaceFile
91
+ *
73
92
* @param $transactionId
74
93
* @param $fileId
75
94
* @param $filePath
@@ -85,6 +104,8 @@ public function AddOrReplaceFile($transactionId, $fileId, $filePath)
85
104
}
86
105
87
106
/**
107
+ * addOrReplaceMetadata
108
+ *
88
109
* @param $transactionId
89
110
* @param $fileId
90
111
* @param $metadata
@@ -99,38 +120,44 @@ public function AddOrReplaceMetadata($transactionId, $fileId, $metadata)
99
120
}
100
121
101
122
/**
123
+ * getReceipt
124
+ *
102
125
* @param $transactionId
103
126
* @return stream
104
127
* @throws SignHostException
105
128
*/
106
- public function GetReceipt ($ transactionId )
129
+ public function getReceipt ($ transactionId )
107
130
{
108
131
$ response = $ this ->client ->execute ("/file/receipt/ " . $ transactionId , "GET " );
109
132
110
133
return $ response ;
111
134
}
112
135
113
136
/**
137
+ * getDocument
138
+ *
114
139
* @param $transactionId
115
140
* @param $fileId
116
141
* @return stream
117
142
* @throws SignHostException
118
143
*/
119
- public function GetDocument ($ transactionId , $ fileId )
144
+ public function getDocument ($ transactionId , $ fileId )
120
145
{
121
146
$ response = $ this ->execute ("/transaction/ " . $ transactionId . "/file/ " . rawurlencode ($ fileId ), "GET " );
122
147
123
148
return $ response ;
124
149
}
125
150
126
151
/**
152
+ * validateChecksum
153
+ *
127
154
* @param $masterTransactionId
128
155
* @param $fileId
129
156
* @param $status
130
157
* @param $remoteChecksum
131
158
* @return bool
132
159
*/
133
- public function ValidateChecksum ($ masterTransactionId , $ fileId , $ status , $ remoteChecksum )
160
+ public function validateChecksum ($ masterTransactionId , $ fileId , $ status , $ remoteChecksum )
134
161
{
135
162
$ localChecksum = sha1 ($ masterTransactionId . "| " . $ fileId . "| " . $ status . "| " . $ this ->SharedSecret );
136
163
@@ -140,4 +167,28 @@ public function ValidateChecksum($masterTransactionId, $fileId, $status, $remote
140
167
141
168
return hash_equals ($ remoteChecksum , $ localChecksum );
142
169
}
170
+
171
+ /**
172
+ * setIgnoreStatusCode
173
+ *
174
+ * @param $ignoreStatusCode
175
+ * @return SignHost
176
+ */
177
+ public function setIgnoreStatusCode ($ ignoreStatusCode )
178
+ {
179
+ $ this ->client ->setIgnoreStatusCode ($ ignoreStatusCode );
180
+ return $ this ;
181
+ }
182
+
183
+ /**
184
+ * setCaInfoPath
185
+ *
186
+ * @param $filePath
187
+ * @return SignHost
188
+ */
189
+ public function setCaInfoPath ($ filePath )
190
+ {
191
+ $ this ->client ->setCaInfoPath ($ filePath );
192
+ return $ this ;
193
+ }
143
194
}
0 commit comments