承接 vormkracht10/wefact-php 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

vormkracht10/wefact-php

Composer 安装命令:

composer require vormkracht10/wefact-php

包简介

PHP package to provide a fluent interface to communicate with WeFact

README 文档

README

GitHub release (latest by date) Tests Packagist PHP Version Support Latest Version on Packagist Total Downloads

This package provides a fluent interface to communicate with the WeFact API. For the full documentation of the WeFact API, please visit https://www.wefact.nl/api/.

Table of Contents

Minimum requirements

  • PHP 8.1 or higher
  • Guzzle 7.0 or higher

Installation

You can install the package via composer:

composer require vormkracht10/wefact-php

Usage

Then you can use the package like this:

$weFact = new \Vormkracht10\WeFact\WeFact('your-api-key');

$response = $weFact->invoices()->list();
// or use listAll to call the show method for each item
$response = $weFact->invoices()->listAll();

if (isset($response['invoices'])) {
  print_r($response['invoices']);
}

Available methods

Creditor

List creditors

$response = $weFact->creditors()->list();
// or use listAll to call the show method for each item
$response = $weFact->creditors()->listAll();

if (isset($response['creditors'])) {
  print_r($response['creditors']);
}

Create creditor

Required parameters: CompanyName or SurName.

$response = $weFact->creditors()->create([
    'CompanyName' => 'Your company name',
  ]);
if ($result['status'] == 'success') {
  print_r($response['company']);
}

Update creditor

Required parameter: Identifier or CreditorCode.

$result = $weFact->creditors()->edit([
    'Identifier' => $creditorId,
    'CompanyName' => 'Your company name',
  ]);

if ($result['status'] == 'error') {
  // Something went wrong
  print_r($result['errors']);
}

Show creditor

Required parameter: Identifier or CreditorCode.

$weFact->creditors()->show(['Identifier' => $creditorId]);
// or
$weFact->creditors()->show(['CreditorCode' => $creditorCode]);

Delete creditor

Required parameter: Identifier or CreditorCode.

$weFact->creditors()->delete(['Identifier' => $creditorId]);
// or
$weFact->creditors()->delete(['CreditorCode' => $creditorCode]);

Credit Invoice

List credit invoices

$weFact->creditInvoices()->list();
// or use listAll to call the show method for each item
$response = $weFact->creditInvoices()->listAll();

Create credit invoice

Required parameters: InvoiceCode, Creditor or CreditorCode and InvoiceLines.

$weFact->creditInvoices()->create([
    'InvoiceCode' => 'your-invoice-code',
    'CreditorCode' => 'CD10001'
    'InvoiceLines' => [
        [
            'Description' => 'Your description',
            'PriceExcl' => 10,
        ],
    ],
  ])

Update credit invoice

Required parameter: Identifier or CreditInvoiceCode.

$weFact->creditInvoices()->edit([
    'Identifier' => $creditInvoiceId,
    'Comment' => 'Your comment',
  ])

Show credit invoice

Required parameter: Identifier or CreditInvoiceCode.

$weFact->creditInvoices()->show(['Identifier' => $creditInvoiceId]);
// or
$weFact->creditInvoices()->show(['CreditInvoiceCode' => $creditInvoiceCode]);

Delete credit invoice

Required parameter: Identifier or CreditInvoiceCode.

$weFact->creditInvoices()->delete(['Identifier' => $creditInvoiceId]);
// or
$weFact->creditInvoices()->delete(['CreditInvoiceCode' => $creditInvoiceCode]);

Debtor

List debtors

$weFact->debtors()->list();
// or use listAll to call the show method for each item
$response = $weFact->debtors()->listAll();

You can also search for debtors:

$weFact->debtors()->list([
  'searchat' => 'EmailAddress',
  'searchfor' => 'example@example.com'
]);

Create debtor

Required parameters: CompanyName or SurName.

$weFact->debtors()->create([
    'CompanyName' => 'Your company name',
  ])

Update debtor

Required parameter: Identifier or DebtorCode, CompanyName or SurName.

$weFact->debtors()->edit([
    'Identifier' => $debtorId,
    'CompanyName' => 'Your company name',
  ])

Show debtor

Required parameter: Identifier or DebtorCode.

$weFact->debtors()->show(['Identifier' => $debtorId]);
// or
$weFact->debtors()->show(['DebtorCode' => $debtorCode]);

Group

List groups

Required parameter: Type.

$weFact->groups()->list([
    'type' => 'debtor',
]);

Create group

Required parameters: Type and GroupName.

$weFact->groups()->create([
    'Type' => 'debtor',
    'GroupName' => 'Your group name',
  ])

Update group

Required parameter: Identifier.

$weFact->groups()->edit([
    'Identifier' => $groupId,
    'GroupName' => 'Your group name',
  ])

Show group

Required parameter: Identifier.

$weFact->groups()->show(['Identifier' => $groupId]);

Delete group

Required parameter: Identifier.

$weFact->groups()->delete(['Identifier' => $groupId]);

Invoice

List invoices

