Hi Team, I have a question around refund functionality. Please consider below scenario: *Given that * *customer has 2 credit cards *referred to as CARD1 & CARD2 below. customer has existing order O1 with two orderItems (ITEM1 = 1 bag of banana) *(ITEM2 = 1 bag of apples)* customer has already made payment for above order (and therefore 2 orderItems) using *CARD1*
*When* customer edits the order prior to fulfilment and adds (ITEM3 = 1 bag of grapes) *THEN* customer would be redirected to payment gateway for additional payment for grapes * AND* customer uses the *CARD2 for paying for grapes* This scenario seems to be working as expected and I have noticed that by the end of it we get 2 records in OrderPaymentPreference table 1 for each card. Now comes the actual question around refund. When a customer tries to edit the above order prior to fulfilment and removes apples then ideally we should be refunding using CARD1. However as I am not seeing an actual link between orderPaymentPreference with OrderItems, I am not sure how ofbiz can decide which card should be picked up for refund. In the pdf - that shows the entities, it is shown that OrderPaymentPrefernce table has column OrderItemSeqId, but it seems ofbiz is not populating it anyways. So could you please advise or provide some pointers to which ofbiz services/ entities could be used to make sure that the correct card is picked up for refunding? Scenario becomes interesting when the customer increases the quantity of existing items E.g. in the example above, if customer adds 1 more bag of apples and then uses CARD2 for making that payment and subsequently tries to cancel the apples altogether. In which case refund should be done using CARD1 and CARD2 both... :-) Essentially I am trying to make sure that if a customer has made 2 payments using 2 cards, then when it comes to partial refund due to changes to order, ofbiz should not be refunding more to any of the cards than what was paid using that card by the customer. Regards, Sameer Apte