class FlexCommerce::PaypalExpress::AdditionalInfo

@class AdditionalInfo Address verification service using paypal

Attributes

gateway_class[RW]
gateway_details[RW]
shipping_method_model[RW]
token[RW]

Public Class Methods

new(gateway_class: ::ActiveMerchant::Billing::PaypalExpressGateway, shipping_method_model: FlexCommerce::ShippingMethod, options:) click to toggle source
# File lib/paypal_express/additional_info.rb, line 11
def initialize(gateway_class: ::ActiveMerchant::Billing::PaypalExpressGateway, shipping_method_model: FlexCommerce::ShippingMethod, options:)
  self.gateway_class = gateway_class
  self.token = options[:token]
  self.shipping_method_model = shipping_method_model
  self.gateway_details = {}
end

Public Instance Methods

call() click to toggle source

@method call

Fetches Shipping Method, Billing and Shipping address details from Paypal

@return [PaymentAdditionalInfo]

# File lib/paypal_express/additional_info.rb, line 24
def call
  PaymentAdditionalInfo.new(meta: gateway_details_for(token))  
end

Private Instance Methods

gateway_details_for(token) click to toggle source

@method gateway_details_for

@param {ID} token - Paypal token

# File lib/paypal_express/additional_info.rb, line 36
def gateway_details_for(token)
  response = gateway_details[token] ||= gateway.details_for(token)
  raise ::FlexCommerce::PaypalExpress::Exception::AccessDenied.new(response.message) unless response.success?
  Process::ResponseParser.new(response: response, shipping_method_model: shipping_method_model).call
end