...
- allPaymentPreferences = delegator.findByAnd("OrderPaymentPreference", UtilMisc.toMap("orderId", orderId)) --> allPaymentPreferences = EntityUtil.filterByAnd(allPaymentPreferences, canExpr);
- filters out items with "PAYMENT_CANCELLED"
- if "manualRefNum" has content then it processes/approves the order("serviceTypeEnum" = "PRDS_PAY_EXTERNAL") -->*SERVICE* dispatcher.runSync("processCaptureResult", captCtx)
- then it looks for OrderPaymentPrefernce entries with statusId = "PAYMENT_NOT_AUTH"
- *SERVICE*paymentResult = dispatcher.runSync("authOrderPayments", UtilMisc.<String, Object>toMap("orderId", orderId, "userLogin", userLogin), 180, false);
<service name="authOrderPayments" engine="java"
location="org.ofbiz.accounting.payment.PaymentGatewayServices" invoke="authOrderPayments" auth="true">
<description>Process (authorizes/re-authorizes) payments for an order</description>
<attribute name="orderId" type="String" mode="IN" optional="false"/>
<attribute name="processResult" type="String" mode="OUT" optional="false"/>
<attribute name="authResultMsgs" type="List" mode="OUT" optional="true"/>
<attribute name="reAuth" type="Boolean" mode="IN" optional="true"/>
</service>
public static Map authOrderPaymentPreference(DispatchContext dctx, Map context)
- orderPaymentPreference = delegator.findByPrimaryKey("OrderPaymentPreference", UtilMisc.toMap("orderPaymentPreferenceId", orderPaymentPreferenceId));
- orderHeader = orderPaymentPreference.getRelatedOne("OrderHeader");
- OrderReadHelper orh = new OrderReadHelper(orderHeader);
- goes through some stuff to check/set processAttempt
- checks if authorization has already occured ("PAYMENT_AUTHROIZED") is this a re-auth request??
- use overrideAmount or maxAmount??
- Map authPaymentResult = authPayment(dispatcher, userLogin, orh, orderPaymentPreference, totalRemaining, reAuth, transAmount
private static Map authPayment(LocalDispatcher dispatcher, GenericValue userLogin, OrderReadHelper orh, GenericValue paymentPreference, BigDecimal totalRemaining, boolean reauth, BigDecimal overrideAmount) throws GeneralException {