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
c008cbe9
Commit
c008cbe9
authored
May 19, 2014
by
David Weston
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added escaping to things
parent
3a2417cc
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
43 additions
and
16 deletions
+43
-16
objects/stppaddressableobject.php
objects/stppaddressableobject.php
+3
-2
objects/stppbilling.php
objects/stppbilling.php
+5
-4
objects/stppcustomer.php
objects/stppcustomer.php
+1
-1
objects/stppmerchant.php
objects/stppmerchant.php
+1
-1
objects/stppobject.php
objects/stppobject.php
+12
-2
objects/stppoperation.php
objects/stppoperation.php
+1
-1
objects/stppresponse.php
objects/stppresponse.php
+15
-2
objects/stppsettlement.php
objects/stppsettlement.php
+1
-1
stapi.php
stapi.php
+4
-2
No files found.
objects/stppaddressableobject.php
View file @
c008cbe9
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
* quite a lot of functionality is shared between billing and customers, for
* quite a lot of functionality is shared between billing and customers, for
* example.
* example.
*
*
* @version: 1.0
-beta
* @version: 1.0
* @author: David Weston <stpp@typefish.co.uk>
* @author: David Weston <stpp@typefish.co.uk>
*/
*/
...
@@ -219,7 +219,8 @@ abstract class STPPAddressable extends STPPObject
...
@@ -219,7 +219,8 @@ abstract class STPPAddressable extends STPPObject
if
(
empty
(
$this
->
options
[
"telephone"
]))
if
(
empty
(
$this
->
options
[
"telephone"
]))
return
false
;
return
false
;
$element
->
addChild
(
"telephone"
,
$this
->
options
[
"telephone"
][
"number"
])
->
addAttribute
(
"type"
,
$this
->
options
[
"telephone"
][
"type"
]);
$element
->
addChild
(
"telephone"
,
$this
->
escape
(
$this
->
options
[
"telephone"
][
"number"
]))
->
addAttribute
(
"type"
,
$this
->
escape
(
$this
->
options
[
"telephone"
][
"type"
]));
return
true
;
return
true
;
}
}
...
...
objects/stppbilling.php
View file @
c008cbe9
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
* this class matches the name registered on the card. Addresses
* this class matches the name registered on the card. Addresses
* are also key.
* are also key.
*
*
* @version: 1.0
-beta
* @version: 1.0
* @author: David Weston <stpp@typefish.co.uk>
* @author: David Weston <stpp@typefish.co.uk>
*/
*/
...
@@ -157,7 +157,8 @@ class STPPBilling extends STPPAddressable
...
@@ -157,7 +157,8 @@ class STPPBilling extends STPPAddressable
if
(
empty
(
$this
->
options
[
"amount"
]))
if
(
empty
(
$this
->
options
[
"amount"
]))
return
false
;
return
false
;
$element
->
addChild
(
"amount"
,
$this
->
options
[
"amount"
][
"value"
])
->
addAttribute
(
"currencycode"
,
$this
->
options
[
"amount"
][
"currencycode"
]);
$element
->
addChild
(
"amount"
,
$this
->
escape
(
$this
->
options
[
"amount"
][
"value"
]))
->
addAttribute
(
"currencycode"
,
$this
->
escape
(
$this
->
options
[
"amount"
][
"currencycode"
]));
return
true
;
return
true
;
}
}
...
@@ -176,12 +177,12 @@ class STPPBilling extends STPPAddressable
...
@@ -176,12 +177,12 @@ class STPPBilling extends STPPAddressable
$node
=
$element
->
addChild
(
"payment"
);
$node
=
$element
->
addChild
(
"payment"
);
if
(
isset
(
$this
->
options
[
"payment"
][
"type"
]))
if
(
isset
(
$this
->
options
[
"payment"
][
"type"
]))
$node
->
addAttribute
(
"type"
,
$this
->
options
[
"payment"
][
"type"
]
);
$node
->
addAttribute
(
"type"
,
$this
->
escape
(
$this
->
options
[
"payment"
][
"type"
])
);
unset
(
$this
->
options
[
"payment"
][
"type"
]);
unset
(
$this
->
options
[
"payment"
][
"type"
]);
foreach
(
$this
->
options
[
"payment"
]
as
$option
=>
$value
)
foreach
(
$this
->
options
[
"payment"
]
as
$option
=>
$value
)
$node
->
addChild
(
$option
,
$
value
);
$node
->
addChild
(
$option
,
$
this
->
escape
(
$value
)
);
return
true
;
return
true
;
}
}
...
...
objects/stppcustomer.php
View file @
c008cbe9
...
@@ -10,7 +10,7 @@
...
@@ -10,7 +10,7 @@
* no real need to fill in anything like addresses and such - however there
* no real need to fill in anything like addresses and such - however there
* /is/ a recommendation from ST to do so.
* /is/ a recommendation from ST to do so.
*
*
* @version: 1.0
-beta
* @version: 1.0
* @author: David Weston <stpp@typefish.co.uk>
* @author: David Weston <stpp@typefish.co.uk>
*/
*/
...
...
objects/stppmerchant.php
View file @
c008cbe9
...
@@ -10,7 +10,7 @@
...
@@ -10,7 +10,7 @@
* it is a required feature for 3D-Secure, which most if not all
* it is a required feature for 3D-Secure, which most if not all
* transactions should be performed using (if available).
* transactions should be performed using (if available).
*
*
* @version: 1.0
-beta
* @version: 1.0
* @author: David Weston <stpp@typefish.co.uk>
* @author: David Weston <stpp@typefish.co.uk>
*/
*/
...
...
objects/stppobject.php
View file @
c008cbe9
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
* This is the god object for all parts of the request, such as
* This is the god object for all parts of the request, such as
* the merchant, operations and such.
* the merchant, operations and such.
*
*
* @version: 1.0
-beta
* @version: 1.0
* @author: David Weston <stpp@typefish.co.uk>
* @author: David Weston <stpp@typefish.co.uk>
*/
*/
...
@@ -39,7 +39,7 @@ abstract class STPPObject
...
@@ -39,7 +39,7 @@ abstract class STPPObject
if
(
method_exists
(
$this
,
$method
))
if
(
method_exists
(
$this
,
$method
))
$this
->
$method
(
$element
);
$this
->
$method
(
$element
);
else
else
$element
->
addChild
(
strtolower
(
$option
),
$
value
);
$element
->
addChild
(
strtolower
(
$option
),
$
this
->
escape
(
$value
)
);
}
}
return
true
;
return
true
;
...
@@ -53,4 +53,14 @@ abstract class STPPObject
...
@@ -53,4 +53,14 @@ abstract class STPPObject
{
{
return
$this
->
options
;
return
$this
->
options
;
}
}
/**
* We can use this as a way of escaping values, since SimpleXMLElement::addChild
* doesn't escape things for you.
*/
public
function
escape
(
$string
)
{
return
htmlspecialchars
(
$string
);
}
}
}
\ No newline at end of file
objects/stppoperation.php
View file @
c008cbe9
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
* The operation object contains some other information that is needed
* The operation object contains some other information that is needed
* to complete the request.
* to complete the request.
*
*
* @version: 1.0
-beta
* @version: 1.0
* @author: David Weston <stpp@typefish.co.uk>
* @author: David Weston <stpp@typefish.co.uk>
*/
*/
...
...
objects/stppresponse.php
View file @
c008cbe9
...
@@ -9,7 +9,7 @@
...
@@ -9,7 +9,7 @@
* give the XML response as the argument to the constructor and all will be
* give the XML response as the argument to the constructor and all will be
* revealed.
* revealed.
*
*
* @version: 1.0
-beta
* @version: 1.0
* @author: David Weston <stpp@typefish.co.uk>
* @author: David Weston <stpp@typefish.co.uk>
*/
*/
...
@@ -19,7 +19,8 @@ class STPPResponse
...
@@ -19,7 +19,8 @@ class STPPResponse
/**
/**
* Store the XML response somewhere...
* Store the XML response somewhere...
*/
*/
protected
$feed
=
null
;
private
$feed
=
null
;
private
$request
=
null
;
/**
/**
...
@@ -28,10 +29,22 @@ class STPPResponse
...
@@ -28,10 +29,22 @@ class STPPResponse
public
function
__construct
(
$response
=
null
,
$request
=
null
)
public
function
__construct
(
$response
=
null
,
$request
=
null
)
{
{
$this
->
feed
=
simplexml_load_string
(
$response
);
$this
->
feed
=
simplexml_load_string
(
$response
);
$this
->
request
=
$request
;
return
true
;
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.
* Retrieves the XML object that was sent back from SecureTrading.
*/
*/
...
...
objects/stppsettlement.php
View file @
c008cbe9
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
*
*
* This is the object that represents updated settlement details.
* This is the object that represents updated settlement details.
*
*
* @version: 1.0
-beta
* @version: 1.0
* @author: David Weston <stpp@typefish.co.uk>
* @author: David Weston <stpp@typefish.co.uk>
*/
*/
...
...
stapi.php
View file @
c008cbe9
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
* to a setup, however, it'll allow you to with ease create
* to a setup, however, it'll allow you to with ease create
* and maintain a new contract with a SecureTrading node.
* and maintain a new contract with a SecureTrading node.
*
*
* @version: 1.0
-beta
* @version: 1.0
* @author: David Weston <stpp@typefish.co.uk>
* @author: David Weston <stpp@typefish.co.uk>
*/
*/
...
@@ -266,7 +266,7 @@ class STAPI
...
@@ -266,7 +266,7 @@ class STAPI
*/
*/
public
function
resetSettlement
()
public
function
resetSettlement
()
{
{
$this
->
objects
[
"settlement"
]
=
new
STP
t
Settlement
();
$this
->
objects
[
"settlement"
]
=
new
STP
P
Settlement
();
return
$this
;
return
$this
;
}
}
...
@@ -425,4 +425,6 @@ class STAPI
...
@@ -425,4 +425,6 @@ class STAPI
return
$envelope
;
return
$envelope
;
}
}
}
}
}
}
\ 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