order.rb 771 B

123456789101112131415161718192021222324252627282930313233343536
  1. module ShopifyAPI
  2. class Order < Base
  3. include Events
  4. include Metafields
  5. def close
  6. load_attributes_from_response(post(:close, {}, only_id))
  7. end
  8. def open
  9. load_attributes_from_response(post(:open, {}, only_id))
  10. end
  11. def cancel(options = {})
  12. load_attributes_from_response(post(:cancel, {}, options.to_json))
  13. end
  14. def transactions
  15. Transaction.find(:all, :params => { :order_id => id })
  16. end
  17. def capture(amount = "", currency: nil)
  18. capture_transaction = {
  19. amount: amount,
  20. kind: "capture",
  21. order_id: id,
  22. }
  23. capture_transaction[:currency] = currency if currency
  24. Transaction.create(capture_transaction)
  25. end
  26. class ClientDetails < Base
  27. end
  28. end
  29. end