Class: PaypalServerSdk::ProcessorResponse

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/paypal_server_sdk/models/processor_response.rb

Overview

The processor response information for payment requests, such as direct credit card transactions.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(avs_code: SKIP, cvv_code: SKIP, response_code: SKIP, payment_advice_code: SKIP) ⇒ ProcessorResponse

Returns a new instance of ProcessorResponse.



57
58
59
60
61
62
63
# File 'lib/paypal_server_sdk/models/processor_response.rb', line 57

def initialize(avs_code: SKIP, cvv_code: SKIP, response_code: SKIP,
               payment_advice_code: SKIP)
  @avs_code = avs_code unless avs_code == SKIP
  @cvv_code = cvv_code unless cvv_code == SKIP
  @response_code = response_code unless response_code == SKIP
  @payment_advice_code = payment_advice_code unless payment_advice_code == SKIP
end

Instance Attribute Details

#avs_codeAvsCode

The address verification code for Visa, Discover, Mastercard, or American Express transactions.

Returns:



16
17
18
# File 'lib/paypal_server_sdk/models/processor_response.rb', line 16

def avs_code
  @avs_code
end

#cvv_codeCvvCode

The card verification value code for for Visa, Discover, Mastercard, or American Express.

Returns:



21
22
23
# File 'lib/paypal_server_sdk/models/processor_response.rb', line 21

def cvv_code
  @cvv_code
end

#payment_advice_codePaymentAdviceCode

The declined payment transactions might have payment advice codes. The card networks, like Visa and Mastercard, return payment advice codes.

Returns:



30
31
32
# File 'lib/paypal_server_sdk/models/processor_response.rb', line 30

def payment_advice_code
  @payment_advice_code
end

#response_codeProcessorResponseCode

Processor response code for the non-PayPal payment processor errors.



25
26
27
# File 'lib/paypal_server_sdk/models/processor_response.rb', line 25

def response_code
  @response_code
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/paypal_server_sdk/models/processor_response.rb', line 66

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  avs_code = hash.key?('avs_code') ? hash['avs_code'] : SKIP
  cvv_code = hash.key?('cvv_code') ? hash['cvv_code'] : SKIP
  response_code = hash.key?('response_code') ? hash['response_code'] : SKIP
  payment_advice_code =
    hash.key?('payment_advice_code') ? hash['payment_advice_code'] : SKIP

  # Create object from extracted values.
  ProcessorResponse.new(avs_code: avs_code,
                        cvv_code: cvv_code,
                        response_code: response_code,
                        payment_advice_code: payment_advice_code)
end

.namesObject

A mapping from model property names to API property names.



33
34
35
36
37
38
39
40
# File 'lib/paypal_server_sdk/models/processor_response.rb', line 33

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['avs_code'] = 'avs_code'
  @_hash['cvv_code'] = 'cvv_code'
  @_hash['response_code'] = 'response_code'
  @_hash['payment_advice_code'] = 'payment_advice_code'
  @_hash
end

.nullablesObject

An array for nullable fields



53
54
55
# File 'lib/paypal_server_sdk/models/processor_response.rb', line 53

def self.nullables
  []
end

.optionalsObject

An array for optional fields



43
44
45
46
47
48
49
50
# File 'lib/paypal_server_sdk/models/processor_response.rb', line 43

def self.optionals
  %w[
    avs_code
    cvv_code
    response_code
    payment_advice_code
  ]
end