$weFact->invoices()->list();
// or use listAll to call the show method for each item
$response = $weFact->invoices()->listAll();

Create invoice

Required parameters: DebtorCode or DebtorCode and InvoiceLines.

$weFact->invoices()->create([
    'DebtorCode' => 'DB10000',
    'InvoiceLines' => [
      [
        'Number' => 1,
        'ProductCode' => 'P0001'
      ]
    ],
    [
      'Description' => 'Your product description',
      'PriceExcl' => 100
    ]
  ])

Update invoice

Required parameter: Identifier or InvoiceCode.

$weFact->invoices()->edit([
    'Identifier' => $invoiceId,
    'InvoiceLines' => [
      [
        'Number' => 1,
        'ProductCode' => 'P0001'
      ]
    ],
    [
      'Description' => 'Your product description',
      'PriceExcl' => 100
    ]
  ])

Show invoice

Required parameter: Identifier or InvoiceCode.

$weFact->invoices()->show(['Identifier' => $invoiceId]);
// or
$weFact->invoices()->show(['InvoiceCode' => $invoiceCode]);

Delete invoice

Required parameter: Identifier or InvoiceCode.

$weFact->invoices()->delete(['Identifier' => $invoiceId]);
// or
$weFact->invoices()->delete(['InvoiceCode' => $invoiceCode]);

Credit

Required parameter: Identifier or InvoiceCode.

$weFact->invoices()->credit(['Identifier' => $invoiceId]);
// or
$weFact->invoices()->credit(['InvoiceCode' => $invoiceCode]);

Part payment

Required parameter: Identifier or InvoiceCode.

$weFact->invoices()->partPayment(['Identifier' => $invoiceId]);
// or
$weFact->invoices()->partPayment(['InvoiceCode' => $invoiceCode]);

Mark invoice as paid

Required parameter: Identifier or InvoiceCode.

$weFact->invoices()->markAsPaid(['Identifier' => $invoiceId]);
// or
$weFact->invoices()->markAsPaid(['InvoiceCode' => $invoiceCode]);

Mark invoice as unpaid

Required parameter: Identifier or InvoiceCode.

$weFact->invoices()->markAsUnpaid(['Identifier' => $invoiceId]);
// or
$weFact->invoices()->markAsUnpaid(['InvoiceCode' => $invoiceCode]);

Send by email

Required parameter: Identifier or InvoiceCode.

$weFact->invoices()->sendByEmail(['Identifier' => $invoiceId]);
// or
$weFact->invoices()->sendByEmail(['InvoiceCode' => $invoiceCode]);

Send reminder by email

Required parameter: Identifier or InvoiceCode.

$weFact->invoices()->sendReminderByEmail(['Identifier' => $invoiceId]);
// or
$weFact->invoices()->sendReminderByEmail(['InvoiceCode' => $invoiceCode]);

Download

Required parameter: Identifier or InvoiceCode.

$weFact->invoices()->download(['Identifier' => $invoiceId]);
// or
$weFact->invoices()->download(['InvoiceCode' => $invoiceCode]);

Block

Required parameter: Identifier or InvoiceCode.

$weFact->invoices()->block(['Identifier' => $invoiceId]);
// or
$weFact->invoices()->block(['InvoiceCode' => $invoiceCode]);

Unblock

Required parameter: Identifier or InvoiceCode.

$weFact->invoices()->unblock(['Identifier' => $invoiceId]);
// or
$weFact->invoices()->unblock(['InvoiceCode' => $invoiceCode]);

Schedule

Required parameter: Identifier or InvoiceCode and ScheduledAt.

$weFact->invoices()->schedule([
    'Identifier' => $invoiceId,
    'ScheduledAt' => '2020-01-01 00:00:00'
  ])
// or
$weFact->invoices()->schedule([
    'InvoiceCode' => $invoiceCode,
    'ScheduledAt' => '2020-01-01 00:00:00'
  ])

Cancel schedule

Required parameter: Identifier or InvoiceCode.

$weFact->invoices()->cancelSchedule(['Identifier' => $invoiceId]);
// or
$weFact->invoices()->cancelSchedule(['InvoiceCode' => $invoiceCode]);

Pause payment process

Required parameter: Identifier or InvoiceCode.

$weFact->invoices()->paymentProcessPause(['Identifier' => $invoiceId]);
// or
$weFact->invoices()->paymentProcessPause(['InvoiceCode' => $invoiceCode]);

Reactivate payment process

Required parameter: Identifier or InvoiceCode.

$weFact->invoices()->paymentProcessReactivate(['Identifier' => $invoiceId]);
// or
$weFact->invoices()->paymentProcessReactivate(['InvoiceCode' => $invoiceCode]);

Sort lines

Required parameter: Identifier or InvoiceCode and InvoiceLines Identifier.

$weFact->invoices()->sortLines([
    'Identifier' => $invoiceId,
    'InvoiceLines' => [
      [
        'Identifier' => $invoiceLineId,
      ]
    ]
  ]);

Add invoice line

