Changeset 3700542
- Timestamp:
- 09/17/2026 03:40:17 PM (6 weeks ago)
- Location:
- oxygen-mydata/trunk
- Files:
-
- 10 edited
-
inc/class-oxygen.php (modified) (2 diffs)
-
inc/class-oxygenapi.php (modified) (2 diffs)
-
inc/class-oxygenhelperfunctions.php (modified) (1 diff)
-
inc/class-oxygenorder.php (modified) (3 diffs)
-
inc/class-oxygenwoosettings.php (modified) (1 diff)
-
inc/class-wc-oxygenpayment-gateway.php (modified) (5 diffs)
-
inc/request-handle-message.php (modified) (8 diffs)
-
inc/templates/plain-invoice-email-template.php (modified) (1 diff)
-
oxygen-mydata.php (modified) (3 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
oxygen-mydata/trunk/inc/class-oxygen.php
r3683155 r3700542 6 6 * Oxygen MyData Class File 7 7 * 8 * @version 3.0. 28 * @version 3.0.4 9 9 * @since 1.0.0 10 10 */ … … 122 122 123 123 /* Texts (translations) that changes with jquery */ 124 wp_localize_script( 125 'create_document_meta_box_js', 126 'MyLocalizedText', 127 array( 128 'createInvoiceText' => __( 'Create Invoice', 'oxygen' ), 129 'createReceiptText' => __( 'Create Receipt', 'oxygen' ), 130 'error_option' => __( 'An error occurred while changing option.', 'oxygen' ), 131 'gateway_disabled' => __( 'The gateway has been disabled successfully.', 'oxygen' ), 132 'success_send' => __( 'Document sent successfully to customer\'s email address.', 'oxygen' ), 133 'error_send' => __( 'An error occurred while sending document via email.', 'oxygen' ), 134 'success_download' => __( 'PDF document downloaded successfully.', 'oxygen' ), 135 'error_downloading' => __( 'An error occurred while downloading the file.', 'oxygen' ), 136 'empty_document_name' => __( 'Document has no name', 'oxygen' ), 137 'do_not_refresh_page' => __( 'Your transaction is in progress, please wait.', 'oxygen' ), 138 'failed_oxygen_payment' => __( 'Your transaction failed.', 'oxygen' ), 139 ) 124 wp_localize_script( 'create_document_meta_box_js', 'MyLocalizedText', self::get_localized_texts() ); 125 } 126 127 /** 128 * Texts (translations) exposed to JS as the `MyLocalizedText` global. 129 * 130 * Shared by the admin scripts and the front end scripts (checkout payment 131 * modal, PDF download), so every handle that uses `MyLocalizedText` can 132 * localize the same set. 133 * 134 * @return array 135 */ 136 public static function get_localized_texts() { 137 138 return array( 139 'createInvoiceText' => __( 'Create Invoice', 'oxygen' ), 140 'createReceiptText' => __( 'Create Receipt', 'oxygen' ), 141 'error_option' => __( 'An error occurred while changing option.', 'oxygen' ), 142 'gateway_disabled' => __( 'The gateway has been disabled successfully.', 'oxygen' ), 143 'success_send' => __( 'Document sent successfully to customer\'s email address.', 'oxygen' ), 144 'error_send' => __( 'An error occurred while sending document via email.', 'oxygen' ), 145 'success_download' => __( 'PDF document downloaded successfully.', 'oxygen' ), 146 'error_downloading' => __( 'An error occurred while downloading the file.', 'oxygen' ), 147 'empty_document_name' => __( 'Document has no name', 'oxygen' ), 148 'do_not_refresh_page' => __( 'Your transaction is in progress, please wait.', 'oxygen' ), 149 'failed_oxygen_payment' => __( 'Your transaction failed.', 'oxygen' ), 140 150 ); 141 151 } -
oxygen-mydata/trunk/inc/class-oxygenapi.php
r3683155 r3700542 6 6 * OxygenApi Class File 7 7 * 8 * @version 3.0. 28 * @version 3.0.4 9 9 * @since 1.0.0 10 10 */ … … 82 82 } else { 83 83 84 self::$api_url = 'https://sandbox-api.oxygen.gr/v1'; 84 // self::$api_url = 'https://sandbox-api.oxygen.gr/v1'; 85 self::$api_url = 'https://api-dev.oxygen.gr/v1'; 86 85 87 } 86 88 -
oxygen-mydata/trunk/inc/class-oxygenhelperfunctions.php
r3683155 r3700542 5 5 * @package Oxygen 6 6 * @summary Class to add WooCommerce settings tab and fields, WooCommerce Helper Funtions 7 * @version 3.0. 27 * @version 3.0.4 8 8 * @since 1.0.0 9 9 */ -
oxygen-mydata/trunk/inc/class-oxygenorder.php
r3683155 r3700542 5 5 * @package Oxygen 6 6 * @summary Class to add WooCommerce order hooks 7 * @version 3.0. 27 * @version 3.0.4 8 8 * @since 1.0.0 9 9 */ … … 384 384 $iris_payment_status = get_post_meta( $order_id, 'everypay_iris_payment_status', true ); 385 385 $transfer_status = get_post_meta( $order_id, 'everypay_transfer_status', true ); 386 $card_payment_status = get_post_meta( $order_id, 'everypay_card_payment_status', true );386 $card_payment_status = get_post_meta( $order_id, 'everypay_card_payment_status', true ); 387 387 388 388 $messages = []; 389 389 390 if ( $iris_payment_status === '1' || $iris_payment_status === 1 || $iris_payment_status === true ) { 390 $iris_result = self::payment_status_result( $iris_payment_status ); 391 392 if ( true === $iris_result ) { 391 393 $messages[] = '<span style="color:#28a745;">✓ ' . __( 'IRIS payment: Success', 'oxygen' ) . '</span>'; 392 } elseif ( $iris_payment_status === '0' || $iris_payment_status === 0 || $iris_payment_status === false) {394 } elseif ( false === $iris_result ) { 393 395 $messages[] = '<span style="color:#dc3232;">✗ ' . __( 'IRIS payment: Failed', 'oxygen' ) . '</span>'; 394 }else if($card_payment_status === '1' || $card_payment_status === 1 || $card_payment_status === true){ 396 } 397 398 /* Own chain, not an elseif on IRIS: an order can fail IRIS and then be paid by card. */ 399 $card_result = self::payment_status_result( $card_payment_status ); 400 401 if ( true === $card_result ) { 395 402 $messages[] = '<span style="color:#28a745;">✓ ' . __( 'Payment by card: Success', 'oxygen' ) . '</span>'; 396 } elseif ( $card_payment_status === '0' || $card_payment_status === 0 || $card_payment_status === false) {403 } elseif ( false === $card_result ) { 397 404 $messages[] = '<span style="color:#dc3232;">✗ ' . __( 'Payment by card: Failed', 'oxygen' ) . '</span>'; 398 } else{399 $messages[] = '<span style="color:#dc3232;">-</span>'; 400 }401 402 if ( $transfer_status === '1' || $transfer_status === 1 || $transfer_status === true) {405 } 406 407 $transfer_result = self::payment_status_result( $transfer_status ); 408 409 if ( true === $transfer_result ) { 403 410 $messages[] = '<span style="color:#28a745;">✓ ' . __( 'IRIS Transfer: Completed', 'oxygen' ) . '</span>'; 404 } elseif ( $transfer_status === '0' || $transfer_status === 0 || $transfer_status === false) {411 } elseif ( false === $transfer_result ) { 405 412 $messages[] = '<span style="color:#dc3232;">✗ ' . __( 'IRIS Transfer: Failed', 'oxygen' ) . '</span>'; 406 413 } 407 414 408 415 echo $messages ? implode('<br>', $messages) : '—'; 416 } 417 418 /** 419 * Resolves a payment status meta value into a tri-state result. 420 * 421 * WordPress stores a boolean false as an empty string, so an empty value can never 422 * be read as "failed" - it is indistinguishable from a meta key that was never 423 * written. Failures must therefore be recorded as 0 / '0'. 424 * 425 * @param mixed $value raw meta value. 426 * @return bool|null true on success, false on failure, null when nothing was recorded. 427 */ 428 private static function payment_status_result( $value ) { 429 430 if ( '' === $value || null === $value ) { 431 return null; 432 } 433 434 return (bool) $value; 409 435 } 410 436 … … 2815 2841 ) 2816 2842 ); 2843 2844 /* download_pdf.js also runs on the front end, where the admin-only localization is absent. */ 2845 wp_localize_script( 'download_pdf', 'MyLocalizedText', Oxygen::get_localized_texts() ); 2817 2846 } 2818 2847 -
oxygen-mydata/trunk/inc/class-oxygenwoosettings.php
r3683155 r3700542 5 5 * @package Oxygen 6 6 * @summary Class to add WooCommerce settings tab and fields, WooCommerce categories fields 7 * @version 3.0. 27 * @version 3.0.4 8 8 * @since 1.0.0 9 9 */ -
oxygen-mydata/trunk/inc/class-wc-oxygenpayment-gateway.php
r3683155 r3700542 4 4 * 5 5 * @package Oxygen Payments 6 * @version 3.0. 26 * @version 3.0.4 7 7 * @author Oxygen 8 8 * @since 1.0.0 … … 512 512 $api_url = 'https://api.oxygen.gr/v1'; 513 513 } else { 514 $api_url = 'https://sandbox-api.oxygen.gr/v1'; 514 // $api_url = 'https://sandbox-api.oxygen.gr/v1'; 515 $api_url = 'https://api-dev.oxygen.gr/v1'; 516 515 517 } 516 518 … … 705 707 } 706 708 707 add_filter( 'query_vars', 'my_add_query_vars' );709 //add_filter( 'query_vars', 'my_add_query_vars' ); 708 710 709 711 /** … … 729 731 wp_enqueue_script( 'custom_payment_js', OXYGEN_PLUGIN_URL . 'js/custom_payment.js', array( 'jquery' ), null, true ); 730 732 wp_enqueue_script( 'iris_payment_js', OXYGEN_PLUGIN_URL . 'js/iris_payment.js', array( 'jquery' ), null, true ); 733 734 /* Texts used by custom_payment.js while the transaction is running. */ 735 wp_localize_script( 'custom_payment_js', 'MyLocalizedText', Oxygen::get_localized_texts() ); 736 737 wp_localize_script( 738 'custom_payment_js', 739 'oxygen_payment_request', 740 array( 741 'url' => OXYGEN_PLUGIN_URL . 'inc/request-handle-message.php', 742 ) 743 ); 731 744 } 732 745 } … … 1301 1314 'methods' => 'POST', 1302 1315 'callback' => 'oxygen_everypay_status_callback', 1303 //'permission_callback' => '__return_true',1316 'permission_callback' => '__return_true', 1304 1317 ]); 1305 1318 }); -
oxygen-mydata/trunk/inc/request-handle-message.php
r3683155 r3700542 4 4 * 5 5 * @package Oxygen Payments 6 * @version 3.0. 26 * @version 3.0.4 7 7 * @author Oxygen 8 8 * @since 1.0.0 … … 18 18 $nonce = wp_create_nonce( 'payment_id' ); 19 19 20 OxygenHelperFunctions::debug( array( '[card-payment] ===== request-handle-message.php entered =====' ), 'info' ); 20 21 21 22 if ( isset( $_POST['payment_id'] ) && wp_verify_nonce( $nonce, 'payment_id' ) ) { 22 23 $payment_id = sanitize_key( $_POST['payment_id'] ); 24 25 OxygenHelperFunctions::debug( array( '[card-payment] payment_id from POST: ' . $payment_id ), 'info' ); 23 26 } else { 27 OxygenHelperFunctions::debug( array( '[card-payment] no payment_id in POST - aborting' ), 'warning' ); 28 24 29 $response = array( 'status' => 'given payment id is null' ); 25 30 echo wp_json_encode( $response ); … … 45 50 ); 46 51 52 OxygenHelperFunctions::debug( array( '[card-payment] GET ' . $endpoint ), 'info' ); 53 47 54 $response_from_api = wp_remote_get( $endpoint, $options ); 55 56 OxygenHelperFunctions::debug( 57 array( '[card-payment] API HTTP code: ' . wp_remote_retrieve_response_code( $response_from_api ) ), 58 'info' 59 ); 48 60 49 61 if ( ! is_wp_error( $response_from_api ) ) { … … 57 69 58 70 71 $order_id = WC()->session->get( 'order_id' ); 72 73 OxygenHelperFunctions::debug( 74 array( 75 '[card-payment] decoded API payload', 76 $array_data, 77 '[card-payment] is_paid: ' . var_export( $is_paid, true ), 78 '[card-payment] receipt id: ' . var_export( $has_receipt_id, true ), 79 '[card-payment] order_id from WC session: ' . var_export( $order_id, true ), 80 ), 81 'info' 82 ); 83 59 84 if ( $is_paid ) { 60 85 61 $order_id = WC()->session->get( 'order_id' );62 86 $my_order = wc_get_order( $order_id ); 87 88 if ( ! $my_order ) { 89 OxygenHelperFunctions::debug( 90 array( '[card-payment] wc_get_order() returned false - session order_id is stale or missing' ), 91 'error' 92 ); 93 } else { 94 OxygenHelperFunctions::debug( 95 array( '[card-payment] order status before payment_complete: ' . $my_order->get_status() ), 96 'info' 97 ); 98 } 99 63 100 $my_order->payment_complete(); 64 101 $my_order->update_status( 'wc-processing' ); 65 update_post_meta( $order_id, 'everypay_card_payment_status', true);102 update_post_meta( $order_id, 'everypay_card_payment_status', 1 ); 66 103 67 104 if ( !empty($has_receipt_id) ) { … … 73 110 } 74 111 75 $thankyou = WC()->session->get( 'thankyou_link' ); 112 // $thankyou = WC()->session->get( 'thankyou_link' ); 113 $thankyou = $my_order->get_checkout_order_received_url(); 114 115 OxygenHelperFunctions::debug( 116 array( 117 '[card-payment] order status after status updates: ' . $my_order->get_status(), 118 '[card-payment] redirect returned to JS: ' . $thankyou, 119 /* If this still carries order-pay, WooCommerce routes to the pay page and 120 refuses it because the order no longer needs payment. */ 121 '[card-payment] redirect contains order-pay: ' . ( false !== strpos( $thankyou, 'order-pay' ) ? 'YES - BUG' : 'no' ), 122 '[card-payment] old session thankyou_link (unused): ' . var_export( WC()->session->get( 'thankyou_link' ), true ), 123 ), 124 'info' 125 ); 76 126 77 127 $response = array( … … 82 132 83 133 } else { 134 135 /* 136 * Record the failure as 0, never as false: WordPress stores a boolean 137 * false as an empty string, which oxygen_payments_details_global cannot 138 * tell apart from "no card payment was ever attempted". 139 */ 140 if ( ! empty( $order_id ) ) { 141 update_post_meta( $order_id, 'everypay_card_payment_status', 0 ); 142 } 143 144 OxygenHelperFunctions::debug( 145 array( '[card-payment] NOT PAID - everypay_card_payment_status set to 0 for order ' . var_export( $order_id, true ) ), 146 'warning' 147 ); 148 84 149 $response = array( 'status' => 'not_paid' ); 85 150 echo wp_json_encode( $response ); 86 151 } 87 152 } else { 153 OxygenHelperFunctions::debug( array( '[card-payment] API returned an empty body' ), 'error' ); 154 88 155 $response = array( 'status' => 'null_data' ); 89 156 echo wp_json_encode( $response ); … … 92 159 } else { 93 160 $error_message = $response_from_api->get_error_message(); 161 162 OxygenHelperFunctions::debug( array( '[card-payment] wp_remote_get failed: ' . $error_message ), 'error' ); 163 94 164 $response = array( 95 165 'status' => 'error', … … 99 169 } 100 170 } else { 171 OxygenHelperFunctions::debug( array( '[card-payment] payment_id empty - nothing to do' ), 'warning' ); 172 101 173 echo 'empty payment id'; 102 174 } 175 176 OxygenHelperFunctions::debug( array( '[card-payment] ===== request-handle-message.php finished =====' ), 'info' ); -
oxygen-mydata/trunk/inc/templates/plain-invoice-email-template.php
r3683155 r3700542 7 7 * 8 8 * @package Oxygen 9 * @version 3.0. 29 * @version 3.0.4 10 10 * 11 11 * @param string $email_heading Heading for the email. -
oxygen-mydata/trunk/oxygen-mydata.php
r3697066 r3700542 4 4 * Plugin URI: https://wordpress.org/plugins/oxygen-mydata/ 5 5 * Description: WooCommerce integration with MyData invoices for Greece. 6 * Version: 3.0 36 * Version: 3.0.4 7 7 * Author: oxygensuite 8 8 * Author URI: https://www.pelatologio.gr/ … … 22 22 * 23 23 * @package Oxygen 24 * @version 3.0 324 * @version 3.0.4 25 25 * @since 1.0.0 26 26 */ … … 29 29 30 30 // Define constants. 31 define( 'OXYGEN_PLUGIN_VERSION', '3.0 3' );31 define( 'OXYGEN_PLUGIN_VERSION', '3.0.4' ); 32 32 define( 'OXYGEN_PLUGIN_FILE', __FILE__ ); 33 33 define( 'OXYGEN_PLUGIN_DIR', plugin_dir_path( __FILE__ ) ); -
oxygen-mydata/trunk/readme.txt
r3697066 r3700542 10 10 WC requires at least: 4.7 11 11 WC tested up to: 11.0.1 12 Version: 3.0 313 Stable tag: 3.0 312 Version: 3.0.4 13 Stable tag: 3.0.4 14 14 License: GPLv2 15 15 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 117 117 == Changelog == 118 118 119 = 3.0.4 = 120 * Fixed bug with oxygen payments - payment with card 121 * Fixed register_rest_route error for permission callback at payment gateway 122 * Fixed MyLocalizedText variable not defined 123 119 124 = 3.0.3 = 120 125 * Fixed on skroutz invoice uploader - reduce resources usage
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)