Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

    <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 authOrderPayments(DispatchContext dctx, Map context)

  • orderHeader = delegator.findByPrimaryKey("OrderHeader", UtilMisc.toMap("orderId", orderId))
  • Map lookupMap = UtilMisc.toMap("orderId", orderId, "statusId", "PAYMENT_NOT_AUTH");
  • List orderList = UtilMisc.toList("maxAmount");
  • paymentPrefs = delegator.findByAnd("OrderPaymentPreference", lookupMap, orderList);
  • check to see if it is a re-authorization(PAYMENT_AUTHORIZED) and if so, add it to the paymentPrefs map
  • OrderReadHelper orh = new OrderReadHelper(orderHeader);
  • BigDecimal totalRemaining = orh.getOrderGrandTotal();
  • Authorize each order payment preference -- Iterator payments = paymentPrefs.iterator();
  • *SERVICE* results = dispatcher.runSync("authOrderPaymentPreference", authContext);
        <service name="authOrderPaymentPreference" engine="java"
                location="org.ofbiz.accounting.payment.PaymentGatewayServices" invoke="authOrderPaymentPreference" auth="true">
            <description>Process (authorizes/re-authorizes) a single payment for an order with an optional overrideAmount</description>
            <attribute name="orderPaymentPreferenceId" type="String" mode="IN" optional="false"/>
            <attribute name="overrideAmount" type="BigDecimal" mode="IN" optional="true"/>
            <attribute name="finished" type="Boolean" mode="OUT" optional="false"/>
            <attribute name="errors" type="Boolean" mode="OUT" optional="false"/>
            <attribute name="messages" type="List" mode="OUT" optional="true"/>
            <attribute name="processAmount" type="BigDecimal" mode="OUT" optional="true"/>
        </service> 
    public static Map authOrderPaymentPreference(DispatchContext dctx, Map context)
  • orderPaymentPreference = delegator.findByPrimaryKey("OrderPaymentPreference", UtilMisc.toMap("orderPaymentPreferenceId", orderPaymentPreferenceId));

...