定制 ashraam/ipaidthat-php 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

ashraam/ipaidthat-php

Composer 安装命令:

composer require ashraam/ipaidthat-php

包简介

IPaidThat PHP Api connector

README 文档

README

Latest Stable Version Build Status License

A PHP wrapper for IPaidThat's API (V2).

You can manage customers, invoices, invoice's items.

Table of contents

Installation

Using composer

composer require ashraam/ipaidthat-php

Usage

List or filter customers

This method returns an array of customers

use Ashraam\IpaidthatPhp\Ipaidthat;

$api = new Ipaidthat('your_token');

$customers = $api->customers()->list();

// With filters
$customers = $api->customers()->list([
   'last_name' => 'Doe',
   'email' => 'john.doe@gmail.com'
]);

Available filters: external_id, name, last_name, first_name, email, siren

Please refer to the official documentation for more informations about types and requirements.

Get a customer

This methods returns a customer

use Ashraam\IpaidthatPhp\Ipaidthat;

$api = new Ipaidthat('your_token');

$customers = $api->customers()->get(123);

Create a customer

this methods returns the newly created customer

The method only accept an instance of Ashraam\IpaidthatPhp\Entity\Customer

use Ashraam\IpaidthatPhp\Ipaidthat;
use Ashraam\IpaidthatPhp\Entity\Customer;

$api = new Ipaidthat('your_token');

$customer = $api->customers()->create(new Customer([
   'external_id' => 'string',
   'name' => 'string',
   'first_name' => 'string',
   'last_name' => 'string',
   'siren' => 'string',
   'vat' => 'string',
   'address' => 'string',
   'email' => 'string',
   'phone' => 'phone',
   'extra' => 'string'
]));

Update a customer

this methods returns the updated customer

The method only accept an instance of Ashraam\IpaidthatPhp\Entity\Customer

use Ashraam\IpaidthatPhp\Ipaidthat;
use Ashraam\IpaidthatPhp\Entity\Customer;

$api = new Ipaidthat('your_token');

$customer = $api->customers()->get(123);

$customer->first_name = 'Chuck';
$customer->last_name = 'Norris';

$customer = $api->customers()->update($customer);

Delete a customer

This methods returns an empty response

use Ashraam\IpaidthatPhp\Ipaidthat;

$api = new Ipaidthat('your_token');

$api->customers()->delete(123);

List or filter invoices

This methods returns an array of invoices

use Ashraam\IpaidthatPhp\Ipaidthat;

$api = new Ipaidthat('your_token');

$invoices = $api->invoices()->list();

// With filters
$invoices = $api->invoices()->list([
    'issue_date' => '2021-01-25',
    'customer_id' => 123
])

Available filters : external_id, type, status, issue_date, number, generated_number, due_date, sent, customer_id, sender_id, customer, sender.

Please refer to the official documentation for more informations about types and requirements.

Get an invoice

This methods returns an invoice by it's ID (without items)

use Ashraam\IpaidthatPhp\Ipaidthat;

$api = new Ipaidthat('your_token');

$invoice = $api->invoices()->get(750);

Create an invoice

This methods returns the newly created invoice

The method only accept an instance of Ashraam\IpaidthatPhp\Entity\Invoice

use Ashraam\IpaidthatPhp\Ipaidthat;

$api = new Ipaidthat('your_token');

$invoice = $api->invoices()->create(new Invoice([
    'external_id' => 'string, nullable',
    'issue_date' => 'Y-m-d',
    'type' => 'invoice|quote|order|credit|other',
    'due_date' => 'Y-m-d',
    'shipping' => 10.5,
    'c_field_name_1' => 'string',
    'c_field_value_1' => 'string',
    'c_field_name_2' => 'string',
    'c_field_value_2' => 'string',
    'sender' => 'integer, nullable',
    'customer' => 'interger, nullable',
    'multi_page' => 'boolean',
    'status' => 'draft|updating|not paid|paid',
    'paid' => 'boolean'
]));

Update an invoice

This methods returns the updated invoice

The method only accept an instance of Ashraam\IpaidthatPhp\Entity\Invoice

use Ashraam\IpaidthatPhp\Ipaidthat;

$api = new Ipaidthat('your_token');

$invoice = $api->invoices()->get(123);

$invoice->due_date = '2021-12-15';
$invoice->multi_page = true;

$invoice = $api->invoices()->update($invoice);

Download an invoice

This methods returns the string raw content of the PDF

use Ashraam\IpaidthatPhp\Ipaidthat;

$api = new Ipaidthat('your_token');

$contents = $api->invoices()->download(123);

file_put_contents('invoice.pdf', $contents);

Validate an invoice

This methods validate an invoice,

if the second parameter is set to true the invoice will be sent to the customer email address (default set to false)

use Ashraam\IpaidthatPhp\Ipaidthat;

$api = new Ipaidthat('your_token');

$invoice = $api->invoices()->validate(123, true);

Delete an invoice

This methods returns an empty response

Validated document can't be delete

use Ashraam\IpaidthatPhp\Ipaidthat;

$api = new Ipaidthat('your_token');

$api->invoices()->delete(123);

List or filter invoice items

This methods returns an array of InvoiceItem

use Ashraam\IpaidthatPhp\Ipaidthat;

$api = new Ipaidthat('your_token');

$items = $api->invoiceItems()->list();

// With filters
$items = $api->invoiceItems()->list([
    'invoice_id' => 13255
]);

Available filters: invoice_id, name, additionnal_info, invoice

Get an invoice item

This methods returns the item by it's ID

use Ashraam\IpaidthatPhp\Ipaidthat;

$api = new Ipaidthat('your_token');

$item = $api->invoiceItems()->get(455874);

Add an item to an invoice

This methods returns the newly created item

The method only accept an instance of Ashraam\IpaidthatPhp\Entity\InvoiceItem

use Ashraam\IpaidthatPhp\Ipaidthat;

$api = new Ipaidthat('your_token');

$item = $api->invoiceItems()->create(new InvoiceItem([
    'invoice' => $invoice_id,   // Required
    'name' => 'name',           // Required
    'unit_price' => 12.15       // Required
    'quantity' => 1,
    'tax_percent' => 20,
    'discount_percent' => 5,
    'additionnal_info' => '',
    'position' => 1
]));

Update an invoice item

This methods returns the updated item

The method only accept an instance of Ashraam\IpaidthatPhp\Entity\InvoiceItem

use Ashraam\IpaidthatPhp\Ipaidthat;

$api = new Ipaidthat('your_token');

$item = $api->invoiceItems()->get(455874);

$item->name = 'Edited name';
$item->quantity = 6;

$item = $api->invoiceItems()->update($item);

delete an invoice item

This methods returns an empty response

use Ashraam\IpaidthatPhp\Ipaidthat;

$api = new Ipaidthat('your_token');

$api->invoiceItems()->delete(455874);

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

MIT

ashraam/ipaidthat-php 适用场景与选型建议

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

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

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

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-07-02