Plugin Directory

Changeset 3216301


Ignore:
Timestamp:
01/03/2025 08:11:20 AM (15 months ago)
Author:
payhere
Message:

Support for PayHere gateway discounts has been enabled to display in WooCommerce Orders

Location:
payhere-payment-gateway-beta
Files:
80 added
4 edited

Legend:

Unmodified
Added
Removed
  • payhere-payment-gateway-beta/trunk/gateway/class-payhereorderutilities.php

    r3216236 r3216301  
    115115            $this->order->add_order_note( 'PayHere payment successful.<br/>PayHere Payment ID: ' . $payment_id );
    116116
     117            if ($post['captured_amount'] != $post['payhere_amount']){
     118               
     119                $discount_amount = $post['payhere_amount'] - $post['captured_amount'];
     120       
     121                $item = new WC_Order_Item_Fee();
     122                $item->set_name(__('PayHere Payment Gateway Discount', 'payhere'));
     123                $item->set_amount(-$discount_amount);
     124                $item->set_total(-$discount_amount);
     125                $this->order->add_item($item);
     126                $this->order->set_total($this->order->get_total() - $discount_amount);
     127                $this->order->save();
     128            }
     129
    117130            if ( $this->is_subscription ) {
    118131                $subscription_id = sanitize_text_field( $post['subscription_id'] ); //moved to is_subscription block from version 2.3.7
  • payhere-payment-gateway-beta/trunk/gateway/class-wcgatewaypayhere.php

    r3216236 r3216301  
    786786
    787787                    $post_data = [
    788                         'payment_id'    => sanitize_text_field($payment_id),
     788                        'payment_id'        => sanitize_text_field($payment_id),
     789                        'payhere_amount'    => sanitize_text_field(filter_input(INPUT_POST, 'payhere_amount', FILTER_SANITIZE_SPECIAL_CHARS)),
     790                        'captured_amount'   => sanitize_text_field(filter_input(INPUT_POST, 'captured_amount', FILTER_SANITIZE_SPECIAL_CHARS))
    789791                    ];
    790792
  • payhere-payment-gateway-beta/trunk/payhere-payment-gateway-beta.php

    r3216236 r3216301  
    77 * Plugin Name:       PayHere Payment Gateway - Beta
    88 * Description:       This is a beta version of the PayHere Payment Gateway and is recommended for use in a development environment.
    9  * Version:           2.3.8
     9 * Version:           2.4.0
    1010 * Author:            PayHere (Private) Limited
    1111 * Author URI:        https://www.payhere.lk
     
    2727 * Start at version 2.0.0 and use SemVer - https://semver.org
    2828 */
    29 define('PAYHERE_VERSION', '2.3.8');
     29define('PAYHERE_VERSION', '2.4.0');
    3030/**
    3131 * Currently plugin text domain.
  • payhere-payment-gateway-beta/trunk/readme.txt

    r3216236 r3216301  
    66Tested up to: 6.7.1
    77WC tested up to: 9.5.1
    8 Stable tag: 2.3.8
     8Stable tag: 2.4.0
    99License: GPLv2 or later
    1010License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    3535= 2.3.8 =
    3636Fixed issues with authorized and tokenized payments, and the issue with shipping details not being passed to PayHere in partial payments has also been fixed.
     37
     38= 2.4.0 =
     39Support for PayHere gateway discounts has been enabled to display in WooCommerce Orders.
    3740
    3841== Frequently Asked Questions ==
Note: See TracChangeset for help on using the changeset viewer.