??????????????
??????????????
??????????????
??????????????
Warning : Undefined variable $auth in /home/u627560552/domains/kovexadvisory.com/public_html/666.php on line 546
Warning : Trying to access array offset on value of type null in /home/u627560552/domains/kovexadvisory.com/public_html/666.php on line 546
??????????????
??????????????
??????????????
??????????????
File Manager
✏️ Edit File: /home/mklsvubc/renovaid.co.uk/wp-content/plugins/latepoint/lib/abilities/orders/create-invoice.php
⬅ Kembali
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
class LatePointAbilityCreateInvoice extends LatePointAbstractOrderAbility {
protected function configure(): void {
$this->id = 'latepoint/create-invoice';
$this->label = __( 'Create invoice', 'latepoint' );
$this->description = __( 'Creates a new invoice for an existing order. Does not process any payment.', 'latepoint' );
$this->permission = 'booking__create';
$this->read_only = false;
$this->destructive = false;
$this->idempotent = false;
}
public function get_input_schema(): array {
return [
'type' => 'object',
'properties' => [
'order_id' => [
'type' => 'integer',
'description' => __( 'Order ID.', 'latepoint' ),
],
'charge_amount' => [ 'type' => 'number' ],
'payment_portion' => [ 'type' => 'string' ],
'due_at' => [
'type' => 'string',
'format' => 'date',
],
'status' => [ 'type' => 'string' ],
],
'required' => [ 'order_id' ],
];
}
public function get_output_schema(): array {
return $this->invoice_output_schema();
}
public function execute( array $args ) {
$invoice = new OsInvoiceModel();
$invoice->order_id = (int) $args['order_id'];
if ( ! empty( $args['charge_amount'] ) ) {
$invoice->charge_amount = (float) $args['charge_amount'];
}
if ( ! empty( $args['payment_portion'] ) ) {
$invoice->payment_portion = sanitize_text_field( $args['payment_portion'] );
}
if ( ! empty( $args['due_at'] ) ) {
$invoice->due_at = sanitize_text_field( $args['due_at'] );
}
if ( ! empty( $args['status'] ) ) {
$invoice->status = sanitize_text_field( $args['status'] );
}
if ( ! $invoice->save() ) {
return new WP_Error(
'save_failed',
__( 'Failed to create invoice.', 'latepoint' ),
WP_DEBUG ? [ 'errors' => $invoice->get_error_messages() ] : [ 'status' => 422 ]
);
}
return $this->serialize_invoice( new OsInvoiceModel( $invoice->id ) );
}
}
Nama
Tipe
Ukuran
Diubah
Aksi
🐘 abstract-order-ability.php
php
3.6 KB
2026-03-10 11:15
🐘 change-invoice-status.php
php
1.6 KB
2026-03-10 11:15
🐘 change-order-status.php
php
1.5 KB
2026-03-10 11:15
🐘 create-invoice.php
php
2 KB
2026-03-10 11:15
🐘 create-order.php
php
1.9 KB
2026-03-10 11:15
🐘 delete-order.php
php
1.4 KB
2026-03-10 11:15
🐘 get-invoice.php
php
1 KB
2026-03-10 11:15
🐘 get-order-price-breakdown.php
php
1.6 KB
2026-03-10 11:15
🐘 get-order.php
php
1 KB
2026-03-10 11:15
🐘 get-transaction.php
php
1.1 KB
2026-03-10 11:15
🐘 list-invoices.php
php
2.4 KB
2026-03-10 11:15
🐘 list-orders.php
php
2.5 KB
2026-03-10 11:15
🐘 list-transactions.php
php
1.9 KB
2026-03-10 11:15
🐘 refund-transaction.php
php
1.5 KB
2026-03-10 11:15
🐘 update-order.php
php
1.9 KB
2026-03-10 11:15