onepay-WHMCS/Functions.php 000664 001750 001750 00000006154 13353123550 020555 0 ustar 00mobileware16 mobileware16 000000 000000 request($url, $myvars); return $checksum->checksum; } function verify($data) { $url = $data['url'] . 'getTxnDetails'; $merchantid = $data['respData']->merchant_id; $txnid = $data['respData']->txn_id; $myvars = "merchantId=" . $merchantid . "&txnId=" . $txnid . ""; //$myvars = "respData=" . $data['respData'] . ""; $resdata = $this->request($url, $myvars); return $resdata; } public function get_encrypt($input) { //for php 5.x.x to 7.0.x $key = $this->ekey; $size = mcrypt_get_block_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_ECB); $input = $this->get_pkcs5_pad($input, $size); $td = mcrypt_module_open(MCRYPT_RIJNDAEL_128, '', MCRYPT_MODE_ECB, ''); $iv = mcrypt_create_iv(mcrypt_enc_get_iv_size($td), MCRYPT_RAND); mcrypt_generic_init($td, $key, $iv); $data = mcrypt_generic($td, $input); mcrypt_generic_deinit($td); mcrypt_module_close($td); $data = base64_encode($data); //die; return $data; } protected function get_pkcs5_pad($text, $blocksize) { $pad = $blocksize - (strlen($text) % $blocksize); return $text . str_repeat(chr($pad), $pad); } public function get_decrypt($input) { $key = $this->ekey; $decrypted = mcrypt_decrypt( MCRYPT_RIJNDAEL_128, $key, base64_decode($input), MCRYPT_MODE_ECB ); $dec_s = strlen($decrypted); $padding = ord($decrypted[$dec_s - 1]); $decrypted = substr($decrypted, 0, -$padding); return $decrypted; } } ?> onepay-WHMCS/callback/onepay.php 000664 001750 001750 00000007325 13353123215 021633 0 ustar 00mobileware16 mobileware16 000000 000000 get_decrypt($respData); $Result = json_decode($respDecrypt); /** * Validate callback authenticity. */ $functions = new Functions(); $verificationResult = $functions->verify(array('url' => $url, 'respData' => $Result)); $parsedtxnid = $verificationResult->txn_id; $parsedmerchantid = $verificationResult->merchant_id; $parsedtxnamount = $verificationResult->txn_amount; $parsedtxnstatus = $verificationResult->trans_status; $responseMessage = $verificationResult->resp_message; $invoiceId = $parsedtxnid; $transactionId = $parsedtxnid; $paymentAmount = $parsedtxnamount; $paymentFee = "0"; if (($responseMessage === 'No Error.') && ($parsedtxnstatus !== 'NA')) { $transactionStatus = "Verified Transaction"; if ($parsedtxnstatus == 'Ok') { $transactionStatus = "Transaction Successful"; $success = true; } else if ($parsedtxnstatus == 'To') { $transactionStatus = "Sorry!!Your Transaction is Timed Out"; $success = false; } else { $transactionStatus = "Transaction Failed"; $success = false; } } else { $vmessage = "Transaction Verification Failed"; $success = false; $transactionStatus = "Transaction Failed"; } // /** * Validate Callback Invoice ID. * * Checks invoice ID is a valid invoice number. Note it will count an * invoice in any status as valid. * * Performs a die upon encountering an invalid Invoice ID. * * Returns a normalised invoice ID. */ $invoiceId = checkCbInvoiceID($invoiceId, $gatewayParams['name']); /** * Check Callback Transaction ID. * * Performs a check for any existing transactions with the same given * transaction number. * * Performs a die upon encountering a duplicate. */ checkCbTransID($transactionId); /** * Log Transaction. * * Add an entry to the Gateway Log for debugging purposes. * * The debug data can be a string or an array. In the case of an * array it will be * * @param string $gatewayName Display label * @param string|array $debugData Data to log * @param string $transactionStatus Status */ logTransaction($gatewayParams['name'], $_POST, $transactionStatus); if ($success) { /** * Add Invoice Payment. * * Applies a payment transaction entry to the given invoice ID. * * @param int $invoiceId Invoice ID * @param string $transactionId Transaction ID * @param float $paymentAmount Amount paid (defaults to full balance) * @param float $paymentFee Payment fee (optional) * @param string $gatewayModule Gateway module name */ addInvoicePayment( $invoiceId, $transactionId, $paymentAmount, $paymentFee, $onepay ); } onepay-WHMCS/onepay.php 000664 001750 001750 00000007475 13353123166 020112 0 ustar 00mobileware16 mobileware16 000000 000000 'OnePay Payment Gateway', 'APIVersion' => '1.0', 'DisableLocalCredtCardInput' => true, 'TokenisedStorage' => false, ); } function onepay_config() { $configarray = array( "FriendlyName" => array("Type" => "System", "Value" => "OnePay Payment Gateway"), "mode" => array("FriendlyName" => "Gateway Mode", "Type" => "dropdown", "Options" => "Sandbox,Production",), "merchant_id" => array("FriendlyName" => "Merchant ID", "Type" => "text", "Size" => "50",), "api_key" => array("FriendlyName" => "Working Key", "Type" => "text", "Size" => "50",), ); return $configarray; } function onepay_link($params) { $gatewaymerchant_id = $params['merchant_id']; $gatewayworkingkey = $params['api_key']; $gatewaymode = $params['mode']; $firstname = $params['clientdetails']['firstname']; $lastname = $params['clientdetails']['lastname']; $address1 = $params['clientdetails']['address1']; $address2 = $params['clientdetails']['address2']; $city = $params['clientdetails']['city']; $state = $params['clientdetails']['state']; $postcode = $params['clientdetails']['postcode']; $country = $params['clientdetails']['country']; $invoiceid = $params['invoiceid']; $description = $params["description"]; $amount = $params['amount']; # Format: ##.## $currency = "INR"; # Currency Code $email = $params['clientdetails']['email']; $mobileno = $params['clientdetails']['phonenumber']; $datetime = date('Y-m-d h:i:s'); $txntype = "DIRECT"; $url = "https://pay.1paypg.in/payone/"; if ($gatewaymode === "Sandbox") { $url = "http://139.59.1.254:8080/onepayVAS/"; } $txnId = $invoiceid . time(); $postVariables = array( "merchantId" => $gatewaymerchant_id, "apiKey" => $gatewayworkingkey, "txnId" => $txnId, "dateTime" => $datetime, "amount" => $amount, "custMobile" => $mobileno, "custMail" => $email, "url" => $url, "channelId" => '0', "txnType" => 'DIRECT', "instrumentId" => '0', "bankId" => 'NA', "productId" => 'DEFAULT', "isMultiSettlement" => "0", "cardType" => "NA", "udf1" => "NA", "udf2" => "NA", "udf3" => "NA", 'cardDetails' => 'NA', 'udf4' => 'NA', 'udf5' => 'NA', "returnURL" => $params['systemurl'] . "/modules/gateways/callback/onepay.php" ); $functions = new Functions(); $postVariables['checksum'] = $functions->checksum($postVariables); $jsondata = json_encode($postVariables); $enc = $functions->get_encrypt($jsondata); # System Variables $companyname = $params['companyname']; $systemurl = $params['systemurl']; $currency = "INR"; $sucUrl = ''; //eg:"/modules/gateways/callback/success.php" $failUrl = ''; //eg:"/modules/gateways/callback/failure.php" $code = '