Class: Batches::BatchesRequest

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/batches/models/batches_request.rb

Overview

BatchesRequest Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(account_id: SKIP, account_name: SKIP, channel: SKIP, currency: SKIP, country: SKIP, payment_methods: SKIP, additional_properties: nil) ⇒ BatchesRequest

Returns a new instance of BatchesRequest.



80
81
82
83
84
85
86
87
88
89
90
91
92
93
# File 'lib/batches/models/batches_request.rb', line 80

def initialize(account_id: SKIP, account_name: SKIP, channel: SKIP,
               currency: SKIP, country: SKIP, payment_methods: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @account_id =  unless  == SKIP
  @account_name =  unless  == SKIP
  @channel = channel unless channel == SKIP
  @currency = currency unless currency == SKIP
  @country = country unless country == SKIP
  @payment_methods = payment_methods unless payment_methods == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#account_idString

A unique identifier that is used to identify and reference an instance of this resource. This id is used when actioning or referencing a specific account. Begins with the three letters, TRA.

Returns:

  • (String)


16
17
18
# File 'lib/batches/models/batches_request.rb', line 16

def 
  @account_id
end

#account_nameString

A meaningful label that better identifies the account.

Returns:

  • (String)


20
21
22
# File 'lib/batches/models/batches_request.rb', line 20

def 
  @account_name
end

#channelChannelBatchesChannel

Describes whether the transaction was processed in a face to face(CP) scenario or a Customer Not Present (CNP) scenario. * CP - A Customer Present transaction is when the payer and the merchant are in direct face to face contact when exchanging payment method information to fulfill a transaction. e.g. in a store and paying at the counter that is attended by a clerk. * CNP - A Customer NOT Present transaction is when the payer and the merchant are not together when exchanging payment method information to fulfill a transaction. e.g. a transaction executed from a merchant's website or over the phone



33
34
35
# File 'lib/batches/models/batches_request.rb', line 33

def channel
  @channel
end

#countryString

This is the country the merchant is domiciled in. For example, if the merchant is based in Canada it must be set to CA.if the merchant is based in England it must be set to GB.if the merchant is based in USA it must be set to US.The country in ISO-3166-1(alpha-2 code) format.

Returns:

  • (String)


44
45
46
# File 'lib/batches/models/batches_request.rb', line 44

def country
  @country
end

#currencyString

The currency of the amount in ISO-4217(alpha-3)

Returns:

  • (String)


37
38
39
# File 'lib/batches/models/batches_request.rb', line 37

def currency
  @currency
end

#payment_methodsArray[PaymentMethod2]

Indicates the Payment Methods used to carry out the transactions in the batch

Returns:



49
50
51
# File 'lib/batches/models/batches_request.rb', line 49

def payment_methods
  @payment_methods
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
# File 'lib/batches/models/batches_request.rb', line 96

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
   = hash.key?('account_id') ? hash['account_id'] : SKIP
   = hash.key?('account_name') ? hash['account_name'] : SKIP
  channel = hash.key?('channel') ? hash['channel'] : SKIP
  currency = hash.key?('currency') ? hash['currency'] : SKIP
  country = hash.key?('country') ? hash['country'] : SKIP
  payment_methods =
    hash.key?('payment_methods') ? hash['payment_methods'] : SKIP

  # Create a new hash for additional properties, removing known properties.
  new_hash = hash.reject { |k, _| names.value?(k) }

  additional_properties = APIHelper.get_additional_properties(
    new_hash, proc { |value| value }
  )

  # Create object from extracted values.
  BatchesRequest.new(account_id: ,
                     account_name: ,
                     channel: channel,
                     currency: currency,
                     country: country,
                     payment_methods: payment_methods,
                     additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



52
53
54
55
56
57
58
59
60
61
# File 'lib/batches/models/batches_request.rb', line 52

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['account_id'] = 'account_id'
  @_hash['account_name'] = 'account_name'
  @_hash['channel'] = 'channel'
  @_hash['currency'] = 'currency'
  @_hash['country'] = 'country'
  @_hash['payment_methods'] = 'payment_methods'
  @_hash
end

.nullablesObject

An array for nullable fields



76
77
78
# File 'lib/batches/models/batches_request.rb', line 76

def self.nullables
  []
end

.optionalsObject

An array for optional fields



64
65
66
67
68
69
70
71
72
73
# File 'lib/batches/models/batches_request.rb', line 64

def self.optionals
  %w[
    account_id
    account_name
    channel
    currency
    country
    payment_methods
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



134
135
136
137
138
139
140
# File 'lib/batches/models/batches_request.rb', line 134

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} account_id: #{@account_id.inspect}, account_name: #{@account_name.inspect},"\
  " channel: #{@channel.inspect}, currency: #{@currency.inspect}, country:"\
  " #{@country.inspect}, payment_methods: #{@payment_methods.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



126
127
128
129
130
131
# File 'lib/batches/models/batches_request.rb', line 126

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} account_id: #{@account_id}, account_name: #{@account_name}, channel:"\
  " #{@channel}, currency: #{@currency}, country: #{@country}, payment_methods:"\
  " #{@payment_methods}, additional_properties: #{@additional_properties}>"
end