Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

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).

The 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 PaypalQuery_StartCheckout, PaypalQuery_GetAddressDetails,PaypalQuery_ConfirmPayment`.

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

share|improve this question

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.