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

#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.



127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
# File 'lib/paypal_server_sdk/models/payment_source.rb', line 127

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:



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

def apple_pay
  @apple_pay
end

#bancontactBancontactPaymentRequest

Information needed to pay using Bancontact.



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

def bancontact
  @bancontact
end

#blikBlikPaymentRequest

Information needed to pay using BLIK.

Returns:



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

def blik
  @blik
end

#cardCardRequest

The payment card to use to fund a payment. Can be a credit or debit card.<blockquote><strong>Note:</strong> Passing card number, cvv and expiry directly via the API requires <a href=“www.pcisecuritystandards.org/pci_security/completing_self_as sessment”> PCI SAQ D compliance</a>.
*PayPal offers a mechanism by which you do not have to take on the <strong>PCI SAQ D</strong> burden by using hosted fields - refer to <a href=“developer.paypal.com/docs/checkout/advanced/integrate/”>this Integration Guide</a>*.</blockquote>

Returns:



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

def card
  @card
end

#epsEpsPaymentRequest

Information needed to pay using eps.

Returns:



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

def eps
  @eps
end

#giropayGiropayPaymentRequest

Information needed to pay using giropay.



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

def giropay
  @giropay
end

#google_payGooglePayRequest

Information needed to pay using Google Pay.

Returns:



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

def google_pay
  @google_pay
end

#idealIdealPaymentRequest

Information needed to pay using iDEAL.

Returns:



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

def ideal
  @ideal
end

#mybankMybankPaymentRequest

Information needed to pay using MyBank.



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

def mybank
  @mybank
end

#p24P24PaymentRequest

Information needed to pay using P24 (Przelewy24).

Returns:



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

def p24
  @p24
end

#paypalPaypalWallet

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

Returns:



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

def paypal
  @paypal
end

#sofortSofortPaymentRequest

Information needed to pay using Sofort.



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

def sofort
  @sofort
end

#tokenToken

The tokenized payment source to fund a payment.

Returns:



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

def token
  @token
end

#trustlyTrustlyPaymentRequest

Information needed to pay using Trustly.



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

def trustly
  @trustly
end

#venmoVenmoWalletRequest

Information needed to pay using Venmo.

Returns:



78
79
80
# File 'lib/paypal_server_sdk/models/payment_source.rb', line 78

def venmo
  @venmo
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
182
183
184
185
# File 'lib/paypal_server_sdk/models/payment_source.rb', line 149

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.



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

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



123
124
125
# File 'lib/paypal_server_sdk/models/payment_source.rb', line 123

def self.nullables
  []
end

.optionalsObject

An array for optional fields



102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
# File 'lib/paypal_server_sdk/models/payment_source.rb', line 102

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