pag_seguro 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
data/README.md
CHANGED
@@ -78,7 +78,11 @@ As notificações de alteração no status da compra no PagSeguro serão enviada
|
|
78
78
|
O código da notificação é enviado pelo PagSeguro através do parâmentro `notificationCode` em uma requisição do tipo POST. Segue um exemplo de uso da notificação em uma aplicação rails (este exemplo supõe a existência de um `resources :notifications` em suas rotas, e um modelo `Invoice` responsável pelos pagamentos):
|
79
79
|
|
80
80
|
class NotificationsController < ApplicationController
|
81
|
+
skip_before_filter :verify_authenticity_token
|
82
|
+
|
81
83
|
def create
|
84
|
+
return unless request.post?
|
85
|
+
|
82
86
|
email = "seu_email_cadastrado@nopagseguro.com.br"
|
83
87
|
token = "SEU_TOKEN_GERADO_NO_PAG_SEGURO"
|
84
88
|
notification_code = params[:notificationCode]
|
@@ -95,6 +99,8 @@ O código da notificação é enviado pelo PagSeguro através do parâmentro `no
|
|
95
99
|
if notification.cancelled? || notification.returned?
|
96
100
|
Invoice.find(notification.id).void!
|
97
101
|
end
|
102
|
+
|
103
|
+
render :nothing => true
|
98
104
|
end
|
99
105
|
end
|
100
106
|
|
@@ -145,4 +151,4 @@ Desenvolvida por [Stefano Diem Benatti](mailto:stefano@heavenstudio.com.br)
|
|
145
151
|
|
146
152
|
Rafael Castilho (<http://github.com/castilhor>)
|
147
153
|
|
148
|
-
Rafael Ivan Garcia (https://github.com/rafaelivan)
|
154
|
+
Rafael Ivan Garcia (https://github.com/rafaelivan)
|
@@ -43,6 +43,8 @@
|
|
43
43
|
%type= shipping.type
|
44
44
|
- else
|
45
45
|
%type 3
|
46
|
+
- if shipping.cost.present?
|
47
|
+
%cost= shipping.cost
|
46
48
|
%address
|
47
49
|
%country BRA
|
48
50
|
- if shipping.state.present?
|
@@ -58,4 +60,4 @@
|
|
58
60
|
- if shipping.number.present?
|
59
61
|
%number= shipping.number
|
60
62
|
- if shipping.complement.present?
|
61
|
-
%complement= shipping.complement
|
63
|
+
%complement= shipping.complement
|
data/lib/pag_seguro/version.rb
CHANGED
@@ -11,7 +11,7 @@ items = [
|
|
11
11
|
sender_info = {name: "Stefano Diem Benatti", email: "stefano@heavenstudio.com.br", phone_ddd: "11", phone_number: "93430994"}
|
12
12
|
|
13
13
|
shipping_info = {type: PagSeguro::Shipping::SEDEX, state: "SP", city: "São Paulo", postal_code: "05363000",
|
14
|
-
district: "Jd. PoliPoli", street: "Av. Otacilio Tomanik", number: "775", complement: "apto. 92"}
|
14
|
+
district: "Jd. PoliPoli", street: "Av. Otacilio Tomanik", number: "775", complement: "apto. 92", cost: "12.13" }
|
15
15
|
|
16
16
|
|
17
17
|
describe PagSeguro::Payment do
|
@@ -119,6 +119,10 @@ describe PagSeguro::Payment do
|
|
119
119
|
@xml.css("checkout shipping type").first.content.to_i.should == PagSeguro::Shipping::SEDEX
|
120
120
|
end
|
121
121
|
|
122
|
+
it "should allow to set a shipping cost" do
|
123
|
+
@xml.css("checkout shipping cost").first.content.should == "12.13"
|
124
|
+
end
|
125
|
+
|
122
126
|
it "should have state" do
|
123
127
|
@xml_without_shipping_info.css("checkout shipping address state").should be_empty
|
124
128
|
@xml.css("checkout shipping address state").first.content.should == "SP"
|
@@ -187,4 +191,4 @@ describe PagSeguro::Payment do
|
|
187
191
|
end
|
188
192
|
end
|
189
193
|
end
|
190
|
-
end
|
194
|
+
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
email:
|
2
|
-
token:
|
3
|
-
notification_code:
|
1
|
+
email: billing@heavenstudio.com.br
|
2
|
+
token: F4D44C5CE6BD4BD78E5CF5424A65A0D5
|
3
|
+
notification_code: EE803A-59F0DEF0DEED-233499BF9A1E-3543E3
|
4
4
|
transaction_id: UM_CODIGO_DE_TRANSACAO
|
@@ -9,7 +9,8 @@ valid_attributes = {
|
|
9
9
|
district: "Jd. PoliPoli",
|
10
10
|
street: "Av. Otacilio Tomanik",
|
11
11
|
number: "775",
|
12
|
-
complement: "apto. 92"
|
12
|
+
complement: "apto. 92",
|
13
|
+
cost: "12.13"
|
13
14
|
}
|
14
15
|
|
15
16
|
describe PagSeguro::Shipping do
|
@@ -23,31 +24,38 @@ describe PagSeguro::Shipping do
|
|
23
24
|
it { @shipping.should have_attribute_accessor(:street) }
|
24
25
|
it { @shipping.should have_attribute_accessor(:number) }
|
25
26
|
it { @shipping.should have_attribute_accessor(:complement) }
|
26
|
-
|
27
|
+
it { @shipping.should have_attribute_accessor(:cost) }
|
28
|
+
|
27
29
|
describe "types" do
|
28
30
|
it "should be pac if type is 1" do
|
29
31
|
@shipping.stub( :type ){ 1 }
|
30
32
|
@shipping.should be_pac
|
31
33
|
end
|
32
|
-
|
34
|
+
|
33
35
|
it "should be sedex if type is 2" do
|
34
36
|
@shipping.stub( :type ){ 2 }
|
35
37
|
@shipping.should be_sedex
|
36
38
|
end
|
37
|
-
|
39
|
+
|
38
40
|
it "should be unidentified if type is 3" do
|
39
41
|
@shipping.stub( :type ){ 3 }
|
40
42
|
@shipping.should be_unidentified
|
41
43
|
end
|
42
44
|
end
|
43
45
|
end
|
44
|
-
|
46
|
+
|
47
|
+
describe "#cost" do
|
48
|
+
it "should return the same specified cost" do
|
49
|
+
PagSeguro::Shipping.new(valid_attributes).cost.should == "12.13"
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
45
53
|
it "should be able to initialize all attributes" do
|
46
54
|
PagSeguro::Shipping.new(valid_attributes).should be_valid
|
47
55
|
end
|
48
|
-
|
56
|
+
|
49
57
|
it "should not show postal code unless valid" do
|
50
58
|
PagSeguro::Shipping.new(valid_attributes).postal_code.should == "05363000"
|
51
59
|
PagSeguro::Shipping.new(valid_attributes.merge(postal_code: 1234567)).postal_code.should be_blank
|
52
60
|
end
|
53
|
-
end
|
61
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pag_seguro
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-02-26 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activemodel
|
@@ -168,3 +168,4 @@ test_files:
|
|
168
168
|
- spec/pag_seguro/version_spec.rb
|
169
169
|
- spec/spec_helper.rb
|
170
170
|
- spec/support/transaction_shared_examples.rb
|
171
|
+
has_rdoc: false
|