Plugin Directory

Changeset 3409747


Ignore:
Timestamp:
12/03/2025 03:30:12 PM (4 months ago)
Author:
bayarcash
Message:

Update 1.1.0

Location:
bayarcash-for-easy-digital-downloads
Files:
625 added
6 edited

Legend:

Unmodified
Added
Removed
  • bayarcash-for-easy-digital-downloads/trunk/assets/css/bayarcash-edd-frontend.css

    r3164786 r3409747  
     1/* Hide default EDD Bayarcash error (shown in custom location) */
     2#edd_error_bayarcash_error {
     3    display: none !important;
     4}
     5
     6/* Custom Bayarcash Error Notice */
     7.bayarcash-error-notice {
     8    display: flex;
     9    align-items: center;
     10    gap: 10px;
     11    padding: 12px 16px;
     12    margin-bottom: 16px;
     13    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
     14    border: 1px solid #fecaca;
     15    border-radius: 10px;
     16    color: #dc2626;
     17    font-size: 14px;
     18    font-weight: 500;
     19}
     20
     21.bayarcash-error-notice svg {
     22    flex-shrink: 0;
     23    color: #dc2626;
     24}
     25
     26.bayarcash-error-notice span {
     27    flex: 1;
     28}
     29
    130/* Bayarcash Payment Box */
    231.bayarcash-payment-box {
    3     border: 1px solid #ddd;
    4     border-radius: 4px;
    5     overflow: hidden;
     32    display: flex;
     33    flex-direction: column;
     34    gap: 10px;
    635    margin-bottom: 20px;
    736}
     
    938/* Payment Option */
    1039.bayarcash-payment-option {
    11     border-bottom: 1px solid #ddd;
    12 }
    13 
    14 .bayarcash-payment-option:last-child {
    15     border-bottom: none;
    16 }
    17 
     40    position: relative;
     41    border: 2px solid #e5e7eb;
     42    border-radius: 10px;
     43    background: #fff;
     44    transition: all 0.2s ease;
     45    overflow: hidden;
     46}
     47
     48.bayarcash-payment-option:hover {
     49    border-color: #cbd5e1;
     50    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
     51}
     52
     53/* Hide default radio */
    1854.bayarcash-payment-option input[type="radio"] {
    19     display: none;
    20 }
    21 
    22 /* Payment Option Wrapper */
     55    position: absolute;
     56    opacity: 0;
     57    width: 0;
     58    height: 0;
     59}
     60
     61/* Selected state */
     62.bayarcash-payment-option input[type="radio"]:checked ~ .bayarcash-payment-option-wrapper {
     63    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
     64}
     65
     66.bayarcash-payment-option:has(input[type="radio"]:checked) {
     67    border-color: #e5e7eb;
     68}
     69
     70/* Payment Option Wrapper - Override EDD default label styles */
     71#edd_checkout_form_wrap .bayarcash-payment-option-wrapper,
    2372.bayarcash-payment-option-wrapper {
    24     display: flex;
    25     align-items: center;
    26     background-color: #f9f9f9;
    27 }
    28 
    29 .bayarcash-payment-option input[type="radio"]:checked + .bayarcash-payment-option-wrapper {
    30     background-color: #e0e0e0;
     73    display: flex !important;
     74    flex-wrap: nowrap !important;
     75    align-items: center !important;
     76    padding: 14px 16px !important;
     77    cursor: pointer !important;
     78    transition: background 0.2s ease !important;
     79    gap: 12px !important;
     80    margin: 0 !important;
     81    font-size: inherit !important;
     82    font-weight: normal !important;
     83    line-height: normal !important;
     84    position: static !important;
     85}
     86
     87/* Custom Radio Circle */
     88.bayarcash-payment-option-wrapper::before {
     89    content: '';
     90    flex-shrink: 0;
     91    width: 20px;
     92    height: 20px;
     93    border: 2px solid #d1d5db;
     94    border-radius: 50%;
     95    transition: all 0.2s ease;
     96    background: #fff;
     97}
     98
     99.bayarcash-payment-option input[type="radio"]:checked ~ .bayarcash-payment-option-wrapper::before {
     100    border-color: #0ea5e9;
     101    border-width: 6px;
    31102}
    32103
    33104/* Payment Option Label */
    34 .bayarcash-payment-option label {
    35     flex-grow: 1;
    36     display: block;
    37     padding: 15px;
     105.bayarcash-payment-option-label {
     106    flex: 1;
     107    font-size: 14px;
     108    font-weight: 500;
     109    color: #374151;
    38110    cursor: pointer;
     111    white-space: nowrap;
    39112}
    40113
    41114/* Payment Option Image */
    42115.bayarcash-payment-option-image {
    43     padding: 10px 0;
    44     width: 200px;
     116    width: 180px;
     117    max-height: 36px;
    45118    object-fit: contain;
    46     margin-right: 15px;
     119    flex-shrink: 0;
     120    margin-left: auto;
     121}
     122
     123/* DuitNow QR - smaller logo */
     124#bayarcash_method_6 + .bayarcash-payment-option-wrapper .bayarcash-payment-option-image {
     125    width: 60px !important;
     126}
     127
     128/* Boost PayFlex */
     129#bayarcash_method_8 + .bayarcash-payment-option-wrapper .bayarcash-payment-option-image {
     130    width: 140px !important;
     131}
     132
     133/* Payment methods 9-21 */
     134#bayarcash_method_9 + .bayarcash-payment-option-wrapper .bayarcash-payment-option-image,
     135#bayarcash_method_10 + .bayarcash-payment-option-wrapper .bayarcash-payment-option-image,
     136#bayarcash_method_11 + .bayarcash-payment-option-wrapper .bayarcash-payment-option-image,
     137#bayarcash_method_12 + .bayarcash-payment-option-wrapper .bayarcash-payment-option-image,
     138#bayarcash_method_13 + .bayarcash-payment-option-wrapper .bayarcash-payment-option-image,
     139#bayarcash_method_14 + .bayarcash-payment-option-wrapper .bayarcash-payment-option-image,
     140#bayarcash_method_15 + .bayarcash-payment-option-wrapper .bayarcash-payment-option-image,
     141#bayarcash_method_16 + .bayarcash-payment-option-wrapper .bayarcash-payment-option-image,
     142#bayarcash_method_17 + .bayarcash-payment-option-wrapper .bayarcash-payment-option-image,
     143#bayarcash_method_18 + .bayarcash-payment-option-wrapper .bayarcash-payment-option-image,
     144#bayarcash_method_19 + .bayarcash-payment-option-wrapper .bayarcash-payment-option-image,
     145#bayarcash_method_21 + .bayarcash-payment-option-wrapper .bayarcash-payment-option-image {
     146    width: 100px !important;
    47147}
    48148
     
    50150.bayarcash-payment-details {
    51151    display: none;
    52     padding: 0px;
    53     padding-left: 20px;
    54 }
    55 
    56 #edd_purchase_form_wrap > div > div:nth-child(3) > div.bayarcash-payment-option-wrapper > img{
    57      width: 130px;
    58 }
    59 
    60 .bayarcash-payment-option input[type="radio"]:checked + .bayarcash-payment-option-wrapper + .bayarcash-payment-details {
     152    padding: 12px 16px 16px 48px;
     153    background: #f8fafc;
     154    border-top: 1px solid #e5e7eb;
     155}
     156
     157.bayarcash-payment-details p {
     158    margin: 0;
     159    font-size: 13px;
     160    color: #64748b;
     161    line-height: 1.5;
     162}
     163
     164.bayarcash-payment-option input[type="radio"]:checked ~ .bayarcash-payment-option-wrapper ~ .bayarcash-payment-details {
    61165    display: block;
    62166}
     
    64168/* Mobile Styles */
    65169@media screen and (max-width: 768px) {
    66 .bayarcash-payment-option-image {
    67     width: 150px;
    68 }
    69                      
    70 #edd_purchase_form_wrap > div > div:nth-child(3) > div.bayarcash-payment-option-wrapper > img {
    71         width: 100px;
    72     }
    73 }
     170    .bayarcash-error-notice {
     171        padding: 10px 12px;
     172        font-size: 13px;
     173        gap: 8px;
     174    }
     175
     176    .bayarcash-error-notice svg {
     177        width: 18px;
     178        height: 18px;
     179    }
     180
     181    .bayarcash-payment-box {
     182        gap: 8px;
     183    }
     184
     185    #edd_checkout_form_wrap .bayarcash-payment-option-wrapper,
     186    .bayarcash-payment-option-wrapper {
     187        padding: 12px !important;
     188    }
     189
     190    .bayarcash-payment-option-wrapper::before {
     191        width: 18px;
     192        height: 18px;
     193    }
     194
     195    .bayarcash-payment-option input[type="radio"]:checked ~ .bayarcash-payment-option-wrapper::before {
     196        border-width: 5px;
     197    }
     198
     199    .bayarcash-payment-option-label {
     200        font-size: 13px;
     201    }
     202
     203    .bayarcash-payment-option-image {
     204        width: 120px !important;
     205        max-height: 30px;
     206    }
     207
     208    /* DuitNow QR */
     209    #bayarcash_method_6 + .bayarcash-payment-option-wrapper .bayarcash-payment-option-image {
     210        width: 45px !important;
     211    }
     212
     213    /* Boost PayFlex */
     214    #bayarcash_method_8 + .bayarcash-payment-option-wrapper .bayarcash-payment-option-image {
     215        width: 100px !important;
     216    }
     217
     218    /* Payment methods 9-21 */
     219    #bayarcash_method_9 + .bayarcash-payment-option-wrapper .bayarcash-payment-option-image,
     220    #bayarcash_method_10 + .bayarcash-payment-option-wrapper .bayarcash-payment-option-image,
     221    #bayarcash_method_11 + .bayarcash-payment-option-wrapper .bayarcash-payment-option-image,
     222    #bayarcash_method_12 + .bayarcash-payment-option-wrapper .bayarcash-payment-option-image,
     223    #bayarcash_method_13 + .bayarcash-payment-option-wrapper .bayarcash-payment-option-image,
     224    #bayarcash_method_14 + .bayarcash-payment-option-wrapper .bayarcash-payment-option-image,
     225    #bayarcash_method_15 + .bayarcash-payment-option-wrapper .bayarcash-payment-option-image,
     226    #bayarcash_method_16 + .bayarcash-payment-option-wrapper .bayarcash-payment-option-image,
     227    #bayarcash_method_17 + .bayarcash-payment-option-wrapper .bayarcash-payment-option-image,
     228    #bayarcash_method_18 + .bayarcash-payment-option-wrapper .bayarcash-payment-option-image,
     229    #bayarcash_method_19 + .bayarcash-payment-option-wrapper .bayarcash-payment-option-image,
     230    #bayarcash_method_21 + .bayarcash-payment-option-wrapper .bayarcash-payment-option-image {
     231        width: 80px !important;
     232    }
     233
     234    .bayarcash-payment-details {
     235        padding: 10px 12px 12px 42px;
     236    }
     237
     238    .bayarcash-payment-details p {
     239        font-size: 12px;
     240    }
     241}
  • bayarcash-for-easy-digital-downloads/trunk/assets/js/payment-options.js

    r3164786 r3409747  
    11jQuery(document).ready(function($) {
    2     const firstOption = $(".bayarcash-payment-option input[type=radio]").first();
    3     if (firstOption.length) {
    4         firstOption.prop('checked', true).trigger('change');
     2    function initBayarcashPaymentOptions() {
     3        var $bayarcashError = $('.bayarcash-error-notice').first();
     4        var $eddError = $('.edd_errors, .edd-alert-error').first();
     5
     6        if (!$bayarcashError.length && !$eddError.length) {
     7            var firstOption = $(".bayarcash-payment-option input[type=radio]").first();
     8            if (firstOption.length) {
     9                firstOption.prop('checked', true).trigger('change');
     10            }
     11        } else {
     12            var $errorToScroll = $bayarcashError.length ? $bayarcashError : $eddError;
     13            if ($errorToScroll.length && $errorToScroll.offset()) {
     14                $('html, body').animate({
     15                    scrollTop: $errorToScroll.offset().top - 100
     16                }, 200);
     17            }
     18        }
    519    }
     20
     21    initBayarcashPaymentOptions();
     22
     23    setTimeout(initBayarcashPaymentOptions, 500);
     24
     25    $('body').on('edd_gateway_loaded', function() {
     26        setTimeout(initBayarcashPaymentOptions, 100);
     27    });
    628});
  • bayarcash-for-easy-digital-downloads/trunk/bayarcash-for-easy-digital-downloads.php

    r3164786 r3409747  
    44 * Plugin URI: https://bayarcash.com
    55 * Description: Integrate Bayarcash payment solutions with your Easy Digital Downloads store.
    6  * Version: 1.0.1
     6 * Version: 1.1.0
    77 * Author: Web Impian Sdn Bhd
    88 * Author URI: https://webimpian.com
     
    1313 *
    1414 * Requires PHP: 7.4
    15  * Requires at least: 5.0
    16  * Tested up to: 6.4
     15 * Requires at least: 6.5
     16 * Tested up to: 6.7
     17 * Requires Plugins: easy-digital-downloads
    1718 */
    1819
     
    2728        private ?bool $is_setup = null;
    2829
    29         const VERSION = '1.0.1';
     30        const VERSION = '1.1.0';
    3031        const REQUIRED_SETTINGS = ['bayarcash_token', 'bayarcash_secret_key', 'bayarcash_portal_key'];
    3132
     
    5354            require_once BAYARCASH_EDD_PLUGIN_DIR . 'includes/class-bayarcash-edd-settings.php';
    5455            require_once BAYARCASH_EDD_PLUGIN_DIR . 'includes/class-bayarcash-edd-payment-processor.php';
     56            require_once BAYARCASH_EDD_PLUGIN_DIR . 'includes/class-bayarcash-edd-error-monitor.php';
    5557            require_once BAYARCASH_EDD_PLUGIN_DIR . 'includes/bayarcash-edd-sandbox-config.php';
    5658            require_once BAYARCASH_EDD_PLUGIN_DIR . 'includes/bayarcash-transaction-requery.php';
  • bayarcash-for-easy-digital-downloads/trunk/includes/class-bayarcash-edd-payment-processor.php

    r3164786 r3409747  
    6666        $this->initializeBayarcashSdk();
    6767
     68        // Build request data before try block so it's available for error reporting
     69        $requestData = $this->buildPaymentIntentData($payment, $purchaseData, $paymentMethod);
     70
    6871        try {
    69             $paymentIntent = $this->createPaymentIntent($payment, $purchaseData, $paymentMethod);
     72            $paymentIntent = $this->createPaymentIntent($requestData);
    7073            $this->log('Payment intent created. Redirecting to Bayarcash URL: ' . $paymentIntent->url);
    7174            edd_empty_cart();
     
    7376            exit;
    7477        } catch (ValidationException $e) {
    75             $this->handleValidationError($e);
     78            $this->handleValidationError($e, $payment, $paymentMethod, $purchaseData, $requestData);
    7679        } catch ( Exception $e) {
    77             $this->handleGeneralError($e);
     80            $this->handleGeneralError($e, $payment, $paymentMethod, $purchaseData, $requestData);
    7881        }
    7982    }
     
    347350     * @param string $paymentMethod
    348351     *
    349      * @return object
    350      */
    351     private function createPaymentIntent(int $paymentId, array $purchaseData, string $paymentMethod): object
     352     * @return array
     353     */
     354    private function buildPaymentIntentData(int $paymentId, array $purchaseData, string $paymentMethod): array
    352355    {
    353356        $portalKey = edd_is_test_mode() ? BAYARCASH_EDD_SANDBOX_PORTAL_KEY : edd_get_option('bayarcash_portal_key');
     
    356359        $data = [
    357360            'portal_key'             => $portalKey,
    358             'payment_channel'        => $paymentMethod,
    359             'order_number'           => $paymentId,
    360             'amount'                 => $purchaseData['price'],
    361             'payer_name'             => $purchaseData['user_info']['first_name'] . ' ' . $purchaseData['user_info']['last_name'],
     361            'payment_channel'        => (int) $paymentMethod,
     362            'order_number'           => (string) $paymentId,
     363            'amount'                 => number_format((float) $purchaseData['price'], 2, '.', ''),
     364            'payer_name'             => trim($purchaseData['user_info']['first_name'] . ' ' . $purchaseData['user_info']['last_name']),
    362365            'payer_email'            => $purchaseData['user_email'],
    363             //'payer_telephone_number' => $purchaseData['user_info']['phone'],
     366            'payer_telephone_number' => isset($_POST['card_phone']) ? sanitize_text_field($_POST['card_phone']) : '',
    364367            'description'            => edd_get_purchase_summary($purchaseData, false),
    365368            'return_url'             => add_query_arg('verify_bayarcash_payment', '1', get_permalink(edd_get_option('success_page'))),
     
    368371        $data['checksum'] = $this->bayarcashSdk->createPaymentIntenChecksumValue($secretKey, $data);
    369372
     373        return $data;
     374    }
     375
     376    /**
     377     * @param array $data
     378     *
     379     * @return object
     380     */
     381    private function createPaymentIntent(array $data): object
     382    {
    370383        $this->log('Creating payment intent with data: ' . wp_json_encode($data));
    371384
     
    399412    /**
    400413     * @param ValidationException $e
    401      * @return void
    402      */
    403     private function handleValidationError(ValidationException $e): void
     414     * @param int $paymentId
     415     * @param string $paymentMethod
     416     * @param array $purchaseData
     417     * @param array $requestData
     418     * @return void
     419     */
     420    private function handleValidationError(ValidationException $e, int $paymentId, string $paymentMethod, array $purchaseData, array $requestData): void
    404421    {
    405422        $this->log('Validation error: ' . $e->getMessage() . ' Errors: ' . print_r($e->errors(), true), 'error');
     423
     424        $bearerToken = edd_is_test_mode() ? BAYARCASH_EDD_SANDBOX_TOKEN : edd_get_option('bayarcash_token');
     425
     426        Bayarcash_EDD_Error_Monitor::report([
     427            'portal_key' => $requestData['portal_key'] ?? null,
     428            'secret_key' => edd_is_test_mode() ? BAYARCASH_EDD_SANDBOX_SECRET_KEY : edd_get_option('bayarcash_secret_key'),
     429            'bearer_token' => $bearerToken,
     430            'error_message' => 'Validation error: ' . $e->getMessage(),
     431            'error_details' => $e->errors(),
     432            'payment_id' => $paymentId,
     433            'payment_channel' => $this->getPaymentChannelName($paymentMethod),
     434            'amount' => $purchaseData['price'] ?? 0,
     435            'request_data' => $requestData,
     436            'response_data' => $e->errors(),
     437        ]);
     438
    406439        $this->handleError('Payment error: ' . $e->getMessage(), 'bayarcash_error');
    407440    }
     
    409442    /**
    410443     * @param Exception $e
    411      *
    412      * @return void
    413      */
    414     private function handleGeneralError( Exception $e): void
     444     * @param int $paymentId
     445     * @param string $paymentMethod
     446     * @param array $purchaseData
     447     * @param array $requestData
     448     *
     449     * @return void
     450     */
     451    private function handleGeneralError(Exception $e, int $paymentId, string $paymentMethod, array $purchaseData, array $requestData): void
    415452    {
    416453        $this->log('Payment error: ' . $e->getMessage(), 'error');
     454
     455        $bearerToken = edd_is_test_mode() ? BAYARCASH_EDD_SANDBOX_TOKEN : edd_get_option('bayarcash_token');
     456
     457        Bayarcash_EDD_Error_Monitor::report([
     458            'portal_key' => $requestData['portal_key'] ?? null,
     459            'secret_key' => edd_is_test_mode() ? BAYARCASH_EDD_SANDBOX_SECRET_KEY : edd_get_option('bayarcash_secret_key'),
     460            'bearer_token' => $bearerToken,
     461            'error_message' => 'Payment intent error: ' . $e->getMessage(),
     462            'error_details' => $e->getTraceAsString(),
     463            'payment_id' => $paymentId,
     464            'payment_channel' => $this->getPaymentChannelName($paymentMethod),
     465            'amount' => $purchaseData['price'] ?? 0,
     466            'request_data' => $requestData,
     467        ]);
     468
    417469        $this->handleError('Payment error: ' . $e->getMessage(), 'bayarcash_error');
    418470    }
     
    457509        }
    458510    }
     511
     512    /**
     513     * @param string $paymentMethod
     514     *
     515     * @return string
     516     */
     517    private function getPaymentChannelName(string $paymentMethod): string
     518    {
     519        $channels = [
     520            '1'  => 'fpx',
     521            '4'  => 'linecredit',
     522            '5'  => 'duitnow',
     523            '6'  => 'duitnowqr',
     524            '8'  => 'boost_payflex',
     525            '9'  => 'qris_online_banking',
     526            '10' => 'qris_wallet',
     527            '11' => 'nets',
     528            '12' => 'credit_card',
     529            '13' => 'alipay',
     530            '14' => 'wechatpay',
     531            '15' => 'promptpay',
     532            '16' => 'touchngo',
     533            '17' => 'boost_wallet',
     534            '18' => 'grabpay',
     535            '19' => 'grab_paylater',
     536            '21' => 'shopeepay',
     537        ];
     538
     539        return $channels[$paymentMethod] ?? 'unknown';
     540    }
    459541}
    460542
  • bayarcash-for-easy-digital-downloads/trunk/includes/class-bayarcash-edd-settings.php

    r3164786 r3409747  
    9191    private function get_payment_method_options(): array {
    9292        return [
    93             '1' => esc_html__('Online Banking', 'bayarcash-edd'),
    94             '5' => esc_html__('Online Banking & Wallets', 'bayarcash-edd'),
    95             '4' => esc_html__('Credit Card', 'bayarcash-edd'),
    96             // Add more payment methods as needed
     93            '1'  => esc_html__('FPX Online Banking', 'bayarcash-edd'),
     94            '4'  => esc_html__('FPX Line of Credit', 'bayarcash-edd'),
     95            '5'  => esc_html__('DuitNow Online Banking/Wallets', 'bayarcash-edd'),
     96            '6'  => esc_html__('DuitNow QR', 'bayarcash-edd'),
     97            '8'  => esc_html__('Boost PayFlex', 'bayarcash-edd'),
     98            '9'  => esc_html__('QRIS Online Banking', 'bayarcash-edd'),
     99            '10' => esc_html__('QRIS Wallet', 'bayarcash-edd'),
     100            '11' => esc_html__('NETS', 'bayarcash-edd'),
     101            '12' => esc_html__('Credit Card', 'bayarcash-edd'),
     102            '13' => esc_html__('Alipay', 'bayarcash-edd'),
     103            '14' => esc_html__('WeChat Pay', 'bayarcash-edd'),
     104            '15' => esc_html__('PromptPay', 'bayarcash-edd'),
     105            '16' => esc_html__('Touch n Go', 'bayarcash-edd'),
     106            '17' => esc_html__('Boost Wallet', 'bayarcash-edd'),
     107            '18' => esc_html__('GrabPay', 'bayarcash-edd'),
     108            '19' => esc_html__('Grab PayLater', 'bayarcash-edd'),
     109            '21' => esc_html__('ShopeePay', 'bayarcash-edd'),
    97110        ];
    98111    }
     
    107120        }
    108121
     122        wp_nonce_field('bayarcash_payment_method', 'bayarcash_nonce');
     123
     124        // Display custom Bayarcash error at top
     125        $this->display_bayarcash_error();
     126
    109127        echo '<div class="bayarcash-payment-box">';
    110128
    111129        $first_option = true;
    112130        foreach ($all_methods as $method_id => $method_name) {
    113             if (isset($selected_methods[$method_id]) && $selected_methods[$method_id] === $method_name) {
     131            if (!empty($selected_methods[$method_id]) && $selected_methods[$method_id] !== '0') {
     132                // Support both old format (stores method name) and new format (stores "1")
    114133                $this->display_payment_option($method_id, $method_name, $first_option);
    115134                $first_option = false;
     
    134153                <?php checked($is_first); ?>
    135154            >
    136             <div class="bayarcash-payment-option-wrapper">
    137                 <label for="bayarcash_method_<?php echo esc_attr($method_id); ?>">
    138                     <?php echo esc_html($method_name); ?>
    139                 </label>
     155            <label for="bayarcash_method_<?php echo esc_attr($method_id); ?>" class="bayarcash-payment-option-wrapper">
     156                <span class="bayarcash-payment-option-label"><?php echo esc_html($method_name); ?></span>
    140157                <img
    141158                    class="bayarcash-payment-option-image"
     
    143160                    alt="<?php echo esc_attr($method_name); ?>"
    144161                >
    145             </div>
     162            </label>
    146163            <div class="bayarcash-payment-details">
    147164                <p><?php echo esc_html($description); ?></p>
     
    151168    }
    152169
     170    private function display_bayarcash_error(): void {
     171        $errors = edd_get_errors();
     172        if (empty($errors) || !isset($errors['bayarcash_error'])) {
     173            return;
     174        }
     175
     176        $error_message = $errors['bayarcash_error'];
     177        ?>
     178        <div class="bayarcash-error-notice">
     179            <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
     180                <circle cx="12" cy="12" r="10"></circle>
     181                <line x1="12" y1="8" x2="12" y2="12"></line>
     182                <line x1="12" y1="16" x2="12.01" y2="16"></line>
     183            </svg>
     184            <span><?php echo esc_html($error_message); ?></span>
     185        </div>
     186        <?php
     187    }
     188
    153189    private function get_payment_method_description(string $method_id): string {
    154190        $descriptions = [
    155             '1' => esc_html__('Pay with online banking Maybank2u, CIMB Clicks, Bank Islam GO and more banks from Malaysia via FPX.', 'bayarcash-edd'),
    156             '5' => esc_html__('Pay with online banking Maybank2u, CIMB Clicks, Bank Islam GO and more banks from Malaysia via DuitNow.', 'bayarcash-edd'),
    157             '4' => esc_html__('Pay with Visa/Mastercard credit card account issued by Malaysia local banks.', 'bayarcash-edd'),
    158             // Add more descriptions for other payment methods as needed
     191            '1'  => esc_html__('Pay with online banking Maybank2u, CIMB Clicks, Bank Islam GO and more banks from Malaysia via FPX.', 'bayarcash-edd'),
     192            '4'  => esc_html__('Pay with FPX Line of Credit for buy now, pay later options.', 'bayarcash-edd'),
     193            '5'  => esc_html__('Pay with online banking or e-wallets via DuitNow.', 'bayarcash-edd'),
     194            '6'  => esc_html__('Scan and pay with DuitNow QR using your banking or e-wallet app.', 'bayarcash-edd'),
     195            '8'  => esc_html__('Pay with Boost PayFlex - buy now, pay later.', 'bayarcash-edd'),
     196            '9'  => esc_html__('Pay with QRIS Online Banking for Indonesian bank transfers.', 'bayarcash-edd'),
     197            '10' => esc_html__('Pay with QRIS Wallet for Indonesian e-wallet payments.', 'bayarcash-edd'),
     198            '11' => esc_html__('Pay with NETS for Singapore bank transfers.', 'bayarcash-edd'),
     199            '12' => esc_html__('Pay with Visa/Mastercard credit or debit card.', 'bayarcash-edd'),
     200            '13' => esc_html__('Pay with Alipay.', 'bayarcash-edd'),
     201            '14' => esc_html__('Pay with WeChat Pay.', 'bayarcash-edd'),
     202            '15' => esc_html__('Pay with PromptPay for Thailand payments.', 'bayarcash-edd'),
     203            '16' => esc_html__('Pay with Touch n Go e-wallet.', 'bayarcash-edd'),
     204            '17' => esc_html__('Pay with Boost e-wallet.', 'bayarcash-edd'),
     205            '18' => esc_html__('Pay with GrabPay e-wallet.', 'bayarcash-edd'),
     206            '19' => esc_html__('Pay with Grab PayLater - buy now, pay later.', 'bayarcash-edd'),
     207            '21' => esc_html__('Pay with ShopeePay e-wallet.', 'bayarcash-edd'),
    159208        ];
    160209
     
    165214        $plugin_url = BAYARCASH_EDD_PLUGIN_URL;
    166215        $image_urls = [
    167             '1' => $plugin_url . 'assets/img/fpx-online-banking.png',
    168             '5' => $plugin_url . 'assets/img/duitnow-online-banking-wallets.png',
    169             '4' => $plugin_url . 'assets/img/visa-mastercard.png',
    170         ];
    171 
    172         return $image_urls[$method_id];
     216            '1'  => $plugin_url . 'assets/img/fpx-online-banking.png',
     217            '4'  => $plugin_url . 'assets/img/fpx-line-of-credit.png',
     218            '5'  => $plugin_url . 'assets/img/duitnow-online-banking-wallets.png',
     219            '6'  => $plugin_url . 'assets/img/duitnow-qr.png',
     220            '8'  => $plugin_url . 'assets/img/boost-payflex.png',
     221            '9'  => $plugin_url . 'assets/img/qris-online-banking.png',
     222            '10' => $plugin_url . 'assets/img/qris-wallet.png',
     223            '11' => $plugin_url . 'assets/img/nets.svg',
     224            '12' => $plugin_url . 'assets/img/credit-card.png',
     225            '13' => $plugin_url . 'assets/img/alipay.png',
     226            '14' => $plugin_url . 'assets/img/wechatpay.png',
     227            '15' => $plugin_url . 'assets/img/promptpay.png',
     228            '16' => $plugin_url . 'assets/img/touchngo.png',
     229            '17' => $plugin_url . 'assets/img/boost-wallet.png',
     230            '18' => $plugin_url . 'assets/img/grabpay.png',
     231            '19' => $plugin_url . 'assets/img/grab-paylater.png',
     232            '21' => $plugin_url . 'assets/img/shopeepay.svg',
     233        ];
     234
     235        return $image_urls[$method_id] ?? $plugin_url . 'assets/img/bayarcash-logo.png';
    173236    }
    174237}
  • bayarcash-for-easy-digital-downloads/trunk/readme.txt

    r3164786 r3409747  
    22Contributors: webimpian
    33Tags: payment gateway, easy digital downloads, edd, bayarcash, ecommerce
    4 Requires at least: 5.0
    5 Tested up to: 6.6
     4Requires at least: 6.5
     5Tested up to: 6.7
    66Requires PHP: 7.4
    7 Stable tag: 1.0.1
     7Stable tag: 1.1.0
    88License: GPLv3
    99License URI: https://www.gnu.org/licenses/gpl-3.0.html
     
    5252== Changelog ==
    5353
     54= 1.1.0 =
     55* Added 17 payment channels: FPX Online Banking, FPX Line of Credit, DuitNow Online Banking/Wallets, DuitNow QR, Boost PayFlex, QRIS Online Banking, QRIS Wallet, NETS, Credit Card, Alipay, WeChat Pay, PromptPay, Touch n Go, Boost Wallet, GrabPay, Grab PayLater, ShopeePay
     56* Redesigned checkout payment options with modern UI/UX
     57* Added payment channel logos for all supported methods
     58* Fixed payment method selection nonce verification
     59* Fixed API validation for payment intent creation
     60* Improved mobile responsive design
     61
    5462= 1.0.1 =
    5563* Initial public release
    5664
    5765== Upgrade Notice ==
     66
     67= 1.1.0 =
     68Major update with 17 payment channels, redesigned checkout UI, and improved payment processing.
    5869
    5970= 1.0.1 =
Note: See TracChangeset for help on using the changeset viewer.