Class: Plaid::SandboxApi

Inherits:
BaseApi show all
Defined in:
lib/plaid/apis/sandbox_api.rb

Overview

SandboxApi

Constant Summary

Constants inherited from BaseApi

BaseApi::GLOBAL_ERRORS

Instance Attribute Summary

Attributes inherited from BaseApi

#config, #http_call_back

Instance Method Summary collapse

Methods inherited from BaseApi

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

Constructor Details

This class inherits a constructor from Plaid::BaseApi

Instance Method Details

#sandbox_bank_transfer_fire_webhook(body) ⇒ ApiResponse

Use the ‘/sandbox/bank_transfer/fire_webhook` endpoint to manually trigger a Bank Transfers webhook in the Sandbox environment. TODO: type description here

Parameters:

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
# File 'lib/plaid/apis/sandbox_api.rb', line 251

def sandbox_bank_transfer_fire_webhook(body)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/sandbox/bank_transfer/fire_webhook',
                                 Server::DEFAULT)
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body)
                            .is_required(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(And.new('PLAID-CLIENT-ID', 'PLAID-SECRET', 'Plaid-Version')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(SandboxBankTransferFireWebhookResponse.method(:from_hash))
                .is_api_response(true)
                .local_error('default',
                             'Error response',
                             ErrorErrorException))
    .execute
end

#sandbox_bank_transfer_simulate(body) ⇒ ApiResponse

Use the ‘/sandbox/bank_transfer/simulate` endpoint to simulate a bank transfer event in the Sandbox environment. Note that while an event will be simulated and will appear when using endpoints such as `/bank_transfer/event/sync` or `/bank_transfer/event/list`, no transactions will actually take place and funds will not move between accounts, even within the Sandbox. type description here

Parameters:

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
# File 'lib/plaid/apis/sandbox_api.rb', line 281

