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

#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) ⇒ ApplePayRequest

Returns a new instance of ApplePayRequest.



97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/paypal_server_sdk/models/apple_pay_request.rb', line 97

def initialize(id: SKIP, name: SKIP, email_address: SKIP,
               phone_number: SKIP, decrypted_token: SKIP,
               stored_credential: SKIP, vault_id: SKIP, attributes: 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
end

Instance Attribute Details

#attributesApplePayAttributes

Additional attributes associated with apple pay.

Returns:



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

def attributes
  @attributes
end

#decrypted_tokenApplePayDecryptedTokenData

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



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

def decrypted_token
  @decrypted_token
end

#email_addressString

The internationalized email address.<blockquote><strong>Note:</strong> 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.</blockquote>

Returns:

  • (String)


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

def email_address
  @email_address
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:



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

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



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

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)


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

def vault_id
  @vault_id
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
# File 'lib/paypal_server_sdk/models/apple_pay_request.rb', line 111

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']

  # 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)
end

.namesObject

A mapping from model property names to API property names.



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

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
end

.nullablesObject

An array for nullable fields



93
94
95
# File 'lib/paypal_server_sdk/models/apple_pay_request.rb', line 93

def self.nullables
  []
end

.optionalsObject

An array for optional fields



79
80
81
82
83
84
85
86
87
88
89
90
# File 'lib/paypal_server_sdk/models/apple_pay_request.rb', line 79

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