Class: PaypalServerSdk::ApplePayRequest

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

Overview

Information needed to pay using ApplePay.

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(id: SKIP, name: SKIP, email_address: SKIP, phone_number: SKIP, decrypted_token: SKIP, stored_credential: SKIP, vault_id: SKIP, attributes: SKIP, experience_context: SKIP) ⇒ ApplePayRequest

Returns a new instance of ApplePayRequest.



101
102
103
104
105
106
107
108
109
110
111
112
113
114
# File 'lib/paypal_server_sdk/models/apple_pay_request.rb', line 101

def initialize(id: SKIP, name: SKIP, email_address: SKIP,
               phone_number: SKIP, decrypted_token: SKIP,
               stored_credential: SKIP, vault_id: SKIP, attributes: SKIP,
               experience_context: SKIP)
  @id = id unless id == SKIP
  @name = name unless name == SKIP
  @email_address = email_address unless email_address == SKIP
  @phone_number = phone_number unless phone_number == SKIP
  @decrypted_token = decrypted_token unless decrypted_token == SKIP
  @stored_credential = stored_credential unless stored_credential == SKIP
  @vault_id = vault_id unless vault_id == SKIP
  @attributes = attributes unless attributes == SKIP
  @experience_context = experience_context unless experience_context == SKIP
end

Instance Attribute Details

#attributesApplePayAttributes

Additional attributes associated with apple pay.

Returns:



59
60
61
# File 'lib/paypal_server_sdk/models/apple_pay_request.rb', line 59

def attributes
  @attributes
end

#decrypted_tokenApplePayDecryptedTokenData

Information about the Payment data obtained by decrypting Apple Pay token.



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

def decrypted_token
  @decrypted_token
end

#email_addressString

The internationalized email address. Note: Up to 64 characters are allowed before and 255 characters are allowed after the @ sign. However, the generally accepted maximum length for an email address is 254 characters. The pattern verifies that an unquoted @ sign exists.

Returns:

  • (String)


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

def email_address
  @email_address
end

#experience_contextApplePayExperienceContext

Customizes the payer experience during the approval process for the payment.



64
65
66
# File 'lib/paypal_server_sdk/models/apple_pay_request.rb', line 64

def experience_context
  @experience_context
end

#idString

ApplePay transaction identifier, this will be the unique identifier for this transaction provided by Apple. The pattern is defined by an external party and supports Unicode.

Returns:

  • (String)


16
17
18
# File 'lib/paypal_server_sdk/models/apple_pay_request.rb', line 16

def id
  @id
end

#nameString

The full name representation like Mr J Smith.

Returns:

  • (String)


20
21
22
# File 'lib/paypal_server_sdk/models/apple_pay_request.rb', line 20

def name
  @name
end

#phone_numberPhoneNumber

The phone number in its canonical international [E.164 numbering plan format](www.itu.int/rec/T-REC-E.164/en).

Returns:



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

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



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

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)


55
56
57
# File 'lib/paypal_server_sdk/models/apple_pay_request.rb', line 55

def vault_id
  @vault_id
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
# File 'lib/paypal_server_sdk/models/apple_pay_request.rb', line 117

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  id = hash.key?('id') ? hash['id'] : SKIP
  name = hash.key?('name') ? hash['name'] : SKIP
  email_address = hash.key?('email_address') ? hash['email_address'] : SKIP
  phone_number = PhoneNumber.from_hash(hash['phone_number']) if hash['phone_number']
  decrypted_token = ApplePayDecryptedTokenData.from_hash(hash['decrypted_token']) if
    hash['decrypted_token']
  stored_credential = CardStoredCredential.from_hash(hash['stored_credential']) if
    hash['stored_credential']
  vault_id = hash.key?('vault_id') ? hash['vault_id'] : SKIP
  attributes = ApplePayAttributes.from_hash(hash['attributes']) if hash['attributes']
  experience_context = ApplePayExperienceContext.from_hash(hash['experience_context']) if
    hash['experience_context']

  # Create object from extracted values.
  ApplePayRequest.new(id: id,
                      name: name,
                      email_address: email_address,
                      phone_number: phone_number,
                      decrypted_token: decrypted_token,
                      stored_credential: stored_credential,
                      vault_id: vault_id,
                      attributes: attributes,
                      experience_context: experience_context)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['id'] = 'id'
  @_hash['name'] = 'name'
  @_hash['email_address'] = 'email_address'
  @_hash['phone_number'] = 'phone_number'
  @_hash['decrypted_token'] = 'decrypted_token'
  @_hash['stored_credential'] = 'stored_credential'
  @_hash['vault_id'] = 'vault_id'
  @_hash['attributes'] = 'attributes'
  @_hash['experience_context'] = 'experience_context'
  @_hash
end

.nullablesObject

An array for nullable fields



97
98
99
# File 'lib/paypal_server_sdk/models/apple_pay_request.rb', line 97

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    id
    name
    email_address
    phone_number
    decrypted_token
    stored_credential
    vault_id
    attributes
    experience_context
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



156
157
158
159
160
161
162
163
# File 'lib/paypal_server_sdk/models/apple_pay_request.rb', line 156

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} id: #{@id.inspect}, name: #{@name.inspect}, email_address:"\
  " #{@email_address.inspect}, phone_number: #{@phone_number.inspect}, decrypted_token:"\
  " #{@decrypted_token.inspect}, stored_credential: #{@stored_credential.inspect}, vault_id:"\
  " #{@vault_id.inspect}, attributes: #{@attributes.inspect}, experience_context:"\
  " #{@experience_context.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



147
148
149
150
151
152
153
# File 'lib/paypal_server_sdk/models/apple_pay_request.rb', line 147

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} id: #{@id}, name: #{@name}, email_address: #{@email_address}, phone_number:"\
  " #{@phone_number}, decrypted_token: #{@decrypted_token}, stored_credential:"\
  " #{@stored_credential}, vault_id: #{@vault_id}, attributes: #{@attributes},"\
  " experience_context: #{@experience_context}>"
end