-
Notifications
You must be signed in to change notification settings - Fork 848
/
SignatureVerificationException.php
74 lines (66 loc) · 1.59 KB
/
SignatureVerificationException.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
<?php
namespace Stripe\Exception;
/**
* SignatureVerificationException is thrown when the signature verification for
* a webhook fails.
*/
class SignatureVerificationException extends \Exception implements ExceptionInterface
{
protected $httpBody;
protected $sigHeader;
/**
* Creates a new SignatureVerificationException exception.
*
* @param string $message the exception message
* @param null|string $httpBody the HTTP body as a string
* @param null|string $sigHeader the `Stripe-Signature` HTTP header
*
* @return SignatureVerificationException
*/
public static function factory(
$message,
$httpBody = null,
$sigHeader = null
) {
$instance = new static($message);
$instance->setHttpBody($httpBody);
$instance->setSigHeader($sigHeader);
return $instance;
}
/**
* Gets the HTTP body as a string.
*
* @return null|string
*/
public function getHttpBody()
{
return $this->httpBody;
}
/**
* Sets the HTTP body as a string.
*
* @param null|string $httpBody
*/
public function setHttpBody($httpBody)
{
$this->httpBody = $httpBody;
}
/**
* Gets the `Stripe-Signature` HTTP header.
*
* @return null|string
*/
public function getSigHeader()
{
return $this->sigHeader;
}
/**
* Sets the `Stripe-Signature` HTTP header.
*
* @param null|string $sigHeader
*/
public function setSigHeader($sigHeader)
{
$this->sigHeader = $sigHeader;
}
}