Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function DoUpdatePaymentStatus(
- $pp_Version,
- $pp_TxnType,
- $pp_BankID,
- $pp_Password,
- $pp_TxnRefNo,
- $pp_TxnDateTime,
- $pp_ResponseCode,
- $pp_ResponseMessage,
- $pp_AuthCode,
- $pp_RetreivalReferenceNo,
- $pp_SecureHash,
- $pp_ProductID,
- $pp_SettlementExpiry
- ){
- global $db_obj;
- header("Content-type: text/xml");
- $servername="localhost";
- $username="smsprouser";
- $password="North123";
- $dbname="smspro";
- $db_obj = new mysqli($servername, $username, $password, $dbname);
- $sql = "INSERT INTO transaction_status_log (pp_TxnRefNo, pp_ResponseCode, pp_RetreivalReferenceNo,pp_TxnDateTime)
- VALUES ('$pp_TxnRefNo','$pp_ResponseCode','$pp_RetreivalReferenceNo','$pp_TxnDateTime')";
- if ($db_obj->query($sql) !== TRUE) {
- $sql = "INSERT INTO transaction_status_log (pp_TxnRefNo, pp_ResponseCode, pp_RetreivalReferenceNo,pp_TxnDateTime)
- VALUES ('1','2','3','4')";
- $db_obj->query($sql);
- $response = '<?xml version="1.0"?>';
- $response .= '<response><status>000|status updated successfully|</status></response>';
- return $response; }else{
- $response = '<?xml version="1.0"?>';
- $response .= '<response><status>000|status updated successfully|</status></response>';
- return $response;
- }
- // check for required parameter
- $required_params = [
- 'pp_Version' => $pp_Version,
- 'pp_TxnType' => $pp_TxnType,
- 'pp_Password' => $pp_Password,
- 'pp_TxnRefNo' => $pp_TxnRefNo,
- 'pp_TxnDateTime' => $pp_TxnDateTime,
- 'pp_ResponseCode' => $pp_ResponseCode,
- 'pp_RetreivalReferenceNo' => $pp_RetreivalReferenceNo
- ];
- foreach ($required_params as $in => $iv){
- if(!isset($iv) or empty($iv)){
- return "012Missing mandatory parameter(s) ".$in;
- exit;
- }
- }
- // some checks before going through the process
- if($pp_Version != '1.1' or $pp_TxnType != 'OTC'){
- return "013Invalid valued for parameter(s)";
- exit;
- }
- // get the payment token from response
- $payment_token = $pp_RetreivalReferenceNo;
- $password = $pp_Password;
- $application_id = $pp_TxnRefNo;
- if($password == "7w9377041a" and in_array($pp_ResponseCode, ['000', '121', '200']))
- return "000|status updated successfully|";
- else
- return "101|invalid merchant details or invalid response code|";
- }
- $server = new nusoap_server();
- $server->configureWSDL("UpdateOrderPaymentStatus6", "urn:UpdateOrderPaymentStatus6");
- $server->register(
- 'DoUpdatePaymentStatus',
- [
- 'pp_Version' => 'xsd:string',
- 'pp_TxnType' => 'xsd:string',
- 'pp_BankID' => 'xsd:string',
- 'pp_Password' => 'xsd:string',
- 'pp_TxnRefNo' => 'xsd:string',
- 'pp_TxnDateTime' => 'xsd:string',
- 'pp_ResponseCode' => 'xsd:string',
- 'pp_ResponseMessage' => 'xsd:string',
- 'pp_AuthCode' => 'xsd:string',
- 'pp_RetreivalReferenceNo' => 'xsd:string',
- 'pp_SecureHash' => 'xsd:string',
- 'pp_ProductID' => 'xsd:string',
- 'pp_SettlementExpiry' => 'xsd:string'
- ],
- ['DoUpdatePaymentStatusResult' => 'xsd:string']
- );
- $HTTP_RAW_POST_DATA = file_get_contents("php://input");
- $server->service($HTTP_RAW_POST_DATA);
- http://www.altijarahtrading.com/jazzCash/UpdateOrderPaymentStatus6.php?wsdl
- <?php
- $pp_version = '1.1';
- $pp_TxnType='OTC';
- $MerchantID = '00137171';//merchant id
- $Password = '7w9377041a'; // password
- $_TxnRefNumber = "TXN20171205073910";// Transaction Reference Number
- $_TxnDateTime = "20171205073910" ;//Time Function
- $pp_ResponseCode="121"; // it will be 121 when jazz will call our api service
- $pp_ResponseMessage="Order is placed and waiting for financials to be received over the counter";
- $pp_RetreivalReferenceNo="1234";
- $url = `'http://www.altijarahtrading.com/jazzCash/UpdateOrderPaymentStatus6.php?wsdl';`
- $client = new SoapClient($url,array("trace" => 1, "exception" => 0));
- $result=$client->DoUpdatePaymentStatus($pp_version ,
- $pp_TxnType,"",
- $Password,$_TxnRefNumber,$_TxnDateTime,
- $pp_ResponseCode,
- $pp_ResponseMessage
- ,"",
- $pp_RetreivalReferenceNo,
- "",
- "","","");
- echo $result;
- exit(0)
- ?>
- System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.InvalidOperationException: Client found response content type of 'text/html; charset=UTF-8', but expected 'text/xml'.
Add Comment
Please, Sign In to add comment