Charge Helper Functions
The helper you can use to create, delete, get and update Charge details.
function add_charge($charge) {.....}
Supported hooks
Filter name: before_add_charge Description: This filter would be executed before add charge into the database in add_charge helper. Usage:
// The filter callback function is based on the filter.
add_filter( ‘before_add_charge’, ‘before_add_charge_callback_fun’, 10, 1 );
function before_add_charge_callback_fun($charge) {
// code
}Filter name: should_add_charge Description: This filter would be executed before add charge into database in add_charge helper. Usage:
// The filter callback function is based on the filter.
add_filter( ‘should_add_charge’, ‘should_add_charge_callback_fun’, 10, 1 );
function should_add_charge_callback_fun($charge) {
// code
}
hook name: pre.add.charge Description: This hook would be executed before add charge into the database in add_charge helper. Usage:
hook name: post.add.charge Description: This hook would be executed after add charge into the database in add_charge helper. Usage:
Usage
Request Parameters
Parameters in array format includes following attributes:
description
Character
Yes
Null
The description of a specific charge.
date_time
Date_time
Date
The date_time for specific charge( must provide date in gmdate() format).
booking_id
Integer
Yes
0
The booking_id (integer) for a specific charge.
amount
Decimal Integer
Yes
0
The amount for a specific charge.
charge_type_id
Integer
0
The charge_type_id for a specific charge.
selling_date
Date
Yes
Date
The selling_date for specific charge ( must provide date in gmdate() format).
user_id
Integer
Null
The user_id for a specific charge.
customer_id
Integer
Yes
0
The customer_id for a specific charge.
pay_period
Integer
1
The pay_period for specific charge.
company_id
Integer
Yes
Null
The company_id for specific charge.
quantity
Integer
Yes
0
The quantity for a specific charge.
folio_id
Integer
Yes
0
The folio_id for a specific charge.
is_extra_pos
Integer
Yes
1
The is_extra_pos if active then charge add as POS for a specific charge.
Response
function get_charge($charge_id) {....}
Supported hooks
Filter name: before_get_charge Description: This filter would be executed before retrieving charge details from database in get_charge helper. Usage:
Filter name: should_get_charge Description: This filter would be executed before retrieving charge details from database in get_charge helper. Usage:
hook name: pre.get.charge Description: This hook would be executed before retrieving charge details from database in get_charge helper. Usage:
hook name: post.get.charge Description: This hook would be executed after retrieving charge details from database in get_charge helper. Usage:
Usage
Request Parameters
$charge_id
Integer
Yes
Null
The primary id of the charge corresponds to the charge table
Response
function get_charges($filter) {.....}
Supported hooks
Filter name: before_get_charges Description: This filter would be executed before retrieving charge details from database in get_charges helper. Usage:
Filter name: should_get_charges Description: This filter would be executed before retrieving charge details from database in get_charges helper. Usage:
hook name: pre.get.charges Description: This hook would be executed before retrieving charge details from database in get_charges helper. Usage:
hook name: post.get.charges Description: This hook would be executed after retrieving charge details from database in get_charges helper. Usage:
Usage
Request Parameters
parameter array filter required for charge details.
description
Character
Yes
Null
The description for a specific charge.
booking_id
Integer
Yes
Null
The booking_id for specific charge.
customer_id
Integer
Yes
Null
The customer_id for a specific charge.
charge_type_id
Integer
Yes
Null
The charge_type_id for a specific charge.
user_id
Integer
Yes
Null
The user_id for a specific charge
Response
function update_charge($charge, $charge_id) {....}
Usage
Supported hooks
Filter name: before_update_charge Description: This filter would be executed before update charge into the database in update_charge helper. Usage:
Filter name: should_update_charge Description: This filter would be executed before update charge into database in update_charge helper. Usage:
hook name: pre.update.charge Description: This hook would be executed before update charge into the database in update_charge helper. Usage:
hook name: post.update.charge Description: This hook would be executed after update charge into the database in update_charge helper. Usage:
Request Parameters
Request required charge_id and array format data includes following attributes:
charge_id
Integer
Yes
Null
The primary key id of charge table for a specific charge.
description
Character
Yes
Null
The description of a specific charge.
date_time
Date_time
Date
The date_time for specific charge( must provide date in gmdate() format).
booking_id
Integer
Yes
0
The booking_id (integer) for a specific charge.
amount
Decimal Integer
Yes
0
The amount for a specific charge.
charge_type_id
Integer
0
The charge_type_id for a specific charge.
selling_date
Date
Yes
Date
The selling_date for specific charge ( must provide date in gmdate() format).
user_id
Integer
Null
The user_id for a specific charge.
customer_id
Integer
Yes
0
The customer_id for a specific charge.
pay_period
Integer
1
The pay_period for specific charge.
company_id
Integer
Yes
Null
The company_id for specific charge.
is_night_audit_charge
Integer
0
The is_night_audit_charge for a specific charge
folio_id
Integer
Yes
0
The folio_id for a specific charge.
Response
function delete_charge($charge_id) {.....}
Usage
Request Parameters
$charge_id
Integer
Yes
Null
The primary id of the charge corresponds to the charge table
Response
Last updated