Class: Yukon::PaymentProcessor

Inherits:
Object
  • Object
show all
Defined in:
lib/yukon/payment_processor.rb

Instance Method Summary collapse

Constructor Details

#initialize(seller_email) ⇒ PaymentProcessor

Returns a new instance of PaymentProcessor.



4
5
6
# File 'lib/yukon/payment_processor.rb', line 4

def initialize(seller_email)
  @gateway = PaymentGateway.create(seller_email)      
end

Instance Method Details

#do_express_checkout_payment(price, options) ⇒ Object

Part of Web Request 2

Step 3 : DoExpressCheckoutPayment



42
43
44
# File 'lib/yukon/payment_processor.rb', line 42

def do_express_checkout_payment(price, options)
  @gateway.purchase(price, options)
end

#get_express_checkout_details(token) ⇒ Object

Part of Web Request 2

Step 2 : GetExpressCheckoutDetails : args - token



34
35
36
# File 'lib/yukon/payment_processor.rb', line 34

def get_express_checkout_details(token)
  @gateway.details_for(token)
end

#redirect_url_for(response) ⇒ Object

Part of Web Request 1

End of Step 1 : Redirect to Paypal URL : args - response



26
27
28
# File 'lib/yukon/payment_processor.rb', line 26

def redirect_url_for(response)
  @gateway.redirect_url_for(response.token)    
end

#set_express_checkout(price, ip, return_url, cancel_return_url, custom) ⇒ Object

Part of Web Request 1

Step 1 : SetExpressCheckout price (in cents), buyer_ip, return_url, cancel_return_url, seller_email, notify_url (optional), custom



12
13
14
15
16
17
18
19
20
# File 'lib/yukon/payment_processor.rb', line 12

def set_express_checkout(price, ip, return_url, cancel_return_url, custom)
  response = @gateway.setup_purchase(price,
                                     ip:                   ip,
                                     return_url:           return_url,
                                     cancel_return_url:    cancel_return_url,
                                     allow_guest_checkout: true,
                                     custom:               custom)        
  response
end