in

dashCommerce

An ASP.NET Open Source e-Commerce Application

Programatically Choosing a Payment Provider OTHER than the default provider?

Last post 07-31-2008 2:54 AM by nabeel. 14 replies.
Page 1 of 1 (15 items)
Sort Posts: Previous Next
  • 06-01-2008 8:11 PM

    • aczarto
    • Top 25 Contributor
    • Joined on 03-27-2008
    • Ottawa, ON
    • Posts 28

    Programatically Choosing a Payment Provider OTHER than the default provider?

    Is there a way to programatically choose a Payment Provider that is NOT the default provider?

     eg: I want to give the user the option between several payment methods: Credit Card, PayPal, Cheque, PrePaid Code, etc...  A depending on his selection, I would load a different provider.

    Does this exist, or does it need to be built?

    Alex

  • 06-01-2008 8:57 PM In reply to

    • aczarto
    • Top 25 Contributor
    • Joined on 03-27-2008
    • Ottawa, ON
    • Posts 28

    Re: Programatically Choosing a Payment Provider OTHER than the default provider?

    Well, from taking a look at the code, I decided that this feature needs to be built.  So here is how I am proceeding:

    1. Created an additional constructor for PaymentService that takes in an IPaymentProvider :

    public PaymentService(IPaymentProvider customPaymentProvider)
    {
        _paymentProviderCollection =
    new PaymentProviderCollection();
        _paymentProviderCollection.Add(customPaymentProvider);
    }

    2. Created an overload of the OrderController.Charge Method that takes a IPaymentProvider as a parameter.  It just passes the IPaymentProvider when creating a the PaymentService.

    public static Transaction Charge(Order order, IPaymentProvider customPaymentProvider, string userName)
    {
       
    [... code ...]
       
    PaymentService paymentService = new PaymentService(customPaymentProvider);
       
    [... code ...]
    }

    3. Modify the CheckOut.aspx.cs btnProcessOrder_Click to call the new overloaded OrderController.Charge method:

    transaction = OrderController.Charge(order, new FreePaymentProvider(), GetUserName());

     

    Well, off to go and test it out to see if it works...

    Alex

  • 06-01-2008 9:06 PM In reply to

    • aczarto
    • Top 25 Contributor
    • Joined on 03-27-2008
    • Ottawa, ON
    • Posts 28

    Re: Programatically Choosing a Payment Provider OTHER than the default provider?

    Worked... Sweet!

    I'll refactor the code a bit and will then post it along with my NullPaymentProvider tomorrow or the day after...

  • 06-01-2008 9:17 PM In reply to

    Re: Programatically Choosing a Payment Provider OTHER than the default provider?

    This is an outstanding feature and one that was on my list of "Things to Do" - fantastic work - this is a real value add to the project. If you get the patch up, I'll integrate it quickly.

    Big Smile

    --
    Support dashCommerce - Buy Our Stuff!!


    Find a bug? Create a Work Item for a fast response.. Want to help? Create a patch for us! Documentation? Help us write some!
    Filed under: , ,
  • 06-01-2008 9:46 PM In reply to

    • aczarto
    • Top 25 Contributor
    • Joined on 03-27-2008
    • Ottawa, ON
    • Posts 28

    Re: Programatically Choosing a Payment Provider OTHER than the default provider?

    FYI it's not integrated into the Admin part of the site, nor is the Checkout page setup to Dynamically let users choose their payment provider.  It's purely (for now anyway) an extra option for developers who are coding their own checkout pages, etc...

  • 06-02-2008 4:35 AM In reply to

    • Axe
    • Not Ranked
    • Joined on 05-02-2008
    • Sydney, Australia
    • Posts 1

    Re: Programatically Choosing a Payment Provider OTHER than the default provider?

    What timing!
    I just came here about to search for such functionality.
    This feature is a must.

    Thanks for thinking of this.Big Smile

  • 06-10-2008 4:07 PM In reply to

    • aczarto
    • Top 25 Contributor
    • Joined on 03-27-2008
    • Ottawa, ON
    • Posts 28

    Re: Programatically Choosing a Payment Provider OTHER than the default provider?

    Just uploaded the patch (well, the whole .cs file anyway) for a ZeroPaymentProvider.

    The patch for programatically choosing a payment provider is on it's way....

  • 06-10-2008 4:18 PM In reply to

    • aczarto
    • Top 25 Contributor
    • Joined on 03-27-2008
    • Ottawa, ON
    • Posts 28

    Re: Programatically Choosing a Payment Provider OTHER than the default provider?

    Just uploaded the patch.

    FYI, made changes to the following files:

    /Store/Services/PaymentService.cs
    /Store/Controllers/OrderController.cs
    /Store/Controllers/OrderNoteController.cs

    Also added /Store/Controller/SkuController.cs

    Compiled it and put through a test transaction using my ZeroPaymentProvider, and things seem to be good.  Let me know if there is something wrong...

    Alex

  • 06-10-2008 4:23 PM In reply to

    Re: Programatically Choosing a Payment Provider OTHER than the default provider?

    Ok, I'll take a look at it over the next day or two and see if we can push this in the 3.0.1 release that we are pushing later this week. Good stuff!

    Thanks for contributing!! - this is a good one :)

    --
    Support dashCommerce - Buy Our Stuff!!


    Find a bug? Create a Work Item for a fast response.. Want to help? Create a patch for us! Documentation? Help us write some!
  • 06-24-2008 6:58 PM In reply to

    Re: Programatically Choosing a Payment Provider OTHER than the default provider?

    hi all.

    i need this freature to..

    can you help me?

  • 06-25-2008 8:33 AM In reply to

    • aczarto
    • Top 25 Contributor
    • Joined on 03-27-2008
    • Ottawa, ON
    • Posts 28

    Re: Programatically Choosing a Payment Provider OTHER than the default provider?

    Take a look at patches 1368 and 1367 at http://www.codeplex.com/dashCommerce/SourceControl/PatchList.aspx

    Please note that:

    1. This is not integrated into the Admin section of the site.  You need to set the payment provider in code.
    2. This has not been integrated into the DashCommerce code base, so keep in mind that future updates to DashCommerce *may* break the code.

    Alex

     

  • 07-13-2008 3:58 PM In reply to

    Re: Programatically Choosing a Payment Provider OTHER than the default provider?

    HI Alex,

     I just download the patch but its not working. Do you know where can I download the code with this payment provider thing working?

    I appreciate so much your help.

    Thanks,

     Alex

  • 07-13-2008 9:56 PM In reply to

    • aczarto
    • Top 25 Contributor
    • Joined on 03-27-2008
    • Ottawa, ON
    • Posts 28

    Re: Programatically Choosing a Payment Provider OTHER than the default provider?

    Unfortunately, I've gotten pulled off working on dashCommerce (temporarily hopefully) so I'm not sure how the patch integrates with the latest build (from the e-mail's I've been getting, apparently it doesn't).  I will hopefully get the chance to revisit this in a couple of weeks and re-submit a new patch that integrates with the latest build.

    I'm scheduled to get back onto dashCommerce the week of Aug 1st, so I'll be able to give more insight then...

    Sorry I couldn't have been of more help...

    Alex

  • 07-13-2008 11:44 PM In reply to

    Re: Programatically Choosing a Payment Provider OTHER than the default provider?

    Thanks a lot Alex, I really appreciate so much your help. Just let me know when you get into dashcommerce again.

     Thanks Alex

  • 07-31-2008 2:54 AM In reply to

    Re: Programatically Choosing a Payment Provider OTHER than the default provider?

     what to do with these ".patch" files ?

Page 1 of 1 (15 items)