Class: VisaAcceptanceMergedSpec::PtsV2PaymentsPost400Response11Exception

Inherits:
APIException
  • Object
show all
Defined in:
lib/visa_acceptance_merged_spec/exceptions/pts_v2_payments_post400_response11_exception.rb

Overview

ptsV2PaymentsPost400Response11 class.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(reason, response) ⇒ PtsV2PaymentsPost400Response11Exception

The constructor.

Parameters:

  • reason (String)

    The reason for raising an exception.

  • response (HttpResponse)

    The HttpReponse of the API call.



53
54
55
56
57
# File 'lib/visa_acceptance_merged_spec/exceptions/pts_v2_payments_post400_response11_exception.rb', line 53

def initialize(reason, response)
  super(reason, response)
  hash = APIHelper.json_deserialize(@response.raw_body)
  unbox(hash)
end

Instance Attribute Details

#detailsArray[Detail]

The detail message related to the status and reason listed above.

Returns:



48
49
50
# File 'lib/visa_acceptance_merged_spec/exceptions/pts_v2_payments_post400_response11_exception.rb', line 48

def details
  @details
end

#messageString

The detail message related to the status and reason listed above.

Returns:

  • (String)


44
45
46
# File 'lib/visa_acceptance_merged_spec/exceptions/pts_v2_payments_post400_response11_exception.rb', line 44

def message
  @message
end

#reasonString

The reason of the status. Possible values:

  • MISSING_FIELD
  • INVALID_DATA
  • DUPLICATE_REQUEST
  • INVALID_CARD
  • CARD_TYPE_NOT_ACCEPTED
  • INVALID_MERCHANT_CONFIGURATION
  • PROCESSOR_UNAVAILABLE
  • INVALID_AMOUNT
  • INVALID_CARD_TYPE
  • INVALID_PAYMENT_ID
  • NOT_SUPPORTED

Returns:

  • (String)


40
41
42
# File 'lib/visa_acceptance_merged_spec/exceptions/pts_v2_payments_post400_response11_exception.rb', line 40

def reason
  @reason
end

#statusString

The status of the submitted transaction. Possible values:

  • INVALID_REQUEST

Returns:

  • (String)


24
25
26
# File 'lib/visa_acceptance_merged_spec/exceptions/pts_v2_payments_post400_response11_exception.rb', line 24

def status
  @status
end

#submit_time_utcString

Time of request in UTC. Format: YYYY-MM-DDThh:mm:ssZ Example 2016-08-11T22:47:57Z equals August 11, 2016, at 22:47:57 (10:47:57 p.m.). The T separates the date and the time. The Z indicates UTC. Returned by Visa Acceptance for all services.

Returns:

  • (String)


18
19
20
# File 'lib/visa_acceptance_merged_spec/exceptions/pts_v2_payments_post400_response11_exception.rb', line 18

def submit_time_utc
  @submit_time_utc
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



90
91
92
93
94
# File 'lib/visa_acceptance_merged_spec/exceptions/pts_v2_payments_post400_response11_exception.rb', line 90

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} submit_time_utc: #{@submit_time_utc.inspect}, status: #{@status.inspect},"\
  " reason: #{@reason.inspect}, message: #{@message.inspect}, details: #{@details.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



83
84
85
86
87
# File 'lib/visa_acceptance_merged_spec/exceptions/pts_v2_payments_post400_response11_exception.rb', line 83

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} submit_time_utc: #{@submit_time_utc}, status: #{@status}, reason:"\
  " #{@reason}, message: #{@message}, details: #{@details}>"
end

#unbox(hash) ⇒ Object

Populates this object by extracting properties from a hash. response body.

Parameters:

  • hash (Hash)

    The deserialized response sent by the server in the



62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/visa_acceptance_merged_spec/exceptions/pts_v2_payments_post400_response11_exception.rb', line 62

def unbox(hash)
  return nil unless hash

  @submit_time_utc =
    hash.key?('submitTimeUtc') ? hash['submitTimeUtc'] : SKIP
  @status = hash.key?('status') ? hash['status'] : SKIP
  @reason = hash.key?('reason') ? hash['reason'] : SKIP
  @message = hash.key?('message') ? hash['message'] : SKIP
  # Parameter is an array, so we need to iterate through it
  @details = nil
  unless hash['details'].nil?
    @details = []
    hash['details'].each do |structure|
      @details << (Detail.from_hash(structure) if structure)
    end
  end

  @details = SKIP unless hash.key?('details')
end