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.<blockquote><strong>Note:</strong> Passing card number, cvv and expiry directly via the API requires <a href=“www.pcisecuritystandards.org/pci_security/completing_self_asse ssment”> PCI SAQ D compliance</a>.
*PayPal offers a mechanism by which you do not have to take on the <strong>PCI SAQ D</strong> burden by using hosted fields - refer to <a href=“developer.paypal.com/docs/checkout/advanced/integrate/”>this Integration Guide</a>*.</blockquote>

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, 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.



125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
# File 'lib/paypal_server_sdk/models/card_request.rb', line 125

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:



50
51
52
# File 'lib/paypal_server_sdk/models/card_request.rb', line 50

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:



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

def billing_address
  @billing_address
end

#experience_contextCardExperienceContext

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



84
85
86
# File 'lib/paypal_server_sdk/models/card_request.rb', line 84

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)


31
32
33
# File 'lib/paypal_server_sdk/models/card_request.rb', line 31

def expiry
  @expiry
end

#nameString

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

Returns:

  • (String)


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

def name
  @name
end

#network_tokenNetworkToken

The Third Party Network token used to fund a payment.

Returns:



80
81
82
# File 'lib/paypal_server_sdk/models/card_request.rb', line 80

def network_token
  @network_token
end

#numberString

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

Returns:

  • (String)


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

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)


37
38
39
# File 'lib/paypal_server_sdk/models/card_request.rb', line 37

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)


61
62
63
# File 'lib/paypal_server_sdk/models/card_request.rb', line 61

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).<br/>Parameter compatibility:<br/><ul><li>`payment_type=ONE_TIME` is compatible only with `payment_initiator=CUSTOMER`.</li><li>`usage=FIRST` is compatible only with `payment_initiator=CUSTOMER`.</li><li>`previous_transaction_reference` or `previous_network_transaction_reference` is compatible only with `payment_initiator=MERCHANT`.</li><li>Only one of the parameters - `previous_transaction_reference` and `previous_network_transaction_reference` - can be present in the request.</li></ul>



76
77
78
# File 'lib/paypal_server_sdk/models/card_request.rb', line 76

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)


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

def vault_id
  @vault_id
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
169
170
171
172
173
174
# File 'lib/paypal_server_sdk/models/card_request.rb', line 143

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.



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

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



121
122
123
# File 'lib/paypal_server_sdk/models/card_request.rb', line 121

def self.nullables
  []
end

.optionalsObject

An array for optional fields



104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# File 'lib/paypal_server_sdk/models/card_request.rb', line 104

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