Posted on 02/10/2020 14:46:32
Hi Tomas
No not with the current implementation. But the actions you do on an RMA are handled by providers (ReturnMerchandiseAuthorizationReplacementOrderProvider). So below is the code from that provider, and you can change the logic of that and make your own process. But remember you have orders with maybe 2 orderlines, where only one is returned.
using Dynamicweb.Ecommerce.Orders;
using Dynamicweb.Ecommerce.Orders.ReturnMerchandiseAuthorization;
using Dynamicweb.Extensibility.AddIns;
namespace Dynamicweb.Ecommerce.RMAProviders.Refund
{
[AddInName("Refund")]
public class Refund : ReturnMerchandiseAuthorizationReplacementOrderProvider
{
public override Order CreateRmaOrder(ReturnMerchandiseAuthorization returnMerchandiseAuthorization)
{
var order = new Order();
order.IsCart = false;
order.Complete = true;
order.CurrencyCode = returnMerchandiseAuthorization.OrderLines[0].OrderLine.Order.CurrencyCode;
returnMerchandiseAuthorization.SetCustomerInfoOnOrder(order);
foreach (ReturnMerchandiseAuthorizationOrderLine rmaOrderLine in returnMerchandiseAuthorization.OrderLines)
{
var unitPrice = rmaOrderLine.OrderLine.UnitPrice;
if (unitPrice == null)
{
unitPrice = rmaOrderLine.OrderLine.Price.Divide(rmaOrderLine.OrderLine.Quantity);
}
var orderLine = order.CreateOrderLine(rmaOrderLine.OrderLine.Product, -1, null);
orderLine.SetUnitPrice(unitPrice, true);
}
order.ForcePriceRecalculation();
return order;
}
}
}