Worldpay & non-shippable goods

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
13 years ago
Hi all, I am having an issue with non-shippable goods such as gift cards and paying via Woldpay.

I can successfully pass any shippable product to WP, process the transaction and be returned to my site with success; the problem I have is when the product is non-shippable I am not passing the correct address information over to WP and an error is generated by WP.

Has anyone else experienced this issue OR has already fixed it?

Regards to all and thanks in advance
13 years ago
I'm having a similar problem.

Did you find a fix for this?

If I make a product non-shippable (such as a downloadable file) then WP doesn't work.  make it shippable and it works fine.
I'm guessing it sends the empty shipping address rather than the billing address???

Anyone know the answer?

Thanks in advance

PJW
13 years ago
Hiya The code firstly appends the Billing Address then there is check to see if Shipped and if so it appends the Shipping Address as well as below.  I can't see anything immediatly wrong - this is not one I have used so not sure what the problem is without running in debug.
A

            remotePostHelper.Add("M_FirstName", order.BillingFirstName);
            remotePostHelper.Add("M_LastName", order.BillingLastName);
            remotePostHelper.Add("M_Addr1", order.BillingAddress1);
            remotePostHelper.Add("tel", order.BillingPhoneNumber);
            remotePostHelper.Add("M_Addr2", order.BillingAddress2);
            remotePostHelper.Add("M_Business", order.BillingCompany);

            CultureInfo cultureInfo = new CultureInfo(NopContext.Current.WorkingLanguage.LanguageCulture);
            remotePostHelper.Add("lang", cultureInfo.TwoLetterISOLanguageName);

            StateProvince billingStateProvince = IoC.Resolve<IStateProvinceService>().GetStateProvinceById(order.BillingStateProvinceId);
            if (billingStateProvince != null)
                remotePostHelper.Add("M_StateCounty", billingStateProvince.Abbreviation);
            else
                remotePostHelper.Add("M_StateCounty", order.BillingStateProvince);
            if (!useSandBox)
                remotePostHelper.Add("testMode", "0");
            else
                remotePostHelper.Add("testMode", "100");
            remotePostHelper.Add("postcode", order.BillingZipPostalCode);
            Country billingCountry = IoC.Resolve<ICountryService>().GetCountryById(order.BillingCountryId);
            if (billingCountry != null)
                remotePostHelper.Add("country", billingCountry.TwoLetterIsoCode);
            else
                remotePostHelper.Add("country", order.BillingCountry);

            remotePostHelper.Add("address", order.BillingAddress1 + "," + order.BillingCountry);
            remotePostHelper.Add("MC_callback", returnURL);
            remotePostHelper.Add("name", order.BillingFirstName + " " + order.BillingLastName);

            if (order.ShippingStatus != ShippingStatusEnum.ShippingNotRequired)
            {
                remotePostHelper.Add("delvName", order.ShippingFullName);
                string delvAddress = order.ShippingAddress1;
                delvAddress += (!string.IsNullOrEmpty(order.ShippingAddress2)) ? " " + order.ShippingAddress2 : string.Empty;
                remotePostHelper.Add("delvAddress", delvAddress);
                remotePostHelper.Add("delvPostcode", order.ShippingZipPostalCode);
                Country shippingCountry = IoC.Resolve<ICountryService>().GetCountryById(order.ShippingCountryId);
                remotePostHelper.Add("delvCountry", shippingCountry.TwoLetterIsoCode);
            }
13 years ago
Thanks Yidna,
You pointed me to the bit of code which had the problem ... well, 4 lines before where you copied from.
The problem is with the line:
            remotePostHelper.Add("withDelivery", "true");

which tells Worldpay to always expect the delivery address, so when  ShippingStatusEnum.ShippingNotRequired is true and the delivery information is not sent ... there is a problem.

I've removed that line and added it into the shipping test code as follows:

            if (order.ShippingStatus != ShippingStatusEnum.ShippingNotRequired)
            {
                remotePostHelper.Add("withDelivery", "true");
                remotePostHelper.Add("delvName", order.ShippingFullName);
                string delvAddress = order.ShippingAddress1;
                delvAddress += (!string.IsNullOrEmpty(order.ShippingAddress2)) ? " " + order.ShippingAddress2 : string.Empty;
                remotePostHelper.Add("delvAddress", delvAddress);
                remotePostHelper.Add("delvPostcode", order.ShippingZipPostalCode);
                Country shippingCountry = IoC.Resolve<ICountryService>().GetCountryById(order.ShippingCountryId);
                remotePostHelper.Add("delvCountry", shippingCountry.TwoLetterIsoCode);
            }
            else
            {
                remotePostHelper.Add("withDelivery", "false");
            }
            remotePostHelper.Post();

Seems to work fine now!

PJW
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.