class GiactVerification::Authenticate

Attributes

check[R]
customer[R]

Public Class Methods

call(args) click to toggle source
# File lib/giact_verification/authenticate.rb, line 4
def self.call(args)
  new(args).call
end
new(args) click to toggle source
# File lib/giact_verification/authenticate.rb, line 8
def initialize(args)
  GiactVerification.ready_for_request?

  @customer = GiactVerification::Customer.new(attributes: args.fetch(:customer, {}))
  @check    = GiactVerification::Check.new(attributes: args.fetch(:check, {}))
end

Public Instance Methods

call() click to toggle source
# File lib/giact_verification/authenticate.rb, line 15
def call
  if customer.invalid? || check.invalid?
    raise GiactVerification::ArgumentError, param_errors
  end

  RequestCoordinator.call(body: request_body)
end

Private Instance Methods

param_errors() click to toggle source
# File lib/giact_verification/authenticate.rb, line 38
def param_errors
  (customer.errors.merge(check.errors)).map do |k,v|
    "#{k}: #{v}\n"
  end.join('')
end
request_body() click to toggle source
# File lib/giact_verification/authenticate.rb, line 26
def request_body
  @request_body ||= GiactVerification::InquiryTemplateRenderer.call(substitutions: substitutions)
end
substitutions() click to toggle source
# File lib/giact_verification/authenticate.rb, line 30
def substitutions
  {
    g_authenticate_enabled: true,
    check: check.decorate_for_xml,
    customer: customer.decorate_for_xml,
  }
end