From c5bb5f332d37943738fbea0da481beb6088b3fbb Mon Sep 17 00:00:00 2001 From: Pond Date: Mon, 8 Jul 2024 10:05:02 +0700 Subject: [PATCH 01/11] Add notice message enabled, disabled test mode and live key changed. --- includes/Gateways/ReepayCheckout.php | 19 +- languages/reepay-checkout-gateway-en_US.mo | Bin 510 -> 510 bytes languages/reepay-checkout-gateway-en_US.po | 868 ++++++++++++++++++--- templates/admin/admin-options.php | 13 + 4 files changed, 776 insertions(+), 124 deletions(-) mode change 100644 => 100755 languages/reepay-checkout-gateway-en_US.po diff --git a/includes/Gateways/ReepayCheckout.php b/includes/Gateways/ReepayCheckout.php index 95afdc6d..4816230c 100644 --- a/includes/Gateways/ReepayCheckout.php +++ b/includes/Gateways/ReepayCheckout.php @@ -167,7 +167,7 @@ public function init_form_fields() { 'private_key_test' => array( 'title' => __( 'Test Private Key', 'reepay-checkout-gateway' ), 'type' => 'text', - 'description' => __( 'Insert your private key from your Billwerk+ Pay test account', 'reepay-checkout-gateway' ), + 'description' => __( 'Insert your private key from your test account', 'reepay-checkout-gateway' ), 'default' => '', ), 'verify_key_test' => array( @@ -618,6 +618,10 @@ public function process_admin_options(): bool { if ( $current_key !== $woocommerce_reepay_checkout_private_key ) { Statistics::private_key_activated(); + /** + * Add action notic message live key changed + */ + add_action( 'woocommerce_update_options_checkout', array( $this, 'notic_message_live_key_changed' ) ); } $this->init_settings(); @@ -774,4 +778,17 @@ public function get_localize_script_data(): array { 'error_text' => __( 'Error with payment, please try again', 'reepay-checkout-gateway' ), ); } + + /** + * Message notice live key changed + */ + public function notice_message_live_key_changed() { + // translators: notic message live key changed. + $notice_message = sprintf( __( 'The Api key identifies the Billwerk account. Only subscription plan handles that exist under the account of the API key can be used to submit subscription orders. Read more about this here.', 'reepay-checkout-gateway' ), 'https://optimize-docs.billwerk.com/reference/account' ); + ?> +
+

+
+ \n" "Language-Team: \n" "Language: en_US\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Generator: Poedit 2.0.6\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"X-Generator: Poedit 3.4.4\n" "X-Poedit-KeywordsList: __;_e;_e(sprintf;__(sprintf\n" "X-Poedit-Basepath: .\n" "X-Poedit-SourceCharset: UTF-8\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" "X-Poedit-SearchPath-0: ..\n" -#: ../includes/abstracts/abstract-wc-payment-gateway-reepay.php:198 -msgid "Discount" +#: ../assets/dist/js/woo-blocks.js:29 +#: ../includes/Gateways/ReepayCheckout.php:49 +#: ../includes/Gateways/ReepayCheckout.php:116 +#: ../includes/Gateways/ReepayCheckout.php:122 +#: ../templates/admin/admin-options.php:29 +msgid "Billwerk+ Pay" +msgstr "" + +#: ../assets/dist/js/woo-blocks.js:99 +msgid "Use a new payment method" +msgstr "" + +#: ../assets/dist/js/woo-blocks.js:153 +msgid "Save to account" +msgstr "" + +#: ../assets/dist/vite/meta-fields/assets/meta-fields-DeJ_ZxWH.js:18 +msgid "Error api response" +msgstr "" + +#: ../assets/dist/vite/meta-fields/assets/meta-fields-DeJ_ZxWH.js:23 +msgid "Update" +msgstr "" + +#: ../assets/dist/vite/meta-fields/assets/meta-fields-DeJ_ZxWH.js:23 +msgid "Delete" +msgstr "" + +#: ../assets/dist/vite/meta-fields/assets/meta-fields-DeJ_ZxWH.js:23 +msgid "Add new meta field" +msgstr "" + +#: ../assets/dist/vite/meta-fields/assets/meta-fields-DeJ_ZxWH.js:23 +msgid "Key" +msgstr "" + +#: ../assets/dist/vite/meta-fields/assets/meta-fields-DeJ_ZxWH.js:23 +msgid "Value" +msgstr "" + +#: ../assets/dist/vite/meta-fields/assets/meta-fields-DeJ_ZxWH.js:23 +msgid "Add meta field" +msgstr "" + +#: ../assets/dist/vite/meta-fields/assets/meta-fields-DeJ_ZxWH.js:23 +msgid "Loading..." +msgstr "" + +#: ../assets/dist/vite/meta-fields/assets/meta-fields-DeJ_ZxWH.js:23 +msgid "Debug: User meta fields" +msgstr "" + +#: ../includes/Actions/Subscriptions.php:380 +#, php-format +msgid "Error: \"%1$s\". %2$s." +msgstr "" + +#: ../includes/Actions/Subscriptions.php:420 +#, php-format +msgid "Via %1$s card ending in %2$s/%3$s" +msgstr "" + +#: ../includes/Admin/Ajax.php:73 ../includes/Admin/Ajax.php:96 +#: ../includes/Admin/Ajax.php:132 +msgid "Order id not specified" +msgstr "" + +#: ../includes/Admin/Ajax.php:82 +msgid "Capture success." +msgstr "" + +#: ../includes/Admin/Ajax.php:104 +msgid "Order already cancelled." +msgstr "" + +#: ../includes/Admin/Ajax.php:119 +msgid "Cancel success." +msgstr "" + +#: ../includes/Admin/Ajax.php:144 +msgid "Payment method not found at the order" +msgstr "" + +#: ../includes/Admin/Ajax.php:149 +msgid "Refund success." +msgstr "" + +#: ../includes/Admin/Ajax.php:171 +msgid "Capture partly success." +msgstr "" + +#: ../includes/Admin/Ajax.php:206 +msgid "Refund partly success." +msgstr "" + +#: ../includes/Admin/Ajax.php:219 +msgid "Order id or settle order not specified" +msgstr "" + +#: ../includes/Admin/Main.php:75 +msgid "Please wait..." +msgstr "" + +#: ../includes/Admin/MetaBoxes/Order.php:63 +msgid "Debug: Order meta fields" +msgstr "" + +#: ../includes/Admin/MetaBoxes/Order.php:96 +msgid "Customer" +msgstr "" + +#: ../includes/Admin/MetaBoxes/Order.php:110 +msgid "Invoice" +msgstr "" + +#: ../includes/Admin/MetaBoxes/Order.php:125 +msgid "Subscription" +msgstr "" + +#: ../includes/Admin/PluginsPage.php:36 +msgid "Settings" +msgstr "" + +#: ../includes/Api.php:248 +#, php-format +msgid "" +"Billwerk+ Pay: API key not specified. Specify it in gateway settings" +msgstr "" + +#: ../includes/Api.php:294 ../includes/Api.php:340 +msgid "Unknown error." +msgstr "" + +#: ../includes/Api.php:297 +#, php-format +msgid "Invalid HTTP Code: %s" +msgstr "" + +#: ../includes/Api.php:307 +msgid "Billwerk+ Pay: Request rate limit exceeded" +msgstr "" + +#: ../includes/Api.php:322 +#, php-format +msgid "API Error: %1$s - %2$s." +msgstr "" + +#: ../includes/Api.php:329 +#, php-format +msgid "API Error (request): %1$s. Error Code: %2$s" +msgstr "" + +#: ../includes/Api.php:335 +#, php-format +msgid "API Error (request): %1$s. HTTP Code: %2$s" +msgstr "" + +#: ../includes/Api.php:680 +#, php-format +msgid "Failed to charge \"%1$s\". Error: %2$s. Token ID: %3$s" +msgstr "" + +#: ../includes/Api.php:780 +#, php-format +msgid "Failed to settle %1$s. Error: %2$s." +msgstr "" + +#: ../includes/Api.php:820 ../includes/Api.php:990 +#, php-format +msgid "Payment has been settled. Amount: %1$s. Transaction: %2$s" +msgstr "" + +#: ../includes/Api.php:851 +#, php-format +msgid "Failed to cancel the payment. Error: %s." +msgstr "" + +#: ../includes/Api.php:867 ../includes/Api.php:1004 ../includes/Api.php:1009 +msgid "Payment has been cancelled." +msgstr "" + +#: ../includes/Api.php:903 +#, php-format +msgid "Failed to refund \"%1$s\". Error: %2$s." +msgstr "" + +#: ../includes/Api.php:927 +#, php-format +msgid "Refunded: %1$s. Credit Note Id #%2$s. Reason: %3$s" +msgstr "" + +#: ../includes/Api.php:959 +#, php-format +msgid "Transaction is pending. Amount: %1$s. Transaction: %2$s" +msgstr "" + +#: ../includes/Api.php:972 ../includes/OrderFlow/Webhook.php:159 +#, php-format +msgid "Payment has been authorized. Amount: %1$s. Transaction: %2$s" +msgstr "" + +#: ../includes/Gateways/Anyday.php:42 +msgid "Billwerk+ Pay - Anyday" +msgstr "" + +#: ../includes/Gateways/ApplePay.php:46 +msgid "Billwerk+ Pay - Apple Pay" +msgstr "" + +#: ../includes/Gateways/Googlepay.php:44 +msgid "Billwerk+ Pay - Google Pay" +msgstr "" + +#: ../includes/Gateways/KlarnaDBT.php:42 +msgid "Billwerk+ Pay - Klarna Direct Bank Transfer" +msgstr "" + +#: ../includes/Gateways/KlarnaDD.php:42 +msgid "Billwerk+ Pay - Klarna Direct Debit" +msgstr "" + +#: ../includes/Gateways/KlarnaPayLater.php:42 +msgid "Billwerk+ Pay - Klarna Pay Later" +msgstr "" + +#: ../includes/Gateways/KlarnaPayNow.php:42 +msgid "Billwerk+ Pay - Klarna Pay Now" +msgstr "" + +#: ../includes/Gateways/KlarnaSliceIt.php:42 +msgid "Billwerk+ Pay - Klarna Slice It" +msgstr "" + +#: ../includes/Gateways/Mobilepay.php:42 +msgid "Billwerk+ Pay - Mobilepay" +msgstr "" + +#: ../includes/Gateways/MobilepaySubscriptions.php:44 +msgid "Billwerk+ Pay - Mobilepay Subscriptions" +msgstr "" + +#: ../includes/Gateways/OfflineCash.php:42 +msgid "Billwerk+ Pay - Cash" +msgstr "" + +#: ../includes/Gateways/OfflineTransfer.php:42 +msgid "Billwerk+ Pay - Bank Transfer" +msgstr "" + +#: ../includes/Gateways/Other.php:42 +msgid "Billwerk+ Pay - Other" +msgstr "" + +#: ../includes/Gateways/PESantander.php:44 +msgid "Billwerk+ Pay - Santander" +msgstr "" + +#: ../includes/Gateways/PPBancontact.php:42 +msgid "Billwerk+ Pay - Bancontact" +msgstr "" + +#: ../includes/Gateways/PPBlik.php:42 +msgid "Billwerk+ Pay - BLIK" +msgstr "" + +#: ../includes/Gateways/PPEps.php:42 +msgid "Billwerk+ Pay - EPS" +msgstr "" + +#: ../includes/Gateways/PPEstonianBanks.php:42 +msgid "Billwerk+ Pay - Estonian Banks" +msgstr "" + +#: ../includes/Gateways/PPGiroPay.php:42 +msgid "Billwerk+ Pay - GiroPay" +msgstr "" + +#: ../includes/Gateways/PPIdeal.php:44 +msgid "Billwerk+ Pay - iDEAL" +msgstr "" + +#: ../includes/Gateways/PPLatvianBanks.php:42 +msgid "Billwerk+ Pay - Latvian Banks" +msgstr "" + +#: ../includes/Gateways/PPLithuanianBanks.php:42 +msgid "Billwerk+ Pay - Lithuanian Banks" +msgstr "" + +#: ../includes/Gateways/PPMBWay.php:42 +msgid "Billwerk+ Pay - MB Way" +msgstr "" + +#: ../includes/Gateways/PPMultibanco.php:42 +msgid "Billwerk+ Pay - Multibanco" +msgstr "" + +#: ../includes/Gateways/PPMybank.php:42 +msgid "Billwerk+ Pay - MBank" +msgstr "" + +#: ../includes/Gateways/PPPaySafeCard.php:42 +msgid "Billwerk+ Pay - Paysafecard" +msgstr "" + +#: ../includes/Gateways/PPPaycoinq.php:42 +msgid "Billwerk+ Pay - Paycoinq" +msgstr "" + +#: ../includes/Gateways/PPPaysera.php:42 +msgid "Billwerk+ Pay - Paysera" msgstr "" -#: ../includes/class-wc-gateway-reepay-checkout.php:67 -#: ../includes/class-wc-gateway-reepay-checkout.php:178 -#: ../includes/class-wc-gateway-reepay-checkout.php:184 -#: ../templates/admin/admin-options.php:11 -msgid "Reepay Checkout" +#: ../includes/Gateways/PPPostFinance.php:42 +msgid "Billwerk+ Pay - PostFinance" msgstr "" -#: ../includes/class-wc-gateway-reepay-checkout.php:169 +#: ../includes/Gateways/PPPr24.php:42 +msgid "Billwerk+ Pay - Przelewy24" +msgstr "" + +#: ../includes/Gateways/PPSatisPay.php:42 +msgid "Billwerk+ Pay - Satisfy" +msgstr "" + +#: ../includes/Gateways/PPSepa.php:44 +msgid "Billwerk+ Pay - SEPA Direct Debit" +msgstr "" + +#: ../includes/Gateways/PPTrustly.php:42 +msgid "Billwerk+ Pay - Trustly" +msgstr "" + +#: ../includes/Gateways/PPVerkkoPankki.php:42 +msgid "Billwerk+ Pay - Finland Banks" +msgstr "" + +#: ../includes/Gateways/PPWeChatPay.php:42 +msgid "Billwerk+ Pay - WeChat Pay" +msgstr "" + +#: ../includes/Gateways/Paypal.php:42 +msgid "Billwerk+ Pay - PayPal" +msgstr "" + +#: ../includes/Gateways/ReepayCheckout.php:104 msgid "Enable/Disable" msgstr "" -#: ../includes/class-wc-gateway-reepay-checkout.php:171 +#: ../includes/Gateways/ReepayCheckout.php:106 msgid "Enable plugin" msgstr "" -#: ../includes/class-wc-gateway-reepay-checkout.php:175 +#: ../includes/Gateways/ReepayCheckout.php:113 msgid "Title" msgstr "" -#: ../includes/class-wc-gateway-reepay-checkout.php:177 -msgid "This controls the title which the user sees during checkout." +#: ../includes/Gateways/ReepayCheckout.php:115 +msgid "This controls the title which the user sees during checkout" msgstr "" -#: ../includes/class-wc-gateway-reepay-checkout.php:181 +#: ../includes/Gateways/ReepayCheckout.php:119 msgid "Description" msgstr "" -#: ../includes/class-wc-gateway-reepay-checkout.php:183 -msgid "This controls the description which the user sees during checkout." +#: ../includes/Gateways/ReepayCheckout.php:121 +msgid "This controls the description which the user sees during checkout" +msgstr "" + +#: ../includes/Gateways/ReepayCheckout.php:128 +msgid "Live Private Key" +msgstr "" + +#: ../includes/Gateways/ReepayCheckout.php:130 +msgid "Insert your private key from your live account" +msgstr "" + +#: ../includes/Gateways/ReepayCheckout.php:140 +#: ../includes/Gateways/ReepayCheckout.php:180 +msgid "Account" +msgstr "" + +#: ../includes/Gateways/ReepayCheckout.php:149 +#: ../includes/Gateways/ReepayCheckout.php:189 +#: ../templates/meta-boxes/invoice.php:39 +msgid "State" msgstr "" -#: ../includes/class-wc-gateway-reepay-checkout.php:187 -#: ../includes/class-wc-gateway-reepay-checkout.php:189 -msgid "Private key" +#: ../includes/Gateways/ReepayCheckout.php:168 +msgid "Test Private Key" msgstr "" -#: ../includes/class-wc-gateway-reepay-checkout.php:193 -#: ../includes/class-wc-gateway-reepay-checkout.php:195 -msgid "Public key" +#: ../includes/Gateways/ReepayCheckout.php:170 +msgid "Insert your private key from your test account" msgstr "" -#: ../includes/class-wc-gateway-reepay-checkout.php:199 +#: ../includes/Gateways/ReepayCheckout.php:209 msgid "Test Mode" msgstr "" -#: ../includes/class-wc-gateway-reepay-checkout.php:201 +#: ../includes/Gateways/ReepayCheckout.php:211 msgid "Enable Test Mode" msgstr "" -#: ../includes/class-wc-gateway-reepay-checkout.php:205 -#: ../includes/class-wc-gateway-reepay-checkout.php:207 -msgid "Capture automatically" +#: ../includes/Gateways/ReepayCheckout.php:218 +#: ../includes/Gateways/ReepayCheckout.php:220 +msgid "Email address for notification about failed webhooks" +msgstr "" + +#: ../includes/Gateways/ReepayCheckout.php:225 +msgid "Email address is invalid." msgstr "" -#: ../includes/class-wc-gateway-reepay-checkout.php:211 -msgid "Payment Type" +#: ../includes/Gateways/ReepayCheckout.php:233 +msgid "Payment Window Display" +msgstr "" + +#: ../includes/Gateways/ReepayCheckout.php:234 +msgid "" +"Choose between a redirect window or a overlay window. Note that some payment " +"methods like Apple Pay do not work for overlay window." msgstr "" -#: ../includes/class-wc-gateway-reepay-checkout.php:212 -msgid "Only Token support WooCommerce Subscriptions" +#: ../includes/Gateways/ReepayCheckout.php:243 +#: ../includes/Gateways/ReepayCheckout.php:244 +msgid "Payment Methods" msgstr "" -#: ../includes/class-wc-gateway-reepay-checkout.php:222 -msgid "Language" +#: ../includes/Gateways/ReepayCheckout.php:277 +msgid "Instant Settle" msgstr "" -#: ../includes/class-wc-gateway-reepay-checkout.php:225 +#: ../includes/Gateways/ReepayCheckout.php:278 +msgid "Instant Settle will charge your customers right away" +msgstr "" + +#: ../includes/Gateways/ReepayCheckout.php:282 +msgid "Instant Settle online / virtualproducts" +msgstr "" + +#: ../includes/Gateways/ReepayCheckout.php:283 +msgid "Instant Settle physical products" +msgstr "" + +#: ../includes/Gateways/ReepayCheckout.php:284 +msgid "Instant Settle recurring (subscription) products" +msgstr "" + +#: ../includes/Gateways/ReepayCheckout.php:285 +msgid "Instant Settle fees" +msgstr "" + +#: ../includes/Gateways/ReepayCheckout.php:291 +msgid "Language In Payment Window" +msgstr "" + +#: ../includes/Gateways/ReepayCheckout.php:294 +msgid "Detect Automatically" +msgstr "" + +#: ../includes/Gateways/ReepayCheckout.php:295 msgid "English" msgstr "" -#: ../includes/class-wc-gateway-reepay-checkout.php:226 +#: ../includes/Gateways/ReepayCheckout.php:296 msgid "Danish" msgstr "" -#: ../includes/class-wc-gateway-reepay-checkout.php:227 +#: ../includes/Gateways/ReepayCheckout.php:297 msgid "Swedish" msgstr "" -#: ../includes/class-wc-gateway-reepay-checkout.php:228 +#: ../includes/Gateways/ReepayCheckout.php:298 msgid "Norwegian" msgstr "" -#: ../includes/class-wc-gateway-reepay-checkout.php:229 +#: ../includes/Gateways/ReepayCheckout.php:299 msgid "German" msgstr "" -#: ../includes/class-wc-gateway-reepay-checkout.php:230 +#: ../includes/Gateways/ReepayCheckout.php:300 msgid "Spanish" msgstr "" -#: ../includes/class-wc-gateway-reepay-checkout.php:231 +#: ../includes/Gateways/ReepayCheckout.php:301 msgid "French" msgstr "" -#: ../includes/class-wc-gateway-reepay-checkout.php:232 +#: ../includes/Gateways/ReepayCheckout.php:302 msgid "Italian" msgstr "" -#: ../includes/class-wc-gateway-reepay-checkout.php:233 -msgid "Nederlands" +#: ../includes/Gateways/ReepayCheckout.php:303 +msgid "Netherlands" msgstr "" -#: ../includes/class-wc-gateway-reepay-checkout.php:238 +#: ../includes/Gateways/ReepayCheckout.php:308 +msgid "Auto-settle" +msgstr "" + +#: ../includes/Gateways/ReepayCheckout.php:309 +msgid "Disable settle orders on status changing to completed" +msgstr "" + +#: ../includes/Gateways/ReepayCheckout.php:311 +msgid "Disable auto-settle" +msgstr "" + +#: ../includes/Gateways/ReepayCheckout.php:315 +msgid "Allow Credit Card saving" +msgstr "" + +#: ../includes/Gateways/ReepayCheckout.php:317 +msgid "Enable Save CC feature" +msgstr "" + +#: ../includes/Gateways/ReepayCheckout.php:324 msgid "Debug" msgstr "" -#: ../includes/class-wc-gateway-reepay-checkout.php:240 +#: ../includes/Gateways/ReepayCheckout.php:326 msgid "Enable logging" msgstr "" -#: ../includes/class-wc-gateway-reepay-checkout.php:244 -msgid "Payment logos" +#: ../includes/Gateways/ReepayCheckout.php:330 +msgid "Show meta fields in orders" +msgstr "" + +#: ../includes/Gateways/ReepayCheckout.php:332 +#: ../includes/Gateways/ReepayCheckout.php:338 +msgid "Enable display" msgstr "" -#: ../includes/class-wc-gateway-reepay-checkout.php:245 -msgid "Payment logos on checkout" +#: ../includes/Gateways/ReepayCheckout.php:336 +msgid "Show meta fields in users" msgstr "" -#: ../includes/class-wc-gateway-reepay-checkout.php:248 +#: ../includes/Gateways/ReepayCheckout.php:345 +msgid "Payment Logos" +msgstr "" + +#: ../includes/Gateways/ReepayCheckout.php:347 +msgid "" +"Choose the logos you would like to show in WooCommerce checkout. Make sure " +"that they are enabled in Billwerk+ Pay Dashboard" +msgstr "" + +#: ../includes/Gateways/ReepayCheckout.php:353 msgid "Dankort" msgstr "" -#: ../includes/class-wc-gateway-reepay-checkout.php:249 +#: ../includes/Gateways/ReepayCheckout.php:354 msgid "Visa" msgstr "" -#: ../includes/class-wc-gateway-reepay-checkout.php:250 +#: ../includes/Gateways/ReepayCheckout.php:355 msgid "MasterCard" msgstr "" -#: ../includes/class-wc-gateway-reepay-checkout.php:251 +#: ../includes/Gateways/ReepayCheckout.php:356 msgid "Visa Electron" msgstr "" -#: ../includes/class-wc-gateway-reepay-checkout.php:252 +#: ../includes/Gateways/ReepayCheckout.php:357 msgid "Maestro" msgstr "" -#: ../includes/class-wc-gateway-reepay-checkout.php:253 +#: ../includes/Gateways/ReepayCheckout.php:358 +msgid "Paypal" +msgstr "" + +#: ../includes/Gateways/ReepayCheckout.php:359 msgid "MobilePay Online" msgstr "" -#: ../includes/class-wc-gateway-reepay-checkout.php:254 +#: ../includes/Gateways/ReepayCheckout.php:360 +msgid "ApplePay" +msgstr "" + +#: ../includes/Gateways/ReepayCheckout.php:361 +msgid "Klarna" +msgstr "" + +#: ../includes/Gateways/ReepayCheckout.php:362 msgid "Viabill" msgstr "" -#: ../includes/class-wc-gateway-reepay-checkout.php:255 +#: ../includes/Gateways/ReepayCheckout.php:363 +msgid "Resurs Bank" +msgstr "" + +#: ../includes/Gateways/ReepayCheckout.php:364 msgid "Forbrugsforeningen" msgstr "" -#: ../includes/class-wc-gateway-reepay-checkout.php:256 +#: ../includes/Gateways/ReepayCheckout.php:365 msgid "AMEX" msgstr "" -#: ../includes/class-wc-gateway-reepay-checkout.php:257 +#: ../includes/Gateways/ReepayCheckout.php:366 msgid "JCB" msgstr "" -#: ../includes/class-wc-gateway-reepay-checkout.php:258 +#: ../includes/Gateways/ReepayCheckout.php:367 msgid "Diners Club" msgstr "" -#: ../includes/class-wc-gateway-reepay-checkout.php:259 +#: ../includes/Gateways/ReepayCheckout.php:368 msgid "Unionpay" msgstr "" -#: ../includes/class-wc-gateway-reepay-checkout.php:260 +#: ../includes/Gateways/ReepayCheckout.php:369 msgid "Discover" msgstr "" -#: ../includes/class-wc-gateway-reepay-checkout.php:287 +#: ../includes/Gateways/ReepayCheckout.php:370 +msgid "Google pay" +msgstr "" + +#: ../includes/Gateways/ReepayCheckout.php:371 +msgid "Vipps" +msgstr "" + +#: ../includes/Gateways/ReepayCheckout.php:377 +msgid "Logo Height" +msgstr "" + +#: ../includes/Gateways/ReepayCheckout.php:379 +msgid "Set the Logo height in pixels" +msgstr "" + +#: ../includes/Gateways/ReepayCheckout.php:386 +#: ../includes/Gateways/ReepayCheckout.php:388 +msgid "Order handle failover" +msgstr "" + +#: ../includes/Gateways/ReepayCheckout.php:389 msgid "" -"Reepay is enabled, but a SSL certificate is not detected. Your checkout may " -"not be secure! Please ensure your server has a valid" +"In case if invoice with current handle was settled before, plugin will " +"generate unique handle" +msgstr "" + +#: ../includes/Gateways/ReepayCheckout.php:393 +msgid "Skip order lines" msgstr "" -#: ../includes/class-wc-gateway-reepay-checkout.php:288 -msgid "SSL certificate" +#: ../includes/Gateways/ReepayCheckout.php:394 +msgid "Select if order lines should not be send to Billwerk+ Pay" msgstr "" -#: ../includes/class-wc-gateway-reepay-checkout.php:331 -#: ../includes/class-wc-gateway-reepay-checkout.php:355 -msgid "Pay" +#: ../includes/Gateways/ReepayCheckout.php:403 +#: ../includes/Gateways/ReepayCheckout.php:404 +msgid "The automatic order auto-cancel" +msgstr "" + +#: ../includes/Gateways/ReepayCheckout.php:413 +msgid "Payment button text" +msgstr "" + +#: ../includes/Gateways/ReepayCheckout.php:415 +msgid "" +"Text on button which will be displayed on payment page if subscription " +"products is being purchased" msgstr "" -#: ../includes/class-wc-gateway-reepay-checkout.php:483 -msgid "Failed to load token." +#: ../includes/Gateways/ReepayCheckout.php:518 +msgid "Save and verify" msgstr "" -#: ../includes/class-wc-gateway-reepay-checkout.php:490 -msgid "Access denied." +#: ../includes/Gateways/ReepayCheckout.php:560 +msgid "Webhook" msgstr "" -#: ../includes/class-wc-gateway-reepay-checkout.php:576 +#: ../includes/Gateways/ReepayCheckout.php:702 +#, php-format +msgid "Payment method changed to \"%s\"" +msgstr "" + +#: ../includes/Gateways/ReepayCheckout.php:731 +#, php-format +msgid "Payment has been authorized. Amount: %s." +msgstr "" + +#: ../includes/Gateways/ReepayCheckout.php:745 +#, php-format +msgid "Payment has been settled. Amount: %s." +msgstr "" + +#: ../includes/Gateways/ReepayCheckout.php:776 +msgid "Payment was canceled, please try again" +msgstr "" + +#: ../includes/Gateways/ReepayCheckout.php:777 +msgid "Error with payment, please try again" +msgstr "" + +#: ../includes/Gateways/ReepayCheckout.php:785 +#, php-format +msgid "" +"The Api key identifies the Billwerk account. Only subscription plan handles " +"that exist under the account of the API key can be used to submit " +"subscription orders. Read more about this " +"here." +msgstr "" + +#: ../includes/Gateways/ReepayGateway.php:241 +#: ../includes/Gateways/ReepayGateway.php:264 +#: ../includes/Gateways/ReepayGateway.php:281 +msgid "Add card" +msgstr "" + +#: ../includes/Gateways/ReepayGateway.php:333 msgid "There was a problem adding the card." msgstr "" -#: ../includes/class-wc-gateway-reepay-checkout.php:593 -#: ../includes/class-wc-gateway-reepay-checkout.php:693 -#: ../includes/class-wc-gateway-reepay-checkout.php:1173 -msgid "Payment authorized." +#: ../includes/Gateways/ReepayGateway.php:340 +msgid "Payment method successfully added." +msgstr "" + +#: ../includes/Gateways/ReepayGateway.php:514 +msgid "Billwerk+ Pay: WebHook has been successfully created/updated" +msgstr "" + +#: ../includes/Gateways/ReepayGateway.php:523 +msgid "Unable to retrieve the webhook settings. Wrong api credentials?" +msgstr "" + +#: ../includes/Gateways/Resurs.php:42 +msgid "Billwerk+ Pay - Resurs Bank" +msgstr "" + +#: ../includes/Gateways/Swish.php:42 +msgid "Billwerk+ Pay - Swish" +msgstr "" + +#: ../includes/Gateways/Viabill.php:42 +msgid "Billwerk+ Pay - ViaBill" +msgstr "" + +#: ../includes/Gateways/Vipps.php:44 +msgid "Billwerk+ Pay - Vipps" +msgstr "" + +#: ../includes/Gateways/VippsRecurring.php:46 +msgid "Billwerk+ Pay - Vipps Recurring" +msgstr "" + +#: ../includes/Integrations/PWGiftCardsIntegration.php:63 +#, php-format +msgid "PW gift card (%s)" +msgstr "" + +#: ../includes/OrderFlow/OrderCapture.php:110 +#: ../includes/OrderFlow/OrderCapture.php:133 +msgid "Capture" +msgstr "" + +#: ../includes/OrderFlow/OrderCapture.php:304 +#: ../includes/OrderFlow/OrderCapture.php:374 +msgid "Failed to settle item" +msgstr "" + +#: ../includes/OrderFlow/OrderStatuses.php:109 +msgid "Sync statuses" +msgstr "" + +#: ../includes/OrderFlow/OrderStatuses.php:111 +msgid "Enable sync" msgstr "" -#: ../includes/class-wc-gateway-reepay-checkout.php:598 -#: ../includes/class-wc-gateway-reepay-checkout.php:701 -#: ../includes/class-wc-gateway-reepay-checkout.php:1178 -msgid "Transaction settled." +#: ../includes/OrderFlow/OrderStatuses.php:112 +msgid "" +"2-way synchronization of order statuses in Woocommerce with invoice statuses " +"in Billwerk+ Pay" msgstr "" -#: ../includes/class-wc-gateway-reepay-checkout.php:603 -msgid "Payment failed" +#: ../includes/OrderFlow/OrderStatuses.php:127 +msgid "Status: Billwerk+ Pay Created" msgstr "" -#: ../includes/class-wc-gateway-reepay-checkout.php:846 -msgid "Transaction captured." +#: ../includes/OrderFlow/OrderStatuses.php:142 +msgid "Status: Billwerk+ Pay Authorized" msgstr "" -#: ../includes/class-wc-gateway-reepay-checkout.php:882 -#: ../includes/class-wc-gateway-reepay-checkout.php:884 -msgid "Transaction cancelled." +#: ../includes/OrderFlow/OrderStatuses.php:157 +msgid "Status: Billwerk+ Pay Settled" msgstr "" -#: ../includes/class-wc-gateway-reepay-checkout.php:924 +#: ../includes/OrderFlow/OrderStatuses.php:412 +#: ../includes/OrderFlow/OrderStatuses.php:447 #, php-format -msgid "Refunded: %s. Credit Note Id #%s. Reason: %s" +msgid "Order status rollback. %s" msgstr "" -#: ../includes/class-wc-gateway-reepay-checkout.php:1186 +#: ../includes/OrderFlow/OrderStatuses.php:437 #, php-format -msgid "Failed to charge \"%s\". %s." +msgid "" +"Error with order #%2$u. View order notes for more info" msgstr "" -#: ../includes/class-wc-gateway-reepay-checkout.php:1210 +#: ../includes/OrderFlow/ThankyouPage.php:111 +msgid "Please wait. We're checking the payment status." +msgstr "" + +#: ../includes/OrderFlow/Webhook.php:310 +msgid "Cancelled by WebHook." +msgstr "" + +#: ../includes/OrderFlow/Webhook.php:361 #, php-format -msgid "Via %s card ending in %s/%s" +msgid "Credit Note Id #%s." msgstr "" -#: ../includes/class-wc-payment-token-reepay.php:154 +#: ../includes/OrderFlow/Webhook.php:381 +#, php-format +msgid "Refunded: %1$s. Reason: %2$s" +msgstr "" + +#: ../includes/Plugin/WoocommerceExists.php:56 +msgid "" +"WooCommerce plugin is inactive or missing. Please install and active it." +msgstr "" + +#: ../includes/Plugin/WoocommerceExists.php:60 +msgid "WooCommerce Billwerk+ Pay Gateway isn't active now." +msgstr "" + +#: ../includes/Tokens/ReepayTokens.php:102 +#: ../includes/Tokens/ReepayTokens.php:163 +msgid "Card not found" +msgstr "" + +#: ../includes/Tokens/TokenReepay.php:220 +msgid "Token not found" +msgstr "" + +#: ../includes/Tokens/TokenReepay.php:232 #, php-format msgid "%1$s ending in %2$s" msgstr "" -#: ../templates/admin/admin-options.php:15 +#: ../includes/Tokens/TokenReepayMS.php:44 +#, php-format +msgid "Billwerk+ Pay - Mobilepay Subscriptions [%s]" +msgstr "" + +#: ../templates/admin/admin-options.php:19 +#, php-format +msgid "" +"You just enabled test mode, meaning your test API key will now be used. " +"Please note that all subscription products previously linked to plans on " +"your live account are no longer linked. If you try to purchase a " +"subscription product now, an error will occur. Disabling test mode will " +"restore all connections. Read more about " +"this here." +msgstr "" + +#: ../templates/admin/admin-options.php:21 +#, php-format +msgid "" +"You just disabled test mode, meaning your live API key will now be used. " +"Please note that all subscription products previously linked to plans on " +"your live account are now restored. If you haven't linked your subscription " +"products with your test account, they will remain unlinked. Read more about this here." +msgstr "" + +#: ../templates/admin/admin-options.php:35 #, php-format msgid "" -"Please setup WebHook in Reepay Dashboard." +"Please setup WebHook in Billwerk+ Pay " +"Dashboard." msgstr "" -#: ../templates/admin/admin-options.php:22 +#: ../templates/admin/admin-options.php:43 #, php-format -msgid "WebHook URL: %s" +msgid "WebHook URL: %2$s" msgstr "" -#: ../templates/admin/payment-actions.php:16 +#: ../templates/admin/payment-actions.php:22 msgid "Capture Payment" msgstr "" -#: ../templates/admin/payment-actions.php:24 +#: ../templates/admin/payment-actions.php:30 msgid "Cancel Payment" msgstr "" -#: ../templates/checkout/payment-fields.php:21 -#, php-format -msgid "Pay with %s on Reepay" +#: ../templates/meta-boxes/customer.php:14 ../templates/meta-boxes/plan.php:14 +msgid "Handle" msgstr "" -#: ../reepay-checkout-gateway.php:68 -msgid "Settings" +#: ../templates/meta-boxes/customer.php:20 +msgid "Email" msgstr "" -#: ../reepay-checkout-gateway.php:184 -#: ../reepay-checkout-gateway.php:199 -#, php-format -msgid "Order status rollback. %s" +#: ../templates/meta-boxes/customer.php:27 +msgid "See customer" msgstr "" -#: ../reepay-checkout-gateway.php:219 -msgid "Reepay Payments Actions" +#: ../templates/meta-boxes/invoice.php:32 +msgid "Invoice handle" msgstr "" -#: ../reepay-checkout-gateway.php:271 -msgid "Please wait..." +#: ../templates/meta-boxes/invoice.php:118 +msgid "See invoice" msgstr "" -#: ../reepay-checkout-gateway.php:299 -#: ../reepay-checkout-gateway.php:325 -msgid "Capture success." +#: ../templates/meta-boxes/plan.php:20 +msgid "Plan" +msgstr "" + +#: ../templates/meta-boxes/plan.php:27 +msgid "See subscription" msgstr "" diff --git a/templates/admin/admin-options.php b/templates/admin/admin-options.php index c2237a89..16eff830 100755 --- a/templates/admin/admin-options.php +++ b/templates/admin/admin-options.php @@ -14,6 +14,19 @@ ?>

get_method_title() ); ?>

+get_setting( 'test_mode' ) ) { + // translators: notice message enabled test mode. + $notice_message = sprintf( __( 'You just enabled test mode, meaning your test API key will now be used. Please note that all subscription products previously linked to plans on your live account are no longer linked. If you try to purchase a subscription product now, an error will occur. Disabling test mode will restore all connections. Read more about this here.', 'reepay-checkout-gateway' ), 'https://optimize-docs.billwerk.com/reference/account' ); +} else { + // translators: notice message disabled test mode. + $notice_message = sprintf( __( 'You just disabled test mode, meaning your live API key will now be used. Please note that all subscription products previously linked to plans on your live account are now restored. If you haven\'t linked your subscription products with your test account, they will remain unlinked. Read more about this here.', 'reepay-checkout-gateway' ), 'https://optimize-docs.billwerk.com/reference/account' ); +} +?> +
+

+
+ get_method_description() ) ); ?>

