Class: PaypalServerSdk::CardResponse

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

Overview

The payment card to use to fund a payment. Card can be a credit or debit card.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(name: SKIP, last_digits: SKIP, brand: SKIP, available_networks: SKIP, type: SKIP, authentication_result: SKIP, attributes: SKIP, from_request: SKIP, expiry: SKIP, bin_details: SKIP) ⇒ CardResponse

Returns a new instance of CardResponse.



92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# File 'lib/paypal_server_sdk/models/card_response.rb', line 92

def initialize(name: SKIP, last_digits: SKIP, brand: SKIP,
               available_networks: SKIP, type: SKIP,
               authentication_result: SKIP, attributes: SKIP,
               from_request: SKIP, expiry: SKIP, bin_details: SKIP)
  @name = name unless name == SKIP
  @last_digits = last_digits unless last_digits == SKIP
  @brand = brand unless brand == SKIP
  @available_networks = available_networks unless available_networks == SKIP
  @type = type unless type == SKIP
  @authentication_result = authentication_result unless authentication_result == SKIP
  @attributes = attributes unless attributes == SKIP
  @from_request = from_request unless from_request == SKIP
  @expiry = expiry unless expiry == SKIP
  @bin_details = bin_details unless bin_details == SKIP
end

Instance Attribute Details

#attributesCardAttributesResponse

Additional attributes associated with the use of this card.



40
41
42
# File 'lib/paypal_server_sdk/models/card_response.rb', line 40

def attributes
  @attributes
end

#authentication_resultAuthenticationResponse

Results of Authentication such as 3D Secure.



36
37
38
# File 'lib/paypal_server_sdk/models/card_response.rb', line 36

def authentication_result
  @authentication_result
end

#available_networksArray[CardBrand]

Array of brands or networks associated with the card.

Returns:



28
29
30
# File 'lib/paypal_server_sdk/models/card_response.rb', line 28

def available_networks
  @available_networks
end

#bin_detailsBinDetails

Bank Identification Number (BIN) details used to fund a payment.

Returns:



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

def bin_details
  @bin_details
end

#brandCardBrand

The card network or brand. Applies to credit, debit, gift, and payment cards.

Returns:



24
25
26
# File 'lib/paypal_server_sdk/models/card_response.rb', line 24

def brand
  @brand
end

#expiryString

The year and month, in ISO-8601 ‘YYYY-MM` date format. See [Internet date and time format](tools.ietf.org/html/rfc3339#section-5.6).

Returns:

  • (String)


49
50
51
# File 'lib/paypal_server_sdk/models/card_response.rb', line 49

def expiry
  @expiry
end

#from_requestCardFromRequest

Representation of card details as received in the request.

Returns:



44
45
46
# File 'lib/paypal_server_sdk/models/card_response.rb', line 44

def from_request
  @from_request
end

#last_digitsString

The last digits of the payment card.

Returns:

  • (String)


19
20
21
# File 'lib/paypal_server_sdk/models/card_response.rb', line 19

def last_digits
  @last_digits
end

#nameString

The card holder’s name as it appears on the card.

Returns:

  • (String)


15
16
17
# File 'lib/paypal_server_sdk/models/card_response.rb', line 15

def name
  @name
end

#typeCardType

Type of card. i.e Credit, Debit and so on.

Returns:



32
33
34
# File 'lib/paypal_server_sdk/models/card_response.rb', line 32

def type
  @type
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
# File 'lib/paypal_server_sdk/models/card_response.rb', line 109

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  name = hash.key?('name') ? hash['name'] : SKIP
  last_digits = hash.key?('last_digits') ? hash['last_digits'] : SKIP
  brand = hash.key?('brand') ? hash['brand'] : SKIP
  available_networks =
    hash.key?('available_networks') ? hash['available_networks'] : SKIP
  type = hash.key?('type') ? hash['type'] : SKIP
  authentication_result = AuthenticationResponse.from_hash(hash['authentication_result']) if
    hash['authentication_result']
  attributes = CardAttributesResponse.from_hash(hash['attributes']) if hash['attributes']
  from_request = CardFromRequest.from_hash(hash['from_request']) if hash['from_request']
  expiry = hash.key?('expiry') ? hash['expiry'] : SKIP
  bin_details = BinDetails.from_hash(hash['bin_details']) if hash['bin_details']

  # Create object from extracted values.
  CardResponse.new(name: name,
                   last_digits: last_digits,
                   brand: brand,
                   available_networks: available_networks,
                   type: type,
                   authentication_result: authentication_result,
                   attributes: attributes,
                   from_request: from_request,
                   expiry: expiry,
                   bin_details: bin_details)
end

.namesObject

A mapping from model property names to API property names.



56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/paypal_server_sdk/models/card_response.rb', line 56

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['name'] = 'name'
  @_hash['last_digits'] = 'last_digits'
  @_hash['brand'] = 'brand'
  @_hash['available_networks'] = 'available_networks'
  @_hash['type'] = 'type'
  @_hash['authentication_result'] = 'authentication_result'
  @_hash['attributes'] = 'attributes'
  @_hash['from_request'] = 'from_request'
  @_hash['expiry'] = 'expiry'
  @_hash['bin_details'] = 'bin_details'
  @_hash
end

.nullablesObject

An array for nullable fields



88
89
90
# File 'lib/paypal_server_sdk/models/card_response.rb', line 88

def self.nullables
  []
end

.optionalsObject

An array for optional fields



72
73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'lib/paypal_server_sdk/models/card_response.rb', line 72

def self.optionals
  %w[
    name
    last_digits
    brand
    available_networks
    type
    authentication_result
    attributes
    from_request
    expiry
    bin_details
  ]
end