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

📄 capturetransaction.bsh

📁 Sequoia ERP是一个真正的企业级开源ERP解决方案。它提供的模块包括:电子商务应用(e-commerce), POS系统(point of sales),知识管理,存货与仓库管理
💻 BSH
字号:
import org.ofbiz.order.order.OrderReadHelper;import org.ofbiz.base.util.UtilMisc;import org.ofbiz.entity.condition.EntityExpr;import org.ofbiz.entity.condition.EntityOperator;import org.ofbiz.entity.util.EntityUtil;orderId = context.get("orderId");orderPaymentPreferenceId = context.get("orderPaymentPreferenceId");if ((orderId == null) || (orderPaymentPreferenceId == null)) return;orderHeader = delegator.findByPrimaryKey("OrderHeader", UtilMisc.toMap("orderId", orderId));context.put("orderHeader", orderHeader);orderPaymentPreference = delegator.findByPrimaryKey("OrderPaymentPreference", UtilMisc.toMap("orderPaymentPreferenceId", orderPaymentPreferenceId));context.put("orderPaymentPreference", orderPaymentPreference);paymentMethodType = orderPaymentPreference.getRelatedOneCache("PaymentMethodType");context.put("paymentMethodType", paymentMethodType);if (orderPaymentPrefrence != null) {    context.put("paymentTypeId", "CUSTOMER_PAYMENT");}// we retrieve the captureAmount by looking at the latest authorized gateway response for this orderPaymentPreferencegatewayResponses = 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("captureAmount", latestAuth.getDouble("amount"));} else {    // todo: some kind of error telling user to re-authorize}

⌨️ 快捷键说明

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