Class: OffsitePayments::Integrations::Platron::Notification
- Inherits:
-
Notification
- Object
- Notification
- OffsitePayments::Integrations::Platron::Notification
show all
- Defined in:
- lib/offsite_payments/integrations/platron.rb
Instance Attribute Summary
Attributes inherited from Notification
#params, #raw
Instance Method Summary
collapse
#empty!, #gross, #gross_cents, #iso_currency, #status, #test?, #valid_sender?
Constructor Details
Returns a new instance of Notification.
49
50
51
52
|
# File 'lib/offsite_payments/integrations/platron.rb', line 49
def initialize(*args)
super
@signature = params.delete('pg_sig')
end
|
Instance Method Details
#acknowledge(authcode = nil) ⇒ Object
134
135
136
|
# File 'lib/offsite_payments/integrations/platron.rb', line 134
def acknowledge(authcode = nil)
signature == Platron.generate_signature(params, path, secret)
end
|
#amount ⇒ Object
122
123
124
|
# File 'lib/offsite_payments/integrations/platron.rb', line 122
def amount
params['pg_amount']
end
|
#captured ⇒ Object
82
83
84
|
# File 'lib/offsite_payments/integrations/platron.rb', line 82
def captured
params['pg_captured']
end
|
#card_brand ⇒ Object
78
79
80
|
# File 'lib/offsite_payments/integrations/platron.rb', line 78
def card_brand
params['pg_card_brand']
end
|
#complete? ⇒ Boolean
54
55
56
|
# File 'lib/offsite_payments/integrations/platron.rb', line 54
def complete?
params['pg_result']
end
|
#currency ⇒ Object
66
67
68
|
# File 'lib/offsite_payments/integrations/platron.rb', line 66
def currency
params['pg_ps_currency']
end
|
#failure_code ⇒ Object
90
91
92
|
# File 'lib/offsite_payments/integrations/platron.rb', line 90
def failure_code
params['pg_failure_code']
end
|
#failure_description ⇒ Object
94
95
96
|
# File 'lib/offsite_payments/integrations/platron.rb', line 94
def failure_description
params['pg_failure_description']
end
|
#net_amount ⇒ Object
110
111
112
|
# File 'lib/offsite_payments/integrations/platron.rb', line 110
def net_amount
params['pg_net_amount']
end
|
#order_id ⇒ Object
58
59
60
|
# File 'lib/offsite_payments/integrations/platron.rb', line 58
def order_id
params['pg_order_id']
end
|
#overpayment ⇒ Object
86
87
88
|
# File 'lib/offsite_payments/integrations/platron.rb', line 86
def overpayment
params['pg_overpayment']
end
|
#path ⇒ Object
130
131
132
|
# File 'lib/offsite_payments/integrations/platron.rb', line 130
def path
@options[:path]
end
|
#payment_date ⇒ Object
98
99
100
|
# File 'lib/offsite_payments/integrations/platron.rb', line 98
def payment_date
params['pg_payment_date']
end
|
#payment_system ⇒ Object
70
71
72
|
# File 'lib/offsite_payments/integrations/platron.rb', line 70
def payment_system
params['pg_payment_system']
end
|
#platron_payment_id ⇒ Object
62
63
64
|
# File 'lib/offsite_payments/integrations/platron.rb', line 62
def platron_payment_id
params['pg_payment_id']
end
|
#ps_amount ⇒ Object
114
115
116
|
# File 'lib/offsite_payments/integrations/platron.rb', line 114
def ps_amount
params['pg_ps_amount']
end
|
#ps_full_amount ⇒ Object
118
119
120
|
# File 'lib/offsite_payments/integrations/platron.rb', line 118
def ps_full_amount
params['pg_ps_full_amount']
end
|
#salt ⇒ Object
102
103
104
|
# File 'lib/offsite_payments/integrations/platron.rb', line 102
def salt
params['pg_salt']
end
|
#secret ⇒ Object
126
127
128
|
# File 'lib/offsite_payments/integrations/platron.rb', line 126
def secret
@options[:secret]
end
|
#signature ⇒ Object
106
107
108
|
# File 'lib/offsite_payments/integrations/platron.rb', line 106
def signature
@signature
end
|
#success_response(path, secret) ⇒ Object
138
139
140
141
142
143
144
145
146
147
148
149
|
# File 'lib/offsite_payments/integrations/platron.rb', line 138
def success_response(path,secret)
salt = rand(36**15).to_s(36)
xml = ""
doc = Builder::XmlMarkup.new(:target => xml)
sign = Platron.generate_signature({:pg_status => 'ok', :pg_salt => salt}, path, secret)
doc.response do
doc.pg_status 'ok'
doc.pg_salt salt
doc.pg_sig sign
end
xml
end
|
#user_phone ⇒ Object
74
75
76
|
# File 'lib/offsite_payments/integrations/platron.rb', line 74
def user_phone
params['pg_user_phone']
end
|