pagseguro_catcher 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.textile CHANGED
@@ -2,19 +2,68 @@ h1. PagseguroCatcher
2
2
 
3
3
  !https://secure.travis-ci.org/matiasleidemer/pagseguro_catcher.png!:http://travis-ci.org/#!/matiasleidemer/pagseguro_catcher
4
4
 
5
- h2. Soon
5
+ h2. About
6
6
 
7
- I'll describe how to use this one, but it's easy :-)
7
+ This is a little gem that helps you parsing the return of the Pagseguro's transaction notification.
8
+ You can find more info about the notification API "here":https://pagseguro.uol.com.br/v2/guia-de-integracao/api-de-notificacoes.html.
8
9
 
9
- h2. TODO
10
+ h2. Usage
11
+
12
+ The first thing you'll need to do is to "enable the Pagseguro's transaction notification":https://pagseguro.uol.com.br/integracao/notificacao-de-transacoes.jhtml. When you do that, you'll receive a post in the URL that you just set up.
13
+
14
+ When you're done, it's time to set up the PagseguroCatcher params. If you're using Rails, the best way to do that is creating an initializer and set the following parameters:
15
+
16
+ <pre>
17
+ PagseguroCatcher.configure do |config|
18
+ config.token = "YOUR CONFIG TOKEN"
19
+ config.email = "you@yourcompany.com"
20
+ end
21
+ </pre>
22
+
23
+ Every time that some transaction occurs, you'll receive a post in the URL that you set up on Pagseguro. When that post hits your app, you'll do this (again, assuming you're in a Rails application):
24
+
25
+ <pre>
26
+ if request.post?
27
+ if params[:notificationCode] && params[:notificationType]
28
+ transaction = PagseguroCatcher::Checker.new(params[:notificationCode], params[:notificationType]).check
29
+ # your implementation logic goes here
30
+ end
31
+
32
+ render :nothing => true
33
+ end
34
+ </pre>
10
35
 
11
- h3. 0.1.0
36
+ The @transaction@ object contains the all the magic:
12
37
 
13
- * parse correctly all the sections of the return (items, sender, shipping are missing);
14
- * implement a @method_missing@ in @::Transaction::Base@ to delegate to @#[]@
38
+ <pre>
39
+ transaction.date # => Thu, 10 Feb 2011 16:13:41 -0300
40
+ transaction.payment_method_type # => Cartão de crédito
41
+ </pre>
42
+
43
+ You can also access others sections as well:
44
+
45
+ <pre>
46
+ transaction.sender.name # => "John Doe"
47
+ transaction.amount.gross # => 199.99
48
+ transaction.shipping.zip # => "01452002"
49
+ </pre>
50
+
51
+ Looping each item is easy too:
52
+
53
+ <pre>
54
+ transaction.each_item do |item|
55
+ puts item.description
56
+ end
57
+
58
+ Notebook Prata
59
+ Notebook Rosa
60
+ </pre>
61
+
62
+ h2. TODO
15
63
 
16
64
  h3. 0.2.0
17
65
 
66
+ * write the documentation
18
67
  * implement a nice way to rescue the @::Checker#check@ method, when the request isn't successfull or the return is invalid
19
68
 
20
69
  h3. 0.3.0:
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.1.1
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{pagseguro_catcher}
8
- s.version = "0.1.0"
8
+ s.version = "0.1.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Matias H. Leidemer"]
12
- s.date = %q{2011-10-23}
12
+ s.date = %q{2011-10-24}
13
13
  s.description = %q{This gem provides a simple way to check and parse the PagSeguro transaction notification.}
14
14
  s.email = %q{matiasleidemer@gmail.com}
15
15
  s.extra_rdoc_files = [
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pagseguro_catcher
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 0
10
- version: 0.1.0
9
+ - 1
10
+ version: 0.1.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Matias H. Leidemer
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-10-23 00:00:00 -02:00
18
+ date: 2011-10-24 00:00:00 -02:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency