Class: ProcessOut::ExternalThreeDS

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

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

Initializes the ExternalThreeDS object Params:

client

ProcessOut client instance

data

data that can be used to fill the object



53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/processout/external_three_ds.rb', line 53

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

  self.xid = data.fetch(:xid, nil)
  self.trans_status = data.fetch(:trans_status, nil)
  self.eci = data.fetch(:eci, nil)
  self.cavv = data.fetch(:cavv, nil)
  self.ds_trans_id = data.fetch(:ds_trans_id, nil)
  self.version = data.fetch(:version, nil)
  self.authentication_flow = data.fetch(:authentication_flow, nil)
  
end

Instance Attribute Details

#authentication_flowObject

Returns the value of attribute authentication_flow.



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

def authentication_flow
  @authentication_flow
end

#cavvObject

Returns the value of attribute cavv.



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

def cavv
  @cavv
end

#ds_trans_idObject

Returns the value of attribute ds_trans_id.



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

def ds_trans_id
  @ds_trans_id
end

#eciObject

Returns the value of attribute eci.



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

def eci
  @eci
end

#trans_statusObject

Returns the value of attribute trans_status.



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

def trans_status
  @trans_status
end

#versionObject

Returns the value of attribute version.



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

def version
  @version
end

#xidObject

Returns the value of attribute xid.



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

def xid
  @xid
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



87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# File 'lib/processout/external_three_ds.rb', line 87

def fill_with_data(data)
  if data.nil?
    return self
  end
  if data.include? "xid"
    self.xid = data["xid"]
  end
  if data.include? "trans_status"
    self.trans_status = data["trans_status"]
  end
  if data.include? "eci"
    self.eci = data["eci"]
  end
  if data.include? "cavv"
    self.cavv = data["cavv"]
  end
  if data.include? "ds_trans_id"
    self.ds_trans_id = data["ds_trans_id"]
  end
  if data.include? "version"
    self.version = data["version"]
  end
  if data.include? "authentication_flow"
    self.authentication_flow = data["authentication_flow"]
  end
  
  self
end

#new(data = {}) ⇒ Object

Create a new ExternalThreeDS using the current client



67
68
69
# File 'lib/processout/external_three_ds.rb', line 67

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

#prefill(data) ⇒ Object

Prefills the object with the data passed as parameters Params:

data

Hash of data



119
120
121
122
123
124
125
126
127
128
129
130
131
132
# File 'lib/processout/external_three_ds.rb', line 119

def prefill(data)
  if data.nil?
    return self
  end
  self.xid = data.fetch(:xid, self.xid)
  self.trans_status = data.fetch(:trans_status, self.trans_status)
  self.eci = data.fetch(:eci, self.eci)
  self.cavv = data.fetch(:cavv, self.cavv)
  self.ds_trans_id = data.fetch(:ds_trans_id, self.ds_trans_id)
  self.version = data.fetch(:version, self.version)
  self.authentication_flow = data.fetch(:authentication_flow, self.authentication_flow)
  
  self
end

#to_json(options) ⇒ Object

Overrides the JSON marshaller to only send the fields we want



72
73
74
75
76
77
78
79
80
81
82
# File 'lib/processout/external_three_ds.rb', line 72

def to_json(options)
  {
      "xid": self.xid,
      "trans_status": self.trans_status,
      "eci": self.eci,
      "cavv": self.cavv,
      "ds_trans_id": self.ds_trans_id,
      "version": self.version,
      "authentication_flow": self.authentication_flow,
  }.to_json
end