Required parameter: Identifier or InvoiceCode and InvoiceLines.

$weFact->invoices()->addLine([
    'Identifier' => $invoiceId,
    'InvoiceLines' => [
      [
        'Number' => 1,
        'ProductCode' => 'P0001'
      ]
    ],
  ]);

Delete invoice line

Required parameter: Identifier or InvoiceCode and InvoiceLines Identifier.

$weFact->invoices()->deleteLine([
    'Identifier' => $invoiceId,
    'InvoiceLines' => [
      [
        'Identifier' => $invoiceLineId,
      ]
    ]
  ]);

Add attachment

Required parameter: ReferenceIdentifier or InvoiceCode, Tyoe, Filename and Base64.

$weFact->invoices()->addAttachment([
    'ReferenceIdentifier' => $invoiceId,
    'Type' => 'invoice',
    'Filename' => 'test.pdf',
    'Base64' => 'base64string'
  ]);

Delete attachment

Required parameter: Identifier or Filename, ReferenceIdentifier or InvoiceCode and Type.

$weFact->invoices()->deleteAttachment([
    'Identifier' => $attachmentId,
    'ReferenceIdentifier' => $invoiceId,
    'Type' => 'invoice',
  ]);

Download attachment

Required parameter: Identifier or Filename, ReferenceIdentifier or InvoiceCode and Type.

$weFact->invoices()->downloadAttachment([
    'ReferenceIdentifier' => $invoiceId,
    'Filename' => 'test.pdf',
    'Type' => 'invoice',
  ]);

Product

List products

$weFact->products()->list();
// or use listAll to call the show method for each item
$response = $weFact->products()->listAll();

Create product

Required parameters: ProductName, ProductKeyPhrase and PriceExcl.

$weFact->products()->create([
    'ProductName' => 'Your product name',
    'ProductKeyPhrase' => 'Your product key phrase',
    'PriceExcl' => 100
  ])

Update product

Required parameter: Identifier or ProductCode.

$weFact->products()->edit([
    'Identifier' => $productId,
    'ProductName' => 'Your product name',
    'ProductKeyPhrase' => 'Your product key phrase',
    'PriceExcl' => 100
  ])

Show product

Required parameter: Identifier

$weFact->products()->show(['Identifier' => $productId]);

Delete product

Required parameter: Identifier or ProductCode.

$weFact->products()->delete(['Identifier' => $productId]);
// or
$weFact->products()->delete(['ProductCode' => $productCode]);

Settings

List settings

$weFact->settings()->list();

Settings - Cost Category

List cost categories

$weFact->costCategories()->list();
// or use listAll to call the show method for each item
$response = $weFact->costCategories()->listAll();

Create cost category

Required parameters: Title.

$weFact->costCategories()->create([
    'Title' => 'Your cost category title',
  ]);

Update cost category

Required parameter: Identifier.

$weFact->costCategories()->edit([
  'Identifier' => $costCategoryId,
]);

Show cost category

Required parameter: Identifier.

$weFact->costCategories()->show(['Identifier' => $costCategoryId]);

Delete cost category

Required parameter: Identifier.

$weFact->costCategories()->delete(['Identifier' => $costCategoryId]);

Subscription

List subscriptions

$weFact->subscriptions()->list();
// or use listAll to call the show method for each item
$response = $weFact->subscriptions()->listAll();

Create subscription

Required parameters: Debtor or DebtorCode and ProductCode. When ProductCode is empty, Description, PriceExcl and Periodic are required.

Please note: You can pass either the TerminateAfter or the TerminationDate, not both. The TerminateAfter includes the number of times the subscription has been billed in the past.

$weFact->subscriptions()->create([
    'DebtorCode' => 'DB10000',
    'ProductCode' => 'P0001',
    'Description' => 'Your product description',
    'PriceExcl' => 100,
    'Periodic' => 'month',
    'TerminateAfter' => 12
  ])

Update subscription

Required parameter: Identifier.

Please note: You can pass either the TerminateAfter or the TerminationDate, not both. The TerminateAfter includes the number of times the subscription has been billed in the past.

$weFact->subscriptions()->edit([
    'Identifier' => $subscriptionId,
    'Description' => 'Your product description',
    'PriceExcl' => 100,
    'Periodic' => 'month',
    'TerminateAfter' => 12
  ])

Show subscription

Required parameter: Identifier.

$weFact->subscriptions()->show(['Identifier' => $subscriptionId]);

Terminate subscription

Required parameter: Identifier.

$weFact->subscriptions()->terminate(['Identifier' => $subscriptionId]);

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.

vormkracht10/wefact-php 适用场景与选型建议

vormkracht10/wefact-php 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 166 次下载、GitHub Stars 达 3, 最近一次更新时间为 2023 年 06 月 07 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「vormkracht10」 「wefact-php」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 vormkracht10/wefact-php 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 vormkracht10/wefact-php 我们能提供哪些服务?
定制开发 / 二次开发

基于 vormkracht10/wefact-php 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 166
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 3
  • 点击次数: 17
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 3
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-06-07