Copied to clipboard

Flag this post as spam?

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


  • Ravi Motha 290 posts 500 karma points MVP 8x c-trib
    Jul 20, 2012 @ 13:47
    Ravi Motha
    1

    Items with zero value

    We have a number of free products (and generally people will be ordering single items from our new site), and I was wondering if there was abuilt in mechanism so that when a zero value basket is processed we bypass the payment step(in our case a call to the payment provider)

     

    ravi

  • Rune Grønkjær 1372 posts 3103 karma points
    Jul 20, 2012 @ 14:59
    Rune Grønkjær
    0

    Hi Ravi,

    There is no built in function doing that.

    What you can do is change the selected payment method in the javascript before the goToPayment funktion is called.

    Be aware taht this would be a potential "security" risk as anyone could change the payment provider to the free one, thus passing the payment step. All they have to do is know Tea Commerce and guess the id of the free payment method.

    To make it more secure you could hook into Tea Commerce's .NET API and throw an error if anyone tries to goToPayment with the free payment method. That would be done in the BeforePaymentFormGenerated event.

    /Rune

  • Ravi Motha 290 posts 500 karma points MVP 8x c-trib
    Jul 20, 2012 @ 15:38
    Ravi Motha
    0

    I thought that might be the case, and I figured that we might have to do a bypass

  • Rune Grønkjær 1372 posts 3103 karma points
    Jul 23, 2012 @ 12:23
    Rune Grønkjær
    0

    Just to let you all know. We are also discussing this in a slightly different scenario here:
    http://our.umbraco.org/projects/website-utilities/tea-commerce/tea-commerce-support/33373-by-pass-payment-for-certain-users

    /Rune

  • Martin Robinson 40 posts 61 karma points
    Sep 17, 2013 @ 11:12
    Martin Robinson
    0

    Hi,

    My scenario is that my online shop needs to sell two products - one is priced and the other is free (a trial copy). They both need to go through the checkout process since licence codes are generated at the back-end and emailed to the customer. However, the payment gateway is only necessary if the total basket value is not zero. If someone just wans the trial copy (and no other products) then they should be able to complete the order without hitting the payment gateway.

    I have read this thread and also the one relating to bypassing users (http://our.umbraco.org/projects/website-utilities/tea-commerce/tea-commerce-support/33373-by-pass-payment-for-certain-users?p=0) but since the last info on this was in July 2012 then I am hoping that there is now a simple set of instructions/options to allow me to fulfil my requirements and which relates to more recent versions of TC and Umbraco.

    What is the latest please?

    Cheers,
    Martin

  • Ravi Motha 290 posts 500 karma points MVP 8x c-trib
    Sep 17, 2013 @ 12:20
    Ravi Motha
    0

    Are you using the latest version of Tea commerce, because I think the bypass may be included or eaier to do in the newer version.. but I'd suggest checking with the TeaCommerce guys.. they are always mst helpful

  • Martin Robinson 40 posts 61 karma points
    Sep 17, 2013 @ 12:33
    Martin Robinson
    0

    Hi Ravi,

    Thanks for the reply. I am using TeaCommerce 2.1.2 with Umbraco 6.0.5.

    I am hoping one of the TeaCommerce guys will respond or point me to some documentation.

    Cheers,
    Martin 

  • Rune Grønkjær 1372 posts 3103 karma points
    Sep 17, 2013 @ 12:58
    Rune Grønkjær
    0

    Hi Martin,

    Basicly what you are going to do is the same as the other forum post. You will need to change the payment method depending on the contents of the cart.

    I expect that you are using Tea Commerce 2.0 in which case you will need to use the notification center to hook into the appropriate event:
    http://documentation.teacommerce.net/net-api/notification-center/

    In your hook you will need to use the .NET API to change the current payment method.

    /Rune

  • Martin Robinson 40 posts 61 karma points
    Sep 17, 2013 @ 18:43
    Martin Robinson
    0

    Hi Rune,

    I can easily add the WebshopEvents_BeforePaymntFormGenerated event handler into my existing code (alongside where I have other event handlers).

    I believe I can also determine whether the total order price is zero (order.TotalPrice.Value == 0 ??).

    But I cannot work out what to do on that condition!

    Should I skip across the payment and go to confirmation - if so how?

    Or should I set some sort of weird payment method that skips the payment step?

    I have tried researching - but I'm not getting very far.

    Cheers,
    Martin

  • Rune Grønkjær 1372 posts 3103 karma points
    Sep 17, 2013 @ 19:35
    Rune Grønkjær
    0

    Hi Martin,

    You need to have two payment methods. One with credit card, and the other with the default Tea Commerce provider, which skips right to the confirmation page.

    In your event handler you set the payment method on your order to the one or the other, and saves the order. That's all you need to do.

    /Rune

  • Ravi Motha 290 posts 500 karma points MVP 8x c-trib
    Sep 17, 2013 @ 19:55
    Ravi Motha
    0

    We did something similar with the old version of TeaCommerce, and its pretty robust once it's i place..

  • Martin Robinson 40 posts 61 karma points
    Sep 18, 2013 @ 10:40
    Martin Robinson
    0

    Hi Rune (and thanks Ravi),

    Which is the "default Tea Commerce provider"?
    My setup has two "Payment methods": "Credit Card" and "PayPal" - and if I create a new payment method I get a choice of payment providers (in the 3rd tab) none of which seems to jump out at me as the default TeaCommerce provider. I can see the following:

    • 2CheckOut
    • AuthorizeNet
    • Axcess
    • DIBS
    • ePay
    • Invoicing
    • Netaxept
    • Ogone
    • Payer
    • PayEx
    • PayPal
    • QuickPay
    • SagePay
    • Wannafind
    • WorldPay

    Apologies for requiring more assistance - you may need to spell it out!

    Also, once I get this new payment provider created - do I need to inspect the database to determine the ID of the payment method and use that ID when changing the method?

    Cheers,
    Martin 

  • Martin Robinson 40 posts 61 karma points
    Sep 18, 2013 @ 20:52
    Martin Robinson
    0

    Nudge... Anyone?

  • Rune Grønkjær 1372 posts 3103 karma points
    Sep 19, 2013 @ 09:30
    Rune Grønkjær
    0

    That would be Invoicing. The only one not connected to at specific payment gateway

    /Rune

  • Martin Robinson 40 posts 61 karma points
    Sep 19, 2013 @ 13:43
    Martin Robinson
    0

    Hi Rune,

    OK - I have added the event and that's being hit - but here's what I have now:

    • I have added a payment method (called "No payment") based on the Invoicing payment provider (with default settings)
    • If I set "No payment" to be available to all countries then it shows up as an option alongside PayPal on the payment page and I can choose that and we go straight to confirmation. But I don't want Invoicing to show up as an option when there's a non-zero value cart.
    • If I set "No payment" to NOT be available to all countries then my ChangePaymentMethod is ignored and it just goes to PayPal (which is the default setting on the Shipping/Payment page).

    I suppose that what I need is for the shipping/payment page to be skipped (since it captures nothing of interest other than a default payment option and a default shipping option) - and for the PayPal method to be set for non-zero value carts and the "No payment" method to be set for zero value carts. If that's the correct way then how do I skip from the Information to the Accept page?

    Any other options?

    Cheers,
    Martin 

  • Martin Robinson 40 posts 61 karma points
    Sep 19, 2013 @ 18:57
    Martin Robinson
    0

    Hi Rune,

    An update on the above. I have modified the step-accept and step-information cshtml files to do a "double step" to miss out the payment/shipping page - so that avoids the customer dealing with a page that only has defaults and also avoids them being able to choose an Invoicing method when the cart is non-zero.

    However, I now notice the following. The BeforePaymentFormGenerated event is being trapped correctly on the transition from the information page to the accept page - and in that event I am changing the order payment method (using order.ChangePaymentMethod(int id) followed by order.Save()) depending on the total value of the cart. I can step through in debug and the correct payment method is chosen for each case. BUT... the change in payment method is sometimes not detected and so the transition from accept page to payment page results in the PayPal page being shown when the payment method should be Invoicing and the sequence should just jump to the confirmation page (I have set the confirmation page correctly as the setting for the invoicing payment method).

    In the above case, if I go back to the information page and back again to the accept page and then to payment the sequence then works correctly. It is as though the timing is off somehow - and I suspect I am not calling the correct method for changing the payment method.

    Any ideas?

    Cheers,
    Martin 

  • Rune Grønkjær 1372 posts 3103 karma points
    Sep 20, 2013 @ 08:23
    Rune Grønkjær
    0

    Could you post your BeforePaymentFormGenerated code?

    I will have Anders take a look at your situation, he might have a simple answer.

    /Rune

  • Anders Burla 2560 posts 8256 karma points
    Sep 20, 2013 @ 09:41
    Anders Burla
    0

    Hi Martin

    When the PaymentFormGenerating event is hit - Tea Commerce has already found out which payment method to use and extracted the settings etc. So at this step it is to late to change the payment method. You will have to do that before the payment form is generated. So that is why this wont work at the moment :)

    Kind regards
    Anders

  • Martin Robinson 40 posts 61 karma points
    Sep 20, 2013 @ 13:58
    Martin Robinson
    0

    Hi Rune and Anders,

    The code is very simple along the following lines (I am not near my workstation at the moment):

    if (order.TotalPrice.Value > 0)
    {
    order.ChangePaymentMethod(2); // PayPal
    }
    else
    {
    order.ChangePaymentMethod(4); // "No payment" (Invoicing)
    }
    order.Save();
     

    If I need to determine the payment method based on the order value without doing that on the payment form generated event, then can I do this on a simple order updated event instead?

    Cheers,
    Martin 

  • Anders Burla 2560 posts 8256 karma points
    Sep 20, 2013 @ 16:08
    Anders Burla
    0

    I cant figure out the right place to do this. It might be at the page where you change the order information or another step you want to change this. But I just know that you shouldn't do it in the PaymentFormGeneration event :)

  • Martin Robinson 40 posts 61 karma points
    Sep 20, 2013 @ 16:13
    Martin Robinson
    0

    Hi Anders,

    I will assess the remaining options and try some things out this weekend and I'll report back. Fingers crossed.

    Cheers,
    Martin 

  • Martin Robinson 40 posts 61 karma points
    Sep 24, 2013 @ 08:54
    Martin Robinson
    0

    Hi Rune and Anders,

    I am just reporting back. I was able to resolve this using the order update events - to modify the payment method depending on the total cart value at each event.

    I had to handle the issue that a change in payment method would cause another order update event to be triggered and I am not certain that I've handled that correctly but so far the site is now working.

    My odyssey so far has involved a few challenges but I now seem to have a fully functioning software licencing web shop (catering for different product and licence types, EU VAT rules and auto generating licence codes and download links) up and running (subject to final testing). I've also created support for single, multiple and domain licences - by using Umbraco item types for multiple/domain (so they are managed via Umbraco back-end) whilst using a separate entity for single licences.

    No doubt this is just in time for new releases of TeaCommerce and/or Umbraco which will break it! ;)

    Thanks for your help this far - I'll post a list to the site when I've completed full testing.

    Cheers,
    Martin 

Please Sign in or register to post replies

Write your reply to:

Draft