Class: PaypalServerSdk::CardPaymentToken

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

Overview

Full representation of a Card Payment Token including network token.

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, expiry: SKIP, billing_address: SKIP, verification_status: SKIP, verification: SKIP, network_transaction_reference: SKIP, authentication_result: SKIP, bin_details: SKIP, type: SKIP, network_token: SKIP) ⇒ CardPaymentToken

Returns a new instance of CardPaymentToken.



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

def initialize(name: SKIP, last_digits: SKIP, brand: SKIP, expiry: SKIP,
               billing_address: SKIP, verification_status: SKIP,
               verification: SKIP, network_transaction_reference: SKIP,
               authentication_result: SKIP, bin_details: SKIP, type: SKIP,
               network_token: SKIP)
  @name = name unless name == SKIP
  @last_digits = last_digits unless last_digits == SKIP
  @brand = brand unless brand == SKIP
  @expiry = expiry unless expiry == SKIP
  @billing_address = billing_address unless billing_address == SKIP
  @verification_status = verification_status unless verification_status == SKIP
  @verification = verification unless verification == SKIP
  unless network_transaction_reference == SKIP
    @network_transaction_reference =
      network_transaction_reference
  end
  @authentication_result = authentication_result unless authentication_result == SKIP
  @bin_details = bin_details unless bin_details == SKIP
  @type = type unless type == SKIP
  @network_token = network_token unless network_token == SKIP
end

Instance Attribute Details

#authentication_resultCardAuthenticationResponse

Results of Authentication such as 3D Secure.



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

def authentication_result
  @authentication_result
end

#billing_addressAddressDetails

Address request details.

Returns:



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

def billing_address
  @billing_address
end

#bin_detailsBinDetails

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

Returns:



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

def bin_details
  @bin_details
end

#brandCardBrand

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

Returns:



23
24
25
# File 'lib/paypal_server_sdk/models/card_payment_token.rb', line 23

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)


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

def expiry
  @expiry
end

#last_digitsString

The last digits of the payment card.

Returns:

  • (String)


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

def last_digits
  @last_digits
end

#nameString

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

Returns:

  • (String)


14
15
16
# File 'lib/paypal_server_sdk/models/card_payment_token.rb', line 14

def name
  @name
end

#network_tokenObject

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

Returns:

  • (Object)


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

def network_token
  @network_token
end

#network_transaction_referenceNetworkTransactionReferenceEntity

Previous network transaction reference including id in response.



45
46
47
# File 'lib/paypal_server_sdk/models/card_payment_token.rb', line 45

def network_transaction_reference
  @network_transaction_reference
end

#typeCardType

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

Returns:



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

def type
  @type
end

#verificationCardVerificationDetails

Card Verification details including the authorization details and 3D SECURE details.



41
42
43
# File 'lib/paypal_server_sdk/models/card_payment_token.rb', line 41

def verification
  @verification
end

#verification_statusString

Verification status of Card.

Returns:

  • (String)


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

def verification_status
  @verification_status
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
158
159
160
161
162
163
164
# File 'lib/paypal_server_sdk/models/card_payment_token.rb', line 128

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
  expiry = hash.key?('expiry') ? hash['expiry'] : SKIP
  billing_address = AddressDetails.from_hash(hash['billing_address']) if
    hash['billing_address']
  verification_status =
    hash.key?('verification_status') ? hash['verification_status'] : SKIP
  verification = CardVerificationDetails.from_hash(hash['verification']) if
    hash['verification']
  if hash['network_transaction_reference']
    network_transaction_reference = NetworkTransactionReferenceEntity.from_hash(hash['network_transaction_reference'])
  end
  authentication_result = CardAuthenticationResponse.from_hash(hash['authentication_result']) if
    hash['authentication_result']
  bin_details = BinDetails.from_hash(hash['bin_details']) if hash['bin_details']
  type = hash.key?('type') ? hash['type'] : SKIP
  network_token = hash.key?('network_token') ? hash['network_token'] : SKIP

  # Create object from extracted values.
  CardPaymentToken.new(name: name,
                       last_digits: last_digits,
                       brand: brand,
                       expiry: expiry,
                       billing_address: billing_address,
                       verification_status: verification_status,
                       verification: verification,
                       network_transaction_reference: network_transaction_reference,
                       authentication_result: authentication_result,
                       bin_details: bin_details,
                       type: type,
                       network_token: network_token)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['name'] = 'name'
  @_hash['last_digits'] = 'last_digits'
  @_hash['brand'] = 'brand'
  @_hash['expiry'] = 'expiry'
  @_hash['billing_address'] = 'billing_address'
  @_hash['verification_status'] = 'verification_status'
  @_hash['verification'] = 'verification'
  @_hash['network_transaction_reference'] =
    'network_transaction_reference'
  @_hash['authentication_result'] = 'authentication_result'
  @_hash['bin_details'] = 'bin_details'
  @_hash['type'] = 'type'
  @_hash['network_token'] = 'network_token'
  @_hash
end

.nullablesObject

An array for nullable fields



101
102
103
# File 'lib/paypal_server_sdk/models/card_payment_token.rb', line 101

def self.nullables
  []
end

.optionalsObject

An array for optional fields



83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# File 'lib/paypal_server_sdk/models/card_payment_token.rb', line 83

def self.optionals
  %w[
    name
    last_digits
    brand
    expiry
    billing_address
    verification_status
    verification
    network_transaction_reference
    authentication_result
    bin_details
    type
    network_token
  ]
end