Class: PaypalServerSdk::VaultController
- Inherits:
-
BaseController
- Object
- BaseController
- PaypalServerSdk::VaultController
- Defined in:
- lib/paypal_server_sdk/controllers/vault_controller.rb
Overview
VaultController
Constant Summary
Constants inherited from BaseController
Instance Attribute Summary
Attributes inherited from BaseController
Instance Method Summary collapse
-
#customer_payment_tokens_get(options = {}) ⇒ ApiResponse
Returns all payment tokens for a customer.
-
#payment_tokens_create(options = {}) ⇒ ApiResponse
Creates a Payment Token from the given payment source and adds it to the Vault of the associated customer.
-
#payment_tokens_delete(id) ⇒ ApiResponse
Delete the payment token associated with the payment token id.
-
#payment_tokens_get(id) ⇒ ApiResponse
Returns a readable representation of vaulted payment source associated with the payment token id.
-
#setup_tokens_create(options = {}) ⇒ ApiResponse
Creates a Setup Token from the given payment source and adds it to the Vault of the associated customer.
-
#setup_tokens_get(id) ⇒ ApiResponse
Returns a readable representation of temporarily vaulted payment source associated with the setup token id.
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.
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( = {}) new_api_call_builder .request(new_request_builder(HttpMethodEnum::GET, '/v3/vault/payment-tokens', Server::DEFAULT) .query_param(new_parameter(['customer_id'], key: 'customer_id')) .query_param(new_parameter(['page_size'], key: 'page_size')) .query_param(new_parameter(['page'], key: 'page')) .query_param(new_parameter(['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.
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( = {}) new_api_call_builder .request(new_request_builder(HttpMethodEnum::POST, '/v3/vault/payment-tokens', Server::DEFAULT) .header_param(new_parameter(['paypal_request_id'], key: 'PayPal-Request-Id')) .header_param(new_parameter('application/json', key: 'Content-Type')) .body_param(new_parameter(['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.
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.
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.
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( = {}) new_api_call_builder .request(new_request_builder(HttpMethodEnum::POST, '/v3/vault/setup-tokens', Server::DEFAULT) .header_param(new_parameter(['paypal_request_id'], key: 'PayPal-Request-Id')) .header_param(new_parameter('application/json', key: 'Content-Type')) .body_param(new_parameter(['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.
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 |