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-5.0.0 test/refund_test.rb
shopify_api-4.13.0 test/refund_test.rb
shopify_api-4.12.0 test/refund_test.rb
shopify_api-4.11.0 test/refund_test.rb
shopify_api-4.10.0 test/refund_test.rb
shopify_api-4.9.1 test/refund_test.rb
shopify_api-4.9.0 test/refund_test.rb
shopify_api-4.8.0 test/refund_test.rb
shopify_api-4.7.1 test/refund_test.rb
shopify_api-4.7.0 test/refund_test.rb
shopify_api-4.6.0 test/refund_test.rb
shopify_api-4.5.0 test/refund_test.rb
shopify_api-4.4.0 test/refund_test.rb
shopify_api-4.3.9 test/refund_test.rb
shopify_api-4.3.8 test/refund_test.rb
shopify_api-4.3.7 test/refund_test.rb
shopify_api-4.3.6 test/refund_test.rb
shopify_api-4.3.5 test/refund_test.rb
shopify_api-4.3.4 test/refund_test.rb
shopify_api-4.3.3 test/refund_test.rb