Sha256: d6c4205f9cda7715fb26c373434c90d35342d354b8550f1e1465b80ba9a919ad

Contents?: true

Size: 783 Bytes

Versions: 5

Compression:

Stored size: 783 Bytes

Contents

# -*- encoding : utf-8 -*-
module GetnetApi
  class CardVerification < Base
    require 'uri'
    require 'net/http'

    # Metodo para verificar se o token gerado é valido.
    def self.verify card

      hash =  {
              "number_token" => card.number_token.to_s,
              "cardholder_name" => card.cardholder_name.to_s,
              "expiration_month" => card.expiration_month.to_s,
              "expiration_year" => card.expiration_year.to_s,
              "security_code" => card.security_code.to_s
              }

      response = self.build_request self.endpoint, "post", hash

      return JSON.parse(response.read_body)
    end

    private

    def self.endpoint
      return "cards/verification"
    end

  end
end

# GetnetApi::CardVerification.verify card

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
getnet_api-1.0.3 lib/getnet_api/card_verification.rb
getnet_api-1.0.2 lib/getnet_api/card_verification.rb
getnet_api-1.0.1 lib/getnet_api/card_verification.rb
getnet_api-1.0.0 lib/getnet_api/card_verification.rb
getnet_api-0.1.2 lib/getnet_api/card_verification.rb