Im trying to add a custom pipeline within my project so that when i customer completes their shipping and billing address details it creates them as a member and emails them a generated password.
My approach is two fold.
1) Upon completion of the shipping address and billing address and check out send email with password
2)Also add those details to custom properties within the membership group
What i have so far which is not working and need a little help on is this, ive been following this thread trying to get it to work but to no avail.
The code ive used below, created a new project, built it and copied the DLL over to the bin of the ucommerce site.
namespace UcomCreateMemberAndSendPassword
{
publicclassCreateMemberAndSendPasswordTask : IPipelineTask<PurchaseOrder>
{
publicPipelineExecutionResult Execute(PurchaseOrder purchaseOrder)
{
// New an instance of our custom taskvar task = newCreateMemberAndSendPasswordInternalTask {PurchaseOrder = purchaseOrder};
// Save the order for use in GeneratePassword to get the e-mailreturn task.Execute(purchaseOrder);
}
}
publicclassCreateMemberAndSendPasswordInternalTask : CreateMemberForCustomerTask
{
publicPurchaseOrder PurchaseOrder { get; set; }
publicoverridestring GeneratePassword()
{
string password = base.GeneratePassword();
var customer = PurchaseOrder.Customer;
// Build a list of parameters to pass to the e-mail service// Parameters are passed to the configured e-mail template with the key specified, // e.g. MyWelcomeTemplate.apsx?password=<generatedPassword>&firstName=<firstName>&lastName=<lastName>// Can also be used in the subject in the form of {password}, {firstName}, {lastName}var parameters = newDictionary<string, string>
{
{"password", password},
{"firstName", customer.FirstName},
{"lastName", customer.LastName}
};
string t = customer.FirstName + customer.LastName + password;
umbraco.library.SendMail("[email protected]", PurchaseOrder.Customer.EmailAddress, "Slingshot Racing Registration", t, true);
var localizationContext = ObjectFactory.Instance.Resolve<ILocalizationContext>();
var emailService = ObjectFactory.Instance.Resolve<IEmailService>();
var emailProfile = SiteContext.Current.CatalogContext.CurrentCatalogGroup.EmailProfile;
emailService.Send(localizationContext, emailProfile, "WelcomeEmail", newMailAddress(PurchaseOrder.Customer.EmailAddress), parameters);
return password;
}
}
}
The config i have changed to this but im unsure if i should be commenting out CreateMemberForCustomer or not, ive tried both approaches, leaving it uncommented and commented out and it still wont send the welcome email with the password. Below you can see my config
I do get the Order Confimation email so i know the emails are setup correctly, which has 'Avenue Clothing' link in the body which i cant seem to find where its putting that in to remove it?
I have created the email profile within ucommerce see below
Im sure its something ive missed, if anyone could help it would be much appreciated.
My second problem is how do i map the shipping/billing information the user inputs into the membership group properties? Another custom pipeline?
You're not far off but you can leave uCommerce doing the heavy lifting of creating the member (i.e. don't do it yourself when adding the address details).
The way we do it is let uCommerce create the user and then reset the password and email in the next step (so uncomment the create member task).
To do this we set a flag in a purchase order property containing the user's password that they specified while checking out. Then during checkout if that's populated (or in your case the random one) we then have a custom pipeline task after the uCommerce one which looks for the property on the order and emails the customer if relevant.
In your code above you're not doing anything to create the member in Umbraco so you'll need to do two things:
Do you have any code examples you could point me to?
I have uncommented the CreateMemberForCustomer pipeline task and left my new pipline task CreateMemberAndSendPassword in their but it doesnt send an email, the Override of GeneratePassword should create the password on the fly for me to email it onto the client?
I have implemented the new DLL (UCommerce.RazorStore.dll) and setup to email the customer but im not getting an email for the NewUserAccount and also after ive added this they are not being created in the Mebers area?
Im using Worlpay and keep getting this email from them upon every test transaction
Our systems have detected that your callback has failed.
This callback failure means we were unable to pass information to your server about the following transaction:
Also, if you usually return a response page for us to display to the Shopper within the time allowed (1 minute), this will not have been displayed.
WorldPay will have displayed to the Shopper the response page file (resultY.html or resultC.html) held for your installation on the WorldPay server. This will be your own custom version, if you have supplied one, or, if not, the WorldPay default version.
We hope this information will be of assistance. Please refer to the WorldPay Knowledgebase - http://www.worldpay.com/support - or contact your local Technical Support team if you want help or advice about using the callback facility or about this particular callback failure.
If you would like to switch off the callback failure alerts or would like to change the address to which these emails are sent, you can do so by following the steps below on the Merchant Interface (WorldPay Administration Server) - http://www.worldpay.com/admin.
- Log on to the Merchant Interface. - Click on the "Configuration Options" button for the relevant installation. - Edit the "Callback Failure Alert email address" field. If you wish to switch off the callback failure alerts, set the "Callback Failure Alert email address" field as blank. - Make sure you click on "Save Changes" before leaving the page.
Could this be what is stopping the NewUserAccount email from sending with the generated email?
It's strange that its not inserting them now into the Members area and also i do recieve the Order Confimation email.
It runs through fine on a authorised payment, it redirects back to the website and shows the completed transaction page, i use a meta refresh to do this in Worldpay.
Son not sure why it wont send the email with the password and now of course wont insert the new user in the mebers area.
The remote server returned an error: (404) Not Found. Byte[] DownloadDataInternal(System.Uri, System.Net.WebRequest ByRef) at System.Net.WebClient.DownloadDataInternal(Uri address, WebRequest& request) at System.Net.WebClient.DownloadData(Uri address) at UCommerce.Transactions.Payments.WorldPay.WorldPayPaymentMethodService.DownloadPageContent(Uri uri) at UCommerce.Transactions.Payments.WorldPay.WorldPayPaymentMethodService.ProcessCallback(Payment payment) at UCommerce.Transactions.Payments.PaymentProcessor.ProcessRequest(HttpContext context)
Sorry, I started responding but then got distracted. I need to take a look at the uCommerce source code to find out what it's looking for -can you go to your email page direct? I usually get the 404 at this point when I've forgotten to setup the emails correctly in Umbraco (e.g. no template).
The avenue clothing bits will have come from the template I suspect.
In regards the 404, I've checked the uCommerce source and it looks as though it's failing on either the AcceptUrl or DeclineUrl, have you configured those correctly in the WorldPay.config file?
The avenue clothing bits will have come from the template I suspect.
In regards the 404, I've checked the uCommerce source and it looks as though it's failing on either the AcceptUrl or DeclineUrl, have you configured those correctly in the WorldPay.config file?
But it has stopped the error email coming from WorldPay :)
What's more worrying is that now its not inserting the user into the members section? Where as before it would insert them and i could see a member created in the mebeship section.
i have downloaded the new ucommerce.razorstore.dll and copied that over into my bin folder and also changed the Checkout.config file is there any other .dll's i need to copy over? Am i missing something?
It might sound a little daft but do you know if the server can see itself? We sometimes have a problem with new servers on Rackspace whereby they can't view the domain from the server itself (something that this will need to do).
You can test this fairly easily if you have RDC access -just log onto the box and open the email page from there.
If I recall correctly the EmailService also uses the url -rather than PageId (this is something we've changed in our EmailService as when running two installs off one instance it can result in the wrong content).
I'm not sure it's the email service side of things causing the issue rather the WorldPay callback. Have you tried reverting to the standard CreateMember task?
As for creating customer members, that is done as part of the Checkout Pipeline task -which is called after your payment callback has been run so if it is the payment stuff that's failing, that'll be why.
Emailing a new customer on signup
Im trying to add a custom pipeline within my project so that when i customer completes their shipping and billing address details it creates them as a member and emails them a generated password.
My approach is two fold.
1) Upon completion of the shipping address and billing address and check out send email with password
2)Also add those details to custom properties within the membership group
What i have so far which is not working and need a little help on is this, ive been following this thread trying to get it to work but to no avail.
Send Email / password when members are created in checkout
The code ive used below, created a new project, built it and copied the DLL over to the bin of the ucommerce site.
The config i have changed to this but im unsure if i should be commenting out CreateMemberForCustomer or not, ive tried both approaches, leaving it uncommented and commented out and it still wont send the welcome email with the password. Below you can see my config
I do get the Order Confimation email so i know the emails are setup correctly, which has 'Avenue Clothing' link in the body which i cant seem to find where its putting that in to remove it?
I have created the email profile within ucommerce see below
Im sure its something ive missed, if anyone could help it would be much appreciated.
My second problem is how do i map the shipping/billing information the user inputs into the membership group properties? Another custom pipeline?
Cheers
Neil.
You're not far off but you can leave uCommerce doing the heavy lifting of creating the member (i.e. don't do it yourself when adding the address details).
The way we do it is let uCommerce create the user and then reset the password and email in the next step (so uncomment the create member task).
To do this we set a flag in a purchase order property containing the user's password that they specified while checking out. Then during checkout if that's populated (or in your case the random one) we then have a custom pipeline task after the uCommerce one which looks for the property on the order and emails the customer if relevant.
In your code above you're not doing anything to create the member in Umbraco so you'll need to do two things:
1. Uncommend the uCommerce task
2. Add some logic to change the user's password
HTH
Hi Tim
Do you have any code examples you could point me to?
I have uncommented the CreateMemberForCustomer pipeline task and left my new pipline task CreateMemberAndSendPassword in their but it doesnt send an email, the Override of GeneratePassword should create the password on the fly for me to email it onto the client?
Ah hang on, I didn't spot that you were overriding the uc task. in that case you were right to comment out the task.
I've got a complete sample that I started blogging about, I'll finish that off and get it posted for you.
Cheers Tim really apreciate it :)
Hi Tim
Did you manage to finish that blog post? If not do you have some sample code you could send me?
Cheers
Neil.
Hi Neil,
Fresh off the press and hopefully not too late for you here's a post that should help - http://blogs.thesitedoctor.co.uk/tim/2013/07/13/How+To+Create+An+Umbraco+Member+And+Email+The+Customer+Their+Password+At+Checkout+Using+UCommerce.aspx
Let me know how you get on.
Tim
Hi Tim
Im getting some strange results with this.
I have implemented the new DLL (UCommerce.RazorStore.dll) and setup to email the customer but im not getting an email for the NewUserAccount and also after ive added this they are not being created in the Mebers area?
Im using Worlpay and keep getting this email from them upon every test transaction
Our systems have detected that your callback has failed.
This callback failure means we were unable to pass information
to your server about the following transaction:
Transaction ID: 146592941
Cart ID: Reference-17
Installation ID: 300051
Error reported: Callback to http://staging.yellowphin.com/8/22/PaymentProcessor.axd: NOT OK, recevied HTTP status: 500
Server Reference: mm2imscs4p:callbackFailureEmail-79710:MerchReq-751-28
Also, if you usually return a response page for us to display to the Shopper
within the time allowed (1 minute), this will not have been displayed.
WorldPay will have displayed to the Shopper the response page file
(resultY.html or resultC.html) held for your installation on the WorldPay
server. This will be your own custom version, if you have supplied one, or,
if not, the WorldPay default version.
We hope this information will be of assistance. Please refer to the WorldPay
Knowledgebase - http://www.worldpay.com/support -
or contact your local Technical Support team if you want help or advice
about using the callback facility or about this particular callback failure.
If you would like to switch off the callback failure alerts or would like to
change the address to which these emails are sent, you can do so by
following the steps below on the Merchant Interface (WorldPay
Administration Server) - http://www.worldpay.com/admin.
- Log on to the Merchant Interface.
- Click on the "Configuration Options" button for the relevant installation.
- Edit the "Callback Failure Alert email address" field. If you wish to switch
off the callback failure alerts, set the "Callback Failure Alert email
address" field as blank.
- Make sure you click on "Save Changes" before leaving the page.
Could this be what is stopping the NewUserAccount email from sending with the generated email?
It's strange that its not inserting them now into the Members area and also i do recieve the Order Confimation email.
It runs through fine on a authorised payment, it redirects back to the website and shows the completed transaction page, i use a meta refresh to do this in Worldpay.
Son not sure why it wont send the email with the password and now of course wont insert the new user in the mebers area.
Any help would be much appreciated.
Yep that sounds like it is the issue Neil,
Can you paste in the error from the Umbraco.log please as we need to know what's exceptioning
Yep sure i have 2 errors
http://staging.yellowphin.com:80/8/23/PaymentProcessor.axd?installation=300051&msgType=authResult
and
The remote server returned an error: (404) Not Found. Byte[] DownloadDataInternal(System.Uri, System.Net.WebRequest ByRef) at System.Net.WebClient.DownloadDataInternal(Uri address, WebRequest& request) at System.Net.WebClient.DownloadData(Uri address) at UCommerce.Transactions.Payments.WorldPay.WorldPayPaymentMethodService.DownloadPageContent(Uri uri) at UCommerce.Transactions.Payments.WorldPay.WorldPayPaymentMethodService.ProcessCallback(Payment payment) at UCommerce.Transactions.Payments.PaymentProcessor.ProcessRequest(HttpContext context)
Any idea on the above Tim?
Are there any other error info i need to add? You think this is something on the WorldPay side or Ucommerce?
Hi Neil,
Sorry, I started responding but then got distracted. I need to take a look at the uCommerce source code to find out what it's looking for -can you go to your email page direct? I usually get the 404 at this point when I've forgotten to setup the emails correctly in Umbraco (e.g. no template).
Tim
Hi
Yep, if i go into back office and click on the link in the properties tab it takes me to the email template
http://staging.yellowphin.com/emails/order-confirmation-email/
although it is saying Avenue Clothing, which im not sure where thats coming from, must be hard coded somewhere?
Cheers
Neil.
Hi Neil,
The avenue clothing bits will have come from the template I suspect.
In regards the 404, I've checked the uCommerce source and it looks as though it's failing on either the AcceptUrl or DeclineUrl, have you configured those correctly in the WorldPay.config file?
Tim
Hi Neil,
The avenue clothing bits will have come from the template I suspect.
In regards the 404, I've checked the uCommerce source and it looks as though it's failing on either the AcceptUrl or DeclineUrl, have you configured those correctly in the WorldPay.config file?
Tim
Hi Tim
So ive tried just having blank acceptUrl and declineUrl in WorldPay.config and it's still not sending the email.
Tried setting the accept and decline url's to http://staging.yellowphin.com/cart/confirmation and still no email.
But it has stopped the error email coming from WorldPay :)
What's more worrying is that now its not inserting the user into the members section? Where as before it would insert them and i could see a member created in the mebeship section.
i have downloaded the new ucommerce.razorstore.dll and copied that over into my bin folder and also changed the Checkout.config file is there any other .dll's i need to copy over? Am i missing something?
Neil.
Hi Neil,
It might sound a little daft but do you know if the server can see itself? We sometimes have a problem with new servers on Rackspace whereby they can't view the domain from the server itself (something that this will need to do).
You can test this fairly easily if you have RDC access -just log onto the box and open the email page from there.
If I recall correctly the EmailService also uses the url -rather than PageId (this is something we've changed in our EmailService as when running two installs off one instance it can result in the wrong content).
I'm not sure it's the email service side of things causing the issue rather the WorldPay callback. Have you tried reverting to the standard CreateMember task?
As for creating customer members, that is done as part of the Checkout Pipeline task -which is called after your payment callback has been run so if it is the payment stuff that's failing, that'll be why.
Tim
is working on a reply...