Class: PayCertify::ThreeDS
- Inherits:
-
Object
- Object
- PayCertify::ThreeDS
- Defined in:
- lib/paycertify/three_ds.rb,
lib/paycertify/three_ds/form.rb,
lib/paycertify/three_ds/client.rb,
lib/paycertify/three_ds/callback.rb,
lib/paycertify/three_ds/payment_authentication.rb
Defined Under Namespace
Classes: Callback, Client, Form, NoCredentialsError, PaymentAuthentication
Class Attribute Summary collapse
-
.api_key ⇒ Object
Returns the value of attribute api_key.
-
.api_secret ⇒ Object
Returns the value of attribute api_secret.
-
.mode ⇒ Object
Returns the value of attribute mode.
Instance Attribute Summary collapse
-
#amount ⇒ Object
Returns the value of attribute amount.
-
#authentication ⇒ Object
Returns the value of attribute authentication.
-
#card_number ⇒ Object
Returns the value of attribute card_number.
-
#client ⇒ Object
Returns the value of attribute client.
-
#expiration_month ⇒ Object
Returns the value of attribute expiration_month.
-
#expiration_year ⇒ Object
Returns the value of attribute expiration_year.
-
#message_id ⇒ Object
Returns the value of attribute message_id.
-
#mode ⇒ Object
Returns the value of attribute mode.
-
#return_url ⇒ Object
Returns the value of attribute return_url.
-
#settings ⇒ Object
Returns the value of attribute settings.
-
#transaction_id ⇒ Object
Returns the value of attribute transaction_id.
-
#type ⇒ Object
Returns the value of attribute type.
Class Method Summary collapse
Instance Method Summary collapse
- #card_enrolled? ⇒ Boolean
-
#initialize(options) ⇒ ThreeDS
constructor
A new instance of ThreeDS.
- #payment_authentication ⇒ Object
- #render! ⇒ Object
- #start! ⇒ Object
Constructor Details
#initialize(options) ⇒ ThreeDS
Returns a new instance of ThreeDS.
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/paycertify/three_ds.rb', line 20 def initialize() raise NoCredentialsError, 'No api_key provided.' unless api_key.present? raise NoCredentialsError, 'No api_secret provided.' unless api_secret.present? self.type = [:type].to_sym.in?([:strict, :frictionless]) ? [:type].to_sym : :strict self.card_number = [:card_number] self.expiration_month = [:expiration_month] self.expiration_year = [:expiration_year] self.amount = [:amount] self.transaction_id = [:transaction_id] self. = [:message_id] self.return_url = [:return_url] self.client = PayCertify::ThreeDS::Client.new(api_key: api_key, api_secret: api_secret, mode: mode) end |
Class Attribute Details
.api_key ⇒ Object
Returns the value of attribute api_key.
66 67 68 |
# File 'lib/paycertify/three_ds.rb', line 66 def api_key @api_key end |
.api_secret ⇒ Object
Returns the value of attribute api_secret.
66 67 68 |
# File 'lib/paycertify/three_ds.rb', line 66 def api_secret @api_secret end |
.mode ⇒ Object
Returns the value of attribute mode.
66 67 68 |
# File 'lib/paycertify/three_ds.rb', line 66 def mode @mode end |
Instance Attribute Details
#amount ⇒ Object
Returns the value of attribute amount.
15 16 17 |
# File 'lib/paycertify/three_ds.rb', line 15 def amount @amount end |
#authentication ⇒ Object
Returns the value of attribute authentication.
14 15 16 |
# File 'lib/paycertify/three_ds.rb', line 14 def authentication @authentication end |
#card_number ⇒ Object
Returns the value of attribute card_number.
15 16 17 |
# File 'lib/paycertify/three_ds.rb', line 15 def card_number @card_number end |
#client ⇒ Object
Returns the value of attribute client.
14 15 16 |
# File 'lib/paycertify/three_ds.rb', line 14 def client @client end |
#expiration_month ⇒ Object
Returns the value of attribute expiration_month.
15 16 17 |
# File 'lib/paycertify/three_ds.rb', line 15 def expiration_month @expiration_month end |
#expiration_year ⇒ Object
Returns the value of attribute expiration_year.
15 16 17 |
# File 'lib/paycertify/three_ds.rb', line 15 def expiration_year @expiration_year end |
#message_id ⇒ Object
Returns the value of attribute message_id.
15 16 17 |
# File 'lib/paycertify/three_ds.rb', line 15 def @message_id end |
#mode ⇒ Object
Returns the value of attribute mode.
16 17 18 |
# File 'lib/paycertify/three_ds.rb', line 16 def mode @mode end |
#return_url ⇒ Object
Returns the value of attribute return_url.
15 16 17 |
# File 'lib/paycertify/three_ds.rb', line 15 def return_url @return_url end |
#settings ⇒ Object
Returns the value of attribute settings.
14 15 16 |
# File 'lib/paycertify/three_ds.rb', line 14 def settings @settings end |
#transaction_id ⇒ Object
Returns the value of attribute transaction_id.
15 16 17 |
# File 'lib/paycertify/three_ds.rb', line 15 def transaction_id @transaction_id end |
#type ⇒ Object
Returns the value of attribute type.
14 15 16 |
# File 'lib/paycertify/three_ds.rb', line 14 def type @type end |
Class Method Details
.authenticate!(settings:, callback_params:) ⇒ Object
72 73 74 75 76 77 78 |
# File 'lib/paycertify/three_ds.rb', line 72 def authenticate!(settings:, callback_params:) raise NoCredentialsError, 'No api_key provided.' unless api_key.present? raise NoCredentialsError, 'No api_secret provided.' unless api_secret.present? client = PayCertify::ThreeDS::Client.new(api_key: api_key, api_secret: api_secret, mode: mode) PayCertify::ThreeDS::PaymentAuthentication.new(client, settings).authenticate!(callback_params) end |
.configure {|_self| ... } ⇒ Object
68 69 70 |
# File 'lib/paycertify/three_ds.rb', line 68 def configure(&block) yield self if block_given? end |
Instance Method Details
#card_enrolled? ⇒ Boolean
53 54 55 |
# File 'lib/paycertify/three_ds.rb', line 53 def card_enrolled? @card_enrolled ||= payment_authentication.card_enrolled? end |
#payment_authentication ⇒ Object
49 50 51 |
# File 'lib/paycertify/three_ds.rb', line 49 def payment_authentication @payment_authentication ||= PayCertify::ThreeDS::PaymentAuthentication.new(client, settings) end |
#render! ⇒ Object
61 62 63 |
# File 'lib/paycertify/three_ds.rb', line 61 def render! PayCertify::ThreeDS::Form.new(authentication).render_html_for(settings, type) end |
#start! ⇒ Object
57 58 59 |
# File 'lib/paycertify/three_ds.rb', line 57 def start! self.authentication = payment_authentication.prepare! end |