dinero_mail_ipn 1.0.1 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -2,4 +2,5 @@ pkg/*
2
2
  *.gem
3
3
  .bundle
4
4
  .yardoc
5
+ .rvmrc
5
6
  doc
data/.rvmrc.sample ADDED
@@ -0,0 +1 @@
1
+ rvm use ruby-1.9.2-p320@dm --create
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- dinero_mail_ipn (1.0.1)
4
+ hrbg_dinero_mail_ipn (1.0.2)
5
5
  httparty (~> 0.8.1)
6
6
  nokogiri (~> 1.5.0)
7
7
 
@@ -23,8 +23,8 @@ PLATFORMS
23
23
  ruby
24
24
 
25
25
  DEPENDENCIES
26
- dinero_mail_ipn!
27
26
  fakeweb (~> 1.3.0)
27
+ hrbg_dinero_mail_ipn!
28
28
  redcarpet (~> 2.0.1)
29
29
  shoulda (~> 2.11.3)
30
30
  yard (~> 0.7.4)
data/README.markdown CHANGED
@@ -1,6 +1,7 @@
1
1
  # Dinero Mail IPN Gem
2
2
 
3
- Ruby gem para consumir los métodos de IPN 1 y IPN 2.
3
+ Ruby gem para consumir los métodos de IPN 1 y IPN 2 de [Dinero
4
+ Mail](http://dineromail.com)
4
5
 
5
6
  ## Instalación
6
7
 
@@ -14,7 +15,7 @@ Ruby gem para consumir los métodos de IPN 1 y IPN 2.
14
15
 
15
16
  require 'dinero_mail_ipn'
16
17
 
17
- ## IPN v1
18
+ ### IPN v1
18
19
 
19
20
  Consulta de pagos en períodos de una semana.
20
21
 
@@ -48,7 +49,7 @@ Consulta de reportes para transacciones específicas.
48
49
 
49
50
  ## Documentación
50
51
 
51
- Ver: [http://rubydoc.info/github/etagwerker/dinero\_mail\_ipn/master/frames](http://rubydoc.info/github/etagwerker/dinero_mail_ipn/master/frames)
52
+ Ver: [http://rubydoc.info/gems/dinero_mail_ipn](http://rubydoc.info/gems/dinero_mail_ipn)
52
53
 
53
54
  Si falta algo, por favor reportarlo como issue.
54
55
 
@@ -59,6 +60,8 @@ Si falta algo, por favor reportarlo como issue.
59
60
 
60
61
  ## Patches/Pull Requests
61
62
 
63
+ Lo de siempre.
64
+
62
65
  Fork the project.
63
66
 
64
67
  Make your feature addition or bug fix.
@@ -7,7 +7,7 @@ Gem::Specification.new do |s|
7
7
  s.version = DineroMailIpn::VERSION
8
8
  s.platform = Gem::Platform::RUBY
9
9
  s.authors = ["Ernesto Tagwerker", "Esteban Pastorino"]
10
- s.email = ["ernesto@etagwerker.com", "kito@pinggers.com"]
10
+ s.email = ["ernesto@ombushop.com", "kito@pinggers.com"]
11
11
  s.homepage = ""
12
12
  s.summary = %q{Dinero Mail IPN gem}
13
13
  s.description = %q{Dinero Mail IPN stub}
@@ -16,6 +16,7 @@ Gem::Specification.new do |s|
16
16
 
17
17
  s.add_dependency 'httparty', '~> 0.8.1'
18
18
  s.add_dependency 'nokogiri', '~> 1.5.0'
19
+ s.add_dependency 'chronic'
19
20
 
20
21
  s.files = `git ls-files`.split("\n")
21
22
  s.test_files = [
@@ -3,7 +3,8 @@ module DineroMailIpn
3
3
 
4
4
  # # Reporte por transacción
5
5
  #
6
- # Nos dice el estado de la transacción, el ID y el monto de la misma.
6
+ # Nos dice el estado de la transacción, el ID, quién pagó, el número
7
+ # de transacción, la fecha y el monto de la misma.
7
8
  #
8
9
  # ## Posibles estados
9
10
  #
@@ -18,7 +19,7 @@ module DineroMailIpn
18
19
  COMPLETED_STATUS = 2
19
20
  CANCELLED_STATUS = 3
20
21
 
21
- attr_reader :id, :amount
22
+ attr_reader :id, :amount, :state, :payer_email, :numtransaction, :date
22
23
 
23
24
  # @param [Hash] opts opciones para crear la instancia
24
25
  # @option opts [String] :id ID de transacción
@@ -28,6 +29,9 @@ module DineroMailIpn
28
29
  @id = opts[:id]
29
30
  @amount = opts[:amount]
30
31
  @state = opts[:state]
32
+ @payer_email = opts[:payer_email]
33
+ @numtransaction = opts[:numtransaction]
34
+ @date = opts[:date]
31
35
  end
32
36
 
33
37
  # Devuelve true si la transacción fue completada
@@ -29,11 +29,15 @@ module DineroMailIpn
29
29
  def build_reports
30
30
  return [] if @doc.xpath("//operacion").empty?
31
31
  @doc.xpath("//operacion").map do |report_xml|
32
- DineroMailIpn::Report.new :id => report_xml.xpath("//id").first.content.to_i,
33
- :amount => report_xml.xpath("//monto").first.content.to_i,
34
- :state => report_xml.xpath("//estado").first.content.to_i
32
+ DineroMailIpn::Report.new :id => report_xml.xpath("//id").text,
33
+ :amount => report_xml.xpath("//monto").text.to_f,
34
+ :state => report_xml.xpath("//estado").text,
35
+ :payer_email => report_xml.xpath("//comprador").xpath("//email").text,
36
+ :numtransaction => report_xml.xpath("//numtransaccion").text,
37
+ :date => Chronic.parse(report_xml.xpath("//fecha").text)
35
38
  end
36
39
  end
37
40
 
38
41
  end
39
42
  end
43
+
@@ -1,3 +1,3 @@
1
1
  module DineroMailIpn
2
- VERSION = "1.0.1"
2
+ VERSION = "1.1.1"
3
3
  end
@@ -2,6 +2,7 @@
2
2
 
3
3
  require 'httparty'
4
4
  require 'nokogiri'
5
+ require 'chronic'
5
6
 
6
7
  Dir[File.join(File.dirname(__FILE__),'dinero_mail_ipn', '*')].each {|file| require file }
7
8
 
@@ -15,7 +15,7 @@ XML
15
15
  assert !reporter.valid?
16
16
  end
17
17
 
18
- def test_invalid_report_should_has_no_reports
18
+ def test_invalid_report_should_have_no_reports
19
19
  xml_response = <<-XML
20
20
  <?xml version="1.0" encoding="ISO-8859-1"?>
21
21
  <REPORTE>
@@ -50,7 +50,9 @@ XML
50
50
  reporter = DineroMailIpn::Reporter.new(xml_response)
51
51
  assert_equal 1, reporter.reports.size
52
52
  assert reporter.reports.kind_of?(Array)
53
- assert reporter.reports.first.kind_of?(DineroMailIpn::Report)
53
+ first_report = reporter.reports.first
54
+ assert first_report.kind_of?(DineroMailIpn::Report)
55
+ assert_equal first_report.date, Time.parse("2011-12-29 19:38:00")
54
56
  end
55
57
 
56
58
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dinero_mail_ipn
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,11 +10,11 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-01-16 00:00:00.000000000Z
13
+ date: 2012-10-31 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: httparty
17
- requirement: &2804470 !ruby/object:Gem::Requirement
17
+ requirement: !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ~>
@@ -22,21 +22,47 @@ dependencies:
22
22
  version: 0.8.1
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *2804470
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ none: false
27
+ requirements:
28
+ - - ~>
29
+ - !ruby/object:Gem::Version
30
+ version: 0.8.1
26
31
  - !ruby/object:Gem::Dependency
27
32
  name: nokogiri
28
- requirement: &2804220 !ruby/object:Gem::Requirement
33
+ requirement: !ruby/object:Gem::Requirement
34
+ none: false
35
+ requirements:
36
+ - - ~>
37
+ - !ruby/object:Gem::Version
38
+ version: 1.5.0
39
+ type: :runtime
40
+ prerelease: false
41
+ version_requirements: !ruby/object:Gem::Requirement
29
42
  none: false
30
43
  requirements:
31
44
  - - ~>
32
45
  - !ruby/object:Gem::Version
33
46
  version: 1.5.0
47
+ - !ruby/object:Gem::Dependency
48
+ name: chronic
49
+ requirement: !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
34
55
  type: :runtime
35
56
  prerelease: false
36
- version_requirements: *2804220
57
+ version_requirements: !ruby/object:Gem::Requirement
58
+ none: false
59
+ requirements:
60
+ - - ! '>='
61
+ - !ruby/object:Gem::Version
62
+ version: '0'
37
63
  - !ruby/object:Gem::Dependency
38
64
  name: shoulda
39
- requirement: &2819840 !ruby/object:Gem::Requirement
65
+ requirement: !ruby/object:Gem::Requirement
40
66
  none: false
41
67
  requirements:
42
68
  - - ~>
@@ -44,10 +70,15 @@ dependencies:
44
70
  version: 2.11.3
45
71
  type: :development
46
72
  prerelease: false
47
- version_requirements: *2819840
73
+ version_requirements: !ruby/object:Gem::Requirement
74
+ none: false
75
+ requirements:
76
+ - - ~>
77
+ - !ruby/object:Gem::Version
78
+ version: 2.11.3
48
79
  - !ruby/object:Gem::Dependency
49
80
  name: fakeweb
50
- requirement: &2819610 !ruby/object:Gem::Requirement
81
+ requirement: !ruby/object:Gem::Requirement
51
82
  none: false
52
83
  requirements:
53
84
  - - ~>
@@ -55,10 +86,15 @@ dependencies:
55
86
  version: 1.3.0
56
87
  type: :development
57
88
  prerelease: false
58
- version_requirements: *2819610
89
+ version_requirements: !ruby/object:Gem::Requirement
90
+ none: false
91
+ requirements:
92
+ - - ~>
93
+ - !ruby/object:Gem::Version
94
+ version: 1.3.0
59
95
  - !ruby/object:Gem::Dependency
60
96
  name: yard
61
- requirement: &2819380 !ruby/object:Gem::Requirement
97
+ requirement: !ruby/object:Gem::Requirement
62
98
  none: false
63
99
  requirements:
64
100
  - - ~>
@@ -66,10 +102,15 @@ dependencies:
66
102
  version: 0.7.4
67
103
  type: :development
68
104
  prerelease: false
69
- version_requirements: *2819380
105
+ version_requirements: !ruby/object:Gem::Requirement
106
+ none: false
107
+ requirements:
108
+ - - ~>
109
+ - !ruby/object:Gem::Version
110
+ version: 0.7.4
70
111
  - !ruby/object:Gem::Dependency
71
112
  name: redcarpet
72
- requirement: &2819150 !ruby/object:Gem::Requirement
113
+ requirement: !ruby/object:Gem::Requirement
73
114
  none: false
74
115
  requirements:
75
116
  - - ~>
@@ -77,17 +118,22 @@ dependencies:
77
118
  version: 2.0.1
78
119
  type: :development
79
120
  prerelease: false
80
- version_requirements: *2819150
121
+ version_requirements: !ruby/object:Gem::Requirement
122
+ none: false
123
+ requirements:
124
+ - - ~>
125
+ - !ruby/object:Gem::Version
126
+ version: 2.0.1
81
127
  description: Dinero Mail IPN stub
82
128
  email:
83
- - ernesto@etagwerker.com
129
+ - ernesto@ombushop.com
84
130
  - kito@pinggers.com
85
131
  executables: []
86
132
  extensions: []
87
133
  extra_rdoc_files: []
88
134
  files:
89
135
  - .gitignore
90
- - .rvmrc
136
+ - .rvmrc.sample
91
137
  - .yardopts
92
138
  - Gemfile
93
139
  - Gemfile.lock
@@ -134,7 +180,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
134
180
  version: '0'
135
181
  requirements: []
136
182
  rubyforge_project: dinero_mail_ipn
137
- rubygems_version: 1.7.2
183
+ rubygems_version: 1.8.24
138
184
  signing_key:
139
185
  specification_version: 3
140
186
  summary: Dinero Mail IPN gem
data/.rvmrc DELETED
@@ -1 +0,0 @@
1
- rvm use 1.9.2-p180@dm --create