Class: PayCertify::ThreeDS::PaymentAuthentication
- Inherits:
-
Object
- Object
- PayCertify::ThreeDS::PaymentAuthentication
- Defined in:
- lib/paycertify/three_ds/payment_authentication.rb
Defined Under Namespace
Classes: FieldNotProvidedError
Constant Summary collapse
- ENROLLED_STATUS_PATH =
'/enrolled-status'
- PAREQ_PATH =
'/auth-request'
- PARES_PATH =
'/auth-response'
- FIELDS =
%w(pan card_exp_month card_exp_year amount transaction_id return_url)
Instance Attribute Summary collapse
-
#client ⇒ Object
Returns the value of attribute client.
-
#params ⇒ Object
Returns the value of attribute params.
Instance Method Summary collapse
- #authenticate!(callback_params) ⇒ Object
- #card_enrolled? ⇒ Boolean
-
#initialize(client, params) ⇒ PaymentAuthentication
constructor
A new instance of PaymentAuthentication.
- #prepare! ⇒ Object
Constructor Details
#initialize(client, params) ⇒ PaymentAuthentication
Returns a new instance of PaymentAuthentication.
15 16 17 18 |
# File 'lib/paycertify/three_ds/payment_authentication.rb', line 15 def initialize(client, params) self.client = client self.params = params end |
Instance Attribute Details
#client ⇒ Object
Returns the value of attribute client.
13 14 15 |
# File 'lib/paycertify/three_ds/payment_authentication.rb', line 13 def client @client end |
#params ⇒ Object
Returns the value of attribute params.
13 14 15 |
# File 'lib/paycertify/three_ds/payment_authentication.rb', line 13 def params @params end |
Instance Method Details
#authenticate!(callback_params) ⇒ Object
33 34 35 36 37 38 39 |
# 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? ⇒ Boolean
20 21 22 23 24 25 26 |
# 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! ⇒ Object
28 29 30 31 |
# File 'lib/paycertify/three_ds/payment_authentication.rb', line 28 def prepare! validate! client.post(path: PAREQ_PATH, data: params) end |