Sha256: e2851b931d02250ba0f138808a581106d2af71a7ca50f4e220bb9336dbce4a40

Contents?: true

Size: 1.07 KB

Versions: 5

Compression:

Stored size: 1.07 KB

Contents

# typed: true
# frozen_string_literal: true

require_relative '../lib/mercadopago'

require 'minitest/autorun'

class CardToken < Minitest::Test
  def test_method_get_id
    sdk = Mercadopago::SDK.new('APP_USR-558881221729581-091712-44fdc612e60e3e638775d8b4003edd51-471763966')
    card_token_object = {
      card_number: '5031433215406351',
      expiration_year: 2025,
      expiration_month: 11,
      security_code: '123',
      cardholder: {
        name: 'APRO'
      }
    }
    result_card_token = sdk.card_token.create(card_token_object)
    result = sdk.card_token.get(result_card_token[:response]['id'])
    assert_equal 200, result[:status]
  end

  def test_method_post
    sdk = Mercadopago::SDK.new('APP_USR-558881221729581-091712-44fdc612e60e3e638775d8b4003edd51-471763966')
    card_token_object = {
      card_number: '5031433215406351',
      expiration_year: 2025,
      expiration_month: 11,
      security_code: '123',
      cardholder: {
        name: 'APRO'
      }
    }
    result = sdk.card_token.create(card_token_object)
    assert_equal 201, result[:status]
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
mercadopago-sdk-2.2.1 tests/test_card_token.rb
mercadopago-sdk-2.2.0 tests/test_card_token.rb
mercadopago-sdk-2.1.0 tests/test_card_token.rb
mercadopago-sdk-2.0.3 tests/test_card_token.rb
mercadopago-sdk-2.0.2 tests/test_card_token.rb