1. <?php
  2. /*
  3. * @ https://EasyToYou.eu - IonCube v11 Decoder Online
  4. * @ PHP 7.2
  5. * @ Decoder version: 1.0.4
  6. * @ Release: 01/09/2021
  7. */
  8. require_once __DIR__ . "/../../../init.php";
  9. require_once __DIR__ . "/../../../includes/gatewayfunctions.php";
  10. require_once __DIR__ . "/../../../includes/invoicefunctions.php";
  11. require_once dirname(__FILE__) . "/TodoPago/lib/Sdk.php";
  12. $gatewayModuleName = "todopago";
  13. $gatewayParams = getGatewayVariables($gatewayModuleName);
  14. $clave = explode(" ", $gatewayParams["authKey"]);
  15. define("ENVMODE", "prod");
  16. define("MERCHANT", $gatewayParams["merchantId"] + 0);
  17. define("AUTHORIZATION", $gatewayParams["authKey"]);
  18. define("SECURITY", $clave[1]);
  19. define("URL_OK", $gatewayParams["systemurl"] . "modules/gateways/callback/todopago.php");
  20. define("URL_ERROR", $gatewayParams["systemurl"] . "modules/gateways/callback/todopago.php");
  21. define("ENCODINGMETHOD", "XML");
  22. define("PRODUCTCODE", "service");
  23. define("CURRENCYCODE", 26);
  24. $csbtCity = filter_input(INPUT_POST, "CSBTCITY");
  25. $csbtCountry = filter_input(INPUT_POST, "CSBTCOUNTRY");
  26. $csbtCustomerId = filter_input(INPUT_POST, "CSBTCUSTOMERID");
  27. $csbtIpAddress = filter_input(INPUT_POST, "CSBTIPADDRESS");
  28. $csbtEmail = filter_input(INPUT_POST, "CSBTEMAIL");
  29. $csbtFirstName = filter_input(INPUT_POST, "CSBTFIRSTNAME");
  30. $csbtLastName = filter_input(INPUT_POST, "CSBTLASTNAME");
  31. $csbtPhoneNumber = filter_input(INPUT_POST, "CSBTPHONENUMBER");
  32. $csbtPostalCode = filter_input(INPUT_POST, "CSBTPOSTALCODE");
  33. $csbtState = filter_input(INPUT_POST, "CSBTSTATE");
  34. $csbtStreet1 = filter_input(INPUT_POST, "CSBTSTREET1");
  35. $csptCurrency = filter_input(INPUT_POST, "CSPTCURRENCY");
  36. $csptGrandTotalAmount = filter_input(INPUT_POST, "CSPTGRANDTOTALAMOUNT");
  37. $csmdd8 = filter_input(INPUT_POST, "CSMDD8");
  38. $csstCity = filter_input(INPUT_POST, "CSSTCITY");
  39. $csstCountry = filter_input(INPUT_POST, "CSSTCOUNTRY");
  40. $csstEmail = filter_input(INPUT_POST, "CSSTEMAIL");
  41. $csstFirstName = filter_input(INPUT_POST, "CSSTFIRSTNAME");
  42. $csstLastName = filter_input(INPUT_POST, "CSSTLASTNAME");
  43. $csstPhoneNumber = filter_input(INPUT_POST, "CSSTPHONENUMBER");
  44. $csstPostalCode = filter_input(INPUT_POST, "CSSTPOSTALCODE");
  45. $csstState = filter_input(INPUT_POST, "CSSTSTATE");
  46. $csstStreet1 = filter_input(INPUT_POST, "CSSTSTREET1");
  47. $csitProductSKU = filter_input(INPUT_POST, "CSITPRODUCTSKU");
  48. $csitProductDescription = filter_input(INPUT_POST, "CSITPRODUCTDESCRIPTION");
  49. $csitProductName = filter_input(INPUT_POST, "CSITPRODUCTNAME");
  50. $csitQuantity = filter_input(INPUT_POST, "CSITQUANTITY");
  51. $csitUnitPrice = filter_input(INPUT_POST, "CSITUNITPRICE");
  52. $csitTotalAmount = number_format($csitUnitPrice * $csitQuantity, 2, ".", "");
  53. $http_header = ["Authorization" => AUTHORIZATION, "user_agent" => "PHPSoapClient"];
  54. $operationId = date("dmY") . $csbtCustomerId . $csitProductSKU;
  55. $optionsSAR_comercio = ["Security" => SECURITY, "EncodingMethod" => ENCODINGMETHOD, "Merchant" => MERCHANT, "URL_OK" => URL_OK . "?operationid=" . $operationId . "&invoiceid=" . $csitProductSKU, "URL_ERROR" => URL_ERROR . "?operationid=" . $operationId . "&invoiceid=" . $csitProductSKU];
  56. $postfields["CSBTCITY"] = urldecode($csbtCity);
  57. $postfields["CSBTCOUNTRY"] = urldecode($csbtCountry);
  58. $postfields["CSBTCUSTOMERID"] = urldecode($csbtCustomerId);
  59. $postfields["CSBTIPADDRESS"] = urldecode($csbtIpAddress);
  60. $postfields["CSBTEMAIL"] = urldecode($csbtEmail);
  61. $postfields["CSBTFIRSTNAME"] = urldecode($csbtFirstName);
  62. $postfields["CSBTLASTNAME"] = urldecode($csbtLastName);
  63. $postfields["CSBTPHONENUMBER"] = urldecode($csbtPhoneNumber);
  64. $postfields["CSBTPOSTALCODE"] = urldecode($csbtPostalCode);
  65. $postfields["CSBTSTATE"] = urldecode($csbtState);
  66. $postfields["CSBTSTREET1"] = urldecode($csbtStreet1);
  67. $postfields["CSSTCITY"] = urldecode($csstCity);
  68. $postfields["CSSTCOUNTRY"] = urldecode($csstCountry);
  69. $postfields["CSSTEMAIL"] = urldecode($csstEmail);
  70. $postfields["CSSTFIRSTNAME"] = urldecode($csstFirstName);
  71. $postfields["CSSTLASTNAME"] = urldecode($csstLastName);
  72. $postfields["CSSTPHONENUMBER"] = urldecode($csstPhoneNumber);
  73. $postfields["CSSTPOSTALCODE"] = urldecode($csstPostalCode);
  74. $postfields["CSSTSTATE"] = urldecode($csstState);
  75. $postfields["CSSTSTREET1"] = urldecode($csstStreet1);
  76. $postfields["CSPTCURRENCY"] = urldecode($csptCurrency);
  77. $postfields["CSPTGRANDTOTALAMOUNT"] = number_format($csptGrandTotalAmount, 2, ".", "");
  78. $postfields["CSMDD8"] = urldecode($csmdd8);
  79. $postfields["CSITPRODUCTSKU"] = urldecode($csitProductSKU);
  80. $postfields["CSITPRODUCTDESCRIPTION"] = urldecode($csitProductDescription);
  81. $postfields["CSITPRODUCTNAME"] = urldecode($csitProductName);
  82. $postfields["CSITQUANTITY"] = urldecode($csitQuantity);
  83. $postfields["CSITUNITPRICE"] = number_format($csitUnitPrice, 2, ".", "");
  84. $postfields["CSITTOTALAMOUNT"] = number_format($csitTotalAmount, 2, ".", "");
  85. $postfields["CSITPRODUCTCODE"] = PRODUCTCODE;
  86. $optionsSAR_operacion = $postfields;
  87. $optionsSAR_operacion["MERCHANT"] = MERCHANT;
  88. $optionsSAR_operacion["OPERATIONID"] = $operationId;
  89. $optionsSAR_operacion["CURRENCYCODE"] = CURRENCYCODE;
  90. $optionsSAR_operacion["AMOUNT"] = number_format($csptGrandTotalAmount, 2, ".", "");
  91. $optionsSAR_operacion["EMAILCLIENTE"] = urldecode($csbtEmail);
  92. $connector = new TodoPago\Sdk($http_header, ENVMODE);
  93. $rta = $connector->sendAuthorizeRequest($optionsSAR_comercio, $optionsSAR_operacion);
  94. if ($rta["StatusCode"] != -1) {
  95. var_dump($rta);
  96. } else {
  97. setcookie("RequestKey", $rta["RequestKey"], time() + 2592000, "/");
  98. echo "<script language=Javascript> location.href=\"" . $rta["URL_Request"] . "\"; </script>";
  99. exit;
  100. }
  101. ?>