magento 0.28.1 → 0.29.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/magento/cart.rb +39 -0
- data/lib/magento/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4850d2918cd100c473f235d63ae185e51daf8cd0f94e9670bd660816b8fa2fd8
|
4
|
+
data.tar.gz: fd1e48ed85a8c881f6c99a22bd8c0f503c1836e5a59ff56d603ae4cf25b08dd2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b4f7f6b02ac69f520cf5dbc28d7cccd351bb284fd6ef7da5d75c67eac31d1267a320d7aa93ae475ee8e08c46006db1d4c8dcc78a984b471df3a1325daf0044b4
|
7
|
+
data.tar.gz: 55c473b7835f4725c3bab994a84f494d61f677b7ace0a79f03c942f6e2435883f4103d71c2cf2e3c184cd70ccc0a0b35bbfb71512994c32d7c85d14316d0778a
|
data/README.md
CHANGED
data/lib/magento/cart.rb
CHANGED
@@ -31,6 +31,27 @@ module Magento
|
|
31
31
|
self.class.delete_coupon(id)
|
32
32
|
end
|
33
33
|
|
34
|
+
#
|
35
|
+
# Place order for cart
|
36
|
+
#
|
37
|
+
# Example:
|
38
|
+
#
|
39
|
+
# cart = Magento::Cart.find('12345')
|
40
|
+
#
|
41
|
+
# # or use "build" to not request information from the magento API
|
42
|
+
# cart = Magento::GuestCart.build({ 'cart_id' => '12345' })
|
43
|
+
#
|
44
|
+
# cart.order(
|
45
|
+
# email: 'customer@gmail.com',
|
46
|
+
# payment: { method: 'cashondelivery' }
|
47
|
+
# )
|
48
|
+
#
|
49
|
+
# @return String: return the order id
|
50
|
+
def order(email:, payment:)
|
51
|
+
attributes = { cartId: id, paymentMethod: payment, email: email }
|
52
|
+
self.class.order(attributes)
|
53
|
+
end
|
54
|
+
|
34
55
|
class << self
|
35
56
|
#
|
36
57
|
# Add a coupon by code to a specified cart.
|
@@ -60,6 +81,24 @@ module Magento
|
|
60
81
|
url = "#{api_resource}/#{id}/coupons"
|
61
82
|
request.delete(url).parse
|
62
83
|
end
|
84
|
+
|
85
|
+
#
|
86
|
+
# Place order for cart
|
87
|
+
#
|
88
|
+
# Example:
|
89
|
+
#
|
90
|
+
# Magento::Cart.order(
|
91
|
+
# cartId: '12345',
|
92
|
+
# paymentMethod: { method: 'cashondelivery' },
|
93
|
+
# email: email
|
94
|
+
# )
|
95
|
+
#
|
96
|
+
# @return String: return the order id
|
97
|
+
def order(attributes)
|
98
|
+
attributes.transform_keys(&:to_sym)
|
99
|
+
url = "#{api_resource}/#{attributes[:cartId]}/order"
|
100
|
+
request.put(url, attributes).parse
|
101
|
+
end
|
63
102
|
end
|
64
103
|
end
|
65
104
|
end
|
data/lib/magento/version.rb
CHANGED