From f3acfa666cfa8dcb2b2c45d6706e910fdde24eb2 Mon Sep 17 00:00:00 2001 From: Pond Date: Mon, 8 Jul 2024 10:07:00 +0700 Subject: [PATCH 02/11] Fix hook function name --- includes/Gateways/ReepayCheckout.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/Gateways/ReepayCheckout.php b/includes/Gateways/ReepayCheckout.php index 4816230c..bfe78748 100644 --- a/includes/Gateways/ReepayCheckout.php +++ b/includes/Gateways/ReepayCheckout.php @@ -621,7 +621,7 @@ public function process_admin_options(): bool { /** * Add action notic message live key changed */ - add_action( 'woocommerce_update_options_checkout', array( $this, 'notic_message_live_key_changed' ) ); + add_action( 'woocommerce_update_options_checkout', array( $this, 'notice_message_live_key_changed' ) ); } $this->init_settings(); From ef8ab0e75374bddb29dcf85a071c4968964bf8e3 Mon Sep 17 00:00:00 2001 From: Pond Date: Tue, 23 Jul 2024 10:14:22 +0700 Subject: [PATCH 03/11] Fix webhook customer_payment_method_added is missing the payment_method_reference data and create a new rule to address this issue. --- Readme.txt | 5 +- includes/Functions/order.php | 102 +++++++++++++++++++++++++++------ includes/OrderFlow/Webhook.php | 2 +- reepay-woocommerce-payment.php | 2 +- 4 files changed, 92 insertions(+), 19 deletions(-) diff --git a/Readme.txt b/Readme.txt index 38701c49..c73bdb8e 100755 --- a/Readme.txt +++ b/Readme.txt @@ -4,7 +4,7 @@ Tags: billwerk+, visa, mastercard, dankort, mobilepay Requires at least: 4.0 Tested up to: 6.5.3 Requires PHP: 7.4 -Stable tag: 1.7.6 +Stable tag: 1.7.6.1 License: GPL License URI: http://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html @@ -18,6 +18,9 @@ The Billwerk+ Pay plugin extends WooCommerce allowing you to take payments on yo See installation guide right here: https://docu.billwerk.plus/help/en/apps/woocommerce/setup-woocommerce-plugin.html == Changelog == +v 1.7.6.1 - +* [Fix] - The Billwerk+ webhook customer_payment_method_added is missing the payment_method_reference data. We need to create a new rule to address this issue. + v 1.7.6 - * [Fix] - Allow the activation of Santander and enforce a redirect for this payment. * [Compatibility] - Billwerk+ Optimize version 1.2.6 diff --git a/includes/Functions/order.php b/includes/Functions/order.php index 803771df..de7fc8b2 100644 --- a/includes/Functions/order.php +++ b/includes/Functions/order.php @@ -6,6 +6,7 @@ */ use Reepay\Checkout\Utils\TimeKeeper; +use WC_Reepay_Renewals; defined( 'ABSPATH' ) || exit(); @@ -129,32 +130,101 @@ function rp_get_not_subs_order_by_handle( string $handle ) { * Get order by reepay order session. * * @param string $session_id reepay order session. + * @param string $handle reepay order handle. * * @return false|WC_Order */ - function rp_get_order_by_session( string $session_id ) { - $order_id = wp_cache_get( $session_id, 'reepay_order_by_session' ); + function rp_get_order_by_session( string $session_id = null, string $handle = null ) { + if ( ! is_null( $session_id ) ) { + if ( rp_hpos_enabled() ) { + $orders = wc_get_orders( + array( + 'limit' => 1, + 'meta_query' => array( //phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_query + array( + 'key' => 'reepay_session_id', + 'value' => $session_id, + ), - if ( empty( $order_id ) ) { - $orders = wc_get_orders( - array( - 'limit' => 1, - 'meta_key' => 'reepay_session_id', //phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_key - 'meta_value' => $session_id, //phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_value - 'meta_compare' => '=', - ) - ); + ), + ) + ); + } else { + $orders = wc_get_orders( + array( + 'limit' => 1, + 'meta_key' => 'reepay_session_id', //phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_key + 'meta_value' => $session_id, //phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_value + 'meta_compare' => '=', + ) + ); + } if ( ! empty( $orders ) ) { $order_id = reset( $orders )->get_id(); - wp_cache_set( $session_id, $order_id, 'reepay_order_by_session' ); - } else { - return false; + clean_post_cache( $order_id ); + return wc_get_order( $order_id ); + } elseif ( ! is_null( $handle ) ) { + $order = rp_get_order_by_customer( $handle ); + return $order; } + + return false; + } elseif ( ! is_null( $handle ) ) { + $order = rp_get_order_by_customer( $handle ); + return $order; + } else { + return false; } + } +} + +if ( ! function_exists( 'rp_get_order_by_customer' ) ) { + /** + * Get order by reepay order customer. + * + * @param string $customer_id reepay order customer. + * + * @return false|WC_Order + */ + function rp_get_order_by_customer( string $customer_id ) { + $reepay_list_invoice = reepay()->api( 'list-invoice' )->request( 'GET', "https://api.reepay.com/v1/list/invoice?customer=$customer_id" ); - clean_post_cache( $order_id ); - return $order_id ? wc_get_order( $order_id ) : false; + if ( is_wp_error( $reepay_list_invoice ) || empty( $reepay_list_invoice['content'] ) ) { + return ''; + } + $subscription_order = null; + foreach ( $reepay_list_invoice['content'] as $content ) { + $search_string = strpos( $content['handle'], 'order-' ); + if ( false !== $search_string ) { + $handle = $content['handle']; + $orders = wc_get_orders( + array( + 'limit' => 1, + 'meta_query' => array( //phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_query + array( + 'key' => '_reepay_order', + 'value' => $handle, + ), + + ), + ) + ); + + if ( ! empty( $orders ) ) { + $order_id = reset( $orders )->get_id(); + $order = wc_get_order( $order_id ); + if ( class_exists( WC_Reepay_Renewals::class ) && WC_Reepay_Renewals::is_order_contain_subscription( $order ) || order_contains_subscription( $order ) ) { + $subscription_order = $order; + } + } + } + } + if ( null !== $subscription_order ) { + return $subscription_order; + } else { + return ''; + } } } diff --git a/includes/OrderFlow/Webhook.php b/includes/OrderFlow/Webhook.php index 466eea8d..43be2a0d 100644 --- a/includes/OrderFlow/Webhook.php +++ b/includes/OrderFlow/Webhook.php @@ -446,7 +446,7 @@ public function process( array $data ) { break; case 'customer_payment_method_added': if ( ! empty( $data['payment_method_reference'] ) ) { - $order = rp_get_order_by_session( $data['payment_method_reference'] ); + $order = rp_get_order_by_session( $data['payment_method_reference'], $data['customer'] ); if ( $order && order_contains_subscription( $order ) ) { WC_Subscriptions_Manager::activate_subscriptions_for_order( $order ); diff --git a/reepay-woocommerce-payment.php b/reepay-woocommerce-payment.php index 56628c7f..6f6bd65e 100755 --- a/reepay-woocommerce-payment.php +++ b/reepay-woocommerce-payment.php @@ -4,7 +4,7 @@ * Description: Get a plug-n-play payment solution for WooCommerce, that is easy to use, highly secure and is built to maximize the potential of your e-commerce. * Author: Billwerk+ * Author URI: http://billwerk.plus - * Version: 1.7.6 + * Version: 1.7.6.1 * Text Domain: reepay-checkout-gateway * Domain Path: /languages * WC requires at least: 3.0.0 From 5385faab97aeed491d659327ad25d508e926cbf3 Mon Sep 17 00:00:00 2001 From: Pond Date: Tue, 23 Jul 2024 10:55:05 +0700 Subject: [PATCH 04/11] Add check plugin reepay subscriptions is activate --- includes/Gateways/ReepayCheckout.php | 16 +++++++++------- templates/admin/admin-options.php | 14 ++++++++------ 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/includes/Gateways/ReepayCheckout.php b/includes/Gateways/ReepayCheckout.php index bfe78748..a5489099 100644 --- a/includes/Gateways/ReepayCheckout.php +++ b/includes/Gateways/ReepayCheckout.php @@ -783,12 +783,14 @@ public function get_localize_script_data(): array { * Message notice live key changed */ public function notice_message_live_key_changed() { - // translators: notic message live key changed. - $notice_message = sprintf( __( 'The Api key identifies the Billwerk account. Only subscription plan handles that exist under the account of the API key can be used to submit subscription orders. Read more about this here.', 'reepay-checkout-gateway' ), 'https://optimize-docs.billwerk.com/reference/account' ); - ?> -
-

