On Jul 16, 2009, at 6:33 AM, Vikas Mayur wrote:
On Jul 16, 2009, at 1:08 AM, David E Jones wrote:
My question is why payment is captured when the invoice status is
In-Process? Shouldn't the system look for Invoice Ready status to
capture the payments.
If what I said above is true, I could use the existing artifacts
and do some changes so that system validate against the invoice
status before doing a capture.
Yes, that sounds like the correct way to go. The payment capture
trigger should not do anything if the invoice that triggered it is
not in the Ready status (and perhaps just in that status, ie it
shouldn't do anything in the In-Process status or the received
status or anything.
I haven't dug into the code to see if it is needed to add the
option that Jacopo mentioned. My opinion right now is that the
current behavior is wrong and should be corrected, ie the trigger
shouldn't cause payment capture for an invoice that isn't Ready.
thanks David for looking into it. I do have the same thought to do
the correction to current behavior. I will start looking into it.
Jacopo, Do you have any thoughts with the new field on ProductStore
you mentioned earlier?
If, as David and you are saying, we will attach the
"capturePaymentsByInvoice" to the status change of the invoice (to
Invoice ready), and detach it from the "createInvoiceForOrder"
service, then we don't probably need the field in the store.
In fact:
a) if ProductStore.autoApproveInvoice = Y then the invoice will be
automatically moved to the ready status, this will trigger the
capturePaymentsByInvoice sservice and everything will work as now
b) if ProductStore.autoApproveInvoice = N then the invoice will stay
in the in-process status and payments will not be captured
We may have to redesign the way ECA rules are defined; here is what I
would suggest (it should work and be enough flexible):
updateShipment --> PICKED: trigger createInvoiceForOrder (invoice in
status IN PROCESS)
ProductStore.autoApproveInvoice = Y: calls updateInvoice to status READY
updateShipment --> PACKED: trigger updateInvoice to status READY (it
is important to pass thru the status PICKED or make sure that invoices
are created before the call to updateInvoice)
updateInvoice --> READY: trigger capturePaymentsByInvoice
Note: the above are just very generic notes and we will probably have
to create small services for the above ECAs: for examplewhen a
shipment is moved to PACKED then we will have to attach a service that
find out all the invoices associated to the shipment and then for each
of them it calls the updateInvoice service (in my notes I have
simplified it saying that the event will call the updateInvoice Service)
Jacopo