📄 valuelinkservices.java
字号:
request.put("PCardNo", physicalCard); request.put("PPIN", vl.encryptPin(physicalPin)); // user defined field #2 if (partyId != null && partyId.length() > 0) { request.put("User2", partyId); } // send the request Map response = null; try { response = vl.send(request); } catch(HttpClientException e) { Debug.logError(e, "Problem communicating with VL"); return ServiceUtil.returnError("Unable to link gift card(s)"); } if (response != null) { String responseCode = (String) response.get("responsecode"); Map result = ServiceUtil.returnSuccess("Activation of physical card complete."); if (responseCode.equals("00")) { result.put("processResult", new Boolean(true)); } else { result.put("processResult", new Boolean(false)); } result.put("responseCode", responseCode); result.put("authCode", response.get("authcode")); result.put("amount", vl.getAmount((String) response.get("newbal"))); result.put("expireDate", response.get("expiredate")); result.put("cardClass", response.get("cardclass")); result.put("referenceNum", response.get("traceno")); Debug.log("Link Result : " + result, module); return result; } else { return ServiceUtil.returnError("Empty response returned from ValueLink"); } } public static Map disablePin(DispatchContext dctx, Map context) { GenericDelegator delegator = dctx.getDelegator(); Properties props = getProperties(context); String cardNumber = (String) context.get("cardNumber"); String pin = (String) context.get("pin"); String orderId = (String) context.get("orderId"); String partyId = (String) context.get("partyId"); Double amount = (Double) context.get("amount"); // get an api instance ValueLinkApi vl = ValueLinkApi.getInstance(delegator, props); Map request = vl.getInitialRequestMap(context); request.put("Interface", "Disable"); request.put("CardNo", cardNumber); request.put("PIN", vl.encryptPin(pin)); request.put("Amount", vl.getAmount(amount)); // user defined field #1 if (orderId != null && orderId.length() > 0) { request.put("User1", orderId); } // user defined field #2 if (partyId != null && partyId.length() > 0) { request.put("User2", partyId); } // send the request Map response = null; try { response = vl.send(request); } catch(HttpClientException e) { Debug.logError(e, "Problem communicating with VL"); return ServiceUtil.returnError("Unable to call disble pin"); } if (response != null) { String responseCode = (String) response.get("responsecode"); Map result = ServiceUtil.returnSuccess("PIN disabled."); if (responseCode.equals("00")) { result.put("processResult", new Boolean(true)); } else { result.put("processResult", new Boolean(false)); } result.put("responseCode", responseCode); result.put("balance", vl.getAmount((String) response.get("currbal"))); result.put("expireDate", response.get("expiredate")); result.put("cardClass", response.get("cardclass")); result.put("referenceNum", response.get("traceno")); Debug.log("Disable Result : " + result, module); return result; } else { return ServiceUtil.returnError("Empty response returned from ValueLink"); } } public static Map redeem(DispatchContext dctx, Map context) { GenericDelegator delegator = dctx.getDelegator(); Properties props = getProperties(context); String cardNumber = (String) context.get("cardNumber"); String pin = (String) context.get("pin"); String currency = (String) context.get("currency"); String orderId = (String) context.get("orderId"); String partyId = (String) context.get("partyId"); Double amount = (Double) context.get("amount"); // override interface for void/rollback String iFace = (String) context.get("Interface"); // get an api instance ValueLinkApi vl = ValueLinkApi.getInstance(delegator, props); Map request = vl.getInitialRequestMap(context); request.put("Interface", iFace != null ? iFace : "Redeem"); request.put("CardNo", cardNumber); request.put("PIN", vl.encryptPin(pin)); request.put("Amount", vl.getAmount(amount)); request.put("LocalCurr", vl.getCurrency(currency)); // user defined field #1 if (orderId != null && orderId.length() > 0) { request.put("User1", orderId); } // user defined field #2 if (partyId != null && partyId.length() > 0) { request.put("User2", partyId); } // set the timeout reversal setTimeoutReversal(dctx, context, request); // send the request Map response = null; try { response = vl.send(request); } catch(HttpClientException e) { Debug.logError(e, "Problem communicating with VL"); return ServiceUtil.returnError("Unable to redeem gift card"); } if (response != null) { String responseCode = (String) response.get("responsecode"); Map result = ServiceUtil.returnSuccess(); if (responseCode.equals("00")) { result.put("processResult", new Boolean(true)); } else { result.put("processResult", new Boolean(false)); } result.put("responseCode", responseCode); result.put("authCode", response.get("authcode")); result.put("previousAmount", vl.getAmount((String) response.get("prevbal"))); result.put("amount", vl.getAmount((String) response.get("newbal"))); result.put("expireDate", response.get("expiredate")); result.put("cardClass", response.get("cardclass")); result.put("cashBack", vl.getAmount((String) response.get("cashback"))); result.put("referenceNum", response.get("traceno")); Debug.log("Redeem Result : " + result, module); return result; } else { return ServiceUtil.returnError("Empty response returned from ValueLink"); } } public static Map reload(DispatchContext dctx, Map context) { GenericDelegator delegator = dctx.getDelegator(); Properties props = getProperties(context); String cardNumber = (String) context.get("cardNumber"); String pin = (String) context.get("pin"); String currency = (String) context.get("currency"); String orderId = (String) context.get("orderId"); String partyId = (String) context.get("partyId"); Double amount = (Double) context.get("amount"); // override interface for void/rollback String iFace = (String) context.get("Interface"); // get an api instance ValueLinkApi vl = ValueLinkApi.getInstance(delegator, props); Map request = vl.getInitialRequestMap(context); request.put("Interface", iFace != null ? iFace : "Reload"); request.put("CardNo", cardNumber); request.put("PIN", vl.encryptPin(pin)); request.put("Amount", vl.getAmount(amount)); request.put("LocalCurr", vl.getCurrency(currency)); // user defined field #1 if (orderId != null && orderId.length() > 0) { request.put("User1", orderId); } // user defined field #2 if (partyId != null && partyId.length() > 0) { request.put("User2", partyId); } // set the timeout reversal setTimeoutReversal(dctx, context, request); // send the request Map response = null; try { response = vl.send(request); } catch(HttpClientException e) { Debug.logError(e, "Problem communicating with VL"); return ServiceUtil.returnError("Unable to reload gift card"); } if (response != null) { String responseCode = (String) response.get("responsecode"); Map result = ServiceUtil.returnSuccess(); if (responseCode.equals("00")) { result.put("processResult", new Boolean(true)); } else { result.put("processResult", new Boolean(false)); } result.put("responseCode", responseCode); result.put("authCode", response.get("authcode")); result.put("previousAmount", vl.getAmount((String) response.get("prevbal"))); result.put("amount", vl.getAmount((String) response.get("newbal"))); result.put("expireDate", response.get("expiredate")); result.put("cardClass", response.get("cardclass")); result.put("referenceNum", response.get("traceno")); Debug.log("Reload Result : " + result, module); return result; } else { return ServiceUtil.returnError("Empty response returned from ValueLink"); } } public static Map balanceInquire(DispatchContext dctx, Map context) { GenericDelegator delegator = dctx.getDelegator(); Properties props = getProperties(context); String cardNumber = (String) context.get("cardNumber"); String pin = (String) context.get("pin"); String currency = (String) context.get("currency"); String orderId = (String) context.get("orderId"); String partyId = (String) context.get("partyId"); // get an api instance ValueLinkApi vl = ValueLinkApi.getInstance(delegator, props); Map request = vl.getInitialRequestMap(context); request.put("Interface", "Balance"); request.put("CardNo", cardNumber); request.put("PIN", vl.encryptPin(pin)); request.put("LocalCurr", vl.getCurrency(currency)); // user defined field #1 if (orderId != null && orderId.length() > 0) { request.put("User1", orderId); } // user defined field #2 if (partyId != null && partyId.length() > 0) { request.put("User2", partyId); } // send the request Map response = null; try { response = vl.send(request); } catch(HttpClientException e) { Debug.logError(e, "Problem communicating with VL"); return ServiceUtil.returnError("Unable to call balance inquire"); } if (response != null) { String responseCode = (String) response.get("responsecode"); Map result = ServiceUtil.returnSuccess(); if (responseCode.equals("00")) { result.put("processResult", new Boolean(true)); } else { result.put("processResult", new Boolean(false)); } result.put("responseCode", responseCode); result.put("balance", vl.getAmount((String) response.get("currbal"))); result.put("expireDate", response.get("expiredate")); result.put("cardClass", response.get("cardclass")); result.put("referenceNum", response.get("traceno")); Debug.log("Balance Result : " + result, module); return result; } else { return ServiceUtil.returnError("Empty response returned from ValueLink"); } } public static Map transactionHistory(DispatchContext dctx, Map context) { GenericDelegator delegator = dctx.getDelegator(); Properties props = getProperties(context); String cardNumber = (String) context.get("cardNumber"); String pin = (String) context.get("pin"); String orderId = (String) context.get("orderId"); String partyId = (String) context.get("partyId"); // get an api instance ValueLinkApi vl = ValueLinkApi.getInstance(delegator, props);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -