mirror of
https://github.com/itflow-org/itflow
synced 2026-04-18 10:35:39 +00:00
API: Add some missing end points
This commit is contained in:
30
api/v1/payments/create.php
Normal file
30
api/v1/payments/create.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
require_once '../validate_api_key.php';
|
||||
|
||||
require_once '../require_post_method.php';
|
||||
|
||||
// Payments require All Clients scope
|
||||
$insert_id = false;
|
||||
|
||||
if ($client_id == 0) {
|
||||
|
||||
$payment_row = false; // Creation, not an update
|
||||
require_once 'payment_model.php';
|
||||
|
||||
if (!empty($invoice_id) && !empty($amount)) {
|
||||
|
||||
$insert_sql = mysqli_query($mysqli, "INSERT INTO payments SET payment_invoice_id = $invoice_id, payment_amount = $amount, payment_date = '$date', payment_method = '$method', payment_reference = '$reference', payment_notes = '$notes'");
|
||||
|
||||
if ($insert_sql) {
|
||||
$insert_id = mysqli_insert_id($mysqli);
|
||||
|
||||
// Logging
|
||||
logAction("Payment", "Create", "Created payment for invoice $invoice_id via API ($api_key_name)", 0, $insert_id);
|
||||
logAction("API", "Success", "Created payment for invoice $invoice_id via API ($api_key_name)", 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Output
|
||||
require_once '../create_output.php';
|
||||
Reference in New Issue
Block a user