paypal-server-sdk 0.6.0 → 0.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -9,14 +9,23 @@ module PaypalServerSdk
9
9
  # Shows details for an authorized payment, by ID.
10
10
  # @param [String] authorization_id Required parameter: The ID of the
11
11
  # authorized payment for which to show details.
12
+ # @param [String] paypal_auth_assertion Optional parameter: An
13
+ # API-caller-provided JSON Web Token (JWT) assertion that identifies the
14
+ # merchant. For details, see
15
+ # [PayPal-Auth-Assertion](/docs/api/reference/api-requests/#paypal-auth-asse
16
+ # rtion).<blockquote><strong>Note:</strong>For three party transactions in
17
+ # which a partner is managing the API calls on behalf of a merchant, the
18
+ # partner must identify the merchant using either a PayPal-Auth-Assertion
19
+ # header or an access token with target_subject.</blockquote>
12
20
  # @return [ApiResponse] the complete http response with raw body and status code.
13
- def authorizations_get(authorization_id)
21
+ def authorizations_get(options = {})
14
22
  new_api_call_builder
15
23
  .request(new_request_builder(HttpMethodEnum::GET,
16
24
  '/v2/payments/authorizations/{authorization_id}',
17
25
  Server::DEFAULT)
18
- .template_param(new_parameter(authorization_id, key: 'authorization_id')
26
+ .template_param(new_parameter(options['authorization_id'], key: 'authorization_id')
19
27
  .should_encode(true))
28
+ .header_param(new_parameter(options['paypal_auth_assertion'], key: 'PayPal-Auth-Assertion'))
20
29
  .header_param(new_parameter('application/json', key: 'accept'))
21
30
  .auth(Single.new('Oauth2')))
22
31
  .response(new_response_handler
@@ -27,10 +36,6 @@ module PaypalServerSdk
27
36
  'Authentication failed due to missing authorization header, or'\
28
37
  ' invalid authentication credentials.',
29
38
  ErrorException)
30
- .local_error('403',
31
- 'The request failed because the caller has insufficient'\
32
- ' permissions.',
33
- ErrorException)
34
39
  .local_error('404',
35
40
  'The request failed because the resource does not exist.',
36
41
  ErrorException)
@@ -56,6 +61,14 @@ module PaypalServerSdk
56
61
  # HATEOAS links.</li><li><code>return=representation</code>. The server
57
62
  # returns a complete resource representation, including the current state of
58
63
  # the resource.</li></ul>
64
+ # @param [String] paypal_auth_assertion Optional parameter: An
65
+ # API-caller-provided JSON Web Token (JWT) assertion that identifies the
66
+ # merchant. For details, see
67
+ # [PayPal-Auth-Assertion](/docs/api/reference/api-requests/#paypal-auth-asse
68
+ # rtion).<blockquote><strong>Note:</strong>For three party transactions in
69
+ # which a partner is managing the API calls on behalf of a merchant, the
70
+ # partner must identify the merchant using either a PayPal-Auth-Assertion
71
+ # header or an access token with target_subject.</blockquote>
59
72
  # @param [CaptureRequest] body Optional parameter: Example:
60
73
  # @return [ApiResponse] the complete http response with raw body and status code.
61
74
  def authorizations_capture(options = {})
@@ -68,6 +81,7 @@ module PaypalServerSdk
68
81
  .header_param(new_parameter('application/json', key: 'Content-Type'))
69
82
  .header_param(new_parameter(options['paypal_request_id'], key: 'PayPal-Request-Id'))
70
83
  .header_param(new_parameter(options['prefer'], key: 'Prefer'))
84
+ .header_param(new_parameter(options['paypal_auth_assertion'], key: 'PayPal-Auth-Assertion'))
71
85
  .body_param(new_parameter(options['body']))
72
86
  .header_param(new_parameter('application/json', key: 'accept'))
73
87
  .body_serializer(proc do |param| param.to_json unless param.nil? end)
@@ -108,18 +122,24 @@ module PaypalServerSdk
108
122
  .execute
109
123
  end
110
124
 
111
- # Voids, or cancels, an authorized payment, by ID. You cannot void an
112
- # authorized payment that has been fully captured.
125
+ # Reauthorizes an authorized PayPal account payment, by ID. To ensure that
126
+ # funds are still available, reauthorize a payment after its initial
127
+ # three-day honor period expires. Within the 29-day authorization period,
128
+ # you can issue multiple re-authorizations after the honor period
129
+ # expires.<br/><br/>If 30 days have transpired since the date of the
130
+ # original authorization, you must create an authorized payment instead of
131
+ # reauthorizing the original authorized payment.<br/><br/>A reauthorized
132
+ # payment itself has a new honor period of three days.<br/><br/>You can
133
+ # reauthorize an authorized payment from 4 to 29 days after the 3-day honor
134
+ # period. The allowed amount depends on context and geography, for example
135
+ # in US it is up to 115% of the original authorized amount, not to exceed an
136
+ # increase of $75 USD.<br/><br/>Supports only the `amount` request
137
+ # parameter.<blockquote><strong>Note:</strong> This request is currently not
138
+ # supported for Partner use cases.</blockquote>
113
139
  # @param [String] authorization_id Required parameter: The PayPal-generated
114
- # ID for the authorized payment to void.
115
- # @param [String] paypal_auth_assertion Optional parameter: An
116
- # API-caller-provided JSON Web Token (JWT) assertion that identifies the
117
- # merchant. For details, see
118
- # [PayPal-Auth-Assertion](/docs/api/reference/api-requests/#paypal-auth-asse
119
- # rtion).<blockquote><strong>Note:</strong>For three party transactions in
120
- # which a partner is managing the API calls on behalf of a merchant, the
121
- # partner must identify the merchant using either a PayPal-Auth-Assertion
122
- # header or an access token with target_subject.</blockquote>
140
+ # ID for the authorized payment to reauthorize.
141
+ # @param [String] paypal_request_id Optional parameter: The server stores
142
+ # keys for 45 days.
123
143
  # @param [String] prefer Optional parameter: The preferred server response
124
144
  # upon successful completion of the request. Value
125
145
  # is:<ul><li><code>return=minimal</code>. The server returns a minimal
@@ -128,20 +148,32 @@ module PaypalServerSdk
128
148
  # HATEOAS links.</li><li><code>return=representation</code>. The server
129
149
  # returns a complete resource representation, including the current state of
130
150
  # the resource.</li></ul>
151
+ # @param [String] paypal_auth_assertion Optional parameter: An
152
+ # API-caller-provided JSON Web Token (JWT) assertion that identifies the
153
+ # merchant. For details, see
154
+ # [PayPal-Auth-Assertion](/docs/api/reference/api-requests/#paypal-auth-asse
155
+ # rtion).<blockquote><strong>Note:</strong>For three party transactions in
156
+ # which a partner is managing the API calls on behalf of a merchant, the
157
+ # partner must identify the merchant using either a PayPal-Auth-Assertion
158
+ # header or an access token with target_subject.</blockquote>
159
+ # @param [ReauthorizeRequest] body Optional parameter: Example:
131
160
  # @return [ApiResponse] the complete http response with raw body and status code.
132
- def authorizations_void(options = {})
161
+ def authorizations_reauthorize(options = {})
133
162
  new_api_call_builder
134
163
  .request(new_request_builder(HttpMethodEnum::POST,
135
- '/v2/payments/authorizations/{authorization_id}/void',
164
+ '/v2/payments/authorizations/{authorization_id}/reauthorize',
136
165
  Server::DEFAULT)
137
166
  .template_param(new_parameter(options['authorization_id'], key: 'authorization_id')
138
167
  .should_encode(true))
139
- .header_param(new_parameter(options['paypal_auth_assertion'], key: 'PayPal-Auth-Assertion'))
168
+ .header_param(new_parameter('application/json', key: 'Content-Type'))
169
+ .header_param(new_parameter(options['paypal_request_id'], key: 'PayPal-Request-Id'))
140
170
  .header_param(new_parameter(options['prefer'], key: 'Prefer'))
171
+ .header_param(new_parameter(options['paypal_auth_assertion'], key: 'PayPal-Auth-Assertion'))
172
+ .body_param(new_parameter(options['body']))
141
173
  .header_param(new_parameter('application/json', key: 'accept'))
174
+ .body_serializer(proc do |param| param.to_json unless param.nil? end)
142
175
  .auth(Single.new('Oauth2')))
143
176
  .response(new_response_handler
144
- .is_nullable_response(true)
145
177
  .deserializer(APIHelper.method(:custom_type_deserializer))
146
178
  .deserialize_into(PaymentAuthorization.method(:from_hash))
147
179
  .is_api_response(true)
@@ -153,17 +185,9 @@ module PaypalServerSdk
153
185
  'Authentication failed due to missing authorization header, or'\
154
186
  ' invalid authentication credentials.',
155
187
  ErrorException)
156
- .local_error('403',
157
- 'The request failed because the caller has insufficient'\
158
- ' permissions.',
159
- ErrorException)
160
188
  .local_error('404',
161
189
  'The request failed because the resource does not exist.',
162
190
  ErrorException)
163
- .local_error('409',
164
- 'The request failed because a previous call for the given'\
165
- ' resource is in progress.',
166
- ErrorException)
167
191
  .local_error('422',
168
192
  'The request failed because it either is semantically incorrect'\
169
193
  ' or failed business validation.',
@@ -177,22 +201,18 @@ module PaypalServerSdk
177
201
  .execute
178
202
  end
179
203
 
180
- # Reauthorizes an authorized PayPal account payment, by ID. To ensure that
181
- # funds are still available, reauthorize a payment after its initial
182
- # three-day honor period expires. Within the 29-day authorization period,
183
- # you can issue multiple re-authorizations after the honor period
184
- # expires.<br/><br/>If 30 days have transpired since the date of the
185
- # original authorization, you must create an authorized payment instead of
186
- # reauthorizing the original authorized payment.<br/><br/>A reauthorized
187
- # payment itself has a new honor period of three days.<br/><br/>You can
188
- # reauthorize an authorized payment from 4 to 29 days after the 3-day honor
189
- # period. The allowed amount depends on context and geography, for example
190
- # in US it is up to 115% of the original authorized amount, not to exceed an
191
- # increase of $75 USD.<br/><br/>Supports only the `amount` request
192
- # parameter.<blockquote><strong>Note:</strong> This request is currently not
193
- # supported for Partner use cases.</blockquote>
204
+ # Voids, or cancels, an authorized payment, by ID. You cannot void an
205
+ # authorized payment that has been fully captured.
194
206
  # @param [String] authorization_id Required parameter: The PayPal-generated
195
- # ID for the authorized payment to reauthorize.
207
+ # ID for the authorized payment to void.
208
+ # @param [String] paypal_auth_assertion Optional parameter: An
209
+ # API-caller-provided JSON Web Token (JWT) assertion that identifies the
210
+ # merchant. For details, see
211
+ # [PayPal-Auth-Assertion](/docs/api/reference/api-requests/#paypal-auth-asse
212
+ # rtion).<blockquote><strong>Note:</strong>For three party transactions in
213
+ # which a partner is managing the API calls on behalf of a merchant, the
214
+ # partner must identify the merchant using either a PayPal-Auth-Assertion
215
+ # header or an access token with target_subject.</blockquote>
196
216
  # @param [String] paypal_request_id Optional parameter: The server stores
197
217
  # keys for 45 days.
198
218
  # @param [String] prefer Optional parameter: The preferred server response
@@ -203,30 +223,24 @@ module PaypalServerSdk
203
223
  # HATEOAS links.</li><li><code>return=representation</code>. The server
204
224
  # returns a complete resource representation, including the current state of
205
225
  # the resource.</li></ul>
206
- # @param [ReauthorizeRequest] body Optional parameter: Example:
207
226
  # @return [ApiResponse] the complete http response with raw body and status code.
208
- def authorizations_reauthorize(options = {})
227
+ def authorizations_void(options = {})
209
228
  new_api_call_builder
210
229
  .request(new_request_builder(HttpMethodEnum::POST,
211
- '/v2/payments/authorizations/{authorization_id}/reauthorize',
230
+ '/v2/payments/authorizations/{authorization_id}/void',
212
231
  Server::DEFAULT)
213
232
  .template_param(new_parameter(options['authorization_id'], key: 'authorization_id')
214
233
  .should_encode(true))
215
- .header_param(new_parameter('application/json', key: 'Content-Type'))
234
+ .header_param(new_parameter(options['paypal_auth_assertion'], key: 'PayPal-Auth-Assertion'))
216
235
  .header_param(new_parameter(options['paypal_request_id'], key: 'PayPal-Request-Id'))
217
236
  .header_param(new_parameter(options['prefer'], key: 'Prefer'))
218
- .body_param(new_parameter(options['body']))
219
237
  .header_param(new_parameter('application/json', key: 'accept'))
220
- .body_serializer(proc do |param| param.to_json unless param.nil? end)
221
238
  .auth(Single.new('Oauth2')))
222
239
  .response(new_response_handler
240
+ .is_nullable_response(true)
223
241
  .deserializer(APIHelper.method(:custom_type_deserializer))
224
242
  .deserialize_into(PaymentAuthorization.method(:from_hash))
225
243
  .is_api_response(true)
226
- .local_error('400',
227
- 'The request failed because it is not well-formed or is'\
228
- ' syntactically incorrect or violates schema.',
229
- ErrorException)
230
244
  .local_error('401',
231
245
  'Authentication failed due to missing authorization header, or'\
232
246
  ' invalid authentication credentials.',
@@ -238,6 +252,10 @@ module PaypalServerSdk
238
252
  .local_error('404',
239
253
  'The request failed because the resource does not exist.',
240
254
  ErrorException)
255
+ .local_error('409',
256
+ 'The request failed because a previous call for the given'\
257
+ ' resource is in progress.',
258
+ ErrorException)
241
259
  .local_error('422',
242
260
  'The request failed because it either is semantically incorrect'\
243
261
  ' or failed business validation.',
@@ -367,14 +385,23 @@ module PaypalServerSdk
367
385
  # Shows details for a refund, by ID.
368
386
  # @param [String] refund_id Required parameter: The PayPal-generated ID for
369
387
  # the refund for which to show details.
388
+ # @param [String] paypal_auth_assertion Optional parameter: An
389
+ # API-caller-provided JSON Web Token (JWT) assertion that identifies the
390
+ # merchant. For details, see
391
+ # [PayPal-Auth-Assertion](/docs/api/reference/api-requests/#paypal-auth-asse
392
+ # rtion).<blockquote><strong>Note:</strong>For three party transactions in
393
+ # which a partner is managing the API calls on behalf of a merchant, the
394
+ # partner must identify the merchant using either a PayPal-Auth-Assertion
395
+ # header or an access token with target_subject.</blockquote>
370
396
  # @return [ApiResponse] the complete http response with raw body and status code.
371
- def refunds_get(refund_id)
397
+ def refunds_get(options = {})
372
398
  new_api_call_builder
373
399
  .request(new_request_builder(HttpMethodEnum::GET,
374
400
  '/v2/payments/refunds/{refund_id}',
375
401
  Server::DEFAULT)
376
- .template_param(new_parameter(refund_id, key: 'refund_id')
402
+ .template_param(new_parameter(options['refund_id'], key: 'refund_id')
377
403
  .should_encode(true))
404
+ .header_param(new_parameter(options['paypal_auth_assertion'], key: 'PayPal-Auth-Assertion'))
378
405
  .header_param(new_parameter('application/json', key: 'accept'))
379
406
  .auth(Single.new('Oauth2')))
380
407
  .response(new_response_handler
@@ -6,6 +6,48 @@
6
6
  module PaypalServerSdk
7
7
  # VaultController
8
8
  class VaultController < BaseController
9
+ # Creates a Payment Token from the given payment source and adds it to the
10
+ # Vault of the associated customer.
11
+ # @param [String] paypal_request_id Required parameter: The server stores
12
+ # keys for 3 hours.
13
+ # @param [PaymentTokenRequest] body Required parameter: Payment Token
14
+ # creation with a financial instrument and an optional customer_id.
15
+ # @return [ApiResponse] the complete http response with raw body and status code.
16
+ def payment_tokens_create(options = {})
17
+ new_api_call_builder
18
+ .request(new_request_builder(HttpMethodEnum::POST,
19
+ '/v3/vault/payment-tokens',
20
+ Server::DEFAULT)
21
+ .header_param(new_parameter(options['paypal_request_id'], key: 'PayPal-Request-Id'))
22
+ .header_param(new_parameter('application/json', key: 'Content-Type'))
23
+ .body_param(new_parameter(options['body']))
24
+ .header_param(new_parameter('application/json', key: 'accept'))
25
+ .body_serializer(proc do |param| param.to_json unless param.nil? end)
26
+ .auth(Single.new('Oauth2')))
27
+ .response(new_response_handler
28
+ .deserializer(APIHelper.method(:custom_type_deserializer))
29
+ .deserialize_into(PaymentTokenResponse.method(:from_hash))
30
+ .is_api_response(true)
31
+ .local_error('400',
32
+ 'Request is not well-formed, syntactically incorrect, or'\
33
+ ' violates schema.',
34
+ ErrorException)
35
+ .local_error('403',
36
+ 'Authorization failed due to insufficient permissions.',
37
+ ErrorException)
38
+ .local_error('404',
39
+ 'Request contains reference to resources that do not exist.',
40
+ ErrorException)
41
+ .local_error('422',
42
+ 'The requested action could not be performed, semantically'\
43
+ ' incorrect, or failed business validation.',
44
+ ErrorException)
45
+ .local_error('500',
46
+ 'An internal server error has occurred.',
47
+ ErrorException))
48
+ .execute
49
+ end
50
+
9
51
  # Returns all payment tokens for a customer.
10
52
  # @param [String] customer_id Required parameter: A unique identifier
11
53
  # representing a specific customer in merchant's/partner's system or
@@ -79,27 +121,19 @@ module PaypalServerSdk
79
121
  .execute
80
122
  end
81
123
 
82
- # Creates a Payment Token from the given payment source and adds it to the
83
- # Vault of the associated customer.
84
- # @param [String] paypal_request_id Required parameter: The server stores
85
- # keys for 3 hours.
86
- # @param [PaymentTokenRequest] body Required parameter: Payment Token
87
- # creation with a financial instrument and an optional customer_id.
124
+ # Delete the payment token associated with the payment token id.
125
+ # @param [String] id Required parameter: ID of the payment token.
88
126
  # @return [ApiResponse] the complete http response with raw body and status code.
89
- def payment_tokens_create(options = {})
127
+ def payment_tokens_delete(id)
90
128
  new_api_call_builder
91
- .request(new_request_builder(HttpMethodEnum::POST,
92
- '/v3/vault/payment-tokens',
129
+ .request(new_request_builder(HttpMethodEnum::DELETE,
130
+ '/v3/vault/payment-tokens/{id}',
93
131
  Server::DEFAULT)
94
- .header_param(new_parameter(options['paypal_request_id'], key: 'PayPal-Request-Id'))
95
- .header_param(new_parameter('application/json', key: 'Content-Type'))
96
- .body_param(new_parameter(options['body']))
97
- .header_param(new_parameter('application/json', key: 'accept'))
98
- .body_serializer(proc do |param| param.to_json unless param.nil? end)
132
+ .template_param(new_parameter(id, key: 'id')
133
+ .should_encode(true))
99
134
  .auth(Single.new('Oauth2')))
100
135
  .response(new_response_handler
101
- .deserializer(APIHelper.method(:custom_type_deserializer))
102
- .deserialize_into(PaymentTokenResponse.method(:from_hash))
136
+ .is_response_void(true)
103
137
  .is_api_response(true)
104
138
  .local_error('400',
105
139
  'Request is not well-formed, syntactically incorrect, or'\
@@ -108,13 +142,6 @@ module PaypalServerSdk
108
142
  .local_error('403',
109
143
  'Authorization failed due to insufficient permissions.',
110
144
  ErrorException)
111
- .local_error('404',
112
- 'Request contains reference to resources that do not exist.',
113
- ErrorException)
114
- .local_error('422',
115
- 'The requested action could not be performed, semantically'\
116
- ' incorrect, or failed business validation.',
117
- ErrorException)
118
145
  .local_error('500',
119
146
  'An internal server error has occurred.',
120
147
  ErrorException))
@@ -161,33 +188,6 @@ module PaypalServerSdk
161
188
  .execute
162
189
  end
163
190
 
164
- # Delete the payment token associated with the payment token id.
165
- # @param [String] id Required parameter: ID of the payment token.
166
- # @return [ApiResponse] the complete http response with raw body and status code.
167
- def payment_tokens_delete(id)
168
- new_api_call_builder
169
- .request(new_request_builder(HttpMethodEnum::DELETE,
170
- '/v3/vault/payment-tokens/{id}',
171
- Server::DEFAULT)
172
- .template_param(new_parameter(id, key: 'id')
173
- .should_encode(true))
174
- .auth(Single.new('Oauth2')))
175
- .response(new_response_handler
176
- .is_response_void(true)
177
- .is_api_response(true)
178
- .local_error('400',
179
- 'Request is not well-formed, syntactically incorrect, or'\
180
- ' violates schema.',
181
- ErrorException)
182
- .local_error('403',
183
- 'Authorization failed due to insufficient permissions.',
184
- ErrorException)
185
- .local_error('500',
186
- 'An internal server error has occurred.',
187
- ErrorException))
188
- .execute
189
- end
190
-
191
191
  # Returns a readable representation of temporarily vaulted payment source
192
192
  # associated with the setup token id.
193
193
  # @param [String] id Required parameter: ID of the setup token.
@@ -45,6 +45,12 @@ module PaypalServerSdk
45
45
  # @return [CardVerificationProcessorResponse]
46
46
  attr_accessor :processor_response
47
47
 
48
+ # DEPRECATED. This field is DEPRECATED. Please find the 3D secure
49
+ # authentication data in 'three_d_secure' object under
50
+ # 'authentication_result' object instead of the 'verification' field.
51
+ # @return [Object]
52
+ attr_accessor :three_d_secure
53
+
48
54
  # A mapping from model property names to API property names.
49
55
  def self.names
50
56
  @_hash = {} if @_hash.nil?
@@ -54,6 +60,7 @@ module PaypalServerSdk
54
60
  @_hash['time'] = 'time'
55
61
  @_hash['amount'] = 'amount'
56
62
  @_hash['processor_response'] = 'processor_response'
63
+ @_hash['three_d_secure'] = 'three_d_secure'
57
64
  @_hash
58
65
  end
59
66
 
@@ -66,6 +73,7 @@ module PaypalServerSdk
66
73
  time
67
74
  amount
68
75
  processor_response
76
+ three_d_secure
69
77
  ]
70
78
  end
71
79
 
@@ -75,13 +83,15 @@ module PaypalServerSdk
75
83
  end
76
84
 
77
85
  def initialize(network_transaction_id: SKIP, date: SKIP, network: SKIP,
78
- time: SKIP, amount: SKIP, processor_response: SKIP)
86
+ time: SKIP, amount: SKIP, processor_response: SKIP,
87
+ three_d_secure: SKIP)
79
88
  @network_transaction_id = network_transaction_id unless network_transaction_id == SKIP
80
89
  @date = date unless date == SKIP
81
90
  @network = network unless network == SKIP
82
91
  @time = time unless time == SKIP
83
92
  @amount = amount unless amount == SKIP
84
93
  @processor_response = processor_response unless processor_response == SKIP
94
+ @three_d_secure = three_d_secure unless three_d_secure == SKIP
85
95
  end
86
96
 
87
97
  # Creates an instance of the object from a hash.
@@ -98,6 +108,8 @@ module PaypalServerSdk
98
108
  if hash['processor_response']
99
109
  processor_response = CardVerificationProcessorResponse.from_hash(hash['processor_response'])
100
110
  end
111
+ three_d_secure =
112
+ hash.key?('three_d_secure') ? hash['three_d_secure'] : SKIP
101
113
 
102
114
  # Create object from extracted values.
103
115
  CardVerificationDetails.new(network_transaction_id: network_transaction_id,
@@ -105,7 +117,8 @@ module PaypalServerSdk
105
117
  network: network,
106
118
  time: time,
107
119
  amount: amount,
108
- processor_response: processor_response)
120
+ processor_response: processor_response,
121
+ three_d_secure: three_d_secure)
109
122
  end
110
123
  end
111
124
  end
@@ -14,8 +14,8 @@ module PaypalServerSdk
14
14
  # @return [PaymentSource]
15
15
  attr_accessor :payment_source
16
16
 
17
- # The instruction to process an order.
18
- # @return [ProcessingInstruction]
17
+ # The payment source definition.
18
+ # @return [Object]
19
19
  attr_accessor :processing_instruction
20
20
 
21
21
  # Customizes the payer confirmation experience.
@@ -44,11 +44,8 @@ module PaypalServerSdk
44
44
  []
45
45
  end
46
46
 
47
- def initialize(
48
- payment_source:,
49
- processing_instruction: ProcessingInstruction::NO_INSTRUCTION,
50
- application_context: SKIP
51
- )
47
+ def initialize(payment_source:, processing_instruction: SKIP,
48
+ application_context: SKIP)
52
49
  @payment_source = payment_source
53
50
  @processing_instruction = processing_instruction unless processing_instruction == SKIP
54
51
  @application_context = application_context unless application_context == SKIP
@@ -61,7 +58,7 @@ module PaypalServerSdk
61
58
  # Extract variables from the hash.
62
59
  payment_source = PaymentSource.from_hash(hash['payment_source']) if hash['payment_source']
63
60
  processing_instruction =
64
- hash['processing_instruction'] ||= ProcessingInstruction::NO_INSTRUCTION
61
+ hash.key?('processing_instruction') ? hash['processing_instruction'] : SKIP
65
62
  application_context = OrderConfirmApplicationContext.from_hash(hash['application_context']) if
66
63
  hash['application_context']
67
64
 
@@ -7,8 +7,8 @@ module PaypalServerSdk
7
7
  # A classification for the method of purchase fulfillment (e.g shipping,
8
8
  # in-store pickup, etc). Either `type` or `options` may be present, but not
9
9
  # both.
10
- class FullfillmentType
11
- FULLFILLMENT_TYPE = [
10
+ class FulfillmentType
11
+ FULFILLMENT_TYPE = [
12
12
  # TODO: Write general description for SHIPPING
13
13
  SHIPPING = 'SHIPPING'.freeze,
14
14
 
@@ -0,0 +1,114 @@
1
+ # paypal_server_sdk
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module PaypalServerSdk
7
+ # The payment card used to fund a Google Pay payment. Can be a credit or debit
8
+ # card.
9
+ class GooglePayCard < BaseModel
10
+ SKIP = Object.new
11
+ private_constant :SKIP
12
+
13
+ # The card holder's name as it appears on the card.
14
+ # @return [String]
15
+ attr_accessor :name
16
+
17
+ # The primary account number (PAN) for the payment card.
18
+ # @return [String]
19
+ attr_accessor :number
20
+
21
+ # The year and month, in ISO-8601 `YYYY-MM` date format. See [Internet date
22
+ # and time format](https://tools.ietf.org/html/rfc3339#section-5.6).
23
+ # @return [String]
24
+ attr_accessor :expiry
25
+
26
+ # The last digits of the payment card.
27
+ # @return [String]
28
+ attr_accessor :last_digits
29
+
30
+ # Type of card. i.e Credit, Debit and so on.
31
+ # @return [CardType]
32
+ attr_accessor :type
33
+
34
+ # The card network or brand. Applies to credit, debit, gift, and payment
35
+ # cards.
36
+ # @return [CardBrand]
37
+ attr_accessor :brand
38
+
39
+ # The portable international postal address. Maps to
40
+ # [AddressValidationMetadata](https://github.com/googlei18n/libaddressinput/
41
+ # wiki/AddressValidationMetadata) and HTML 5.1 [Autofilling form controls:
42
+ # the autocomplete
43
+ # attribute](https://www.w3.org/TR/html51/sec-forms.html#autofilling-form-co
44
+ # ntrols-the-autocomplete-attribute).
45
+ # @return [PortablePostalAddressMediumGrained]
46
+ attr_accessor :billing_address
47
+
48
+ # A mapping from model property names to API property names.
49
+ def self.names
50
+ @_hash = {} if @_hash.nil?
51
+ @_hash['name'] = 'name'
52
+ @_hash['number'] = 'number'
53
+ @_hash['expiry'] = 'expiry'
54
+ @_hash['last_digits'] = 'last_digits'
55
+ @_hash['type'] = 'type'
56
+ @_hash['brand'] = 'brand'
57
+ @_hash['billing_address'] = 'billing_address'
58
+ @_hash
59
+ end
60
+
61
+ # An array for optional fields
62
+ def self.optionals
63
+ %w[
64
+ name
65
+ number
66
+ expiry
67
+ last_digits
68
+ type
69
+ brand
70
+ billing_address
71
+ ]
72
+ end
73
+
74
+ # An array for nullable fields
75
+ def self.nullables
76
+ []
77
+ end
78
+
79
+ def initialize(name: SKIP, number: SKIP, expiry: SKIP, last_digits: SKIP,
80
+ type: SKIP, brand: SKIP, billing_address: SKIP)
81
+ @name = name unless name == SKIP
82
+ @number = number unless number == SKIP
83
+ @expiry = expiry unless expiry == SKIP
84
+ @last_digits = last_digits unless last_digits == SKIP
85
+ @type = type unless type == SKIP
86
+ @brand = brand unless brand == SKIP
87
+ @billing_address = billing_address unless billing_address == SKIP
88
+ end
89
+
90
+ # Creates an instance of the object from a hash.
91
+ def self.from_hash(hash)
92
+ return nil unless hash
93
+
94
+ # Extract variables from the hash.
95
+ name = hash.key?('name') ? hash['name'] : SKIP
96
+ number = hash.key?('number') ? hash['number'] : SKIP
97
+ expiry = hash.key?('expiry') ? hash['expiry'] : SKIP
98
+ last_digits = hash.key?('last_digits') ? hash['last_digits'] : SKIP
99
+ type = hash.key?('type') ? hash['type'] : SKIP
100
+ brand = hash.key?('brand') ? hash['brand'] : SKIP
101
+ billing_address = PortablePostalAddressMediumGrained.from_hash(hash['billing_address']) if
102
+ hash['billing_address']
103
+
104
+ # Create object from extracted values.
105
+ GooglePayCard.new(name: name,
106
+ number: number,
107
+ expiry: expiry,
108
+ last_digits: last_digits,
109
+ type: type,
110
+ brand: brand,
111
+ billing_address: billing_address)
112
+ end
113
+ end
114
+ end