clearsaleID 1.2.0 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/clearsale/analysis.rb +3 -3
- data/lib/clearsale/object.rb +1 -1
- data/lib/clearsale/order.rb +10 -7
- data/lib/clearsale/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: 6ac3d35a33da3d5d071c0af973f5a6648a7a471b2e5ee14158e02e535c0364e9
|
4
|
+
data.tar.gz: b17585c2967174e8733a7498304a1c15df5bceb80350e3815ff680b9f20a4c47
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9beb839770a5ad6e290c5f7676b4dd2be80a4c7526919b01b33b4709141b0c897ffd7af013a775e88eecdda8bdd0d721c32ec72250ba14f78f0d2be13dde6257
|
7
|
+
data.tar.gz: 0cb41901de81ae17c983f289d6c25dc64994da93ed0762475c2123641eacc6abc4a87513895769bcf9cbf6e04129766e2d17cdeac2cec421ad11ddbdf804bcde
|
data/lib/clearsale/analysis.rb
CHANGED
@@ -5,9 +5,9 @@
|
|
5
5
|
end
|
6
6
|
|
7
7
|
def self.send_order(order_hash, payment_hash, user_hash)
|
8
|
-
order =
|
9
|
-
payment =
|
10
|
-
user =
|
8
|
+
order = Object.new(order_hash)
|
9
|
+
payment = Object.new(payment_hash)
|
10
|
+
user = Object.new(user_hash)
|
11
11
|
|
12
12
|
order_xml = Clearsale::Order.to_xml(order, payment, user)
|
13
13
|
request = {"xml" => order_xml}
|
data/lib/clearsale/object.rb
CHANGED
data/lib/clearsale/order.rb
CHANGED
@@ -28,10 +28,10 @@ module Clearsale
|
|
28
28
|
builder.tag!('QtdItens', order.items_count)
|
29
29
|
builder.tag!('IP', user.last_sign_in_ip)
|
30
30
|
builder.tag!('DadosCobranca') do |b|
|
31
|
-
build_user_data(b, user, order.billing_address)
|
31
|
+
build_user_data(b, user, Object.new(order.billing_address))
|
32
32
|
end
|
33
33
|
builder.tag!('DadosEntrega') do |b|
|
34
|
-
build_user_data(b, user, order.shipping_address)
|
34
|
+
build_user_data(b, user, Object.new(order.shipping_address))
|
35
35
|
end
|
36
36
|
|
37
37
|
builder.tag!('Pagamentos') do |b|
|
@@ -40,7 +40,7 @@ module Clearsale
|
|
40
40
|
|
41
41
|
builder.tag!('Itens') do |b|
|
42
42
|
order.order_items.each do |order_item|
|
43
|
-
build_item(b, order_item)
|
43
|
+
build_item(b, Object.new(order_item))
|
44
44
|
end
|
45
45
|
end
|
46
46
|
end
|
@@ -123,12 +123,15 @@ module Clearsale
|
|
123
123
|
|
124
124
|
def self.build_item(builder, order_item)
|
125
125
|
builder.tag!('Item') do |b|
|
126
|
-
|
127
|
-
|
126
|
+
product = Object.new(order_item.product)
|
127
|
+
category = Object.new(product.category)
|
128
|
+
|
129
|
+
b.tag!('CodigoItem', product.product_id)
|
130
|
+
b.tag!('NomeItem', product.name)
|
128
131
|
b.tag!('ValorItem', order_item.price)
|
129
132
|
b.tag!('Quantidade', order_item.quantity)
|
130
|
-
b.tag!('CodigoCategoria',
|
131
|
-
b.tag!('NomeCategoria',
|
133
|
+
b.tag!('CodigoCategoria', category.category_id) if category.try(:category_id).present?
|
134
|
+
b.tag!('NomeCategoria', category.name) if category.try(:name).present?
|
132
135
|
end
|
133
136
|
end
|
134
137
|
end
|
data/lib/clearsale/version.rb
CHANGED