I am calling the service 'addPaymentMethodToOrder' (defined below) to add a payment to an existing order. It seems to be working correctly accept for the 'status' of the payment. The status is showing up as 'payment authorized', I was expecting it to be a status of 'payment settled'.

What causes the payment to be authorized and captured at the same time? Is this the correct service call to add payment records to an order?

Service definition:
Services_paymentmethod.xml

   <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="Double" 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="Double" mode="OUT" optional="true"/>

   </service>

OrderServices.xml

<simple-method method-name="addPaymentMethodToOrder" short-description="Create an PaymentMethodToOrder">
   <check-permission permission="ORDERMGR" action="_CREATE">
<fail-property resource="OrderErrorUiLabels" property="OrderSecurityErrorToRunAddPaymentMethodToOrder"/>
   </check-permission>
   <check-errors/>
<set field="inputMap.paymentMethodId" from-field="parameters.paymentMethodId"/>
   <set field="inputMap.maxAmount" from-field="parameters.maxAmount"/>
   <set field="inputMap.orderId" from-field="parameters.orderId"/>
   <entity-one entity-name="PaymentMethod" value-name="paymentMethod">
<field-map field-name="paymentMethodId" env-name="parameters.paymentMethodId"/>
   </entity-one>
<set field="inputMap.paymentMethodTypeId" from-field="paymentMethod.paymentMethodTypeId"/> <!--In this method we calls createOrderPaymentPreference and returns orderPaymentPreferenceId field to authOrderPaymentPreference --> <call-service service-name="createOrderPaymentPreference" in-map-name="inputMap" include-user-login="true"> <result-to-field field-name="parameters.orderPaymentPreferenceId" result-name="orderPaymentPreferenceId"/>
   </call-service>
<field-to-result field-name="parameters.orderPaymentPreferenceId" result-name="orderPaymentPreferenceId"/>
   </simple-method>




My apps
controller.xml

   <request-map uri="addPaymentMethodToOrder">

   <security https="true" auth="true"/>

   <event type="service" path="" invoke="addPaymentMethodToOrder"/>

   <response name="success" type="request" value="authOrderPayment"/>

   </request-map>

   <request-map uri="authOrderPayment">

   <security https="true" auth="true"/>

   <event type="service" path="" invoke="authOrderPaymentPreference"/>

   <response name="success" type="request-redirect" value="orderDetail"/>

   </request-map>

services.xml
   <service name="addPaymentMethodToOrder" engine="simple"

location="org/ofbiz/order/order/OrderServices.xml" invoke="addPaymentMethodToOrder" auth="true">

<description>Add Payment Method to Order.From this servicewe will call the createOrderPaymentPreference service to create OrderPaymentPreference</description>

   <attribute type="String" mode="IN" name="orderId" optional="false"/>

<attribute type="String" mode="IN" name="paymentMethodId" optional="false"/>

   <attribute type="BigDecimal" mode="IN" name="maxAmount"/>

   <attribute type="String" mode="OUT" name="orderPaymentPreferenceId"/>

   </service>










Reply via email to