oriskami/oriskami-php

1.0.0 2017-06-04 16:50 UTC

This package is not auto-updated.

Last update: 2024-09-29 05:01:43 UTC


README

Build Status Latest Stable Version Total Downloads License Code Coverage

The Oriskami PHP library provides convenient access to the Oriskami API from applications written in the PHP language. It includes a pre-defined set of classes for API resources.

文档

查看 Oriskami API 文档

快速入门

You don't need this source code unless you want to modify the package. If you want to use the package, there are three options

  1. 使用 Composer,在你的 composer.json 中添加以下内容并运行 composer install
{ 
  "require": {
    "oriskami/oriskami-php": "*@dev"
  }
}
  1. 使用 autoload,添加
require_once('vendor/autoload.php');
  1. 手动下载 最新版本 并包含 init.php
require_once('/path/to/oriskami-php/init.php');

要求

  • Php 5.4, 5.5, 5.6, 7.0, 7.1

使用方法

该库需要配置您的 API 密钥,该密钥可在 我的 Oriskami 中找到。

\Oriskami\Oriskami::setApiKey("9spB-ChM6J8NwMEEG ... WsJShd6lVQH7f6xz=");

\Oriskami\Event::create(array(
  "id" => "1",
  "parameters"  => array(
    "id"                    => "1",
    "email"                 =>  "abc@gmail.com",
    "names"                 =>  "M Abc",
    "account_creation_time" =>  "2017-05-17 21:50:00",
    "account_id"            =>  "1",
    "account_n_fulfilled"   =>  "1",
    "account_total_since_created" =>  "49.40",
    "account_total_cur"     =>  "EUR",
    "invoice_time"          =>  "2017-05-17 21:55:00",
    "invoice_address_country"=>  "France",
    "invoice_address_place" =>  "75008 Paris",
    "invoice_address_street1"=>  "1 Av. des Champs-Élysées",
    "invoice_name"          =>  "M ABC",
    "invoice_phone1"        =>  "0123456789",
    "invoice_phone2"        =>  null,
    "transport_date"        =>  "2017-05-18 08:00:00",
    "transport_type"        =>  "Delivery",
    "transport_mode"        =>  "TNT",
    "transport_weight"      =>  "9.000",
    "transport_unit"        =>  "kg",
    "transport_cur"         =>  "EUR",
    "delivery_address_country" =>  "France",
    "delivery_address_place"=>  "75008 Paris",
    "delivery_address_street1" =>  "1 Av. des Champs-Élysées",
    "delivery_name"         =>  "M ABC",
    "delivery_phone1"       =>  "0123450689",
    "customer_ip_address"   =>  "1.2.3.4",
    "pmeth_origin"          =>  "FRA",
    "pmeth_validity"        =>  "0121",
    "pmeth_brand"           =>  "MC",
    "pmeth_bin"             =>  "510000",
    "pmeth_3ds"             =>  "-1",
    "cart_products"         => array("Product ref #12345"),
    "cart_details"          => array(
      array(
        "name"              =>  "Product ref #12345",
        "pu"                =>  "10.00",
        "n"                 =>  "1",
        "reimbursed"        =>  " 0",
        "available"         =>  "1",
        "amount"            =>  "10.00",
        "cur"               =>  "EUR"
      )
    ),
    "cart_n"          =>  "15000",
    "order_payment_accepted" =>  "2017-05-17 22:00:00",
    "amount_pmeth"    =>  "ABC Payment Service Provider",
    "amount_discounts"=>  0.00,
    "amount_products" =>  20.00,
    "amount_transport"=>  10.00,
    "amount_total"    =>  30.00,
    "amount_cur"      =>  "EUR"
));


# Retrieve, Update, Delete, or List Events 

\Oriskami\Event::retrieve("123")
\Oriskami\Event::retrieve("123", array("amount_transport" => "20.00"))
\Oriskami\Event::delete("123")
\Oriskami\Event::all(array("order" => "-id", "limit" => "10"))

# Create, Retrieve, Update, Delete or List Whitelists

\Oriskami\FilterWhitelist::create(array(
    "description" => "Test"
  , "feature" => "email_domain"
  , "is_active" => "true"
  , "value" => "gmail.com"))
\Oriskami\FilterWhitelist::retrieve("0")
\Oriskami\FilterWhitelist::update("0"
  , array(
      "description" => "Test"
    , "feature" => "email_domain"
    , "is_active" => "true"
    , "value" => "yahoo.com"
    ))
\Oriskami\FilterWhitelist::delete("123")
\Oriskami\FilterWhitelist::all()

资源、操作和参数

以下矩阵列出了资源(行)、CRUD 操作(列)和参数(单元格)。单元格链接指向 https://oriskami.com/docs/php 上的 API 文档或 GitHub 上的功能测试。

  • C: 创建
  • R: 检索
  • U: 更新
  • D: 删除
  • L: 列表
  • 123: 资源 ID
  • {}: 带有查询参数的 JSON

过滤参数

开发

要运行测试套件

cd path/to/oriskami/oriskami-php
composer install 
./vendor/bin/phpunit -v 

问题和功能请求

它们位于 这里

作者