The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

WebService::MinFraud::Validator - Validation for the minFraud requests

VERSION

version 1.009001

SYNOPSIS

    use 5.010;

    use WebService::MinFraud::Validator;

    my $validator = WebService::MinFraud::Validator->new;
    my $request = { device => { ip_address => '24.24.24.24' } };
    $validator->validate_request($request, 'score'); # takes an optional 'path'

DESCRIPTION

This module defines the request schema for the minFraud API. In addition, it provides a validate_request method that is used to validate any request passed to the score, insights, factors, or chargeback methods.

METHODS

validate_request

    my $validator = WebService::MinFraud::Validator->new;
    my $request = { ip => '24.24.24.24' };
    $validator->validate_request($request, 'chargeback');

    $request = { device => { ip_address => '24.24.24.24'  } };
    $validator->validate_request($request); # by default will use WebService::MinFraud::Validator::FraudService

This method takes a minFraud request as a HashRef and validates it against the minFraud request schema for the specified API endpoint. A second optional argument can be used to specify the schema to use, socre, insights, factors, chargeback, or fraud_service. If the request HashRef fails validation, an exception is thrown, which is a string containing all of the validation errors.

SUPPORT

Bugs may be submitted through https://github.com/maxmind/minfraud-api-perl/issues.

AUTHOR

Mateu Hunter <mhunter@maxmind.com>

COPYRIGHT AND LICENSE

This software is copyright (c) 2015 - 2019 by MaxMind, Inc.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.