} else { ?> <?php foreach ($fieldValue as $fieldArrayValue) { ?> <input type="hidden" name="<?php echo $fieldName; ?> " value="<?php echo $fieldArrayValue; ?> " /> <?php } ?> <?php } ?> <?php } ?> <input type="hidden" name="WMI_SIGNATURE" value="<?php echo KSMWalletone::getHash($view->payment_params->get('secretKey', null)); ?> " /> <input type="submit" value="<?php echo JText::_('KSM_PAYMENT_WALLETONE_PAY'); ?> " class="button btn-success btn-large noTransition" /> </form> </center>
public function onPayOrder() { $app = JFactory::getApplication(); $input = $app->input; $postData = $input->getArray($_POST); $merchant_id = $input->get('WMI_MERCHANT_ID', null, 'string'); $cost = $input->get('WMI_PAYMENT_AMOUNT', 0, 'float'); $orderId = $input->get('WMI_PAYMENT_NO', 0, 'int'); $state = $input->get('WMI_ORDER_STATE', null, 'string'); $hash = $input->get('WMI_SIGNATURE', null, 'string'); if (!empty($orderId) && !empty($cost) && !empty($merchant_id) && strtoupper($state) == 'ACCEPTED') { $db = JFactory::getDBO(); $query = $db->getQuery(true); $query->select(' o.id, o.payment_id, o.region_id, o.cost, o.customer_fields ')->from('#__ksenmart_orders AS o')->where('o.id=' . $db->q($orderId)); $db->setQuery($query); $order = $db->loadObject(); if (empty($order)) { return; } if (empty($order->payment_id)) { return; } if ($order->cost == $cost) { $payment = KSMWalletone::getPayment($order->payment_id, $this->_name); if (empty($payment)) { return; } if (empty($order->region_id)) { return; } if ($this->checkRegion($payment->regions, $order->region_id)) { KSMWalletone::_setFields($postData); $payment->params = json_decode($payment->params, true); $order->customer_fields = json_decode($order->customer_fields, true); $sign = KSMWalletone::getHash($payment->params['secretKey']); if ($sign === $hash && $payment->params['merchant_id'] == $merchant_id) { $this->_setState($orderId, 5); $app->close('WMI_RESULT=OK'); } } } } else { $this->_setState($orderId, 2); $app->close('WMI_RESULT=RETRY'); } }