Class: ActiveMerchant::Billing::Integrations::MollieIdeal::Notification
- Inherits:
-
Notification
- Object
- Notification
- ActiveMerchant::Billing::Integrations::MollieIdeal::Notification
show all
- Defined in:
- lib/active_merchant/billing/integrations/mollie_ideal/notification.rb
Instance Attribute Summary
Attributes inherited from Notification
#params, #raw
Instance Method Summary
collapse
#amount, #empty!, #valid_sender?
Constructor Details
#initialize(post_arguments, options = {}) ⇒ Notification
Returns a new instance of Notification.
9
10
11
12
13
14
|
# File 'lib/active_merchant/billing/integrations/mollie_ideal/notification.rb', line 9
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
57
58
59
60
|
# File 'lib/active_merchant/billing/integrations/mollie_ideal/notification.rb', line 57
def acknowledge(authcode = nil)
@params = check_payment_status(transaction_id)
true
end
|
#api_key ⇒ Object
28
29
30
|
# File 'lib/active_merchant/billing/integrations/mollie_ideal/notification.rb', line 28
def api_key
@options[:credential1]
end
|
#check_payment_status(transaction_id) ⇒ Object
62
63
64
|
# File 'lib/active_merchant/billing/integrations/mollie_ideal/notification.rb', line 62
def check_payment_status(transaction_id)
MollieIdeal.check_payment_status(@options[:credential1], transaction_id)
end
|
#complete? ⇒ Boolean
16
17
18
|
# File 'lib/active_merchant/billing/integrations/mollie_ideal/notification.rb', line 16
def complete?
true
end
|
#currency ⇒ Object
32
33
34
|
# File 'lib/active_merchant/billing/integrations/mollie_ideal/notification.rb', line 32
def currency
"EUR"
end
|
#gross ⇒ Object
the money amount we received in X.2 decimal.
37
38
39
|
# File 'lib/active_merchant/billing/integrations/mollie_ideal/notification.rb', line 37
def gross
@params['amount']
end
|
#gross_cents ⇒ Object
41
42
43
|
# File 'lib/active_merchant/billing/integrations/mollie_ideal/notification.rb', line 41
def gross_cents
(BigDecimal.new(@params['amount'], 2) * 100).to_i
end
|
#item_id ⇒ Object
20
21
22
|
# File 'lib/active_merchant/billing/integrations/mollie_ideal/notification.rb', line 20
def item_id
params['metadata']['order']
end
|
#status ⇒ Object
45
46
47
48
49
50
51
|
# File 'lib/active_merchant/billing/integrations/mollie_ideal/notification.rb', line 45
def status
case @params['status']
when 'open'; 'Pending'
when 'paidout', 'paid'; 'Completed'
else 'Failed'
end
end
|
#test? ⇒ Boolean
53
54
55
|
# File 'lib/active_merchant/billing/integrations/mollie_ideal/notification.rb', line 53
def test?
@params['mode'] == 'test'
end
|
#transaction_id ⇒ Object
24
25
26
|
# File 'lib/active_merchant/billing/integrations/mollie_ideal/notification.rb', line 24
def transaction_id
params['id']
end
|