Skip to content

Instantly share code, notes, and snippets.

@dscataglini
Created March 23, 2012 17:41
Show Gist options
  • Save dscataglini/2173104 to your computer and use it in GitHub Desktop.
Save dscataglini/2173104 to your computer and use it in GitHub Desktop.
PaymentProxy.rb
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