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

📄 viewgatewayresponse.bsh

📁 Sequoia ERP是一个真正的企业级开源ERP解决方案。它提供的模块包括:电子商务应用(e-commerce), POS系统(point of sales),知识管理,存货与仓库管理
💻 BSH
字号:
/*  * The first purpose of this script is to retrieve the orderId and paymentPreferenceId of this gateway response. It is * activated if orderPaymentPreferenceId is not supplied. * * The second purpose of this script is to determine the gateway response of a given capture or authorize action. * To activate this behavior, pass in an orderPaymentPreferenceId. It will set the orderId in the context so that * a backlink to the order can be created. */import org.ofbiz.base.util.UtilMisc;import org.ofbiz.entity.condition.EntityExpr;import org.ofbiz.entity.condition.EntityOperator;import org.ofbiz.entity.util.EntityUtil;// get this field first, it determines which purpose this script satisfiesorderPaymentPreferenceId = context.get("orderPaymentPreferenceId");// first purpose: retrieve orderId and pamentPreferenceIdif (orderPaymentPreferenceId == null) {  paymentGatewayResponse = context.get("paymentGatewayResponse");  orderPaymentPreference = paymentGatewayResponse.getRelatedOne("OrderPaymentPreference");  context.put("orderId", orderPaymentPreference.getString("orderId"));  context.put("orderPaymentPreferenceId", orderPaymentPreference.getString("orderPaymentPreferenceId"));  return;} // second purpose: grab the latest gateway response of the orderaymentpreferenceIdorderPaymentPreference = delegator.findByPrimaryKey("OrderPaymentPreference", UtilMisc.toMap("orderPaymentPreferenceId", orderPaymentPreferenceId));gatewayResponses = orderPaymentPreference.getRelated("PaymentGatewayResponse", UtilMisc.toList("transactionDate DESC"));EntityUtil.filterByCondition(gatewayResponses, new EntityExpr("transCodeEnumId", EntityOperator.EQUALS, "PGT_AUTHORIZE"));if (gatewayResponses.size() > 0) {    latestAuth = gatewayResponses.get(0);    context.put("paymentGatewayResponse", latestAuth);} else {    // todo: some kind of error telling user to re-authorize}context.put("orderId", orderPaymentPreference.getString("orderId"));

⌨️ 快捷键说明

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