Class: ActiveMerchant::Billing::Integrations::PagSeguro::Notification
- Inherits:
-
Notification
- Object
- Notification
- ActiveMerchant::Billing::Integrations::PagSeguro::Notification
show all
- Defined in:
- lib/active_merchant/billing/integrations/pag_seguro/notification.rb
Instance Attribute Summary
Attributes inherited from Notification
#params, #raw
Instance Method Summary
collapse
#amount, #empty!, #gross_cents, #test?, #valid_sender?
Constructor Details
#initialize(post, options = {}) ⇒ Notification
Returns a new instance of Notification.
10
11
12
13
14
15
16
17
|
# File 'lib/active_merchant/billing/integrations/pag_seguro/notification.rb', line 10
def initialize(post, options = {})
notify_code = parse_http_query(post)["notificationCode"]
email = options[:credential1]
token = options[:credential2]
uri = URI.join(PagSeguro.notification_url, notify_code)
parse_xml(web_get(uri, email: email, token: token))
end
|
Instance Method Details
#acknowledge ⇒ Object
There’s no acknowledge for PagSeguro
73
74
75
|
# File 'lib/active_merchant/billing/integrations/pag_seguro/notification.rb', line 73
def acknowledge
true
end
|
#complete? ⇒ Boolean
19
20
21
|
# File 'lib/active_merchant/billing/integrations/pag_seguro/notification.rb', line 19
def complete?
status == "Completed"
end
|
#currency ⇒ Object
43
44
45
|
# File 'lib/active_merchant/billing/integrations/pag_seguro/notification.rb', line 43
def currency
"BRL"
end
|
#gross ⇒ Object
39
40
41
|
# File 'lib/active_merchant/billing/integrations/pag_seguro/notification.rb', line 39
def gross
params["transaction"]["grossAmount"]
end
|
#item_id ⇒ Object
23
24
25
|
# File 'lib/active_merchant/billing/integrations/pag_seguro/notification.rb', line 23
def item_id
params["transaction"]["reference"]
end
|
#payer_email ⇒ Object
35
36
37
|
# File 'lib/active_merchant/billing/integrations/pag_seguro/notification.rb', line 35
def payer_email
params["sender"]["email"]
end
|
#payment_method_code ⇒ Object
51
52
53
|
# File 'lib/active_merchant/billing/integrations/pag_seguro/notification.rb', line 51
def payment_method_code
params["transaction"]["paymentMethod"]["code"]
end
|
#payment_method_type ⇒ Object
47
48
49
|
# File 'lib/active_merchant/billing/integrations/pag_seguro/notification.rb', line 47
def payment_method_type
params["transaction"]["paymentMethod"]["type"]
end
|
#received_at ⇒ Object
31
32
33
|
# File 'lib/active_merchant/billing/integrations/pag_seguro/notification.rb', line 31
def received_at
params["transaction"]["date"]
end
|
#status ⇒ Object
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
# File 'lib/active_merchant/billing/integrations/pag_seguro/notification.rb', line 55
def status
case params["transaction"]["status"]
when "1", "2"
"Pending"
when "3"
"Completed"
when "4"
"Available"
when "5"
"Dispute"
when "6"
"Reversed"
when "7"
"Failed"
end
end
|
#transaction_id ⇒ Object
27
28
29
|
# File 'lib/active_merchant/billing/integrations/pag_seguro/notification.rb', line 27
def transaction_id
params["transaction"]["code"]
end
|