Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Sign in
Toggle navigation
P
php-stpp
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
common
php-stpp
Commits
460f3c6c
Commit
460f3c6c
authored
Apr 13, 2018
by
David Weston
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
okay, this is now safer
parent
24069bf0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
24 deletions
+32
-24
lib/RequestHandler.php
lib/RequestHandler.php
+2
-5
lib/Response.php
lib/Response.php
+30
-19
No files found.
lib/RequestHandler.php
View file @
460f3c6c
...
...
@@ -87,7 +87,7 @@ class RequestHandler
curl_setopt
(
$ch
,
CURLOPT_HEADER
,
false
);
curl_setopt
(
$ch
,
CURLOPT_HTTPHEADER
,
$headers
);
curl_setopt
(
$ch
,
CURLOPT_POST
,
true
);
curl_setopt
(
$ch
,
CURLOPT_POSTFIELDS
,
$this
->
request
->
getRequestXML
());
curl_setopt
(
$ch
,
CURLOPT_POSTFIELDS
,
$this
->
request
->
getRequestXML
(
$method
));
curl_setopt
(
$ch
,
CURLOPT_RETURNTRANSFER
,
true
);
curl_setopt
(
$ch
,
CURLOPT_SSL_VERIFYPEER
,
false
);
...
...
@@ -96,9 +96,6 @@ class RequestHandler
curl_close
(
$ch
);
if
(
$status
)
return
new
Response
(
$request
,
$output
);
return
false
;
return
new
Response
(
$output
);
}
}
\ No newline at end of file
lib/Response.php
View file @
460f3c6c
...
...
@@ -11,9 +11,10 @@ namespace OUTRAGElib\Payment\STPP;
use
\OUTRAGElib\Payment\STPP\Request
;
use
\SimpleXMLElement
;
use
\Serializable
;
class
Response
class
Response
implements
Serializable
{
/**
* Store the XML response somewhere...
...
...
@@ -21,34 +22,17 @@ class Response
private
$feed
=
null
;
/**
* The request?
*/
private
$request
=
null
;
/**
* Called when the response has been constructed.
*/
public
function
__construct
(
Request
$request
,
$response
)
public
function
__construct
(
$response
)
{
$this
->
feed
=
simplexml_load_string
(
$response
);
$this
->
request
=
$request
;
return
true
;
}
/**
* Retrieves a cleansed version of the request - where this means
* all credit card information is removed.
*/
public
function
getRequest
()
{
return
$this
->
request
;
}
/**
* Retrieves the XML object that was sent back from SecureTrading.
*/
...
...
@@ -144,4 +128,31 @@ class Response
return
(
integer
)
$this
->
feed
->
response
->
live
===
1
;
}
/**
* Called to serialize an object
*/
public
function
serialize
()
{
$vars
=
get_object_vars
(
$this
);
$vars
[
"feed"
]
=
$this
->
feed
->
asXML
();
return
serialize
(
$vars
);
}
/**
* Called to unserialize an object
*/
public
function
unserialize
(
$input
)
{
$vars
=
unserialize
(
$input
);
$vars
[
"feed"
]
=
simplexml_load_string
(
$vars
[
"feed"
]);
foreach
(
$vars
as
$key
=>
$value
)
$this
->
{
$key
}
=
$value
;
return
true
;
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment