Sha256: 41887f74bd57e728d47c41729a376a85962630c364a8e354ab9d2c5087c2321b

Contents?: true

Size: 1.7 KB

Versions: 14

Compression:

Stored size: 1.7 KB

Contents

describe MangoPay::PreAuthorization do
  include_context 'users'
  include_context 'payins'

  describe 'CREATE' do
    it 'creates a new card pre-authorization' do
      cardreg = new_card_registration_completed
      created = new_card_preauthorization
      expect(created['Id']).not_to be_nil
      expect(created['Id'].to_i).to be > 0
      expect(created['CardId']).to eq(cardreg['CardId'])
      expect(created['AuthorId']).to eq(new_natural_user["Id"])
      expect(created['PayInId']).to be_nil
      expect(created['Status']).to eq('SUCCEEDED')
      expect(created['PaymentStatus']).to eq('WAITING')
      expect(created['PaymentType']).to eq('CARD')
      expect(created['ExecutionType']).to eq('DIRECT')
      expect(created['Requested3DSVersion']).to eq('V2_1')
    end
  end

  describe 'UPDATE' do
    it 'updates a card pre-authorization' do
      created = new_card_preauthorization
      updated = MangoPay::PreAuthorization.update(created['Id'] ,{
        PaymentStatus: 'CANCELED'
      })
      expect(updated['PaymentStatus']).to eq('CANCELED')
    end
  end

  describe 'FETCH' do
    it 'fetches a card pre-authorization' do
      created = new_card_preauthorization
      fetched = MangoPay::PreAuthorization.fetch(created['Id'])
      expect(fetched['Id']).to eq(created['Id'])
      expect(fetched['CardId']).to eq(created['CardId'])
      expect(fetched['AuthorId']).to eq(created['AuthorId'])
      expect(fetched['Tag']).to eq(created['Tag'])
    end
  end

  describe 'FETCH FOR CARD' do
    it "fetches a card's pre-authorizations" do
      created = new_card_preauthorization
      fetched = MangoPay::Card.get_pre_authorizations(created['CardId'])

      expect(fetched).to be_an(Array)
    end
  end

end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
mangopay-3.24.0 spec/mangopay/preauthorization_spec.rb
mangopay-3.23.0 spec/mangopay/preauthorization_spec.rb
mangopay-3.22.0 spec/mangopay/preauthorization_spec.rb
mangopay-3.21.0 spec/mangopay/preauthorization_spec.rb
mangopay-3.20.0 spec/mangopay/preauthorization_spec.rb
mangopay-3.19.0 spec/mangopay/preauthorization_spec.rb
mangopay-3.18.0 spec/mangopay/preauthorization_spec.rb
mangopay-3.17.0 spec/mangopay/preauthorization_spec.rb
mangopay-3.16.0 spec/mangopay/preauthorization_spec.rb
mangopay-3.15.0 spec/mangopay/preauthorization_spec.rb
mangopay-3.14.0 spec/mangopay/preauthorization_spec.rb
mangopay-3.13.2 spec/mangopay/preauthorization_spec.rb
mangopay-3.12.0 spec/mangopay/preauthorization_spec.rb
mangopay-3.11.1 spec/mangopay/preauthorization_spec.rb