Class: PaypalServerSdk::VaultController

Inherits:
BaseController show all
Defined in:
lib/paypal_server_sdk/controllers/vault_controller.rb

Overview

VaultController

Constant Summary

Constants inherited from BaseController

BaseController::GLOBAL_ERRORS

Instance Attribute Summary

Attributes inherited from BaseController

#config, #http_call_back

Instance Method Summary collapse

Methods inherited from BaseController

#initialize, #new_api_call_builder, #new_parameter, #new_request_builder, #new_response_handler, user_agent, user_agent_parameters

Constructor Details

This class inherits a constructor from PaypalServerSdk::BaseController

Instance Method Details

#customer_payment_tokens_get(options = {}) ⇒ ApiResponse

Returns all payment tokens for a customer. representing a specific customer in merchant’s/partner’s system or records. integer indicating the maximum number of results to return at one time. representing the page of the results. boolean indicating total number of items (total_items) and pages (total_pages) are expected to be returned in the response.

Parameters:

  • customer_id (String)

    Required parameter: A unique identifier

  • page_size (Integer)

    Optional parameter: A non-negative, non-zero

  • page (Integer)

    Optional parameter: A non-negative, non-zero integer

  • total_required (TrueClass | FalseClass)

    Optional parameter: A

Returns:

  • (ApiResponse)

    the complete http response with raw body and status code.



63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# File 'lib/paypal_server_sdk/controllers/vault_controller.rb', line 63

def customer_payment_tokens_get(options = {})
  new_api_call_builder
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/v3/vault/payment-tokens',
                                 Server::DEFAULT)
               .query_param(new_parameter(options['customer_id'], key: 'customer_id'))
               .query_param(new_parameter(options['page_size'], key: 'page_size'))
               .query_param(new_parameter(options['page'], key: 'page'))
               .query_param(new_parameter(options['total_required'], key: 'total_required'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('Oauth2')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(CustomerVaultPaymentTokensResponse.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Request is not well-formed, syntactically incorrect, or'\
                              ' violates schema.',
                             ErrorException)
                .local_error('403',
                             'Authorization failed due to insufficient permissions.',
                             ErrorException)
                .local_error('500',
                             'An internal server error has occurred.',
                             ErrorException))
    .execute
end

#payment_tokens_create(options = {}) ⇒ ApiResponse

Creates a Payment Token from the given payment source and adds it to the Vault of the associated customer. keys for 3 hours. creation with a financial instrument and an optional customer_id.

Parameters:

  • paypal_request_id (String)

    Required parameter: The server stores

  • body (PaymentTokenRequest)

    Required parameter: Payment Token

Returns:

  • (ApiResponse)

    the complete http response with raw body and status code.



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/paypal_server_sdk/controllers/vault_controller.rb', line 16

def payment_tokens_create(options = {})
  new_api_call_builder
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/v3/vault/payment-tokens',
                                 Server::DEFAULT)
               .header_param(new_parameter(options['paypal_request_id'], key: 'PayPal-Request-Id'))
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(options['body']))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(Single.new('Oauth2')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(PaymentTokenResponse.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Request is not well-formed, syntactically incorrect, or'\
                              ' violates schema.',
                             ErrorException)
                .local_error('403',
                             'Authorization failed due to insufficient permissions.',
                             ErrorException)
                .local_error('404',
                             'Request contains reference to resources that do not exist.',
                             ErrorException)
                .local_error('422',
                             'The requested action could not be performed, semantically'\
                              ' incorrect, or failed business validation.',
                             ErrorException)
                .local_error('500',
                             'An internal server error has occurred.',
                             ErrorException))
    .execute
end

#payment_tokens_delete(id) ⇒ ApiResponse

Delete the payment token associated with the payment token id.

Parameters:

  • id (String)

    Required parameter: ID of the payment token.

Returns:

  • (ApiResponse)

    the complete http response with raw body and status code.



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

