forked from klarna/php-xmlrpc
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCheckoutServiceResponse.php
More file actions
91 lines (82 loc) · 1.84 KB
/
CheckoutServiceResponse.php
File metadata and controls
91 lines (82 loc) · 1.84 KB
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
<?php
/**
* File containing the CheckoutServiceResponse class.
*
* PHP version 5.3
*
* @category Payment
* @package KlarnaAPI
* @author MINT <ms.modules@klarna.com>
* @copyright 2014 Klarna AB
* @license http://opensource.org/licenses/BSD-2-Clause BSD-2
* @link https://developers.klarna.com/
*/
/**
* CheckoutServiceResponse
*
* @category Payment
* @package KlarnaAPI
* @author MINT <ms.modules@klarna.com>
* @copyright 2014 Klarna AB
* @license http://opensource.org/licenses/BSD-2-Clause BSD-2
* @link https://developers.klarna.com/
*/
class CheckoutServiceResponse
{
/**
* @var CheckoutServiceRequest
*/
protected $request;
/**
* @var int
*/
protected $status;
/**
* @var array
*/
protected $data;
/**
* Constructor
*
* @param CheckoutServiceRequest $request The original request
* @param int $status HTTP status code
* @param string $data JSON string
*/
public function __construct($request, $status, $data)
{
$this->request = $request;
$this->status = $status;
$data = json_decode($data, true);
if ($data === null) {
throw new InvalidArgumentException('data must be a valid JSON string');
}
$this->data = $data;
}
/**
* Get the original request
*
* @return CheckoutServiceRequest The original request
*/
public function getRequest()
{
return $this->request;
}
/**
* Get the response status code
*
* @return int Status code
*/
public function getStatus()
{
return $this->status;
}
/**
* Get the response data
*
* @return array Response data
*/
public function getData()
{
return $this->data;
}
}