def sandbox_bank_transfer_simulate(body)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/sandbox/bank_transfer/simulate',
                                 Server::DEFAULT)
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body)
                            .is_required(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(And.new('PLAID-CLIENT-ID', 'PLAID-SECRET', 'Plaid-Version')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(SandboxBankTransferSimulateResponse.method(:from_hash))
                .is_api_response(true)
                .local_error('default',
                             'Error response',
                             ErrorErrorException))
    .execute
end

#sandbox_income_fire_webhook(body) ⇒ ApiResponse

Use the ‘/sandbox/income/fire_webhook` endpoint to manually trigger an Income webhook in the Sandbox environment. type description here

Parameters:

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
# File 'lib/plaid/apis/sandbox_api.rb', line 171

def sandbox_income_fire_webhook(body)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/sandbox/income/fire_webhook',
                                 Server::DEFAULT)
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body)
                            .is_required(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(And.new('PLAID-CLIENT-ID', 'PLAID-SECRET', 'Plaid-Version')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(SandboxIncomeFireWebhookResponse.method(:from_hash))
                .is_api_response(true)
                .local_error('default',
                             'Error response',
                             ErrorErrorException))
    .execute
end

#sandbox_item_fire_webhook(body) ⇒ ApiResponse

The ‘/sandbox/item/fire_webhook` endpoint is used to test that code correctly handles webhooks. Calling this endpoint triggers a Transactions `DEFAULT_UPDATE` webhook to be fired for a given Sandbox Item. If the Item does not support Transactions, a `SANDBOX_PRODUCT_NOT_ENABLED` error will result. description here

Parameters:

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
# File 'lib/plaid/apis/sandbox_api.rb', line 114

def sandbox_item_fire_webhook(body)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/sandbox/item/fire_webhook',
                                 Server::DEFAULT)
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body)
                            .is_required(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(And.new('PLAID-CLIENT-ID', 'PLAID-SECRET', 'Plaid-Version')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(SandboxItemFireWebhookResponse.method(:from_hash))
                .is_api_response(true)
                .local_error('default',
                             'Error response.',
                             ErrorErrorException))
    .execute
end

#sandbox_item_reset_login(body) ⇒ ApiResponse

‘/sandbox/item/reset_login/` forces an Item into an `ITEM_LOGIN_REQUIRED` state in order to simulate an Item whose login is no longer valid. This makes it easy to test Link’s [update mode](plaid.com/docs/link/update-mode) flow in the Sandbox environment. After calling ‘/sandbox/item/reset_login`, You can then use Plaid Link update mode to restore the Item to a good state. An `ITEM_LOGIN_REQUIRED` webhook will also be fired after a call to this endpoint, if one is associated with the Item. In the Sandbox, Items will transition to an `ITEM_LOGIN_REQUIRED` error state automatically after 30 days, even if this endpoint is not called. description here

Parameters:

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
# File 'lib/plaid/apis/sandbox_api.rb', line 148

def (body)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/sandbox/item/reset_login',
                                 Server::DEFAULT)
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body)
                            .is_required(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(And.new('PLAID-CLIENT-ID', 'PLAID-SECRET', 'Plaid-Version')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(SandboxItemResetLoginResponse.method(:from_hash))
                .is_api_response(true))
    .execute
end

#sandbox_item_set_verification_status(body) ⇒ ApiResponse

The ‘/sandbox/item/set_verification_status` endpoint can be used to change the verification status of an Item in in the Sandbox in order to simulate the Automated Micro-deposit flow. Note that not all Plaid developer accounts are enabled for micro-deposit based verification by default. Your account must be enabled for this feature in order to test it in Sandbox. To enable this features or check your status, contact your account manager or [submit a product access Support ticket](dashboard.plaid.com/support/new/product-and-development/pr oduct-troubleshooting/request-product-access). For more information on testing Automated Micro-deposits in Sandbox, see [Auth full coverage testing](plaid.com/docs/auth/coverage/testing#). TODO: type description here

Parameters:

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/plaid/apis/sandbox_api.rb', line 25

def sandbox_item_set_verification_status(body)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/sandbox/item/set_verification_status',
                                 Server::DEFAULT)
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body)
                            .is_required(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(And.new('PLAID-CLIENT-ID', 'PLAID-SECRET', 'Plaid-Version')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(SandboxItemSetVerificationStatusResponse.method(:from_hash))
                .is_api_response(true))
    .execute
end

#sandbox_oauth_select_accounts(body) ⇒ ApiResponse

Save the selected accounts when connecting to the Platypus Oauth institution type description here

Parameters:

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
# File 'lib/plaid/apis/sandbox_api.rb', line 197

def sandbox_oauth_select_accounts(body)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/sandbox/oauth/select_accounts',
                                 Server::DEFAULT)
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body)
                            .is_required(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(And.new('PLAID-CLIENT-ID', 'PLAID-SECRET', 'Plaid-Version')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:json_deserialize))
                .is_api_response(true)
                .local_error('default',
                             'Error response.',
                             ErrorErrorException))
    .execute
end

#sandbox_processor_token_create(body) ⇒ ApiResponse

Use the ‘/sandbox/processor_token/create` endpoint to create a valid `processor_token` for an arbitrary institution ID and test credentials. The created `processor_token` corresponds to a new Sandbox Item. You can then use this `processor_token` with the `/processor/` API endpoints in Sandbox. You can also use `/sandbox/processor_token/create` with the [`user_custom` test username](plaid.com/docs/sandbox/user-custom) to generate a test account with custom data. type description here

Parameters:

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# File 'lib/plaid/apis/sandbox_api.rb', line 85

def sandbox_processor_token_create(body)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/sandbox/processor_token/create',
                                 Server::DEFAULT)
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body)
                            .is_required(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(And.new('PLAID-CLIENT-ID', 'PLAID-SECRET', 'Plaid-Version')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(SandboxProcessorTokenCreateResponse.method(:from_hash))
                .is_api_response(true)
                .local_error('default',
                             'Error response.',
                             ErrorErrorException))
    .execute
end

#sandbox_public_token_create(body) ⇒ ApiResponse

Use the ‘/sandbox/public_token/create` endpoint to create a valid `public_token` for an arbitrary institution ID, initial products, and test credentials. The created `public_token` maps to a new Sandbox Item. You can then call `/item/public_token/exchange` to exchange the `public_token` for an `access_token` and perform all API actions. `/sandbox/public_token/create` can also be used with the [`user_custom` test username](plaid.com/docs/sandbox/user-custom) to generate a test account with custom data. type description here

Parameters:

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/plaid/apis/sandbox_api.rb', line 54

def sandbox_public_token_create(body)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/sandbox/public_token/create',
                                 Server::DEFAULT)
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body)
                            .is_required(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(And.new('PLAID-CLIENT-ID', 'PLAID-SECRET', 'Plaid-Version')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(SandboxPublicTokenCreateResponse.method(:from_hash))
                .is_api_response(true)
                .local_error('default',
                             'Error response.',
                             ErrorErrorException))
    .execute
end

#sandbox_transfer_simulate(body) ⇒ ApiResponse

Use the ‘/sandbox/transfer/simulate` endpoint to simulate a transfer event in the Sandbox environment. Note that while an event will be simulated and will appear when using endpoints such as `/transfer/event/sync` or `/transfer/event/list`, no transactions will actually take place and funds will not move between accounts, even within the Sandbox. type description here

Parameters:

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
# File 'lib/plaid/apis/sandbox_api.rb', line 225

def sandbox_transfer_simulate(body)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/sandbox/transfer/simulate',
                                 Server::DEFAULT)
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body)
                            .is_required(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(And.new('PLAID-CLIENT-ID', 'PLAID-SECRET', 'Plaid-Version')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(SandboxTransferSimulateResponse.method(:from_hash))
                .is_api_response(true)
                .local_error('default',
                             'Error response',
                             ErrorErrorException))
    .execute
end