@@ -10,6 +10,8 @@ abstract class SecureXMLAbstractRequest extends AbstractRequest
1010 public $ testEndpoint = 'https://test.securepay.com.au/xmlapi/payment ' ;
1111 public $ liveEndpoint = 'https://api.securepay.com.au/xmlapi/payment ' ;
1212
13+ protected $ requestType = 'Payment ' ;
14+
1315 /**
1416 * Set the messageID on the request.
1517 *
@@ -67,7 +69,19 @@ protected function getBaseXML()
6769 $ merchantInfo ->addChild ('merchantID ' , $ this ->getMerchantId ());
6870 $ merchantInfo ->addChild ('password ' , $ this ->getTransactionPassword ());
6971
70- $ xml ->addChild ('RequestType ' , 'Payment ' ); // Not related to the transaction type
72+ $ xml ->addChild ('RequestType ' , $ this ->requestType ); // Not related to the transaction type
73+
74+ return $ xml ;
75+ }
76+
77+ /**
78+ * XML template of a SecurePayMessage Payment.
79+ *
80+ * @return \SimpleXMLElement SecurePayMessage with transaction details.
81+ */
82+ protected function getBasePaymentXML ()
83+ {
84+ $ xml = $ this ->getBaseXML ();
7185
7286 $ payment = $ xml ->addChild ('Payment ' );
7387 $ txnList = $ payment ->addChild ('TxnList ' );
@@ -85,13 +99,14 @@ protected function getBaseXML()
8599 }
86100
87101 /**
88- * @return \SimpleXMLElement SecurePayMessage with card details.
102+ * @return \SimpleXMLElement SecurePayMessage with transaction and card
103+ * details.
89104 */
90- protected function getBaseXMLWithCard ()
105+ protected function getBasePaymentXMLWithCard ()
91106 {
92107 $ this ->getCard ()->validate ();
93108
94- $ xml = $ this ->getBaseXML ();
109+ $ xml = $ this ->getBasePaymentXML ();
95110
96111 $ card = $ xml ->Payment ->TxnList ->Txn ->addChild ('CreditCardInfo ' );
97112 $ card ->addChild ('cardNumber ' , $ this ->getCard ()->getNumber ());
0 commit comments