Class: PaypalServerSdk::OrderAuthorizeResponsePaymentSource

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

Overview

The payment source used to fund the payment.

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, apple_pay: SKIP, google_pay: SKIP, venmo: SKIP) ⇒ OrderAuthorizeResponsePaymentSource

Returns a new instance of OrderAuthorizeResponsePaymentSource.



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

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

Instance Attribute Details

#apple_payApplePayPaymentObject

Information needed to pay using ApplePay.



23
24
25
# File 'lib/paypal_server_sdk/models/order_authorize_response_payment_source.rb', line 23

def apple_pay
  @apple_pay
end

#cardCardResponse

The payment card to use to fund a payment. Card can be a credit or debit card.

Returns:



15
16
17
# File 'lib/paypal_server_sdk/models/order_authorize_response_payment_source.rb', line 15

def card
  @card
end

#google_payGooglePayWalletResponse

Google Pay Wallet payment data.



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

def google_pay
  @google_pay
end

#paypalPaypalWalletResponse

The PayPal Wallet response.



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

def paypal
  @paypal
end

#venmoVenmoWalletResponse

Venmo wallet response.

Returns:



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

def venmo
  @venmo
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  card = CardResponse.from_hash(hash['card']) if hash['card']
  paypal = PaypalWalletResponse.from_hash(hash['paypal']) if hash['paypal']
  apple_pay = ApplePayPaymentObject.from_hash(hash['apple_pay']) if hash['apple_pay']
  google_pay = GooglePayWalletResponse.from_hash(hash['google_pay']) if hash['google_pay']
  venmo = VenmoWalletResponse.from_hash(hash['venmo']) if hash['venmo']

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

.namesObject

A mapping from model property names to API property names.



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

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

.nullablesObject

An array for nullable fields



56
57
58
# File 'lib/paypal_server_sdk/models/order_authorize_response_payment_source.rb', line 56

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

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