@@ -180,22 +180,42 @@ public function preparePublicKey($publicKeyFile) {
180180
181181 /**
182182 * Use this function to initiate a reversal request. This is an abstracted function that takes care of SecurityCredential Generation
183- * @param $Initiator | The name of Initiator to initiating the request
184- * @param $InitiatorPassword | Plain Text Initiator Password for generating the security credential
183+ * @param $Initiator | The name of Initiator - Username of user initiating the transaction
184+ * @param $InitiatorPassword | Plain Text Initiator Password for generating the security credential
185185 * @param $TransactionID | Unique Id received with every transaction response.
186186 * @param $Amount | Amount
187187 * @param $ReceiverParty | Organization /MSISDN sending the transaction
188188 * @param $ResultURL | The path that stores information of transaction
189189 * @param $QueueTimeOutURL | The path that stores information of time out transaction
190190 * @param $Remarks | Comments that are sent along with the transaction.
191- * @param $Occasion | Optional Parameter
191+ * @param $Occasion | Optional Parameter
192192 * @return mixed|string
193+ * @throws \Exception
193194 */
194- public function reverseTransaction ($ Initiator , $ InitiatorPassword , $ TransactionID , $ Amount , $ ReceiverParty , $ ResultURL , $ QueueTimeOutURL , $ Remarks , $ Occasion ) {
195+ public function reverseTransaction ($ Initiator , $ InitiatorPassword , $ TransactionID , $ Amount , $ ReceiverParty , $ ResultURL , $ QueueTimeOutURL , $ Remarks , $ Occasion, $ ReceiverIdentifierType = 11 ) {
195196 $ SecurityCredential = $ this ->encryptInitiatorPassword ($ InitiatorPassword ,$ this ->environment );
196197 $ CommandID = 'TransactionReversal ' ;
197- $ RecieverIdentifierType = 11 ;
198- return $ this ->reversal ($ CommandID ,$ Initiator ,$ SecurityCredential ,$ TransactionID ,$ Amount ,$ ReceiverParty ,$ RecieverIdentifierType ,$ ResultURL ,$ QueueTimeOutURL ,$ Remarks ,$ Occasion );
198+ return $ this ->reversal ($ CommandID ,$ Initiator ,$ SecurityCredential ,$ TransactionID ,$ Amount ,$ ReceiverParty ,$ ReceiverIdentifierType ,$ ResultURL ,$ QueueTimeOutURL ,$ Remarks ,$ Occasion );
199+ }
200+
201+ /**
202+ * Use this function to initiate a transaciton status query
203+ * @param $Initiator | The username of the user initiating the transaction. This is the credential/username used to authenticate the transaction request
204+ * @param $InitiatorPassword | PlainText Initiator password
205+ * @param $TransactionID | Mpesa confirmation code of the trasaction whose query we are checking
206+ * @param $PartyA | The shortcode or msisdn of the organization that is receiving the transaction
207+ * @param $ResultURL | Where will the result be sent to
208+ * @param $QueueTimeOutURL | In case of a timeout, this url will be called.
209+ * @param $Remarks |Comments sent along with the transaction
210+ * @param $Occasion | Optional Parameter.
211+ * @param int $IdentifierType | The type of organization receiving the transaction: 1 = MSISDN, 2 = TILL, 4 = Org shortcode
212+ * @return mixed|string
213+ * @throws \Exception
214+ */
215+ public function checkTransactionStatus ($ Initiator , $ InitiatorPassword , $ TransactionID , $ PartyA , $ ResultURL , $ QueueTimeOutURL , $ Remarks , $ Occasion , $ IdentifierType =4 ) {
216+ $ SecurityCredential = $ this ->encryptInitiatorPassword ($ InitiatorPassword ,$ this ->environment );
217+ $ CommandID = 'TransactionStatusQuery ' ;
218+ return $ this ->transactionStatus ($ Initiator , $ SecurityCredential , $ CommandID , $ TransactionID , $ PartyA , $ IdentifierType , $ ResultURL , $ QueueTimeOutURL , $ Remarks , $ Occasion );
199219 }
200220 /**
201221 * Use this function to initiate a reversal request. This is the lowest level function that can change even the Organization Id Type.
@@ -212,7 +232,7 @@ public function reverseTransaction($Initiator, $InitiatorPassword, $TransactionI
212232 * @param $Occasion | Optional Parameter
213233 * @return mixed|string
214234 */
215- public function reversal ($ CommandID , $ Initiator , $ SecurityCredential , $ TransactionID , $ Amount , $ ReceiverParty , $ RecieverIdentifierType , $ ResultURL , $ QueueTimeOutURL , $ Remarks , $ Occasion ){
235+ private function reversal ($ CommandID , $ Initiator , $ SecurityCredential , $ TransactionID , $ Amount , $ ReceiverParty , $ RecieverIdentifierType , $ ResultURL , $ QueueTimeOutURL , $ Remarks , $ Occasion ){
216236
217237 $ environment = $ this ->environment ;
218238 if ( $ environment =="live " ){
@@ -423,7 +443,7 @@ public function accountBalance($CommandID, $Initiator, $SecurityCredential, $Par
423443 * @param $Occasion | Optional Parameter
424444 * @return mixed|string
425445 */
426- public function transactionStatus ($ Initiator , $ SecurityCredential , $ CommandID , $ TransactionID , $ PartyA , $ IdentifierType , $ ResultURL , $ QueueTimeOutURL , $ Remarks , $ Occasion ){
446+ private function transactionStatus ($ Initiator , $ SecurityCredential , $ CommandID , $ TransactionID , $ PartyA , $ IdentifierType , $ ResultURL , $ QueueTimeOutURL , $ Remarks , $ Occasion ){
427447
428448 $ environment = $ this ->environment ;
429449
0 commit comments