Plugin Directory

Changeset 3392430


Ignore:
Timestamp:
11/09/2025 03:22:45 PM (5 months ago)
Author:
webimpian
Message:

Fix small bug

Location:
bayarcash-wc
Files:
380 added
7 edited

Legend:

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

    r3324773 r3392430  
    1313 * Plugin Name:         Bayarcash WC
    1414 * Plugin URI:          https://bayarcash.com/
    15  * Version:             4.3.10
     15 * Version:             4.3.11
    1616 * Description:         Accept payment from Malaysia. Bayarcash support FPX, Direct Debit, DuitNow OBW & DuitNow QR payment channels.
    1717 * Author:              Web Impian
  • bayarcash-wc/trunk/includes/src/Gateway.php

    r3251431 r3392430  
    298298            $this->log('Validation error: ' . $e->getMessage(), $order);
    299299            $this->log('Validation errors: ' . print_r($e->errors(), true), $order);
     300
     301            ErrorMonitor::report([
     302                'portal_key' => $portal_key,
     303                'secret_key' => $apiSecretKey,
     304                'bearer_token' => $bearer_token,
     305                'error_message' => 'Validation error: ' . $e->getMessage(),
     306                'error_details' => print_r($e->errors(), true),
     307                'order_id' => $order_no,
     308                'payment_channel' => $this->get_payment_channel_name($payment_gateway),
     309                'amount' => $order->get_total(),
     310                'request_data' => $data,
     311                'response_data' => $e->errors(),
     312            ]);
     313
    300314            wc_add_notice('Payment error: ' . $e->getMessage(), 'error');
    301315            wp_redirect(wc_get_checkout_url());
     
    303317        } catch (\Exception $e) {
    304318            $this->log('Payment error: ' . $e->getMessage(), $order);
     319
     320            ErrorMonitor::report([
     321                'portal_key' => $portal_key,
     322                'secret_key' => $apiSecretKey,
     323                'bearer_token' => $bearer_token,
     324                'error_message' => 'Payment intent error: ' . $e->getMessage(),
     325                'error_details' => $e->getTraceAsString(),
     326                'order_id' => $order_no,
     327                'payment_channel' => $this->get_payment_channel_name($payment_gateway),
     328                'amount' => $order->get_total(),
     329                'request_data' => $data,
     330            ]);
     331
    305332            wc_add_notice('Payment error: ' . $e->getMessage(), 'error');
    306333            wp_redirect(wc_get_checkout_url());
     
    719746    }
    720747
     748    private function get_payment_channel_name($gateway_number): string {
     749        $channels = [
     750            1 => 'fpx',
     751            3 => 'directdebit',
     752            4 => 'linecredit',
     753            5 => 'duitnow',
     754            6 => 'duitnowqr',
     755            7 => 'duitnowshopee',
     756            8 => 'duitnowboost',
     757            9 => 'duitnowqris',
     758            10 => 'duitnowqriswallet',
     759            11 => 'duitnownets',
     760        ];
     761
     762        return $channels[$gateway_number] ?? 'unknown';
     763    }
     764
    721765    public function needs_setup(): bool {
    722766        return empty($this->get_option('portal_key')) || empty($this->get_option('bearer_token'));
  • bayarcash-wc/trunk/includes/src/Gateway/DirectDebitGateway.php

    r3305853 r3392430  
    327327            }
    328328
     329            ErrorMonitor::report([
     330                'portal_key' => $settings['settings']['portal_key'] ?? null,
     331                'secret_key' => $settings['settings']['api_secret_key'] ?? null,
     332                'bearer_token' => $settings['settings']['bearer_token'] ?? null,
     333                'error_message' => 'Direct Debit Validation error: ' . $error_message,
     334                'error_details' => print_r($errors, true),
     335                'order_id' => $order->get_id(),
     336                'payment_channel' => 'directdebit',
     337                'amount' => $order->get_total(),
     338                'request_data' => $args ?? null,
     339                'response_data' => $errors,
     340            ]);
     341
    329342            wc_add_notice(__('We encountered an issue while processing your Direct Debit enrollment: ', 'bayarcash-wc') . $detailed_error, 'error');
    330343            wp_redirect(wc_get_checkout_url());
     
    332345        } catch (Exception $e) {
    333346            $this->log('General Exception: ' . $e->getMessage());
     347
     348            ErrorMonitor::report([
     349                'portal_key' => $settings['settings']['portal_key'] ?? null,
     350                'secret_key' => $settings['settings']['api_secret_key'] ?? null,
     351                'bearer_token' => $settings['settings']['bearer_token'] ?? null,
     352                'error_message' => 'Direct Debit enrollment error: ' . $e->getMessage(),
     353                'error_details' => $e->getTraceAsString(),
     354                'order_id' => $order->get_id(),
     355                'payment_channel' => 'directdebit',
     356                'amount' => $order->get_total(),
     357                'request_data' => $args ?? null,
     358            ]);
    334359
    335360            if (str_contains($e->getMessage(), 'Only weekly and monthly subscriptions')) {
  • bayarcash-wc/trunk/includes/vendor/composer/autoload_classmap.php

    r3295064 r3392430  
    3636    'Bayarcash\\WooCommerce\\DynamicDuitNowGateway' => $baseDir . '/includes/src/Gateway/DynamicDuitNowGateway.php',
    3737    'Bayarcash\\WooCommerce\\DynamicFpxGateway' => $baseDir . '/includes/src/Gateway/DynamicFpxGateway.php',
     38    'Bayarcash\\WooCommerce\\ErrorMonitor' => $baseDir . '/includes/src/ErrorMonitor.php',
    3839    'Bayarcash\\WooCommerce\\FpxGateway' => $baseDir . '/includes/src/Gateway/FpxGateway.php',
    3940    'Bayarcash\\WooCommerce\\LineCreditGateway' => $baseDir . '/includes/src/Gateway/LineCreditGateway.php',
  • bayarcash-wc/trunk/includes/vendor/composer/autoload_static.php

    r3295064 r3392430  
    107107        'Bayarcash\\WooCommerce\\DynamicDuitNowGateway' => __DIR__ . '/../../..' . '/includes/src/Gateway/DynamicDuitNowGateway.php',
    108108        'Bayarcash\\WooCommerce\\DynamicFpxGateway' => __DIR__ . '/../../..' . '/includes/src/Gateway/DynamicFpxGateway.php',
     109        'Bayarcash\\WooCommerce\\ErrorMonitor' => __DIR__ . '/../../..' . '/includes/src/ErrorMonitor.php',
    109110        'Bayarcash\\WooCommerce\\FpxGateway' => __DIR__ . '/../../..' . '/includes/src/Gateway/FpxGateway.php',
    110111        'Bayarcash\\WooCommerce\\LineCreditGateway' => __DIR__ . '/../../..' . '/includes/src/Gateway/LineCreditGateway.php',
  • bayarcash-wc/trunk/includes/vendor/composer/platform_check.php

    r3139455 r3392430  
    2020        }
    2121    }
    22     trigger_error(
    23         'Composer detected issues in your platform: ' . implode(' ', $issues),
    24         E_USER_ERROR
     22    throw new \RuntimeException(
     23        'Composer detected issues in your platform: ' . implode(' ', $issues)
    2524    );
    2625}
  • bayarcash-wc/trunk/readme.txt

    r3324773 r3392430  
    55Tested up to: 6.8
    66Requires PHP: 7.4
    7 Stable tag: 4.3.10
     7Stable tag: 4.3.11
    88License: GPLv3
    99License URI: https://www.gnu.org/licenses/gpl-3.0.txt
     
    8989== Changelog ==
    9090
     91= 4.3.11 =
     92* Fixed minor bugs
    9193
    9294= 4.3.10 =
Note: See TracChangeset for help on using the changeset viewer.