Sha256: a1d767a5ff1abe2416653df20b5bbfdeab92dd096876973708c1bf67e04af22b

Contents?: true

Size: 911 Bytes

Versions: 5

Compression:

Stored size: 911 Bytes

Contents

require 'test_helper'

module Workarea
  module Klarna
    class Gateway
      class PlaceOrderRequestTest < TestCase
        setup :create_supporting_data_for_klarna, :add_tender

        def add_tender
          @klarna = create_klarna_tender(payment: @payment)
        end

        def test_details
          request = PlaceOrderRequest.new(@klarna, 14.12.to_m)

          assert_equal('post', request.method)
          assert_equal(
            "/payments/v1/authorizations/#{@klarna.authorization_token}/order",
            request.path
          )
          assert(request.summary.present?)
        end

        def test_body
          request = PlaceOrderRequest.new(@klarna, 14.12.to_m, auto_capture: true)
          assert(request.body[:auto_capture])

          request = PlaceOrderRequest.new(@klarna, 14.12.to_m)
          refute(request.body[:auto_capture])
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
workarea-klarna-1.1.0 test/lib/workarea/klarna/gateway/place_order_request_test.rb
workarea-klarna-1.1.0.beta1 test/lib/workarea/klarna/gateway/place_order_request_test.rb
workarea-klarna-1.0.0 test/lib/workarea/klarna/gateway/place_order_request_test.rb
workarea-klarna-1.0.0.beta2 test/lib/workarea/klarna/gateway/place_order_request_test.rb
workarea-klarna-1.0.0.beta1 test/lib/workarea/klarna/gateway/place_order_request_test.rb