Class: VisaAcceptanceMergedSpec::MerchantInitiatedTransactionObject

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

Overview

MerchantInitiatedTransactionObject 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(reason: SKIP, previous_transaction_id: SKIP, original_authorized_amount: SKIP, agreement_id: SKIP, additional_properties: nil) ⇒ MerchantInitiatedTransactionObject

Returns a new instance of MerchantInitiatedTransactionObject.



84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# File 'lib/visa_acceptance_merged_spec/models/merchant_initiated_transaction_object.rb', line 84

def initialize(reason: SKIP, previous_transaction_id: SKIP,
               original_authorized_amount: SKIP, agreement_id: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @reason = reason unless reason == SKIP
  @previous_transaction_id = previous_transaction_id unless previous_transaction_id == SKIP
  unless original_authorized_amount == SKIP
    @original_authorized_amount =
      original_authorized_amount
  end
  @agreement_id = agreement_id unless agreement_id == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#agreement_idString

This field contains the predetermined agrement id with the merchant

Returns:

  • (String)


57
58
59
# File 'lib/visa_acceptance_merged_spec/models/merchant_initiated_transaction_object.rb', line 57

def agreement_id
  @agreement_id
end

#original_authorized_amountString

Amount of the original authorization. This field is supported only for Apple Pay, Google Pay, and Samsung Pay transactions with Discover on FDC Nashville Global and Chase Paymentech.

Returns:

  • (String)


53
54
55
# File 'lib/visa_acceptance_merged_spec/models/merchant_initiated_transaction_object.rb', line 53

def original_authorized_amount
  @original_authorized_amount
end

#previous_transaction_idString

Network transaction identifier that was returned in the payment response field processorInformation.transactionID in the reply message for either the original merchant-initiated payment in the series or the previous merchant-initiated payment in the series. If the current payment request includes a token instead of an account number, the following time limits apply for the value of this field:

  • For a resubmission, the transaction ID must be less than 14 days old.
  • For a delayed charge or reauthorization, the transaction ID must be less than 30 days old. NOTE: The value for this field does not correspond to any data in the TC 33 capture file5. This field is supported only for Visa transactions on Visa Acceptance through VisaNet.

Returns:

  • (String)


47
48
49
# File 'lib/visa_acceptance_merged_spec/models/merchant_initiated_transaction_object.rb', line 47

def previous_transaction_id
  @previous_transaction_id
end

#reasonString

Reason for the merchant-initiated transaction or incremental authorization. Possible values:

  • 1: Resubmission
  • 2: Delayed charge
  • 3: Reauthorization for split shipment
  • 4: No show
  • 5: Account top up This field is required only for the five kinds of transactions in the preceding list. This field is supported only for merchant-initiated transactions and incremental authorizations.

Visa Acceptance through VisaNet

The value for this field corresponds to the following data in the TC 33 capture file5:

  • Record: CP01 TCR0
  • Position: 160-163
  • Field: Message Reason Code

Returns:

  • (String)


30
31
32
# File 'lib/visa_acceptance_merged_spec/models/merchant_initiated_transaction_object.rb', line 30

def reason
  @reason
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
# File 'lib/visa_acceptance_merged_spec/models/merchant_initiated_transaction_object.rb', line 101

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  reason = hash.key?('reason') ? hash['reason'] : SKIP
  previous_transaction_id =
    hash.key?('previousTransactionId') ? hash['previousTransactionId'] : SKIP
  original_authorized_amount =
    hash.key?('originalAuthorizedAmount') ? hash['originalAuthorizedAmount'] : SKIP
  agreement_id = hash.key?('agreementId') ? hash['agreementId'] : 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.
  MerchantInitiatedTransactionObject.new(reason: reason,
                                         previous_transaction_id: previous_transaction_id,
                                         original_authorized_amount: original_authorized_amount,
                                         agreement_id: agreement_id,
                                         additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



60
61
62
63
64
65
66
67
# File 'lib/visa_acceptance_merged_spec/models/merchant_initiated_transaction_object.rb', line 60

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['reason'] = 'reason'
  @_hash['previous_transaction_id'] = 'previousTransactionId'
  @_hash['original_authorized_amount'] = 'originalAuthorizedAmount'
  @_hash['agreement_id'] = 'agreementId'
  @_hash
end

.nullablesObject

An array for nullable fields



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

def self.nullables
  []
end

.optionalsObject

An array for optional fields



70
71
72
73
74
75
76
77
# File 'lib/visa_acceptance_merged_spec/models/merchant_initiated_transaction_object.rb', line 70

def self.optionals
  %w[
    reason
    previous_transaction_id
    original_authorized_amount
    agreement_id
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



136
137
138
139
140
141
142
# File 'lib/visa_acceptance_merged_spec/models/merchant_initiated_transaction_object.rb', line 136

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} reason: #{@reason.inspect}, previous_transaction_id:"\
  " #{@previous_transaction_id.inspect}, original_authorized_amount:"\
  " #{@original_authorized_amount.inspect}, agreement_id: #{@agreement_id.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



128
129
130
131
132
133
# File 'lib/visa_acceptance_merged_spec/models/merchant_initiated_transaction_object.rb', line 128

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} reason: #{@reason}, previous_transaction_id: #{@previous_transaction_id},"\
  " original_authorized_amount: #{@original_authorized_amount}, agreement_id:"\
  " #{@agreement_id}, additional_properties: #{@additional_properties}>"
end