Class: OffsitePayments::Integrations::MollieIdeal::Notification
- Inherits:
-
Notification
- Object
- Notification
- OffsitePayments::Integrations::MollieIdeal::Notification
show all
- Defined in:
- lib/offsite_payments/integrations/mollie_ideal.rb
Instance Attribute Summary
Attributes inherited from Notification
#params, #raw
Instance Method Summary
collapse
#amount, #empty!, #iso_currency, #valid_sender?
Constructor Details
#initialize(post_arguments, options = {}) ⇒ Notification
Returns a new instance of Notification.
103
104
105
106
107
108
|
# File 'lib/offsite_payments/integrations/mollie_ideal.rb', line 103
def initialize(post_arguments, options = {})
super
raise ArgumentError, "The transaction_id needs to be included in the query string." if transaction_id.nil?
raise ArgumentError, "The credential1 option needs to be set to the Mollie API key." if api_key.blank?
end
|
Instance Method Details
#acknowledge(authcode = nil) ⇒ Object
151
152
153
154
|
# File 'lib/offsite_payments/integrations/mollie_ideal.rb', line 151
def acknowledge(authcode = nil)
@params = check_payment_status(transaction_id)
true
end
|
#api_key ⇒ Object
122
123
124
|
# File 'lib/offsite_payments/integrations/mollie_ideal.rb', line 122
def api_key
@options[:credential1]
end
|
#check_payment_status(transaction_id) ⇒ Object
156
157
158
|
# File 'lib/offsite_payments/integrations/mollie_ideal.rb', line 156
def check_payment_status(transaction_id)
MollieIdeal.check_payment_status(@options[:credential1], transaction_id)
end
|
#complete? ⇒ Boolean
110
111
112
|
# File 'lib/offsite_payments/integrations/mollie_ideal.rb', line 110
def complete?
true
end
|
#currency ⇒ Object
126
127
128
|
# File 'lib/offsite_payments/integrations/mollie_ideal.rb', line 126
def currency
"EUR"
end
|
#gross ⇒ Object
the money amount we received in X.2 decimal.
131
132
133
|
# File 'lib/offsite_payments/integrations/mollie_ideal.rb', line 131
def gross
@params['amount']
end
|
#gross_cents ⇒ Object
135
136
137
|
# File 'lib/offsite_payments/integrations/mollie_ideal.rb', line 135
def gross_cents
(BigDecimal(@params['amount'], 2) * 100).to_i
end
|
#item_id ⇒ Object
114
115
116
|
# File 'lib/offsite_payments/integrations/mollie_ideal.rb', line 114
def item_id
params['metadata']['order']
end
|
#status ⇒ Object
139
140
141
142
143
144
145
|
# File 'lib/offsite_payments/integrations/mollie_ideal.rb', line 139
def status
case @params['status']
when 'open'; 'Pending'
when 'paidout', 'paid'; 'Completed'
else 'Failed'
end
end
|
#test? ⇒ Boolean
147
148
149
|
# File 'lib/offsite_payments/integrations/mollie_ideal.rb', line 147
def test?
@params['mode'] == 'test'
end
|
#transaction_id ⇒ Object
118
119
120
|
# File 'lib/offsite_payments/integrations/mollie_ideal.rb', line 118
def transaction_id
params['id']
end
|