Sha256: ac05bc2ffd4be46055440948995a853fc3d0726b317263bcaeb3f6ac39760089

Contents?: true

Size: 1.74 KB

Versions: 6

Compression:

Stored size: 1.74 KB

Contents

require 'test_helper'

module Workarea
  class ForterPayFlowProResponseCodeIntegrationTest < Workarea::IntegrationTest
    if Workarea::Plugin.installed?(:PayflowPro)
      include ForterApiConfig
      include PayflowProGatewayVCRConfig

      def test_response_code
        VCR.use_cassette 'forter/integration/payflow_pro_response_code' do

          tender.amount = 5.to_m
          transaction = tender.build_transaction(action: 'authorize')
          operation = Payment::Authorize::CreditCard.new(tender, transaction)
          operation.complete!
          transaction.save!

          response_code = Workarea.config.forter.response_code[gateway_class].call(transaction)
          assert_equal('0', response_code)
        end
      end

      private

      def gateway_class
        gateway.class.to_s
      end

      def gateway
        Workarea.config.gateways.credit_card
      end

      def payment
        @payment ||=
          begin
            profile = create_payment_profile
            create_payment(
              profile_id: profile.id,
              address: {
                first_name: 'Ben',
                last_name: 'Crouse',
                street: '22 s. 3rd st.',
                city: 'Philadelphia',
                region: 'PA',
                postal_code: '19106',
                country: Country['US']
              }
            )
          end
      end

      def tender
        @tender ||=
          begin
            payment.set_address(first_name: 'Ben', last_name: 'Crouse')

            payment.build_credit_card(
              number: 4111111111111111,
              month: 1,
              year: Time.current.year + 1,
              cvv: 999
            )

            payment.credit_card
          end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
workarea-forter-1.3.2 test/integration/workarea/forter_payflow_pro_response_code_test.rb
workarea-forter-1.3.1 test/integration/workarea/forter_payflow_pro_response_code_test.rb
workarea-forter-1.3.0 test/integration/workarea/forter_payflow_pro_response_code_test.rb
workarea-forter-1.2.4 test/integration/workarea/forter_payflow_pro_response_code_test.rb
workarea-forter-1.2.3 test/integration/workarea/forter_payflow_pro_response_code_test.rb
workarea-forter-1.2.2 test/integration/workarea/forter_payflow_pro_response_code_test.rb