def payment_tokens_delete(id)
  new_api_call_builder
    .request(new_request_builder(HttpMethodEnum::DELETE,
                                 '/v3/vault/payment-tokens/{id}',
                                 Server::DEFAULT)
               .template_param(new_parameter(id, key: 'id')
                                .should_encode(true))
               .auth(Single.new('Oauth2')))
    .response(new_response_handler
                .is_response_void(true)
                .is_api_response(true)
                .local_error('400',
                             'Request is not well-formed, syntactically incorrect, or'\
                              ' violates schema.',
                             ErrorException)
                .local_error('403',
                             'Authorization failed due to insufficient permissions.',
                             ErrorException)
                .local_error('500',
                             'An internal server error has occurred.',
                             ErrorException))
    .execute
end

#payment_tokens_get(id) ⇒ ApiResponse

Returns a readable representation of vaulted payment source associated with the payment token id.

Parameters:

  • id (String)

    Required parameter: ID of the payment token.

Returns:

  • (ApiResponse)

    the complete http response with raw body and status code.



95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
# File 'lib/paypal_server_sdk/controllers/vault_controller.rb', line 95

def payment_tokens_get(id)
  new_api_call_builder
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/v3/vault/payment-tokens/{id}',
                                 Server::DEFAULT)
               .template_param(new_parameter(id, key: 'id')
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('Oauth2')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(PaymentTokenResponse.method(:from_hash))
                .is_api_response(true)
                .local_error('403',
                             'Authorization failed due to insufficient permissions.',
                             ErrorException)
                .local_error('404',
                             'The specified resource does not exist.',
                             ErrorException)
                .local_error('422',
                             'The requested action could not be performed, semantically'\
                              ' incorrect, or failed business validation.',
                             ErrorException)
                .local_error('500',
                             'An internal server error has occurred.',
                             ErrorException))
    .execute
end

#setup_tokens_create(options = {}) ⇒ ApiResponse

Creates a Setup Token from the given payment source and adds it to the Vault of the associated customer. keys for 3 hours. with a instrument type optional financial instrument details and customer_id.

Parameters:

  • paypal_request_id (String)

    Required parameter: The server stores

  • body (SetupTokenRequest)

    Required parameter: Setup Token creation

Returns:

  • (ApiResponse)

    the complete http response with raw body and status code.



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
186
187
188
189
# File 'lib/paypal_server_sdk/controllers/vault_controller.rb', line 159

def setup_tokens_create(options = {})
  new_api_call_builder
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/v3/vault/setup-tokens',
                                 Server::DEFAULT)
               .header_param(new_parameter(options['paypal_request_id'], key: 'PayPal-Request-Id'))
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(options['body']))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(Single.new('Oauth2')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(SetupTokenResponse.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Request is not well-formed, syntactically incorrect, or'\
                              ' violates schema.',
                             ErrorException)
                .local_error('403',
                             'Authorization failed due to insufficient permissions.',
                             ErrorException)
                .local_error('422',
                             'The requested action could not be performed, semantically'\
                              ' incorrect, or failed business validation.',
                             ErrorException)
                .local_error('500',
                             'An internal server error has occurred.',
                             ErrorException))
    .execute
end

#setup_tokens_get(id) ⇒ ApiResponse

Returns a readable representation of temporarily vaulted payment source associated with the setup token id.

Parameters:

  • id (String)

    Required parameter: ID of the setup token.

Returns:

  • (ApiResponse)

    the complete http response with raw body and status code.



195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
# File 'lib/paypal_server_sdk/controllers/vault_controller.rb', line 195

def setup_tokens_get(id)
  new_api_call_builder
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/v3/vault/setup-tokens/{id}',
                                 Server::DEFAULT)
               .template_param(new_parameter(id, key: 'id')
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('Oauth2')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(SetupTokenResponse.method(:from_hash))
                .is_api_response(true)
                .local_error('403',
                             'Authorization failed due to insufficient permissions.',
                             ErrorException)
                .local_error('404',
                             'The specified resource does not exist.',
                             ErrorException)
                .local_error('422',
                             'The requested action could not be performed, semantically'\
                              ' incorrect, or failed business validation.',
                             ErrorException)
                .local_error('500',
                             'An internal server error has occurred.',
                             ErrorException))
    .execute
end