File tree Expand file tree Collapse file tree 2 files changed +13
-27
lines changed Expand file tree Collapse file tree 2 files changed +13
-27
lines changed Original file line number Diff line number Diff line change @@ -37,41 +37,28 @@ public function setComment($value)
37
37
public function sendData ($ data )
38
38
{
39
39
$ header = base64_encode ($ this ->getMerchantId () . ': ' . $ this ->getApiPasscode ());
40
- // Don't throw exceptions for 4xx errors
41
- $ this ->httpClient ->getEventDispatcher ()->addListener (
42
- 'request.error ' ,
43
- function ($ event ) {
44
- if ($ event ['response ' ]->isClientError ()) {
45
- $ event ->stopPropagation ();
46
- }
47
- }
48
- );
49
-
40
+
50
41
if (!empty ($ data )) {
51
- $ httpRequest = $ this ->httpClient ->createRequest (
42
+ $ httpResponse = $ this ->httpClient ->request (
52
43
$ this ->getHttpMethod (),
53
44
$ this ->getEndpoint (),
54
- null ,
45
+ [
46
+ 'Content-Type ' => 'application/json ' ,
47
+ 'Authorization ' => 'Passcode ' . $ header ,
48
+ ],
55
49
json_encode ($ data )
56
50
);
57
51
} else {
58
- $ httpRequest = $ this ->httpClient ->createRequest (
52
+ $ httpResponse = $ this ->httpClient ->request (
59
53
$ this ->getHttpMethod (),
60
- $ this ->getEndpoint ()
54
+ $ this ->getEndpoint (),
55
+ [
56
+ 'Content-Type ' => 'application/json ' ,
57
+ 'Authorization ' => 'Passcode ' . $ header ,
58
+ ]
61
59
);
62
60
}
63
61
64
- $ httpResponse = $ httpRequest
65
- ->setHeader (
66
- 'Content-Type ' ,
67
- 'application/json '
68
- )
69
- ->setHeader (
70
- 'Authorization ' ,
71
- 'Passcode ' . $ header
72
- )
73
- ->send ();
74
-
75
- return $ this ->response = new ProfileResponse ($ this , $ httpResponse ->json ());
62
+ return $ this ->response = new Response ($ this , $ httpResponse ->getBody ()->getContents ());
76
63
}
77
64
}
Original file line number Diff line number Diff line change @@ -147,7 +147,6 @@ public function getHttpMethod()
147
147
public function sendData ($ data )
148
148
{
149
149
$ header = base64_encode ($ this ->getMerchantId () . ': ' . $ this ->getApiPasscode ());
150
- // Don't throw exceptions for 4xx errors
151
150
152
151
if (!empty ($ data )) {
153
152
$ httpResponse = $ this ->httpClient ->request (
You can’t perform that action at this time.
0 commit comments