Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion assets/build/js/react/admin/order.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions assets/src/js/react/admin/pages/orders/edit/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ export default function OrderEdit({}: EditProps) {
doAction('wpmvc-toast', {
message: __(
'Order status updated successfully',
'directorist-pricing-plans'
'directorist'
),
});
refresh();
Expand All @@ -247,7 +247,7 @@ export default function OrderEdit({}: EditProps) {
type: 'error',
message: __(
'Oppps! Something went wrong',
'directorist-pricing-plans'
'directorist'
),
});
} finally {
Expand Down
1 change: 1 addition & 0 deletions includes/asset-loader/init.php
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,7 @@ public static function admin_scripts( string $hook_suffix ) {
Enqueue::style( 'directorist/admin-order-dataview', 'build/css/admin/style-app', ['wp-components'] );
Enqueue::style( 'directorist/admin-app', 'build/css/admin/app' );
Enqueue::script( 'directorist/admin-order', 'build/js/react/admin/order' );
wp_set_script_translations( 'directorist/admin-order', 'directorist', ATBDP_DIR . 'languages' );

$c_position = directorist_get_currency_position();
$currency = directorist_get_currency();
Expand Down
4 changes: 2 additions & 2 deletions includes/checkout/class-checkout.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public function payment_receipt() {
$order_db = $order_repository->get_by_id( $order_id );

if ( ! $order_db ) {
return __( "Order not found" );
return __( "Order not found", 'directorist' );
}

$order = apply_filters( 'directorist_payment_receipt_order_dto', $order_repository->to_dto( $order_db ) );
Expand Down Expand Up @@ -464,4 +464,4 @@ public function transaction_failure() {

return ob_get_clean();
}
} // ends class
} // ends class
2 changes: 1 addition & 1 deletion includes/classes/class-ajax-handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -1048,7 +1048,7 @@ public function atbdp_post_attachment_upload() {
}

if ( empty( $status['url'] ) ) {
throw new \Exception( __( 'Could not upload your file, please try again.' ), 400 );
throw new \Exception( __( 'Could not upload your file, please try again.', 'directorist' ), 400 );
}

// Update the meta when post id is available.
Expand Down
10 changes: 5 additions & 5 deletions includes/classes/class-payment-checkout-service.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,15 @@ public function validate_checkout( string $checkout_type, WP_REST_Request $reque
$order = directorist_get_order_by_id( $request->get_param( 'order_id' ) );

if ( ! $order ) {
throw new Exception( __( 'Order not found.', 'directorist-pricing-plans' ) );
throw new Exception( __( 'Order not found.', 'directorist' ) );
}

if ( (int) $order->user_id !== get_current_user_id() ) {
throw new Exception( __( 'You do not have permission to pay for this order.', 'directorist-pricing-plans' ) );
throw new Exception( __( 'You do not have permission to pay for this order.', 'directorist' ) );
}

if ( Status::PENDING !== $order->status ) {
throw new Exception( __( 'This order is not pending payment.', 'directorist-pricing-plans' ) );
throw new Exception( __( 'This order is not pending payment.', 'directorist' ) );
}
}

Expand Down Expand Up @@ -124,7 +124,7 @@ public function handle_checkout_create_order( DTO $dto, string $checkout_type, W
$order = directorist_get_order_by_id( $request->get_param( 'order_id' ) );

if ( ! $order ) {
throw new Exception( __( 'Order not found.', 'directorist-pricing-plans' ) );
throw new Exception( __( 'Order not found.', 'directorist' ) );
}

// Set the existing order ID on the DTO so the core skips order creation
Expand All @@ -136,4 +136,4 @@ public function before_checkout_form_end() {
echo '<input type="hidden" name="order_id" value="' . esc_attr( absint( $_GET['order_id'] ) ) . '">'; // phpcs:ignore WordPress.Security.NonceVerification.Recommended
}
}
}
}
2 changes: 1 addition & 1 deletion includes/classes/class-settings-panel.php
Original file line number Diff line number Diff line change
Expand Up @@ -1319,7 +1319,7 @@ public function prepare_settings() {
// single listing settings
'disable_single_listing' => [
'type' => 'toggle',
'label' => __( 'Disable Single Listing View' ),
'label' => __( 'Disable Single Listing View', 'directorist' ),
'value' => false,
],
'restrict_single_listing_for_logged_in_user' => [
Expand Down
4 changes: 2 additions & 2 deletions includes/model/ListingDashboard.php
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ public function dashboard_tabs() {

if ( $user_order_history ) {
$dashboard_tabs[ 'order_history' ] = array(
'title' => __( 'Order History', 'directorist-pricing-plans' ),
'title' => __( 'Order History', 'directorist' ),
'content' => Helper::get_template_contents( 'dashboard/tab-orders', [ 'dashboard' => $this ] ),
'icon' => 'las la-clock',
);
Expand Down Expand Up @@ -726,4 +726,4 @@ public function get_action_dropdown_item() {

return apply_filters( 'directorist_dashboard_listing_action_items_end', $dropdown_items, $post_id, $this );
}
}
}
6 changes: 3 additions & 3 deletions includes/repositories/refund-repository.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public function create( $dto ) {
$order = $this->order_repository->to_dto( $this->order_repository->get_by_id( $dto->get_order_id() ) );

if ( ! $order ) {
throw new Exception( esc_html__( "Order not found" ) );
throw new Exception( esc_html__( "Order not found", 'directorist' ) );
}

$total = $order->get_sub_total();
Expand All @@ -75,7 +75,7 @@ public function create( $dto ) {

// Prevent refunding if order is already fully refunded
if ( $already_refunded >= $total ) {
throw new Exception( esc_html__( "Order is already refunded" ) );
throw new Exception( esc_html__( "Order is already refunded", 'directorist' ) );
}

// Calculate remaining amount that can still be refunded
Expand Down Expand Up @@ -111,4 +111,4 @@ public function create( $dto ) {
public function get_order_total_refunded( int $order_id ) {
return $this->get_query_builder()->where( 'order_id', $order_id )->where( 'status', Status::PAID )->sum( 'amount' );
}
}
}
24 changes: 12 additions & 12 deletions includes/rest-api/Version1/class-checkout-controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ public function register_routes() {
'permission_callback' => [ $this, 'auth_permissions_check' ],
'args' => [
'checkout_type' => [
'description' => __( 'The type of checkout to be performed.' ),
'description' => __( 'The type of checkout to be performed.', 'directorist' ),
'type' => 'string',
'sanitize_callback' => 'sanitize_text_field',
'enum' => directorist_get_checkout_types(),
'required' => true,
],
'payment_gateway' => [
'description' => __( 'The payment gateway to be used for the checkout.' ),
'description' => __( 'The payment gateway to be used for the checkout.', 'directorist' ),
'type' => 'string',
'sanitize_callback' => 'sanitize_text_field',
'required' => false,
Expand All @@ -54,7 +54,7 @@ public function register_routes() {
'permission_callback' => [ $this, 'auth_permissions_check' ],
'args' => [
'order_id' => [
'description' => __( 'The order id to be retried.' ),
'description' => __( 'The order id to be retried.', 'directorist' ),
'type' => 'integer',
'sanitize_callback' => 'absint',
'required' => true,
Expand Down Expand Up @@ -84,7 +84,7 @@ public function checkout( WP_REST_Request $request ) {
$order = $repository->get_by_id( $dto->get_id() );

if ( ! $order ) {
return new WP_Error( 'rest_not_found', __( 'Order not found.' ) );
return new WP_Error( 'rest_not_found', __( 'Order not found.', 'directorist' ) );
}

$dto = $repository->to_dto( $order );
Expand All @@ -98,13 +98,13 @@ public function checkout( WP_REST_Request $request ) {
$payment_gateway = $request->get_param( 'payment_gateway' );

if ( ! $payment_gateway ) {
return new WP_Error( 'rest_empty_value', __( 'Payment gateway is required.' ) );
return new WP_Error( 'rest_empty_value', __( 'Payment gateway is required.', 'directorist' ) );
}

$payment_processors = directorist_get_payment_processors();

if ( ! isset( $payment_processors[ $payment_gateway ] ) ) {
return new WP_Error( 'rest_invalid_value', __( 'Invalid payment gateway.' ) );
return new WP_Error( 'rest_invalid_value', __( 'Invalid payment gateway.', 'directorist' ) );
}

/**
Expand All @@ -113,7 +113,7 @@ public function checkout( WP_REST_Request $request ) {
$processor_instance = directorist_make( $payment_processors[ $payment_gateway ], __( 'Invalid payment gateway.', 'directorist' ) );

if ( ! $processor_instance instanceof PaymentInterface ) {
return new WP_Error( 'rest_invalid_value', __( 'Invalid payment gateway.' ) );
return new WP_Error( 'rest_invalid_value', __( 'Invalid payment gateway.', 'directorist' ) );
}

do_action( 'directorist_checkout_validate_payment_processor', $processor_instance, $dto, $checkout_type, $request );
Expand Down Expand Up @@ -165,27 +165,27 @@ public function retry_payment( WP_REST_Request $request ) {
$order = $order_repository->get_by_id( $order_id );

if ( ! $order ) {
return new WP_Error( 'rest_not_found', __( 'Order not found.' ) );
return new WP_Error( 'rest_not_found', __( 'Order not found.', 'directorist' ) );
}

$order = $order_repository->to_dto( $order );

if ( ! in_array( $order->get_status(), [ OrderStatus::PENDING, OrderStatus::FAILED ], true ) ) {
return new WP_Error( 'rest_invalid_value', __( 'Order is not pending or failed.' ) );
return new WP_Error( 'rest_invalid_value', __( 'Order is not pending or failed.', 'directorist' ) );
}

$payment_repository = directorist_payment_repository();
$payment = $payment_repository->get_last_payment( $order_id );

if ( ! $payment ) {
return new WP_Error( 'rest_not_found', __( 'Payment not found.' ) );
return new WP_Error( 'rest_not_found', __( 'Payment not found.', 'directorist' ) );
}

$payment = $payment_repository->to_dto( $payment );
$payment_processors = directorist_get_payment_processors();

if ( ! isset( $payment_processors[$payment->get_method()] ) ) {
return new WP_Error( 'rest_invalid_value', __( 'Invalid payment gateway.' ) );
return new WP_Error( 'rest_invalid_value', __( 'Invalid payment gateway.', 'directorist' ) );
}

/**
Expand All @@ -203,4 +203,4 @@ public function retry_payment( WP_REST_Request $request ) {
]
);
}
}
}
2 changes: 1 addition & 1 deletion includes/rest-api/Version1/class-listings-controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,7 @@ public function update_status( WP_REST_Request $request ) {

return rest_ensure_response(
[
'message' => esc_html__( 'The listing status was updated successfully', 'directorist-pricing-plans' )
'message' => esc_html__( 'The listing status was updated successfully', 'directorist' )
]
);
}
Expand Down
Loading
Loading