1pay_magento/MwtUM/Onepay/Model/adminhtml/Source/Env.php 000664 001750 001750 00000001200 13353123272 026254 0 ustar 00mobileware16 mobileware16 000000 000000 'sandbox','label' => 'sandbox'),
array('value' => 'production','label' => 'production')
);
}
} 1pay_magento/MwtUM/Onepay/view/frontend/layout/ 000775 001750 001750 00000000000 13347667365 024676 5 ustar 00mobileware16 mobileware16 000000 000000 1pay_magento/MwtUM/Onepay/Model/PaymentMethod.php 000664 001750 001750 00000026456 13353123257 025114 0 ustar 00mobileware16 mobileware16 000000 000000 ekey = '3a5c1c4e81d7eb133a5c1c4e81d7eb13';
$this->_urlBuilder = $urlBuilder;
$this->_exception = $exception;
$this->_transactionRepository = $transactionRepository;
$this->_transactionBuilder = $transactionBuilder;
$this->_orderFactory = $orderFactory;
$this->_storeManager = $storeManager;
$this->_countryHelper = \Magento\Framework\App\ObjectManager::getInstance()->get('\Magento\Directory\Model\Country');
parent::__construct(
$context, $registry, $extensionFactory, $customAttributeFactory, $paymentData, $scopeConfig, $logger, $resource, $resourceCollection, $data
);
}
/**
* Instantiate state and set it to state object.
*
* @param string $paymentAction
* @param \Magento\Framework\DataObject $stateObject
*/
public function initialize($paymentAction, $stateObject) {
$payment = $this->getInfoInstance();
$order = $payment->getOrder();
$order->setCanSendNewEmailFlag(false);
$stateObject->setState(\Magento\Sales\Model\Order::STATE_PENDING_PAYMENT);
$stateObject->setStatus('pending_payment');
$stateObject->setIsNotified(false);
}
public function getPostHTML($order, $storeId = null) {
$environment = $this->getConfigData('environment');
$merchantid = $this->getConfigData('merchantId');
$apikey = $this->getConfigData('apiKey');
$txnid = $order->getIncrementId() . '_' . date("ymds");
$amount = $order->getGrandTotal();
$amount = number_format((float) $amount, 2, '.', '');
$action = "https://pay.1paypg.in/";
if ($environment == 'sandbox')
$action = "http://139.59.1.254:8080/onepayVAS";
$currency = $order->getOrderCurrencyCode();
$billingAddress = $order->getBillingAddress();
$productInfo = "Product Information";
$firstname = $billingAddress->getData('firstname');
$lastname = $billingAddress->getData('lastname');
$zipcode = $billingAddress->getData('postcode');
$email = $billingAddress->getData('email');
$phone = $billingAddress->getData('telephone');
$address = $billingAddress->getStreet();
$state = $billingAddress->getData('region');
$city = $billingAddress->getData('city');
$country = $billingAddress->getData('country_id');
$countryObj = $this->_countryHelper->loadByCode($country);
$country = $countryObj->getName();
$surl = $this->getMwtUMReturnUrl();
$dateTime = date('Y-m-d h:i:s');
$checksumArray = array('apiKey' => $apikey, 'merchantid' => $merchantid, 'date' => $dateTime, 'txnId' => $txnid, 'amount' => $amount, 'custMobile' => $phone, 'custEmail' => $email, 'action' => $action);
$checksum = $this->get_checksum($checksumArray);
$order_data = array(
'dateTime' => $dateTime,
'amount' => $amount,
'isMultiSettlement' => '0',
'custMobile' => $phone,
'apiKey' => $this->apiKey,
'productId' => 'DEFAULT',
'instrumentId' => 'NA',
'cardType' => 'NA',
'txnType' => 'DIRECT',
'udf3' => 'NA',
'udf1' => 'NA',
'udf2' => 'NA',
'merchantId' => $merchantid,
'custMail' => $email,
'returnURL' => $surl,
'channelId' => '0',
'txnId' => $txnid,
'checksum' => $checksum,
'bankId' => 'NA',
'cardDetails' => 'NA',
'udf4' => 'NA',
'udf5' => 'NA',
);
$jsondata = json_encode($order_data);
$enc = $this->get_encrypt($jsondata);
if ($checksum !== 'failure') {
$html = '
';
} else {
$html = "failure";
}
return json_encode($html);
}
function get_checksum($data) {
$datetime = urlencode($data['date']);
$merchantId = $data['merchantid'];
$apiKey = $data['apiKey'];
$txnId = $data['txnId'];
$amount = $data['amount'];
$mobileno = $data['custMobile'];
$email = $data['custEmail'];
$txntype = 'DIRECT';
$checkSumUrl = $data['action'] . 'payone/checksumgenerator';
$myvars = "merchantId=" . $merchantId . "&txnId=" . $txnId . "&dateTime=" . $datetime . "&amount=" . $amount . "&apiKey=" . $apiKey . "&custMobile=" . $mobileno . "&custMail=" . $email . "&channelId=0&txnType=DIRECT";
$ch = curl_init($checkSumUrl);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $myvars);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($ch);
curl_close($ch);
$value = json_decode($response);
return $value->checksum; //$value->checksum;
}
public function get_encrypt($input) {
//for php 5.x.x to 7.0.x
$ekey = $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) {
$ekey = $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;
}
public function getOrderPlaceRedirectUrl($storeId = null) {
return $this->_getUrl('onepay/checkout/start', $storeId);
}
protected function addHiddenField($arr) {
$nm = $arr['name'];
$vl = $arr['value'];
$input = "";
return $input;
}
/**
* Get return URL.
*
* @param int|null $storeId
*
* @return string
*/
//AA may not be required
public function getSuccessUrl($storeId = null) {
return $this->_getUrl('checkout/onepage/success', $storeId);
}
/**
* Get return (IPN) URL.
*
* @param int|null $storeId
*
* @return string
*/
//AA Done
public function getMwtUMReturnUrl($storeId = null) {
return $this->_getUrl('onepay/ipn/callbackMwtum', $storeId, false);
}
/**
* Get cancel URL.
*
* @param int|null $storeId
*
* @return string
*/
//AA Not required
public function getCancelUrl($storeId = null) {
return $this->_getUrl('checkout/onepage/failure', $storeId);
}
/**
* Build URL for store.
*
* @param string $path
* @param int $storeId
* @param bool|null $secure
*
* @return string
*/
//AA Done
protected function _getUrl($path, $storeId, $secure = null) {
$store = $this->_storeManager->getStore($storeId);
return $this->_urlBuilder->getUrl(
$path, ['_store' => $store, '_secure' => $secure === null ? $store->isCurrentlySecure() : $secure]
);
}
}
1pay_magento/MwtUM/Onepay/Controller/Checkout/Success.php 000664 001750 001750 00000003746 13353123305 026565 0 ustar 00mobileware16 mobileware16 000000 000000 _checkoutSession = $checkoutSession;
$this->_urlBuilder = $context->getUrlInterface();
$this->_storeManager = $context->getStoreManagerInterface();
parent::__construct($context);
}
/**
* Unset the quote and redirect to checkout success.
*/
public function execute()
{
$this->getResponse()->setRedirect(
$this->_getUrl('checkout/onepage/success')
);
}
/**
* Build URL for store.
*
* @param string $path
* @param int $storeId
* @param bool|null $secure
*
* @return string
*/
protected function _getUrl($path, $secure = null)
{
$store = $this->_storeManager->getStore(null);
return $this->_urlBuilder->getUrl(
$path,
['_store' => $store, '_secure' => $secure === null ? $store->isCurrentlySecure() : $secure]
);
}
}
1pay_magento/MwtUM/Onepay/view/frontend/web/js/ 000775 001750 001750 00000000000 13347667365 024552 5 ustar 00mobileware16 mobileware16 000000 000000 1pay_magento/MwtUM/Onepay/view/frontend/web/template/img/ 000775 001750 001750 00000000000 13347667365 026525 5 ustar 00mobileware16 mobileware16 000000 000000 1pay_magento/MwtUM/Onepay/view/frontend/web/template/img/preloader.gif 000664 001750 001750 00000303222 13335100150 031136 0 ustar 00mobileware16 mobileware16 000000 000000 GIF89a "ot"a$%mY\&q)l1r*p"e,urԲXN`)dhn!uo~m̼/lL!x1vf4%t!z-x0y%y ]!h)t$|(v)hh*)~p}!|m)jf]t{,|\`,q2|ZVlV)rzbx| qg"}ƅdnX(xi\b(fj`(4|PR*|1~..xH|+m^*n&add-t\%/Z4~ ´hjz2xZu'db9(z@U4n+"t$vW^*$w(=|ׄ.zj,rT!b$~&Ȅ
w -h< $r@p ll22~d-js* ^f/z͍A~5z7x^VTVTTT\VX&||$zRZ v3u&x.|h