Plugin Directory

Changeset 3105409


Ignore:
Timestamp:
06/20/2024 11:50:53 PM (22 months ago)
Author:
weeconnectpay
Message:

Deploying version 3.10.2 from pipeline

Location:
weeconnectpay
Files:
607 added
10 edited

Legend:

Unmodified
Added
Removed
  • weeconnectpay/trunk/README.txt

    r3095409 r3105409  
    66Author: WeeConnectPay
    77Contributors: weeconnectpay
    8 Stable Tag: 3.9.0
     8Stable Tag: 3.10.2
    99Requires at least: 5.6
    10 Tested Up To: 6.5.3
     10Tested Up To: 6.5.4
    1111Requires PHP: 7.2
    1212Text Domain: weeconnectpay
     
    1616Requires Plugins: woocommerce
    1717WC requires at least: 3.0.4
    18 WC tested up to: 8.9.1
     18WC tested up to: 9.0.1
    1919
    2020Accept payments easily and quickly with the Clover online Payment gateway by WeeConnectPay.
     
    125125
    126126== Changelog ==
     127= 3.10.0 =
     128* Added support for order fees
     129
    127130= 3.9.0 =
    128131* Added card brand as a column in the WooCommerce Orders listing page. This feature is available in both Classic and Blocks checkout. It is also available for both the HPOS and legacy data storage modes.
  • weeconnectpay/trunk/includes/WeeConnectPayAPI.php

    r2863498 r3105409  
    186186
    187187        $items          = $this->get_items_as_clover_order_items( $order );
     188        $fees           = $this->get_fees_as_clover_order_items( $order );
    188189        $tax_items      = array();
    189190        $shipping_items = $this->get_shipping_as_clover_items( $order );
    190191
     192        if ( count( $fees ) > 0 ) {
     193            $items = array_merge( $items, $fees );
     194        }
     195
    191196        if ( count( $shipping_items ) > 0 ) {
    192197            $items = array_merge( $items, $shipping_items );
    193198        }
     199
    194200
    195201        return $items;
     
    419425    public function is_matching_amounts( array $clover_order, int $amount_in_cents ): bool {
    420426        $clover_total = $this->get_clover_order_total_from_products( $clover_order );
     427
    421428        if ( $this->orders_totals_matches( $amount_in_cents, $clover_total ) ) {
    422429            return true;
     
    653660                    error_log( "WeeConnectPay: Line item and order total amounts do not match." );
    654661                    throw new WeeConnectPayException(
    655                         'Line items total and order total do not match. This is likely due to an unsupported discount or gift card plugin.',
     662                        'Line items total and order total do not match. This is likely due to an unsupported discount, gift card or fee plugin. Please contact us at support@weeconnectpay.com to help us resolve this.',
    656663                        ExceptionCode::ORDER_LINE_ITEM_TOTAL_MISMATCH);
    657664                }
     
    689696        }
    690697    }
     698
     699    private function get_fees_as_clover_order_items(WC_Order $order): array
     700    {
     701        $fees = $order->get_fees();
     702        $feeArr = [];
     703
     704        foreach ($fees as $fee) {
     705
     706            $amount = WeeConnectPayHelper::safe_amount_to_cents_int($fee->get_total());
     707
     708            // If the fee is set as taxable we'll include the price in the line item
     709            if ($fee->get_tax_status() === 'taxable') {
     710                $amount += WeeConnectPayHelper::safe_amount_to_cents_int($fee->get_total_tax());
     711            }
     712
     713            $item = array(
     714                'type' => 'sku',
     715                'amount' => $amount,
     716                'description' => WeeConnectPayHelper::name_and_qty_as_clover_line_desc($fee->get_name(), $fee->get_quantity()),
     717                'currency' => strtolower($order->get_currency()),
     718                'quantity' => 1,
     719            );
     720
     721            $feeArr[] = $item;
     722        }
     723
     724        return $feeArr;
     725    }
    691726}
  • weeconnectpay/trunk/includes/integrations/woocommerce/WC_Gateway_Weeconnectpay.php

    r3095409 r3105409  
    526526        global $woocommerce;
    527527        try {
    528             error_log( 'Setting up gateway data for Classic Checkout' );
    529528            $script_data = array(
    530529                'pakms'  => $this->integrationSettings->getPublicAccessKey(),
     
    10311030            foreach ( $latest_refund->get_items() as $item_id => $item ) {
    10321031
    1033                 error_log('Item id => item: '. json_encode( [ [ 'item_id' => $item_id ], [ 'item' => $item ] ] ) );
     1032//                error_log('Item id => item: '. json_encode( [ [ 'item_id' => $item_id ], [ 'item' => $item ] ] ) );
    10341033                // Original order line item
    10351034                $refunded_item_id    = $item->get_meta( '_refunded_item_id' );
     
    11081107            }
    11091108
     1109            // Fees refund
     1110            /** @var WC_Order_Item_Fee $fee */
     1111            foreach ($latest_refund->get_fees() as $fee_id => $fee) {
     1112
     1113                // Get the metadata for the refunded fee item
     1114                $refunded_fee_id = $fee->get_meta('_refunded_item_id');
     1115
     1116                // Retrieve all fees from the original order
     1117                $order_fees = $order->get_fees();
     1118
     1119                // Initialize variable to hold the original fee item
     1120                $refunded_fee = null;
     1121
     1122                // Loop through the order fees to find the matching fee
     1123                foreach ($order_fees as $order_fee_id => $order_fee) {
     1124                    if ($order_fee_id == $refunded_fee_id) {
     1125                        $refunded_fee = $order_fee;
     1126                        break;
     1127                    }
     1128                }
     1129
     1130                if (!$refunded_fee) {
     1131                    // Subtotal amount must match the refund subtotal amount
     1132                    $refundErrorReasonSprintfFormat = __('Could not find the fee to refund (%s) within the original order. Please contact support@weeconnectpay.com if you are seeing this message.');
     1133                    $refundFailureReason = sprintf(
     1134                        $refundErrorReasonSprintfFormat,
     1135                        $refunded_fee->get_name()
     1136                    );
     1137
     1138                    error_log("Refund error - Could not find the fee to refund (%s) within the original order. Refunded fee ID: $refunded_fee_id | Refunded fee name: {$refunded_fee->get_name()}");
     1139                    return new WP_Error('wc-order', $undocumentedChangePrefixText . $refundFailureReason . "\n\n" . $orderWillNotBeRefundedText);
     1140                }
     1141
     1142
     1143                // Check if the absolute value of refunded quantity, total, and tax match -- Although quantity should never be used for fees, this is WordPress,
     1144                // and a fee item is a child of an item, and somebody could have the brilliant idea to change the quantity of a fee, so I'm leaving it here.
     1145                if (abs($fee->get_quantity()) != $refunded_fee->get_quantity()) {
     1146                    // Quantity must match total quantity -- This is no longer going to be relevant with Atomic Order as we will be able to split units on Clover's end and separate taxes
     1147                    $refundErrorReasonSprintfFormat = __('To refund this fee (%s), the quantity to refund (currently %s) must be the total fee quantity (%s)');
     1148                    $refundFailureReason = sprintf(
     1149                        $refundErrorReasonSprintfFormat,
     1150                        $refunded_fee->get_name(),
     1151                        abs($fee->get_quantity()),
     1152                        $refunded_fee->get_quantity()
     1153                    );
     1154
     1155                    error_log("Refund error - Partial refunds not allowed due to mismatched fee quantity. Item ID: $refunded_fee_id");
     1156                    return new WP_Error('wc-order', $undocumentedChangePrefixText . $refundFailureReason . "\n\n" . $orderWillNotBeRefundedText);
     1157
     1158                } elseif (WeeConnectPayHelper::safe_amount_to_cents_int(abs($fee->get_total())) != WeeConnectPayHelper::safe_amount_to_cents_int($refunded_fee->get_total())) {
     1159                    // Subtotal amount must match the refund subtotal amount
     1160                    $refundErrorReasonSprintfFormat = __('To refund this fee (%s), the amount before tax to refund (currently $%s) must be the fee total amount before tax ($%s)');
     1161                    $refundFailureReason = sprintf(
     1162                        $refundErrorReasonSprintfFormat,
     1163                        $refunded_fee->get_name(),
     1164                        abs($fee->get_total()),
     1165                        $refunded_fee->get_total()
     1166                    );
     1167
     1168                    error_log("Refund error - Partial refunds not allowed due to mismatched fee total. Fee ID: $refunded_fee_id ");
     1169                    return new WP_Error('wc-order', $undocumentedChangePrefixText . $refundFailureReason . "\n\n" . $orderWillNotBeRefundedText);
     1170                } elseif (WeeConnectPayHelper::safe_amount_to_cents_int(abs($fee->get_total_tax())) != WeeConnectPayHelper::safe_amount_to_cents_int($refunded_fee->get_total_tax())) {
     1171                    // Total Tax amount must match refund tax amount
     1172                    $refundErrorReasonSprintfFormat = __('To refund this fee (%s), the tax to refund (currently $%s) must be the fee total tax ($%s)');
     1173                    $refundFailureReason = sprintf(
     1174                        $refundErrorReasonSprintfFormat,
     1175                        $refunded_fee->get_name(),
     1176                        abs($fee->get_total_tax()),
     1177                        $refunded_fee->get_total_tax()
     1178                    );
     1179
     1180                    error_log("Refund error - Partial refunds not allowed due to mismatched fee tax. Item ID: $refunded_fee_id");
     1181                    return new WP_Error('wc-order', $undocumentedChangePrefixText . $refundFailureReason . "\n\n" . $orderWillNotBeRefundedText);
     1182                }
     1183
     1184
     1185                // Order Refund line fee
     1186                $line_items[] = array(
     1187                    'refunded_quantity' => $fee->get_quantity(),
     1188                    'refunded_line_total' => WeeConnectPayHelper::safe_amount_to_cents_int($fee->get_total()),
     1189                    'refunded_total_tax' => WeeConnectPayHelper::safe_amount_to_cents_int($fee->get_total_tax()),
     1190                    'order_refund_item_id' => $fee_id,
     1191                    'refunded_item' => array(
     1192                        'line_item_id' => $refunded_fee_id,
     1193                        'line_total' => WeeConnectPayHelper::safe_amount_to_cents_int($refunded_fee->get_total()),
     1194                        'line_total_tax' => WeeConnectPayHelper::safe_amount_to_cents_int($refunded_fee->get_total_tax()),
     1195                        'line_quantity' => $refunded_fee->get_quantity(),
     1196                        'line_description' => WeeConnectPayHelper::name_and_qty_as_clover_line_desc(
     1197                            $refunded_fee->get_name(),
     1198                            $refunded_fee->get_quantity()
     1199                        ),
     1200                    ),
     1201                );
     1202
     1203                // Log line fee details for successful inclusion
     1204                error_log("Refund processed - Item ID: $refunded_fee_id, Quantity: " . abs($fee->get_quantity()) . ", Line Total: " . abs($fee->get_total()) . ", Tax: " . $fee->get_total_tax());
     1205            }
    11101206
    11111207
    11121208            // Add shipping if it's part of the refund request
    1113             if ( $latest_refund->get_shipping_total() + $latest_refund->get_shipping_tax() ) {
     1209            if ( $latest_refund->get_shipping_total() + $latest_refund->get_shipping_tax() ) {
    11141210
    11151211//              $refundShippingTotal = $latest_refund->get_shipping_total();
  • weeconnectpay/trunk/includes/modules/WeeConnectPay/Integration/PaymentFields.php

    r3095409 r3105409  
    3333     */
    3434    public function localizeData( array $script_data ): PaymentFields {
    35         error_log( 'Setting up localizeData - gateway data for Classic Checkout script_data: ' . json_encode( $script_data) );
    3635
    3736        wp_localize_script( 'weeconnectpay-payment-fields', 'WeeConnectPayPaymentFieldsData', $script_data );
  • weeconnectpay/trunk/languages/weeconnectpay-fr_CA.po

    r3095409 r3105409  
    22msgstr ""
    33"Project-Id-Version: WeeConnectPay\n"
    4 "POT-Creation-Date: 2024-05-30 20:54-0400\n"
    5 "PO-Revision-Date: 2024-05-30 20:56-0400\n"
     4"POT-Creation-Date: 2024-06-20 18:16-0400\n"
     5"PO-Revision-Date: 2024-06-20 18:18-0400\n"
    66"Last-Translator: \n"
    77"Language-Team: \n"
     
    3434
    3535#: admin/WeeConnectPayAdmin.php:251
    36 #: includes/integrations/woocommerce/WC_Gateway_Weeconnectpay.php:855
    37 #: includes/integrations/woocommerce/WC_Gateway_Weeconnectpay.php:908
     36#: includes/integrations/woocommerce/WC_Gateway_Weeconnectpay.php:854
     37#: includes/integrations/woocommerce/WC_Gateway_Weeconnectpay.php:907
    3838msgid "Card Brand"
    3939msgstr "Marque de la Carte"
     
    7979msgstr "Désactiver l’intégration WeeConnectPay/WooCommerce  Clover"
    8080
    81 #: includes/WeeConnectPayAPI.php:385
     81#: includes/WeeConnectPayAPI.php:390
    8282msgid ""
    8383"A shipping address state, county or province is required for this gateway."
     
    269269msgstr "Connectez-vous en tant qu’un autre commerçant ou employé de Clover"
    270270
    271 #: includes/integrations/woocommerce/WC_Gateway_Weeconnectpay.php:581
     271#: includes/integrations/woocommerce/WC_Gateway_Weeconnectpay.php:580
    272272msgid ""
    273273"The hidden honeypot field was filled out. This field is hidden an can only be "
     
    280280"champ : "
    281281
    282 #: includes/integrations/woocommerce/WC_Gateway_Weeconnectpay.php:612
     282#: includes/integrations/woocommerce/WC_Gateway_Weeconnectpay.php:611
    283283msgid ""
    284284"<b>Google reCAPTCHA API.js (front-end/customer-facing) has encountered an "
     
    290290"Voici le message d’erreur: "
    291291
    292 #: includes/integrations/woocommerce/WC_Gateway_Weeconnectpay.php:627
     292#: includes/integrations/woocommerce/WC_Gateway_Weeconnectpay.php:626
    293293msgid "Google reCAPTCHA: "
    294294msgstr "Google reCAPTCHA: "
    295295
    296 #: includes/integrations/woocommerce/WC_Gateway_Weeconnectpay.php:628
     296#: includes/integrations/woocommerce/WC_Gateway_Weeconnectpay.php:627
    297297msgid "Google reCAPTCHA score: "
    298298msgstr "Score Google reCAPTCHA : "
    299299
    300 #: includes/integrations/woocommerce/WC_Gateway_Weeconnectpay.php:629
     300#: includes/integrations/woocommerce/WC_Gateway_Weeconnectpay.php:628
    301301msgid "Minimum human score setting: "
    302302msgstr "Paramètre de score humain minimum : "
    303303
    304 #: includes/integrations/woocommerce/WC_Gateway_Weeconnectpay.php:632
     304#: includes/integrations/woocommerce/WC_Gateway_Weeconnectpay.php:631
    305305msgid ""
    306306"According to your plugin settings for Google reCAPTCHA, the customer who paid "
     
    310310"payé la commande est probablement un être humain."
    311311
    312 #: includes/integrations/woocommerce/WC_Gateway_Weeconnectpay.php:634
     312#: includes/integrations/woocommerce/WC_Gateway_Weeconnectpay.php:633
    313313msgid ""
    314314"According to your plugin settings for Google reCAPTCHA, the customer who paid "
     
    323323"passerelle."
    324324
    325 #: includes/integrations/woocommerce/WC_Gateway_Weeconnectpay.php:654
     325#: includes/integrations/woocommerce/WC_Gateway_Weeconnectpay.php:653
    326326msgid ""
    327327"The request to Google contains was successful but is missing the score "
     
    333333"réponse complète : "
    334334
    335 #: includes/integrations/woocommerce/WC_Gateway_Weeconnectpay.php:661
     335#: includes/integrations/woocommerce/WC_Gateway_Weeconnectpay.php:660
    336336msgid ""
    337337"The request to Google reCAPTCHA triggered an exception. See exception "
     
    341341"message d’exception : "
    342342
    343 #: includes/integrations/woocommerce/WC_Gateway_Weeconnectpay.php:664
     343#: includes/integrations/woocommerce/WC_Gateway_Weeconnectpay.php:663
    344344msgid "The response from Google reCAPTCHA contains errors. See error codes: "
    345345msgstr ""
     
    347347"d’erreur : "
    348348
    349 #: includes/integrations/woocommerce/WC_Gateway_Weeconnectpay.php:667
     349#: includes/integrations/woocommerce/WC_Gateway_Weeconnectpay.php:666
    350350msgid ""
    351351"The response from Google reCAPTCHA contains unexpected errors. See the full "
     
    355355"réponse complète : "
    356356
    357 #: includes/integrations/woocommerce/WC_Gateway_Weeconnectpay.php:750
     357#: includes/integrations/woocommerce/WC_Gateway_Weeconnectpay.php:749
    358358msgid ""
    359359"ERROR: The merchant's Clover API key needs to be refreshed by the merchant to "
     
    366366"pour réactiver la passerelle de paiement."
    367367
    368 #: includes/integrations/woocommerce/WC_Gateway_Weeconnectpay.php:809
     368#: includes/integrations/woocommerce/WC_Gateway_Weeconnectpay.php:808
    369369msgid "Clover order created."
    370370msgstr "La commande Clover a été créé."
     
    375375# Used in the order notes in bold before a 13 character alphanumerical ID from Clover.
    376376# All the order notes that contain "ID" should be described the same way across the different "ID" notes in every language.
    377 #: includes/integrations/woocommerce/WC_Gateway_Weeconnectpay.php:810
     377#: includes/integrations/woocommerce/WC_Gateway_Weeconnectpay.php:809
    378378msgid "Order ID: "
    379379msgstr "ID de commande : "
    380380
    381 #: includes/integrations/woocommerce/WC_Gateway_Weeconnectpay.php:828
     381#: includes/integrations/woocommerce/WC_Gateway_Weeconnectpay.php:827
    382382msgid "No payment required: Order total is 0 or under."
    383383msgstr "Aucun paiement requis: Le total de la commande est de 0 ou moins."
    384384
    385 #: includes/integrations/woocommerce/WC_Gateway_Weeconnectpay.php:852
     385#: includes/integrations/woocommerce/WC_Gateway_Weeconnectpay.php:851
    386386msgid "Clover payment successful!"
    387387msgstr "Paiement Clover réussi!"
     
    392392# Used in the order notes in bold before a 13 character alphanumerical ID from Clover.
    393393# All the order notes that contain "ID" should be described the same way across the different "ID" notes in every language.
    394 #: includes/integrations/woocommerce/WC_Gateway_Weeconnectpay.php:853
    395 #: includes/integrations/woocommerce/WC_Gateway_Weeconnectpay.php:906
     394#: includes/integrations/woocommerce/WC_Gateway_Weeconnectpay.php:852
     395#: includes/integrations/woocommerce/WC_Gateway_Weeconnectpay.php:905
    396396msgid "Payment ID: "
    397397msgstr "ID du paiement : "
    398398
    399 #: includes/integrations/woocommerce/WC_Gateway_Weeconnectpay.php:867
     399#: includes/integrations/woocommerce/WC_Gateway_Weeconnectpay.php:866
    400400#, php-format
    401401msgid ""
     
    406406"postal de facturation « %s » sont différents."
    407407
    408 #: includes/integrations/woocommerce/WC_Gateway_Weeconnectpay.php:872
     408#: includes/integrations/woocommerce/WC_Gateway_Weeconnectpay.php:871
    409409#, php-format
    410410msgid ""
     
    416416"devraient être les mêmes."
    417417
    418 #: includes/integrations/woocommerce/WC_Gateway_Weeconnectpay.php:888
    419 #: includes/integrations/woocommerce/WC_Gateway_Weeconnectpay.php:911
    420 #: includes/integrations/woocommerce/WC_Gateway_Weeconnectpay.php:925
     418#: includes/integrations/woocommerce/WC_Gateway_Weeconnectpay.php:887
     419#: includes/integrations/woocommerce/WC_Gateway_Weeconnectpay.php:910
     420#: includes/integrations/woocommerce/WC_Gateway_Weeconnectpay.php:924
    421421msgid "Clover error message: "
    422422msgstr "Message d’erreur Clover : "
    423423
    424 #: includes/integrations/woocommerce/WC_Gateway_Weeconnectpay.php:890
     424#: includes/integrations/woocommerce/WC_Gateway_Weeconnectpay.php:889
    425425msgid ""
    426426"Please check the order in the Clover dashboard for the full payment "
     
    430430"informations de paiement complètes."
    431431
    432 #: includes/integrations/woocommerce/WC_Gateway_Weeconnectpay.php:905
    433 #: includes/integrations/woocommerce/WC_Gateway_Weeconnectpay.php:916
     432#: includes/integrations/woocommerce/WC_Gateway_Weeconnectpay.php:904
     433#: includes/integrations/woocommerce/WC_Gateway_Weeconnectpay.php:915
    434434msgid "Payment failed."
    435435msgstr "Échec de paiement."
    436436
    437 #: includes/integrations/woocommerce/WC_Gateway_Weeconnectpay.php:919
     437#: includes/integrations/woocommerce/WC_Gateway_Weeconnectpay.php:918
    438438msgid "Clover response message: "
    439439msgstr "Réponse de Clover : "
    440440
    441 #: includes/integrations/woocommerce/WC_Gateway_Weeconnectpay.php:922
     441#: includes/integrations/woocommerce/WC_Gateway_Weeconnectpay.php:921
    442442msgid "Clover error code: "
    443443msgstr "Code d’erreur Clover : "
    444444
    445 #: includes/integrations/woocommerce/WC_Gateway_Weeconnectpay.php:930
     445#: includes/integrations/woocommerce/WC_Gateway_Weeconnectpay.php:929
    446446msgid "Payment failed - Unhandled context, see response payload: "
    447447msgstr "Échec du paiement - Contexte non géré, voir la réponse Clover : "
    448448
    449 #: includes/integrations/woocommerce/WC_Gateway_Weeconnectpay.php:997
     449#: includes/integrations/woocommerce/WC_Gateway_Weeconnectpay.php:996
    450450msgid "Provided ID is not a WC Order"
    451451msgstr "L’ID fourni n’est pas une commande de WC"
    452452
    453 #: includes/integrations/woocommerce/WC_Gateway_Weeconnectpay.php:1005
     453#: includes/integrations/woocommerce/WC_Gateway_Weeconnectpay.php:1004
    454454msgid "No WC Order Refund found"
    455455msgstr "Aucun remboursement de commande WC trouvé"
    456456
    457 #: includes/integrations/woocommerce/WC_Gateway_Weeconnectpay.php:1011
     457#: includes/integrations/woocommerce/WC_Gateway_Weeconnectpay.php:1010
    458458msgid "Refund amount must be higher than 0."
    459459msgstr "Le montant du remboursement doit être supérieur à 0."
    460460
    461 #: includes/integrations/woocommerce/WC_Gateway_Weeconnectpay.php:1016
     461#: includes/integrations/woocommerce/WC_Gateway_Weeconnectpay.php:1015
    462462msgid "Last created refund is not a WC Order Refund"
    463463msgstr "Le dernier remboursement créé n’est pas un remboursement de commande WC"
    464464
    465 #: includes/integrations/woocommerce/WC_Gateway_Weeconnectpay.php:1021
    466 #: includes/integrations/woocommerce/WC_Gateway_Weeconnectpay.php:1279
     465#: includes/integrations/woocommerce/WC_Gateway_Weeconnectpay.php:1020
     466#: includes/integrations/woocommerce/WC_Gateway_Weeconnectpay.php:1375
    467467msgid "Order has been already refunded"
    468468msgstr "La commande a déjà été remboursée"
    469469
    470 #: includes/integrations/woocommerce/WC_Gateway_Weeconnectpay.php:1029
     470#: includes/integrations/woocommerce/WC_Gateway_Weeconnectpay.php:1028
    471471msgid ""
    472472"Due to an undocumented breaking change in the Clover API, we have temporarily "
     
    476476"temporairement désactivé les remboursements partiels.\n"
    477477
    478 #: includes/integrations/woocommerce/WC_Gateway_Weeconnectpay.php:1030
     478#: includes/integrations/woocommerce/WC_Gateway_Weeconnectpay.php:1029
    479479msgid ""
    480480"This request to refund will not be processed. Should you want to do a partial "
     
    485485"bord Web Clover."
    486486
    487 #: includes/integrations/woocommerce/WC_Gateway_Weeconnectpay.php:1048
     487#: includes/integrations/woocommerce/WC_Gateway_Weeconnectpay.php:1047
    488488#, php-format
    489489msgid ""
     
    494494"doit être la quantité totale de l'item (%s)"
    495495
    496 #: includes/integrations/woocommerce/WC_Gateway_Weeconnectpay.php:1060
     496#: includes/integrations/woocommerce/WC_Gateway_Weeconnectpay.php:1059
    497497#, php-format
    498498msgid ""
     
    503503"(actuellement %s $) doit être le montant total avant taxes de l'item (%s $)"
    504504
    505 #: includes/integrations/woocommerce/WC_Gateway_Weeconnectpay.php:1072
     505#: includes/integrations/woocommerce/WC_Gateway_Weeconnectpay.php:1071
    506506#, php-format
    507507msgid ""
     
    512512"être la taxe totale de l'item (%s $)"
    513513
    514 #: includes/integrations/woocommerce/WC_Gateway_Weeconnectpay.php:1137
     514#: includes/integrations/woocommerce/WC_Gateway_Weeconnectpay.php:1132
     515#, php-format
     516msgid ""
     517"Could not find the fee to refund (%s) within the original order. Please "
     518"contact support@weeconnectpay.com if you are seeing this message."
     519msgstr ""
     520
     521#: includes/integrations/woocommerce/WC_Gateway_Weeconnectpay.php:1147
     522#, php-format
     523msgid ""
     524"To refund this fee (%s), the quantity to refund (currently %s) must be the "
     525"total fee quantity (%s)"
     526msgstr ""
     527"Pour rembourser ce frais (%s), la quantité à rembourser (actuellement %s) "
     528"doit être la quantité totale du frais (%s)"
     529
     530#: includes/integrations/woocommerce/WC_Gateway_Weeconnectpay.php:1160
     531#, php-format
     532msgid ""
     533"To refund this fee (%s), the amount before tax to refund (currently $%s) must "
     534"be the fee total amount before tax ($%s)"
     535msgstr ""
     536"Pour rembourser ce frais (%s), le montant avant taxes à rembourser "
     537"(actuellement %s $) doit être le montant total avant taxes du frais (%s $)"
     538
     539#: includes/integrations/woocommerce/WC_Gateway_Weeconnectpay.php:1172
     540#, php-format
     541msgid ""
     542"To refund this fee (%s), the tax to refund (currently $%s) must be the fee "
     543"total tax ($%s)"
     544msgstr ""
     545"Pour rembourser ce frais (%s), la taxe à rembourser (actuellement %s $) doit "
     546"être la taxe totale du frais (%s $)"
     547
     548#: includes/integrations/woocommerce/WC_Gateway_Weeconnectpay.php:1233
    515549#, php-format
    516550msgid ""
     
    522556"livraison avant taxes (%s $)"
    523557
    524 #: includes/integrations/woocommerce/WC_Gateway_Weeconnectpay.php:1149
     558#: includes/integrations/woocommerce/WC_Gateway_Weeconnectpay.php:1245
    525559#, php-format
    526560msgid ""
     
    532566"(%s $)"
    533567
    534 #: includes/integrations/woocommerce/WC_Gateway_Weeconnectpay.php:1214
    535 #: includes/integrations/woocommerce/WC_Gateway_Weeconnectpay.php:1241
     568#: includes/integrations/woocommerce/WC_Gateway_Weeconnectpay.php:1310
     569#: includes/integrations/woocommerce/WC_Gateway_Weeconnectpay.php:1337
    536570msgid "Refunded: "
    537571msgstr "Remboursé : "
    538572
    539 #: includes/integrations/woocommerce/WC_Gateway_Weeconnectpay.php:1216
    540 #: includes/integrations/woocommerce/WC_Gateway_Weeconnectpay.php:1243
     573#: includes/integrations/woocommerce/WC_Gateway_Weeconnectpay.php:1312
     574#: includes/integrations/woocommerce/WC_Gateway_Weeconnectpay.php:1339
    541575#, php-format
    542576msgid "%1$s %2$s"
     
    548582# Used in the order notes in bold before a 13 character alphanumerical ID from Clover.
    549583# All the order notes that contain "ID" should be described the same way across the different "ID" notes in every language.
    550 #: includes/integrations/woocommerce/WC_Gateway_Weeconnectpay.php:1220
    551 #: includes/integrations/woocommerce/WC_Gateway_Weeconnectpay.php:1247
     584#: includes/integrations/woocommerce/WC_Gateway_Weeconnectpay.php:1316
     585#: includes/integrations/woocommerce/WC_Gateway_Weeconnectpay.php:1343
    552586msgid "Refund ID: "
    553587msgstr "ID du remboursement : "
    554588
    555 #: includes/integrations/woocommerce/WC_Gateway_Weeconnectpay.php:1221
     589#: includes/integrations/woocommerce/WC_Gateway_Weeconnectpay.php:1317
    556590msgid "Charge refunded: "
    557591msgstr "Frais remboursés : "
    558592
    559 #: includes/integrations/woocommerce/WC_Gateway_Weeconnectpay.php:1224
    560 #: includes/integrations/woocommerce/WC_Gateway_Weeconnectpay.php:1250
     593#: includes/integrations/woocommerce/WC_Gateway_Weeconnectpay.php:1320
     594#: includes/integrations/woocommerce/WC_Gateway_Weeconnectpay.php:1346
    561595msgid "Reason: "
    562596msgstr "Raison: "
     
    567601# Used in the order notes in bold before a 13 character alphanumerical ID from Clover.
    568602# All the order notes that contain "ID" should be described the same way across the different "ID" notes in every language.
    569 #: includes/integrations/woocommerce/WC_Gateway_Weeconnectpay.php:1263
     603#: includes/integrations/woocommerce/WC_Gateway_Weeconnectpay.php:1359
    570604msgid "Returned clover item ID: "
    571605msgstr "ID d’article Clover retourné : "
    572606
    573 #: includes/integrations/woocommerce/WC_Gateway_Weeconnectpay.php:1265
     607#: includes/integrations/woocommerce/WC_Gateway_Weeconnectpay.php:1361
    574608#, php-format
    575609msgid "%1$s(%2$s %3$s) - %4$s"
  • weeconnectpay/trunk/payment-fields-blocks/assets/js/frontend/blocks.asset.php

    r3095409 r3105409  
    1 <?php return array('dependencies' => array('react', 'wc-blocks-registry', 'wc-settings', 'wp-html-entities', 'wp-i18n'), 'version' => '58653f5247e0142846e6');
     1<?php return array('dependencies' => array('react', 'wc-blocks-registry', 'wc-settings', 'wp-html-entities', 'wp-i18n'), 'version' => 'fdd9461ce865bbc2d8d4');
  • weeconnectpay/trunk/payment-fields-blocks/assets/js/frontend/blocks.js

    r3095409 r3105409  
    1 !function(){"use strict";var e={20:function(e,t,r){var o=r(609),n=Symbol.for("react.element"),a=(Symbol.for("react.fragment"),Object.prototype.hasOwnProperty),s=o.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,c={key:!0,ref:!0,__self:!0,__source:!0};function i(e,t,r){var o,i={},l=null,d=null;for(o in void 0!==r&&(l=""+r),void 0!==t.key&&(l=""+t.key),void 0!==t.ref&&(d=t.ref),t)a.call(t,o)&&!c.hasOwnProperty(o)&&(i[o]=t[o]);if(e&&e.defaultProps)for(o in t=e.defaultProps)void 0===i[o]&&(i[o]=t[o]);return{$$typeof:n,type:e,key:l,ref:d,props:i,_owner:s.current}}t.jsx=i,t.jsxs=i},848:function(e,t,r){e.exports=r(20)},609:function(e){e.exports=window.React}},t={};function r(o){var n=t[o];if(void 0!==n)return n.exports;var a=t[o]={exports:{}};return e[o](a,a.exports,r),a.exports}!function(){var e,t,o,n=r(848);!function(e){e.CARD="CARD",e.CVV="CARD_CVV",e.DATE="CARD_DATE",e.NUMBER="CARD_NUMBER",e.POSTAL_CODE="CARD_POSTAL_CODE",e.STREET_ADDRESS="CARD_STREET_ADDRESS",e.PAYMENT_REQUEST_BUTTON="PAYMENT_REQUEST_BUTTON"}(e||(e={})),function(e){e.NUMBER="weeconnectpay-card-number",e.DATE="weeconnectpay-card-date",e.CVV="weeconnectpay-card-cvv",e.ZIP="weeconnectpay-card-postal-code",e.PAYMENT_REQUEST_BUTTON="weeconnectpay-payment-request-button"}(t||(t={})),function(e){e.NUMBER="weeconnectpay-card-number-errors",e.DATE="weeconnectpay-card-date-errors",e.CVV="weeconnectpay-card-cvv-errors",e.ZIP="weeconnectpay-card-postal-code-errors",e.PAYMENT_REQUEST_BUTTON="weeconnectpay-payment-request-button-errors"}(o||(o={}));var a=r(609),s=window.wc.wcSettings,c=window.wc.wcBlocksRegistry,i=window.wp.htmlEntities,l=window.wp.i18n;class d{constructor(e){this.getLocalizedCvvPlaceholderStyles=e=>{let r={};if("fr-CA"===e){const e=document.getElementById(t.CVV);e?r=e.offsetWidth>=106||0===e.offsetWidth?{whiteSpace:"pre-line",position:"relative"}:{whiteSpace:"pre-line",position:"relative",top:"-7px"}:console.warn("WeeConnectPay could not detect the CVV element during Styles creation. CVV Element placeholder may look off-center depending on your locale.")}else r={};return r},this.cloverConfig=e,this.verifyCloverSdkIsLoaded(),this.getPakmsOrFail(e.pakms),this.cloverInstance=this.createCloverInstance(e.pakms)}static getInstance(e){if(!this.instance){if(!e)throw console.error("Clover settings must be provided for initialization."),new Error("Clover settings must be provided for initialization.");this.instance=new d(e)}return this.instance}createCloverInstance(e){try{return new Clover(e)}catch(e){const t=`WeeConnectPay failed to initialize Clover instance: ${e.message}`;throw console.error(t),new Error(t)}}getCloverInstance(){return this.cloverInstance}verifyCloverSdkIsLoaded(){if("undefined"==typeof Clover)throw new Error("Clover SDK is not loaded.")}getPakmsOrFail(e){if(!e||""===e.trim()){const e="WeeConnectPay Gateway for WooCommerce Blocks cannot load the Clover iframes. Reason: Missing Clover public merchant (pakms) key, is the merchant authenticated?";throw console.error(e),new Error(e)}return e}static getWrapperId(r){switch(r){case e.NUMBER:return t.NUMBER;case e.DATE:return t.DATE;case e.CVV:return t.CVV;case e.POSTAL_CODE:return t.ZIP;case e.PAYMENT_REQUEST_BUTTON:return t.PAYMENT_REQUEST_BUTTON;default:return}}static getErrorDisplayId(t){switch(t){case e.NUMBER:return o.NUMBER;case e.DATE:return o.DATE;case e.CVV:return o.CVV;case e.POSTAL_CODE:return o.ZIP;case e.PAYMENT_REQUEST_BUTTON:return o.PAYMENT_REQUEST_BUTTON;default:return}}getDefaultStyles(){const e=this.getLocalizedCvvPlaceholderStyles(this.cloverConfig.websiteLocale);return{input:{padding:"0px",margin:"0px",height:"3.4em",width:"100%",border:"1px #C8C8C8 solid",borderRadius:"3px",textAlign:"center"},"::-webkit-input-placeholder":{textAlign:"center"},"::-moz-placeholder":{textAlign:"center"},":-ms-input-placeholder":{textAlign:"center"},":-moz-placeholder":{textAlign:"center"},"card-cvv input::-webkit-input-placeholder":e,"card-cvv input::-moz-placeholder":e,"card-cvv input:-ms-input-placeholder":e,"card-cvv input:-moz-placeholder":e}}createElements(e){const t=this.cloverInstance.elements(),r={};return e.forEach((([e,o])=>{const n={...this.getDefaultStyles(),...o};try{r[e]=t.create(e,n)}catch(t){console.error(`Error creating element for type ${e}:`,t)}})),r}mountElements(e){Object.entries(e).forEach((([e,t])=>{const r=e,o=d.getWrapperId(r);o&&t.mount&&t.mount("#"+o)}))}static createFinalValidationState(){const e={CARD_NUMBER:{error:"Card number is required",touched:!0},CARD_DATE:{error:"Card expiry is required",touched:!0},CARD_CVV:{error:"Card CVV is required",touched:!0},CARD_POSTAL_CODE:{error:"Card postal code is required",touched:!0}},t=d.getValidationState(),r={};return Object.keys(e).forEach((o=>{const n=o,a=t[n];a&&(a.touched&&!a.error||a.touched&&a.error)?r[n]=a:r[n]=e[n]})),r}attachEventListeners({elements:e,events:t,handler:r}){Object.keys(e).forEach((o=>{const n=e[o];t.forEach((e=>{n.addEventListener(e,r)}))}))}static getValidationState(){return d.validationState}static isFinalEventValid(e){return["CARD_NUMBER","CARD_DATE","CARD_CVV","CARD_POSTAL_CODE"].every((t=>{const r=e[t];return r&&r.touched&&!r.error}))}static isEventElementState(e){return e&&"object"==typeof e&&"touched"in e}static getErrorMessageOrNull(t){const r=["CARD_CVV","CARD_DATE","CARD_NUMBER","CARD_POSTAL_CODE"];let o=!1,n="";return 0===Object.keys(t).length?r.forEach((()=>{o=!0,n+="These fields are required.<br>"})):r.forEach((r=>{const a=t[r];d.isEventElementState(a)&&a.touched?a.error&&(o=!0,n+=`${a.error}<br>`):(o=!0,n+=`${e[r]}: This field is required.<br>`)})),o?n:null}}d.validationState={},d.validationEventHandler=(e,t)=>{"onPaymentSetup"!==t&&(d.validationState={...e}),Object.entries(e).forEach((([e,t])=>{const r=e,o=d.getWrapperId(r),n=d.getErrorDisplayId(r),a=o?document.getElementById(o):null,s=n?document.getElementById(n):null;a&&s?t.error&&t.touched?d.addError(a,s,t.error):t.touched&&d.removeError(a,s):console.error(`WeeConnectPay failed to handle the event for the Clover Iframe element type: ${r}. The wrapperElement or errorDisplayElement were not found. `,{wrapperElement:{id:o,element:a},errorDisplayElement:{id:n,element:s}})}))},d.addError=(e,t,r)=>{t.textContent=r,t.classList.add("error"),e.classList.remove("success"),e.classList.add("error")},d.removeError=(e,t)=>{t.textContent=null,t.classList.remove("error"),e.classList.remove("error"),e.classList.add("success")};var p=d;Error;class u{constructor(e){if(this.googleRecaptchaConfig=e,this.verifyGoogleRecaptchaSdkIsLoaded(),!u.isGoogleRecaptchaEnabled(e.isEnabled))throw console.error("Google Recaptcha is disabled in the settings but is still being constructed."),new Error("Google Recaptcha is disabled in the settings but is still being constructed.");this.getSiteKeyOrFail(e.siteKey)}static getInstance(e){if(!this.instance){if(!e)throw console.error("Clover settings must be provided for initialization."),new Error("Clover settings must be provided for initialization.");this.instance=new u(e)}return this.instance}verifyGoogleRecaptchaSdkIsLoaded(){if("undefined"==typeof grecaptcha)throw console.error("Google Recaptcha SDK is not loaded."),new Error("Google Recaptcha SDK is not loaded.")}static isGoogleRecaptchaEnabled(e){return"1"===e}getSiteKeyOrFail(e){if(!e||""===e.trim()){const e='WeeConnectPay Gateway for WooCommerce Blocks has an error while using Google Recaptcha. Reason: Missing Google Recaptcha "site key". Have you set it up in the plugin settings?';throw console.error(e),new Error(e)}return e}createToken(){return new Promise(((e,t)=>{grecaptcha.ready((()=>{try{grecaptcha.execute(this.googleRecaptchaConfig.siteKey,{action:"submit"}).then((t=>{e(t)}),(e=>{t(e.toString())}))}catch(e){t(e.toString())}}))}))}async getTokenOrExceptionJson(){return await this.createToken()}static getStringifiedErrorForPaymentMethodData(e){const t={exception:e.toString()};return JSON.stringify(t)}}const h="weeconnectpay",E=(0,s.getSetting)("weeconnectpay_data",{}),m=(0,i.decodeEntities)(E.woocommerce?.gateway?.title)||(0,l.__)("Credit Card","weeconnectpay"),v=t=>{const{eventRegistration:r,emitResponse:o}=t,{onPaymentSetup:s}=r;return(0,a.useEffect)((()=>{const e=s((async()=>{const e=p.createFinalValidationState();if(p.validationEventHandler(e,"onPaymentSetup"),!p.isFinalEventValid(e)){const t=p.getErrorMessageOrNull(e);if(null!==t)return{type:o?.responseTypes.ERROR,message:t,messageContext:o?.noticeContexts?.PAYMENTS};{const e="An unexpected validation error has occurred. Please check the console for more details.";return console.error("The final validation before tokenizing the card did not pass validation, but could not generate a proper error message."),{type:o?.responseTypes.ERROR,unhandledValidationErrorMessage:e,messageContext:o?.noticeContexts?.PAYMENTS}}}const t=p.getInstance(E.clover).getCloverInstance();try{var r;let e="";if(u.isGoogleRecaptchaEnabled(E.googleRecaptcha.isEnabled))try{const t=u.getInstance(E.googleRecaptcha);e=await t.getTokenOrExceptionJson()}catch(t){console.error("Error creating Google Recaptcha Token:",t),e=u.getStringifiedErrorForPaymentMethodData(t)}const n=await t.createToken(),a=n.token,s=null!==(r=n.card?.brand)&&void 0!==r?r:"",c=n.card?.address_zip;return{type:o.responseTypes.SUCCESS,meta:{paymentMethodData:{token:a,"card-brand":s,"tokenized-zip":c,"recaptcha-token":e}}}}catch(e){return console.error("Error creating Clover token:",e),{type:o?.responseTypes.ERROR,message:"Error creating Clover token",messageContext:o?.noticeContexts?.PAYMENTS}}}));return()=>e()}),[o.responseTypes.ERROR,o.responseTypes.SUCCESS,s]),(0,a.useEffect)((()=>{!function(){try{const t=p.getInstance(E.clover),r=[[e.NUMBER,{}],[e.DATE,{}],[e.CVV,{}],[e.POSTAL_CODE,{}]],o=t.createElements(r);t.mountElements(o),t.attachEventListeners({elements:o,events:["change","blur"],handler:p.validationEventHandler})}catch(e){console.error("WeeConnectPay failed to setup Clover:",e.message)}}()}),[]),(0,n.jsx)("div",{id:"weeconnectpay-wc-fields",children:(0,n.jsxs)("div",{id:"form-display-no-footer",children:[(0,n.jsx)("div",{className:"top-row-wrapper",children:(0,n.jsxs)("div",{className:"form-row top-row full-width",children:[(0,n.jsx)("div",{id:"weeconnectpay-card-number",className:"field card-number-field"}),(0,n.jsx)("div",{className:"input-errors",id:"weeconnectpay-card-number-errors",role:"alert"})]})}),(0,n.jsxs)("div",{className:"bottom-row-wrapper",children:[(0,n.jsxs)("div",{className:"form-row bottom-row third-width",children:[(0,n.jsx)("div",{id:"weeconnectpay-card-date",className:"field card-date-field"}),(0,n.jsx)("div",{className:"input-errors",id:"weeconnectpay-card-date-errors",role:"alert"})]}),(0,n.jsxs)("div",{className:"form-row bottom-row third-width",children:[(0,n.jsx)("div",{id:"weeconnectpay-card-cvv",className:"field card-cvv-field"}),(0,n.jsx)("div",{className:"input-errors",id:"weeconnectpay-card-cvv-errors",role:"alert"})]}),(0,n.jsxs)("div",{className:"form-row bottom-row third-width",children:[(0,n.jsx)("div",{id:"weeconnectpay-card-postal-code",className:"field card-postal-code-field"}),(0,n.jsx)("div",{className:"input-errors",id:"weeconnectpay-card-postal-code-errors",role:"alert"})]})]}),(0,n.jsx)("div",{id:"card-response",role:"alert"}),(0,n.jsx)("div",{id:"card-errors",role:"alert"}),(0,n.jsx)("div",{className:"clover-footer"})]})})},g={name:h,paymentMethodId:h,label:m,content:(0,n.jsx)(v,{emitResponse:()=>{},eventRegistration:()=>{}}),edit:(0,n.jsx)(v,{emitResponse:()=>{},eventRegistration:()=>{}}),canMakePayment:()=>!0,ariaLabel:m,supports:{features:E.woocommerce?.gateway?.supports?E.woocommerce.gateway.supports:["products"]}};(0,c.registerPaymentMethod)(g)}()}();
     1!function(){"use strict";var e={20:function(e,t,r){var o=r(609),n=Symbol.for("react.element"),a=(Symbol.for("react.fragment"),Object.prototype.hasOwnProperty),s=o.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,c={key:!0,ref:!0,__self:!0,__source:!0};function i(e,t,r){var o,i={},l=null,d=null;for(o in void 0!==r&&(l=""+r),void 0!==t.key&&(l=""+t.key),void 0!==t.ref&&(d=t.ref),t)a.call(t,o)&&!c.hasOwnProperty(o)&&(i[o]=t[o]);if(e&&e.defaultProps)for(o in t=e.defaultProps)void 0===i[o]&&(i[o]=t[o]);return{$$typeof:n,type:e,key:l,ref:d,props:i,_owner:s.current}}t.jsx=i,t.jsxs=i},848:function(e,t,r){e.exports=r(20)},609:function(e){e.exports=window.React}},t={};function r(o){var n=t[o];if(void 0!==n)return n.exports;var a=t[o]={exports:{}};return e[o](a,a.exports,r),a.exports}var o,n,a,s=r(848);!function(e){e.CARD="CARD",e.CVV="CARD_CVV",e.DATE="CARD_DATE",e.NUMBER="CARD_NUMBER",e.POSTAL_CODE="CARD_POSTAL_CODE",e.STREET_ADDRESS="CARD_STREET_ADDRESS",e.PAYMENT_REQUEST_BUTTON="PAYMENT_REQUEST_BUTTON"}(o||(o={})),function(e){e.NUMBER="weeconnectpay-card-number",e.DATE="weeconnectpay-card-date",e.CVV="weeconnectpay-card-cvv",e.ZIP="weeconnectpay-card-postal-code",e.PAYMENT_REQUEST_BUTTON="weeconnectpay-payment-request-button"}(n||(n={})),function(e){e.NUMBER="weeconnectpay-card-number-errors",e.DATE="weeconnectpay-card-date-errors",e.CVV="weeconnectpay-card-cvv-errors",e.ZIP="weeconnectpay-card-postal-code-errors",e.PAYMENT_REQUEST_BUTTON="weeconnectpay-payment-request-button-errors"}(a||(a={}));var c=r(609),i=window.wc.wcSettings,l=window.wc.wcBlocksRegistry,d=window.wp.htmlEntities,p=window.wp.i18n;class u{constructor(e){this.getLocalizedCvvPlaceholderStyles=e=>{let t={};if("fr-CA"===e){const e=document.getElementById(n.CVV);e?t=e.offsetWidth>=106||0===e.offsetWidth?{whiteSpace:"pre-line",position:"relative"}:{whiteSpace:"pre-line",position:"relative",top:"-7px"}:console.warn("WeeConnectPay could not detect the CVV element during Styles creation. CVV Element placeholder may look off-center depending on your locale.")}else t={};return t},this.cloverConfig=e,this.verifyCloverSdkIsLoaded(),this.getPakmsOrFail(e.pakms),this.cloverInstance=this.createCloverInstance(e.pakms)}static getInstance(e){if(!this.instance){if(!e)throw console.error("Clover settings must be provided for initialization."),new Error("Clover settings must be provided for initialization.");this.instance=new u(e)}return this.instance}createCloverInstance(e){try{return new Clover(e)}catch(e){const t=`WeeConnectPay failed to initialize Clover instance: ${e.message}`;throw console.error(t),new Error(t)}}getCloverInstance(){return this.cloverInstance}verifyCloverSdkIsLoaded(){if("undefined"==typeof Clover)throw new Error("Clover SDK is not loaded.")}getPakmsOrFail(e){if(!e||""===e.trim()){const e="WeeConnectPay Gateway for WooCommerce Blocks cannot load the Clover iframes. Reason: Missing Clover public merchant (pakms) key, is the merchant authenticated?";throw console.error(e),new Error(e)}return e}static getWrapperId(e){switch(e){case o.NUMBER:return n.NUMBER;case o.DATE:return n.DATE;case o.CVV:return n.CVV;case o.POSTAL_CODE:return n.ZIP;case o.PAYMENT_REQUEST_BUTTON:return n.PAYMENT_REQUEST_BUTTON;default:return}}static getErrorDisplayId(e){switch(e){case o.NUMBER:return a.NUMBER;case o.DATE:return a.DATE;case o.CVV:return a.CVV;case o.POSTAL_CODE:return a.ZIP;case o.PAYMENT_REQUEST_BUTTON:return a.PAYMENT_REQUEST_BUTTON;default:return}}getDefaultStyles(){const e=this.getLocalizedCvvPlaceholderStyles(this.cloverConfig.websiteLocale);return{input:{padding:"0px",margin:"0px",height:"3.4em",width:"100%",border:"1px #C8C8C8 solid",borderRadius:"3px",textAlign:"center"},"::-webkit-input-placeholder":{textAlign:"center"},"::-moz-placeholder":{textAlign:"center"},":-ms-input-placeholder":{textAlign:"center"},":-moz-placeholder":{textAlign:"center"},"card-cvv input::-webkit-input-placeholder":e,"card-cvv input::-moz-placeholder":e,"card-cvv input:-ms-input-placeholder":e,"card-cvv input:-moz-placeholder":e}}createElements(e){const t=this.cloverInstance.elements(),r={};return e.forEach((([e,o])=>{const n={...this.getDefaultStyles(),...o};try{r[e]=t.create(e,n)}catch(t){console.error(`Error creating element for type ${e}:`,t)}})),r}mountElements(e){Object.entries(e).forEach((([e,t])=>{const r=e,o=u.getWrapperId(r);o&&t.mount&&t.mount("#"+o)}))}static createFinalValidationState(){const e={CARD_NUMBER:{error:"Card number is required",touched:!0},CARD_DATE:{error:"Card expiry is required",touched:!0},CARD_CVV:{error:"Card CVV is required",touched:!0},CARD_POSTAL_CODE:{error:"Card postal code is required",touched:!0}},t=u.getValidationState(),r={};return Object.keys(e).forEach((o=>{const n=o,a=t[n];a&&(a.touched&&!a.error||a.touched&&a.error)?r[n]=a:r[n]=e[n]})),r}attachEventListeners({elements:e,events:t,handler:r}){Object.keys(e).forEach((o=>{const n=e[o];t.forEach((e=>{n.addEventListener(e,r)}))}))}static getValidationState(){return u.validationState}static isFinalEventValid(e){return["CARD_NUMBER","CARD_DATE","CARD_CVV","CARD_POSTAL_CODE"].every((t=>{const r=e[t];return r&&r.touched&&!r.error}))}static isEventElementState(e){return e&&"object"==typeof e&&"touched"in e}static getErrorMessageOrNull(e){const t=["CARD_CVV","CARD_DATE","CARD_NUMBER","CARD_POSTAL_CODE"];let r=!1,n="";return 0===Object.keys(e).length?t.forEach((()=>{r=!0,n+="These fields are required.<br>"})):t.forEach((t=>{const a=e[t];u.isEventElementState(a)&&a.touched?a.error&&(r=!0,n+=`${a.error}<br>`):(r=!0,n+=`${o[t]}: This field is required.<br>`)})),r?n:null}}u.validationState={},u.validationEventHandler=(e,t)=>{"onPaymentSetup"!==t&&(u.validationState={...e}),Object.entries(e).forEach((([e,t])=>{const r=e,o=u.getWrapperId(r),n=u.getErrorDisplayId(r),a=o?document.getElementById(o):null,s=n?document.getElementById(n):null;a&&s?t.error&&t.touched?u.addError(a,s,t.error):t.touched&&u.removeError(a,s):console.error(`WeeConnectPay failed to handle the event for the Clover Iframe element type: ${r}. The wrapperElement or errorDisplayElement were not found. `,{wrapperElement:{id:o,element:a},errorDisplayElement:{id:n,element:s}})}))},u.addError=(e,t,r)=>{t.textContent=r,t.classList.add("error"),e.classList.remove("success"),e.classList.add("error")},u.removeError=(e,t)=>{t.textContent=null,t.classList.remove("error"),e.classList.remove("error"),e.classList.add("success")};var h=u;Error;class E{constructor(e){if(this.googleRecaptchaConfig=e,this.verifyGoogleRecaptchaSdkIsLoaded(),!E.isGoogleRecaptchaEnabled(e.isEnabled))throw console.error("Google Recaptcha is disabled in the settings but is still being constructed."),new Error("Google Recaptcha is disabled in the settings but is still being constructed.");this.getSiteKeyOrFail(e.siteKey)}static getInstance(e){if(!this.instance){if(!e)throw console.error("Clover settings must be provided for initialization."),new Error("Clover settings must be provided for initialization.");this.instance=new E(e)}return this.instance}verifyGoogleRecaptchaSdkIsLoaded(){if("undefined"==typeof grecaptcha)throw console.error("Google Recaptcha SDK is not loaded."),new Error("Google Recaptcha SDK is not loaded.")}static isGoogleRecaptchaEnabled(e){return"1"===e}getSiteKeyOrFail(e){if(!e||""===e.trim()){const e='WeeConnectPay Gateway for WooCommerce Blocks has an error while using Google Recaptcha. Reason: Missing Google Recaptcha "site key". Have you set it up in the plugin settings?';throw console.error(e),new Error(e)}return e}createToken(){return new Promise(((e,t)=>{grecaptcha.ready((()=>{try{grecaptcha.execute(this.googleRecaptchaConfig.siteKey,{action:"submit"}).then((t=>{e(t)}),(e=>{t(e.toString())}))}catch(e){t(e.toString())}}))}))}async getTokenOrExceptionJson(){return await this.createToken()}static getStringifiedErrorForPaymentMethodData(e){const t={exception:e.toString()};return JSON.stringify(t)}}const m="weeconnectpay",v=(0,i.getSetting)("weeconnectpay_data",{}),g=(0,d.decodeEntities)(v.woocommerce?.gateway?.title)||(0,p.__)("Credit Card","weeconnectpay"),f=e=>{const{eventRegistration:t,emitResponse:r}=e,{onPaymentSetup:n}=t;return(0,c.useEffect)((()=>{const e=n((async()=>{const e=h.createFinalValidationState();if(h.validationEventHandler(e,"onPaymentSetup"),!h.isFinalEventValid(e)){const t=h.getErrorMessageOrNull(e);if(null!==t)return{type:r?.responseTypes.ERROR,message:t,messageContext:r?.noticeContexts?.PAYMENTS};{const e="An unexpected validation error has occurred. Please check the console for more details.";return console.error("The final validation before tokenizing the card did not pass validation, but could not generate a proper error message."),{type:r?.responseTypes.ERROR,unhandledValidationErrorMessage:e,messageContext:r?.noticeContexts?.PAYMENTS}}}const t=h.getInstance(v.clover).getCloverInstance();try{var o;let e="";if(E.isGoogleRecaptchaEnabled(v.googleRecaptcha.isEnabled))try{const t=E.getInstance(v.googleRecaptcha);e=await t.getTokenOrExceptionJson()}catch(t){console.error("Error creating Google Recaptcha Token:",t),e=E.getStringifiedErrorForPaymentMethodData(t)}const n=await t.createToken(),a=n.token,s=null!==(o=n.card?.brand)&&void 0!==o?o:"",c=n.card?.address_zip;return{type:r.responseTypes.SUCCESS,meta:{paymentMethodData:{token:a,"card-brand":s,"tokenized-zip":c,"recaptcha-token":e}}}}catch(e){return console.error("Error creating Clover token:",e),{type:r?.responseTypes.ERROR,message:"Error creating Clover token",messageContext:r?.noticeContexts?.PAYMENTS}}}));return()=>e()}),[r.responseTypes.ERROR,r.responseTypes.SUCCESS,n]),(0,c.useEffect)((()=>{!function(){try{const e=h.getInstance(v.clover),t=[[o.NUMBER,{}],[o.DATE,{}],[o.CVV,{}],[o.POSTAL_CODE,{}]],r=e.createElements(t);e.mountElements(r),e.attachEventListeners({elements:r,events:["change","blur"],handler:h.validationEventHandler})}catch(e){console.error("WeeConnectPay failed to setup Clover:",e.message)}}()}),[]),(0,s.jsx)("div",{id:"weeconnectpay-wc-fields",children:(0,s.jsxs)("div",{id:"form-display-no-footer",children:[(0,s.jsx)("div",{className:"top-row-wrapper",children:(0,s.jsxs)("div",{className:"form-row top-row full-width",children:[(0,s.jsx)("div",{id:"weeconnectpay-card-number",className:"field card-number-field"}),(0,s.jsx)("div",{className:"input-errors",id:"weeconnectpay-card-number-errors",role:"alert"})]})}),(0,s.jsxs)("div",{className:"bottom-row-wrapper",children:[(0,s.jsxs)("div",{className:"form-row bottom-row third-width",children:[(0,s.jsx)("div",{id:"weeconnectpay-card-date",className:"field card-date-field"}),(0,s.jsx)("div",{className:"input-errors",id:"weeconnectpay-card-date-errors",role:"alert"})]}),(0,s.jsxs)("div",{className:"form-row bottom-row third-width",children:[(0,s.jsx)("div",{id:"weeconnectpay-card-cvv",className:"field card-cvv-field"}),(0,s.jsx)("div",{className:"input-errors",id:"weeconnectpay-card-cvv-errors",role:"alert"})]}),(0,s.jsxs)("div",{className:"form-row bottom-row third-width",children:[(0,s.jsx)("div",{id:"weeconnectpay-card-postal-code",className:"field card-postal-code-field"}),(0,s.jsx)("div",{className:"input-errors",id:"weeconnectpay-card-postal-code-errors",role:"alert"})]})]}),(0,s.jsx)("div",{id:"card-response",role:"alert"}),(0,s.jsx)("div",{id:"card-errors",role:"alert"}),(0,s.jsx)("div",{className:"clover-footer"})]})})},y={name:m,paymentMethodId:m,label:g,content:(0,s.jsx)(f,{emitResponse:()=>{},eventRegistration:()=>{}}),edit:(0,s.jsx)(f,{emitResponse:()=>{},eventRegistration:()=>{}}),canMakePayment:()=>!0,ariaLabel:g,supports:{features:v.woocommerce?.gateway?.supports?v.woocommerce.gateway.supports:["products"]}};(0,l.registerPaymentMethod)(y)}();
  • weeconnectpay/trunk/vendor/composer/installed.php

    r3095409 r3105409  
    22    'root' => array(
    33        'name' => '__root__',
    4         'pretty_version' => '3.9.0',
    5         'version' => '3.9.0.0',
    6         'reference' => 'f8d9ca39949a716e4013b3a8af79555fd4eb51b2',
     4        'pretty_version' => '3.10.0',
     5        'version' => '3.10.0.0',
     6        'reference' => 'dd602908ca063e38b4335250da240231e212fefb',
    77        'type' => 'library',
    88        'install_path' => __DIR__ . '/../../',
     
    1212    'versions' => array(
    1313        '__root__' => array(
    14             'pretty_version' => '3.9.0',
    15             'version' => '3.9.0.0',
    16             'reference' => 'f8d9ca39949a716e4013b3a8af79555fd4eb51b2',
     14            'pretty_version' => '3.10.0',
     15            'version' => '3.10.0.0',
     16            'reference' => 'dd602908ca063e38b4335250da240231e212fefb',
    1717            'type' => 'library',
    1818            'install_path' => __DIR__ . '/../../',
  • weeconnectpay/trunk/weeconnectpay.php

    r3095409 r3105409  
    1818 * Description:       Integrate Clover Payments with your WooCommerce online store.
    1919 * Tags:              clover, payments, weeconnect, e-commerce, gateway
    20  * Version:           3.9.0
     20 * Version:           3.10.2
    2121 * Requires at least: 5.6
    22  * Tested Up To:      6.5.3
     22 * Tested Up To:      6.5.4
    2323 * Requires PHP:      7.2
    2424 * Author:            WeeConnectPay
     
    3131 * Requires Plugins:  woocommerce
    3232 * WC requires at least: 3.0.4
    33  * WC tested up to: 8.9.1
     33 * WC tested up to: 9.0.1
    3434 */
    3535
     
    3838    die;
    3939}
    40 const WEECONNECT_VERSION = '3.9.0';
     40const WEECONNECT_VERSION = '3.10.2';
    4141
    4242define( 'WEECONNECTPAY_PLUGIN_URL', plugin_dir_url(__FILE__));
Note: See TracChangeset for help on using the changeset viewer.