I have a
PaypalCheckout object that handles the checkout process: from initiating API calls, to providing an interface for front-end code (e.g. View/Controller).
PaypalCheckout object handles: gathering price details from a basket, to redirecting to paypal for payment, to getting the customer's address details from Paypal, sending payment confirmation to paypal and finally determining the status of the payment.
It does so by instantiating children of an abstract
PaypalQuery class such as
My question is about how to organise methods in
PaypalQuery_ConfirmPayment and 'PaypalCheckout':
At present, my
PaypalQuery_ConfirmPayment objects have methods such as:
public function isPaymentSuccessful();
public function isPaymentPending()
public function hasItemNotReceivedProtection()
public function getPendingReason()
And I was hoping to hide all
PaypalQuery object methods from front-end code. The problem is, that would involve making methods in
PaypalCheckout which blindly call and return methods in the
PaypalQuery class(es). While not exactly much of a hassle, it 'smells'. Although what the smells are, let alone the best solutions, elude me.
I am hoping to keep this simple - while I may add other payment options besides Paypal in the future, I am comfortable refactoring at that later date. Also, in case it makes a difference, I don't think I am using any traditional framework patterns such as MVC - (although I have taken ideas from them). I am doing this in PHP.
What solutions could I use? Thanks