Plugin Directory

Changeset 3185027


Ignore:
Timestamp:
11/10/2024 08:30:07 AM (17 months ago)
Author:
webimpian
Message:

Add nets and add gateway fee title

Location:
bayarcash-wc
Files:
344 added
17 edited

Legend:

Unmodified
Added
Removed
  • bayarcash-wc/trunk/bayarcash-wc.php

    r3169110 r3185027  
    1313 * Plugin Name:         Bayarcash WC
    1414 * Plugin URI:          https://bayarcash.com/
    15  * Version:             4.2.5
     15 * Version:             4.2.6
    1616 * Description:         Accept payment from Malaysia. Bayarcash support FPX, Direct Debit, DuitNow OBW & DuitNow QR payment channels.
    1717 * Author:              Web Impian
    1818 * Author URI:          https://bayarcash.com/
    1919 * Requires at least:   5.6
    20  * Tested up to:        6.6.1
     20 * Tested up to:        6.7
    2121 * Requires PHP:        7.4
    2222 * License:             GPLv3
  • bayarcash-wc/trunk/includes/admin/bayarcash-wc-script.js

    r3169110 r3185027  
    1010            'duitnowboost-wc',
    1111            'duitnowqris-wc',
    12             'duitnowqriswallet-wc'
     12            'duitnowqriswallet-wc',
     13            'duitnownets-wc',
    1314        ];
    1415        const cache = {}; // Cache for jQuery selections and API responses
  • bayarcash-wc/trunk/includes/admin/bayarcash-wc-style.css

    r3165859 r3185027  
    2121#duitnowboost-wc-verify-status.valid,
    2222#duitnowqris-wc-verify-status.valid,
    23 #duitnowqriswallet-wc-verify-status.valid {
     23#duitnowqriswallet-wc-verify-status.valid,
     24#duitnownets-wc-verify-status.valid
     25{
    2426    color: green;
    2527    font-weight: bold;
     
    3537#duitnowboost-wc-verify-status.invalid,
    3638#duitnowqris-wc-verify-status.invalid,
    37 #duitnowqriswallet-wc-verify-status.invalid {
     39#duitnowqriswallet-wc-verify-status.invalid,
     40#duitnownets-wc-verify-status.invalid
     41{
    3842    color: red;
    3943    font-weight: bold;
  • bayarcash-wc/trunk/includes/src/AdminFormFields.php

    r3169110 r3185027  
    7171                'description' => esc_html__('Additional options to customize the payment experience and debugging.', $payment_method . '-wc'),
    7272            ],
     73            'logo_size_unit' => [
     74                'title'       => esc_html__('Logo Size Unit', $payment_method . '-wc'),
     75                'type'        => 'select',
     76                'options'     => [
     77                    '%'  => esc_html__('Percentage (%)', $payment_method . '-wc'),
     78                    'px' => esc_html__('Pixels (px)', $payment_method . '-wc'),
     79                ],
     80                'description' => esc_html__('Select the unit for logo size', $payment_method . '-wc'),
     81                'desc_tip'    => true,
     82                'default'     => 'px',
     83            ],
     84            'logo_size_value' => [
     85                'title'       => esc_html__('Logo Size', $payment_method . '-wc'),
     86                'type'        => 'number',
     87                'description' => esc_html__('Enter the size value for the logo', $payment_method . '-wc'),
     88                'desc_tip'    => true,
     89                'default'     => '180',
     90                'custom_attributes' => [
     91                    'min'  => '1',
     92                    'step' => '1',
     93                ],
     94            ],
    7395            'enabled_country' => [
    7496                'title'       => esc_html__('Country Restrictions', $payment_method . '-wc'),
     
    78100                    'MY' => esc_html__('Malaysia', $payment_method . '-wc'),
    79101                    'ID' => esc_html__('Indonesia', $payment_method . '-wc'),
     102                    'SG' => esc_html__('Singapore', $payment_method . '-wc'),
    80103                ],
    81104                'description' => esc_html__('Limit this payment method to specific countries.', $payment_method . '-wc'),
     
    150173                'default'     => 'no',
    151174            ],
     175            'additional_charge_name' => [
     176                'title'       => esc_html__('Fee Name', $payment_method . '-wc'),
     177                'type'        => 'text',
     178                'description' => esc_html__('Enter the name of the fee that will be displayed to customers', $payment_method . '-wc'),
     179                'desc_tip'    => true,
     180                'default'     => esc_html__('Bayarcash Processing Fee', $payment_method . '-wc'),
     181            ],
    152182            'additional_charge_type' => [
    153183                'title'       => esc_html__('Charge Type', $payment_method . '-wc'),
  • bayarcash-wc/trunk/includes/src/Bayarcash.php

    r3169110 r3185027  
    8484            $gateways[] = new DuitNowQRIS();
    8585            $gateways[] = new DuitNowQRISWALLET();
     86            $gateways[] = new DuitNowNETS();
    8687
    8788            // Check if WooCommerce Subscriptions is active
     
    134135                $version = bayarcash_version().'c'.date('Ymdh');
    135136
     137                // Enqueue the base CSS file
    136138                wp_enqueue_style($this->slug.'-checkout-css', $this->url.'includes/admin/checkout.css', null, $version);
     139
     140                // Define payment methods
     141                $payment_methods = [
     142                    'bayarcash-wc',
     143                    'duitnow-wc',
     144                    'linecredit-wc',
     145                    'directdebit-wc',
     146                    'duitnowqr-wc',
     147                    'duitnowshopee-wc',
     148                    'duitnowboost-wc',
     149                    'duitnowqris-wc',
     150                    'duitnowqriswallet-wc',
     151                    'duitnownets-wc'
     152                ];
     153
     154                // Build CSS for each payment method
     155                $dynamic_css = "";
     156
     157                foreach ($payment_methods as $method) {
     158                    // Get settings for each payment method
     159                    $gateway_settings = get_option('woocommerce_' . $method . '_settings', []);
     160
     161                    // Get logo size settings with fallbacks
     162                    $logo_size_unit = !empty($gateway_settings['logo_size_unit']) ? $gateway_settings['logo_size_unit'] : 'px';
     163                    $logo_size_value = !empty($gateway_settings['logo_size_value']) ? $gateway_settings['logo_size_value'] : '180';
     164
     165                    // Add CSS for this payment method using label selector
     166                    $dynamic_css .= "
     167                label[for='payment_method_{$method}'] img {
     168                    width: {$logo_size_value}{$logo_size_unit} !important;
     169                    height: auto !important;
     170                }
     171            ";
     172                }
     173
     174                // Add inline CSS after the main stylesheet
     175                wp_add_inline_style($this->slug.'-checkout-css', $dynamic_css);
    137176            }
    138177        );
  • bayarcash-wc/trunk/includes/src/BayarcashCheckoutFee.php

    r3169110 r3185027  
    1818            'duitnowboost-wc',
    1919            'duitnowqris-wc',
    20             'duitnowqriswallet-wc'
     20            'duitnowqriswallet-wc',
     21            'duitnownets-wc'
    2122        ];
    2223        $this->init();
     
    4748            'additional_charge_amount' => $settings['additional_charge_amount'] ?? '',
    4849            'additional_charge_percentage' => $settings['additional_charge_percentage'] ?? '',
     50            'additional_charge_name' => $settings['additional_charge_name'] ?? '',
    4951        ];
    5052        if ($fee_settings['enable_additional_charges'] !== 'yes') {
     
    6466        $cart_total = $cart->get_subtotal() + $cart->get_shipping_total();
    6567        $fee = 0;
    66         $fee_label = '';
     68        $fee_name = !empty($fee_settings['additional_charge_name'])
     69            ? $fee_settings['additional_charge_name']
     70            : __('Bayarcash Processing Fee', 'bayarcash-wc');
    6771
    6872        switch ($charge_type) {
    6973            case 'fixed':
    7074                $fee = $charge_amount;
    71                 $fee_label = sprintf(__('Bayarcash Processing Fee (RM %s)', 'bayarcash-wc'), number_format($charge_amount, 2));
     75                $fee_label = sprintf('%s (RM %s)', $fee_name, number_format($charge_amount, 2));
    7276                break;
    7377            case 'percentage':
    7478                $fee = ($cart_total * $charge_amount) / 100;
    75                 $fee_label = sprintf(__('Bayarcash Processing Fee (%s%%)', 'bayarcash-wc'), $charge_amount);
     79                $fee_label = sprintf('%s (%s%%)', $fee_name, $charge_amount);
    7680                break;
    7781            case 'both':
     
    7983                $percentage_fee = ($cart_total * $charge_percentage) / 100;
    8084                $fee = $fixed_fee + $percentage_fee;
    81                 $fee_label = sprintf(__('Bayarcash Processing Fee (RM %s + %s%%)', 'bayarcash-wc'), number_format($charge_amount, 2), $charge_percentage);
     85                $fee_label = sprintf('%s (RM %s + %s%%)', $fee_name, number_format($charge_amount, 2), $charge_percentage);
    8286                break;
    8387        }
  • bayarcash-wc/trunk/includes/src/CronEvent.php

    r3157102 r3185027  
    99{
    1010    private $pt;
    11     private array $supported_payment_methods = ['bayarcash-wc', 'duitnow-wc', 'linecredit-wc'];
     11    private array $supported_payment_methods = [
     12        'bayarcash-wc',
     13        'duitnow-wc',
     14        'linecredit-wc',
     15        'directdebit-wc',
     16        'duitnowqr-wc',
     17        'duitnowshopee-wc',
     18        'duitnowboost-wc',
     19        'duitnowqris-wc',
     20        'duitnowqriswallet-wc',
     21        'duitnownets-wc'
     22    ];
    1223
    1324    public function __construct($pt)
  • bayarcash-wc/trunk/includes/src/Gateway.php

    r3168181 r3185027  
    3232        'duitnowqris-wc' => ['log_title' => 'bayarcash_duitnowqris', 'gateway_number' => 9],
    3333        'duitnowqriswallet-wc' => ['log_title' => 'bayarcash_duitnowqriswallet', 'gateway_number' => 10],
     34        'duitnownets-wc' => ['log_title' => 'bayarcash_duitnownets', 'gateway_number' => 11],
    3435    ];
    3536
  • bayarcash-wc/trunk/includes/vendor/composer/autoload_classmap.php

    r3169110 r3185027  
    1818    'Bayarcash\\WooCommerce\\DuitNowBoostPayFlex' => $baseDir . '/includes/src/Gateway/DuitNowBoostPayFlex.php',
    1919    'Bayarcash\\WooCommerce\\DuitNowGateway' => $baseDir . '/includes/src/Gateway/DuitNowGateway.php',
     20    'Bayarcash\\WooCommerce\\DuitNowNETS' => $baseDir . '/includes/src/Gateway/DuitNowNETS.php',
    2021    'Bayarcash\\WooCommerce\\DuitNowQR' => $baseDir . '/includes/src/Gateway/DuitNowQR.php',
    2122    'Bayarcash\\WooCommerce\\DuitNowQRIS' => $baseDir . '/includes/src/Gateway/DuitNowQRIS.php',
  • bayarcash-wc/trunk/includes/vendor/composer/autoload_static.php

    r3169110 r3185027  
    8989        'Bayarcash\\WooCommerce\\DuitNowBoostPayFlex' => __DIR__ . '/../../..' . '/includes/src/Gateway/DuitNowBoostPayFlex.php',
    9090        'Bayarcash\\WooCommerce\\DuitNowGateway' => __DIR__ . '/../../..' . '/includes/src/Gateway/DuitNowGateway.php',
     91        'Bayarcash\\WooCommerce\\DuitNowNETS' => __DIR__ . '/../../..' . '/includes/src/Gateway/DuitNowNETS.php',
    9192        'Bayarcash\\WooCommerce\\DuitNowQR' => __DIR__ . '/../../..' . '/includes/src/Gateway/DuitNowQR.php',
    9293        'Bayarcash\\WooCommerce\\DuitNowQRIS' => __DIR__ . '/../../..' . '/includes/src/Gateway/DuitNowQRIS.php',
  • bayarcash-wc/trunk/includes/vendor/composer/installed.json

    r3165859 r3185027  
    132132        {
    133133            "name": "guzzlehttp/promises",
    134             "version": "2.0.3",
    135             "version_normalized": "2.0.3.0",
     134            "version": "2.0.4",
     135            "version_normalized": "2.0.4.0",
    136136            "source": {
    137137                "type": "git",
    138138                "url": "https://github.com/guzzle/promises.git",
    139                 "reference": "6ea8dd08867a2a42619d65c3deb2c0fcbf81c8f8"
    140             },
    141             "dist": {
    142                 "type": "zip",
    143                 "url": "https://api.github.com/repos/guzzle/promises/zipball/6ea8dd08867a2a42619d65c3deb2c0fcbf81c8f8",
    144                 "reference": "6ea8dd08867a2a42619d65c3deb2c0fcbf81c8f8",
     139                "reference": "f9c436286ab2892c7db7be8c8da4ef61ccf7b455"
     140            },
     141            "dist": {
     142                "type": "zip",
     143                "url": "https://api.github.com/repos/guzzle/promises/zipball/f9c436286ab2892c7db7be8c8da4ef61ccf7b455",
     144                "reference": "f9c436286ab2892c7db7be8c8da4ef61ccf7b455",
    145145                "shasum": ""
    146146            },
     
    152152                "phpunit/phpunit": "^8.5.39 || ^9.6.20"
    153153            },
    154             "time": "2024-07-18T10:29:17+00:00",
     154            "time": "2024-10-17T10:06:22+00:00",
    155155            "type": "library",
    156156            "extra": {
     
    198198            "support": {
    199199                "issues": "https://github.com/guzzle/promises/issues",
    200                 "source": "https://github.com/guzzle/promises/tree/2.0.3"
     200                "source": "https://github.com/guzzle/promises/tree/2.0.4"
    201201            },
    202202            "funding": [
     
    682682        {
    683683            "name": "webimpian/bayarcash-php-sdk",
    684             "version": "1.2.3",
    685             "version_normalized": "1.2.3.0",
     684            "version": "1.2.4",
     685            "version_normalized": "1.2.4.0",
    686686            "source": {
    687687                "type": "git",
    688688                "url": "https://github.com/webimpian/bayarcash-php-sdk.git",
    689                 "reference": "3a7ef088024c6c894445e3bcdba7b4bccff1b769"
    690             },
    691             "dist": {
    692                 "type": "zip",
    693                 "url": "https://api.github.com/repos/webimpian/bayarcash-php-sdk/zipball/3a7ef088024c6c894445e3bcdba7b4bccff1b769",
    694                 "reference": "3a7ef088024c6c894445e3bcdba7b4bccff1b769",
     689                "reference": "8664f695c53d3ba8c8ede8c916334392e047f3b3"
     690            },
     691            "dist": {
     692                "type": "zip",
     693                "url": "https://api.github.com/repos/webimpian/bayarcash-php-sdk/zipball/8664f695c53d3ba8c8ede8c916334392e047f3b3",
     694                "reference": "8664f695c53d3ba8c8ede8c916334392e047f3b3",
    695695                "shasum": ""
    696696            },
     
    704704                "psr/simple-cache": "^2.0"
    705705            },
    706             "time": "2024-09-26T01:03:43+00:00",
     706            "time": "2024-11-05T16:34:00+00:00",
    707707            "type": "sdk",
    708708            "extra": {
     
    733733            "description": "Bayarcash payment gateway PHP Sdk.",
    734734            "support": {
    735                 "source": "https://github.com/webimpian/bayarcash-php-sdk/tree/v1.2.3",
     735                "source": "https://github.com/webimpian/bayarcash-php-sdk/tree/v1.2.4",
    736736                "issues": "https://github.com/webimpian/bayarcash-php-sdk/issues"
    737737            },
  • bayarcash-wc/trunk/includes/vendor/composer/installed.php

    r3169110 r3185027  
    44        'pretty_version' => 'dev-master',
    55        'version' => 'dev-master',
    6         'reference' => 'e1aaf99e28972fbf73a3dbcfcf7ae36141eb64c4',
     6        'reference' => '29b6f5d4651009df50123b07ce8b06131781db0d',
    77        'type' => 'wordpress-plugin',
    88        'install_path' => __DIR__ . '/../../../',
     
    1414            'pretty_version' => 'dev-master',
    1515            'version' => 'dev-master',
    16             'reference' => 'e1aaf99e28972fbf73a3dbcfcf7ae36141eb64c4',
     16            'reference' => '29b6f5d4651009df50123b07ce8b06131781db0d',
    1717            'type' => 'wordpress-plugin',
    1818            'install_path' => __DIR__ . '/../../../',
     
    3030        ),
    3131        'guzzlehttp/promises' => array(
    32             'pretty_version' => '2.0.3',
    33             'version' => '2.0.3.0',
    34             'reference' => '6ea8dd08867a2a42619d65c3deb2c0fcbf81c8f8',
     32            'pretty_version' => '2.0.4',
     33            'version' => '2.0.4.0',
     34            'reference' => 'f9c436286ab2892c7db7be8c8da4ef61ccf7b455',
    3535            'type' => 'library',
    3636            'install_path' => __DIR__ . '/../guzzlehttp/promises',
     
    120120        ),
    121121        'webimpian/bayarcash-php-sdk' => array(
    122             'pretty_version' => '1.2.3',
    123             'version' => '1.2.3.0',
    124             'reference' => '3a7ef088024c6c894445e3bcdba7b4bccff1b769',
     122            'pretty_version' => '1.2.4',
     123            'version' => '1.2.4.0',
     124            'reference' => '8664f695c53d3ba8c8ede8c916334392e047f3b3',
    125125            'type' => 'sdk',
    126126            'install_path' => __DIR__ . '/../webimpian/bayarcash-php-sdk',
  • bayarcash-wc/trunk/includes/vendor/guzzlehttp/promises/CHANGELOG.md

    r3139455 r3185027  
    11# CHANGELOG
     2
     3
     4## 2.0.4 - 2024-10-17
     5
     6### Fixed
     7
     8- Once settled, don't allow further rejection of additional promises
    29
    310
  • bayarcash-wc/trunk/includes/vendor/guzzlehttp/promises/src/Utils.php

    r3139455 r3185027  
    145145            },
    146146            function ($reason, $idx, Promise $aggregate): void {
    147                 $aggregate->reject($reason);
     147                if (Is::pending($aggregate)) {
     148                    $aggregate->reject($reason);
     149                }
    148150            }
    149151        )->then(function () use (&$results) {
  • bayarcash-wc/trunk/includes/vendor/webimpian/bayarcash-php-sdk/composer.json

    r3165859 r3185027  
    22    "name": "webimpian/bayarcash-php-sdk",
    33    "description": "Bayarcash payment gateway PHP Sdk.",
    4     "version": "1.2.3",
     4    "version": "1.2.4",
    55    "type": "sdk",
    66    "require": {
  • bayarcash-wc/trunk/includes/vendor/webimpian/bayarcash-php-sdk/src/Bayarcash.php

    r3165859 r3185027  
    2828    const QRISOB = 9;
    2929    const QRISWALLET = 10;
     30
     31    const NETS = 11;
    3032
    3133    /**
  • bayarcash-wc/trunk/readme.txt

    r3169110 r3185027  
    33Tags: FPX, DuitNow, Direct Debit, DuitNow QR
    44Requires at least: 5.6
    5 Tested up to: 6.6.1
     5Tested up to: 6.7
    66Requires PHP: 7.4
    7 Stable tag: 4.2.5
     7Stable tag: 4.2.6
    88License: GPLv3
    99License URI: https://www.gnu.org/licenses/gpl-3.0.txt
     
    8383
    8484== Changelog ==
     85
     86= 4.2.6 =
     87* New payment option: NETS Singapore for seamless transactions
     88* Added customizable logo size settings for each payment method
     89* Added customizable fee name for payment processing charges
    8590
    8691= 4.2.5 =
Note: See TracChangeset for help on using the changeset viewer.