Class: PaypalServerSdk::PaymentTokenResponsePaymentSource

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

Overview

The vaulted payment method details.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(card: SKIP, paypal: SKIP, venmo: SKIP, apple_pay: SKIP, bank: SKIP) ⇒ PaymentTokenResponsePaymentSource

Returns a new instance of PaymentTokenResponsePaymentSource.



59
60
61
62
63
64
65
66
# File 'lib/paypal_server_sdk/models/payment_token_response_payment_source.rb', line 59

def initialize(card: SKIP, paypal: SKIP, venmo: SKIP, apple_pay: SKIP,
               bank: SKIP)
  @card = card unless card == SKIP
  @paypal = paypal unless paypal == SKIP
  @venmo = venmo unless venmo == SKIP
  @apple_pay = apple_pay unless apple_pay == SKIP
  @bank = bank unless bank == SKIP
end

Instance Attribute Details

#apple_payApplePayPaymentToken

A resource representing a response for Apple Pay.



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

def apple_pay
  @apple_pay
end

#bankHash

Full representation of a Bank Payment Token.

Returns:

  • (Hash)


30
31
32
# File 'lib/paypal_server_sdk/models/payment_token_response_payment_source.rb', line 30

def bank
  @bank
end

#cardCardPaymentToken

Full representation of a Card Payment Token including network token.

Returns:



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

def card
  @card
end

#paypalPaypalPaymentToken

Full representation of a Card Payment Token including network token.

Returns:



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

def paypal
  @paypal
end

#venmoVenmoPaymentToken

Full representation of a Card Payment Token including network token.

Returns:



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

def venmo
  @venmo
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'lib/paypal_server_sdk/models/payment_token_response_payment_source.rb', line 69

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  card = CardPaymentToken.from_hash(hash['card']) if hash['card']
  paypal = PaypalPaymentToken.from_hash(hash['paypal']) if hash['paypal']
  venmo = VenmoPaymentToken.from_hash(hash['venmo']) if hash['venmo']
  apple_pay = ApplePayPaymentToken.from_hash(hash['apple_pay']) if hash['apple_pay']
  bank = hash.key?('bank') ? hash['bank'] : SKIP

  # Create object from extracted values.
  PaymentTokenResponsePaymentSource.new(card: card,
                                        paypal: paypal,
                                        venmo: venmo,
                                        apple_pay: apple_pay,
                                        bank: bank)
end

.namesObject

A mapping from model property names to API property names.



33
34
35
36
37
38
39
40
41
# File 'lib/paypal_server_sdk/models/payment_token_response_payment_source.rb', line 33

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['card'] = 'card'
  @_hash['paypal'] = 'paypal'
  @_hash['venmo'] = 'venmo'
  @_hash['apple_pay'] = 'apple_pay'
  @_hash['bank'] = 'bank'
  @_hash
end

.nullablesObject

An array for nullable fields



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

def self.nullables
  []
end

.optionalsObject

An array for optional fields



44
45
46
47
48
49
50
51
52
# File 'lib/paypal_server_sdk/models/payment_token_response_payment_source.rb', line 44

def self.optionals
  %w[
    card
    paypal
    venmo
    apple_pay
    bank
  ]
end