Sha256: fe81c151f7c34dbd8c8084e7a1a93aad7bfdd89149e86bbae4657c28b1a500e1

Contents?: true

Size: 1.08 KB

Versions: 3

Compression:

Stored size: 1.08 KB

Contents

module CrowdPay
  class Verification
    include ActiveModel::AttributeMethods
    include ActiveModel::Validations
    include CrowdPay

    attr_accessor :id, :firstName, :lastName, :address, :city, :state, :zip,
      :taxpayerId, :birthMonth, :birthDay, :birthYear, :created_by_ip_address,
      :message, :key, :questions, :response_body, :request_data, :summary,
      :qualifiers

    def self.verify(data, bypass_validation)
      url = "identification/api/v1/ops/verify-identity"
      response = post(url, data, bypass_validation)
      obj = parse(response)
      obj.response_body = response.body
      obj.request_data = data.to_s
      obj
    end

    def self.verify_answers(data)
      url = "identification/api/v1/ops/verify-answers"
      response = post(url, data)
      obj = parse(response)
      obj.response_body = response.body
      obj.request_data = data.to_s
      obj
    end

    def pass?
      self.message.downcase == 'pass' || self.summary.try(:downcase) == 'pass'
    end

    def fail?
      !pass?
    end

    def soft_fail?
      !self.questions.nil?
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
crowd_pay-0.0.3 lib/crowd_pay/verification.rb
crowd_pay-0.0.2 lib/crowd_pay/verification.rb
crowd_pay-0.0.1 lib/crowd_pay/verification.rb