require(['config'], function() {
	require([
		'jquery'
	], function($) {
		setTimeout(function() {
			pageObj.init();
		}, 300);
	});
});

var pageObj = {
	init: function() {
		this.setParam();
	},
	setParam() {
		var nowAddress = unescape(location.href);
		var parameters = (nowAddress.slice(nowAddress.indexOf('?') + 1,
			nowAddress.length)).split('&');
		for (var i = 0; i < parameters.length; i++) {
			var param = parameters[i].split('=');
			$('#frm_pay input[name="' + param[0] + '"]').val(param[1]);
		}
		this.mobileCert();
		// console.log(JSON.stringify($('#frm_pay').serializeObject()));
	},
	mobileCert() {
		var KICC_JAVASCRIPT_URL = CommonObj.getParameter('kiccJavascriptUrl');

		var head = document.getElementsByTagName('head')[0];
		var script = document.createElement('script');
		script.type = 'text/javascript';
		script.src = KICC_JAVASCRIPT_URL;
		head.appendChild(script);

		// const js = '<script src="' + KICC_JAVASCRIPT_URL + '"></script>';
		// $('#ITP_BIZPOP_PO_PAYMENT #ITP_POPUP_KICC_JS').empty();
		// $('#ITP_BIZPOP_PO_PAYMENT #ITP_POPUP_KICC_JS').append(js);
		$.getScript(KICC_JAVASCRIPT_URL, function() {
			easypay_card_webpay(frm_pay,"/oqpo-view/mobile/app/easypay/oqpo/mobile_order_req.jsp","_self","0","0","submit",30);
		});
	}
};
