Created
March 23, 2012 17:41
-
-
Save dscataglini/2173104 to your computer and use it in GitHub Desktop.
PaymentProxy.rb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class PaymentProxy | |
def initialize(gateway) | |
@gateway = gateway | |
@observers = [] | |
end | |
def register_observer(o) | |
# ... | |
end | |
def create_recurring_payment(user, products, price) | |
if @gateway.recurring_payment(…).success | |
@observers.each do |observer| | |
observer.notify(:payment_succeeded, products, price) | |
end | |
else | |
self.errors.add(…) | |
@observers.each do |observer| | |
observer.notify(:payment_failed, products, price, errors) | |
end | |
end | |
end | |
def cancel_recurring_payment(opts = {}) | |
end | |
def update_recurring_payment(opts = {}) | |
end | |
def refund_recurring_payment(opts = {}) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment