Class: ProcessOut::PaymentDataThreeDSRequest

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

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

Initializes the PaymentDataThreeDSRequest object Params:

client

ProcessOut client instance

data

data that can be used to fill the object



38
39
40
41
42
43
44
45
46
# File 'lib/processout/payment_data_three_ds_request.rb', line 38

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

  self.acs_url = data.fetch(:acs_url, nil)
  self.pareq = data.fetch(:pareq, nil)
  self.md = data.fetch(:md, nil)
  self.term_url = data.fetch(:term_url, nil)
  
end

Instance Attribute Details

#acs_urlObject

Returns the value of attribute acs_url.



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

def acs_url
  @acs_url
end

#mdObject

Returns the value of attribute md.



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

def md
  @md
end

#pareqObject

Returns the value of attribute pareq.



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

def pareq
  @pareq
end

#term_urlObject

Returns the value of attribute term_url.



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

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



66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/processout/payment_data_three_ds_request.rb', line 66

def fill_with_data(data)
  if data.nil?
    return self
  end
  if data.include? "acs_url"
    self.acs_url = data["acs_url"]
  end
  if data.include? "pareq"
    self.pareq = data["pareq"]
  end
  if data.include? "md"
    self.md = data["md"]
  end
  if data.include? "term_url"
    self.term_url = data["term_url"]
  end
  
  self
end

#new(data = {}) ⇒ Object

Create a new PaymentDataThreeDSRequest using the current client



49
50
51
# File 'lib/processout/payment_data_three_ds_request.rb', line 49

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

#prefill(data) ⇒ Object

Prefills the object with the data passed as parameters Params:

data

Hash of data



89
90
91
92
93
94
95
96
97
98
99
# File 'lib/processout/payment_data_three_ds_request.rb', line 89

def prefill(data)
  if data.nil?
    return self
  end
  self.acs_url = data.fetch(:acs_url, self.acs_url)
  self.pareq = data.fetch(:pareq, self.pareq)
  self.md = data.fetch(:md, self.md)
  self.term_url = data.fetch(:term_url, self.term_url)
  
  self
end

#to_json(options) ⇒ Object

Overrides the JSON marshaller to only send the fields we want



54
55
56
57
58
59
60
61
# File 'lib/processout/payment_data_three_ds_request.rb', line 54

def to_json(options)
  {
      "acs_url": self.acs_url,
      "pareq": self.pareq,
      "md": self.md,
      "term_url": self.term_url,
  }.to_json
end