Class: VisaAcceptanceMergedSpec::RecurringPaymentInformation

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/visa_acceptance_merged_spec/models/recurring_payment_information.rb

Overview

This object contains recurring payment information.

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(end_date:, frequency:, number_of_payments: SKIP, original_purchase_date: SKIP, sequence_number: SKIP, type: SKIP, occurrence: SKIP, validation_indicator: SKIP, amount_type: SKIP, maximum_amount: SKIP, reference_number: SKIP, additional_properties: nil) ⇒ RecurringPaymentInformation

Returns a new instance of RecurringPaymentInformation.



137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
# File 'lib/visa_acceptance_merged_spec/models/recurring_payment_information.rb', line 137

def initialize(end_date:, frequency:, number_of_payments: SKIP,
               original_purchase_date: SKIP, sequence_number: SKIP,
               type: SKIP, occurrence: SKIP, validation_indicator: SKIP,
               amount_type: SKIP, maximum_amount: SKIP,
               reference_number: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @end_date = end_date
  @frequency = frequency
  @number_of_payments = number_of_payments unless number_of_payments == SKIP
  @original_purchase_date = original_purchase_date unless original_purchase_date == SKIP
  @sequence_number = sequence_number unless sequence_number == SKIP
  @type = type unless type == SKIP
  @occurrence = occurrence unless occurrence == SKIP
  @validation_indicator = validation_indicator unless validation_indicator == SKIP
  @amount_type = amount_type unless amount_type == SKIP
  @maximum_amount = maximum_amount unless maximum_amount == SKIP
  @reference_number = reference_number unless reference_number == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#amount_typeString

Indicates recurring amount type agreed by the cardholder Valid Values : 1- Fixed amount recurring payment 2- Recurring payment with maximum amount

Returns:

  • (String)


87
88
89
# File 'lib/visa_acceptance_merged_spec/models/recurring_payment_information.rb', line 87

def amount_type
  @amount_type
end

#end_dateString

The date after which no further recurring authorizations should be performed. Format: YYYY-MM-DD Note This field is required for recurring transactions.

Returns:

  • (String)


16
17
18
# File 'lib/visa_acceptance_merged_spec/models/recurring_payment_information.rb', line 16

def end_date
  @end_date
end

#frequencyInteger

Integer value indicating the minimum number of days between recurring authorizations. A frequency of monthly is indicated by the value 28. Multiple of 28 days will be used to indicate months. Example: 6 months = 168 Example values accepted (31 days):

  • 31
  • 031
  • 0031 Note This field is required for recurring transactions.

Returns:

  • (Integer)


29
30
31
# File 'lib/visa_acceptance_merged_spec/models/recurring_payment_information.rb', line 29

def frequency
  @frequency
end

#maximum_amountString

This API field will contain the maximum amount agreed to by the cardholder. The currency of this amount will be specified in Field 49—Currency Code,Transaction.

Returns:

  • (String)


93
94
95
# File 'lib/visa_acceptance_merged_spec/models/recurring_payment_information.rb', line 93

def maximum_amount
  @maximum_amount
end

#number_of_paymentsInteger

Total number of payments for the duration of the recurring subscription.

Returns:

  • (Integer)


33
34
35
# File 'lib/visa_acceptance_merged_spec/models/recurring_payment_information.rb', line 33

def number_of_payments
  @number_of_payments
end

#occurrenceString

This value indicates how often a recurring payment occurs. Valid Values : • 01 (Daily) • 02 (Twice weekly) • 03 (Weekly) • 04 (Ten days) • 05 (Fortnightly) • 06 (Monthly) • 07 (Every two months) • 08 (Trimester) • 09 (Quarterly) • 10 (Twice yearly) • 11 (Annually) • 12 (Unscheduled)

Returns:

  • (String)


72
73
74
# File 'lib/visa_acceptance_merged_spec/models/recurring_payment_information.rb', line 72

def occurrence
  @occurrence
end

#original_purchase_dateString

Date of original purchase. Required for recurring transactions. Format: YYYY-MM-DDTHH:MM:SSZ Note: If this field is empty, the current date is used.

Returns:

  • (String)


39
40
41
# File 'lib/visa_acceptance_merged_spec/models/recurring_payment_information.rb', line 39

def original_purchase_date
  @original_purchase_date
end

#reference_numberString

This will contain a unique reference number for the recurring payment transaction.

Returns:

  • (String)


98
99
100
# File 'lib/visa_acceptance_merged_spec/models/recurring_payment_information.rb', line 98

def reference_number
  @reference_number
end

#sequence_numberInteger

This field is mandatory for Cartes Bancaires recurring transactions on Credit Mutuel-CIC.
This field records recurring sequence, e.g. 1st for initial, 2 for subsequent, 3 etc

Returns:

  • (Integer)


46
47
48
# File 'lib/visa_acceptance_merged_spec/models/recurring_payment_information.rb', line 46

def sequence_number
  @sequence_number
end

#typeString

This contains the type of recurring payment. Valid Values : 1 - Registration/First transaction 2 - Subsequent transaction 3 - Modification 4 - Cancellation

Returns:

  • (String)


55
56
57
# File 'lib/visa_acceptance_merged_spec/models/recurring_payment_information.rb', line 55

def type
  @type
end

#validation_indicatorString

This tag will contain a value that indicates whether or not the recurring payment transaction has been validated. Valid values : 0- Not validated 1- Validated

Returns:

  • (String)


80
81
82
# File 'lib/visa_acceptance_merged_spec/models/recurring_payment_information.rb', line 80

def validation_indicator
  @validation_indicator
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
# File 'lib/visa_acceptance_merged_spec/models/recurring_payment_information.rb', line 160

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  end_date = hash.key?('endDate') ? hash['endDate'] : nil
  frequency = hash.key?('frequency') ? hash['frequency'] : nil
  number_of_payments =
    hash.key?('numberOfPayments') ? hash['numberOfPayments'] : SKIP
  original_purchase_date =
    hash.key?('originalPurchaseDate') ? hash['originalPurchaseDate'] : SKIP
  sequence_number =
    hash.key?('sequenceNumber') ? hash['sequenceNumber'] : SKIP
  type = hash.key?('type') ? hash['type'] : SKIP
  occurrence = hash.key?('occurrence') ? hash['occurrence'] : SKIP
  validation_indicator =
    hash.key?('validationIndicator') ? hash['validationIndicator'] : SKIP
  amount_type = hash.key?('amountType') ? hash['amountType'] : SKIP
  maximum_amount = hash.key?('maximumAmount') ? hash['maximumAmount'] : SKIP
  reference_number =
    hash.key?('referenceNumber') ? hash['referenceNumber'] : 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.
  RecurringPaymentInformation.new(end_date: end_date,
                                  frequency: frequency,
                                  number_of_payments: number_of_payments,
                                  original_purchase_date: original_purchase_date,
                                  sequence_number: sequence_number,
                                  type: type,
                                  occurrence: occurrence,
                                  validation_indicator: validation_indicator,
                                  amount_type: amount_type,
                                  maximum_amount: maximum_amount,
                                  reference_number: reference_number,
                                  additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# File 'lib/visa_acceptance_merged_spec/models/recurring_payment_information.rb', line 101

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['end_date'] = 'endDate'
  @_hash['frequency'] = 'frequency'
  @_hash['number_of_payments'] = 'numberOfPayments'
  @_hash['original_purchase_date'] = 'originalPurchaseDate'
  @_hash['sequence_number'] = 'sequenceNumber'
  @_hash['type'] = 'type'
  @_hash['occurrence'] = 'occurrence'
  @_hash['validation_indicator'] = 'validationIndicator'
  @_hash['amount_type'] = 'amountType'
  @_hash['maximum_amount'] = 'maximumAmount'
  @_hash['reference_number'] = 'referenceNumber'
  @_hash
end

.nullablesObject

An array for nullable fields



133
134
135
# File 'lib/visa_acceptance_merged_spec/models/recurring_payment_information.rb', line 133

def self.nullables
  []
end

.optionalsObject

An array for optional fields



118
119
120
121
122
123
124
125
126
127
128
129
130
# File 'lib/visa_acceptance_merged_spec/models/recurring_payment_information.rb', line 118

def self.optionals
  %w[
    number_of_payments
    original_purchase_date
    sequence_number
    type
    occurrence
    validation_indicator
    amount_type
    maximum_amount
    reference_number
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



215
216
217
218
219
220
221
222
223
224
# File 'lib/visa_acceptance_merged_spec/models/recurring_payment_information.rb', line 215

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} end_date: #{@end_date.inspect}, frequency: #{@frequency.inspect},"\
  " number_of_payments: #{@number_of_payments.inspect}, original_purchase_date:"\
  " #{@original_purchase_date.inspect}, sequence_number: #{@sequence_number.inspect}, type:"\
  " #{@type.inspect}, occurrence: #{@occurrence.inspect}, validation_indicator:"\
  " #{@validation_indicator.inspect}, amount_type: #{@amount_type.inspect}, maximum_amount:"\
  " #{@maximum_amount.inspect}, reference_number: #{@reference_number.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



204
205
206
207
208
209
210
211
212
# File 'lib/visa_acceptance_merged_spec/models/recurring_payment_information.rb', line 204

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} end_date: #{@end_date}, frequency: #{@frequency}, number_of_payments:"\
  " #{@number_of_payments}, original_purchase_date: #{@original_purchase_date},"\
  " sequence_number: #{@sequence_number}, type: #{@type}, occurrence: #{@occurrence},"\
  " validation_indicator: #{@validation_indicator}, amount_type: #{@amount_type},"\
  " maximum_amount: #{@maximum_amount}, reference_number: #{@reference_number},"\
  " additional_properties: #{@additional_properties}>"
end