-
- Read more about this here.', 'reepay-checkout-gateway' ), 'https://optimize-docs.billwerk.com/reference/account' ); + ?> +
+

+
+ get_method_title() ); ?> get_setting( 'test_mode' ) ) { - // translators: notice message enabled test mode. - $notice_message = sprintf( __( 'You just enabled test mode, meaning your test API key will now be used. Please note that all subscription products previously linked to plans on your live account are no longer linked. If you try to purchase a subscription product now, an error will occur. Disabling test mode will restore all connections. Read more about this here.', 'reepay-checkout-gateway' ), 'https://optimize-docs.billwerk.com/reference/account' ); -} else { - // translators: notice message disabled test mode. - $notice_message = sprintf( __( 'You just disabled test mode, meaning your live API key will now be used. Please note that all subscription products previously linked to plans on your live account are now restored. If you haven\'t linked your subscription products with your test account, they will remain unlinked. Read more about this here.', 'reepay-checkout-gateway' ), 'https://optimize-docs.billwerk.com/reference/account' ); +if ( is_plugin_active( 'reepay-subscriptions-for-woocommerce/reepay-subscriptions-for-woocommerce.php' ) ) { + if ( 'yes' === reepay()->get_setting( 'test_mode' ) ) { + // translators: notice message enabled test mode. + $notice_message = sprintf( __( 'You just enabled test mode, meaning your test API key will now be used. Please note that all subscription products previously linked to plans on your live account are no longer linked. If you try to purchase a subscription product now, an error will occur. Disabling test mode will restore all connections. Read more about this here.', 'reepay-checkout-gateway' ), 'https://optimize-docs.billwerk.com/reference/account' ); + } else { + // translators: notice message disabled test mode. + $notice_message = sprintf( __( 'You just disabled test mode, meaning your live API key will now be used. Please note that all subscription products previously linked to plans on your live account are now restored. If you haven\'t linked your subscription products with your test account, they will remain unlinked. Read more about this here.', 'reepay-checkout-gateway' ), 'https://optimize-docs.billwerk.com/reference/account' ); + } } ?>
From e65773d0ade3799770e4a06c93234d516124bb7f Mon Sep 17 00:00:00 2001 From: Pond Date: Tue, 23 Jul 2024 14:36:25 +0700 Subject: [PATCH 05/11] Fix notice message enabled or disable test mode show on save changes action --- includes/Gateways/ReepayCheckout.php | 22 ++++++++++++++++++++++ templates/admin/admin-options.php | 15 --------------- 2 files changed, 22 insertions(+), 15 deletions(-) diff --git a/includes/Gateways/ReepayCheckout.php b/includes/Gateways/ReepayCheckout.php index a5489099..2a47d442 100644 --- a/includes/Gateways/ReepayCheckout.php +++ b/includes/Gateways/ReepayCheckout.php @@ -629,6 +629,8 @@ public function process_admin_options(): bool { $this->private_key_test = $this->settings['private_key_test'] ?? $this->private_key_test; $this->test_mode = $this->settings['test_mode'] ?? $this->test_mode; + add_action( 'woocommerce_update_options_checkout', array( $this, 'notice_message_test_mode_enabled' ) ); + reepay()->reset_settings(); parent::is_webhook_configured(); @@ -793,4 +795,24 @@ public function notice_message_live_key_changed() { test_mode ) { + // translators: notice message enabled test mode. + $notice_message = sprintf( __( 'You just enabled test mode, meaning your test API key will now be used. Please note that all subscription products previously linked to plans on your live account are no longer linked. If you try to purchase a subscription product now, an error will occur. Disabling test mode will restore all connections. Read more about this here.', 'reepay-checkout-gateway' ), 'https://optimize-docs.billwerk.com/reference/account' ); + } else { + // translators: notice message disabled test mode. + $notice_message = sprintf( __( 'You just disabled test mode, meaning your live API key will now be used. Please note that all subscription products previously linked to plans on your live account are now restored. If you haven\'t linked your subscription products with your test account, they will remain unlinked. Read more about this here.', 'reepay-checkout-gateway' ), 'https://optimize-docs.billwerk.com/reference/account' ); + } + } + ?> +
+

+
+

get_method_title() ); ?>

-get_setting( 'test_mode' ) ) { - // translators: notice message enabled test mode. - $notice_message = sprintf( __( 'You just enabled test mode, meaning your test API key will now be used. Please note that all subscription products previously linked to plans on your live account are no longer linked. If you try to purchase a subscription product now, an error will occur. Disabling test mode will restore all connections. Read more about this here.', 'reepay-checkout-gateway' ), 'https://optimize-docs.billwerk.com/reference/account' ); - } else { - // translators: notice message disabled test mode. - $notice_message = sprintf( __( 'You just disabled test mode, meaning your live API key will now be used. Please note that all subscription products previously linked to plans on your live account are now restored. If you haven\'t linked your subscription products with your test account, they will remain unlinked. Read more about this here.', 'reepay-checkout-gateway' ), 'https://optimize-docs.billwerk.com/reference/account' ); - } -} -?> -
-

-
- get_method_description() ) ); ?>

