Link to home
Start Free TrialLog in
Avatar of JRockFL
JRockFLFlag for United States of America

asked on

Plugable Payment Providers

BaitShop.BusinnessLogic has a reference to Baitshop.Payment
BaitShop.Payment has an interface called IPayable
BaitShop.Payment has a reference to BaitShop.Payment.AuthorizeNet
BaitShop.Payment has a reference to BaitShop.Payment.PayPal

I'm trying to design this somewhat plugable so I can switch out the Payment Providers.
At checkout a customer can select Credit Card or PayPal.

I'm not sure if my references are correct.

I attached a screen shot
solution.jpg
Avatar of jamesrh
jamesrh
Flag of United States of America image

The above doesn't seem to match the attachment.  

The attachment seems to imply:
BaitShop.Payment has an interface called IPayable
BaitShop.BusinnessLogic has a reference to Baitshop.Payment
BaitShop.Payment.AuthorizeNet has a reference to BaitShop.Payment
BaitShop.Payment.PayPal has a reference to BaitShop.Payment

And then AuthorizeNet and PayPal implement IPayable?

If yes, then this is a reasonable structure to have a pluggable option in BusinessLogic calling the IPayable interface against whichever class is appropriate.
Avatar of JRockFL

ASKER

The issue that I'm having is that

BaitShop.Payment.AuthorizeNet
BaitShop.Payment.PayPal
each have a reference to Baitshop.Payment and they implement IPayable.

However, BaitShop.Payment  does not have a reference and does not know about them.

In the business layer, how can I create an instance of IPayable?
AuthorizeNetProcessor implements IPayable;


//this wont work
IPayable payable = new BaitShop.Payment.AuthorizeNet.AuthorizeNetProcessor();
ASKER CERTIFIED SOLUTION
Avatar of jamesrh
jamesrh
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial