Class: ProcessOut::PaymentProcessingConfiguration

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

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

Initializes the PaymentProcessingConfiguration object Params:

client

ProcessOut client instance

data

data that can be used to fill the object



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

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

  self.bypass_unsupported_split_payments = data.fetch(:bypass_unsupported_split_payments, nil)
  self.apm_payment_config = data.fetch(:apm_payment_config, nil)
  
end

Instance Attribute Details

#apm_payment_configObject

Returns the value of attribute apm_payment_config.



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

def apm_payment_config
  @apm_payment_config
end

#bypass_unsupported_split_paymentsObject

Returns the value of attribute bypass_unsupported_split_payments.



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

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



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

def fill_with_data(data)
  if data.nil?
    return self
  end
  if data.include? "bypass_unsupported_split_payments"
    self.bypass_unsupported_split_payments = data["bypass_unsupported_split_payments"]
  end
  if data.include? "apm_payment_config"
    self.apm_payment_config = data["apm_payment_config"]
  end
  
  self
end

#new(data = {}) ⇒ Object

Create a new PaymentProcessingConfiguration using the current client



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

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

#prefill(data) ⇒ Object

Prefills the object with the data passed as parameters Params:

data

Hash of data



81
82
83
84
85
86
87
88
89
# File 'lib/processout/payment_processing_configuration.rb', line 81

def prefill(data)
  if data.nil?
    return self
  end
  self.bypass_unsupported_split_payments = data.fetch(:bypass_unsupported_split_payments, self.bypass_unsupported_split_payments)
  self.apm_payment_config = data.fetch(:apm_payment_config, self.apm_payment_config)
  
  self
end

#to_json(options) ⇒ Object

Overrides the JSON marshaller to only send the fields we want



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

def to_json(options)
  {
      "bypass_unsupported_split_payments": self.bypass_unsupported_split_payments,
      "apm_payment_config": self.apm_payment_config,
  }.to_json
end