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

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #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, stored_credential: SKIP) ⇒ CardResponse

Returns a new instance of CardResponse.



107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
# File 'lib/paypal_server_sdk/models/card_response.rb', line 107

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,
               stored_credential: 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
  @stored_credential = stored_credential unless stored_credential == 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

#stored_credentialCardStoredCredential

Provides additional details to process a payment using a ‘card` that has been stored or is intended to be stored (also referred to as stored_credential or card-on-file). Parameter compatibility: `payment_type=ONE_TIME` is compatible only with `payment_initiator=CUSTOMER`. `usage=FIRST` is compatible only with `payment_initiator=CUSTOMER`. `previous_transaction_reference` or `previous_network_transaction_reference` is compatible only with `payment_initiator=MERCHANT`. Only one of the parameters - `previous_transaction_reference` and `previous_network_transaction_reference` - can be present in the request.



66
67
68
# File 'lib/paypal_server_sdk/models/card_response.rb', line 66

def stored_credential
  @stored_credential
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.



126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
# File 'lib/paypal_server_sdk/models/card_response.rb', line 126

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']
  stored_credential = CardStoredCredential.from_hash(hash['stored_credential']) if
    hash['stored_credential']

  # 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,
                   stored_credential: stored_credential)
end

.namesObject

A mapping from model property names to API property names.



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

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['stored_credential'] = 'stored_credential'
  @_hash
end

.nullablesObject

An array for nullable fields



103
104
105
# File 'lib/paypal_server_sdk/models/card_response.rb', line 103

def self.nullables
  []
end

.optionalsObject

An array for optional fields



86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# File 'lib/paypal_server_sdk/models/card_response.rb', line 86

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

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



170
171
172
173
174
175
176
177
178
# File 'lib/paypal_server_sdk/models/card_response.rb', line 170

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} name: #{@name.inspect}, last_digits: #{@last_digits.inspect}, brand:"\
  " #{@brand.inspect}, available_networks: #{@available_networks.inspect}, type:"\
  " #{@type.inspect}, authentication_result: #{@authentication_result.inspect}, attributes:"\
  " #{@attributes.inspect}, from_request: #{@from_request.inspect}, expiry:"\
  " #{@expiry.inspect}, bin_details: #{@bin_details.inspect}, stored_credential:"\
  " #{@stored_credential.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



160
161
162
163
164
165
166
167
# File 'lib/paypal_server_sdk/models/card_response.rb', line 160

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} 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}, stored_credential:"\
  " #{@stored_credential}>"
end