Raise Oracle Client

Client for Raise Oracle API endpoints for fraud prevention.

Clients

Two types of clients are available:

  • RaiseOracleClient::Http
  • RaiseOracleClient::InMemory

The application utilizing Raise Oracle Client can dynamically define the preferred client based on development, test, staging or production environment.

When initializing clients, three arguments are passed (user, password and endpoint).

RaiseOracleClient::Http

Interact with Raise Oracle API via HTTP and requires authentication.

RaiseOracleClient::InMemory

Does not perform any http request but uses the same contract.

Example (Neo)

Posts a payload to the buy event endpoint:

RaiseOracleClient::Http::Client#post or RaiseOracleClient::InMemory::Client#post.

The payload is composed with the same content of the payload used by Neo (that includes data about order, line items, addresses and payment) plus the Neo decision (approve, decline or not_review). Follow an example:

data = {
  decision: "approve",
  id: "R123456789",
  timestamp: "1391385178",
  remoteIP: "68.52.16.22",
  userAgent: "Mozilla/5.0",
  forterTokenCookie: "456454-ae6544",
  customer: {
    id: "123",
    email: "[email protected]"
  },
  amount: "167.9",
  currency: "USD",
  paymentType: "Credit Card",
  orderStatus: "Completed",
  cartItems: [
    {
      item: "111",
      name: "Target",
      price: "83.5",
      value: "100",
      quantity: "1",
      sellerId: "123456",
      created: "1388560227"
    }
  ],
  billingAddress: {
    firstName: "Bill",
    lastName: "Clinton",
    company: "The White House",
    address1: "5 Chance St",
    address2: "apt 2",
    city: "Hicksville",
    region: "NY",
    zip: "11801",
    country: "United States",
    phone: "516-942-0594",
    usedSavedAddress: true
  },
  shippingAddress: {
    firstName: "George W.",
    lastName: "Bush",
    company: "The White House",
    address1: "173 E Interlake Blvd",
    address2: "3rd floor",
    city: "Lake Placid",
    region: "FL",
    zip: "33852",
    country: "USA",
    phone: "18634653101",
    usedSavedAddress: true
  },
  creditCard: {
    cardNumber: "532015",
    cardType: "VISA",
    nameOnCard: "Debra Smith",
    last4: "4721",
    avsResult: "Y",
    cvvResult: "Y",
    expireMonth: "12",
    expireYear: "2018",
    usedSavedCard: true,
    choseToSaveCard: false
  }
}.to_json

http_client = RaiseOracleClient::Http::Client.new("user", "password", "https://www.example.com/buy_event")
http_client.post(data)

=> #<Net::HTTPOK 200 OK readbody=true>

in_memory_client = RaiseOracleClient::InMemory::Client.new("user", "password", "https://www.example.com/buy_event")
in_memory_client.post(data)

=> true

Replace the credentials and the base endpoint for real ones when using RaiseOracleClient::Http clients. In case of RaiseOracleClient::InMemory you can pass any content but the contract is the same.