iikoFront API SDK

Добавлена возможность отправить доставку в путь (без оплаты)

[ ]

Начиная с V7Preview3 появляется возможность подготовить доставку к отправке, напечатать накладную, назначить курьера и отправить его в путь.

Нововведения

Пример использования

private void CreateAndSendDelivery()
{
    if (PluginContext.Operations.GetHostDeliverySettings().DeliveryPaymentTimeOption == DeliveryPaymentTimeOption.BeforeSending)
        return; // not supported yet

    var credentials = PluginContext.Operations.AuthenticateByPin(pin);

    var delivery = CreateDelivery(false); // EditorTester.CreateDelivery method from SamplePlugin
    if (PluginContext.Operations.IsDeliveryConfirmationActive())
    {
        Debug.Assert(delivery.DeliveryStatus == DeliveryStatus.Unconfirmed);
        PluginContext.Operations.ChangeDeliveryConfirmTime(DateTime.Now, delivery, credentials);
        delivery = PluginContext.Operations.GetDeliveryOrderById(delivery.Id);
    }

    PluginContext.Operations.PrintOrderItems(credentials, delivery, delivery.Items.OfType<IOrderCookingItem>().ToList());

    Debug.Assert(delivery.DeliveryStatus == DeliveryStatus.New);
    PluginContext.Operations.PrepareDeliveryForSending(credentials, delivery);
    delivery = PluginContext.Operations.GetDeliveryOrderById(delivery.Id);
    Debug.Assert(delivery.DeliveryStatus == DeliveryStatus.Waiting);

    var courier = PluginContext.Operations.GetUsers().Single(x => x.Name == courierName);
    Debug.Assert(delivery.Courier == null);
    PluginContext.Operations.ChangeDeliveryCourier(true, delivery, courier, credentials);
    delivery = PluginContext.Operations.GetDeliveryOrderById(delivery.Id);
    Debug.Assert(Equals(delivery.Courier, courier));

    Debug.Assert(!delivery.IsPrintedBillActual);
    PluginContext.Operations.PrintDeliveryBill(credentials, delivery);
    delivery = PluginContext.Operations.GetDeliveryOrderById(delivery.Id);
    Debug.Assert(delivery.IsPrintedBillActual);

    PluginContext.Operations.SendDelivery(credentials, delivery);
    delivery = PluginContext.Operations.GetDeliveryOrderById(delivery.Id);
    Debug.Assert(delivery.DeliveryStatus == DeliveryStatus.OnWay);
}