Merge pull request #9609 from turbo124/v5-develop

v5.9.4
This commit is contained in:
David Bomba 2024-06-09 10:58:36 +10:00 committed by GitHub
commit e90c651f38
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
15 changed files with 486 additions and 31 deletions

View File

@ -1 +1 @@
5.9.3
5.9.4

View File

@ -146,6 +146,9 @@ class PdfSlot extends Component
(new VendorHtmlEngine($this->invitation))->generateLabelsAndValues() :
(new HtmlEngine($this->invitation))->generateLabelsAndValues();
$this->entity->terms = $this->entity->parseHtmlVariables('terms', $this->html_variables);
$this->entity->public_notes = $this->entity->parseHtmlVariables('public_notes', $this->html_variables);
return render('components.livewire.pdf-slot', [
'invitation' => $this->invitation,
'entity' => $this->entity,

View File

@ -92,6 +92,7 @@ class BTCPayPaymentDriver extends BaseDriver
{
$webhook_payload = file_get_contents('php://input');
/** @var \stdClass $btcpayRep */
$btcpayRep = json_decode($webhook_payload);
if ($btcpayRep == null) {
throw new PaymentFailed('Empty data');
@ -109,6 +110,7 @@ class BTCPayPaymentDriver extends BaseDriver
return;
}
$sig = '';
$headers = getallheaders();
foreach ($headers as $key => $value) {
if (strtolower($key) === 'btcpay-sig') {
@ -141,6 +143,7 @@ class BTCPayPaymentDriver extends BaseDriver
];
$payment = $this->createPayment($dataPayment, $StatusId);
} else {
/** @var \App\Models\Payment $payment */
$payment = Payment::find($this->payment_hash->payment_id);
$StatusId = $payment->status_id;
}

View File

@ -115,6 +115,7 @@ class PayPalPPCPPaymentDriver extends PayPalBasePaymentDriver
{
nlog("response");
$r = false;
$request['gateway_response'] = str_replace("Error: ", "", $request['gateway_response']);
$response = json_decode($request['gateway_response'], true);

View File

@ -62,6 +62,7 @@ class PayPalRestPaymentDriver extends PayPalBasePaymentDriver
{
nlog("response");
$this->init();
$r = false;
$request['gateway_response'] = str_replace("Error: ", "", $request['gateway_response']);
$response = json_decode($request['gateway_response'], true);

View File

@ -196,6 +196,8 @@ class RoEInvoice extends AbstractService
$ubl_invoice->setDocumentCurrencyCode($invoice->client->getCurrencyCode());
$ubl_invoice->setTaxCurrencyCode($invoice->client->getCurrencyCode());
$taxName = '';
foreach ($invoice->line_items as $index => $item) {
if (!empty($item->tax_name1)) {
@ -205,9 +207,7 @@ class RoEInvoice extends AbstractService
} elseif (!empty($item->tax_name3)) {
$taxName = $item->tax_name3;
}
else {
$taxName = '';
}
}
$supplier_party = $this->createParty($company, $companyVatNr, $coEmail, $coPhone, $companyIdn, $coFullName, 'company', $taxName);

View File

@ -933,6 +933,7 @@ class Email implements ShouldQueue
private function refreshOfficeToken(User $user): mixed
{
$expiry = $user->oauth_user_token_expiry ?: now()->subDay();
$token = false;
if ($expiry->lt(now())) {
$guzzle = new \GuzzleHttp\Client();

View File

@ -564,6 +564,7 @@ class TemplateService
'credit_balance' => $invoice->client->credit_balance,
'vat_number' => $invoice->client->vat_number ?? '',
'currency' => $invoice->client->currency()->code ?? 'USD',
'locale' => substr($invoice->client->locale(),0,2),
],
'payments' => $payments,
'total_tax_map' => $invoice->calc()->getTotalTaxMap(),

View File

@ -17,8 +17,8 @@ return [
'require_https' => env('REQUIRE_HTTPS', true),
'app_url' => rtrim(env('APP_URL', ''), '/'),
'app_domain' => env('APP_DOMAIN', 'invoicing.co'),
'app_version' => env('APP_VERSION', '5.9.3'),
'app_tag' => env('APP_TAG', '5.9.3'),
'app_version' => env('APP_VERSION', '5.9.4'),
'app_tag' => env('APP_TAG', '5.9.4'),
'minimum_client_version' => '5.0.16',
'terms_version' => '1.0.1',
'api_secret' => env('API_SECRET', false),

View File

@ -0,0 +1,155 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
private array $timezones = [
'Pacific/Midway' => 'Pacific/Midway',
'US/Samoa' => 'Pacific/Pago_Pago',
'US/Hawaii' => 'Pacific/Honolulu',
'US/Alaska' => 'America/Anchorage',
'US/Pacific' => 'America/Los_Angeles',
'America/Tijuana' => 'America/Tijuana',
'US/Arizona' => 'America/Phoenix',
'US/Mountain' => 'America/Denver',
'America/Chihuahua' => 'America/Chihuahua',
'America/Mazatlan' => 'America/Mazatlan',
'America/Mexico_City' => 'America/Mexico_City',
'America/Monterrey' => 'America/Monterrey',
'Canada/Saskatchewan' => 'America/Regina',
'US/Central' => 'America/Chicago',
'US/Eastern' => 'America/New_York',
'US/East-Indiana' => 'America/Indiana/Indianapolis',
'America/Bogota' => 'America/Bogota',
'America/Lima' => 'America/Lima',
'America/Caracas' => 'America/Caracas',
'Canada/Atlantic' => 'America/Halifax',
'America/La_Paz' => 'America/La_Paz',
'America/Santiago' => 'America/Santiago',
'Canada/Newfoundland' => 'America/St_Johns',
'America/Buenos_Aires' => 'America/Argentina/Buenos_Aires',
'America/Godthab' => 'America/Godthab',
'America/Sao_Paulo' => 'America/Sao_Paulo',
'Atlantic/Stanley' => 'Atlantic/Stanley',
'Atlantic/Azores' => 'Atlantic/Azores',
'Atlantic/Cape_Verde' => 'Atlantic/Cape_Verde',
'Africa/Casablanca' => 'Africa/Casablanca',
'Europe/Dublin' => 'Europe/Dublin',
'Europe/Lisbon' => 'Europe/Lisbon',
'Europe/London' => 'Europe/London',
'Africa/Monrovia' => 'Africa/Monrovia',
'Europe/Amsterdam' => 'Europe/Amsterdam',
'Europe/Belgrade' => 'Europe/Belgrade',
'Europe/Berlin' => 'Europe/Berlin',
'Europe/Bratislava' => 'Europe/Bratislava',
'Europe/Brussels' => 'Europe/Brussels',
'Europe/Budapest' => 'Europe/Budapest',
'Europe/Copenhagen' => 'Europe/Copenhagen',
'Europe/Ljubljana' => 'Europe/Ljubljana',
'Europe/Madrid' => 'Europe/Madrid',
'Europe/Paris' => 'Europe/Paris',
'Europe/Prague' => 'Europe/Prague',
'Europe/Rome' => 'Europe/Rome',
'Europe/Sarajevo' => 'Europe/Sarajevo',
'Europe/Skopje' => 'Europe/Skopje',
'Europe/Stockholm' => 'Europe/Stockholm',
'Europe/Vienna' => 'Europe/Vienna',
'Europe/Warsaw' => 'Europe/Warsaw',
'Europe/Zagreb' => 'Europe/Zagreb',
'Europe/Athens' => 'Europe/Athens',
'Europe/Bucharest' => 'Europe/Bucharest',
'Africa/Cairo' => 'Africa/Cairo',
'Africa/Harare' => 'Africa/Harare',
'Europe/Helsinki' => 'Europe/Helsinki',
'Asia/Jerusalem' => 'Asia/Jerusalem',
'Europe/Kiev' => 'Europe/Kiev',
'Europe/Minsk' => 'Europe/Minsk',
'Europe/Riga' => 'Europe/Riga',
'Europe/Sofia' => 'Europe/Sofia',
'Europe/Tallinn' => 'Europe/Tallinn',
'Europe/Vilnius' => 'Europe/Vilnius',
'Europe/Istanbul' => 'Europe/Istanbul',
'Asia/Baghdad' => 'Asia/Baghdad',
'Asia/Kuwait' => 'Asia/Kuwait',
'Africa/Nairobi' => 'Africa/Nairobi',
'Asia/Riyadh' => 'Asia/Riyadh',
'Asia/Tehran' => 'Asia/Tehran',
'Europe/Moscow' => 'Europe/Moscow',
'Asia/Baku' => 'Asia/Baku',
'Europe/Volgograd' => 'Europe/Volgograd',
'Asia/Muscat' => 'Asia/Muscat',
'Asia/Tbilisi' => 'Asia/Tbilisi',
'Asia/Yerevan' => 'Asia/Yerevan',
'Asia/Kabul' => 'Asia/Kabul',
'Asia/Karachi' => 'Asia/Karachi',
'Asia/Tashkent' => 'Asia/Tashkent',
'Asia/Kolkata' => 'Asia/Kolkata',
'Asia/Kathmandu' => 'Asia/Kathmandu',
'Asia/Yekaterinburg' => 'Asia/Yekaterinburg',
'Asia/Almaty' => 'Asia/Almaty',
'Asia/Dhaka' => 'Asia/Dhaka',
'Asia/Novosibirsk' => 'Asia/Novosibirsk',
'Asia/Bangkok' => 'Asia/Bangkok',
'Asia/Ho_Chi_Minh' => 'Asia/Ho_Chi_Minh',
'Asia/Jakarta' => 'Asia/Jakarta',
'Asia/Krasnoyarsk' => 'Asia/Krasnoyarsk',
'Asia/Chongqing' => 'Asia/Chongqing',
'Asia/Hong_Kong' => 'Asia/Hong_Kong',
'Asia/Kuala_Lumpur' => 'Asia/Kuala_Lumpur',
'Australia/Perth' => 'Australia/Perth',
'Asia/Singapore' => 'Asia/Singapore',
'Asia/Taipei' => 'Asia/Taipei',
'Asia/Ulaanbaatar' => 'Asia/Ulaanbaatar',
'Asia/Urumqi' => 'Asia/Urumqi',
'Asia/Irkutsk' => 'Asia/Irkutsk',
'Asia/Seoul' => 'Asia/Seoul',
'Asia/Tokyo' => 'Asia/Tokyo',
'Australia/Adelaide' => 'Australia/Adelaide',
'Australia/Darwin' => 'Australia/Darwin',
'Asia/Yakutsk' => 'Asia/Yakutsk',
'Australia/Brisbane' => 'Australia/Brisbane',
'Australia/Canberra' => 'Australia/Sydney',
'Pacific/Guam' => 'Pacific/Guam',
'Australia/Hobart' => 'Australia/Hobart',
'Australia/Melbourne' => 'Australia/Melbourne',
'Pacific/Port_Moresby' => 'Pacific/Port_Moresby',
'Australia/Sydney' => 'Australia/Sydney',
'Asia/Vladivostok' => 'Asia/Vladivostok',
'Asia/Magadan' => 'Asia/Magadan',
'Pacific/Auckland' => 'Pacific/Auckland',
'Pacific/Fiji' => 'Pacific/Fiji'
];
/**
* Run the migrations.
*/
public function up(): void
{
if($c=\App\Models\Currency::find(63))
{
$c->precision = 0;
$c->save();
}
foreach($this->timezones as $key => $value) {
\App\Models\Timezone::where('name', $key)->update(['name' => $value]);
}
}
/**
* Reverse the migrations.
*/
public function down(): void
{
//
}
};

View File

@ -38,29 +38,29 @@ class ConstantsSeeder extends Seeder
*/
$timezones[] = ['name'=>'Pacific/Midway', 'location', 'location' => '(GMT-11:00) Midway Island', 'utc_offset' => -39600];
$timezones[] = ['name'=>'US/Samoa', 'location' => '(GMT-11:00) Samoa', 'utc_offset' => -39600];
$timezones[] = ['name'=>'US/Hawaii', 'location' => '(GMT-10:00) Hawaii', 'utc_offset' => -36000];
$timezones[] = ['name'=>'US/Alaska', 'location' => '(GMT-09:00) Alaska', 'utc_offset' => -32400];
$timezones[] = ['name'=>'US/Pacific', 'location' => '(GMT-08:00) Pacific Time (US & Canada)', 'utc_offset' => -28800];
$timezones[] = ['name'=>'Pacific/Pago_Pago', 'location' => '(GMT-11:00) Samoa', 'utc_offset' => -39600];
$timezones[] = ['name'=>'Pacific/Honolulu', 'location' => '(GMT-10:00) Hawaii', 'utc_offset' => -36000];
$timezones[] = ['name'=>'America/Anchorage', 'location' => '(GMT-09:00) Alaska', 'utc_offset' => -32400];
$timezones[] = ['name'=>'America/Los_Angeles', 'location' => '(GMT-08:00) Pacific Time (US & Canada)', 'utc_offset' => -28800];
$timezones[] = ['name'=>'America/Tijuana', 'location' => '(GMT-08:00) Tijuana', 'utc_offset' => -28800];
$timezones[] = ['name'=>'US/Arizona', 'location' => '(GMT-07:00) Arizona', 'utc_offset' => -25200];
$timezones[] = ['name'=>'US/Mountain', 'location' => '(GMT-07:00) Mountain Time (US & Canada)', 'utc_offset' => -25200];
$timezones[] = ['name'=>'America/Phoenix', 'location' => '(GMT-07:00) Arizona', 'utc_offset' => -25200];
$timezones[] = ['name'=>'America/Denver', 'location' => '(GMT-07:00) Mountain Time (US & Canada)', 'utc_offset' => -25200];
$timezones[] = ['name'=>'America/Chihuahua', 'location' => '(GMT-07:00) Chihuahua', 'utc_offset' => -25200];
$timezones[] = ['name'=>'America/Mazatlan', 'location' => '(GMT-07:00) Mazatlan', 'utc_offset' => -25200];
$timezones[] = ['name'=>'America/Mexico_City', 'location' => '(GMT-06:00) Mexico City', 'utc_offset' => -21600];
$timezones[] = ['name'=>'America/Monterrey', 'location' => '(GMT-06:00) Monterrey', 'utc_offset' => -21600];
$timezones[] = ['name'=>'Canada/Saskatchewan', 'location' => '(GMT-06:00) Saskatchewan', 'utc_offset' => -21600];
$timezones[] = ['name'=>'US/Central', 'location' => '(GMT-06:00) Central Time (US & Canada)', 'utc_offset' => -21600];
$timezones[] = ['name'=>'US/Eastern', 'location' => '(GMT-05:00) Eastern Time (US & Canada)', 'utc_offset' => -18000];
$timezones[] = ['name'=>'US/East-Indiana', 'location' => '(GMT-05:00) Indiana (East)', 'utc_offset' => -18000];
$timezones[] = ['name'=>'America/Regina', 'location' => '(GMT-06:00) Saskatchewan', 'utc_offset' => -21600];
$timezones[] = ['name'=>'America/Chicago', 'location' => '(GMT-06:00) Central Time (US & Canada)', 'utc_offset' => -21600];
$timezones[] = ['name'=>'America/New_York', 'location' => '(GMT-05:00) Eastern Time (US & Canada)', 'utc_offset' => -18000];
$timezones[] = ['name'=>'America/Indiana/Indianapolis', 'location' => '(GMT-05:00) Indiana (East)', 'utc_offset' => -18000];
$timezones[] = ['name'=>'America/Bogota', 'location' => '(GMT-05:00) Bogota', 'utc_offset' => -18000];
$timezones[] = ['name'=>'America/Lima', 'location' => '(GMT-05:00) Lima', 'utc_offset' => -18000];
$timezones[] = ['name'=>'America/Caracas', 'location' => '(GMT-04:00) Caracas', 'utc_offset' => -14400];
$timezones[] = ['name'=>'Canada/Atlantic', 'location' => '(GMT-04:00) Atlantic Time (Canada)', 'utc_offset' => -14400];
$timezones[] = ['name'=>'America/Halifax', 'location' => '(GMT-04:00) Atlantic Time (Canada)', 'utc_offset' => -14400];
$timezones[] = ['name'=>'America/La_Paz', 'location' => '(GMT-04:00) La Paz', 'utc_offset' => -14400];
$timezones[] = ['name'=>'America/Santiago', 'location' => '(GMT-04:00) Santiago', 'utc_offset' => -14400];
$timezones[] = ['name'=>'Canada/Newfoundland', 'location' => '(GMT-03:30) Newfoundland', 'utc_offset' => -12600];
$timezones[] = ['name'=>'America/Buenos_Aires', 'location' => '(GMT-03:00) Buenos Aires', 'utc_offset' => -10800];
$timezones[] = ['name'=>'America/St_Johns', 'location' => '(GMT-03:30) Newfoundland', 'utc_offset' => -12600];
$timezones[] = ['name'=>'America/Argentina/Buenos_Aires', 'location' => '(GMT-03:00) Buenos Aires', 'utc_offset' => -10800];
$timezones[] = ['name'=>'America/Godthab', 'location' => '(GMT-03:00) Greenland', 'utc_offset' => -10800];
$timezones[] = ['name'=>'America/Sao_Paulo', 'location' => '(GMT-03:00) Sao Paulo', 'utc_offset' => -10800];
$timezones[] = ['name'=>'Atlantic/Stanley', 'location' => '(GMT-02:00) Stanley', 'utc_offset' => -7200];
@ -141,7 +141,7 @@ class ConstantsSeeder extends Seeder
$timezones[] = ['name'=>'Australia/Darwin', 'location' => '(GMT+09:30) Darwin', 'utc_offset' => 34200];
$timezones[] = ['name'=>'Asia/Yakutsk', 'location' => '(GMT+10:00) Yakutsk', 'utc_offset' => 36000];
$timezones[] = ['name'=>'Australia/Brisbane', 'location' => '(GMT+10:00) Brisbane', 'utc_offset' => 36000];
$timezones[] = ['name'=>'Australia/Canberra', 'location' => '(GMT+10:00) Canberra', 'utc_offset' => 36000];
$timezones[] = ['name'=>'Australia/Sydney', 'location' => '(GMT+10:00) Canberra', 'utc_offset' => 36000];
$timezones[] = ['name'=>'Pacific/Guam', 'location' => '(GMT+10:00) Guam', 'utc_offset' => 36000];
$timezones[] = ['name'=>'Australia/Hobart', 'location' => '(GMT+10:00) Hobart', 'utc_offset' => 36000];
$timezones[] = ['name'=>'Australia/Melbourne', 'location' => '(GMT+10:00) Melbourne', 'utc_offset' => 36000];

View File

@ -85,7 +85,7 @@ class CurrenciesSeeder extends Seeder
['id' => 60, 'name' => 'Taiwan New Dollar', 'code' => 'TWD', 'symbol' => 'NT$', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'],
['id' => 61, 'name' => 'Dominican Peso', 'code' => 'DOP', 'symbol' => 'RD$', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'],
['id' => 62, 'name' => 'Chilean Peso', 'code' => 'CLP', 'symbol' => '$', 'precision' => '0', 'thousand_separator' => '.', 'decimal_separator' => ','],
['id' => 63, 'name' => 'Icelandic Króna', 'code' => 'ISK', 'symbol' => 'kr', 'precision' => '2', 'thousand_separator' => '.', 'decimal_separator' => ',', 'swap_currency_symbol' => true],
['id' => 63, 'name' => 'Icelandic Króna', 'code' => 'ISK', 'symbol' => 'kr', 'precision' => '0', 'thousand_separator' => '.', 'decimal_separator' => ',', 'swap_currency_symbol' => true],
['id' => 64, 'name' => 'Papua New Guinean Kina', 'code' => 'PGK', 'symbol' => 'K', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'],
['id' => 65, 'name' => 'Jordanian Dinar', 'code' => 'JOD', 'symbol' => '', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'],
['id' => 66, 'name' => 'Myanmar Kyat', 'code' => 'MMK', 'symbol' => 'K', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'],

View File

@ -2249,6 +2249,43 @@ paths:
description: 'Server error'
default:
$ref: "#/components/responses/default"
"/api/v1/companies/current":
post:
tags:
- companies
summary: "Returns the current comapny"
description: "Returns the current company based on the API token passed in"
operationId: showCurrentCompany
parameters:
- $ref: "#/components/parameters/X-API-TOKEN"
- $ref: "#/components/parameters/X-Requested-With"
- $ref: "#/components/parameters/include"
responses:
200:
description: "Returns the company object"
headers:
X-MINIMUM-CLIENT-VERSION:
$ref: "#/components/headers/X-MINIMUM-CLIENT-VERSION"
X-RateLimit-Remaining:
$ref: "#/components/headers/X-RateLimit-Remaining"
X-RateLimit-Limit:
$ref: "#/components/headers/X-RateLimit-Limit"
content:
application/json:
schema:
$ref: "#/components/schemas/Company"
401:
$ref: "#/components/responses/401"
403:
$ref: "#/components/responses/403"
422:
$ref: "#/components/responses/422"
429:
$ref: "#/components/responses/429"
5XX:
description: 'Server error'
default:
$ref: "#/components/responses/default"
/api/v1/company_gateways:
get:
tags:
@ -10138,10 +10175,28 @@ paths:
tags:
- products
summary: "List products"
x-code-samples:
- lang: curl
label: Curl
source: |
curl -X GET 'https://invoicing.co/api/v1/products?filter=search&per_page=20&page=1&include=documents' \
-H "X-API-TOKEN:company-token-test" \
-H "X-Requested-With: XMLHttpRequest";
- lang: go
label: PHP
source: |
$ninja = new InvoiceNinja("your_token");
$products = $ninja->products->all([
'filter' => 'search',
'per_page' => 20,
'page' => 1,
'include' => 'documents'
]);
description: |
Lists products, search and filters allow fine grained lists to be generated.
Query parameters can be added to perform fine grained filtering of the products list, these are handled by the ProductFilters class
which defines the methods available
Lists products within your company.
You can search and filter the result set using query parameters. These can be chained together allowing fine grained lists to be generated.
operationId: getProducts
parameters:
- $ref: "#/components/parameters/X-API-TOKEN"
@ -10213,6 +10268,25 @@ paths:
tags:
- products
summary: "Create Product"
x-code-samples:
- lang: curl
label: Curl
source: |
curl -X POST 'https://invoicing.co/api/v1/products' \
-H "X-API-TOKEN:company-token-test" \
-H "Content-Type:application/json" \
-d '{"product_key":"sku_1","notes":"product description","cost":1,"price":10}' \
-H "X-Requested-With: XMLHttpRequest";
- lang: go
label: PHP
source: |
$ninja = new InvoiceNinja("your_token");
$products = $ninja->products->create([
'product_key' => "sku_1",
'notes' => "product description",
'cost' => 1,
'price' => 10
]);
description: "Adds a product to a company"
operationId: storeProduct
parameters:
@ -10257,6 +10331,18 @@ paths:
tags:
- products
summary: "Show product"
x-code-samples:
- lang: curl
label: Curl
source: |
curl -X GET 'https://invoicing.co/api/v1/products/{id}' \
-H "X-API-TOKEN:company-token-test" \
-H "X-Requested-With: XMLHttpRequest";
- lang: php
label: PHP
source: |
$ninja = new InvoiceNinja("your_token");
$product = $ninja->products->get("{id}");
description: "Displays a product by id"
operationId: showProduct
parameters:
@ -10301,6 +10387,27 @@ paths:
tags:
- products
summary: "Update product"
x-code-samples:
- lang: curl
label: Curl
source: |
curl -X PUT 'https://invoicing.co/api/v1/products/{id}' \
-H "X-API-TOKEN:company-token-test" \
-H "Content-Type: application/json" \
-d '{
"product_key": "Updated Product",
"price": 150.0,
"notes": "An updated description of the product"
}'
- lang: go
label: PHP
source: |
$ninja = new InvoiceNinja("your_token");
$product = $ninja->products->update("id", [
"name" => "Updated Product",
"price" => 150.0,
"description" => "An updated description of the product"
]);
description: "Handles the updating of a product by id"
operationId: updateProduct
parameters:
@ -10352,6 +10459,18 @@ paths:
tags:
- products
summary: "Delete product"
x-code-samples:
- lang: curl
label: Curl
source: |
curl -X DELETE 'https://invoicing.co/api/v1/products/{id}' \
-H "X-API-TOKEN:company-token-test" \
-H "X-Requested-With: XMLHttpRequest";
- lang: go
label: PHP
source: |
$ninja = new InvoiceNinja("your_token");
$ninja->products->bulk("delete", "id");
description: "Handles the deletion of a product by id"
operationId: deleteProduct
parameters:
@ -10393,6 +10512,18 @@ paths:
tags:
- products
summary: "Edit product"
x-code-samples:
- lang: curl
label: Curl
source: |
curl -X GET 'https://invoicing.co/api/v1/products/{id}/edit' \
-H "X-API-TOKEN:company-token-test" \
-H "X-Requested-With: XMLHttpRequest";
- lang: php
label: PHP
source: |
$ninja = new InvoiceNinja("your_token");
$product = $ninja->products->get("{id}");
description: "Displays an Product by id"
operationId: editProduct
parameters:
@ -10476,6 +10607,20 @@ paths:
tags:
- products
summary: "Bulk product actions"
x-code-samples:
- lang: curl
label: Curl
source: |
curl -X GET 'https://invoicing.co/api/v1/products/bulk' \
-H "Content-Type:application/json" \
-d '{"action":"archive","ids":["id","id2"]}' \
-H "X-API-TOKEN:company-token-test" \
-H "X-Requested-With: XMLHttpRequest";
- lang: php
label: PHP
source: |
$ninja = new InvoiceNinja("your_token");
$product = $ninja->products->bulk("action", ["id","id2"]);
description: "Archive / Restore / Delete / Set tax id in bulk"
operationId: bulkProducts
parameters:

View File

@ -2159,6 +2159,43 @@ paths:
description: 'Server error'
default:
$ref: "#/components/responses/default"
"/api/v1/companies/current":
post:
tags:
- companies
summary: "Returns the current comapny"
description: "Returns the current company based on the API token passed in"
operationId: showCurrentCompany
parameters:
- $ref: "#/components/parameters/X-API-TOKEN"
- $ref: "#/components/parameters/X-Requested-With"
- $ref: "#/components/parameters/include"
responses:
200:
description: "Returns the company object"
headers:
X-MINIMUM-CLIENT-VERSION:
$ref: "#/components/headers/X-MINIMUM-CLIENT-VERSION"
X-RateLimit-Remaining:
$ref: "#/components/headers/X-RateLimit-Remaining"
X-RateLimit-Limit:
$ref: "#/components/headers/X-RateLimit-Limit"
content:
application/json:
schema:
$ref: "#/components/schemas/Company"
401:
$ref: "#/components/responses/401"
403:
$ref: "#/components/responses/403"
422:
$ref: "#/components/responses/422"
429:
$ref: "#/components/responses/429"
5XX:
description: 'Server error'
default:
$ref: "#/components/responses/default"
/api/v1/company_gateways:
get:
tags:

View File

@ -3,10 +3,28 @@
tags:
- products
summary: "List products"
x-code-samples:
- lang: curl
label: Curl
source: |
curl -X GET 'https://invoicing.co/api/v1/products?filter=search&per_page=20&page=1&include=documents' \
-H "X-API-TOKEN:company-token-test" \
-H "X-Requested-With: XMLHttpRequest";
- lang: go
label: PHP
source: |
$ninja = new InvoiceNinja("your_token");
$products = $ninja->products->all([
'filter' => 'search',
'per_page' => 20,
'page' => 1,
'include' => 'documents'
]);
description: |
Lists products, search and filters allow fine grained lists to be generated.
Query parameters can be added to perform fine grained filtering of the products list, these are handled by the ProductFilters class
which defines the methods available
Lists products within your company.
You can search and filter the result set using query parameters. These can be chained together allowing fine grained lists to be generated.
operationId: getProducts
parameters:
- $ref: "#/components/parameters/X-API-TOKEN"
@ -78,6 +96,25 @@
tags:
- products
summary: "Create Product"
x-code-samples:
- lang: curl
label: Curl
source: |
curl -X POST 'https://invoicing.co/api/v1/products' \
-H "X-API-TOKEN:company-token-test" \
-H "Content-Type:application/json" \
-d '{"product_key":"sku_1","notes":"product description","cost":1,"price":10}' \
-H "X-Requested-With: XMLHttpRequest";
- lang: go
label: PHP
source: |
$ninja = new InvoiceNinja("your_token");
$products = $ninja->products->create([
'product_key' => "sku_1",
'notes' => "product description",
'cost' => 1,
'price' => 10
]);
description: "Adds a product to a company"
operationId: storeProduct
parameters:
@ -122,6 +159,18 @@
tags:
- products
summary: "Show product"
x-code-samples:
- lang: curl
label: Curl
source: |
curl -X GET 'https://invoicing.co/api/v1/products/{id}' \
-H "X-API-TOKEN:company-token-test" \
-H "X-Requested-With: XMLHttpRequest";
- lang: php
label: PHP
source: |
$ninja = new InvoiceNinja("your_token");
$product = $ninja->products->get("{id}");
description: "Displays a product by id"
operationId: showProduct
parameters:
@ -166,6 +215,27 @@
tags:
- products
summary: "Update product"
x-code-samples:
- lang: curl
label: Curl
source: |
curl -X PUT 'https://invoicing.co/api/v1/products/{id}' \
-H "X-API-TOKEN:company-token-test" \
-H "Content-Type: application/json" \
-d '{
"product_key": "Updated Product",
"price": 150.0,
"notes": "An updated description of the product"
}'
- lang: go
label: PHP
source: |
$ninja = new InvoiceNinja("your_token");
$product = $ninja->products->update("id", [
"name" => "Updated Product",
"price" => 150.0,
"description" => "An updated description of the product"
]);
description: "Handles the updating of a product by id"
operationId: updateProduct
parameters:
@ -217,6 +287,18 @@
tags:
- products
summary: "Delete product"
x-code-samples:
- lang: curl
label: Curl
source: |
curl -X DELETE 'https://invoicing.co/api/v1/products/{id}' \
-H "X-API-TOKEN:company-token-test" \
-H "X-Requested-With: XMLHttpRequest";
- lang: go
label: PHP
source: |
$ninja = new InvoiceNinja("your_token");
$ninja->products->bulk("delete", "id");
description: "Handles the deletion of a product by id"
operationId: deleteProduct
parameters:
@ -258,6 +340,18 @@
tags:
- products
summary: "Edit product"
x-code-samples:
- lang: curl
label: Curl
source: |
curl -X GET 'https://invoicing.co/api/v1/products/{id}/edit' \
-H "X-API-TOKEN:company-token-test" \
-H "X-Requested-With: XMLHttpRequest";
- lang: php
label: PHP
source: |
$ninja = new InvoiceNinja("your_token");
$product = $ninja->products->get("{id}");
description: "Displays an Product by id"
operationId: editProduct
parameters:
@ -341,6 +435,20 @@
tags:
- products
summary: "Bulk product actions"
x-code-samples:
- lang: curl
label: Curl
source: |
curl -X GET 'https://invoicing.co/api/v1/products/bulk' \
-H "Content-Type:application/json" \
-d '{"action":"archive","ids":["id","id2"]}' \
-H "X-API-TOKEN:company-token-test" \
-H "X-Requested-With: XMLHttpRequest";
- lang: php
label: PHP
source: |
$ninja = new InvoiceNinja("your_token");
$product = $ninja->products->bulk("action", ["id","id2"]);
description: "Archive / Restore / Delete / Set tax id in bulk"
operationId: bulkProducts
parameters: