Class: PaypalServerSdk::CardRequest

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

Overview

The payment card to use to fund a payment. Can be a credit or debit card. Note: Passing card number, cvv and expiry directly via the API requires PCI SAQ D compliance. *PayPal offers a mechanism by which you do not have to take on the PCI SAQ D burden by using hosted fields - refer to this Integration Guide*.

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, number: SKIP, expiry: SKIP, security_code: SKIP, billing_address: SKIP, attributes: SKIP, vault_id: SKIP, single_use_token: SKIP, stored_credential: SKIP, network_token: SKIP, experience_context: SKIP) ⇒ CardRequest

Returns a new instance of CardRequest.



119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
# File 'lib/paypal_server_sdk/models/card_request.rb', line 119

def initialize(name: SKIP, number: SKIP, expiry: SKIP, security_code: SKIP,
               billing_address: SKIP, attributes: SKIP, vault_id: SKIP,
               single_use_token: SKIP, stored_credential: SKIP,
               network_token: SKIP, experience_context: SKIP)
  @name = name unless name == SKIP
  @number = number unless number == SKIP
  @expiry = expiry unless expiry == SKIP
  @security_code = security_code unless security_code == SKIP
  @billing_address = billing_address unless billing_address == SKIP
  @attributes = attributes unless attributes == SKIP
  @vault_id = vault_id unless vault_id == SKIP
  @single_use_token = single_use_token unless single_use_token == SKIP
  @stored_credential = stored_credential unless stored_credential == SKIP
  @network_token = network_token unless network_token == SKIP
  @experience_context = experience_context unless experience_context == SKIP
end

Instance Attribute Details

#attributesCardAttributes

Additional attributes associated with the use of this card.

Returns:



46
47
48
# File 'lib/paypal_server_sdk/models/card_request.rb', line 46

def attributes
  @attributes
end

#billing_addressAddress

The portable international postal address. Maps to [AddressValidationMetadata](github.com/googlei18n/libaddressinput/ wiki/AddressValidationMetadata) and HTML 5.1 [Autofilling form controls: the autocomplete attribute](www.w3.org/TR/html51/sec-forms.html#autofilling-form-co ntrols-the-autocomplete-attribute).

Returns:



42
43
44
# File 'lib/paypal_server_sdk/models/card_request.rb', line 42

def billing_address
  @billing_address
end

#experience_contextCardExperienceContext

Customizes the payer experience during the 3DS Approval for payment.



78
79
80
# File 'lib/paypal_server_sdk/models/card_request.rb', line 78

def experience_context
  @experience_context
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)


27
28
29
# File 'lib/paypal_server_sdk/models/card_request.rb', line 27

def expiry
  @expiry
end

#nameString

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

Returns:

  • (String)


18
19
20
# File 'lib/paypal_server_sdk/models/card_request.rb', line 18

def name
  @name
end

#network_tokenNetworkToken

The Third Party Network token used to fund a payment.

Returns:



74
75
76
# File 'lib/paypal_server_sdk/models/card_request.rb', line 74

def network_token
  @network_token
end

#numberString

The primary account number (PAN) for the payment card.

Returns:

  • (String)


22
23
24
# File 'lib/paypal_server_sdk/models/card_request.rb', line 22

def number
  @number
end

#security_codeString

