Sha256: 1b1fa9a7114b0071d00aae531f9b4aae70f067a4f648dc8b979105c20fe1fb96

Contents?: true

Size: 1.25 KB

Versions: 5

Compression:

Stored size: 1.25 KB

Contents

# -*- coding: utf-8 -*-
require 'payex'
require 'spec_helper'

describe PayEx do
  before {
    PayEx.account_number = 'foo-account'
    PayEx.encryption_key = 'foo-secret'
    PayEx.return_url = 'http://example.com/payex-callback'
  }

  it 'should send request and parse response' do
    expected = {
      'accountNumber' => 'foo-account',
      'purchaseOperation' => 'AUTHORIZATION',
      'price' => 12300,
      'priceArgList' => '',
      'currency' => 'SEK',
      'vat' => 0,
      'orderID' => 'order123',
      'productNumber' => 'PRODUCT123',
      'description' => 'Product description',
      'clientIPAddress' => '12.34.56.78',
      'clientIdentifier' => '',
      'additionalValues' => '',
      'externalID' => '',
      'returnUrl' => 'http://example.com/payex-callback',
      'view' => 'CREDITCARD',
      'agreementRef' => '',
      'cancelUrl' => '',
      'clientLanguage' => ''
    }

    expected['hash'] = PayEx::API.signed_hash(expected.values.join)
    savon.expects('Initialize7').with(expected).returns(:initialize_ok)

    href = PayEx.authorize_transaction! 'order123',
      product_number: 'PRODUCT123',
      product_description: 'Product description',
      price: 12300,
      customer_ip: '12.34.56.78'

    href.should include 'http'
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
payex-0.1.2 spec/integration_spec.rb
payex-0.1.1 spec/integration_spec.rb
payex-0.1.0 spec/integration_spec.rb
payex-0.1.0.rc spec/integration_spec.rb
payex-0.0.1 spec/integration_spec.rb