Hi Devs,

I’m testing the order fulfillment on ofbiz release branch 12.04 for a scenario 
when payment gateway decline the payments. I’m using OOTB service 
'alwaysDeclineCCProcessor’ to decline the payments which are earlier authorized 
by the service ‘alwaysApproveCCProcessor’. Once I create a sales order I click 
on the link ‘Pack Shipment For Ship Group’ to pack the order, the link is under 
the shipping information block on the order detail page. After packing the 
items, I click on ‘Complete’ button to complete the packing.

The order packing is initiated and completed by a main service completePack 
which do a lot of things. It creates shipment, packages, issue items to 
shipment (which in turns also change the item status to complete), apply items 
to packages etc. and update the shipment status to PACKED. We have a following 
eca, which triggers services that creates invoice and capture the payments.

    <eca service="updateShipment" event="commit">
        <condition-field field-name="statusId" operator="not-equals" 
to-field-name="oldStatusId"/>
        <condition field-name="statusId" operator="equals" 
value="SHIPMENT_PACKED"/>
        <condition field-name="shipmentTypeId" operator="equals" 
value="SALES_SHIPMENT"/>
        <action service="createInvoicesFromShipment" mode=“sync" 
run-as-user="system"/>
        <action service="setInvoicesToReadyFromShipment" mode="sync" 
run-as-user="system"/>
    </eca>

I see few issues noted below while processing the order fulfillment. I believe 
the same issue exists on ofbiz trunk since that code around the packing & 
payment gateway service remains unchanged.

1. The service processCaptureResult (PaymentGatewayServices) contains a piece 
of code that creates payment and apply the payment to invoice but it does not 
check the status of the capture result. This leads to a invoice to PAID status 
even though the payments are declined.

2. The order status remains complete even though the payments are declined and 
is not rolled back to approved (preferably hold).

3. The order status ‘complete’ triggers an email to the customer through an eca 
defined on the service ‘changeOrderStatus’ in the order component.

I think If we add an attribute ignore-error="false" to the <action service ...> 
element it will roll-back the global transaction started by the service 
completePack() and hence will revert the oder back to its initial state 
(status) where we started packing the order but it will also rollback every 
changes done by the service completePack.

Should we fix all three issues above or just do a global rollback (which takes 
you back where you started)?

Regards
Vikas 


Reply via email to