<!doctype html>
<html lang="en">
<head>
	<meta charset="utf-8">
</head>
<body>
	<?php 
		echo $this->lang->line('js_text_processing');
		
		$currency_code = 'MYR';
		switch($order['payment_method']) {
			case 15: $currency_code = 'THB'; break;
			case 16: $currency_code = 'VND'; break;
			case 17:$currency_code = 'IDR'; break;
			default: $currency_code = 'MYR'; break;
		}
				
		$amount = (isset($order['transaction_amount']) ? number_format($order['transaction_amount'], 2, '.', '') : '0.00');
		$datetime = date('Y-m-d h:i:sA');
		$language = 'en-us';
		$bank = (isset($order['bank_code']) ? $order['bank_code'] : '');
		$ip = $this->input->ip_address();
		$token = '';
		
		if(isset($order['order_no']) && isset($order['to_member_username'])) {
			$token = strtoupper(md5(PG_PAYLAH_MERCHANT_ID . $order['order_no'] . $order['to_member_username'] . $amount . $currency_code . date('YmdHis', strtotime($datetime)) . PG_PAYLAH_KEY . $ip));
		}
	?>
	<form id='paysubmit' name='paysubmit' method="post" action="<?php echo PG_PAYLAH_PAY_URL;?>" style="display: none;"> 
		<input type="hidden" name="Merchant" value="<?php echo PG_PAYLAH_MERCHANT_ID;?>" />
		<input type="hidden" name="Currency" value="<?php echo $currency_code;?>" />
		<input type="hidden" name="Customer" value="<?php echo (isset($order['to_member_username']) ? $order['to_member_username'] : '');?>" />
		<input type="hidden" name="Reference" value="<?php echo (isset($order['order_no']) ? $order['order_no'] : '');?>" />
		<input type="hidden" name="Key" value="<?php echo $token;?>" />
		<input type="hidden" name="Amount" value="<?php echo $amount;?>" />
		<input type="hidden" name="Note" value="" />
		<input type="hidden" name="Datetime" value="<?php echo $datetime;?>" />
		<input type="hidden" name="FrontURI" value="<?php echo base_url() . 'callback/success/' . $order['payment_method'] . '/';?>" /> 
		<input type="hidden" name="BackURI" value="<?php echo base_url() . 'callback/notify/' . $order['payment_method'] . '/';?>" /> 
		<input type="hidden" name="Language" value="<?php echo $language;?>" /> 
		<input type="hidden" name="Bank" value="<?php echo $bank;?>" />
		<input type="hidden" name="ClientIP" value="<?php echo $ip;?>" /> 
	</form>
	<script style="text/javascript">document.forms['paysubmit'].submit();</script>
</body>
</html>