xubio / sdk
Xubio SDK API 集成库
v0.1.0
2021-04-20 18:12 UTC
Requires
- ext-curl: *
README
安装
使用 Composer
从命令行
composer require xubio/sdk:0.1.0
作为项目 composer.json 中的依赖项
{ "require": { "xubio/sdk": "0.1.0" } }
通过下载
- 克隆/下载此存储库
- 将
lib
文件夹复制到项目所需文件夹。
特定方法
返回值
API 以 数组 形式返回所有值
配置凭据
- 从 Xubio 获取您的 CLIENT_ID 和 SECRET_ID
require_once ('lib/xubio.php'); try { $xb = new XubioApi('CLIENT_ID', 'SECRET_ID'); } catch (Exception $e) { echo $e->getMessage() . ' ' . $e->getCode(); }
方法
获取客户端
$client = $xb->get_client($id); print_r($client);
创建客户端
$client = array( "nombre" => 'Juan Perez', "identificacionTributaria" => array( 'nombre' => 'CUIT', 'codigo' => 'CUIT', 'id' => '9', ), "categoriaFiscal" => array( 'nombre' => 'Responsable Inscripto', 'codigo' => 'RI', 'id' => '1', ), "provincia" => array( 'nombre' => 'Ciudad Autónoma de Buenos Aires', 'codigo' => 'CIUDAD_AUTONOMA_DE_BUENOS_AIRES', 'id' => '43', ), "direccion" => 'dirección 123', "email" => 'test@test.com', "telefono" => '1122334455', "razonSocial" => 'Empresa Test', "codigoPostal" => '1234', "cuentaCompra_id" => array ( "nombre" => "Proveedores", "codigo" => "PROVEEDORES", "id" => -7, ), "cuentaVenta_id" => array ( "nombre" => "Deudores por Venta", "codigo" => "DEUDORES_POR_VENTA", "id" => -3, ), "pais" => array ( "nombre" => "Argentina", "codigo" => "ARGENTINA", "id" => 1, ), "localidad" => array ( "nombre" => 'Floresta', "codigo" => 'FLORESTA', "id" => '43', ), "descripcion" => "cLIENTE CREADO DESE API Xubio", "CUIT" => '30144555774', ); $result = $xb->create_client($client); print_r($result);
获取产品
$productos = $xb->get_product(); print_r($productos);
创建发票
$invoiceData = array( "circuitoContable" => array ( "ID" => -2, ), "descripcion" => "Invoide description", "fecha" => date("Y-m-d\Z", time()), "moneda" => array ( "ID" => -2, ), "condicionDePago" => 7, "cotizacion" => 1, "cotizacionListaDePrecio" => 1, "deposito" => array ( "ID" => -2, ), "fechaVto" => date("Y-m-d\Z", time()), "cliente" => array ( "ID" => "XXXX", ), "facturaNoExportacion" => false, "porcentajeComision" => 0, "puntoVenta" => array ( "ID" => "XXXX", ), "transaccionProductoItems" => array ( array ( "cantidad" => 3, "precio" => 160, "producto" => array ( "ID" => "XXXX", ), ), array ( "cantidad" => 6, "precio" => 360, "producto" => array ( "ID" => "XXXX", ), ), array ( "cantidad" => 1, "precio" => 60, "producto" => array ( "ID" => "XXXX", ), ), ), "tipo" => 1, ); $result = $xb->create_invoice($invoiceData); print_r($result);