Class: Plaid::TransferApi

Inherits:
BaseApi
  • Object
show all
Defined in:
lib/plaid/apis/transfer_api.rb

Overview

TransferApi

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

#transfer_authorization_create(body) ⇒ ApiResponse

Use the ‘/transfer/authorization/create` endpoint to determine transfer failure risk. In Plaid’s sandbox environment the decisions will be returned as follows:

- To approve a transfer, make an authorization request with an `amount`

less than the available balance in the account.

- To decline a transfer with the rationale code `NSF`, the available

balance on the account must be less than the authorization ‘amount`. See [Create Sandbox test data](plaid.com/docs/sandbox/user-custom/) for details on how to customize data in Sandbox.

- To decline a transfer with the rationale code `RISK`, the available

balance on the account must be exactly $0. See [Create Sandbox test data](plaid.com/docs/sandbox/user-custom/) for details on how to customize data in Sandbox.

- To permit a transfer with the rationale code `MANUALLY_VERIFIED_ITEM`,

create an Item in Link through the [Same Day Micro-deposits flow](plaid.com/docs/auth/coverage/testing/#testing-same-day-micro -deposits).

- To permit a transfer with the rationale code `LOGIN_REQUIRED`, [reset

the login for an Item](plaid.com/docs/sandbox/#item_login_required). All username/password combinations other than the ones listed above will result in a decision of permitted and rationale code ‘ERROR`. type description here

Parameters:

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
# File 'lib/plaid/apis/transfer_api.rb', line 167

def transfer_authorization_create(body)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/transfer/authorization/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(TransferAuthorizationCreateResponse.method(:from_hash))
                .is_api_response(true)
                .local_error('default',
                             'Error response',
                             ErrorErrorException))
    .execute
end

#transfer_cancel(body) ⇒ ApiResponse

Use the ‘/transfer/cancel` endpoint to cancel a transfer. A transfer is eligible for cancelation if the `cancellable` property returned by `/transfer/get` is `true`. description here

Parameters:

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# File 'lib/plaid/apis/transfer_api.rb', line 96

def transfer_cancel(body)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/transfer/cancel',
                                 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(TransferCancelResponse.method(:from_hash))
                .is_api_response(true)
                .local_error('default',
                             'Error response',
                             ErrorErrorException))
    .execute
end

#transfer_create(body) ⇒ ApiResponse

Use the ‘/transfer/create` endpoint to initiate a new transfer. description here

Parameters:

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
# File 'lib/plaid/apis/transfer_api.rb', line 121

def transfer_create(body)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/transfer/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(TransferCreateResponse.method(:from_hash))
                .is_api_response(true)
                .local_error('default',
                             'Error response',
                             ErrorErrorException))
    .execute
end

#transfer_event_list(body) ⇒ ApiResponse

Use the ‘/transfer/event/list` endpoint to get a list of transfer events based on specified filter criteria. description here

Parameters:

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
# File 'lib/plaid/apis/transfer_api.rb', line 193

def transfer_event_list(body)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/transfer/event/list',
                                 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(TransferEventListResponse.method(:from_hash))
                .is_api_response(true)
                .local_error('default',
                             'Error response',
                             ErrorErrorException))
    .execute
end

#transfer_event_sync(body) ⇒ ApiResponse

‘/transfer/event/sync` allows you to request up to the next 25 transfer events that happened after a specific `event_id`. Use the `/transfer/event/sync` endpoint to guarantee you have seen all transfer events. description here

Parameters:

Returns:

  • (ApiResponse)

    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
# File 'lib/plaid/apis/transfer_api.rb', line 16

def transfer_event_sync(body)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/transfer/event/sync',
                                 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(TransferEventSyncResponse.method(:from_hash))
                .is_api_response(true)
                .local_error('default',
                             'Error response',
                             ErrorErrorException))
    .execute
end

#transfer_get(body) ⇒ ApiResponse

The ‘/transfer/get` fetches information about the transfer corresponding to the given `transfer_id`. description here

Parameters:

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/plaid/apis/transfer_api.rb', line 69

def transfer_get(body)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/transfer/get',
                                 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(TransferGetResponse.method(:from_hash))
                .is_api_response(true)
                .local_error('default',
                             'Error response',
                             ErrorErrorException))
    .execute
end

#transfer_list(body) ⇒ ApiResponse

Use the ‘/transfer/list` endpoint to see a list of all your transfers and their statuses. Results are paginated; use the `count` and `offset` query parameters to retrieve the desired transfers. description here

Parameters:

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/plaid/apis/transfer_api.rb', line 43

def transfer_list(body)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/transfer/list',
                                 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(TransferListResponse.method(:from_hash))
                .is_api_response(true)
                .local_error('default',
                             'Error response',
                             ErrorErrorException))
    .execute
end