Plugin Directory

Changeset 3073097


Ignore:
Timestamp:
04/18/2024 12:07:04 PM (2 years ago)
Author:
chaifinport
Message:

adding support for the new Blocks checkout and updated the icon

Location:
chaiport-payment/trunk
Files:
4 added
2 edited

Legend:

Unmodified
Added
Removed
  • chaiport-payment/trunk/chaiportGateway.php

    r3014526 r3073097  
    44 * Plugin URI:        https://www.docs.portone.cloud/plugins_and_sdks/woocommerce-plugin.html
    55 * Description:       Single Payment
    6  * Version:           2.0.9
     6 * Version:           3.0.0
    77 * Requires at least: 5.6
    88 * Author:            PortOne
     
    474474{
    475475
     476    add_action( 'before_woocommerce_init', 'portone_cart_checkout_blocks_compatibility' );
     477    add_action( 'woocommerce_blocks_loaded', 'portone_gateway_block_support' );
     478
    476479    class WC_Chaiport_Gateway extends WC_Payment_Gateway
    477480    {
     
    486489
    487490            $plugin_location = plugin_dir_url(__FILE__);
    488             $imageUrl = $plugin_location . "images/pay.png";
     491            $imageUrl = $plugin_location . "images/woocommerce_icon.png";
    489492
    490493            $websiteUrl = get_bloginfo('url');
     
    572575                    'type' => 'text',
    573576                    'description' => 'This is the title which the user sees during checkout.',
    574                     'default' => 'Credit Card/Debit Card/E-Wallets',
     577                    'default' => 'Cards/Wallets/Bank-Transfer',
    575578                    'desc_tip' => false
    576579                ),
     
    579582                    'type' => 'textarea',
    580583                    'description' => 'This is the description which the user sees during checkout.',
    581                     'default' => 'Pay with your Credit Card/Debit Card/E-Wallets via PortOne Payment Service'
     584                    'default' => 'Pay with Cards/Wallets/Bank-Transfer via PortOne'
    582585                ),
    583586                'testmode' => array(
     
    769772                "back_url" => get_bloginfo('url') . "/checkout/",
    770773                "shipping_charges" => round((float)$order->get_shipping_total(), 2),
    771                 "promo_discount" => round((float)$discount_total, 2)
     774                "promo_discount" => round((float)$discount_total, 2),
     775                "tax_amount" => round((float)$order->get_total_tax(), 2)
    772776            );
    773777
    774778            $this->console_log("Environment is: " . $environment, '');
    775             if ($amount != ((float)$order->get_shipping_total() + $item_total - round((float)$discount_total, 2))) {
     779            if ($amount != ((float)$order->get_total_tax() + (float)$order->get_shipping_total() + $item_total - round((float)$discount_total, 2))) {
    776780                $this->console_log("Not sending item details", '');
    777781                $isItemsAvailable = false;
     
    786790                $this->console_log("Total amount is: " . $amount, '');
    787791                $this->console_log("Items total is: " . $item_total, '');
     792                $this->console_log("Tax amount is: " . round((float)$order->get_total_tax(), 2), '');
    788793                $this->console_log("Shipping amount is: " . (float)$order->get_shipping_total(), '');
    789794                $this->console_log("Discount is: " . round((float)$discount_total, 2), '');
     
    12531258    }
    12541259}
     1260
     1261function portone_cart_checkout_blocks_compatibility() {
     1262
     1263    if( class_exists( '\Automattic\WooCommerce\Utilities\FeaturesUtil' ) ) {
     1264        \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility(
     1265            'cart_checkout_blocks',
     1266            __FILE__,
     1267            true // true (compatible, default) or false (not compatible)
     1268        );
     1269    }
     1270
     1271}
     1272
     1273
     1274function portone_gateway_block_support() {
     1275
     1276    if( ! class_exists( 'Automattic\WooCommerce\Blocks\Payments\Integrations\AbstractPaymentMethodType' ) ) {
     1277        return;
     1278    }
     1279
     1280    // here we're including our "gateway block support class"
     1281    require_once plugin_dir_path( __FILE__ ) . 'includes/portoneBlocks.php';
     1282
     1283    // registering the PHP class we have just included
     1284    add_action(
     1285        'woocommerce_blocks_payment_method_type_registration',
     1286        function( Automattic\WooCommerce\Blocks\Payments\PaymentMethodRegistry $payment_method_registry ) {
     1287            $payment_method_registry->register( new WC_Portone_Gateway_Blocks_Support );
     1288        }
     1289    );
     1290
     1291}
  • chaiport-payment/trunk/readme.txt

    r3014526 r3073097  
    33Tags: chaipay, chaiport, payments, woocommerce, ecommerce, portone
    44Requires at least: 3.9.2
    5 Tested up to: 6.1.1
    6 Stable tag: 2.0.9
     5Tested up to: 6.5.2
     6Stable tag: 3.0.0
    77Requires PHP: 5.6
    88License: GPLv2 or later
     
    1313== Description ==
    1414
    15 This is the official PortOne payments plugin for WooCommerce. Allows you to accept credit cards, debit cards and wallet payments with the WooCommerce plugin. It uses a seamless integration, allowing the customer to pay on your website without being redirected away. This works across all browsers, and is compatible with the latest WooCommerce.
     15This is the official PortOne payments plugin for WooCommerce. Allows you to accept credit cards, debit cards and wallet payments with the WooCommerce plugin.
    1616
    17 This is compatible with WooCommerce>=2.4, including the new 3.0 release. It has been tested upto the 3.1.1 WooCommerce release.
     17It uses a seamless integration, allowing the customer to pay on your website without being redirected away. This works across all browsers, and is compatible with the latest WooCommerce.
     18
     19This plugin supports both, legacy and the new Blocks based checkout.
     20
     21This is compatible with WooCommerce>=2.4. It has been tested upto the 8.7.0 WooCommerce release.
    1822
    1923== Installation ==
Note: See TracChangeset for help on using the changeset viewer.