Bukimedia / PrestaSharp

CSharp .Net client library for the PrestaShop API via web service
GNU General Public License v3.0
155 stars 153 forks source link

Changing order status not sending email. #378

Open rmartinez1996 opened 5 years ago

rmartinez1996 commented 5 years ago

Hello,

I updated to the latest version but i found the following problem.

When i try to change the order status from an order, the method doesn´t send an email. I was doing some tests and i got it overriding the Add method from OrderHistoryFactory. This is the result of the method:

public new order_history Add(order_history Entity) { long? idAux = Entity.id; Entity.id = null; List Entities = new List(); Entities.Add(Entity); RestRequest request = this.RequestForAdd($"{pluralEntityName}&sendemail=1", Entities); request.AddParameter("sendemail", 1); order_history aux = this.Execute(request); Entity.id = idAux; return this.Get((long)aux.id); }

And this is how i tested it.

[Test] public void AddOrderHistory() { order_history history = new order_history { id_order = 35206, date_add = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), id_employee = 0, id_order_state = 2 };

        history = factory.Add(history);

        Assert.IsNotNull(history.id);

}

Is there another solution?

Thank you.

Regards.