承接 c-delouvencourt/pennylane-laravel 相关项目开发

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

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

c-delouvencourt/pennylane-laravel

最新稳定版本:1.0.2

Composer 安装命令:

composer require c-delouvencourt/pennylane-laravel

包简介

Pennylane API wrapper for Laravel 11

README 文档

README

Latest Version on Packagist

Please read the official API documentation to know what are the required fields for each endpoint.

Installation

You can install the package via composer:

composer require ashraam/pennylane-laravel

Then add the Pennylance API KEY in the .env file.

PENNYLANE_API_KEY=my_api_key

Usage

List all customers

$customers = PennylaneLaravel::customers()->list();

Get a customer by it's ID

$customer = PennylaneLaravel::customers()->get(999);

Create a new customer

$customer = PennylaneLaravel::customers()->create([
    'source_id' => (string) 1,
    'customer_type' => 'individual',
    'first_name' => 'John',
    'last_name' => 'Doe',
    'gender' => 'mister',
    'address' => "Street",
    'postal_code' => 'zip code',
    'city' => 'City',
    'country_alpha2' => 'FR',
    'emails' => ['john.doe@gmail.com'],
    'phone' => '+33625478510'
]);

Update a customer

$customer = PennylaneLaravel::customers()->update(1, [
    'delivery_address' => 'Delivery address',
    'delivery_postal_code' => 'Delivery zip code',
    'delivery_city' => 'Delivery city',
    'delivery_country_alpha2' => 'FR'
]);

List all products

$products = PennylaneLaravel::products()->list();

Get a product by it's ID

$product = PennylaneLaravel::products()->get(1);

Create a new product

$product = PennylaneLaravel::products()->create([
    'source_id' => (string) 1,
    'label' => 'Product 1',
    'unit' => 'piece',
    'price_before_tax' => 10,
    'price' => 12,
    'vat_rate' => 'FR_200',
    'currency' => 'EUR',
    'reference' => 'ref-001'
]);

Update a product

$product = PennylaneLaravel::products()->update(1, [
    'description' => 'Updated description'
]);

List all invoices

$invoices = PennylaneLaravel::invoices()->list();

// Invoices can be filtered
$invoices = PennylaneLaravel::invoices()->list([
    [
        'field' => 'customer_id',
        'operator' => 'eq',
        'value' => (string) 1
    ],
    [
        'field' => 'status',
        'operator' => 'eq',
        'value' => 'draft_status'
    ]
]);

Get an invoice by it's ID

$invoice = PennylaneLaravel::invoices()->get('RNT9MXHXAD');

Create an invoice

Second and third default value is set to false

$invoice = PennylaneLaravel::invoices()->create([
    'date' => today()->format('Y-m-d'),
    'deadline' => today()->addDays(15)->format('Y-m-d'),
    'draft' => false,
    'customer' => [
        'source_id' => (string) 1
    ],
    'line_items' => [
        [
            'label' => "My special item",
            'quantity' => 3,
            'product' => [
                'source_id' => (string) 1
            ]
        ],
        [
            'label' => "Remise",
            'quantity' => 1,
            'currency_amount' => -10,
            'unit' => 'piece',
            'vat_rate' => 'FR_200'
        ]
    ]
], $create_customers = false, $create_products = false);

Import an invoice

Third default value is set to false

$invoice = PennylaneLaravel::invoices()->import([
    'date' => today()->format('Y-m-d'),
    'deadline' => today()->addDays(15)->format('Y-m-d'),
    'invoice_number' => 'F-874',
    'currency' => 'EUR',
    'customer' => [
        'source_id' => (string) 1
    ],
    'line_items' => [
        [
            'label' => "My special item",
            'quantity' => 3,
            'product' => [
                'source_id' => (string) 1
            ]
        ],
        [
            'label' => "Remise",
            'quantity' => 1,
            'currency_amount' => -10,
            'unit' => 'piece',
            'vat_rate' => 'FR_200'
        ]
    ]
], $file_url, $create_customer = false);

List all estimates

$estimates = PennylaneLaravel::estimates()->list();

Get an estimate by it's ID

$estimate = PennylaneLaravel::estimates()->get('VVAWLPY8QB');

Create a new estimate

$estimate = PennylaneLaravel::estimates()->create([
    'date' => today()->format('Y-m-d'),
    'deadline' => today()->addDays(15)->format('Y-m-d'),
    'customer' => [
        'source_id' => (string) 1
    ],
    'line_items' => [
        [
            'label' => "My special item",
            'quantity' => 3,
            'product' => [
                'source_id' => (string) 1
            ]
        ],
        [
            'label' => "Random line",
            'quantity' => 1,
            'currency_amount' => 17.85,
            'unit' => 'piece',
            'vat_rate' => 'FR_200'
        ]
    ]
]);

Get an enum

The second parameter default value is en

$values = PennylaneLaravel::enums()->get('unit', 'fr');

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email romain.bertolucci@gmail.com instead of using the issue tracker.

Credits

License

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

统计信息

  • 总下载量: 3.69k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-07-08