Changeset 2781410
- Timestamp:
- 09/07/2022 02:32:10 PM (4 years ago)
- Location:
- cardgate
- Files:
-
- 8 edited
- 1 copied
-
tags/3.1.22 (copied) (copied from cardgate/trunk)
-
tags/3.1.22/cardgate-clientlib-php/src/Client.php (modified) (1 diff)
-
tags/3.1.22/cardgate.php (modified) (1 diff)
-
tags/3.1.22/classes/CGP_Common_Gateway.php (modified) (10 diffs)
-
tags/3.1.22/readme.txt (modified) (2 diffs)
-
trunk/cardgate-clientlib-php/src/Client.php (modified) (1 diff)
-
trunk/cardgate.php (modified) (1 diff)
-
trunk/classes/CGP_Common_Gateway.php (modified) (10 diffs)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
cardgate/tags/3.1.22/cardgate-clientlib-php/src/Client.php
r2588602 r2781410 36 36 * Client version. 37 37 */ 38 const CLIENT_VERSION = "1.1.1 5";38 const CLIENT_VERSION = "1.1.17"; 39 39 40 40 /** -
cardgate/tags/3.1.22/cardgate.php
r2588602 r2781410 7 7 * Author: CardGate 8 8 * Author URI: https://www.cardgate.com 9 * Version: 3.1.2 19 * Version: 3.1.22 10 10 * Text Domain: cardgate 11 11 * Domain Path: /i18n/languages 12 12 * Requires at least: 4.4 13 * WC requires at least: 2.1.014 * WC tested up to: 5.6.013 * WC requires at least: 3.0.0 14 * WC tested up to: 6.8.2 15 15 * License: GPLv3 or later 16 16 */ -
cardgate/tags/3.1.22/classes/CGP_Common_Gateway.php
r2532998 r2781410 20 20 var $logo; 21 21 var $bSeperateSalesTax; 22 var $instructions; 22 23 23 24 // //////////////////////////////////////////////// … … 27 28 $this->title = (isset($this->settings['title']) && !empty($this->settings['title']) ? $this->settings['title'] : $this->payment_name); 28 29 $this->description = $this->settings['description']; 30 $this->instructions = (!empty($this->settings['instructions']) ? $this->settings['instructions'] : ''); 29 31 30 32 add_filter ( 'woocommerce_gateway_icon', array($this, 'modify_icon'), 20, 2 ); 31 33 add_action( 'woocommerce_update_options_payment_gateways_' . $this->id, array( $this, 'process_admin_options' ) ); 32 34 add_action( 'woocommerce_receipt_' . $this->id, array( $this, 'receiptPage' ) ); 35 add_action( 'woocommerce_thankyou_' . $this->id, array( $this, 'thankyou_page' ) ); 33 36 } 34 37 … … 44 47 } 45 48 } 49 50 /** 51 * Output for the order received page. 52 */ 53 public function thankyou_page() { 54 if ( $this->instructions ) { 55 echo wp_kses_post( wpautop( wptexturize( $this->instructions ) ) ); 56 } 57 } 46 58 47 59 // //////////////////////////////////////////////// … … 147 159 'default' => __( 'Pay with ', 'cardgate' ) . $this->payment_name, 148 160 'desc_tip' => true 149 ] 161 ], 162 'instructions' => [ 163 'title' => __( 'Instructions', 'cardgate' ), 164 'type' => 'textarea', 165 'description' => __( 'Instructions that will be added to the thank you page.', 'cardgate' ), 166 'default' => __( '', 'cardgate' ), 167 'desc_tip' => true 168 ] 150 169 ]; 151 170 } … … 180 199 public function process_payment( $iOrderId ) { 181 200 global $woocommerce; 182 183 201 try { 184 202 … … 546 564 $sModel = $this->formatSku( $oProduct ); 547 565 $iQty = $oItem->get_quantity(); 548 $iPrice = round( ( $oItem->get_ total() * 100 ) / $iQty );549 $iTax = round( ( $oItem->get_ total_tax() * 100 ) / $iQty );566 $iPrice = round( ( $oItem->get_subtotal() * 100 ) / $iQty ); 567 $iTax = round( ( $oItem->get_subtotal_tax() * 100 ) / $iQty ); 550 568 $iTotal = round( $iPrice + $iTax ); 551 569 $iTaxrate = $this->get_tax_rate( $oProduct ); … … 577 595 578 596 $iShippingTotal = 0; 579 $i ShippingVatTotal = 0;597 $ishippingTaxTotal = 0; 580 598 581 599 $aShipping_methods = $oOrder->get_shipping_methods(); … … 610 628 611 629 $iShippingTotal = $iPrice; 612 $i ShippingVatTotal = $iTax;630 $ishippingTaxTotal = $iTax; 613 631 } 614 632 } … … 629 647 } 630 648 631 $iTaxDifference = round( $oOrder->get_total_tax() * 100 ) - $iCartItemTaxTotal - $iShippingVatTotal; 649 $iDiscountTotal = 0; 650 $iDiscountTaxTotal = 0; 651 652 $aOrderData = $oOrder->get_data(); 653 if ( $aOrderData['discount_total'] > 0 ) { 654 $iDiscountTaxTotal = round($aOrderData['discount_tax'] * -100); 655 $iDiscountTotal = round($aOrderData['discount_total'] * -100); 656 $iDiscountVat = round($aOrderData['discount_tax'] / $aOrderData['discount_total'] * 100); 657 658 $nr ++; 659 $items[ $nr ]['type'] = 'discount'; 660 $items[ $nr ]['model'] = 'discount_total'; 661 $items[ $nr ]['name'] = 'Discount'; 662 $items[ $nr ]['quantity'] = 1; 663 $items[ $nr ]['price_wt'] = $iDiscountTotal; 664 $items[ $nr ]['vat'] = $iDiscountVat; 665 $items[ $nr ]['vat_amount'] = $iDiscountTaxTotal; 666 } 667 668 $iTaxDifference = round( $oOrder->get_total_tax() * 100 ) - $iCartItemTaxTotal - $ishippingTaxTotal - $iDiscountTaxTotal; 632 669 if ( $iTaxDifference != 0 ) { 633 670 $nr ++; … … 641 678 } 642 679 643 $iCorrection = round( $iOrderTotal - $iCartItemTotal - $iCartItemTaxTotal - $iShippingTotal - $i ShippingVatTotal - $iExtraFee - $iTaxDifference);680 $iCorrection = round( $iOrderTotal - $iCartItemTotal - $iCartItemTaxTotal - $iShippingTotal - $ishippingTaxTotal - $iExtraFee - $iTaxDifference - $iDiscountTotal - $iDiscountTaxTotal); 644 681 645 682 if ( $iCorrection != 0 ) { -
cardgate/tags/3.1.22/readme.txt
r2665824 r2781410 5 5 Requires at least: 4.4 6 6 Tested up to: 5.9 7 Stable tag: 3.1.2 17 Stable tag: 3.1.22 8 8 License: GPLv3 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-3.0.html … … 75 75 76 76 == Changelog == 77 78 = 3.1.22 = 79 * Added: Instructions field 80 * Added: Discount items 81 * update: Client Lib 77 82 78 83 = 3.1.21 = -
cardgate/trunk/cardgate-clientlib-php/src/Client.php
r2588602 r2781410 36 36 * Client version. 37 37 */ 38 const CLIENT_VERSION = "1.1.1 5";38 const CLIENT_VERSION = "1.1.17"; 39 39 40 40 /** -
cardgate/trunk/cardgate.php
r2588602 r2781410 7 7 * Author: CardGate 8 8 * Author URI: https://www.cardgate.com 9 * Version: 3.1.2 19 * Version: 3.1.22 10 10 * Text Domain: cardgate 11 11 * Domain Path: /i18n/languages 12 12 * Requires at least: 4.4 13 * WC requires at least: 2.1.014 * WC tested up to: 5.6.013 * WC requires at least: 3.0.0 14 * WC tested up to: 6.8.2 15 15 * License: GPLv3 or later 16 16 */ -
cardgate/trunk/classes/CGP_Common_Gateway.php
r2532998 r2781410 20 20 var $logo; 21 21 var $bSeperateSalesTax; 22 var $instructions; 22 23 23 24 // //////////////////////////////////////////////// … … 27 28 $this->title = (isset($this->settings['title']) && !empty($this->settings['title']) ? $this->settings['title'] : $this->payment_name); 28 29 $this->description = $this->settings['description']; 30 $this->instructions = (!empty($this->settings['instructions']) ? $this->settings['instructions'] : ''); 29 31 30 32 add_filter ( 'woocommerce_gateway_icon', array($this, 'modify_icon'), 20, 2 ); 31 33 add_action( 'woocommerce_update_options_payment_gateways_' . $this->id, array( $this, 'process_admin_options' ) ); 32 34 add_action( 'woocommerce_receipt_' . $this->id, array( $this, 'receiptPage' ) ); 35 add_action( 'woocommerce_thankyou_' . $this->id, array( $this, 'thankyou_page' ) ); 33 36 } 34 37 … … 44 47 } 45 48 } 49 50 /** 51 * Output for the order received page. 52 */ 53 public function thankyou_page() { 54 if ( $this->instructions ) { 55 echo wp_kses_post( wpautop( wptexturize( $this->instructions ) ) ); 56 } 57 } 46 58 47 59 // //////////////////////////////////////////////// … … 147 159 'default' => __( 'Pay with ', 'cardgate' ) . $this->payment_name, 148 160 'desc_tip' => true 149 ] 161 ], 162 'instructions' => [ 163 'title' => __( 'Instructions', 'cardgate' ), 164 'type' => 'textarea', 165 'description' => __( 'Instructions that will be added to the thank you page.', 'cardgate' ), 166 'default' => __( '', 'cardgate' ), 167 'desc_tip' => true 168 ] 150 169 ]; 151 170 } … … 180 199 public function process_payment( $iOrderId ) { 181 200 global $woocommerce; 182 183 201 try { 184 202 … … 546 564 $sModel = $this->formatSku( $oProduct ); 547 565 $iQty = $oItem->get_quantity(); 548 $iPrice = round( ( $oItem->get_ total() * 100 ) / $iQty );549 $iTax = round( ( $oItem->get_ total_tax() * 100 ) / $iQty );566 $iPrice = round( ( $oItem->get_subtotal() * 100 ) / $iQty ); 567 $iTax = round( ( $oItem->get_subtotal_tax() * 100 ) / $iQty ); 550 568 $iTotal = round( $iPrice + $iTax ); 551 569 $iTaxrate = $this->get_tax_rate( $oProduct ); … … 577 595 578 596 $iShippingTotal = 0; 579 $i ShippingVatTotal = 0;597 $ishippingTaxTotal = 0; 580 598 581 599 $aShipping_methods = $oOrder->get_shipping_methods(); … … 610 628 611 629 $iShippingTotal = $iPrice; 612 $i ShippingVatTotal = $iTax;630 $ishippingTaxTotal = $iTax; 613 631 } 614 632 } … … 629 647 } 630 648 631 $iTaxDifference = round( $oOrder->get_total_tax() * 100 ) - $iCartItemTaxTotal - $iShippingVatTotal; 649 $iDiscountTotal = 0; 650 $iDiscountTaxTotal = 0; 651 652 $aOrderData = $oOrder->get_data(); 653 if ( $aOrderData['discount_total'] > 0 ) { 654 $iDiscountTaxTotal = round($aOrderData['discount_tax'] * -100); 655 $iDiscountTotal = round($aOrderData['discount_total'] * -100); 656 $iDiscountVat = round($aOrderData['discount_tax'] / $aOrderData['discount_total'] * 100); 657 658 $nr ++; 659 $items[ $nr ]['type'] = 'discount'; 660 $items[ $nr ]['model'] = 'discount_total'; 661 $items[ $nr ]['name'] = 'Discount'; 662 $items[ $nr ]['quantity'] = 1; 663 $items[ $nr ]['price_wt'] = $iDiscountTotal; 664 $items[ $nr ]['vat'] = $iDiscountVat; 665 $items[ $nr ]['vat_amount'] = $iDiscountTaxTotal; 666 } 667 668 $iTaxDifference = round( $oOrder->get_total_tax() * 100 ) - $iCartItemTaxTotal - $ishippingTaxTotal - $iDiscountTaxTotal; 632 669 if ( $iTaxDifference != 0 ) { 633 670 $nr ++; … … 641 678 } 642 679 643 $iCorrection = round( $iOrderTotal - $iCartItemTotal - $iCartItemTaxTotal - $iShippingTotal - $i ShippingVatTotal - $iExtraFee - $iTaxDifference);680 $iCorrection = round( $iOrderTotal - $iCartItemTotal - $iCartItemTaxTotal - $iShippingTotal - $ishippingTaxTotal - $iExtraFee - $iTaxDifference - $iDiscountTotal - $iDiscountTaxTotal); 644 681 645 682 if ( $iCorrection != 0 ) { -
cardgate/trunk/readme.txt
r2665824 r2781410 5 5 Requires at least: 4.4 6 6 Tested up to: 5.9 7 Stable tag: 3.1.2 17 Stable tag: 3.1.22 8 8 License: GPLv3 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-3.0.html … … 75 75 76 76 == Changelog == 77 78 = 3.1.22 = 79 * Added: Instructions field 80 * Added: Discount items 81 * update: Client Lib 77 82 78 83 = 3.1.21 =
Note: See TracChangeset
for help on using the changeset viewer.