class Yukon::PaymentProcessor

Public Class Methods

new(seller_email) click to toggle source
# File lib/yukon/payment_processor.rb, line 4
def initialize(seller_email)
  @gateway = PaymentGateway.create(seller_email)      
end

Public Instance Methods

do_express_checkout_payment(price, ip, token, payer_id) click to toggle source

Part of Web Request 2

Step 3 : DoExpressCheckoutPayment

Arguments

price : Amount to be charged in cents ip, token and payer_id Returns PaypalExpressResponse object

# File lib/yukon/payment_processor.rb, line 66
def do_express_checkout_payment(price, ip, token, payer_id)      
  @gateway.purchase(price,          
                    ip:       ip, 
                    token:    token,
                    payer_id: payer_id)
end
get_express_checkout_details(token) click to toggle source

Part of Web Request 2

Step 2 : GetExpressCheckoutDetails

Argument - token in string format

Returns : details

# File lib/yukon/payment_processor.rb, line 52
def get_express_checkout_details(token)
  @gateway.details_for(token)
end
redirect_url_for(response) click to toggle source

Part of Web Request 1

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

Argument : PaypalExpressResponse

Returns URL : www.sandbox.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=EC-5TC81926SR152035B

# File lib/yukon/payment_processor.rb, line 40
def redirect_url_for(response)
  @gateway.redirect_url_for(response.token)    
end
set_express_checkout(price, ip, return_url, cancel_return_url, custom) click to toggle source

Part of Web Request 1

Step 1 : SetExpressCheckout

price : Amount to be charged in cents ip : Buyer IP address return_url : URL to return after completing the purchase cancel_return_url : URL to return if purchase is cancelled notify_url : IPN notification URL (optional) custom : custom variable

Returns : PaypalExpressResponse object

# File lib/yukon/payment_processor.rb, line 22
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