It's working the way it's supposed to. The reason it's like this is that PayPal will get in there and calculate taxes and other fields automatically, which will give the wrong amounts so we just lump everything together in a single field instead of specifying everything, which gives uCommerce total control over the amounts.
Basically we're not huge fans of PayPal post-processing amounts that show up in the uCommerce records.
How would you go about overriding the RenderPage method of the PayPalPaymentMethodService class?
I only need to change the value of the "item_name_1" that is being posted to PayPal, from "Sum" to "Something more descriptive".
I have tried to follow other tutorials that I have found, but these mainly focus on implementing whole new custom payments. I don't want to be implementing a whole new Payment Provider just to change a bit of text, if I can help it.
You can inherit the method called "GetParameters" on the class "PayPalWebSitePaymentsStandardPageBuilder".
It returns a dictionary with the fields sent to PayPal. Among them is the "item_name_1", which you can override.
Once that's done add your custom class to "Custom.config" found in "/umbraco/ucommerce/configuration" using the id "PayPalWebsitePaymentsStandardPageBuilder". That will make uCommerce use your implementation instead of the default one.
Here's an example of what you need to add to Custom.config:
I cannot extend PayPalWebSitePaymentsStandardPageBuilder and build because it does not contain a constructor with 0 params. Can you please assist with the posturl param. Where can i get this from to send through to PayPalWebSitePaymentsStandardPageBuilder?
Also, i do not have a custom.config file. Can you please assit with wiring this into ucommerce.
Which version of uCommerce are you running? Custom.config was introduced with uCommerce 3.
You can inherit the default page builder override the method GetParameters like so:
public class MyPayPalPageBuilder : PayPalWebSitePaymentsStandardPageBuilder { public IDictionary<string, string> GetParameters() { var baseParameters = base.GetParameters(); baseParameters.Add("myCutomKey", "myCustomValue"); return baseParameters; }
Fixing the problem is exactly the same way as in 3.0 You would just have to register it in components.config instead of custom.config (v3).
@Marc Love
Where are you trying to call GetParamters from ?
The standard PayPalWebSitePaymentsStandardPageBuilder only uses GetParameters within BuildBody which has the paymentreuqest passed as a parameter. I'd advice you to use Jetbrain's DotPeek decompiler to take a look at the paymentmethod service and how it's build. Its free and effective when you have to override standard components within uCommerce.
Hey Marc, glad this is sorted. Alas I couldnt figure it out in time, so came up with an alternative solution, which was to change the notifyURL parameter in the paypal.config which would change the listener url from ProcessPayment.axd? to our own IPN listener.
The IPN listener is basically a razor Macro that does various things based on the payment_complete and VERIFIED or INVALID response from paypal. Then using webmatrix.data, does some SQL on the fly to update order statuses (which also marks orders in uCommerce backend) and send out emails to customers based on this. The advantage here was that it allowed then for a lot of custom functions which don't come "out of the box".
Sounds like a reasonable solution. Although have you considered integrating them in the uCommerce Pipeline instead? Sounds like alot of the functionallity your talking about could be placed inside those. Whenever a callback is processed, the postprocessing pipeline is executed. At least that is what happens if you use any of the default paymentproviders.
Hi Morten, yeh I took a look at it briefly via the documentation on the uCommerce webste, essentially time was up against it for the project and I had to do something that would work the way the company had indicated to the client, it was my first time integrating uCommerce with umbraco so was a lot of late nights and learning curves (for a Front End Developer). But when I have more time to play with it - that will be my first port of call. I really did enjoy the integration and learned a lot from the razor store demo, which I'd recommend to anyone coming into uCommere for the first time!
Alrighty :) adding tasks to the pipeline is actually a piece of cake once you get the hang of it. They are only as complex as you make them yourself :) At least, hooking one up, would be the easy part.
Paypal emails
I'm testing a site in the Paypal sandbox. The Test Emails section is showing me this for the payment receipt:
Hello Test User, ... ----------------------------------- Purchase Details ----------------------------------- Description:Sum Unit price:13.20 GBP Qty:1 Amount:£13.20 GBP Subtotal: £13.20 GBP Total: 13.20 GBP Payment: 13.20 GBP Payment sent to: .......
That 'Description' is not what was purchased. Is there a setting I have missed?
Hi Tony,
It's working the way it's supposed to. The reason it's like this is that PayPal will get in there and calculate taxes and other fields automatically, which will give the wrong amounts so we just lump everything together in a single field instead of specifying everything, which gives uCommerce total control over the amounts.
Basically we're not huge fans of PayPal post-processing amounts that show up in the uCommerce records.
Hope this helps.
Hi Soren,
I have the same issue. I need to track all sales in PayPal as well and the detailed PayPal invoice.
How can I change current request to a detailed one? Is it possible to override current request generation method and how?
I would write my own request generation.
You can override the RenderPage method of the PayPalPaymentMethodService class. It's responsible for generating the information sent to PayPal.
Hello,
How would you go about overriding the RenderPage method of the PayPalPaymentMethodService class?
I only need to change the value of the "item_name_1" that is being posted to PayPal, from "Sum" to "Something more descriptive".
I have tried to follow other tutorials that I have found, but these mainly focus on implementing whole new custom payments. I don't want to be implementing a whole new Payment Provider just to change a bit of text, if I can help it.
Thanks
You can inherit the method called "GetParameters" on the class "PayPalWebSitePaymentsStandardPageBuilder".
It returns a dictionary with the fields sent to PayPal. Among them is the "item_name_1", which you can override.
Once that's done add your custom class to "Custom.config" found in "/umbraco/ucommerce/configuration" using the id "PayPalWebsitePaymentsStandardPageBuilder". That will make uCommerce use your implementation instead of the default one.
Here's an example of what you need to add to Custom.config:
Soren,
can you please supply me with a link to the API documentation for this class to assist in building this override.
(PayPalWebSitePaymentsStandardPageBuilder)
I cannot find it...see below link?
http://www.ucommerce.dk/docs/
I cannot extend PayPalWebSitePaymentsStandardPageBuilder and build because it does not contain a constructor with 0 params. Can you please assist with the posturl param. Where can i get this from to send through to PayPalWebSitePaymentsStandardPageBuilder?
Also, i do not have a custom.config file. Can you please assit with wiring this into ucommerce.
Thanks
Dean
Hi Deano,
Which version of uCommerce are you running? Custom.config was introduced with uCommerce 3.
You can inherit the default page builder override the method GetParameters like so:
public class MyPayPalPageBuilder : PayPalWebSitePaymentsStandardPageBuilder
{
public IDictionary<string, string> GetParameters()
{
var baseParameters = base.GetParameters();
baseParameters.Add("myCutomKey", "myCustomValue");
return baseParameters;
}
Hope this helps.
We're using 2.6 (i think)....The version before V3.
We are also unable to upgrade to version 3 at this point. Is there a way of achieving the above without upgrading to version 3??
Thanks
Dean
Hey,
glad i found this topic. Have succesfully made a custom PayPalPageBuilder with uCommerce3.
But i also have the same problem with uCommerce 2.6. Where can i change the PageBuilder there?
Thanks David
Hi Soren,
I am trying to override PayPalWebSitePaymentsStandardPageBuilder
The following line gives me an error:
var baseParameters = base.GetParameters();
GetParameters is expection PaymentRequest to be passed to it. Where do I get this from?
Cheers,
Marc
/// <summary>
/// Summary description for MyPayPalPageBuilder
/// </summary>
public class MyPayPalPageBuilder : PayPalWebSitePaymentsStandardPageBuilder
{
public IDictionary<string, string> GetParameters(PaymentRequest paymentRequest)
{
var baseParameters = base.GetParameters(paymentRequest);
baseParameters.Add("item_name_1", "Order Name");
return baseParameters;
}
}
I get the following error when trying to add in my custom values:
UCommerce.Transactions.Payments.PayPal.PayPalWebSitePaymentsStandardPageBuilder' does not contain a constructor that takes 0 arguments
Any ideas would be greatly appreciated.
Thanks,
J
Hi Joe,
Did you manage to figure this out? I have the same issue.
Cheers,
Marc
Fixing the problem is exactly the same way as in 3.0 You would just have to register it in components.config instead of custom.config (v3).
@Marc Love
Where are you trying to call GetParamters from ?
The standard PayPalWebSitePaymentsStandardPageBuilder only uses GetParameters within BuildBody which has the paymentreuqest passed as a parameter. I'd advice you to use Jetbrain's DotPeek decompiler to take a look at the paymentmethod service and how it's build. Its free and effective when you have to override standard components within uCommerce.
Thanks Morten, sorted
public MyPayPalPageBuilder(CommerceConfigurationProvider configProvider) : base(configProvider) { }
Hey Marc, glad this is sorted. Alas I couldnt figure it out in time, so came up with an alternative solution, which was to change the notifyURL parameter in the paypal.config which would change the listener url from ProcessPayment.axd? to our own IPN listener.
The IPN listener is basically a razor Macro that does various things based on the payment_complete and VERIFIED or INVALID response from paypal. Then using webmatrix.data, does some SQL on the fly to update order statuses (which also marks orders in uCommerce backend) and send out emails to customers based on this. The advantage here was that it allowed then for a lot of custom functions which don't come "out of the box".
Thanks,
Joe
@Joe
Sounds like a reasonable solution. Although have you considered integrating them in the uCommerce Pipeline instead? Sounds like alot of the functionallity your talking about could be placed inside those. Whenever a callback is processed, the postprocessing pipeline is executed. At least that is what happens if you use any of the default paymentproviders.
Hi Morten, yeh I took a look at it briefly via the documentation on the uCommerce webste, essentially time was up against it for the project and I had to do something that would work the way the company had indicated to the client, it was my first time integrating uCommerce with umbraco so was a lot of late nights and learning curves (for a Front End Developer). But when I have more time to play with it - that will be my first port of call. I really did enjoy the integration and learned a lot from the razor store demo, which I'd recommend to anyone coming into uCommere for the first time!
Alrighty :) adding tasks to the pipeline is actually a piece of cake once you get the hang of it. They are only as complex as you make them yourself :) At least, hooking one up, would be the easy part.
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.