Guest User

Untitled

a guest
Dec 18th, 2017
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.60 KB | None | 0 0
  1. function DoUpdatePaymentStatus(
  2. $pp_Version,
  3. $pp_TxnType,
  4. $pp_BankID,
  5. $pp_Password,
  6. $pp_TxnRefNo,
  7. $pp_TxnDateTime,
  8. $pp_ResponseCode,
  9. $pp_ResponseMessage,
  10. $pp_AuthCode,
  11. $pp_RetreivalReferenceNo,
  12. $pp_SecureHash,
  13. $pp_ProductID,
  14. $pp_SettlementExpiry
  15. ){
  16.  
  17. global $db_obj;
  18. header("Content-type: text/xml");
  19. $servername="localhost";
  20. $username="smsprouser";
  21. $password="North123";
  22. $dbname="smspro";
  23. $db_obj = new mysqli($servername, $username, $password, $dbname);
  24.  
  25.  
  26. $sql = "INSERT INTO transaction_status_log (pp_TxnRefNo, pp_ResponseCode, pp_RetreivalReferenceNo,pp_TxnDateTime)
  27. VALUES ('$pp_TxnRefNo','$pp_ResponseCode','$pp_RetreivalReferenceNo','$pp_TxnDateTime')";
  28. if ($db_obj->query($sql) !== TRUE) {
  29.  
  30. $sql = "INSERT INTO transaction_status_log (pp_TxnRefNo, pp_ResponseCode, pp_RetreivalReferenceNo,pp_TxnDateTime)
  31. VALUES ('1','2','3','4')";
  32. $db_obj->query($sql);
  33.  
  34. $response = '<?xml version="1.0"?>';
  35. $response .= '<response><status>000|status updated successfully|</status></response>';
  36. return $response; }else{
  37. $response = '<?xml version="1.0"?>';
  38. $response .= '<response><status>000|status updated successfully|</status></response>';
  39. return $response;
  40.  
  41.  
  42.  
  43. }
  44.  
  45.  
  46.  
  47. // check for required parameter
  48. $required_params = [
  49. 'pp_Version' => $pp_Version,
  50. 'pp_TxnType' => $pp_TxnType,
  51. 'pp_Password' => $pp_Password,
  52. 'pp_TxnRefNo' => $pp_TxnRefNo,
  53. 'pp_TxnDateTime' => $pp_TxnDateTime,
  54. 'pp_ResponseCode' => $pp_ResponseCode,
  55. 'pp_RetreivalReferenceNo' => $pp_RetreivalReferenceNo
  56. ];
  57.  
  58. foreach ($required_params as $in => $iv){
  59. if(!isset($iv) or empty($iv)){
  60. return "012Missing mandatory parameter(s) ".$in;
  61. exit;
  62. }
  63. }
  64.  
  65.  
  66. // some checks before going through the process
  67. if($pp_Version != '1.1' or $pp_TxnType != 'OTC'){
  68. return "013Invalid valued for parameter(s)";
  69. exit;
  70. }
  71.  
  72.  
  73. // get the payment token from response
  74. $payment_token = $pp_RetreivalReferenceNo;
  75. $password = $pp_Password;
  76. $application_id = $pp_TxnRefNo;
  77.  
  78. if($password == "7w9377041a" and in_array($pp_ResponseCode, ['000', '121', '200']))
  79. return "000|status updated successfully|";
  80. else
  81. return "101|invalid merchant details or invalid response code|";
  82.  
  83. }
  84.  
  85.  
  86. $server = new nusoap_server();
  87.  
  88.  
  89. $server->configureWSDL("UpdateOrderPaymentStatus6", "urn:UpdateOrderPaymentStatus6");
  90. $server->register(
  91. 'DoUpdatePaymentStatus',
  92. [
  93. 'pp_Version' => 'xsd:string',
  94. 'pp_TxnType' => 'xsd:string',
  95. 'pp_BankID' => 'xsd:string',
  96. 'pp_Password' => 'xsd:string',
  97. 'pp_TxnRefNo' => 'xsd:string',
  98. 'pp_TxnDateTime' => 'xsd:string',
  99. 'pp_ResponseCode' => 'xsd:string',
  100. 'pp_ResponseMessage' => 'xsd:string',
  101. 'pp_AuthCode' => 'xsd:string',
  102. 'pp_RetreivalReferenceNo' => 'xsd:string',
  103. 'pp_SecureHash' => 'xsd:string',
  104. 'pp_ProductID' => 'xsd:string',
  105. 'pp_SettlementExpiry' => 'xsd:string'
  106. ],
  107. ['DoUpdatePaymentStatusResult' => 'xsd:string']
  108. );
  109.  
  110.  
  111.  
  112.  
  113. $HTTP_RAW_POST_DATA = file_get_contents("php://input");
  114. $server->service($HTTP_RAW_POST_DATA);
  115.  
  116. http://www.altijarahtrading.com/jazzCash/UpdateOrderPaymentStatus6.php?wsdl
  117.  
  118. <?php
  119. $pp_version = '1.1';
  120. $pp_TxnType='OTC';
  121. $MerchantID = '00137171';//merchant id
  122. $Password = '7w9377041a'; // password
  123. $_TxnRefNumber = "TXN20171205073910";// Transaction Reference Number
  124. $_TxnDateTime = "20171205073910" ;//Time Function
  125. $pp_ResponseCode="121"; // it will be 121 when jazz will call our api service
  126. $pp_ResponseMessage="Order is placed and waiting for financials to be received over the counter";
  127. $pp_RetreivalReferenceNo="1234";
  128. $url = `'http://www.altijarahtrading.com/jazzCash/UpdateOrderPaymentStatus6.php?wsdl';`
  129. $client = new SoapClient($url,array("trace" => 1, "exception" => 0));
  130.  
  131. $result=$client->DoUpdatePaymentStatus($pp_version ,
  132. $pp_TxnType,"",
  133. $Password,$_TxnRefNumber,$_TxnDateTime,
  134. $pp_ResponseCode,
  135. $pp_ResponseMessage
  136. ,"",
  137. $pp_RetreivalReferenceNo,
  138. "",
  139. "","","");
  140.  
  141. echo $result;
  142. exit(0)
  143. ?>
  144.  
  145. 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