Copied to clipboard

Flag this post as spam?

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


  • Peter Rombouts 71 posts 265 karma points
    May 24, 2013 @ 16:11
    Peter Rombouts
    0

    Cannot get PaymentCallbackWithoutOrderId to work propery

    Hi guys,

     

    I'm trying to implement a custom payment provider, using the following installation:

    Umbraco v6.0.5
    TeaCommerce 2.1.1 with StarterKit

    The problem is that I need to enable 'PaymentCallbackWithoutOrderId'.

    I've added the override in my payment provider class:

    public override bool AllowsCallbackWithoutOrderId
    {
      get
      {
        return true;
      }
    }
    

    I've found the next snippet, but as 'Base' is nowhere to be found, I cannot get it to work:

    public static void PaymentCallbackWithoutOrderId( string alias, long paymentMethodId ) {
         
    IPaymentProvider paymentProviderInstance = Base.GetPaymentProviderInstance( alias );
         
    if ( paymentProviderInstance.AllowCallbackWithoutOrderId ) {
           
    PaymentMethod paymentMethod = PaymentMethod.GetPaymentMethod( paymentMethodId );
           
    if ( paymentMethod != null ) {
             
    long? orderId = paymentProviderInstance.GetOrderId( HttpContext.Current.Request, paymentMethod.GetSettings( null ) );
     
             
    if ( orderId != null )
               
    Base.PaymentCallback( paymentProviderInstance, orderId.Value );
           
    }
         
    }
       
    }

    How can I override the methods, or how should it be implemented?
    I've found several articles, but it seems to differ per version.

    Thanks in advance,
    Peter

  • Anders Burla 2560 posts 8256 karma points
    May 27, 2013 @ 11:19
    Anders Burla
    0

    Hi Peter

    Does you provider inherit from APaymentProvider? When you have overridden the AllowsCallbackWithoutOrderId you also need to implement the GetCartNumber method. This is the method that gives the cart number of the order, now that the payment provider doesnt know about the order id.

    Kind regards
    Anders

  • Peter Rombouts 71 posts 265 karma points
    May 27, 2013 @ 12:32
    Peter Rombouts
    0

    Hi Anders,

    I've implemented the GetCartNumber method, but none of my added logging appears in my UmbracoTraceLog nor in my Log.
    Should I enable some restExtension config? Or is there any other way to enable tracing/logging in these methods?

    We've inherited from the APaymentProvider as provided by the documentation.
    Basically everything works, except the callback.

    Kind regards,
    Peter Rombouts

     

    (edit. inherited obviously, not overriden)

  • Peter Rombouts 71 posts 265 karma points
    May 27, 2013 @ 13:13
    Peter Rombouts
    0

    Update

    Hi Anders,

    I think I found the problems in logging; and have some more info available.
    I forked the code and will post here when I've resolved all issues.

    Kind regards,
    Peter Rombouts

  • Anders Burla 2560 posts 8256 karma points
    May 27, 2013 @ 13:59
    Anders Burla
    0

    Sounds great. The API works for some of the other providers that we have made - so it should work :)

    Keep us posted.

  • Peter Rombouts 71 posts 265 karma points
    May 27, 2013 @ 16:08
    Peter Rombouts
    0

    Hi Anders,

    Added pullrequest:
    https://bitbucket.org/teasolutions/tea-commerce-tea-commerce-payment-providers/pull-request/2/added-payment-provider-mollie/diff

    I've started on the next 'DocData' payments provider, so please contact me if there are any issues with my code.

    Regards,
    Peter Rombouts

  • Anders Burla 2560 posts 8256 karma points
    May 27, 2013 @ 21:57
    Anders Burla
    0

    Just added some comments - but really glad that you have added the provider - the Umbraco community is so amazing!

  • Peter Rombouts 71 posts 265 karma points
    May 31, 2013 @ 10:47
    Peter Rombouts
    0

    Hi Anders,

    DocData payments has been implemented, but I have a problem; The DocData service calls the 'ProcessCallback' several times.
    The problem is that TeaCommerce only updates on the very first callback.
    Is there a solution to this? For creditcard payments it is often necessary to facilitate several callbacks.

    Thanks in advance for your reply,

    Kind regards,
    Peter Rombouts

    Please see my pull for details: https://bitbucket.org/prombouts/tea-commerce-tea-commerce-payment-providers

     

  • Anders Burla 2560 posts 8256 karma points
    May 31, 2013 @ 11:30
    Anders Burla
    0

    Hi Peter

    Why does DocData call the callback url several times?

    It is correct can Tea Commerce only use the callback ones because that is the way its designed - because all payment providers I have worked with only did one callback :)

    Kind regards
    Anders

  • Peter Rombouts 71 posts 265 karma points
    May 31, 2013 @ 11:34
    Peter Rombouts
    0

    Hi Anders,

    The reason is that for creditcard payments, sometimes the capture of payments is done at a later moment.
    DocData calls the callback on each and every update of the status.

    For example, Booking.com: If you book a holiday, the status is 'Authorized'.
    Not until one day prior to arrival, the callback will actually 'Capture' this payment.
    There are more providers who do it like this, e.g. recurring payments (like some yearly subscription).

    Do you have a workaround? Or should I build my own callback service for these payment?

    FYI: DocData was formerly known as TripleDeal, and this multi-callback principle was always in their system.
    I don't think they will change this for us...

    Kind regards,
    Peter Rombouts

  • Peter Rombouts 71 posts 265 karma points
    May 31, 2013 @ 15:15
    Peter Rombouts
    0

    For those of you forced to work with DocData, my fork contains the complete code and BaseRestExtensions to facilitate the multi-callback authorizations:

    https://bitbucket.org/prombouts/tea-commerce-tea-commerce-payment-providers

  • Anders Burla 2560 posts 8256 karma points
    Jun 05, 2013 @ 19:27
    Anders Burla
    0

    Cool Peter! I will look at the fork and see it can be integrated into Tea Commerce. One thing that hits me is that you implemented your own REST part that takes the callback. This will need to be build into Tea Commerce if its fits - so I will have a look at what to do with gateways that does multiple callbacks.

    Kind regards
    Anders

  • Peter Rombouts 71 posts 265 karma points
    Jun 06, 2013 @ 08:07
    Peter Rombouts
    0

    Hi Anders,

    Some kind of construction with an override like

    AllowsMultipleCallbacks

    Would be great; If you can explicitly set that multi-callbacks are possible, you can write your ProcessCallback in the same way as any other.

    If I can be of any assistance, please let me know:

    Kind regards,
    Peter Rombouts
    skype:prombouts

  • Anders Burla 2560 posts 8256 karma points
    Jun 20, 2013 @ 15:40
    Anders Burla
    0

    As I wrote on BitBucket - Tea Commerce 2 supports multiple callbacks - but only one of the calls can finalize the order.

    Kind regards
    Anders

Please Sign in or register to post replies

Write your reply to:

Draft