Class: PaypalServerSdk::OrderAuthorizeRequestPaymentSource

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

Overview

The payment source definition.

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(card: SKIP, token: SKIP, paypal: SKIP, apple_pay: SKIP, google_pay: SKIP, venmo: SKIP) ⇒ OrderAuthorizeRequestPaymentSource

Returns a new instance of OrderAuthorizeRequestPaymentSource.



69
70
71
72
73
74
75
76
77
# File 'lib/paypal_server_sdk/models/order_authorize_request_payment_source.rb', line 69

def initialize(card: SKIP, token: SKIP, paypal: SKIP, apple_pay: SKIP,
               google_pay: SKIP, venmo: SKIP)
  @card = card unless card == SKIP
  @token = token unless token == 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_payApplePayRequest

Information needed to pay using ApplePay.

Returns:



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

def apple_pay
  @apple_pay
end

#cardCardRequest

The payment card to use to fund a payment. Can be a credit or debit card. Note: Passing card number, cvv and expiry directly via the API requires PCI SAQ D compliance. *PayPal offers a mechanism by which you do not have to take on the PCI SAQ D burden by using hosted fields - refer to this Integration Guide*.

Returns:



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

def card
  @card
end

#google_payGooglePayRequest

Information needed to pay using Google Pay.

Returns:



34
35
36
# File 'lib/paypal_server_sdk/models/order_authorize_request_payment_source.rb', line 34

def google_pay
  @google_pay
end

#paypalPaypalWallet

A resource that identifies a PayPal Wallet is used for payment.

Returns:



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

def paypal
  @paypal
end

#tokenToken

The tokenized payment source to fund a payment.

Returns:



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

def token
  @token
end

#venmoVenmoWalletRequest

Information needed to pay using Venmo.

Returns:



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

def venmo
  @venmo
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# File 'lib/paypal_server_sdk/models/order_authorize_request_payment_source.rb', line 80

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  card = CardRequest.from_hash(hash['card']) if hash['card']
  token = Token.from_hash(hash['token']) if hash['token']
  paypal = PaypalWallet.from_hash(hash['paypal']) if hash['paypal']
  apple_pay = ApplePayRequest.from_hash(hash['apple_pay']) if hash['apple_pay']
  google_pay = GooglePayRequest.from_hash(hash['google_pay']) if hash['google_pay']
  venmo = VenmoWalletRequest.from_hash(hash['venmo']) if hash['venmo']

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

.namesObject

A mapping from model property names to API property names.



41
42
43
44
45
46
47
48
49
50
# File 'lib/paypal_server_sdk/models/order_authorize_request_payment_source.rb', line 41

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

.nullablesObject

An array for nullable fields



65
66
67
# File 'lib/paypal_server_sdk/models/order_authorize_request_payment_source.rb', line 65

def self.nullables
  []
end

.optionalsObject

An array for optional fields



53
54
55
56
57
58
59
60
61
62
# File 'lib/paypal_server_sdk/models/order_authorize_request_payment_source.rb', line 53

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

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



108
109
110
111
112
113
# File 'lib/paypal_server_sdk/models/order_authorize_request_payment_source.rb', line 108

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} card: #{@card.inspect}, token: #{@token.inspect}, paypal:"\
  " #{@paypal.inspect}, apple_pay: #{@apple_pay.inspect}, google_pay: #{@google_pay.inspect},"\
  " venmo: #{@venmo.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



101
102
103
104
105
# File 'lib/paypal_server_sdk/models/order_authorize_request_payment_source.rb', line 101

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} card: #{@card}, token: #{@token}, paypal: #{@paypal}, apple_pay:"\
  " #{@apple_pay}, google_pay: #{@google_pay}, venmo: #{@venmo}>"
end