From 7bc25487aada2281821ae90adb85d217679a46c7 Mon Sep 17 00:00:00 2001 From: Pond Date: Tue, 23 Jul 2024 14:38:38 +0700 Subject: [PATCH 06/11] Fix code standard --- includes/Gateways/ReepayCheckout.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/Gateways/ReepayCheckout.php b/includes/Gateways/ReepayCheckout.php index 2a47d442..df4b8623 100644 --- a/includes/Gateways/ReepayCheckout.php +++ b/includes/Gateways/ReepayCheckout.php @@ -799,8 +799,8 @@ public function notice_message_live_key_changed() { /** * Message notice enabled or disabled test mode */ - public function notice_message_test_mode_enabled(){ - if (is_plugin_active('reepay-subscriptions-for-woocommerce/reepay-subscriptions-for-woocommerce.php')) { + public function notice_message_test_mode_enabled() { + if ( is_plugin_active( 'reepay-subscriptions-for-woocommerce/reepay-subscriptions-for-woocommerce.php' ) ) { if ( 'yes' === $this->test_mode ) { // translators: notice message enabled test mode. $notice_message = sprintf( __( 'You just enabled test mode, meaning your test API key will now be used. Please note that all subscription products previously linked to plans on your live account are no longer linked. If you try to purchase a subscription product now, an error will occur. Disabling test mode will restore all connections. Read more about this here.', 'reepay-checkout-gateway' ), 'https://optimize-docs.billwerk.com/reference/account' ); From 92e306629b8093c32681d13db29f6c909ec17f7c Mon Sep 17 00:00:00 2001 From: Pond Date: Wed, 24 Jul 2024 11:12:13 +0700 Subject: [PATCH 07/11] Fix condition show notice message test mode enabled --- includes/Gateways/ReepayCheckout.php | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/includes/Gateways/ReepayCheckout.php b/includes/Gateways/ReepayCheckout.php index df4b8623..e2d5dff4 100644 --- a/includes/Gateways/ReepayCheckout.php +++ b/includes/Gateways/ReepayCheckout.php @@ -616,21 +616,20 @@ public function process_admin_options(): bool { $current_key = $this->private_key ?? ''; $woocommerce_reepay_checkout_private_key = isset( $_POST['woocommerce_reepay_checkout_private_key'] ) ? wc_clean( $_POST['woocommerce_reepay_checkout_private_key'] ) : ''; - if ( $current_key !== $woocommerce_reepay_checkout_private_key ) { + $this->init_settings(); + $this->private_key = $this->settings['private_key'] ?? $this->private_key; + $this->private_key_test = $this->settings['private_key_test'] ?? $this->private_key_test; + $this->test_mode = $this->settings['test_mode'] ?? $this->test_mode; + + if ( $current_key !== $woocommerce_reepay_checkout_private_key || $current_key !== $this->private_key_test ) { Statistics::private_key_activated(); /** * Add action notic message live key changed */ add_action( 'woocommerce_update_options_checkout', array( $this, 'notice_message_live_key_changed' ) ); + add_action( 'woocommerce_update_options_checkout', array( $this, 'notice_message_test_mode_enabled' ) ); } - $this->init_settings(); - $this->private_key = $this->settings['private_key'] ?? $this->private_key; - $this->private_key_test = $this->settings['private_key_test'] ?? $this->private_key_test; - $this->test_mode = $this->settings['test_mode'] ?? $this->test_mode; - - add_action( 'woocommerce_update_options_checkout', array( $this, 'notice_message_test_mode_enabled' ) ); - reepay()->reset_settings(); parent::is_webhook_configured(); From 89cc832bb02cb50c729622531ea61be7bcfb000d Mon Sep 17 00:00:00 2001 From: ZenTBelL Date: Wed, 24 Jul 2024 14:32:11 +0700 Subject: [PATCH 08/11] [Fix] Settled amount higher than authorized amount when discount applied. --- includes/Gateways/ReepayGateway.php | 4 ++-- includes/OrderFlow/OrderCapture.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/includes/Gateways/ReepayGateway.php b/includes/Gateways/ReepayGateway.php index 3abe5ca6..318c0afa 100644 --- a/includes/Gateways/ReepayGateway.php +++ b/includes/Gateways/ReepayGateway.php @@ -1429,7 +1429,7 @@ public function get_order_items( WC_Order $order, bool $only_not_settled = false $price = OrderCapture::get_item_price( $order_item, $order ); $tax_percent = $price['tax_percent']; - $unit_price = round( ( $prices_incl_tax ? $price['with_tax'] : $price['original'] ) / $order_item->get_quantity(), 2 ); + $unit_price = round( ( $prices_incl_tax ? $price['with_tax_and_discount'] : $price['original_with_discount'] ) / $order_item->get_quantity(), 2 ); if ( $only_not_settled && ! empty( $order_item->get_meta( 'settled' ) ) ) { continue; @@ -1453,7 +1453,7 @@ public function get_order_items( WC_Order $order, bool $only_not_settled = false $tax_percent = $price['tax_percent']; - $unit_price = round( ( $prices_incl_tax ? $price['with_tax'] : $price['original'] ) / $item_shipping->get_quantity(), 2 ); + $unit_price = round( ( $prices_incl_tax ? $price['with_tax_and_discount'] : $price['original_with_discount'] ) / $item_shipping->get_quantity(), 2 ); if ( $only_not_settled && ! empty( $item_shipping->get_meta( 'settled' ) ) ) { continue; diff --git a/includes/OrderFlow/OrderCapture.php b/includes/OrderFlow/OrderCapture.php index 82e0f9ef..8f8b6949 100644 --- a/includes/OrderFlow/OrderCapture.php +++ b/includes/OrderFlow/OrderCapture.php @@ -490,8 +490,8 @@ public static function get_item_price( $order_item, WC_Order $order ): array { $tax = $price['with_tax'] - $price['original']; $price['tax_percent'] = ( $tax > 0 && $price['original'] > 0 ) ? round( 100 / ( $price['original'] / $tax ) ) : 0; - $price['original'] += $discount; - $price['with_tax'] += $discount; + $price['original_with_discount'] = $price['original'] + $discount; + $price['with_tax_and_discount'] = $price['with_tax'] + $discount; return $price; } From c5be8c9ddaf60f2f76fb3e6551d9392ebee59f00 Mon Sep 17 00:00:00 2001 From: Pond Date: Wed, 24 Jul 2024 15:26:26 +0700 Subject: [PATCH 09/11] Fix condition check action show notic message --- includes/Gateways/ReepayCheckout.php | 71 +++++++++++++++++----------- 1 file changed, 44 insertions(+), 27 deletions(-) diff --git a/includes/Gateways/ReepayCheckout.php b/includes/Gateways/ReepayCheckout.php index e2d5dff4..a30027e9 100644 --- a/includes/Gateways/ReepayCheckout.php +++ b/includes/Gateways/ReepayCheckout.php @@ -613,21 +613,34 @@ public function admin_options() { public function process_admin_options(): bool { parent::process_admin_options(); - $current_key = $this->private_key ?? ''; - $woocommerce_reepay_checkout_private_key = isset( $_POST['woocommerce_reepay_checkout_private_key'] ) ? wc_clean( $_POST['woocommerce_reepay_checkout_private_key'] ) : ''; + $current_key = $this->private_key ?? ''; + $current_test_mode = $this->test_mode; + $woocommerce_reepay_checkout_private_key = isset( $_POST['woocommerce_reepay_checkout_private_key'] ) ? wc_clean( $_POST['woocommerce_reepay_checkout_private_key'] ) : ''; + $woocommerce_reepay_checkout_private_key_test = isset( $_POST['woocommerce_reepay_checkout_private_key_test'] ) ? wc_clean( $_POST['woocommerce_reepay_checkout_private_key_test'] ) : ''; + $woocommerce_reepay_checkout_test_mode = isset( $_POST['woocommerce_reepay_checkout_test_mode'] ) ? 'yes' : 'no'; $this->init_settings(); $this->private_key = $this->settings['private_key'] ?? $this->private_key; $this->private_key_test = $this->settings['private_key_test'] ?? $this->private_key_test; $this->test_mode = $this->settings['test_mode'] ?? $this->test_mode; - if ( $current_key !== $woocommerce_reepay_checkout_private_key || $current_key !== $this->private_key_test ) { + if ( $current_key !== $woocommerce_reepay_checkout_private_key ) { Statistics::private_key_activated(); - /** - * Add action notic message live key changed - */ - add_action( 'woocommerce_update_options_checkout', array( $this, 'notice_message_live_key_changed' ) ); - add_action( 'woocommerce_update_options_checkout', array( $this, 'notice_message_test_mode_enabled' ) ); + } + + /** + * Condition check notic message. + */ + if ( is_plugin_active( 'reepay-subscriptions-for-woocommerce/reepay-subscriptions-for-woocommerce.php' ) ) { + if ( $current_test_mode !== $woocommerce_reepay_checkout_test_mode && $woocommerce_reepay_checkout_private_key !== $woocommerce_reepay_checkout_private_key_test ) { + if ( 'yes' === $this->test_mode ) { + add_action( 'woocommerce_update_options_checkout', array( $this, 'notice_message_test_mode_enabled' ) ); + } else { + add_action( 'woocommerce_update_options_checkout', array( $this, 'notice_message_test_mode_disabled' ) ); + } + } elseif ( $current_key !== $woocommerce_reepay_checkout_private_key ) { + add_action( 'woocommerce_update_options_checkout', array( $this, 'notice_message_live_key_changed' ) ); + } } reepay()->reset_settings(); @@ -784,30 +797,34 @@ public function get_localize_script_data(): array { * Message notice live key changed */ public function notice_message_live_key_changed() { - if ( is_plugin_active( 'reepay-subscriptions-for-woocommerce/reepay-subscriptions-for-woocommerce.php' ) ) { - // translators: notic message live key changed. - $notice_message = sprintf( __( 'The Api key identifies the Billwerk account. Only subscription plan handles that exist under the account of the API key can be used to submit subscription orders. Read more about this here.', 'reepay-checkout-gateway' ), 'https://optimize-docs.billwerk.com/reference/account' ); - ?> -
-

-
- Read more about this here.', 'reepay-checkout-gateway' ), 'https://optimize-docs.billwerk.com/reference/account' ); + ?> +
+

+
+ test_mode ) { - // translators: notice message enabled test mode. - $notice_message = sprintf( __( 'You just enabled test mode, meaning your test API key will now be used. Please note that all subscription products previously linked to plans on your live account are no longer linked. If you try to purchase a subscription product now, an error will occur. Disabling test mode will restore all connections. Read more about this here.', 'reepay-checkout-gateway' ), 'https://optimize-docs.billwerk.com/reference/account' ); - } else { - // translators: notice message disabled test mode. - $notice_message = sprintf( __( 'You just disabled test mode, meaning your live API key will now be used. Please note that all subscription products previously linked to plans on your live account are now restored. If you haven\'t linked your subscription products with your test account, they will remain unlinked. Read more about this here.', 'reepay-checkout-gateway' ), 'https://optimize-docs.billwerk.com/reference/account' ); - } - } + // translators: notice message enabled test mode. + $notice_message = sprintf( __( 'You just enabled test mode, meaning your test API key will now be used. Please note that all subscription products previously linked to plans on your live account are no longer linked. If you try to purchase a subscription product now, an error will occur. Disabling test mode will restore all connections. Read more about this here.', 'reepay-checkout-gateway' ), 'https://optimize-docs.billwerk.com/reference/account' ); + ?> +
+

+
+ Read more about this here.', 'reepay-checkout-gateway' ), 'https://optimize-docs.billwerk.com/reference/account' ); ?>

From 0ec3bce8ce5a21f8de328a09fa573e75b72982f9 Mon Sep 17 00:00:00 2001 From: Pond Date: Thu, 25 Jul 2024 13:23:16 +0700 Subject: [PATCH 10/11] Fix unit test order capture get_item_price --- tests/unit/orderFlow/OrderCaptureTest.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/unit/orderFlow/OrderCaptureTest.php b/tests/unit/orderFlow/OrderCaptureTest.php index 8dcd7636..2275f315 100644 --- a/tests/unit/orderFlow/OrderCaptureTest.php +++ b/tests/unit/orderFlow/OrderCaptureTest.php @@ -946,6 +946,8 @@ public function test_get_item_price_product() { 'original' => $price * $qty, 'with_tax' => $price * $qty, 'tax_percent' => 0, + 'original_with_discount' => $price * $qty, + 'with_tax_and_discount' => $price * $qty, ), OrderCapture::get_item_price( WC_Order_Factory::get_order_item( $order_item_id ), $this->order_generator->order() ) ); @@ -975,6 +977,8 @@ public function test_get_item_price_product_with_discount() { 'original' => $sale_price * $qty, 'with_tax' => $sale_price * $qty, 'tax_percent' => 0, + 'original_with_discount' => $sale_price * $qty, + 'with_tax_and_discount' => $sale_price * $qty, ), OrderCapture::get_item_price( WC_Order_Factory::get_order_item( $order_item_id ), $this->order_generator->order() ) ); @@ -1009,6 +1013,8 @@ public function test_get_item_price_product_with_taxes() { 'original' => $sale_price * $qty, 'with_tax' => round(( $sale_price * $qty ) * ( 1 + $tax_rate / 100 ), 2), 'tax_percent' => round($tax_rate), + 'original_with_discount' => $sale_price * $qty, + 'with_tax_and_discount' => round(( $sale_price * $qty ) * ( 1 + $tax_rate / 100 ), 2), ), OrderCapture::get_item_price( WC_Order_Factory::get_order_item( $order_item_id ), $this->order_generator->order() ) ); @@ -1031,6 +1037,8 @@ public function test_get_item_price_shipping() { 'original' => $price, 'with_tax' => $price, 'tax_percent' => 0, + 'original_with_discount' => $price, + 'with_tax_and_discount' => $price, ), OrderCapture::get_item_price( WC_Order_Factory::get_order_item( $order_item_id ), $this->order_generator->order() ) ); @@ -1053,6 +1061,8 @@ public function test_get_item_price_fee() { 'original' => $price, 'with_tax' => $price, 'tax_percent' => 0, + 'original_with_discount' => $price, + 'with_tax_and_discount' => $price, ), OrderCapture::get_item_price( WC_Order_Factory::get_order_item( $order_item_id ), $this->order_generator->order() ) ); From f9348a5ee7b3e4447ee59232b9a87f4f29b49362 Mon Sep 17 00:00:00 2001 From: Pond Date: Thu, 25 Jul 2024 17:41:21 +0700 Subject: [PATCH 11/11] Add changelog and change version to 1.7.7 --- Readme.txt | 11 ++++++++--- reepay-woocommerce-payment.php | 2 +- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/Readme.txt b/Readme.txt index c73bdb8e..baa750ec 100755 --- a/Readme.txt +++ b/Readme.txt @@ -4,7 +4,7 @@ Tags: billwerk+, visa, mastercard, dankort, mobilepay Requires at least: 4.0 Tested up to: 6.5.3 Requires PHP: 7.4 -Stable tag: 1.7.6.1 +Stable tag: 1.7.7 License: GPL License URI: http://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html @@ -18,8 +18,13 @@ The Billwerk+ Pay plugin extends WooCommerce allowing you to take payments on yo See installation guide right here: https://docu.billwerk.plus/help/en/apps/woocommerce/setup-woocommerce-plugin.html == Changelog == -v 1.7.6.1 - -* [Fix] - The Billwerk+ webhook customer_payment_method_added is missing the payment_method_reference data. We need to create a new rule to address this issue. +v 1.7.7 - +* [Fix] - Missing payment_method_reference data in the Billwerk+ customer_payment_method_added webhook could cause PHP fatal error. +* [Fix] - WooCommerce Subscriptions had issues with change of payment method where orders got payment authorized but were not automatically captured and set to complete. +* [Fix] - Instant capture didn't work for orders with discount. +* [Fix] - Amounts in order notes were wrong for "Failed to settle" notes and some captures. +* [Improvement] - A WordPress notice appears when the module starts to use another API key. This is because the subscriptions are defined in the Billwerk+ account, and the notice is only showed if the subscription module "Optimize" is installed. +* [Compatibility] - Billwerk+ Optimize version 1.2.7 v 1.7.6 - * [Fix] - Allow the activation of Santander and enforce a redirect for this payment. diff --git a/reepay-woocommerce-payment.php b/reepay-woocommerce-payment.php index 6f6bd65e..631a6f0a 100755 --- a/reepay-woocommerce-payment.php +++ b/reepay-woocommerce-payment.php @@ -4,7 +4,7 @@ * Description: Get a plug-n-play payment solution for WooCommerce, that is easy to use, highly secure and is built to maximize the potential of your e-commerce. * Author: Billwerk+ * Author URI: http://billwerk.plus - * Version: 1.7.6.1 + * Version: 1.7.7 * Text Domain: reepay-checkout-gateway * Domain Path: /languages * WC requires at least: 3.0.0