class ActiveMerchant::Billing::PaymillGateway::ResponseParser
Attributes
message[R]
options[R]
parsed[R]
raw_response[R]
succeeded[R]
Public Class Methods
new(raw_response = '', options = {})
click to toggle source
# File lib/active_merchant/billing/gateways/paymill.rb, line 331 def initialize(raw_response = '', options = {}) @raw_response = raw_response @options = options end
Public Instance Methods
generate_response()
click to toggle source
# File lib/active_merchant/billing/gateways/paymill.rb, line 336 def generate_response parse_response if parsed['error'] handle_response_parse_error else handle_response_correct_parsing end Response.new(succeeded, message, parsed, options) end
Private Instance Methods
ack?()
click to toggle source
# File lib/active_merchant/billing/gateways/paymill.rb, line 363 def ack? parsed['transaction']['processing']['result'] == 'ACK' end
handle_response_correct_parsing()
click to toggle source
# File lib/active_merchant/billing/gateways/paymill.rb, line 358 def handle_response_correct_parsing @message = parsed['transaction']['processing']['return']['message'] @options[:authorization] = parsed['transaction']['identification']['uniqueId'] if @succeeded = ack? end
handle_response_parse_error()
click to toggle source
# File lib/active_merchant/billing/gateways/paymill.rb, line 353 def handle_response_parse_error @succeeded = false @message = parsed['error']['message'] end
parse_response()
click to toggle source
# File lib/active_merchant/billing/gateways/paymill.rb, line 349 def parse_response @parsed = JSON.parse(raw_response.sub(/jsonPFunction\(/, '').sub(/\)\z/, '')) end