Creating PDF and sending it via E-Mail

Hi Rusty

Still trying to get into Merchello and figure out, how it works under the hood ;-).




I thought it’s faster if I ask you about this :-P.

After the payment is done, I want to generate a PDF. Therefore I created a task chain and added it to the merchello.config:

<task type="Test.Chains.InvoiceCreation.GenereatePdf, Test.Chains" />

The problem is, that after the payment is succeeded and the task is hit, the InvoiceNumber is still 0 - is this a bug, or is there a reason?

As a next step I want to send the PDF to the customer. Should I use the Notification for that?

Is it possible to have something like:

public override void PerformSend(IFormattedNotificationMessage message)
{
    // There is no way to access invoice
    string invoiceNumber = message.Invoice.InvoiceNumber;

    GetPdfPathByInvoiceNumber(invoiceNumber);
}

private GetPdfPathByInvoiceNumber(int invoiceNumber)
{
    var privateFolder = WebConfigurationManager.AppSettings["privateFolderPath"].ToString();
    return Path.Combine(privateFolder, "Confirmations", invoiceNumber + ".pdf");
}

Thank you

Calvin


This is a companion discussion topic for the original entry at https://our.umbraco.com/forum/56553-creating-pdf-and-sending-it-via-e-mail