dev-master
9999999-devMaxmind API library
MIT
The Development Requires
by Dmitry Vrublevskis
Wallogit.com
2017 © Pedro Peláez
Maxmind API library
Author: Dmitry Vrublevskis, (*2)
Email: d.vrublevskis@gmail.com, (*3)
Recommended way of installation is through composer. Add to your composer.json:, (*4)
"require": {
"fylmtm/maxmind-api": "0.1.*@dev"
}
And then install with:, (*5)
$ composer.phar install
You can manually download library and use autoloader., (*6)
require_once 'lib/autoloader.php'
Create client:, (*7)
$fraudClient = new Maxmind\MinFraud\MinFraudClient();
By default main server used. You can choose whatever you want:, (*8)
$fraudClient->setServer(\Maxmind\MinFraud\MinFraudServers::MAIN); $fraudClient->setServer(\Maxmind\MinFraud\MinFraudServers::US_EAST); $fraudClient->setServer(\Maxmind\MinFraud\MinFraudServers::US_WEST);
HTTPS used by default. You can turn on/off https usage:, (*9)
$fraudClient->enableHttps(false);
minFraud API reference, (*10)
You need to create request, which you pass to fraudClient later. Required request fields must be passed on client creation. By default standard request type used., (*11)
// Exception may be thrown, if any of required fields will not be passed.
$request = new Maxmind\MinFraud\MinFraudRequest([
'license_key' => '1111111',
'i' => '257.257.257.257',
'city' => 'BigApple',
'region' => 'NA',
'postal' => '1111',
'country' => 'NA',
]);
$request->setRequestType('standard'); // 'standard' or 'premium' request type can be used.
Other fields (see API reference for more info) can be passed separately., (*12)
$request->setShippingAddress([
'shipAddr' => '',
'shipCity' => '',
'shipRegion' => '',
'shipPostal' => '',
'shipCountry' => ''
]);
$request->setUserData([
'domain' => '',
'custPhone' => '',
'emailMD5' => '',
'usernameMD5' => '',
'passwordMD5' => ''
]);
$request->setBinRelated([
'bin' => '',
'binName' => '',
'binPhone' => ''
]);
$request->setTransactionLinking([
'sessionID' => '',
'user_agent' => '',
'accept_language' => ''
]);
$request->setTransactionInformation([
'txnID' => '',
'order_amount' => '',
'order_currency' => '',
'shopID' => '',
'txn_type' => ''
]);
$request->setCreditCardCheck([
'avs_result' => '',
'cvv_result' => ''
]);
$request->setMisc([
'forwardedIP' => ''
]);
Request can be executed via client., (*13)
$response = $fraudClient->executeRequest($request); $response->getIsCurlSuccessful(); // true|false - indicates if curl was successfull $response->getRawResult(); // string - raw curl response, contains error if curl was unsuccessful $response->getResult(); // parsed minFraud response
If you wish to run tests, you need to install development dependencies:, (*14)
$ composer.phar install --dev
And then run them with:, (*15)
$ vendor/bin/phpunit
Maxmind API library
MIT