CashChequePrinting on Cancellation
Tags:
v8
Notification of cheque printing upon payment
CashChequePrinting,
which allows extending the cheque layout in the header and footer, starting from version SyrveFront 8.5.1, will also be generated upon cancellation (refund) of an order.
Example:
public sealed class CashChequePrintingHandler : IDisposable
{
private readonly IDisposable subscription;
public CashChequePrintingHandler()
{
subscription = PluginContext.Notifications.CashChequePrinting.Subscribe(OnCashChequePrinting);
}
private static CashCheque OnCashChequePrinting(Guid orderId)
{
PluginContext.Log.Info("On cash cheque printing subscription.");
var order = PluginContext.Operations.GetOrderById(orderId);
var message = order.Status == OrderStatus.Closed
? $"Order #{order.Number} storno."
: $"Order #{order.Number} pay.";
return new CashCheque
{
BeforeCheque = new XElement(Tags.Center, message),
AfterCheque = new XElement(Tags.QRCode, message)
};
}
public void Dispose()
{
try
{
subscription.Dispose();
}
catch (RemotingException)
{
// nothing to do with the lost connection
}
}
}