/support/modules/gateways/ewayuk.php

https://gitlab.com/stigmahost/arkahost-child-theme · PHP · 79 lines · 57 code · 12 blank · 10 comment · 7 complexity · 1dec6bf06a93f33079862bea6111f297 MD5 · raw file

  1. <?php
  2. /**
  3. *
  4. * @ WHMCS FULL DECODED & NULLED
  5. *
  6. * @ Version : 5.2.15
  7. * @ Author : MTIMER
  8. * @ Release on : 2013-12-24
  9. * @ Website : http://www.mtimer.cn
  10. *
  11. * */
  12. function ewayuk_config() {
  13. $configarray = array( "FriendlyName" => array( "Type" => "System", "Value" => "eWay UK" ), "customerid" => array( "FriendlyName" => "Customer ID", "Type" => "text", "Size" => "20" ), "username" => array( "FriendlyName" => "Username", "Type" => "text", "Size" => "20" ), "testmode" => array( "FriendlyName" => "Test Mode", "Type" => "yesno", "Description" => "Tick this to enable test mode" ) );
  14. return $configarray;
  15. }
  16. function ewayuk_link($params) {
  17. $query = "";
  18. $gatewaytestmode = $params['testmode'];
  19. if ($gatewaytestmode == "on") {
  20. $query .= "CustomerID=87654321";
  21. $query .= "&UserName=TestAccount";
  22. }
  23. else {
  24. $query .= "CustomerID=" . $params['customerid'];
  25. $query .= "&UserName=" . $params['username'];
  26. }
  27. $query .= "&MerchantInvoice=" . $params['invoiceid'];
  28. $query .= "&MerchantReference=" . $params['invoiceid'];
  29. $query .= "&Amount=" . urlencode( $params['amount'] );
  30. $query .= "&Currency=" . $params['currency'];
  31. $query .= "&CustomerFirstName=" . $params['clientdetails']['firstname'];
  32. $query .= "&CustomerLastName=" . $params['clientdetails']['lastname'];
  33. $query .= "&CustomerAddress=" . $params['clientdetails']['address1'] . " " . $params['clientdetails']['address2'];
  34. $query .= "&CustomerCity=" . $params['clientdetails']['city'];
  35. $query .= "&CustomerState=" . $params['clientdetails']['state'];
  36. $query .= "&CustomerPostCode=" . $params['clientdetails']['postcode'];
  37. $query .= "&CustomerCountry=" . $params['clientdetails']['country'];
  38. $query .= "&CustomerEmail=" . $params['clientdetails']['email'];
  39. $query .= "&CustomerPhone=" . $params['clientdetails']['phonenumber'];
  40. $query .= "&CancelUrl=" . urlencode( $params['systemurl'] . "/viewinvoice.php?id=" . $params['invoiceid'] );
  41. $query .= "&ReturnUrl=" . urlencode( $params['systemurl'] . "/modules/gateways/callback/ewayuk.php" );
  42. $query = str_replace( " ", "%20", $query );
  43. $posturl = "https://payment.ewaygateway.com/Request/?" . $query;
  44. $response = curlCall( $posturl, "" );
  45. $responsemode = strtolower( ewayuk_fetch_data( $response, "<Result>", "</Result>" ) );
  46. if ($responsemode == "true") {
  47. $redirecturl = ewayuk_fetch_data( $response, "<Uri>", "</Uri>" );
  48. $code = "<input type=\"button\" value=\"" . $params['langpaynow'] . "\" onclick=\"window.location='" . $redirecturl . "'\" />
  49. </form>";
  50. return $code;
  51. }
  52. logTransaction( "eWay UK", $response, "Error" );
  53. return "An Error Occurred. Please try again later or submit a ticket if the error persists.";
  54. }
  55. function ewayuk_fetch_data($string, $start_tag, $end_tag) {
  56. $position = stripos( $string, $start_tag );
  57. $str = substr( $string, $position );
  58. $str_second = substr( $str, strlen( $start_tag ) );
  59. $second_positon = stripos( $str_second, $end_tag );
  60. $str_third = substr( $str_second, 0, $second_positon );
  61. $ewayukhp_fetch_data = trim( $str_third );
  62. return $ewayukhp_fetch_data;
  63. }
  64. if (!defined( "WHMCS" )) {
  65. exit( "This file cannot be accessed directly" );
  66. }
  67. ?>