Sha256: c08e0b0ec1025cc3e5211ab57691e155ea1d2e40b4d0346f47282ec2be11cde5

Contents?: true

Size: 1022 Bytes

Versions: 11

Compression:

Stored size: 1022 Bytes

Contents

require File.dirname(__FILE__) + '/../test_helper'

class CreatePaymentsTest < Test::Unit::TestCase
  include TestHelper

  def setup
    @gateway = XeroGateway::Gateway.new(CONSUMER_KEY, CONSUMER_SECRET)

    if STUB_XERO_CALLS
      @gateway.xero_url = "DUMMY_URL"

      @gateway.stubs(:http_put).with {|client, url, body, params| url =~ /Invoices$/ }.returns(get_file_as_string("create_invoice.xml"))
      @gateway.stubs(:http_put).with {|client, url, params| url =~ /Payments$/ }.returns(get_file_as_string("create_payments.xml"))
    end
  end

  def test_create_payment
    example_invoice = dummy_invoice.dup

    result = @gateway.create_invoice(example_invoice)

    payment = XeroGateway::Payment.new(
      :invoice_id => result.invoice.invoice_id,
      :amount     => 500,
      :reference  => "Test Payment",
      :date       => Time.now,
      :code       => "601"
    )

    result = @gateway.create_payment(payment)

    assert_kind_of XeroGateway::Response, result
    assert result.success?
  end
end

Version data entries

11 entries across 11 versions & 2 rubygems

Version Path
xero_gateway-2.7.0 test/integration/create_payments_test.rb
xero_gateway-2.6.0 test/integration/create_payments_test.rb
xero_gateway-2.5.0 test/integration/create_payments_test.rb
xero_gateway-2.4.0 test/integration/create_payments_test.rb
xero_gateway-2.3.0 test/integration/create_payments_test.rb
xero_gateway-float-2.1.7 test/integration/create_payments_test.rb
xero_gateway-float-2.1.6 test/integration/create_payments_test.rb
xero_gateway-float-2.1.4 test/integration/create_payments_test.rb
xero_gateway-float-2.1.3 test/integration/create_payments_test.rb
xero_gateway-float-2.1.1 test/integration/create_payments_test.rb
xero_gateway-2.1.0 test/integration/create_payments_test.rb