dineromail 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/dineromail/buyer.rb +8 -8
- data/lib/dineromail/item.rb +5 -5
- data/lib/dineromail/notification.rb +9 -3
- data/lib/dineromail/operation.rb +10 -10
- data/lib/dineromail/status_report.rb +8 -2
- data/lib/dineromail/version.rb +1 -1
- metadata +3 -3
data/lib/dineromail/buyer.rb
CHANGED
@@ -2,14 +2,14 @@ module Dineromail
|
|
2
2
|
class Buyer
|
3
3
|
include HappyMapper
|
4
4
|
|
5
|
-
tag '
|
6
|
-
element :email, String, :tag => '
|
7
|
-
element :address, String, :tag => '
|
8
|
-
element :name, String, :tag => '
|
9
|
-
element :phone, String, :tag => '
|
10
|
-
element :document_type, String, :tag => '
|
11
|
-
element :document_number, String, :tag => '
|
12
|
-
element :comment, String, :tag => '
|
5
|
+
tag 'comprador'
|
6
|
+
element :email, String, :tag => 'email'
|
7
|
+
element :address, String, :tag => 'direccion'
|
8
|
+
element :name, String, :tag => 'nombre'
|
9
|
+
element :phone, String, :tag => 'telefono'
|
10
|
+
element :document_type, String, :tag => 'tipodoc'
|
11
|
+
element :document_number, String, :tag => 'numerodoc'
|
12
|
+
element :comment, String, :tag => 'comentario'
|
13
13
|
|
14
14
|
end
|
15
15
|
end
|
data/lib/dineromail/item.rb
CHANGED
@@ -2,11 +2,11 @@ module Dineromail
|
|
2
2
|
class Item
|
3
3
|
include HappyMapper
|
4
4
|
|
5
|
-
tag '
|
6
|
-
element :description, String, :tag => '
|
7
|
-
element :currency, Integer, :tag => '
|
8
|
-
element :unit_price, Float, :tag => '
|
9
|
-
element :count, Integer, :tag => '
|
5
|
+
tag 'item'
|
6
|
+
element :description, String, :tag => 'descripcion'
|
7
|
+
element :currency, Integer, :tag => 'moneda'
|
8
|
+
element :unit_price, Float, :tag => 'preciounitario'
|
9
|
+
element :count, Integer, :tag => 'cantidad'
|
10
10
|
|
11
11
|
DOLLAR = 2
|
12
12
|
PESO = 1
|
@@ -3,9 +3,9 @@ module Dineromail
|
|
3
3
|
class Notification
|
4
4
|
include HappyMapper
|
5
5
|
|
6
|
-
tag '
|
7
|
-
element :transaction_id, Integer, :tag => '
|
8
|
-
element :type, String, :tag => '
|
6
|
+
tag 'operacion'
|
7
|
+
element :transaction_id, Integer, :tag => 'id'
|
8
|
+
element :type, String, :tag => 'tipo'
|
9
9
|
|
10
10
|
def initialize(options = {})
|
11
11
|
@options = options.symbolize_keys
|
@@ -28,5 +28,11 @@ module Dineromail
|
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
31
|
+
def self.parse(xml)
|
32
|
+
#Convert tags to lowercase
|
33
|
+
xml = xml.gsub(/<(.*?)[> ]/){|tag| tag.downcase}
|
34
|
+
super(xml)
|
35
|
+
end
|
36
|
+
|
31
37
|
end
|
32
38
|
end
|
data/lib/dineromail/operation.rb
CHANGED
@@ -3,16 +3,16 @@ module Dineromail
|
|
3
3
|
class Operation
|
4
4
|
include HappyMapper
|
5
5
|
|
6
|
-
tag '
|
7
|
-
element :transaction_id, Integer, :tag => '
|
8
|
-
element :date, DateTime, :tag => '
|
9
|
-
element :status, Integer, :tag => '
|
10
|
-
element :amount, Float, :tag => '
|
11
|
-
element :net_amount, Float, :tag => '
|
12
|
-
element :pay_method, String, :tag => '
|
13
|
-
element :pay_medium, String, :tag => '
|
14
|
-
has_one :buyer, Buyer, :tag => '
|
15
|
-
has_many :items, Dineromail::Item, :tag => '
|
6
|
+
tag 'operacion'
|
7
|
+
element :transaction_id, Integer, :tag => 'id'
|
8
|
+
element :date, DateTime, :tag => 'fecha'
|
9
|
+
element :status, Integer, :tag => 'estado'
|
10
|
+
element :amount, Float, :tag => 'monto'
|
11
|
+
element :net_amount, Float, :tag => 'montoneto'
|
12
|
+
element :pay_method, String, :tag => 'metodopago'
|
13
|
+
element :pay_medium, String, :tag => 'mediopago'
|
14
|
+
has_one :buyer, Buyer, :tag => 'comprador'
|
15
|
+
has_many :items, Dineromail::Item, :tag => 'item'
|
16
16
|
|
17
17
|
PENDING_STATUS = 1
|
18
18
|
COMPLETED_STATUS = 2
|
@@ -8,8 +8,8 @@ module Dineromail
|
|
8
8
|
|
9
9
|
include HappyMapper
|
10
10
|
|
11
|
-
tag '
|
12
|
-
element :report_status, Integer, :tag => '
|
11
|
+
tag 'reporte'
|
12
|
+
element :report_status, Integer, :tag => 'estadoreporte'
|
13
13
|
has_many :operations, Operation
|
14
14
|
|
15
15
|
VALID_REPORT_STATUS = 1
|
@@ -35,6 +35,12 @@ module Dineromail
|
|
35
35
|
self.parse response.body
|
36
36
|
end
|
37
37
|
|
38
|
+
def self.parse(xml)
|
39
|
+
#Convert tags to lowercase
|
40
|
+
xml = xml.gsub(/<(.*?)[> ]/){|tag| tag.downcase}
|
41
|
+
super(xml)
|
42
|
+
end
|
43
|
+
|
38
44
|
def self.xml_request_for(transaction_id,options = {})
|
39
45
|
options = options.symbolize_keys
|
40
46
|
account_number = options[:account_number] || Dineromail.configuration.account_number
|
data/lib/dineromail/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dineromail
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 29
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 3
|
10
|
+
version: 0.1.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Nicolas Mosconi
|