Class: PaypalServerSdk::ApplePayPaymentObject

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/paypal_server_sdk/models/apple_pay_payment_object.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, token: SKIP, name: SKIP, email_address: SKIP, phone_number: SKIP, card: SKIP, attributes: SKIP, stored_credential: SKIP) ⇒ ApplePayPaymentObject

Returns a new instance of ApplePayPaymentObject.



94
95
96
97
98
99
100
101
102
103
104
105
# File 'lib/paypal_server_sdk/models/apple_pay_payment_object.rb', line 94

def initialize(id: SKIP, token: SKIP, name: SKIP, email_address: SKIP,
               phone_number: SKIP, card: SKIP, attributes: SKIP,
               stored_credential: SKIP)
  @id = id unless id == SKIP
  @token = token unless token == SKIP
  @name = name unless name == SKIP
  @email_address = email_address unless email_address == SKIP
  @phone_number = phone_number unless phone_number == SKIP
  @card = card unless card == SKIP
  @attributes = attributes unless attributes == SKIP
  @stored_credential = stored_credential unless stored_credential == SKIP
end

Instance Attribute Details

#attributesApplePayAttributesResponse

Additional attributes associated with the use of Apple Pay.



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

def attributes
  @attributes
end

#cardApplePayCardResponse

The Card from Apple Pay Wallet used to fund the payment.



42
43
44
# File 'lib/paypal_server_sdk/models/apple_pay_payment_object.rb', line 42

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


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

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_payment_object.rb', line 16

def id
  @id
end

#nameString

The full name representation like Mr J Smith.

Returns:

  • (String)


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

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:



38
39
40
# File 'lib/paypal_server_sdk/models/apple_pay_payment_object.rb', line 38

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.



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

def stored_credential
  @stored_credential
end

#tokenString

Encrypted ApplePay token, containing card information. This token would be base64encoded. The pattern is defined by an external party and supports Unicode.

Returns:

  • (String)


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

def token
  @token
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
# File 'lib/paypal_server_sdk/models/apple_pay_payment_object.rb', line 108

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  id = hash.key?('id') ? hash['id'] : SKIP
  token = hash.key?('token') ? hash['token'] : 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']
  card = ApplePayCardResponse.from_hash(hash['card']) if hash['card']
  attributes = ApplePayAttributesResponse.from_hash(hash['attributes']) if hash['attributes']
  stored_credential = CardStoredCredential.from_hash(hash['stored_credential']) if
    hash['stored_credential']

  # Create object from extracted values.
  ApplePayPaymentObject.new(id: id,
                            token: token,
                            name: name,
                            email_address: email_address,
                            phone_number: phone_number,
                            card: card,
                            attributes: attributes,
                            stored_credential: stored_credential)
end

.namesObject

A mapping from model property names to API property names.



62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/paypal_server_sdk/models/apple_pay_payment_object.rb', line 62

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

.nullablesObject

An array for nullable fields



90
91
92
# File 'lib/paypal_server_sdk/models/apple_pay_payment_object.rb', line 90

def self.nullables
  []
end

.optionalsObject

An array for optional fields



76
77
78
79
80
81
82
83
84
85
86
87
# File 'lib/paypal_server_sdk/models/apple_pay_payment_object.rb', line 76

def self.optionals
  %w[
    id
    token
    name
    email_address
    phone_number
    card
    attributes
    stored_credential
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



142
143
144
145
146
147
148
# File 'lib/paypal_server_sdk/models/apple_pay_payment_object.rb', line 142

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

#to_sObject

Provides a human-readable string representation of the object.



134
135
136
137
138
139
# File 'lib/paypal_server_sdk/models/apple_pay_payment_object.rb', line 134

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