Imagine being paid to improve your favorite CMS!

It could be you! Umbraco HQ are hiring and are looking for both talents and senior developers. Wonderful workplace, friendly colleagues and competitive salary.

Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


These support forums are now closed for new topics and comments.
Please head on over to http://eureka.ucommerce.net/ for support.

  • Ferry zijlmans 8 posts 59 karma points
    May 29, 2015 @ 08:53
    Ferry zijlmans
    0

    Make an order without paying

    I’ve made a form in the back office of Umbraco 7 the problem is that it is the same form as in the web site. If a user enter their information they will be redirected to the payment method.
    So it is one product on my website.

    Users do not pay in the back office so I use the “Default payment Method Service” pay method. If I try to create a payment I get some error in my custom pipeline. This pipeline saves the users info in the database. The error is PurchaseOrder.Orderadress  is null. The other information is filled but only the order address is null.

     

    If I use this code it work but it can't be the right way:

    basket.PurchaseOrder.AddOrderAddress(basket.PurchaseOrder.BillingAddress);

                    basket.PurchaseOrder.CultureCode = "nl-NL";

                    TransactionLibrary.CreatePayment(id);

    If I don't change the CultureCode I get the error:
    no "Confirmationemail" for culture code "en-GB"

    So the problem is that the Orderadress stays null after paying with “Default payment Method Service”. And yes the checkout pipeline is attachted to that payment method.

    the catch:
        //Continue processing the data...
        var orderAddress = order.OrderAddresses.FirstOrDefault();

                if (orderAddress == null)

                {
     string error = String.Concat("CustomCode.Pipeline (", order.OrderId, ") - OrderAdress is null");

                    Log.Error(error);

                    throw new ArgumentException(error);

                }

    I also tried the TransactionLibary.Checkout(); but that doesn't work because the order total is higher than 0 so i need to use a payment method. 

    I hope you can help me.

     


  • Morten Skjoldager 436 posts 1492 karma points
    Jun 02, 2015 @ 13:13
    Morten Skjoldager
    0

    Hi Ferry,

    When you use the back office to do so, why is that? All the API's runs on a basket for a user, so you need to ensure that it can be resolved properly. 

    You can use the order editor in the backend to process orders from scratch. Everything should be enabled to do so. So why do you need a custom form in the backend? 

    Best regards

    Morten

  • Ferry zijlmans 8 posts 59 karma points
    Jun 11, 2015 @ 10:26
    Ferry zijlmans
    0

    Hi morten,

    The Form in the backend will be used by the customers(this will be used locally with the help of a collaborator). for example when a customer pays direct with cash etc.. so they can enter their information and submit that without a online pay method.

    Anyway thanks for your help.

    Best regards, Ferry

  • Søren Spelling Lund 1793 posts 2744 karma points
    Jun 02, 2015 @ 13:20
    Søren Spelling Lund
    0

    Hi Ferry,

    You can fix this in a couple of different ways. If what you need in the pipeline is indeed the billing address, you can just use that as it seems you're always setting that up anyway.

    The PurchaseOrder.OrderAddresses collection just holds a number of addresses, it doesn't have to hold any though, so it's basically up to you how you want to use it.

    The PurchaseOrder.BillingAddress has to be set.

    Hope this helps.

  • Ferry zijlmans 8 posts 59 karma points
    Jun 11, 2015 @ 10:20
    Ferry zijlmans
    0

    Hi Søren,

    I know that, and I actually fill the billing adress. It does work without any problems when I use another payment provider(custom made). this is the code what I use to fill the Billingadres:

            TransactionLibrary.EditBillingInformation(
                firstname,
                String.IsNullOrWhiteSpace(Secondname) ? Lastname : String.Format("{0} {1}", Secondname, Lastname),
                Email,
                Telefoon,
                Mobiel,
                "",
                Street,
                String.Format("{0}{1}", Housenumber, HousenumberPrefix),
                Zipcode,
                City,
                "",
                "",
                int.Parse(country)
            );
    
            //Add Data
            PurchaseOrder orderData = basket.PurchaseOrder;
            //Add dynamic order property to the order
            orderData["Dateofbirth:"] = Dateofbirth;
            orderData["Newsletter:"] = request.Form["Newsletter"] == "" ? "Yes" : "No";
            orderData["Gender:"] = gender;
            orderData["entry way:"] = backend ? "Backoffice" : "Website";
    
            orderData.Save();
    

    So this works fine when I use another Payment provider. it only crashes when I use the Default payment Method Service.

    Best regards,

    Ferry

Please Sign in or register to post replies

Write your reply to:

Draft