The three- or four-digit security code of the card. Also known as the CVV, CVC, CVN, CVE, or CID. This parameter cannot be present in the request when ‘payment_initiator=MERCHANT`.

Returns:

  • (String)


33
34
35
# File 'lib/paypal_server_sdk/models/card_request.rb', line 33

def security_code
  @security_code
end

#single_use_tokenString

The PayPal-generated, short-lived, one-time-use token, used to communicate payment information to PayPal for transaction processing.

Returns:

  • (String)


57
58
59
# File 'lib/paypal_server_sdk/models/card_request.rb', line 57

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



70
71
72
# File 'lib/paypal_server_sdk/models/card_request.rb', line 70

def stored_credential
  @stored_credential
end

#vault_idString

The PayPal-generated ID for the vaulted payment source. This ID should be stored on the merchant’s server so the saved payment source can be used for future transactions.

Returns:

  • (String)


52
53
54
# File 'lib/paypal_server_sdk/models/card_request.rb', line 52

def vault_id
  @vault_id
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
# File 'lib/paypal_server_sdk/models/card_request.rb', line 137

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.

  name = hash.key?('name') ? hash['name'] : SKIP
  number = hash.key?('number') ? hash['number'] : SKIP
  expiry = hash.key?('expiry') ? hash['expiry'] : SKIP
  security_code = hash.key?('security_code') ? hash['security_code'] : SKIP
  billing_address = Address.from_hash(hash['billing_address']) if hash['billing_address']
  attributes = CardAttributes.from_hash(hash['attributes']) if hash['attributes']
  vault_id = hash.key?('vault_id') ? hash['vault_id'] : SKIP
  single_use_token =
    hash.key?('single_use_token') ? hash['single_use_token'] : SKIP
  stored_credential = CardStoredCredential.from_hash(hash['stored_credential']) if
    hash['stored_credential']
  network_token = NetworkToken.from_hash(hash['network_token']) if hash['network_token']
  experience_context = CardExperienceContext.from_hash(hash['experience_context']) if
    hash['experience_context']

  # Create object from extracted values.

  CardRequest.new(name: name,
                  number: number,
                  expiry: expiry,
                  security_code: security_code,
                  billing_address: billing_address,
                  attributes: attributes,
                  vault_id: vault_id,
                  single_use_token: single_use_token,
                  stored_credential: stored_credential,
                  network_token: network_token,
                  experience_context: experience_context)
end

.namesObject

A mapping from model property names to API property names.



81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# File 'lib/paypal_server_sdk/models/card_request.rb', line 81

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['name'] = 'name'
  @_hash['number'] = 'number'
  @_hash['expiry'] = 'expiry'
  @_hash['security_code'] = 'security_code'
  @_hash['billing_address'] = 'billing_address'
  @_hash['attributes'] = 'attributes'
  @_hash['vault_id'] = 'vault_id'
  @_hash['single_use_token'] = 'single_use_token'
  @_hash['stored_credential'] = 'stored_credential'
  @_hash['network_token'] = 'network_token'
  @_hash['experience_context'] = 'experience_context'
  @_hash
end

.nullablesObject

An array for nullable fields



115
116
117
# File 'lib/paypal_server_sdk/models/card_request.rb', line 115

def self.nullables
  []
end

.optionalsObject

An array for optional fields



98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# File 'lib/paypal_server_sdk/models/card_request.rb', line 98

def self.optionals
  %w[
    name
    number
    expiry
    security_code
    billing_address
    attributes
    vault_id
    single_use_token
    stored_credential
    network_token
    experience_context
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



181
182
183
184
185
186
187
188
189
# File 'lib/paypal_server_sdk/models/card_request.rb', line 181

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} name: #{@name.inspect}, number: #{@number.inspect}, expiry:"\
  " #{@expiry.inspect}, security_code: #{@security_code.inspect}, billing_address:"\
  " #{@billing_address.inspect}, attributes: #{@attributes.inspect}, vault_id:"\
  " #{@vault_id.inspect}, single_use_token: #{@single_use_token.inspect}, stored_credential:"\
  " #{@stored_credential.inspect}, network_token: #{@network_token.inspect},"\
  " experience_context: #{@experience_context.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



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

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} name: #{@name}, number: #{@number}, expiry: #{@expiry}, security_code:"\
  " #{@security_code}, billing_address: #{@billing_address}, attributes: #{@attributes},"\
  " vault_id: #{@vault_id}, single_use_token: #{@single_use_token}, stored_credential:"\
  " #{@stored_credential}, network_token: #{@network_token}, experience_context:"\
  " #{@experience_context}>"
end