Class: ActiveMerchant::Billing::Integrations::Adyen::Return
- Inherits:
-
Return
- Object
- Return
- ActiveMerchant::Billing::Integrations::Adyen::Return
show all
- Defined in:
- lib/active_merchant/billing/integrations/adyen/return.rb
Constant Summary
collapse
- PAYMENT_RESULT_SIGNATURE_FIELDS =
for verifying the signature of the URL parameters returned by Adyen after the payment process
[
:authResult,
:pspReference,
:merchantReference,
:skinCode
]
Instance Attribute Summary collapse
Attributes inherited from Return
#params
Instance Method Summary
collapse
Methods inherited from Return
#initialize, #parse
Instance Attribute Details
#shared_secret ⇒ Object
Returns the value of attribute shared_secret.
12
13
14
|
# File 'lib/active_merchant/billing/integrations/adyen/return.rb', line 12
def shared_secret
@shared_secret
end
|
Instance Method Details
#generate_signature ⇒ Object
26
27
28
29
|
# File 'lib/active_merchant/billing/integrations/adyen/return.rb', line 26
def generate_signature
digest = OpenSSL::HMAC.digest(OpenSSL::Digest::SHA1.new, @shared_secret, generate_signature_string)
return Base64.encode64(digest).strip
end
|
#generate_signature_string ⇒ Object
#message ⇒ Object
43
44
45
|
# File 'lib/active_merchant/billing/integrations/adyen/return.rb', line 43
def message
params['authResult']
end
|
#payment_authorized? ⇒ Boolean
35
36
37
|
# File 'lib/active_merchant/billing/integrations/adyen/return.rb', line 35
def payment_authorized?
params['authResult'] == 'AUTHORISED'
end
|
#signature_is_valid? ⇒ Boolean
31
32
33
|
# File 'lib/active_merchant/billing/integrations/adyen/return.rb', line 31
def signature_is_valid?
generate_signature.to_s == params['merchantSig'].to_s
end
|
#success? ⇒ Boolean
39
40
41
|
# File 'lib/active_merchant/billing/integrations/adyen/return.rb', line 39
def success?
signature_is_valid? and payment_authorized?
end
|