Skip to content

Commit

Permalink
Updates from PR review
Browse files Browse the repository at this point in the history
  • Loading branch information
karmakaze committed Nov 13, 2019
1 parent 7130871 commit 7f5e63c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
6 changes: 5 additions & 1 deletion lib/shopify_api/resources/fulfillment_order.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,11 @@ def fulfillment_request(fulfillment_order_line_items:, message:)
message: message
}
}
load_keyed_attributes_from_response(post(:fulfillment_request, body, only_id))
keyed_fos = load_keyed_attributes_from_response(post(:fulfillment_request, body, only_id))
if keyed_fos&.fetch('original_fulfillment_order', nil)&.attributes
load(keyed_fos['original_fulfillment_order'].attributes, false, true)
end
keyed_fos
end

def accept_fulfillment_request(params)
Expand Down
6 changes: 4 additions & 2 deletions test/fulfillment_order_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ def setup
unsubmitted_fulfillment_order = original_fulfillment_order.clone
unsubmitted_fulfillment_order['id'] = 3
unsubmitted_fulfillment_order['request_status'] = 'unsubmitted'
original_fulfillment_order['status'] = 'closed'
original_fulfillment_order['status'] = 'in_progress'
body = {
original_fulfillment_order: original_fulfillment_order,
submitted_fulfillment_order: submitted_fulfillment_order,
Expand All @@ -161,9 +161,11 @@ def setup
}
original_submitted_unsubmitted_fos = fulfillment_order.fulfillment_request(params)

assert_equal 'in_progress', fulfillment_order.status

original_fo = original_submitted_unsubmitted_fos['original_fulfillment_order']
assert_equal 519788021, original_fo.id
assert_equal 'closed', original_fo.status
assert_equal 'in_progress', original_fo.status

submitted_fo = original_submitted_unsubmitted_fos['submitted_fulfillment_order']
assert_equal 2, submitted_fo.id
Expand Down

0 comments on commit 7f5e63c

Please sign in to comment.