class Flutterwave::BIN

Attributes

client[RW]
options[RW]

Public Class Methods

new(client) click to toggle source
# File lib/flutterwave/bin.rb, line 6
def initialize(client)
  @client = client
end

Public Instance Methods

check(options = {}) click to toggle source

www.flutterwave.com/documentation/compliance/ - Verify Card BIN API

# File lib/flutterwave/bin.rb, line 11
def check(options = {})
  @options = options

  request_params = {
    card6: encrypt(:card6)
  }

  response = post(
    Flutterwave::Utils::Constants::BIN[:check_url],
    request_params
  )

  Flutterwave::Response.new(response)
end
encrypt(key) click to toggle source
# File lib/flutterwave/bin.rb, line 26
def encrypt(key)
  plain_text = options[key].to_s
  raise Flutterwave::Utils::MissingKeyError.new(
    "#{key.capitalize} key required!"
  ) if plain_text.empty?

  encrypt_data(plain_text, client.api_key)
end