Changeset 2803807
- Timestamp:
- 10/25/2022 09:08:34 AM (3 years ago)
- Location:
- aircash-for-woocommerce
- Files:
-
- 5 edited
-
tags/1.0.2/aircash-woocommerce.php (modified) (3 diffs)
-
tags/1.0.2/includes/class-aircash-payment-gateway.php (modified) (1 diff)
-
trunk/aircash-woocommerce.php (modified) (4 diffs)
-
trunk/includes/class-aircash-payment-gateway.php (modified) (9 diffs)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
aircash-for-woocommerce/tags/1.0.2/aircash-woocommerce.php
r2802373 r2803807 19 19 20 20 add_action( 'init', 'aircash_load_textdomain' ); 21 21 22 22 function aircash_load_textdomain() { 23 load_plugin_textdomain( 'aircash-for-woocommerce', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );23 load_plugin_textdomain( 'aircash-for-woocommerce', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' ); 24 24 } 25 25 if ( ! class_exists( 'WC_Aircash' ) ) { … … 42 42 add_action( 'admin_init', array( $this->get_aircash_payment_gateway(), 'admin_init' ) ); 43 43 add_action( 'admin_init', array( $this->get_aircash_payment_gateway(), 'check_configuration' ) ); 44 add_action('in_admin_footer', array($this->get_aircash_payment_gateway(), 'add_html_to_admin'));44 add_action('in_admin_footer', array($this->get_aircash_payment_gateway(), 'add_html_to_admin')); 45 45 } 46 46 } … … 187 187 jQuery.post("<?php echo admin_url( 'admin-ajax.php' ); ?>", { 188 188 action: "aircash_dismiss_notice", 189 dismiss_action: "<?php echo esc_js( $notice['dismiss_action'] ); ?>",189 dismiss_action: "<?php echo isset($notice['dismiss_action']) ? esc_js( $notice['dismiss_action']) : null; ?>", 190 190 nonce: "<?php echo esc_js( wp_create_nonce( 'aircash_dismiss_notice' ) ); ?>" 191 191 }); -
aircash-for-woocommerce/tags/1.0.2/includes/class-aircash-payment-gateway.php
r2802373 r2803807 545 545 echo base64_encode( $qr_code_image_data ); 546 546 ?>"> 547 <? 547 <?php 548 548 } 549 549 ?> -
aircash-for-woocommerce/trunk/aircash-woocommerce.php
r2803780 r2803807 5 5 * Plugin URI: https://aircash.eu/aircash-woocommerce/ 6 6 * Description: Aircash - for quick and simple payments 7 * Version: 1.0 7 * Version: 1.0.2 8 8 * Author: Aircash 9 9 * Requires PHP: 7.1 … … 19 19 20 20 add_action( 'init', 'aircash_load_textdomain' ); 21 21 22 22 function aircash_load_textdomain() { 23 load_plugin_textdomain( 'aircash-for-woocommerce', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );23 load_plugin_textdomain( 'aircash-for-woocommerce', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' ); 24 24 } 25 25 if ( ! class_exists( 'WC_Aircash' ) ) { … … 42 42 add_action( 'admin_init', array( $this->get_aircash_payment_gateway(), 'admin_init' ) ); 43 43 add_action( 'admin_init', array( $this->get_aircash_payment_gateway(), 'check_configuration' ) ); 44 add_action('in_admin_footer', array($this->get_aircash_payment_gateway(), 'add_html_to_admin'));44 add_action('in_admin_footer', array($this->get_aircash_payment_gateway(), 'add_html_to_admin')); 45 45 } 46 46 } … … 187 187 jQuery.post("<?php echo admin_url( 'admin-ajax.php' ); ?>", { 188 188 action: "aircash_dismiss_notice", 189 dismiss_action: "<?php echo esc_js( $notice['dismiss_action'] ); ?>",189 dismiss_action: "<?php echo isset($notice['dismiss_action']) ? esc_js( $notice['dismiss_action']) : null; ?>", 190 190 nonce: "<?php echo esc_js( wp_create_nonce( 'aircash_dismiss_notice' ) ); ?>" 191 191 }); -
aircash-for-woocommerce/trunk/includes/class-aircash-payment-gateway.php
r2803780 r2803807 9 9 use BaconQrCode\Renderer\ImageRenderer; 10 10 use BaconQrCode\Renderer\Image\ImagickImageBackEnd; 11 use BaconQrCode\Renderer\PlainTextRenderer; 11 12 use BaconQrCode\Renderer\RendererStyle\RendererStyle; 12 13 use BaconQrCode\Writer; … … 60 61 add_filter( 'wp_enqueue_scripts', array( $this, 'add_frontend_scripts' ) ); 61 62 add_action( 'aircash_cron_hook', array( $this, 'update_aircash_account_status' ) ); 63 add_action( 'admin_head', array( $this, 'remove_manual_refund_button_for_aircash_orders' ) ); 62 64 } 63 65 64 66 private function get_plugin_url(): string { 65 67 return untrailingslashit( plugins_url( '/', realpath( __DIR__ . '/../aircash-woocommerce.php' ) ) ); 68 } 69 70 /** 71 * Hides the manual refund button 72 * 73 * @return void 74 */ 75 public function remove_manual_refund_button_for_aircash_orders() { 76 global $post; 77 if ( ! $post ) { 78 return; 79 } 80 if ( $post->post_type !== 'shop_order' ) { 81 return; 82 } 83 $order = new WC_Order( $post->ID ); 84 if ( 'aircash-woocommerce' !== $order->get_payment_method() ) { 85 return; 86 } 87 echo '<style>.do-manual-refund {display: none !important;}</style>'; 66 88 } 67 89 … … 121 143 */ 122 144 public function add_html_to_admin() { 123 echo '<div id="aircash-new-account-request-url" data-url="' . esc_attr( $this->get_new_account_request_url()) . '"></div>';145 echo '<div id="aircash-new-account-request-url" data-url="' . esc_attr( $this->get_new_account_request_url() ) . '"></div>'; 124 146 } 125 147 … … 427 449 $order->save(); 428 450 } 429 $store_address = get_option( 'woocommerce_store_address' ); 430 $store_address_2 = get_option( 'woocommerce_store_address_2' ); 431 $store_city = get_option( 'woocommerce_store_city' ); 432 $store_postcode = get_option( 'woocommerce_store_postcode' ); 433 $location = null; 434 if ( $store_address ) { 435 $location .= $store_address . ', '; 436 } 437 if ( $store_address_2 ) { 438 $location .= $store_address_2 . ', '; 439 } 440 if ( $store_city ) { 441 $location .= trim( $store_postcode . ' ' . $store_city ); 442 } 443 $store_raw_country = get_option( 'woocommerce_default_country' ); 444 if ( $store_raw_country ) { 445 $location .= ', ' . $store_raw_country; 446 } 451 $location = preg_replace( '/^https?:\/\//i', '', get_site_url() ); 447 452 $parameters = array( 448 453 'Amount' => (float) number_format( $order->get_total(), 2, '.', '' ), … … 459 464 // phpcs:ignore 460 465 ini_set( 'serialize_precision', - 1 ); 461 $body = wp_json_encode( $parameters, \JSON_UNESCAPED_SLASHES );466 $body = wp_json_encode( $parameters, JSON_UNESCAPED_SLASHES ); 462 467 // phpcs:ignore 463 468 ini_set( 'serialize_precision', $serialize_precizion ); … … 472 477 ) 473 478 ); 474 $result = $error_message = $qr_code_image_data = null;479 $result = $error_message = $qr_code_image_data = $qr_code_textual = null; 475 480 476 481 $response_code = (int) wp_remote_retrieve_response_code( $response ); … … 485 490 if ( isset( $result['codeLink'] ) && is_string( $result['codeLink'] ) ) { 486 491 // It's all good man, display the QR code 487 $renderer = new ImageRenderer( new RendererStyle( 400 ), new ImagickImageBackEnd() ); 488 $writer = new Writer( $renderer ); 489 $qr_code_image_data = $writer->writeString( $result['codeLink'] ); 492 if ( ! extension_loaded( 'imagick' ) ) { 493 $qr_code_textual = true; 494 $renderer = new PlainTextRenderer(); 495 $writer = new Writer( $renderer ); 496 $qr_code_image_data = $writer->writeString( $result['codeLink'] ); 497 } else { 498 $qr_code_textual = false; 499 $renderer = new ImageRenderer( new RendererStyle( 400 ), new ImagickImageBackEnd() ); 500 $writer = new Writer( $renderer ); 501 $qr_code_image_data = $writer->writeString( $result['codeLink'] ); 502 } 490 503 } else { 491 504 $error_message = 'Unable to generate QR code'; … … 520 533 521 534 <div class="aircash-qr-code-wrapper"> 522 <img class="aircash-qr-code" src="data:image/png;base64,<?php 523 // phpcs:ignore 524 echo base64_encode( $qr_code_image_data ); 525 ?>"> 535 <?php 536 if ( $qr_code_textual ) { 537 ?> 538 <pre style="line-height:100%;color:black;font-family:monospace;font-size:11px;background:white;font-weight:100;letter-spacing:-1px;user-select:none;-webkit-user-select:none"><?php 539 echo $qr_code_image_data; 540 ?></pre><?php 541 } else { 542 ?> 543 <img class="aircash-qr-code" src="data:image/png;base64,<?php 544 // phpcs:ignore 545 echo base64_encode( $qr_code_image_data ); 546 ?>"> 547 <?php 548 } 549 ?> 526 550 <ol> 527 551 <li><?php echo esc_html__( 'Open Aircash application', 'aircash-for-woocommerce' ) ?></li> … … 951 975 $this->update_option( $aircash_callback_url_option, $callback_url ); 952 976 953 $body = wp_json_encode( $parameters, \JSON_UNESCAPED_SLASHES ^ \JSON_UNESCAPED_LINE_TERMINATORS ^ \JSON_PRETTY_PRINT );977 $body = wp_json_encode( $parameters, JSON_UNESCAPED_SLASHES ^ JSON_UNESCAPED_LINE_TERMINATORS ^ JSON_PRETTY_PRINT ); 954 978 $response = wp_remote_post( 955 979 'https://' . ( $test ? 'staging-m3.aircash.eu' : 'm3.aircash.eu' ) . '/api/AircashPay/ActivatePartner', -
aircash-for-woocommerce/trunk/readme.txt
r2803780 r2803807 4 4 Requires at least: 4.7 5 5 Tested up to: 5.9.3 6 Stable tag: 1.0 6 Stable tag: 1.0.2 7 7 Requires PHP: 7.1 8 8 License: GPLv2 or later … … 101 101 == Changelog == 102 102 103 = 1.0.2 = 104 105 Updated refund option. 106 103 107 = 1.0.1 = 104 108
Note: See TracChangeset
for help on using the changeset viewer.