Skip to content

Commit

Permalink
Fix server respond format
Browse files Browse the repository at this point in the history
  • Loading branch information
IvanPetakNeuralab committed Apr 3, 2024
1 parent 40a9a72 commit b3eaac5
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 53 deletions.
6 changes: 3 additions & 3 deletions includes/core/class-kekspay-ipn.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ private function respond( $message, $status_code = 200 ) {
$encoded_message = -1;
}

wp_die( esc_html( $encoded_message ) );
die( $encoded_message ); //@codingStandardsIgnoreLine - escaping not needed
}

/**
Expand All @@ -61,7 +61,7 @@ private function respond_error( $message ) {
$encoded_message = -1;
}

wp_die( esc_html( $encoded_message ) );
die( $encoded_message ); //@codingStandardsIgnoreLine - escaping not needed
}

/**
Expand Down Expand Up @@ -159,7 +159,7 @@ public function do_checkout_status() {

if ( (int) $params['status'] === 0 ) {
Kekspay_Logger::log( 'KEKS Pay successfully completed payment for order ' . $order_id . ', setting status to ' . $params['message'], 'info' );
$order->set_status( Kekspay_Data::get_settings( 'payed-order-status' ) ?: 'processing', __( 'Narudžba uspješno plaćena putem KEKS Pay aplikacije.', 'kekspay' ) ); //phpcs:ignore
$order->set_status( Kekspay_Data::get_settings( 'payed-order-status' ) ?: 'processing', __( 'Narudžba uspješno plaćena putem KEKS Pay aplikacije.', 'kekspay' ) );
$order->add_meta_data( 'kekspay_status', 'success', true );
$order->add_meta_data( 'kekspay_id', $params['keks_id'], true );
$order->save();
Expand Down
100 changes: 50 additions & 50 deletions includes/core/class-kekspay-order-admin.php
Original file line number Diff line number Diff line change
@@ -1,58 +1,58 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
exit;
}

if ( ! class_exists( 'Kekspay_Order_Admin' ) ) {
/**
* Kekspay_Order_Admin class
*
* @since 0.1
*/
class Kekspay_Order_Admin {

/**
* Class constructor.
*/
public function __construct() {
add_action( 'admin_notices', array( $this, 'display_test_order_notice' ), 100 );
}

/**
* Display WordPress warning notice if current order (admin view) is processed in sandbox/test mode.
*
* @return void
*/
public function display_test_order_notice() {
if ( ! is_admin() ) {
return;
}

$screen = get_current_screen();
if ( 'post' === $screen->base && 'shop_order' === $screen->id ) {
$order = wc_get_order( get_the_ID() );
if ( ! is_a( $order, 'WC_Order' ) ) {
return;
}

if ( Kekspay_Data::order_test_mode( $order ) ) {
$class = 'notice notice-warning';
$message = __( 'Narudžba kreirana koristeći KEKS Pay u testnom načinu rada.', 'kekspay' );

printf( '<div class="%1$s"><p>%2$s</p></div>', esc_attr( $class ), esc_html( $message ) );
}

if ( 'HRK' === $order->get_currency() ) {
$class = 'notice notice-warning';
$message = __( 'KEKS Pay - Narudžba naplaćena u valuti HRK koja više nije podržana od strane KEKS Pay sustava. Ako želite napraviti povrat novca kroz KEKS Pay sustav, iznos za povrat prije povrata preračunati će se u EUR prema tečaju 7.5345 te biti vraćen u valuti EUR.', 'kekspay' );

printf( '<div class="%1$s"><p>%2$s</p></div>', esc_attr( $class ), esc_html( $message ) );
}
}

}

}
/**
* Kekspay_Order_Admin class
*
* @since 0.1
*/
class Kekspay_Order_Admin {

/**
* Class constructor.
*/
public function __construct() {
add_action( 'admin_notices', [ $this, 'display_test_order_notice' ], 100 );
}

/**
* Display WordPress warning notice if current order (admin view) is processed in sandbox/test mode.
*
* @return void
*/
public function display_test_order_notice() {
if ( ! is_admin() ) {
return;
}

$screen = get_current_screen();
if ( 'post' === $screen->base && 'shop_order' === $screen->id ) {
$order = wc_get_order( get_the_ID() );
if ( ! is_a( $order, 'WC_Order' ) ) {
return;
}

if ( Kekspay_Data::order_test_mode( $order ) ) {
$class = 'notice notice-warning';
$message = __( 'Narudžba kreirana koristeći KEKS Pay u testnom načinu rada.', 'kekspay' );

printf( '<div class="%1$s"><p>%2$s</p></div>', esc_attr( $class ), esc_html( $message ) );
}

if ( 'HRK' === $order->get_currency() ) {
$class = 'notice notice-warning';
$message = __( 'KEKS Pay - Narudžba naplaćena u valuti HRK koja više nije podržana od strane KEKS Pay sustava. Ako želite napraviti povrat novca kroz KEKS Pay sustav, iznos za povrat prije povrata preračunati će se u EUR prema tečaju 7.5345 te biti vraćen u valuti EUR.', 'kekspay' );

printf( '<div class="%1$s"><p>%2$s</p></div>', esc_attr( $class ), esc_html( $message ) );
}
}

}

}
}

new Kekspay_Order_Admin();

0 comments on commit b3eaac5

Please sign in to comment.