Class: VisaAcceptanceMergedSpec::MerchantInitiatedTransaction

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

Overview

MerchantInitiatedTransaction 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) ⇒ MerchantInitiatedTransaction

Returns a new instance of MerchantInitiatedTransaction.



88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# File 'lib/visa_acceptance_merged_spec/models/merchant_initiated_transaction.rb', line 88

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_id ⇒ String

An API to carry the agreement ID generated for recurring and unscheduled Card on file transaction. the merchant generates this per card holder or per payment agreement and shares the generated unique ID in the subsequent transactions. This can contain foreign/arabic character set also. Visa Acceptance forwards this value to the Saudi Payment processor.

Returns:

  • (String)


61
62
63
# File 'lib/visa_acceptance_merged_spec/models/merchant_initiated_transaction.rb', line 61

def agreement_id
  @agreement_id
end

#original_authorized_amount ⇒ String

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.rb', line 53

def original_authorized_amount
  @original_authorized_amount
end

#previous_transaction_id ⇒ String

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.rb', line 47

def previous_transaction_id
  @previous_transaction_id
end

#reason ⇒ String

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.rb', line 30

def reason
  @reason
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
# File 'lib/visa_acceptance_merged_spec/models/merchant_initiated_transaction.rb', line 105

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.
  MerchantInitiatedTransaction.new(reason: reason,
                                   previous_transaction_id: previous_transaction_id,
                                   original_authorized_amount: original_authorized_amount,
                                   agreement_id: agreement_id,
                                   additional_properties: additional_properties)
end

.names ⇒ Object

A mapping from model property names to API property names.



64
65
66
67
68
69
70
71
# File 'lib/visa_acceptance_merged_spec/models/merchant_initiated_transaction.rb', line 64

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

.nullables ⇒ Object

An array for nullable fields



84
85
86
# File 'lib/visa_acceptance_merged_spec/models/merchant_initiated_transaction.rb', line 84

def self.nullables
  []
end

.optionals ⇒ Object

An array for optional fields



74
75
76
77
78
79
80
81
# File 'lib/visa_acceptance_merged_spec/models/merchant_initiated_transaction.rb', line 74

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

Instance Method Details

#inspect ⇒ Object

Provides a debugging-friendly string with detailed object information.



140
141
142
143
144
145
146
# File 'lib/visa_acceptance_merged_spec/models/merchant_initiated_transaction.rb', line 140

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_s ⇒ Object

Provides a human-readable string representation of the object.



132
133
134
135
136
137
# File 'lib/visa_acceptance_merged_spec/models/merchant_initiated_transaction.rb', line 132

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