Sha256: 5676ec165d1f5e42da9efc9177f2e4dd214740861feb45d637f8f5a9706d5fb4

Contents?: true

Size: 1.53 KB

Versions: 2

Compression:

Stored size: 1.53 KB

Contents

require "spec_helper"

describe "Payments from bank cards without authorization" do
  before :all do
    VCR.use_cassette "obtain token for payments from bank cards without authorization" do
    end
  end
  it "should fail when try to register an instance of application without connected market" do
    VCR.use_cassette "get instance id fail" do
      @api = YandexMoney::Api.new(
        client_id: nil
      )
      expect { @api.get_instance_id }.to raise_error YandexMoney::ApiError
    end
  end

  it "should register an instance of application" do
    VCR.use_cassette "get instance id success" do
      @api = YandexMoney::Api.new(
        client_id: CLIENT_ID
      )
      expect(@api.get_instance_id).to eq(INSTANCE_ID)
    end
  end

  it "should request external payment" do
    VCR.use_cassette "request external payment" do
      @api = YandexMoney::Api.new(
        client_id: CLIENT_ID,
        instance_id: INSTANCE_ID
      )
      expect(@api.request_external_payment({
        pattern_id: "p2p",
        to: "410011285611534",
        amount_due: "1.00",
        message: "test"
      }).status).to eq("success")
    end
  end

  it "should process external payment" do
    VCR.use_cassette "process external payment" do
      @api = YandexMoney::Api.new(
        instance_id: INSTANCE_ID
      )
      expect(@api.process_external_payment({
        request_id: REQUEST_ID,
        ext_auth_success_uri: "http://drakmail.ru/success",
        ext_auth_fail_uri: "http://drakmail.ru/fail"
      }).status).to eq("ext_auth_required")
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
yandex-money-sdk-0.11.0 spec/cards_spec.rb
yandex-money-sdk-0.10.0 spec/cards_spec.rb