Example #1
0
 public static function _getFields()
 {
     if (empty(self::$_fields)) {
         self::$_fields = array();
     }
     return self::$_fields;
 }
Example #2
0
 public function onAfterExecuteKSMcartgetOrderInfo($model, $order = null)
 {
     $payment = KSMWalletone::getPayment($order->payment_id, 'walletone');
     $shipping = KSMWalletone::getShipping($order->shipping_id, 'redexpress');
     if ($payment->id > 0 && $shipping->id > 0) {
         $orderInfo = KSMWalletone::getOrder($order->id);
         $region = KSMWalletone::getRegion($order->region_id);
         $country = KSMWalletone::getCountry($region->country_id);
         KSMWalletone::_setFields(array('WMI_DELIVERY_REQUEST' => true, 'WMI_DELIVERY_COUNTRY' => $country->title, 'WMI_DELIVERY_REGION' => $region->title, 'WMI_DELIVERY_ADDRESS' => $order->address_fields, 'WMI_DELIVERY_CITY' => $orderInfo->address_fields->city, 'WMI_DELIVERY_CONTACTINFO' => $order->customer_fields->phone, 'WMI_DELIVERY_COMMENTS' => $order->note, 'WMI_DELIVERY_ORDERID' => $order->id));
     }
 }
Example #3
0
    } 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>
Example #4
0
 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');
     }
 }