2017 © Pedro Peláez
 

library maxmind-api

Maxmind API library

image

fylmtm/maxmind-api

Maxmind API library

  • Monday, March 3, 2014
  • by FylmTM
  • Repository
  • 1 Watchers
  • 0 Stars
  • 6,668 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 1 Versions
  • 7 % Grown

The README.md

Maxmind API

Build Status Coverage Status Latest Stable Version Total Downloads Latest Unstable Version License, (*1)

About

Author: Dmitry Vrublevskis, (*2)

Email: d.vrublevskis@gmail.com, (*3)

Installation

Composer

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

Manual

You can manually download library and use autoloader., (*6)

require_once 'lib/autoloader.php'

Usage

MinFraud client

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 request

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' => ''
]);

MinFraud response

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

Tests

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

The Versions

03/03 2014

dev-master

9999999-dev

Maxmind API library

  Sources   Download

MIT

The Development Requires

by Dmitry Vrublevskis