⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 authorize.jsp

📁 陕西电信sp客户端
💻 JSP
字号:
<%@page contentType="text/html; charset=GBK" %>

<%@page import="com.onewaveinc.portalman.webpro.*"%>
<%@page import="com.onewaveinc.portalman.webpro.entity.*"%>
<%@page import="java.util.Date"%>
<%!
	public String checkSuite(OWAuthorizeResult result){
		if("true".equalsIgnoreCase(result.getErrorCode())){
			String message=result.getMessage();
			if(message!=null && message.indexOf("8000,")!=-1){
				return message.substring(5);
			}
		}
		return null;
	}
%>
<%
	//取得Vnet网页传回的vnetloginname值
	String vnetloginname = request.getParameter("vnetloginname");
	if(vnetloginname==null){
		out.println("<p align='center'><font color='#FF0000'>非法请求,请退出重试!</font></p>");
		return;
	}
	//ICP在Vnet上的服务代码
	String serviceCode = "45454";
	//ICP产品信息
	String productInfo = "测试包月服务离线扣款";
	//ICP产品价格
	int price = 1000;
	//用户在ICP上的登陆名,将显示在用户详单中,也可在此写注释
	String icpLoginName = "该服务仅供测试";


	OWAuthorizeRequest authRequest = new OWAuthorizeRequest();
  //如果需要传入icp侧loginname,则为
	OWAuthorizeRequest2 authRequest = new OWAuthorizeRequest2();
	//0:由Vnet系统自动判断1:指明用在ADSL和163帐号中做检查2:指明用在现金帐号中做检查3:指定促消卡中扣款4:指定在业务卡中扣款
	authRequest.setPayAccountCheckMode(0);
	//ICP在Vnet上的服务代码
	authRequest.setServiceCode(serviceCode);
	//如果是代收费模式,设置产品价格,单位为厘
	authRequest.setExpenditure(price);
	//设置产品信息
	authRequest.setProductInfo(productInfo);
	//Vnet 客户统一登录名
	authRequest.setVnetLoginName(vnetloginname);
  //设置用户在icp一侧的帐号
  authRequest.setIcpLoginName(icpLoginName);

	OWAuthorizeResult result = WebProManager.getOWAuthentication().OWAuthorizeOffLine(authRequest);
	if(!"true".equalsIgnoreCase(result.getErrorCode())){
		//发现授权失败,ICP需要做相应的处理
		out.println("授权失败!");
		out.println("<BR>错误代码为:" + result.getErrorCode());
		out.println("<BR>错误信息为:" + result.getMessage());
		return;
	}
	//检查用户是否为套餐用户
	String suitename = checkSuite(result);
	if(suitename!=null){
		//为套餐用户,做相应的处理。
		System.out.println("该用户已订购了套餐:"+ suitename);
	}

	//生成计费Entity
	OWAccountingRequest acrequest = new OWAccountingRequest();
	//“1” 代表包月 “0” 非包月
	acrequest.setAccountingType(1);
	//客户ICP登录名, String 类型, 最长64位
	acrequest.setIcpLoginName(icpLoginName);
	//产品信息, String 类型, 最长64位
	acrequest.setProductInfo(productInfo);
	//用户包月开始时间
	acrequest.setStartTime(new Date());
	//用户包月结束时间
	acrequest.setEndTime(new Date());
	//全局唯一的交易号。
	acrequest.setTransactionId(result.getTransactionID());
	//Vnet 客户统一登录名
	acrequest.setVnetLoginName(vnetloginname);
	try{
		//调用收费接口
		OWAccountingResult result2 = WebProManager.getOWAccounting().setAccountingInfo(acrequest);
		if(!("true".equalsIgnoreCase(result2.getErrorCode()))){
			out.println("扣费时发现错误:" + result2.getMessage());
			return;
		}
	}catch(Exception e){
		e.printStackTrace();
		out.println("扣费时发现错误:" + e.toString());
		return;
	}
%>
<html><head><title></title></head><body>
 离线收费记录已保存。<BR>到互联星空上可以查到本次消费的详单。<BR>
<%
	if(suitename!=null){
		//为套餐用户,做相应的处理。
		out.println("该用户已订购了套餐:"+ suitename);
	}
%>
</body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -