Wrox Programmer Forums
|
BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0
This is the forum to discuss the Wrox book ASP.NET 2.0 Website Programming: Problem - Design - Solution by Marco Bellinaso; ISBN: 9780764584640
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 30th, 2008, 07:28 PM
Authorized User
 
Join Date: Nov 2006
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default TBH integration with Google Checkout?

Anyone have code to integrate TBH with Google Checkout?

I am using the Paypal integration and wanted to add Google Checkout.
 
Old October 31st, 2008, 12:04 PM
Friend of Wrox
 
Join Date: Mar 2007
Posts: 488
Thanks: 2
Thanked 11 Times in 10 Posts
Default

hi there,

Not sure if you're referring to a methodology or the code. I'm going to go by 1st principles and state that in your methodology, you should have a payment interface that all other payment gateways use with their API's (using an adaptor pattern or similar). something like the code below would be an appropriate interface:

    public interface IPaymentMethod
    {
        #region Methods
        void ProcessPayment(ShoppingCartCollection shoppingCart, PaymentInfo paymentInfo, Customer customer, Guid OrderGuid, ProcessPaymentResult processPaymentResult);

        string PostProcessPayment(Order order);

        #endregion
    }

and then each resulting class would implement this interface (similar to below):

public class GoogleCheckoutPaymentProcessor : IPaymentMethod

As for the specifics of the google API, i'm not familiar with it, but there will be c# examples floating around.

hope this at least points to best practice, if not an definitive answer as such.


[edit] just looked at TBH payment gateway stuff. it's a little weak, so you might be better off re-writing it to conform to some kind of interface and then slot the google one in behind it. there's a great example of this in the nopSolutions cart which has a very similar structure to TBH, so will be easy to follow. give it a look at:


http://www.nopcommerce.com/

jimi

http://www.originaltalent.com
 
Old October 31st, 2008, 01:10 PM
Lee Dumond's Avatar
Wrox Author
 
Join Date: Jan 2008
Posts: 923
Thanks: 12
Thanked 166 Times in 162 Posts
Default

I'd agree with Jimi's approach, but in the code example, you might want to either make ProcessPaymentResult an "out" parameter, or create an Enum of possible results that can be returned by the method.

Also, rather than creating an interface, you might look into implementing a Provider pattern for this. Just some possible ideas.

 
Old October 31st, 2008, 04:55 PM
Friend of Wrox
 
Join Date: Mar 2007
Posts: 488
Thanks: 2
Thanked 11 Times in 10 Posts
Default

lee- i agree actually that it'd be better to follow the provider pattern for both consistancy and also the fact that using abstract classes might leverage additonal benefit that the interface implementation can't provide.

the DAL provider obviously could be an XML file and or a database table, serviced by an admin screen (and/or an RSS subscription that suppled the latest urls etc).

just another thought. but that said, the paypal solution as exists at the moment isn't scalable and does require a rework. if you do get around to it, it would be nice to see the resulting refactor.

cheers again

jimi

http://www.originaltalent.com
 
Old October 31st, 2008, 07:16 PM
Lee Dumond's Avatar
Wrox Author
 
Join Date: Jan 2008
Posts: 923
Thanks: 12
Thanked 166 Times in 162 Posts
Default

Come to think of it, this might be an excellent idea for the upcoming edition of the new book -- extend the Shopping Cart to implement an abstract provider that could allow a developer to “plug-in” various external payment gateway APIs – not just PayPal or Google, but others as well.

I'll pass it along...
 
Old November 1st, 2008, 04:27 AM
Friend of Wrox
 
Join Date: Mar 2007
Posts: 488
Thanks: 2
Thanked 11 Times in 10 Posts
Default

lee - sounds like a great idea. i'd urge you to take a look (if you haven't already) at the nopSolutions cart. the architecture is like a very close cousin to TBH and as it's purely a cart based product site, there's a lot of detail involved. i was tempted to 'craft out' the implementation but have got sidetracked with other work. you can see it here:

http://www.nopcommerce.com/

catch up with you 'proper' at some point hopefully...

jimi

http://www.originaltalent.com
 
Old November 4th, 2008, 01:05 PM
Authorized User
 
Join Date: Nov 2006
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks you - For suggesting the http://www.nopcommerce.com/

-Bob-






Similar Threads
Thread Thread Starter Forum Replies Last Post
C# Chap13, Checkout (Last Exercise) onlinecg BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 0 February 20th, 2008 05:49 AM
Error in checkout fase paolo70 BOOK: Wrox's ASP.NET 2.0 Visual Web Developer 2005 Express Edition Starter ISBN: 978-0-7645-8807-5 2 September 10th, 2007 09:03 AM
Chapter 8: checkout process mbeppe BOOK: Wrox's ASP.NET 2.0 Visual Web Developer 2005 Express Edition Starter ISBN: 978-0-7645-8807-5 4 August 10th, 2007 07:59 AM
Checkout Issue rsm42 ASP.NET 1.0 and 1.1 Basics 4 November 27th, 2006 03:50 PM
Checkout Problem rsm42 ASP.NET 1.0 and 1.1 Basics 0 November 11th, 2006 06:29 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.