Class: PaypalServerSdk::PaymentSource

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/paypal_server_sdk/models/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, bancontact: SKIP, blik: SKIP, eps: SKIP, giropay: SKIP, ideal: SKIP, mybank: SKIP, p24: SKIP, sofort: SKIP, trustly: SKIP, apple_pay: SKIP, google_pay: SKIP, venmo: SKIP) ⇒ PaymentSource

Returns a new instance of PaymentSource.



123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
# File 'lib/paypal_server_sdk/models/payment_source.rb', line 123

def initialize(card: SKIP, token: SKIP, paypal: SKIP, bancontact: SKIP,
               blik: SKIP, eps: SKIP, giropay: SKIP, ideal: SKIP,
               mybank: SKIP, p24: SKIP, sofort: SKIP, trustly: SKIP,
               apple_pay: SKIP, google_pay: SKIP, venmo: SKIP)
  @card = card unless card == SKIP
  @token = token unless token == SKIP
  @paypal = paypal unless paypal == SKIP
  @bancontact = bancontact unless bancontact == SKIP
  @blik = blik unless blik == SKIP
  @eps = eps unless eps == SKIP
  @giropay = giropay unless giropay == SKIP
  @ideal = ideal unless ideal == SKIP
  @mybank = mybank unless mybank == SKIP
  @p24 = p24 unless p24 == SKIP
  @sofort = sofort unless sofort == SKIP
  @trustly = trustly unless trustly == 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:



66
67
68
# File 'lib/paypal_server_sdk/models/payment_source.rb', line 66

def apple_pay
  @apple_pay
end

#bancontactBancontactPaymentRequest

Information needed to pay using Bancontact.



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

def bancontact
  @bancontact
end

#blikBlikPaymentRequest

Information needed to pay using BLIK.

Returns:



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

def blik
  @blik
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/payment_source.rb', line 18

def card
  @card
end

#epsEpsPaymentRequest

Information needed to pay using eps.

Returns:



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

def eps
  @eps
end

#giropayGiropayPaymentRequest

Information needed to pay using giropay.



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

def giropay
  @giropay
end

#google_payGooglePayRequest

Information needed to pay using Google Pay.

Returns:



70
71
72
# File 'lib/paypal_server_sdk/models/payment_source.rb', line 70

def google_pay
  @google_pay
end

#idealIdealPaymentRequest

Information needed to pay using iDEAL.

Returns:



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

def ideal
  @ideal
end

#mybankMybankPaymentRequest

Information needed to pay using MyBank.



50
51
52
# File 'lib/paypal_server_sdk/models/payment_source.rb', line 50

def mybank
  @mybank
end

#p24P24PaymentRequest

Information needed to pay using P24 (Przelewy24).

Returns:



54
55
56
# File 'lib/paypal_server_sdk/models/payment_source.rb', line 54

def p24
  @p24
end

#paypalPaypalWallet

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

Returns:



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

def paypal
  @paypal
end

#sofortSofortPaymentRequest

Information needed to pay using Sofort.



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

def sofort
  @sofort
end

#tokenToken

The tokenized payment source to fund a payment.

Returns:



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

def token
  @token
end

#trustlyTrustlyPaymentRequest

Information needed to pay using Trustly.



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

def trustly
  @trustly
end

#venmoVenmoWalletRequest

Information needed to pay using Venmo.

Returns:



74
75
76
# File 'lib/paypal_server_sdk/models/payment_source.rb', line 74

def venmo
  @venmo
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
# File 'lib/paypal_server_sdk/models/payment_source.rb', line 145

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']
  bancontact = BancontactPaymentRequest.from_hash(hash['bancontact']) if hash['bancontact']
  blik = BlikPaymentRequest.from_hash(hash['blik']) if hash['blik']
  eps = EpsPaymentRequest.from_hash(hash['eps']) if hash['eps']
  giropay = GiropayPaymentRequest.from_hash(hash['giropay']) if hash['giropay']
  ideal = IdealPaymentRequest.from_hash(hash['ideal']) if hash['ideal']
  mybank = MybankPaymentRequest.from_hash(hash['mybank']) if hash['mybank']
  p24 = P24PaymentRequest.from_hash(hash['p24']) if hash['p24']
  sofort = SofortPaymentRequest.from_hash(hash['sofort']) if hash['sofort']
  trustly = TrustlyPaymentRequest.from_hash(hash['trustly']) if hash['trustly']
  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.
  PaymentSource.new(card: card,
                    token: token,
                    paypal: paypal,
                    bancontact: bancontact,
                    blik: blik,
                    eps: eps,
                    giropay: giropay,
                    ideal: ideal,
                    mybank: mybank,
                    p24: p24,
                    sofort: sofort,
                    trustly: trustly,
                    apple_pay: apple_pay,
                    google_pay: google_pay,
                    venmo: venmo)
end

.namesObject

A mapping from model property names to API property names.



77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# File 'lib/paypal_server_sdk/models/payment_source.rb', line 77

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['card'] = 'card'
  @_hash['token'] = 'token'
  @_hash['paypal'] = 'paypal'
  @_hash['bancontact'] = 'bancontact'
  @_hash['blik'] = 'blik'
  @_hash['eps'] = 'eps'
  @_hash['giropay'] = 'giropay'
  @_hash['ideal'] = 'ideal'
  @_hash['mybank'] = 'mybank'
  @_hash['p24'] = 'p24'
  @_hash['sofort'] = 'sofort'
  @_hash['trustly'] = 'trustly'
  @_hash['apple_pay'] = 'apple_pay'
  @_hash['google_pay'] = 'google_pay'
  @_hash['venmo'] = 'venmo'
  @_hash
end

.nullablesObject

An array for nullable fields



119
120
121
# File 'lib/paypal_server_sdk/models/payment_source.rb', line 119

def self.nullables
  []
end

.optionalsObject

An array for optional fields



98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# File 'lib/paypal_server_sdk/models/payment_source.rb', line 98

def self.optionals
  %w[
    card
    token
    paypal
    bancontact
    blik
    eps
    giropay
    ideal
    mybank
    p24
    sofort
    trustly
    apple_pay
    google_pay
    venmo
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



193
194
195
196
197
198
199
200
201
# File 'lib/paypal_server_sdk/models/payment_source.rb', line 193

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} card: #{@card.inspect}, token: #{@token.inspect}, paypal:"\
  " #{@paypal.inspect}, bancontact: #{@bancontact.inspect}, blik: #{@blik.inspect}, eps:"\
  " #{@eps.inspect}, giropay: #{@giropay.inspect}, ideal: #{@ideal.inspect}, mybank:"\
  " #{@mybank.inspect}, p24: #{@p24.inspect}, sofort: #{@sofort.inspect}, trustly:"\
  " #{@trustly.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.



184
185
186
187
188
189
190
# File 'lib/paypal_server_sdk/models/payment_source.rb', line 184

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} card: #{@card}, token: #{@token}, paypal: #{@paypal}, bancontact:"\
  " #{@bancontact}, blik: #{@blik}, eps: #{@eps}, giropay: #{@giropay}, ideal: #{@ideal},"\
  " mybank: #{@mybank}, p24: #{@p24}, sofort: #{@sofort}, trustly: #{@trustly}, apple_pay:"\
  " #{@apple_pay}, google_pay: #{@google_pay}, venmo: #{@venmo}>"
end