Class: ProcessOut::ThreeDS

Inherits:
Object
  • Object
show all
Defined in:
lib/processout/three_ds.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client, data = {}) ⇒ ThreeDS

Initializes the ThreeDS object Params:

client

ProcessOut client instance

data

data that can be used to fill the object



63
64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/processout/three_ds.rb', line 63

def initialize(client, data = {})
  @client = client

  self.version = data.fetch(:version, nil)
  self.status = data.fetch(:status, nil)
  self.fingerprinted = data.fetch(:fingerprinted, nil)
  self.challenged = data.fetch(:challenged, nil)
  self.ares_trans_status = data.fetch(:ares_trans_status, nil)
  self.cres_trans_status = data.fetch(:cres_trans_status, nil)
  self.ds_trans_id = data.fetch(:ds_trans_id, nil)
  self.fingerprint_completion_indicator = data.fetch(:fingerprint_completion_indicator, nil)
  self.server_trans_id = data.fetch(:server_trans_id, nil)
  
end

Instance Attribute Details

#ares_trans_statusObject

Returns the value of attribute ares_trans_status.



15
16
17
# File 'lib/processout/three_ds.rb', line 15

def ares_trans_status
  @ares_trans_status
end

#challengedObject

Returns the value of attribute challenged.



14
15
16
# File 'lib/processout/three_ds.rb', line 14

def challenged
  @challenged
end

#cres_trans_statusObject

Returns the value of attribute cres_trans_status.



16
17
18
# File 'lib/processout/three_ds.rb', line 16

def cres_trans_status
  @cres_trans_status
end

#ds_trans_idObject

Returns the value of attribute ds_trans_id.



17
18
19
# File 'lib/processout/three_ds.rb', line 17

def ds_trans_id
  @ds_trans_id
end

#fingerprint_completion_indicatorObject

Returns the value of attribute fingerprint_completion_indicator.



18
19
20
# File 'lib/processout/three_ds.rb', line 18

def fingerprint_completion_indicator
  @fingerprint_completion_indicator
end

#fingerprintedObject

Returns the value of attribute fingerprinted.



13
14
15
# File 'lib/processout/three_ds.rb', line 13

def fingerprinted
  @fingerprinted
end

#server_trans_idObject

Returns the value of attribute server_trans_id.



19
20
21
# File 'lib/processout/three_ds.rb', line 19

def server_trans_id
  @server_trans_id
end

#statusObject

Returns the value of attribute status.



12
13
14
# File 'lib/processout/three_ds.rb', line 12

def status
  @status
end

#versionObject

Returns the value of attribute version.



11
12
13
# File 'lib/processout/three_ds.rb', line 11

def version
  @version
end

Instance Method Details

#fill_with_data(data) ⇒ Object

Fills the object with data coming from the API Params:

data

Hash of data coming from the API



101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
# File 'lib/processout/three_ds.rb', line 101

def fill_with_data(data)
  if data.nil?
    return self
  end
  if data.include? "version"
    self.version = data["version"]
  end
  if data.include? "status"
    self.status = data["status"]
  end
  if data.include? "fingerprinted"
    self.fingerprinted = data["fingerprinted"]
  end
  if data.include? "challenged"
    self.challenged = data["challenged"]
  end
  if data.include? "ares_trans_status"
    self.ares_trans_status = data["ares_trans_status"]
  end
  if data.include? "cres_trans_status"
    self.cres_trans_status = data["cres_trans_status"]
  end
  if data.include? "ds_trans_id"
    self.ds_trans_id = data["ds_trans_id"]
  end
  if data.include? "fingerprint_completion_indicator"
    self.fingerprint_completion_indicator = data["fingerprint_completion_indicator"]
  end
  if data.include? "server_trans_id"
    self.server_trans_id = data["server_trans_id"]
  end
  
  self
end

#new(data = {}) ⇒ Object

Create a new ThreeDS using the current client



79
80
81
# File 'lib/processout/three_ds.rb', line 79

def new(data = {})
  ThreeDS.new(@client, data)
end

#prefill(data) ⇒ Object

Prefills the object with the data passed as parameters Params:

data

Hash of data



139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
# File 'lib/processout/three_ds.rb', line 139

def prefill(data)
  if data.nil?
    return self
  end
  self.version = data.fetch(:version, self.version)
  self.status = data.fetch(:status, self.status)
  self.fingerprinted = data.fetch(:fingerprinted, self.fingerprinted)
  self.challenged = data.fetch(:challenged, self.challenged)
  self.ares_trans_status = data.fetch(:ares_trans_status, self.ares_trans_status)
  self.cres_trans_status = data.fetch(:cres_trans_status, self.cres_trans_status)
  self.ds_trans_id = data.fetch(:ds_trans_id, self.ds_trans_id)
  self.fingerprint_completion_indicator = data.fetch(:fingerprint_completion_indicator, self.fingerprint_completion_indicator)
  self.server_trans_id = data.fetch(:server_trans_id, self.server_trans_id)
  
  self
end

#to_json(options) ⇒ Object

Overrides the JSON marshaller to only send the fields we want



84
85
86
87
88
89
90
91
92
93
94
95
96
# File 'lib/processout/three_ds.rb', line 84

def to_json(options)
  {
      "version": self.version,
      "status": self.status,
      "fingerprinted": self.fingerprinted,
      "challenged": self.challenged,
      "ares_trans_status": self.ares_trans_status,
      "cres_trans_status": self.cres_trans_status,
      "ds_trans_id": self.ds_trans_id,
      "fingerprint_completion_indicator": self.fingerprint_completion_indicator,
      "server_trans_id": self.server_trans_id,
  }.to_json
end