xi / netvisor

Netvisor API 接口

dev-master 2018-01-22 12:51 UTC

README

适用于PHP 5.3+的Netvisor API接口。

Build Status

接口

  • 尚未添加

在开始修改之前

您必须完成以下事项以使一切正常运行

  • 从Netvisor获取您的合作伙伴ID和密钥
  • 获取Netvisor网络管理页面的访问权限(测试环境有其自己的管理页面)
  • 在您的管理页面中激活使用外部接口
  • 使用您的管理页面创建新的接口ID和密钥(与上面相同)。

使用方法

配置

大多数配置参数应从Netvisor获取。

netvisor.host           = "https://www.netvisor.biz"         // Test server is "http://integrationdemo.netvisor.fi"
netvisor.sender         = "Testiclient"                      // Pick a name that describes your service
netvisor.customerId     = "XX_yyyy_1yyy"                     // Create manually in your Netvisor management page
netvisor.partnerId      = "Xxx_yyy"                          // Obtain from your Netvisor contact
netvisor.organizationId = "2521043-1"                        // Your company ID

netvisor.userKey        = "D953E3D10457F778B009F88B038CC3C7" // Create manually in your Netvisor management page
netvisor.partnerKey     = "3BCBFB382CE884YD6C8D4F4FC1C2AC95" // Obtain from your Netvisor contact

netvisor.language       = "FI"
netvisor.enabled        = true

初始化

$config   = new Xi\Netvisor\Config(...);       // Use the parameters described above.
$netvisor = new Xi\Netvisor\Netvisor($config);

构建XML

您可以实例化某种类型的资源(例如Xi\Netvisor\Resource\Xml\SalesInvoice)。所有资源都应该扩展Xi\Netvisor\Resource\Xml\Root并实现getDtdPath()以返回指向正确的DTD文件的文件路径(用于验证)。

资源的必填参数在构造函数中给出。可选值可以通过setter设置。

销售发票

$invoice = new Xi\Netvisor\Resource\Xml\SalesInvoice(...);

$invoiceProductLine = new Xi\Netvisor\Resource\Xml\SalesInvoiceProductLine(...);

$invoice->addSalesInvoiceProductLine($invoiceProductLine);

$netvisor->addSalesInvoice($invoice);