??????????????
??????????????
??????????????
??????????????
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/pyan.co.uk/wp-content/plugins/latepoint/lib/abilities/customers/create-customer.php
⬅ Kembali
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
class LatePointAbilityCreateCustomer extends LatePointAbstractCustomerAbility {
protected function configure(): void {
$this->id = 'latepoint/create-customer';
$this->label = __( 'Create customer', 'latepoint' );
$this->description = __( 'Creates a new customer record. Email address must be unique across all customers.', 'latepoint' );
$this->permission = 'customer__create';
$this->read_only = false;
$this->destructive = false;
$this->idempotent = false;
}
public function get_input_schema(): array {
return [
'type' => 'object',
'properties' => [
'first_name' => [
'type' => 'string',
'description' => __( 'First name.', 'latepoint' ),
],
'last_name' => [
'type' => 'string',
'description' => __( 'Last name.', 'latepoint' ),
],
'email' => [
'type' => 'string',
'format' => 'email',
'description' => __( 'Email address.', 'latepoint' ),
],
'phone' => [
'type' => 'string',
'description' => __( 'Phone number.', 'latepoint' ),
],
'notes' => [
'type' => 'string',
'description' => __( 'Internal notes.', 'latepoint' ),
],
],
'required' => [ 'first_name', 'email' ],
];
}
public function get_output_schema(): array {
return $this->customer_output_schema();
}
public function execute( array $args ) {
$customer = new OsCustomerModel();
$customer->first_name = sanitize_text_field( $args['first_name'] );
$customer->email = sanitize_email( $args['email'] );
if ( ! empty( $args['last_name'] ) ) {
$customer->last_name = sanitize_text_field( $args['last_name'] );
}
if ( ! empty( $args['phone'] ) ) {
$customer->phone = sanitize_text_field( $args['phone'] );
}
if ( ! empty( $args['notes'] ) ) {
$customer->notes = sanitize_textarea_field( $args['notes'] );
}
if ( ! $customer->save() ) {
return new WP_Error(
'save_failed',
__( 'Failed to create customer.', 'latepoint' ),
WP_DEBUG ? [ 'errors' => $customer->get_error_messages() ] : [ 'status' => 422 ]
);
}
return $this->serialize_customer( new OsCustomerModel( $customer->id ) );
}
}
Nama
Tipe
Ukuran
Diubah
Aksi
🐘 abstract-customer-ability.php
php
1.4 KB
2026-03-10 11:15
🐘 connect-customer-to-wp-user.php
php
2.4 KB
2026-04-24 10:27
🐘 create-customer.php
php
2.2 KB
2026-03-10 11:15
🐘 delete-customer.php
php
1.5 KB
2026-03-10 11:15
🐘 get-customer-bookings.php
php
2.8 KB
2026-03-10 11:15
🐘 get-customer-by-email.php
php
1.2 KB
2026-03-10 11:15
🐘 get-customer-orders.php
php
2.2 KB
2026-03-10 11:15
🐘 get-customer.php
php
1.1 KB
2026-03-10 11:15
🐘 get-total-customers-count.php
php
866 B
2026-03-10 11:15
🐘 list-customers.php
php
2.2 KB
2026-03-10 11:15
🐘 search-customers.php
php
1.6 KB
2026-03-10 11:15
🐘 update-customer.php
php
2.2 KB
2026-03-10 11:15