class PayCertify::ThreeDS::PaymentAuthentication
Constants
- ENROLLED_STATUS_PATH
- FIELDS
- PAREQ_PATH
- PARES_PATH
Attributes
client[RW]
params[RW]
Public Class Methods
new(client, params)
click to toggle source
# File lib/paycertify/three_ds/payment_authentication.rb, line 15 def initialize(client, params) self.client = client self.params = params end
Public Instance Methods
authenticate!(callback_params)
click to toggle source
# File lib/paycertify/three_ds/payment_authentication.rb, line 33 def authenticate!(callback_params) validate! self.params = params.merge(pares: callback_params['PaRes']) response = client.post(path: PARES_PATH, data: params) params.merge(pares: callback_params['PaRes']).merge(response) end
card_enrolled?()
click to toggle source
# File lib/paycertify/three_ds/payment_authentication.rb, line 20 def card_enrolled? validate!(:pan) response = client.post(path: ENROLLED_STATUS_PATH, data: params.slice(:pan)) return response['enrollment_status'] == 'Y' end
prepare!()
click to toggle source
# File lib/paycertify/three_ds/payment_authentication.rb, line 28 def prepare! validate! client.post(path: PAREQ_PATH, data: params) end
Private Instance Methods
raise_error_if_field_not_present(settings, field)
click to toggle source
# File lib/paycertify/three_ds/payment_authentication.rb, line 47 def raise_error_if_field_not_present(settings, field) raise FieldNotProvidedError, "no #{field} provided" unless settings[field].present? end
validate!(*settings)
click to toggle source
# File lib/paycertify/three_ds/payment_authentication.rb, line 42 def validate!(*settings) fields = settings.presence || FIELDS fields.each { |field| raise_error_if_field_not_present(params, field.to_sym) } end