We're trying to save notes in Merchello 2.0 in the CheckoutPaymentController process payment.
We've tried several things, none of which have worked. We're doing this after processing the payment.
A few notes:
1. Our customers are anonymous
2. No errors are thrown and everything works correctly, but the note does not display in the Merchello Sale display
Here's what we've tried:
CheckoutManager.Extended.AddNote(message)
Create the note and add to invoice
var invoiceService = MerchelloContext.Current.Services.InvoiceService;
var invoice = invoiceService.GetByKey(invoiceKey);
// ensure the invoice is already saved
MerchelloContext.Current.Services.InvoiceService.Save(invoice);
var noteService = MerchelloContext.Current.Services.NoteService;
var note = noteService.CreateNoteWithKey(invoice.Key, EntityType.Invoice, model.Notes);
noteService.Save(note);
// resave the invoice - shouldn't need to do this either
MerchelloContext.Current.Services.InvoiceService.Save(invoice);
Same as above, but manually add the note
var notes = noteService.GetNotesByEntityKey(invoice.Key);
if(notes == null)
{
notes = new List
It's because it is after the payment and the CheckoutManager has been cleared by an event so it's losing context so Number 1 will not work as it is assuming the checkout has been completed (assuming the payment was successful).
Depending on where your getting your information for your message:
1) If it is available through the payment result, you could use one of the event handlers off of the PaymentMethodBase class or the Finalizing event off the checkout manager.
2) If the information is specific (like a text box entry from a form field) you have to add the note to the invoice and then re-save the invoice:
To prevent multiple saves
Use the NoteService to create the note (without a key)
Add it to the invoice notes (directly on the invoice)
Save the invoice
It's basically the same thing that is done in the CheckoutManager ...
Notes do not save
We're trying to save notes in Merchello 2.0 in the CheckoutPaymentController process payment.
We've tried several things, none of which have worked. We're doing this after processing the payment.
A few notes: 1. Our customers are anonymous 2. No errors are thrown and everything works correctly, but the note does not display in the Merchello Sale display
Here's what we've tried:
Create the note and add to invoice var invoiceService = MerchelloContext.Current.Services.InvoiceService; var invoice = invoiceService.GetByKey(invoiceKey); // ensure the invoice is already saved MerchelloContext.Current.Services.InvoiceService.Save(invoice);
Same as above, but manually add the note var notes = noteService.GetNotesByEntityKey(invoice.Key); if(notes == null) { notes = new List
We've already tried these suggestions: https://our.umbraco.org/projects/collaboration/merchello/merchello/74101-how-to-implementate-note-s-to-invoices
Hey Zac,
It's because it is after the payment and the CheckoutManager has been cleared by an event so it's losing context so Number 1 will not work as it is assuming the checkout has been completed (assuming the payment was successful).
Depending on where your getting your information for your message:
1) If it is available through the payment result, you could use one of the event handlers off of the PaymentMethodBase class or the Finalizing event off the checkout manager.
2) If the information is specific (like a text box entry from a form field) you have to add the note to the invoice and then re-save the invoice:
To prevent multiple saves
It's basically the same thing that is done in the CheckoutManager ...
https://github.com/Merchello/Merchello/blob/merchello-dev/src/Merchello.Web/Workflow/InvoiceCreation/CheckoutManager/AddNotesToInvoiceTask.cs#L44
That worked.
For other people having the same issue, here's what we did:
Thanks again Rusty - would you be able to provide any insight on this: https://our.umbraco.org/projects/collaboration/merchello/merchello/78254-digital-products-checkout-flow?
We've been spinning our wheels trying to get the fulfillment to display correctly.
is working on a reply...