Sha256: a4d54ea5d9beb92cc198277e210a3010875c4b279decd14e77be4eb55e79fb9d

Contents?: true

Size: 1.31 KB

Versions: 42

Compression:

Stored size: 1.31 KB

Contents

require 'test_helper'

class RefundTest < Test::Unit::TestCase

  test '#create should create a refund' do
    fake "orders/450789469/refunds", :method => :post, :status => 201, :body => load_fixture('refund')
    refund = ShopifyAPI::Refund.create(
      :order_id => 450789469,
      :restock => true,
      :note => "wrong size",
      :shipping => { :full_refund => true },
      :refund_line_items => [{ :line_item_id => 518995019, :quantity => 1 }]
    )
    assert_equal 703073504, refund.refund_line_items.first.line_item_id
  end

  test '#find should return a refund' do
    fake "orders/450789469/refunds/509562969.json?order_id=450789469", :extension => false, :method => :get, :body => load_fixture('refund')
    fake "orders/450789469/refunds/509562969", :method => :get, :body => load_fixture('refund')
    refund = ShopifyAPI::Refund.find(509562969, :params => {:order_id => 450789469})
    assert_equal 509562969, refund.id
  end

  test '#calculate a refund' do
    fake "orders/450789469/refunds/calculate", :method => :post, :body => load_fixture('refund')
    data = { :shipping => { :amount => 0 } }

    refund = ShopifyAPI::Refund.calculate(data, :params => {:order_id => 450789469})
    assert_equal 2, refund.refund_line_items.count
    assert_equal 703073504, refund.refund_line_items.first.line_item_id
  end
end

Version data entries

42 entries across 42 versions & 1 rubygems

Version Path
shopify_api-9.2.0 test/refund_test.rb
shopify_api-9.1.0 test/refund_test.rb
shopify_api-9.0.4 test/refund_test.rb
shopify_api-9.0.3 test/refund_test.rb
shopify_api-9.0.2 test/refund_test.rb
shopify_api-9.0.1 test/refund_test.rb
shopify_api-9.0.0 test/refund_test.rb
shopify_api-8.1.0 test/refund_test.rb
shopify_api-8.0.0 test/refund_test.rb
shopify_api-7.1.0 test/refund_test.rb
shopify_api-7.0.2 test/refund_test.rb
shopify_api-7.0.1 test/refund_test.rb
shopify_api-7.0.0 test/refund_test.rb
shopify_api-6.0.0 test/refund_test.rb
shopify_api-5.2.4 test/refund_test.rb
shopify_api-5.2.3 test/refund_test.rb
shopify_api-5.2.2 test/refund_test.rb
shopify_api-5.2.1 test/refund_test.rb
shopify_api-5.2.0 test/refund_test.rb
shopify_api-5.1.0 test/refund_test.rb