Lukesy,
Still a real newby with C#.
Added the following line into PaypalStandardPaymentProvider.cs
public string GetUploadOrderUrl(string orderNumber) {
Order order = Order.Get(orderNumber);
decimal total = Math.Round(order.OrderTotalAmount, 2);
StringBuilder url = new StringBuilder();
url.Append(GetPaypalUrl()).Append("?cmd=_xclick&business=").Append(HttpUtility.UrlEncode(businessEmail));
url.AppendFormat("&amount={0}", Math.Round(order.OrderTotalAmount, 2));
url.AppendFormat("&item_name=Order Number {0}", orderNumber);
url.AppendFormat("&custom={0}", orderNumber);
url.Append("&no_shipping=1");
url.AppendFormat("&first_name={0}", order.ShippingAddress.FirstName);
url.AppendFormat("&last_name={0}", order.ShippingAddress.LastName);
url.AppendFormat("&address1={0}", order.ShippingAddress.Address1);
url.AppendFormat("&address2={0}", order.ShippingAddress.Address2);
url.AppendFormat("&city={0}", order.ShippingAddress.City);
url.AppendFormat("&state={0}", order.ShippingAddress.State);
url.AppendFormat("&country={0}", order.ShippingAddress.Country.CodeISO3166);
url.AppendFormat("&zip={0}", order.ShippingAddress.Zipcode);
//2009.03.17 JJ Add currency_code parameter
url.AppendFormat("¤cy_code={0}", "AUD"); // <<<<<<<<<<<<<<<<<<<<<<<<<<<
url.AppendFormat("&return={0}", HttpUtility.UrlEncode(SiteNavigation.PaypalPDTHandlerPage));
url.AppendFormat("&cancel_return={0}", HttpUtility.UrlEncode(SiteNavigation.CheckoutPage));
return url.ToString();
}
Added the following into PaypalExpressProvider.cs
public string SetExpressCheckout(decimal orderTotal, string returnUrl, string cancelUrl, bool AuthOnly) {
SetExpressCheckoutReq req = new SetExpressCheckoutReq();
req.SetExpressCheckoutRequest = new SetExpressCheckoutRequestType();
req.SetExpressCheckoutRequest.Version = PaymentUtils.APIVersion;
SetExpressCheckoutRequestDetailsType details = new SetExpressCheckoutRequestDetailsType();
req.SetExpressCheckoutRequest.SetExpressCheckoutRequestDetails = details;
details.PaymentAction = AuthOnly ? PaymentActionCodeType.Authorization : PaymentActionCodeType.Sale;
details.PaymentActionSpecified = true;
details.OrderTotal = new BasicAmountType();
details.OrderTotal.Value = Math.Round(orderTotal, 2).ToString();
//2009.03.17 JJ Change to AUD
details.OrderTotal.currencyID = CurrencyCodeType.AUD; //<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
details.ReturnURL = returnUrl;
details.CancelURL = cancelUrl;
SetExpressCheckoutResponseType response = service2.SetExpressCheckout(req);
string error;
if (PaymentUtils.CheckSuccess(response, out error)) {
return GetPaypalUrl(response.Token);
}
throw new PaymentExecption(error);
}
I did a build. For some reason it would only build a debug build, even though I changed the properties on the project.
I then copied the DLL and *.pdb files from \bin\debug into the bin folder on my website.
Restarted website.
Get the following Unhandled Exception
<font face="Segoe UI" size="2">Timestamp: 17/03/2009 9:10:26 AM
Message: HandlingInstanceID: 6ccadf27-39aa-40d1-86e6-7594210c4a60
An exception of type 'System.Configuration.ConfigurationErrorsException' occurred and was caught.
-------------------------------------------------------------------------------------------------
03/17/2009 20:10:26
Type : System.Configuration.ConfigurationErrorsException, System.Configuration, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
Message : Cannot find the requested object.
(C:\inetpub\wwwroot\dsc\DSC.config line 20)
Source : System.Web
Help link :
BareMessage : Cannot find the requested object.
Filename : C:\inetpub\wwwroot\dsc\DSC.config
Line : 20
Errors : System.Configuration.ConfigurationException[]
Data : System.Collections.ListDictionaryInternal
TargetSite : System.Configuration.Provider.ProviderBase InstantiateProvider(System.Configuration.ProviderSettings, System.Type)
Stack Trace : at System.Web.Configuration.ProvidersHelper.InstantiateProvider(ProviderSettings providerSettings, Type providerType)
at DotShoppingCart.OpenSource.Payment.PaypalExpressPaymentProvider.GetProvider(String host)
at DotShoppingCart.OpenSource.Payment.PaypalExpressPaymentProvider.GetProvider()
at Store_Cart.IsCreditCardAndPaypalEnabled() in c:\inetpub\wwwroot\dsc\Store\Cart.ascx.cs:line 69
at Store_Cart.Page_Load(Object sender, EventArgs e) in c:\inetpub\wwwroot\dsc\Store\Cart.ascx.cs:line 49
at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e)
at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e)
at System.Web.UI.Control.OnLoad(EventArgs e)
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest()
at System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context)
at System.Web.UI.Page.ProcessRequest(HttpContext context)
at ASP.dynamic_aspx.ProcessRequest(HttpContext context) in c:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\49a10f32\18934afa\App_Web_jgqcqbhs.0.cs:line 0
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
Additional Info:
MachineName : ELIJAH32
TimeStamp : 17/03/2009 9:10:26 AM
FullName : Microsoft.Practices.EnterpriseLibrary.ExceptionHandling, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null
AppDomainName : /LM/W3SVC/2/ROOT-4-128817545575734920
ThreadIdentity : admin
WindowsIdentity : NT AUTHORITY\NETWORK SERVICE
Category: General
Priority: 0
EventId: 100
Severity: Error
Title:Enterprise Library Exception Handling
Machine: ELIJAH32
Application Domain: /LM/W3SVC/2/ROOT-4-128817545575734920
Process Id: 4276
Process Name: c:\windows\system32\inetsrv\w3wp.exe
Win32 Thread Id: 5320
Thread Name:
Extended Properties: Url - http://dsc.goldrush.local/Dynamic.aspx?p=Store/Cart
RawUrl - /Store/Cart.aspx
UseAgent - Mozilla/5.0 (Windows; U; Windows NT 6.0; en-GB; rv:1.9.0.7) Gecko/2009021910 Firefox/3.0.7 (.NET CLR 3.5.30729)
UrlReferrer - http://dsc.goldrush.local/
IPAddress - 192.168.14.18
<font face="Segoe UI" size="2">I'm sure I've just missed something basic.
<font face="Segoe UI" size="2">Thanks for your help.
|