Class: Plaid::Processor::Signal::Client
- Inherits:
-
Object
- Object
- Plaid::Processor::Signal::Client
- Defined in:
- lib/plaid/processor/signal/client.rb
Instance Method Summary collapse
-
#evaluate(request_options: {}, **params) ⇒ Plaid::Types::ProcessorSignalEvaluateResponse
Use
/processor/signal/evaluateto evaluate a planned ACH transaction to get a return risk assessment and additional risk signals. - #initialize(client:) ⇒ void constructor
-
#prepare(request_options: {}, **params) ⇒ Plaid::Types::ProcessorSignalPrepareResponse
When a processor token is not initialized with
signal, call/processor/signal/prepareto opt-in that processor token to the data collection process, which will improve the accuracy of the Signal Transaction Score. -
#report_decision(request_options: {}, **params) ⇒ Plaid::Types::ProcessorSignalDecisionReportResponse
After you call
/processor/signal/evaluate, Plaid will normally infer the outcome from your Signal Rules. -
#report_return(request_options: {}, **params) ⇒ Plaid::Types::ProcessorSignalReturnReportResponse
Call the
/processor/signal/return/reportendpoint to report a returned transaction that was previously sent to the/processor/signal/evaluateendpoint.
Constructor Details
#initialize(client:) ⇒ void
10 11 12 |
# File 'lib/plaid/processor/signal/client.rb', line 10 def initialize(client:) @client = client end |
Instance Method Details
#evaluate(request_options: {}, **params) ⇒ Plaid::Types::ProcessorSignalEvaluateResponse
Use /processor/signal/evaluate to evaluate a planned ACH transaction to get a return risk assessment and
additional risk signals.
/processor/signal/evaluate uses Rulesets that are configured on the end customer's Dashboard and can be used
with either the Signal Transaction Scores product or the Balance product. Which product is used will be
determined by the ruleset_key that you provide. Note that only customer-configured rulesets work with this
endpoint; as a processor partner, you cannot create or configure your own rulesets. For more details, see
Signal Rules.
Note: This request may have higher latency if Signal Transaction Scores is being added to an existing Item for the first time, or when using a Balance-only ruleset. This is because Plaid must communicate directly with the institution to request data.
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/plaid/processor/signal/client.rb', line 43 def evaluate(request_options: {}, **params) params = Plaid::Internal::Types::Utils.normalize_keys(params) request = Plaid::Internal::JSON::Request.new( base_url: [:base_url], method: "POST", path: "processor/signal/evaluate", body: Plaid::Processor::Signal::Types::ProcessorSignalEvaluateRequest.new(params).to_h, request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Plaid::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) begin (response.body.to_s.empty? ? nil : Plaid::Types::ProcessorSignalEvaluateResponse.load(response.body)) rescue ::JSON::ParserError raise Plaid::Errors::ResponseError.new(response.body, code: code, headers: response.to_hash) end else error_class = Plaid::Errors::ResponseError.subclass_for_code(code) error_types = { 400 => Plaid::Types::PlaidError, 401 => Plaid::Types::PlaidError, 429 => Plaid::Types::PlaidError, 500 => Plaid::Types::PlaidError, (400..499) => Plaid::Types::PlaidError, (500..599) => Plaid::Types::PlaidError } error_body = Plaid::Errors::ResponseError.load_error_body(code, response.body, error_types) raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash) end end |
#prepare(request_options: {}, **params) ⇒ Plaid::Types::ProcessorSignalPrepareResponse
When a processor token is not initialized with signal, call /processor/signal/prepare to opt-in that
processor token to the data collection process, which will improve the accuracy of the Signal Transaction
Score.
If this endpoint is called with a processor token that is already initialized with signal, it will return a
200 response and will not modify the processor token.
224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 |
# File 'lib/plaid/processor/signal/client.rb', line 224 def prepare(request_options: {}, **params) params = Plaid::Internal::Types::Utils.normalize_keys(params) request = Plaid::Internal::JSON::Request.new( base_url: [:base_url], method: "POST", path: "processor/signal/prepare", body: Plaid::Processor::Signal::Types::ProcessorSignalPrepareRequest.new(params).to_h, request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Plaid::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) begin (response.body.to_s.empty? ? nil : Plaid::Types::ProcessorSignalPrepareResponse.load(response.body)) rescue ::JSON::ParserError raise Plaid::Errors::ResponseError.new(response.body, code: code, headers: response.to_hash) end else error_class = Plaid::Errors::ResponseError.subclass_for_code(code) error_types = { 400 => Plaid::Types::PlaidError, 401 => Plaid::Types::PlaidError, 429 => Plaid::Types::PlaidError, 500 => Plaid::Types::PlaidError, (400..499) => Plaid::Types::PlaidError, (500..599) => Plaid::Types::PlaidError } error_body = Plaid::Errors::ResponseError.load_error_body(code, response.body, error_types) raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash) end end |
#report_decision(request_options: {}, **params) ⇒ Plaid::Types::ProcessorSignalDecisionReportResponse
After you call /processor/signal/evaluate, Plaid will normally infer the outcome from your Signal Rules.
However, if you are not using Signal Rules, if the Signal Rules outcome was REVIEW, or if you take a
different action than the one determined by the Signal Rules, you will need to call
/processor/signal/decision/report. This helps improve Signal Transaction Score accuracy for your account and
is necessary for proper functioning of the rule performance and rule tuning capabilities in the Dashboard. If
your effective decision changes after calling /processor/signal/decision/report (for example, you indicated
that you accepted a transaction, but later on, your payment processor rejected it, so it was never initiated),
call /processor/signal/decision/report again for the transaction to correct Plaid's records.
If you are using Plaid Transfer as your payment processor, you also do not need to call
/processor/signal/decision/report, as Plaid can infer outcomes from your Transfer activity.
If using a Balance-only ruleset, this endpoint will not impact scores (Balance does not use scores), but is necessary to view accurate transaction outcomes and tune rule logic in the Dashboard.
110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 |
# File 'lib/plaid/processor/signal/client.rb', line 110 def report_decision(request_options: {}, **params) params = Plaid::Internal::Types::Utils.normalize_keys(params) request = Plaid::Internal::JSON::Request.new( base_url: [:base_url], method: "POST", path: "processor/signal/decision/report", body: Plaid::Processor::Signal::Types::ProcessorSignalDecisionReportRequest.new(params).to_h, request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Plaid::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) begin (response.body.to_s.empty? ? nil : Plaid::Types::ProcessorSignalDecisionReportResponse.load(response.body)) rescue ::JSON::ParserError raise Plaid::Errors::ResponseError.new(response.body, code: code, headers: response.to_hash) end else error_class = Plaid::Errors::ResponseError.subclass_for_code(code) error_types = { 400 => Plaid::Types::PlaidError, 401 => Plaid::Types::PlaidError, 429 => Plaid::Types::PlaidError, 500 => Plaid::Types::PlaidError, (400..499) => Plaid::Types::PlaidError, (500..599) => Plaid::Types::PlaidError } error_body = Plaid::Errors::ResponseError.load_error_body(code, response.body, error_types) raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash) end end |
#report_return(request_options: {}, **params) ⇒ Plaid::Types::ProcessorSignalReturnReportResponse
Call the /processor/signal/return/report endpoint to report a returned transaction that was previously sent
to the /processor/signal/evaluate endpoint. Your feedback will be used by the model to incorporate the
latest risk trend in your portfolio.
If you are using the Plaid Transfer product to create transfers, it is not necessary to use this endpoint, as Plaid already knows whether the transfer was returned.
169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 |
# File 'lib/plaid/processor/signal/client.rb', line 169 def report_return(request_options: {}, **params) params = Plaid::Internal::Types::Utils.normalize_keys(params) request = Plaid::Internal::JSON::Request.new( base_url: [:base_url], method: "POST", path: "processor/signal/return/report", body: Plaid::Processor::Signal::Types::ProcessorSignalReturnReportRequest.new(params).to_h, request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Plaid::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) begin (response.body.to_s.empty? ? nil : Plaid::Types::ProcessorSignalReturnReportResponse.load(response.body)) rescue ::JSON::ParserError raise Plaid::Errors::ResponseError.new(response.body, code: code, headers: response.to_hash) end else error_class = Plaid::Errors::ResponseError.subclass_for_code(code) error_types = { 400 => Plaid::Types::PlaidError, 401 => Plaid::Types::PlaidError, 429 => Plaid::Types::PlaidError, 500 => Plaid::Types::PlaidError, (400..499) => Plaid::Types::PlaidError, (500..599) => Plaid::Types::PlaidError } error_body = Plaid::Errors::ResponseError.load_error_body(code, response.body, error_types) raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash) end end |