Find this useful? Enter your email to receive occasional updates for securing PHP code.
Signing you up...
Thank you for signing up!
PHP Decode
<?php namespace App\Services; use App\Services\RegularService; use DB; use App\Models\Or..
Decoded Output download
<?php
namespace App\Services; use App\Services\RegularService; use DB; use App\Models\Order; class EmitraService { private static $vlist = array("emitraUrl" => "https://emitraapp.rajasthan.gov.in/webServicesRepository", "merchantcode" => "HAPPY2HELP0523", "officecode" => "HAPPY2HELPHQ", "commtype" => "3"); public static function serviceStatus($SERVICEID) { $route = "emitra.dashboard"; if ($SERVICEID == 11505) { $route = "emitra.dmt.index"; } else { if ($SERVICEID == 11499) { $route = "emitra.pan.create"; } else { if ($SERVICEID == 11500) { $route = "emitra.recharge.mobile"; } else { if ($SERVICEID == 11478) { $route = "emitra.recharge.dth"; } else { if ($SERVICEID == 11512) { $route = "emitra.electricity.create"; } } } } } $time = date("H:i:s"); $services = DB::table("services")->where("service_id", $SERVICEID)->where("status", 1)->whereRAW("start_time<'{$time}' AND end_time>'{$time}'")->first(); if (empty($services)) { return array("status" => false, "msg" => "Service Not Active..Plz Try After Some time"); } return array("status" => true, "route" => $route); } public static function commision($input) { $wallet_type = $input["wallet_type"]; $user_id = $input["user_id"]; $service_id = $input["service_id"]; $amount = $input["amount"]; $time = date("H:i:s"); $services = DB::table("services")->where("service_id", $service_id)->where("status", 1)->whereRAW("start_time<'{$time}' AND end_time>'{$time}'")->first(); if (empty($services)) { return array("status" => false, "msg" => "Service Not Active..Plz Try After Some time"); } $sc = DB::table("services as s")->select("sc.*", "s.providerClass")->leftJoin("service_cms as sc", "sc.service_id", "s.id")->where("s.service_id", $service_id)->where("sc.status", 1)->where("sc.lower_amount_limit", "<=", $amount)->where("sc.amount_limit", ">=", $amount); if (!empty($input["subservice_name"])) { $subservice_name = $input["subservice_name"]; $sc->where("sc.subservice_name", $subservice_name); } $sc = $sc->first(); if (empty($sc)) { return array("status" => false, "msg" => "Amount " . $amount . " is not allowed...plz check amount limit on commission section and try again"); } $data = array(); if ($sc->type == "amount") { $data["commission"] = number_format((double) $sc->commission, 4, ".", ''); $data["surcharge"] = number_format((double) $sc->surcharge, 4, ".", ''); } else { $data["commission"] = $amount * $sc->commission / 100; $data["commission"] = number_format((double) $data["commission"], 4, ".", ''); $data["surcharge"] = $sc->surcharge; $data["surcharge"] = number_format((double) $data["surcharge"], 4, ".", ''); } $data["subservice_name"] = $sc->subservice_name; $data["subservice_id"] = $sc->subservice_id; $data["providerClass"] = $sc->providerClass; return array("status" => true, "data" => $data); } public static function getKioskDetailsJSON($ssoid) { $merchantcode = self::$vlist["merchantcode"]; $data = "MERCHANTCODE={$merchantcode}&SSOID={$ssoid}"; $url = self::$vlist["emitraUrl"] . "/getKioskDetailsJSON"; return RegularService::curlPost($url, $data); } public static function Payment($etnx) { $merchantcode = self::$vlist["merchantcode"]; $officecode = self::$vlist["officecode"]; $commtype = self::$vlist["commtype"]; $user_id = $etnx["user_id"]; $service_data = $etnx["service_data"]; $enc_data_id = $etnx["enc_data_id"]; $SERVICEID = $etnx["SERVICEID"]; $SERVICE = $etnx["SERVICE"]; $sub_service = $etnx["sub_service"]; $SUBSERVICEID = ''; if (!empty($etnx["SUBSERVICEID"])) { $SUBSERVICEID = $etnx["SUBSERVICEID"]; } $CONSUMERNAME = $etnx["CONSUMERNAME"]; $consumerkey = $etnx["consumerkey"]; $amount = $etnx["amount"]; $commisionCharge = $etnx["commisionCharge"]; $REVENUEHEAD = $etnx["REVENUEHEAD"]; $providerClass = empty($etnx["providerClass"]) ? "0" : $etnx["providerClass"]; $encData = DB::table("emitra_logs")->select("service_id", "data")->where("type", "encData")->where("parent_id", $enc_data_id)->first(); $enc_details = json_decode($encData->data); $SSOID = $enc_details->SSOID; $KIOSKCODE = $enc_details->KIOSKCODE; $SSOTOKEN = "0"; $emitratimestamp = date("ymdHis") . RegularService::get_millisecond(); $request_id = "S" . $emitratimestamp . rand(10, 99); $consumerkey = $consumerkey . "-" . $request_id; $checksum_data = "{"SSOID":"" . $SSOID . "","REQUESTID":"" . $request_id . "","REQTIMESTAMP":"" . $emitratimestamp . "","SSOTOKEN":"" . $SSOTOKEN . ""}"; $CHECKSUM = self::emitraMD5Checksum($checksum_data); if (empty($CHECKSUM)) { return array("status" => false, "msg" => "Oops....Something went wrong From Emitra Server...Plz Try Again-CS"); } $request_data = "{"MERCHANTCODE":"" . $merchantcode . "","REQUESTID":"" . $request_id . "","REQTIMESTAMP":"" . $emitratimestamp . "","SERVICEID":"" . $SERVICEID . "","SUBSERVICEID":"" . $SUBSERVICEID . "","REVENUEHEAD":"" . $REVENUEHEAD . "","CONSUMERKEY":"" . $consumerkey . "","CONSUMERNAME":"" . $CONSUMERNAME . "","COMMTYPE":"" . $commtype . "","SSOID":"" . $SSOID . "","OFFICECODE":"" . $officecode . "","SSOTOKEN":"" . $SSOTOKEN . "","CHECKSUM":"" . $CHECKSUM . ""}"; $order_request = array("enc_data_id" => $enc_data_id, "user_id" => $user_id, "kiosk_code" => $KIOSKCODE, "sso_id" => $SSOID, "request_id" => $request_id, "consumer_key" => $consumerkey, "request_data" => $request_data, "service_data" => $service_data, "providerClass" => $providerClass, "service_id" => $SERVICEID, "sub_service" => $sub_service, "wallet_type" => "eMitra Wallet", "amount" => $amount, "commission" => $commisionCharge, "service_status" => 1); $order_request_id = DB::table("order_request")->insertGetId($order_request); $resp = self::emitraAESEncryption($request_data); if (!empty($resp)) { DB::table("order_request")->where("id", $order_request_id)->update(array("response_data" => $resp, "service_status" => 2)); $url = self::$vlist["emitraUrl"] . "/backtobackTransactionWithEncryptionA"; $data = "encData={$resp}"; $resp1 = RegularService::curlPost($url, $data); if (!empty($resp1)) { $resp2 = self::emitraAESDecryption($resp1); if (!empty($resp2)) { $response = json_decode($resp2); if ($response->TRANSACTIONSTATUSCODE == 200) { DB::table("order_request")->where("id", $order_request_id)->update(array("response_data" => $resp2, "service_status" => 4, "wallet_transaction_id" => $response->TRANSACTIONID, "wallet_receipt_no" => $response->RECEIPTNO)); $ordersData = array("tnx_id" => $request_id, "user_id" => $user_id, "kiosk_code" => $KIOSKCODE, "sso_id" => $SSOID, "order_request_id" => $order_request_id, "providerClass" => $providerClass, "service" => $SERVICE, "sub_service" => $sub_service, "wallet_type" => "eMitra Wallet", "consumer_key" => $consumerkey, "amount" => $response->TRANSAMT, "commission" => $commisionCharge, "wallet_transaction_id" => $response->TRANSACTIONID, "wallet_receipt_no" => $response->RECEIPTNO, "order_status" => 5); $order_id = DB::table("orders")->insertGetId($ordersData); return array("status" => true, "msg" => "Service Payment Debited Successfully...!!", "order_id" => $order_id, "tnx_id" => $request_id); } else { DB::table("order_request")->where("id", $order_request_id)->update(array("response_data" => $resp2, "service_status" => 3, "wallet_transaction_id" => $response->TRANSACTIONID, "wallet_receipt_no" => $response->RECEIPTNO)); return array("status" => false, "msg" => $response->MSG); } } else { return array("status" => false, "msg" => "Something went wrong 1-D."); } } else { return array("status" => false, "msg" => "Something went wrong 2-BTE."); } } else { return array("status" => false, "msg" => "Something went wrong 3-En."); } } public static function ReCheckPayment($data) { $MERCHANTCODE = $data["MERCHANTCODE"]; $REQUESTID = $data["REQUESTID"]; $SSOTOKEN = $data["SSOTOKEN"]; $SERVICEID = $data["SERVICEID"]; $checksum_data = "{"MERCHANTCODE":"" . $MERCHANTCODE . "","REQUESTID":"" . $REQUESTID . "","SSOTOKEN":"" . $SSOTOKEN . ""}"; $CHECKSUM = self::emitraMD5Checksum($checksum_data); $req_data = "{"MERCHANTCODE":"" . $MERCHANTCODE . "","SERVICEID":"" . $SERVICEID . "","REQUESTID":"" . $REQUESTID . "","SSOTOKEN":"" . $SSOTOKEN . "","CHECKSUM":"" . $CHECKSUM . ""}"; $resp = self::emitraAESEncryption($req_data); if (empty($resp)) { return array("status" => false, "msg" => "Something went wrong 1"); } $url = self::$vlist["emitraUrl"] . "/getTokenVerifyNewProcessByRequestIdWithEncryption"; $resp1 = RegularService::curlPost($url, "encData={$resp}"); if (empty($resp1)) { return array("status" => false, "msg" => "Something went wrong 2"); } $resp2 = self::emitraAESDecryption($resp1); if (empty($resp2)) { return array("status" => false, "msg" => "Something went wrong 3"); } return array("status" => true, "msg" => "data found", "response" => $resp2); } public static function refund($data) { if (empty($data["EMITRATOKEN"]) && !empty($data["TNX_ID"])) { $TNX_ID = $data["TNX_ID"]; $ID = $data["ID"]; $order = Order::where("order_status", 5)->where("tnx_id", $TNX_ID)->where("id", $ID)->first(); if (empty($order)) { return array("status" => false, "msg" => "Something went wrong -no order found with success"); } $ID = $order->id; $EMITRATOKEN = $order->wallet_transaction_id; $enc_data_id = $order->OrderRequest->enc_data_id; $order_request_id = $order->order_request_id; $request_data = $order->OrderRequest->request_data; $request_data = json_decode($request_data, true); $MERCHANTCODE = $request_data["MERCHANTCODE"]; $REQUESTID = $request_data["REQUESTID"]; $CANCELREMARK = empty($data["CANCELREMARK"]) ? "Refund" : $data["CANCELREMARK"]; $SSOTOKEN = "0"; } else { $ID = $data["ID"]; $EMITRATOKEN = $data["EMITRATOKEN"]; $enc_data_id = $data["enc_data_id"]; $order_request_id = $data["order_request_id"]; $MERCHANTCODE = $data["MERCHANTCODE"]; $REQUESTID = $data["REQUESTID"]; $SSOTOKEN = $data["SSOTOKEN"]; $CANCELREMARK = empty($data["CANCELREMARK"]) ? "Refund" : $data["CANCELREMARK"]; } $bdays = date("Y-m-d", strtotime(date("Y-m-d") . " - 4 days")); $order = DB::table("orders")->where("id", $ID)->where("created_at", ">", $bdays)->first(); if (empty($order)) { return array("status" => false, "msg" => "Refund Period Over"); } $checksum_data = "{"MERCHANTCODE":"" . $MERCHANTCODE . "","REQUESTID":"" . $REQUESTID . "","SSOTOKEN":"" . $SSOTOKEN . ""}"; $CHECKSUM = self::emitraMD5Checksum($checksum_data); $request_data = "{"MERCHANTCODE":"" . $MERCHANTCODE . "","REQUESTID":"" . $REQUESTID . "","EMITRATOKEN":"" . $EMITRATOKEN . "","CANCELREMARK":"" . $CANCELREMARK . "","ENTITYTYPEID":"2","SSOTOKEN":"" . $SSOTOKEN . "","CHECKSUM":"" . $CHECKSUM . ""}"; $resp = self::emitraAESEncryption($request_data); if (empty($resp)) { return array("status" => false, "msg" => "Something went wrong 1"); } $url = self::$vlist["emitraUrl"] . "/backendTransCancelByDepartmentWithEncryption"; $resp1 = RegularService::curlPost($url, "encData={$resp}"); if (empty($resp1)) { return array("status" => false, "msg" => "Something went wrong 2"); } $resp2 = self::emitraAESDecryption($resp1); if (empty($resp2)) { return array("status" => false, "msg" => "Something went wrong 3"); } $response = json_decode($resp2); if ($response->CANCELSTATUSCODE == 200 || $response->MSG == "Transaction Already Cancelled.") { $refund_date = date("Y-m-d H:i:s"); DB::table("orders")->where("id", $ID)->where("wallet_transaction_id", $EMITRATOKEN)->update(array("order_status" => 10, "refund_date" => $refund_date, "remark" => $CANCELREMARK)); DB::table("order_request")->where("id", $order_request_id)->update(array("service_status" => 10)); DB::table("emitra_logs")->insert(array("type" => "refund", "parent_id" => $enc_data_id, "data" => $resp2)); return array("status" => true, "msg" => "Refund generated Successfully"); } else { return array("status" => false, "msg" => $response->MSG); } } public static function postingFnc($APPLICATIONID, $REQUESTID, $TRANSACTIONID, $SSOTOKEN) { $emitratimestamp = date("YmdHis", time()) . RegularService::get_millisecond(); $checksum_data = "{"REQUESTID":"" . $REQUESTID . "","TRANSACTIONID":"" . $TRANSACTIONID . "","APPLICATIONID":"" . $APPLICATIONID . "","SSOTOKEN":"" . $SSOTOKEN . ""}"; $CHECKSUM = self::emitraMD5Checksum($checksum_data); $merchantcode = self::$vlist["merchantcode"]; $data = "{"MERCHANTCODE":"" . $merchantcode . "","REQUESTID":"" . $REQUESTID . "","REQTIMESTAMP":"" . $emitratimestamp . "","TRANSACTIONID":"" . $TRANSACTIONID . "","APPLICATIONID":"" . $APPLICATIONID . "","SSOTOKEN":"" . $SSOTOKEN . "","CHECKSUM":"" . $CHECKSUM . ""}"; $resp = self::emitraAESEncryption($data); $url = self::$vlist["emitraUrl"] . "/updateTransactionPostingWithEncryption"; $resp1 = RegularService::curlPost($url, "encData={$resp}"); $resp2 = self::emitraAESDecryption($resp1); return $resp2; } public static function emitraMD5Checksum($checksum_data) { $checksum_url = self::$vlist["emitraUrl"] . "/emitraMD5Checksum"; $checksum_data = "toBeCheckSumString=" . $checksum_data; return $checksum_data = RegularService::curlPost($checksum_url, $checksum_data); } public static function emitraAESEncryption($request_data) { $url = self::$vlist["emitraUrl"] . "/emitraAESEncryption"; $data = "toBeEncrypt=" . $request_data; return $checksum_data = RegularService::curlPost($url, $data); } public static function emitraAESDecryption($data) { $url = self::$vlist["emitraUrl"] . "/emitraAESDecryption"; $data = "toBeDecrypt={$data}"; return $checksum_data = RegularService::curlPost($url, $data); } public static function enc() { $plaintext = "hello"; $key = "E-m!tr@2016"; $iv = random_bytes(16); $ciphertext = openssl_encrypt($plaintext, "aes-256-cbc", $key, OPENSSL_RAW_DATA, $iv); $ivCiphertext = $iv . $ciphertext; $ivCiphertextB64 = base64_encode($ivCiphertext); $ivCiphertextB64 = "rQhwqMxU3KBRXa6oKXlCZ/1IP0RznY9IRippbpQPPDVN5uNaJjIlFiY7cGcr9q4hw9EAE0kbT2DLOoGo1jtW9lI+gqzFdNVB8xNvcGUyjsdCEmzY16wPmjnV3KKBq5sWbUUBoFU35TfOPR9an3mWI9ouSO3LTDug1sJK5zlAacQEIF5Ob7sm0qj7ziH0sPLNPny6Q6pjJyIzWdmaH1I23CShV0cI0lXxVkeOAo9WkfcTZ+LQpwlUamRxdzRNo54+rEyWDDfpQaFWNNbg1qmvG/JqPjz0XQ2SOSLWpVzV7dItGoBXLcUTPTlE67HD+jrCRsZ1qY14dWwmX/I3cYFENROALcfcMulwLv8lzedQwZxDmu/KzG17uCif9h/J+daao5EdYzQnOnHKpspqd2Y2AEuww7YOSa9PeNR1TZu+UAIGkXSUbHQANg4oXama5/I9Ro+0GaXqX+Jc9DzoOV4OAO53WSAv2IFsp0vALoksxY2b+15GkgizXi57aTF2arUlpbMYe38NfIKcLNQZk1UbW3A2SreDJPJPGkgbUmb32Nrcn/cAxJtak+fMVBkrOhEmbosWselv9lMYtvkMDltQ37mgLaEFOiSfhwaeLruoMvK3rp05Rq+Os6cInrdPqh6he8ImwhSnNWk8JtFc0sZi22Yb+X+Z/m6QrNXZ9Tps+NKwZTlO/chvKkJIfhi0TsqchW6PAGai0nNFrDNfweEQQZyJA8ZQa2U0XG++kuI8inrtQMNxdB4MdnR25u+mjh5kFgSKYpZUNvH16W1JCRG/c5bAo1cGyxboS4jVpOBUqrbno7HoM/QNzc039xWPI5G6ugM41YYhC/vfPG96tKeTcw=="; echo $ddd = self::decrypt($ivCiphertextB64); die; die($ivCiphertextB64); } function decrypt($ivCiphertextB64) { $key = "E-m!tr@2016"; $ivCiphertext = base64_decode($ivCiphertextB64); $iv = substr($ivCiphertext, 0, 16); $ciphertext = substr($ivCiphertext, 16); $decryptedData = openssl_decrypt($ciphertext, "aes-256-cbc", $key, OPENSSL_RAW_DATA, $iv); print_r(openssl_error_string()); return $decryptedData; } } ?>
Did this file decode correctly?
Original Code
<?php
namespace App\Services; use App\Services\RegularService; use DB; use App\Models\Order; class EmitraService { private static $vlist = array("\145\155\x69\x74\x72\x61\x55\162\154" => "\150\164\164\x70\163\x3a\x2f\57\x65\x6d\151\x74\x72\x61\x61\x70\x70\56\162\x61\x6a\x61\x73\x74\150\x61\x6e\56\x67\x6f\166\x2e\x69\156\x2f\x77\145\x62\x53\145\x72\x76\151\143\x65\163\122\145\x70\x6f\163\x69\x74\x6f\x72\x79", "\x6d\145\162\143\x68\x61\x6e\164\x63\157\144\x65" => "\110\x41\120\x50\131\x32\110\x45\114\120\x30\x35\62\x33", "\157\146\x66\x69\x63\x65\143\x6f\144\145" => "\110\101\x50\x50\x59\x32\110\105\114\x50\110\121", "\143\157\x6d\x6d\164\x79\160\x65" => "\x33"); public static function serviceStatus($SERVICEID) { $route = "\145\155\151\164\x72\x61\56\x64\x61\163\150\142\x6f\141\x72\144"; if ($SERVICEID == 11505) { $route = "\145\155\x69\x74\162\141\56\144\155\x74\56\x69\x6e\144\145\x78"; } else { if ($SERVICEID == 11499) { $route = "\145\155\x69\164\x72\141\56\x70\x61\156\x2e\143\x72\145\x61\164\x65"; } else { if ($SERVICEID == 11500) { $route = "\145\155\151\x74\x72\x61\x2e\x72\145\143\x68\x61\162\147\145\x2e\x6d\x6f\x62\151\x6c\145"; } else { if ($SERVICEID == 11478) { $route = "\145\x6d\151\164\162\x61\56\x72\x65\x63\x68\x61\162\147\145\x2e\144\x74\150"; } else { if ($SERVICEID == 11512) { $route = "\145\x6d\151\164\x72\x61\56\x65\154\145\143\x74\x72\x69\x63\151\164\171\56\x63\162\x65\x61\164\145"; } } } } } $time = date("\x48\x3a\x69\72\163"); $services = DB::table("\x73\145\162\x76\x69\x63\x65\x73")->where("\163\x65\x72\166\151\x63\x65\137\x69\x64", $SERVICEID)->where("\163\164\141\164\165\163", 1)->whereRAW("\163\164\x61\x72\x74\x5f\x74\x69\x6d\x65\x3c\x27{$time}\x27\40\x41\x4e\x44\40\145\x6e\144\x5f\x74\151\155\145\76\47{$time}\47")->first(); if (empty($services)) { return array("\x73\164\x61\x74\165\x73" => false, "\155\163\x67" => "\x53\x65\162\x76\151\143\145\40\116\x6f\164\40\x41\143\164\x69\x76\145\56\x2e\x50\x6c\172\40\124\162\171\40\101\146\164\x65\162\x20\x53\x6f\x6d\x65\x20\164\151\155\145"); } return array("\x73\164\141\164\x75\x73" => true, "\x72\x6f\x75\164\x65" => $route); } public static function commision($input) { $wallet_type = $input["\167\141\x6c\x6c\145\x74\x5f\x74\x79\160\x65"]; $user_id = $input["\x75\163\145\162\x5f\151\144"]; $service_id = $input["\x73\x65\x72\166\x69\x63\x65\137\x69\x64"]; $amount = $input["\141\155\157\165\156\x74"]; $time = date("\110\72\151\72\163"); $services = DB::table("\163\145\x72\166\151\143\x65\x73")->where("\x73\145\x72\x76\151\143\x65\137\151\144", $service_id)->where("\163\x74\141\x74\x75\163", 1)->whereRAW("\163\x74\141\x72\164\x5f\164\151\x6d\x65\74\x27{$time}\47\40\101\x4e\104\x20\x65\x6e\x64\137\164\x69\155\145\76\x27{$time}\47")->first(); if (empty($services)) { return array("\x73\164\141\164\165\x73" => false, "\155\x73\147" => "\x53\145\162\x76\151\x63\145\40\x4e\157\x74\40\x41\x63\164\x69\166\145\x2e\x2e\x50\x6c\x7a\x20\x54\x72\171\x20\101\x66\164\x65\x72\40\123\x6f\155\145\x20\164\151\x6d\x65"); } $sc = DB::table("\163\145\x72\x76\151\143\145\163\40\141\163\x20\163")->select("\163\143\x2e\x2a", "\163\x2e\160\x72\157\166\151\x64\145\162\103\154\x61\x73\x73")->leftJoin("\x73\145\162\166\151\x63\x65\137\143\x6d\163\40\x61\x73\x20\x73\143", "\x73\143\56\163\145\x72\x76\x69\x63\x65\137\x69\x64", "\163\x2e\x69\144")->where("\x73\56\x73\x65\x72\166\151\143\145\x5f\151\144", $service_id)->where("\x73\143\x2e\163\164\x61\x74\165\x73", 1)->where("\x73\143\x2e\x6c\157\x77\145\x72\137\141\x6d\157\165\x6e\x74\x5f\154\151\155\x69\x74", "\74\x3d", $amount)->where("\x73\x63\x2e\141\x6d\157\165\x6e\x74\137\x6c\151\155\x69\x74", "\x3e\x3d", $amount); if (!empty($input["\x73\165\x62\163\145\x72\166\x69\143\x65\137\156\141\155\x65"])) { $subservice_name = $input["\x73\165\x62\163\x65\162\166\x69\143\145\x5f\156\141\x6d\x65"]; $sc->where("\x73\143\56\163\165\142\163\145\x72\166\151\143\145\137\x6e\141\x6d\x65", $subservice_name); } $sc = $sc->first(); if (empty($sc)) { return array("\x73\164\x61\164\165\163" => false, "\155\x73\147" => "\101\x6d\157\x75\156\164\40" . $amount . "\x20\x69\x73\x20\156\157\x74\x20\141\154\x6c\157\167\x65\x64\x2e\x2e\56\160\154\172\x20\143\x68\x65\143\153\x20\x61\x6d\157\x75\x6e\164\x20\154\x69\x6d\151\x74\40\157\156\x20\x63\157\x6d\155\x69\x73\x73\151\157\156\40\x73\145\x63\x74\151\157\x6e\40\141\x6e\144\40\164\x72\171\x20\141\x67\141\151\156"); } $data = array(); if ($sc->type == "\x61\x6d\x6f\165\156\164") { $data["\143\x6f\155\x6d\x69\x73\163\151\157\156"] = number_format((double) $sc->commission, 4, "\x2e", ''); $data["\163\165\162\143\150\141\162\x67\x65"] = number_format((double) $sc->surcharge, 4, "\x2e", ''); } else { $data["\143\157\155\155\x69\163\x73\151\x6f\156"] = $amount * $sc->commission / 100; $data["\143\x6f\x6d\155\151\x73\163\151\157\156"] = number_format((double) $data["\x63\157\x6d\155\151\163\163\x69\157\156"], 4, "\x2e", ''); $data["\x73\x75\162\143\150\x61\x72\147\145"] = $sc->surcharge; $data["\x73\165\162\143\150\141\162\x67\145"] = number_format((double) $data["\163\x75\x72\x63\150\x61\x72\147\x65"], 4, "\x2e", ''); } $data["\163\165\142\x73\145\x72\x76\151\x63\145\x5f\x6e\141\x6d\x65"] = $sc->subservice_name; $data["\163\x75\x62\163\145\162\x76\151\143\x65\x5f\x69\x64"] = $sc->subservice_id; $data["\x70\162\157\166\151\144\x65\x72\103\154\x61\163\x73"] = $sc->providerClass; return array("\x73\164\x61\x74\165\163" => true, "\x64\141\164\141" => $data); } public static function getKioskDetailsJSON($ssoid) { $merchantcode = self::$vlist["\155\x65\x72\x63\150\141\156\x74\143\157\x64\x65"]; $data = "\115\x45\x52\x43\x48\x41\x4e\124\103\x4f\104\105\x3d{$merchantcode}\46\123\x53\x4f\x49\x44\x3d{$ssoid}"; $url = self::$vlist["\145\x6d\x69\x74\162\141\125\162\x6c"] . "\x2f\147\145\x74\113\x69\x6f\x73\153\x44\x65\164\x61\151\154\x73\x4a\x53\117\x4e"; return RegularService::curlPost($url, $data); } public static function Payment($etnx) { $merchantcode = self::$vlist["\x6d\x65\162\x63\150\141\156\x74\143\x6f\144\x65"]; $officecode = self::$vlist["\x6f\146\146\x69\x63\145\x63\x6f\x64\x65"]; $commtype = self::$vlist["\x63\x6f\155\155\x74\171\x70\x65"]; $user_id = $etnx["\x75\x73\145\162\x5f\151\x64"]; $service_data = $etnx["\x73\x65\162\x76\x69\143\145\x5f\x64\x61\x74\141"]; $enc_data_id = $etnx["\145\156\143\137\x64\141\164\x61\x5f\151\x64"]; $SERVICEID = $etnx["\123\x45\x52\x56\111\103\105\x49\x44"]; $SERVICE = $etnx["\x53\105\122\x56\x49\x43\105"]; $sub_service = $etnx["\x73\165\x62\x5f\163\145\x72\x76\151\x63\x65"]; $SUBSERVICEID = ''; if (!empty($etnx["\123\125\102\x53\105\122\x56\111\103\x45\111\x44"])) { $SUBSERVICEID = $etnx["\x53\x55\x42\123\105\122\126\111\x43\105\111\104"]; } $CONSUMERNAME = $etnx["\x43\117\116\123\125\x4d\105\x52\116\x41\x4d\105"]; $consumerkey = $etnx["\x63\x6f\x6e\163\x75\x6d\145\162\153\145\171"]; $amount = $etnx["\141\x6d\157\x75\156\164"]; $commisionCharge = $etnx["\x63\157\155\155\151\163\x69\x6f\x6e\x43\x68\141\x72\147\x65"]; $REVENUEHEAD = $etnx["\x52\x45\x56\x45\x4e\125\105\110\105\101\x44"]; $providerClass = empty($etnx["\x70\x72\157\166\151\x64\x65\162\x43\154\x61\x73\163"]) ? "\60" : $etnx["\x70\x72\x6f\166\151\x64\x65\162\103\x6c\x61\x73\163"]; $encData = DB::table("\x65\x6d\151\164\162\x61\137\x6c\x6f\x67\163")->select("\x73\x65\162\x76\x69\x63\145\x5f\151\x64", "\x64\141\164\141")->where("\x74\x79\x70\145", "\x65\x6e\x63\x44\x61\x74\x61")->where("\160\x61\162\x65\x6e\164\x5f\151\144", $enc_data_id)->first(); $enc_details = json_decode($encData->data); $SSOID = $enc_details->SSOID; $KIOSKCODE = $enc_details->KIOSKCODE; $SSOTOKEN = "\60"; $emitratimestamp = date("\171\x6d\144\x48\x69\x73") . RegularService::get_millisecond(); $request_id = "\x53" . $emitratimestamp . rand(10, 99); $consumerkey = $consumerkey . "\55" . $request_id; $checksum_data = "\173\42\x53\123\x4f\x49\x44\x22\72\42" . $SSOID . "\42\54\42\x52\x45\121\125\x45\123\124\x49\x44\42\72\42" . $request_id . "\42\54\42\122\105\121\124\111\115\x45\x53\124\x41\x4d\120\42\x3a\42" . $emitratimestamp . "\42\54\42\123\123\117\124\x4f\x4b\105\x4e\x22\x3a\x22" . $SSOTOKEN . "\x22\175"; $CHECKSUM = self::emitraMD5Checksum($checksum_data); if (empty($CHECKSUM)) { return array("\x73\x74\x61\164\165\x73" => false, "\x6d\163\147" => "\117\157\x70\163\x2e\56\56\56\123\x6f\155\x65\x74\150\151\x6e\147\x20\167\x65\156\164\40\167\162\x6f\x6e\x67\x20\106\x72\157\x6d\x20\x45\x6d\x69\x74\162\141\x20\x53\145\x72\x76\x65\x72\x2e\56\x2e\x50\x6c\172\x20\124\x72\171\x20\x41\x67\x61\x69\156\55\103\x53"); } $request_data = "\x7b\42\115\105\122\x43\x48\101\x4e\x54\103\x4f\104\105\42\x3a\42" . $merchantcode . "\42\x2c\42\x52\105\x51\x55\105\x53\x54\111\104\42\72\42" . $request_id . "\42\x2c\42\122\105\x51\124\x49\x4d\x45\123\124\x41\115\x50\42\x3a\x22" . $emitratimestamp . "\42\x2c\42\x53\x45\x52\x56\111\x43\x45\x49\104\x22\x3a\42" . $SERVICEID . "\42\x2c\42\x53\x55\102\x53\x45\122\126\x49\x43\x45\111\x44\42\72\42" . $SUBSERVICEID . "\42\54\x22\122\x45\x56\105\116\x55\105\x48\x45\101\x44\42\72\x22" . $REVENUEHEAD . "\42\x2c\42\103\117\x4e\x53\125\115\x45\122\113\105\x59\x22\72\x22" . $consumerkey . "\42\x2c\x22\x43\117\x4e\123\x55\x4d\x45\122\116\x41\115\105\x22\72\x22" . $CONSUMERNAME . "\x22\54\42\103\117\115\x4d\124\x59\120\x45\42\x3a\42" . $commtype . "\x22\54\42\x53\123\x4f\x49\x44\x22\72\42" . $SSOID . "\x22\x2c\x22\x4f\106\106\x49\103\x45\x43\117\x44\x45\42\x3a\x22" . $officecode . "\x22\54\42\x53\123\x4f\x54\117\x4b\105\x4e\42\72\x22" . $SSOTOKEN . "\42\x2c\x22\103\x48\105\103\113\x53\125\115\x22\x3a\x22" . $CHECKSUM . "\42\x7d"; $order_request = array("\x65\x6e\143\x5f\x64\x61\x74\141\x5f\x69\144" => $enc_data_id, "\165\x73\x65\162\x5f\x69\144" => $user_id, "\153\x69\x6f\x73\153\137\143\x6f\144\145" => $KIOSKCODE, "\163\163\157\137\x69\x64" => $SSOID, "\x72\145\x71\x75\x65\x73\x74\137\x69\x64" => $request_id, "\143\x6f\156\x73\165\x6d\145\162\x5f\153\x65\x79" => $consumerkey, "\x72\145\x71\x75\145\x73\164\137\144\141\x74\141" => $request_data, "\163\145\x72\166\151\x63\145\137\144\141\x74\x61" => $service_data, "\160\162\x6f\x76\151\x64\145\162\103\x6c\x61\163\x73" => $providerClass, "\x73\x65\162\166\x69\143\x65\137\151\x64" => $SERVICEID, "\x73\165\x62\137\x73\x65\x72\166\x69\x63\145" => $sub_service, "\167\141\x6c\154\x65\164\137\x74\171\x70\145" => "\x65\115\151\x74\162\x61\40\x57\x61\154\x6c\x65\164", "\x61\x6d\x6f\165\x6e\x74" => $amount, "\143\157\x6d\x6d\151\x73\163\x69\157\156" => $commisionCharge, "\163\145\162\x76\x69\143\x65\x5f\163\x74\x61\164\x75\163" => 1); $order_request_id = DB::table("\x6f\162\x64\x65\162\137\162\145\x71\165\x65\163\x74")->insertGetId($order_request); $resp = self::emitraAESEncryption($request_data); if (!empty($resp)) { DB::table("\157\x72\144\145\162\137\162\145\161\165\x65\163\164")->where("\x69\x64", $order_request_id)->update(array("\x72\x65\x73\160\157\156\x73\145\137\144\x61\x74\141" => $resp, "\x73\145\x72\166\x69\143\x65\137\x73\x74\x61\x74\x75\x73" => 2)); $url = self::$vlist["\x65\155\151\x74\162\x61\x55\x72\154"] . "\x2f\x62\x61\143\x6b\164\x6f\142\141\143\x6b\124\x72\x61\156\x73\141\143\x74\151\157\x6e\x57\151\164\150\x45\156\x63\x72\x79\x70\x74\x69\157\156\x41"; $data = "\145\x6e\x63\104\141\x74\141\75{$resp}"; $resp1 = RegularService::curlPost($url, $data); if (!empty($resp1)) { $resp2 = self::emitraAESDecryption($resp1); if (!empty($resp2)) { $response = json_decode($resp2); if ($response->TRANSACTIONSTATUSCODE == 200) { DB::table("\157\162\144\145\162\137\162\x65\x71\x75\145\x73\x74")->where("\x69\144", $order_request_id)->update(array("\x72\x65\163\x70\157\156\163\145\137\x64\141\164\x61" => $resp2, "\163\145\162\166\x69\143\145\137\163\x74\x61\x74\x75\163" => 4, "\x77\141\x6c\x6c\145\x74\137\x74\162\141\156\163\141\143\164\x69\157\156\x5f\x69\144" => $response->TRANSACTIONID, "\167\141\x6c\x6c\145\x74\137\162\x65\x63\x65\151\160\164\x5f\156\x6f" => $response->RECEIPTNO)); $ordersData = array("\x74\156\x78\x5f\151\144" => $request_id, "\x75\x73\145\x72\x5f\x69\144" => $user_id, "\x6b\151\157\x73\x6b\137\x63\157\x64\x65" => $KIOSKCODE, "\x73\x73\x6f\137\151\144" => $SSOID, "\157\162\x64\x65\x72\137\x72\x65\x71\165\145\x73\164\x5f\151\144" => $order_request_id, "\160\x72\x6f\166\151\x64\x65\162\103\x6c\x61\163\x73" => $providerClass, "\x73\x65\x72\166\151\x63\145" => $SERVICE, "\163\165\142\137\163\145\162\166\x69\x63\145" => $sub_service, "\167\141\x6c\154\x65\164\x5f\x74\x79\160\145" => "\x65\115\x69\164\162\141\x20\x57\x61\x6c\154\145\164", "\143\157\x6e\x73\165\x6d\145\x72\x5f\153\145\171" => $consumerkey, "\141\155\157\165\156\164" => $response->TRANSAMT, "\x63\157\x6d\155\151\163\x73\151\x6f\x6e" => $commisionCharge, "\x77\x61\154\154\145\x74\x5f\164\162\x61\156\163\x61\143\x74\x69\x6f\156\x5f\151\x64" => $response->TRANSACTIONID, "\x77\x61\x6c\x6c\x65\x74\137\x72\x65\143\145\151\160\x74\x5f\156\x6f" => $response->RECEIPTNO, "\157\162\x64\x65\162\x5f\163\164\x61\x74\165\163" => 5); $order_id = DB::table("\157\162\x64\x65\x72\x73")->insertGetId($ordersData); return array("\x73\x74\x61\x74\x75\163" => true, "\x6d\163\147" => "\x53\145\x72\x76\x69\143\145\40\x50\141\171\x6d\x65\x6e\x74\40\104\x65\x62\151\x74\145\x64\40\x53\x75\143\143\x65\163\163\146\x75\x6c\154\x79\56\56\56\41\x21", "\x6f\x72\144\145\x72\x5f\151\144" => $order_id, "\x74\x6e\170\137\x69\x64" => $request_id); } else { DB::table("\x6f\x72\144\145\162\137\x72\145\161\x75\x65\163\x74")->where("\x69\x64", $order_request_id)->update(array("\x72\x65\x73\x70\157\x6e\x73\145\x5f\144\x61\x74\x61" => $resp2, "\163\x65\162\166\x69\143\x65\137\163\164\141\x74\165\163" => 3, "\167\x61\x6c\x6c\145\x74\x5f\x74\x72\141\x6e\163\141\x63\x74\x69\157\x6e\137\x69\x64" => $response->TRANSACTIONID, "\x77\141\x6c\154\145\164\x5f\x72\145\x63\145\151\160\x74\x5f\156\157" => $response->RECEIPTNO)); return array("\163\x74\141\164\165\x73" => false, "\x6d\x73\147" => $response->MSG); } } else { return array("\163\x74\x61\x74\x75\163" => false, "\x6d\163\x67" => "\123\157\155\x65\164\150\x69\x6e\x67\40\x77\x65\x6e\164\40\x77\162\157\156\x67\40\61\55\x44\x2e"); } } else { return array("\163\x74\141\164\165\163" => false, "\155\163\147" => "\123\157\155\145\x74\x68\x69\156\147\40\x77\145\x6e\x74\x20\167\x72\157\156\x67\40\62\x2d\x42\x54\105\x2e"); } } else { return array("\163\164\141\x74\165\163" => false, "\x6d\163\x67" => "\123\x6f\155\x65\x74\x68\151\x6e\x67\x20\x77\145\x6e\x74\40\167\x72\x6f\x6e\147\x20\x33\55\105\x6e\56"); } } public static function ReCheckPayment($data) { $MERCHANTCODE = $data["\x4d\105\122\103\110\101\116\124\x43\x4f\104\105"]; $REQUESTID = $data["\122\105\x51\125\x45\x53\x54\x49\104"]; $SSOTOKEN = $data["\123\123\117\x54\117\113\x45\116"]; $SERVICEID = $data["\x53\105\122\126\111\x43\105\x49\x44"]; $checksum_data = "\x7b\x22\115\105\x52\103\110\x41\x4e\x54\103\117\x44\x45\x22\72\x22" . $MERCHANTCODE . "\x22\x2c\x22\122\105\121\125\105\123\x54\111\104\x22\72\42" . $REQUESTID . "\42\54\42\123\123\x4f\x54\x4f\x4b\x45\x4e\x22\x3a\42" . $SSOTOKEN . "\42\175"; $CHECKSUM = self::emitraMD5Checksum($checksum_data); $req_data = "\173\x22\x4d\x45\122\x43\110\101\x4e\124\103\x4f\x44\105\x22\72\42" . $MERCHANTCODE . "\42\54\x22\123\x45\122\126\x49\103\x45\x49\104\42\72\42" . $SERVICEID . "\42\x2c\42\122\x45\121\125\x45\123\124\x49\104\x22\x3a\x22" . $REQUESTID . "\42\x2c\42\x53\123\117\x54\117\113\105\116\x22\x3a\42" . $SSOTOKEN . "\x22\54\42\103\x48\x45\103\x4b\123\125\x4d\x22\72\42" . $CHECKSUM . "\42\175"; $resp = self::emitraAESEncryption($req_data); if (empty($resp)) { return array("\x73\164\x61\x74\x75\163" => false, "\x6d\163\x67" => "\123\x6f\155\145\164\x68\x69\156\x67\40\x77\x65\x6e\x74\x20\x77\x72\157\x6e\147\x20\x31"); } $url = self::$vlist["\145\x6d\x69\x74\162\x61\125\162\x6c"] . "\57\x67\x65\x74\124\x6f\153\x65\156\x56\145\162\151\x66\x79\116\x65\x77\120\162\x6f\x63\x65\x73\x73\x42\171\x52\145\x71\165\x65\x73\x74\x49\x64\127\x69\164\150\105\156\143\x72\171\x70\164\x69\157\156"; $resp1 = RegularService::curlPost($url, "\145\156\143\104\141\x74\141\75{$resp}"); if (empty($resp1)) { return array("\163\x74\x61\164\x75\x73" => false, "\155\163\147" => "\123\x6f\155\x65\164\150\151\x6e\x67\40\x77\x65\x6e\164\40\x77\x72\157\x6e\x67\40\62"); } $resp2 = self::emitraAESDecryption($resp1); if (empty($resp2)) { return array("\163\x74\x61\x74\x75\163" => false, "\155\x73\147" => "\123\x6f\155\145\164\150\x69\x6e\147\x20\x77\x65\156\x74\x20\167\162\157\x6e\147\x20\63"); } return array("\163\164\x61\x74\x75\163" => true, "\x6d\x73\x67" => "\144\x61\164\141\x20\146\x6f\165\x6e\x64", "\162\x65\x73\x70\157\x6e\x73\145" => $resp2); } public static function refund($data) { if (empty($data["\105\115\x49\x54\122\101\x54\117\113\105\116"]) && !empty($data["\124\116\130\x5f\x49\104"])) { $TNX_ID = $data["\x54\x4e\130\x5f\x49\104"]; $ID = $data["\x49\x44"]; $order = Order::where("\x6f\x72\x64\145\x72\137\163\x74\x61\x74\x75\x73", 5)->where("\x74\156\x78\x5f\x69\144", $TNX_ID)->where("\151\x64", $ID)->first(); if (empty($order)) { return array("\x73\x74\141\x74\x75\x73" => false, "\x6d\163\147" => "\x53\157\x6d\145\164\x68\x69\x6e\x67\40\167\x65\x6e\164\40\167\x72\x6f\156\x67\40\x2d\x6e\157\x20\x6f\x72\144\x65\x72\x20\146\x6f\165\x6e\144\x20\x77\x69\x74\x68\x20\163\x75\143\143\145\x73\x73"); } $ID = $order->id; $EMITRATOKEN = $order->wallet_transaction_id; $enc_data_id = $order->OrderRequest->enc_data_id; $order_request_id = $order->order_request_id; $request_data = $order->OrderRequest->request_data; $request_data = json_decode($request_data, true); $MERCHANTCODE = $request_data["\115\x45\x52\103\110\x41\x4e\124\103\x4f\x44\105"]; $REQUESTID = $request_data["\x52\105\121\x55\x45\123\x54\x49\x44"]; $CANCELREMARK = empty($data["\103\x41\116\x43\x45\114\x52\x45\x4d\101\x52\x4b"]) ? "\122\145\x66\165\156\x64" : $data["\103\101\x4e\103\x45\x4c\x52\x45\115\x41\122\x4b"]; $SSOTOKEN = "\60"; } else { $ID = $data["\111\x44"]; $EMITRATOKEN = $data["\x45\115\111\x54\x52\x41\x54\117\x4b\x45\116"]; $enc_data_id = $data["\145\156\x63\137\x64\x61\164\x61\x5f\x69\144"]; $order_request_id = $data["\x6f\162\144\145\162\x5f\162\145\161\165\x65\x73\x74\137\x69\x64"]; $MERCHANTCODE = $data["\115\105\122\103\x48\x41\x4e\x54\103\117\x44\x45"]; $REQUESTID = $data["\x52\105\121\x55\x45\123\124\x49\104"]; $SSOTOKEN = $data["\x53\123\117\124\117\113\x45\x4e"]; $CANCELREMARK = empty($data["\103\x41\x4e\103\105\x4c\x52\105\115\x41\122\113"]) ? "\x52\x65\146\165\x6e\144" : $data["\x43\x41\116\103\105\x4c\x52\105\x4d\101\x52\113"]; } $bdays = date("\131\55\x6d\55\x64", strtotime(date("\131\55\x6d\x2d\x64") . "\x20\x2d\x20\x34\40\144\141\171\163")); $order = DB::table("\x6f\x72\x64\x65\x72\163")->where("\151\x64", $ID)->where("\x63\x72\145\141\x74\145\x64\137\141\x74", "\x3e", $bdays)->first(); if (empty($order)) { return array("\x73\164\x61\x74\x75\163" => false, "\155\x73\x67" => "\122\145\x66\x75\x6e\144\40\x50\145\x72\x69\x6f\x64\x20\117\x76\145\x72"); } $checksum_data = "\x7b\42\x4d\105\122\x43\110\x41\x4e\124\x43\x4f\104\105\x22\72\42" . $MERCHANTCODE . "\42\54\42\122\105\x51\125\105\x53\124\x49\104\x22\72\42" . $REQUESTID . "\x22\54\42\x53\123\117\124\117\113\x45\x4e\x22\x3a\42" . $SSOTOKEN . "\42\175"; $CHECKSUM = self::emitraMD5Checksum($checksum_data); $request_data = "\x7b\42\115\105\122\x43\110\x41\x4e\x54\x43\117\x44\x45\42\72\x22" . $MERCHANTCODE . "\42\54\42\122\x45\121\125\105\123\124\x49\104\x22\72\x22" . $REQUESTID . "\42\x2c\42\x45\115\x49\124\122\x41\124\117\x4b\105\x4e\x22\72\42" . $EMITRATOKEN . "\x22\54\42\103\101\x4e\x43\x45\x4c\122\x45\x4d\x41\x52\x4b\42\x3a\42" . $CANCELREMARK . "\42\x2c\x22\x45\116\124\x49\124\x59\x54\131\x50\105\111\104\x22\72\42\62\42\x2c\42\x53\123\117\x54\117\x4b\105\x4e\x22\x3a\x22" . $SSOTOKEN . "\42\54\42\103\110\105\x43\113\123\125\x4d\x22\72\42" . $CHECKSUM . "\x22\175"; $resp = self::emitraAESEncryption($request_data); if (empty($resp)) { return array("\163\164\141\x74\x75\163" => false, "\x6d\x73\147" => "\x53\157\155\x65\164\x68\x69\156\x67\x20\167\x65\156\x74\x20\x77\x72\x6f\156\147\40\61"); } $url = self::$vlist["\145\x6d\x69\x74\162\x61\x55\162\154"] . "\57\142\141\143\x6b\145\156\144\124\162\x61\x6e\163\x43\141\156\143\x65\x6c\x42\x79\x44\145\x70\141\162\x74\x6d\x65\x6e\164\127\x69\164\x68\x45\156\143\162\171\160\x74\x69\157\156"; $resp1 = RegularService::curlPost($url, "\x65\x6e\x63\x44\x61\164\x61\75{$resp}"); if (empty($resp1)) { return array("\x73\164\141\164\x75\163" => false, "\155\163\147" => "\x53\x6f\155\145\164\x68\151\x6e\147\40\x77\x65\x6e\x74\x20\167\162\157\x6e\x67\40\62"); } $resp2 = self::emitraAESDecryption($resp1); if (empty($resp2)) { return array("\x73\x74\x61\164\x75\163" => false, "\x6d\163\147" => "\x53\157\155\145\164\150\151\x6e\147\x20\x77\x65\x6e\x74\x20\x77\162\157\x6e\147\x20\x33"); } $response = json_decode($resp2); if ($response->CANCELSTATUSCODE == 200 || $response->MSG == "\x54\x72\x61\156\163\x61\143\x74\x69\x6f\x6e\x20\101\x6c\x72\145\x61\x64\x79\40\103\141\x6e\143\x65\154\x6c\x65\144\x2e") { $refund_date = date("\x59\x2d\x6d\55\144\x20\x48\x3a\151\72\x73"); DB::table("\x6f\162\x64\x65\162\163")->where("\151\x64", $ID)->where("\167\x61\x6c\x6c\145\x74\137\x74\x72\x61\156\163\141\143\x74\x69\157\x6e\x5f\x69\x64", $EMITRATOKEN)->update(array("\x6f\x72\144\145\x72\x5f\x73\164\x61\164\165\163" => 10, "\162\x65\146\165\156\x64\x5f\144\141\x74\x65" => $refund_date, "\162\x65\x6d\141\162\153" => $CANCELREMARK)); DB::table("\x6f\x72\144\145\162\x5f\x72\145\161\x75\x65\163\x74")->where("\151\144", $order_request_id)->update(array("\x73\145\162\166\x69\x63\x65\x5f\x73\164\141\164\165\163" => 10)); DB::table("\x65\x6d\151\x74\x72\141\x5f\154\157\x67\x73")->insert(array("\x74\x79\160\x65" => "\x72\x65\x66\x75\156\x64", "\160\141\x72\145\x6e\164\137\151\144" => $enc_data_id, "\x64\x61\x74\141" => $resp2)); return array("\x73\164\141\164\165\163" => true, "\x6d\163\x67" => "\x52\x65\146\165\156\x64\40\147\145\x6e\x65\162\141\x74\x65\144\40\123\165\x63\143\145\x73\x73\x66\x75\x6c\x6c\171"); } else { return array("\163\x74\x61\164\x75\x73" => false, "\155\163\147" => $response->MSG); } } public static function postingFnc($APPLICATIONID, $REQUESTID, $TRANSACTIONID, $SSOTOKEN) { $emitratimestamp = date("\131\x6d\x64\110\x69\163", time()) . RegularService::get_millisecond(); $checksum_data = "\x7b\42\122\105\121\x55\x45\x53\124\111\104\42\72\42" . $REQUESTID . "\42\54\42\124\122\101\x4e\123\101\103\124\x49\x4f\x4e\111\x44\x22\72\x22" . $TRANSACTIONID . "\x22\x2c\42\x41\120\x50\114\111\x43\101\x54\x49\117\116\x49\x44\42\x3a\42" . $APPLICATIONID . "\x22\x2c\42\123\x53\117\124\x4f\x4b\105\116\x22\72\x22" . $SSOTOKEN . "\x22\175"; $CHECKSUM = self::emitraMD5Checksum($checksum_data); $merchantcode = self::$vlist["\155\x65\x72\x63\150\x61\x6e\x74\x63\x6f\144\145"]; $data = "\173\x22\x4d\105\x52\103\110\x41\x4e\124\103\x4f\104\x45\x22\72\42" . $merchantcode . "\42\x2c\42\122\x45\x51\x55\105\123\124\111\104\x22\72\x22" . $REQUESTID . "\x22\x2c\42\122\105\121\124\x49\115\105\x53\124\101\x4d\x50\42\x3a\x22" . $emitratimestamp . "\42\x2c\x22\x54\x52\x41\116\123\101\x43\x54\x49\x4f\x4e\x49\x44\42\72\x22" . $TRANSACTIONID . "\42\54\x22\101\120\120\114\111\103\x41\124\111\117\116\x49\104\42\72\x22" . $APPLICATIONID . "\42\54\42\x53\x53\117\x54\117\x4b\105\x4e\x22\72\42" . $SSOTOKEN . "\42\x2c\x22\103\x48\105\103\113\123\x55\x4d\x22\72\x22" . $CHECKSUM . "\42\x7d"; $resp = self::emitraAESEncryption($data); $url = self::$vlist["\145\x6d\151\164\x72\x61\125\x72\x6c"] . "\x2f\x75\x70\144\x61\x74\145\124\x72\141\x6e\x73\x61\x63\x74\x69\157\x6e\x50\157\x73\x74\151\x6e\147\x57\151\x74\x68\x45\x6e\x63\x72\x79\160\164\x69\x6f\x6e"; $resp1 = RegularService::curlPost($url, "\x65\156\143\104\141\164\x61\x3d{$resp}"); $resp2 = self::emitraAESDecryption($resp1); return $resp2; } public static function emitraMD5Checksum($checksum_data) { $checksum_url = self::$vlist["\x65\x6d\x69\x74\162\141\x55\162\x6c"] . "\x2f\145\x6d\151\164\x72\141\115\x44\65\103\150\145\143\153\x73\x75\155"; $checksum_data = "\164\x6f\x42\x65\103\x68\x65\143\x6b\x53\165\x6d\123\x74\162\151\x6e\147\x3d" . $checksum_data; return $checksum_data = RegularService::curlPost($checksum_url, $checksum_data); } public static function emitraAESEncryption($request_data) { $url = self::$vlist["\145\155\x69\x74\x72\141\x55\x72\154"] . "\x2f\145\155\151\x74\162\x61\101\105\x53\105\x6e\143\162\171\160\164\x69\157\156"; $data = "\164\x6f\102\x65\x45\x6e\143\x72\171\x70\x74\75" . $request_data; return $checksum_data = RegularService::curlPost($url, $data); } public static function emitraAESDecryption($data) { $url = self::$vlist["\145\x6d\151\x74\x72\x61\x55\x72\154"] . "\x2f\145\155\151\x74\x72\141\101\x45\123\x44\145\143\x72\x79\160\164\151\x6f\x6e"; $data = "\x74\157\102\x65\x44\x65\143\x72\171\160\x74\75{$data}"; return $checksum_data = RegularService::curlPost($url, $data); } public static function enc() { $plaintext = "\150\x65\x6c\x6c\x6f"; $key = "\105\x2d\x6d\x21\x74\162\x40\x32\60\61\x36"; $iv = random_bytes(16); $ciphertext = openssl_encrypt($plaintext, "\141\145\x73\x2d\x32\x35\x36\55\x63\x62\143", $key, OPENSSL_RAW_DATA, $iv); $ivCiphertext = $iv . $ciphertext; $ivCiphertextB64 = base64_encode($ivCiphertext); $ivCiphertextB64 = "\x72\x51\150\167\161\115\170\125\63\113\102\x52\130\141\66\157\113\130\154\x43\132\x2f\61\x49\120\60\x52\x7a\156\131\71\x49\122\151\160\x70\x62\x70\x51\x50\120\x44\x56\116\65\165\116\141\112\x6a\x49\154\106\151\131\67\143\107\x63\x72\71\x71\64\x68\167\x39\105\x41\x45\x30\x6b\142\x54\x32\x44\114\x4f\157\x47\x6f\x31\152\164\x57\71\154\111\x2b\147\161\172\x46\144\116\126\x42\x38\170\x4e\x76\x63\x47\x55\x79\152\x73\144\x43\x45\155\172\131\x31\66\x77\120\155\x6a\x6e\126\x33\x4b\113\102\161\x35\163\127\142\x55\125\x42\x6f\x46\125\63\x35\x54\x66\117\x50\122\x39\141\x6e\63\155\x57\111\71\157\x75\123\x4f\x33\x4c\124\104\x75\147\61\x73\112\x4b\x35\x7a\x6c\101\x61\143\121\x45\x49\x46\x35\x4f\142\67\163\155\x30\x71\152\67\x7a\x69\110\x30\163\x50\x4c\116\x50\156\171\x36\121\x36\x70\152\112\171\111\x7a\127\144\x6d\x61\x48\x31\x49\62\x33\x43\x53\150\126\x30\x63\x49\60\154\x58\x78\x56\153\x65\117\101\x6f\71\x57\x6b\146\143\x54\x5a\x2b\114\121\x70\167\x6c\125\141\155\x52\170\x64\172\122\x4e\x6f\x35\64\53\x72\105\171\x57\x44\x44\146\160\x51\x61\x46\x57\x4e\x4e\142\147\61\161\155\166\x47\x2f\x4a\x71\120\x6a\172\60\130\x51\x32\123\117\x53\114\x57\160\x56\x7a\x56\67\144\111\164\x47\x6f\x42\130\x4c\143\125\x54\x50\124\154\x45\x36\67\x48\104\x2b\152\162\x43\122\x73\132\x31\x71\x59\x31\64\144\x57\167\x6d\130\57\111\63\143\131\x46\x45\116\122\x4f\101\114\143\146\x63\x4d\165\x6c\167\x4c\x76\x38\154\172\x65\x64\121\167\132\170\104\155\165\x2f\x4b\172\x47\x31\67\x75\103\151\146\x39\150\x2f\112\53\144\141\141\x6f\65\105\144\x59\x7a\121\x6e\x4f\x6e\x48\113\x70\163\x70\x71\x64\62\131\62\x41\x45\x75\x77\x77\67\131\x4f\123\141\x39\120\145\116\x52\x31\124\132\x75\53\125\x41\x49\107\x6b\130\x53\x55\142\110\x51\x41\116\x67\64\157\130\141\155\x61\65\x2f\111\x39\x52\x6f\53\x30\x47\141\x58\x71\x58\x2b\x4a\143\x39\x44\172\157\x4f\126\x34\x4f\101\x4f\x35\63\127\x53\x41\x76\x32\x49\106\163\160\x30\166\101\x4c\157\153\x73\170\x59\x32\142\53\x31\65\x47\x6b\147\x69\x7a\130\x69\65\67\x61\124\106\x32\x61\162\125\154\x70\x62\x4d\131\145\x33\70\x4e\x66\111\113\143\114\116\x51\132\153\61\x55\142\127\63\x41\62\x53\x72\x65\x44\x4a\120\x4a\x50\x47\153\147\x62\x55\x6d\142\63\x32\x4e\x72\x63\x6e\x2f\x63\101\x78\x4a\164\x61\153\53\x66\115\x56\102\153\162\x4f\150\105\155\x62\157\163\127\163\x65\154\x76\71\x6c\x4d\131\164\166\x6b\x4d\x44\154\164\x51\x33\x37\155\147\x4c\141\x45\x46\x4f\x69\x53\x66\x68\167\141\145\114\x72\165\x6f\115\x76\x4b\x33\162\x70\60\x35\x52\161\53\x4f\x73\x36\143\111\156\x72\144\120\161\x68\66\x68\145\x38\x49\x6d\167\x68\123\156\116\x57\153\x38\112\164\106\x63\x30\x73\132\x69\x32\x32\x59\x62\x2b\130\53\132\x2f\155\66\121\162\x4e\130\132\x39\x54\x70\163\x2b\116\x4b\x77\132\x54\x6c\x4f\x2f\143\150\x76\113\153\x4a\111\146\150\x69\x30\124\163\x71\143\150\x57\66\x50\101\x47\x61\151\60\x6e\116\106\162\x44\116\146\167\x65\x45\x51\121\132\171\x4a\x41\x38\132\121\141\62\x55\60\x58\107\53\x2b\x6b\165\x49\x38\x69\156\162\x74\x51\115\x4e\x78\144\102\64\115\144\156\x52\x32\65\x75\x2b\155\x6a\150\x35\153\x46\147\x53\113\x59\x70\132\125\x4e\x76\110\61\x36\127\x31\x4a\x43\122\107\x2f\143\65\x62\101\157\61\143\x47\x79\170\x62\x6f\123\x34\x6a\126\x70\x4f\x42\125\161\x72\x62\x6e\x6f\67\x48\157\x4d\x2f\121\116\x7a\x63\x30\x33\71\x78\x57\x50\111\65\107\66\165\x67\115\64\x31\x59\131\150\103\x2f\166\x66\x50\107\71\x36\164\x4b\145\x54\143\167\x3d\75"; echo $ddd = self::decrypt($ivCiphertextB64); die; die($ivCiphertextB64); } function decrypt($ivCiphertextB64) { $key = "\x45\x2d\155\41\x74\x72\100\62\x30\x31\66"; $ivCiphertext = base64_decode($ivCiphertextB64); $iv = substr($ivCiphertext, 0, 16); $ciphertext = substr($ivCiphertext, 16); $decryptedData = openssl_decrypt($ciphertext, "\x61\x65\163\55\62\x35\66\x2d\143\x62\143", $key, OPENSSL_RAW_DATA, $iv); print_r(openssl_error_string()); return $decryptedData; } } ?>
Function Calls
None |
Stats
MD5 | 3255a7807fabbb334bc6acad2fd4c562 |
Eval Count | 0 |
Decode Time | 142 ms |