Class: FlexCommerce::PaypalExpress::Process::ResponseParser

Inherits:
Object
  • Object
show all
Defined in:
lib/paypal_express/process/response_parser.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response:, shipping_method_model:) ⇒ ResponseParser

Returns a new instance of ResponseParser.



8
9
10
11
# File 'lib/paypal_express/process/response_parser.rb', line 8

def initialize(response:, shipping_method_model:)
  self.response = response
  self.shipping_method_model = shipping_method_model
end

Instance Attribute Details

#responseObject

Returns the value of attribute response.



26
27
28
# File 'lib/paypal_express/process/response_parser.rb', line 26

def response
  @response
end

#shipping_method_modelObject

Returns the value of attribute shipping_method_model.



26
27
28
# File 'lib/paypal_express/process/response_parser.rb', line 26

def shipping_method_model
  @shipping_method_model
end

Instance Method Details

#callObject

@TODO: Need to validate the paypal response, to ensure it is

returning all the attribute values as expected

Related ticket: github.com/shiftcommerce/flex-ruby-gem/issues/152



17
18
19
20
21
22
23
24
# File 'lib/paypal_express/process/response_parser.rb', line 17

def call
  {
    shipping_method_id: get_shipping_method_details,
    email: get_email_address,
    shipping_address_attributes: get_shipping_address_attributes,
    billing_address_attributes: get_billing_address_attributes
  }
end