Class: PaypalServerSdk::NetworkToken

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

Overview

The Third Party Network token used to fund a payment.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(number:, expiry:, cryptogram: SKIP, eci_flag: SKIP, token_requestor_id: SKIP) ⇒ NetworkToken

Returns a new instance of NetworkToken.



66
67
68
69
70
71
72
73
# File 'lib/paypal_server_sdk/models/network_token.rb', line 66

def initialize(number:, expiry:, cryptogram: SKIP, eci_flag: SKIP,
               token_requestor_id: SKIP)
  @number = number
  @expiry = expiry
  @cryptogram = cryptogram unless cryptogram == SKIP
  @eci_flag = eci_flag unless eci_flag == SKIP
  @token_requestor_id = token_requestor_id unless token_requestor_id == SKIP
end

Instance Attribute Details

#cryptogramString

An Encrypted one-time use value that’s sent along with Network Token. This field is not required to be present for recurring transactions.

Returns:

  • (String)


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

def cryptogram
  @cryptogram
end

#eci_flagECIFlag

Electronic Commerce Indicator (ECI). The ECI value is part of the 2 data elements that indicate the transaction was processed electronically. This should be passed on the authorization transaction to the Gateway/Processor.

Returns:



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

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


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

def expiry
  @expiry
end

#numberString

Third party network token number.

Returns:

  • (String)


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

def number
  @number
end

#token_requestor_idString

A TRID, or a Token Requestor ID, is an identifier used by merchants to request network tokens from card networks. A TRID is a precursor to obtaining a network token for a credit card primary account number (PAN), and will aid in enabling secure card on file (COF) payments and reducing fraud.

Returns:

  • (String)


39
40
41
# File 'lib/paypal_server_sdk/models/network_token.rb', line 39

def token_requestor_id
  @token_requestor_id
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# File 'lib/paypal_server_sdk/models/network_token.rb', line 76

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  number = hash.key?('number') ? hash['number'] : nil
  expiry = hash.key?('expiry') ? hash['expiry'] : nil
  cryptogram = hash.key?('cryptogram') ? hash['cryptogram'] : SKIP
  eci_flag = hash.key?('eci_flag') ? hash['eci_flag'] : SKIP
  token_requestor_id =
    hash.key?('token_requestor_id') ? hash['token_requestor_id'] : SKIP

  # Create object from extracted values.
  NetworkToken.new(number: number,
                   expiry: expiry,
                   cryptogram: cryptogram,
                   eci_flag: eci_flag,
                   token_requestor_id: token_requestor_id)
end

.namesObject

A mapping from model property names to API property names.



42
43
44
45
46
47
48
49
50
# File 'lib/paypal_server_sdk/models/network_token.rb', line 42

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['number'] = 'number'
  @_hash['expiry'] = 'expiry'
  @_hash['cryptogram'] = 'cryptogram'
  @_hash['eci_flag'] = 'eci_flag'
  @_hash['token_requestor_id'] = 'token_requestor_id'
  @_hash
end

.nullablesObject

An array for nullable fields



62
63
64
# File 'lib/paypal_server_sdk/models/network_token.rb', line 62

def self.nullables
  []
end

.optionalsObject

An array for optional fields



53
54
55
56
57
58
59
# File 'lib/paypal_server_sdk/models/network_token.rb', line 53

def self.optionals
  %w[
    cryptogram
    eci_flag
    token_requestor_id
  ]
end