Changeset 3454688
- Timestamp:
- 02/05/2026 02:01:34 PM (2 months ago)
- Location:
- svea-checkout-for-woocommerce
- Files:
-
- 2 added
- 2 deleted
- 78 edited
- 1 copied
-
tags/3.5.0 (copied) (copied from svea-checkout-for-woocommerce/trunk)
-
tags/3.5.0/assets/js/frontend/application.min.js (modified) (1 diff)
-
tags/3.5.0/inc/Admin.php (modified) (1 diff)
-
tags/3.5.0/inc/Compat/Polylang_Compat.php (modified) (2 diffs)
-
tags/3.5.0/inc/Models/Svea_Checkout.php (modified) (1 diff)
-
tags/3.5.0/inc/Rule_Integration.php (modified) (5 diffs)
-
tags/3.5.0/inc/Session_Table.php (deleted)
-
tags/3.5.0/inc/Template_Handler.php (modified) (3 diffs)
-
tags/3.5.0/inc/WC_Gateway_Svea_Checkout.php (modified) (2 diffs)
-
tags/3.5.0/inc/Webhook_Handler.php (modified) (7 diffs)
-
tags/3.5.0/inc/settings-svea-checkout.php (modified) (2 diffs)
-
tags/3.5.0/readme.txt (modified) (3 diffs)
-
tags/3.5.0/svea-checkout-for-woocommerce.php (modified) (5 diffs)
-
tags/3.5.0/templates/svea-checkout.php (modified) (1 diff)
-
tags/3.5.0/vendor/autoload.php (modified) (1 diff)
-
tags/3.5.0/vendor/composer/autoload_classmap.php (modified) (1 diff)
-
tags/3.5.0/vendor/composer/autoload_real.php (modified) (2 diffs)
-
tags/3.5.0/vendor/composer/autoload_static.php (modified) (3 diffs)
-
tags/3.5.0/vendor/composer/installed.json (modified) (12 diffs)
-
tags/3.5.0/vendor/composer/installed.php (modified) (4 diffs)
-
tags/3.5.0/vendor/guzzlehttp/guzzle/CHANGELOG.md (modified) (1 diff)
-
tags/3.5.0/vendor/guzzlehttp/guzzle/composer.json (modified) (1 diff)
-
tags/3.5.0/vendor/guzzlehttp/guzzle/package-lock.json (added)
-
tags/3.5.0/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php (modified) (2 diffs)
-
tags/3.5.0/vendor/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php (modified) (1 diff)
-
tags/3.5.0/vendor/guzzlehttp/guzzle/src/Handler/StreamHandler.php (modified) (1 diff)
-
tags/3.5.0/vendor/guzzlehttp/guzzle/src/Middleware.php (modified) (1 diff)
-
tags/3.5.0/vendor/guzzlehttp/promises/CHANGELOG.md (modified) (1 diff)
-
tags/3.5.0/vendor/guzzlehttp/promises/README.md (modified) (1 diff)
-
tags/3.5.0/vendor/guzzlehttp/promises/composer.json (modified) (1 diff)
-
tags/3.5.0/vendor/guzzlehttp/psr7/CHANGELOG.md (modified) (1 diff)
-
tags/3.5.0/vendor/guzzlehttp/psr7/README.md (modified) (1 diff)
-
tags/3.5.0/vendor/guzzlehttp/psr7/composer.json (modified) (1 diff)
-
tags/3.5.0/vendor/guzzlehttp/psr7/src/MessageTrait.php (modified) (1 diff)
-
tags/3.5.0/vendor/guzzlehttp/psr7/src/Utils.php (modified) (2 diffs)
-
tags/3.5.0/vendor/sveaekonomi/checkout/README.md (modified) (3 diffs)
-
tags/3.5.0/vendor/sveaekonomi/checkout/VERSION (modified) (1 diff)
-
tags/3.5.0/vendor/sveaekonomi/checkout/composer.json (modified) (2 diffs)
-
tags/3.5.0/vendor/sveaekonomi/checkout/src/CheckoutClient.php (modified) (1 diff)
-
tags/3.5.0/vendor/sveaekonomi/checkout/src/Transport/ApiClient.php (modified) (2 diffs)
-
tags/3.5.0/vendor/sveaekonomi/checkout/src/Transport/Http/CurlRequest.php (modified) (1 diff)
-
tags/3.5.0/vendor/sveaekonomi/checkout/src/Validation/Admin/ValidateDeliverOrderData.php (modified) (1 diff)
-
trunk/assets/js/frontend/application.min.js (modified) (1 diff)
-
trunk/inc/Admin.php (modified) (1 diff)
-
trunk/inc/Compat/Polylang_Compat.php (modified) (2 diffs)
-
trunk/inc/Models/Svea_Checkout.php (modified) (1 diff)
-
trunk/inc/Rule_Integration.php (modified) (5 diffs)
-
trunk/inc/Session_Table.php (deleted)
-
trunk/inc/Template_Handler.php (modified) (3 diffs)
-
trunk/inc/WC_Gateway_Svea_Checkout.php (modified) (2 diffs)
-
trunk/inc/Webhook_Handler.php (modified) (7 diffs)
-
trunk/inc/settings-svea-checkout.php (modified) (2 diffs)
-
trunk/readme.txt (modified) (3 diffs)
-
trunk/svea-checkout-for-woocommerce.php (modified) (5 diffs)
-
trunk/templates/svea-checkout.php (modified) (1 diff)
-
trunk/vendor/autoload.php (modified) (1 diff)
-
trunk/vendor/composer/autoload_classmap.php (modified) (1 diff)
-
trunk/vendor/composer/autoload_real.php (modified) (2 diffs)
-
trunk/vendor/composer/autoload_static.php (modified) (3 diffs)
-
trunk/vendor/composer/installed.json (modified) (12 diffs)
-
trunk/vendor/composer/installed.php (modified) (4 diffs)
-
trunk/vendor/guzzlehttp/guzzle/CHANGELOG.md (modified) (1 diff)
-
trunk/vendor/guzzlehttp/guzzle/composer.json (modified) (1 diff)
-
trunk/vendor/guzzlehttp/guzzle/package-lock.json (added)
-
trunk/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php (modified) (2 diffs)
-
trunk/vendor/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php (modified) (1 diff)
-
trunk/vendor/guzzlehttp/guzzle/src/Handler/StreamHandler.php (modified) (1 diff)
-
trunk/vendor/guzzlehttp/guzzle/src/Middleware.php (modified) (1 diff)
-
trunk/vendor/guzzlehttp/promises/CHANGELOG.md (modified) (1 diff)
-
trunk/vendor/guzzlehttp/promises/README.md (modified) (1 diff)
-
trunk/vendor/guzzlehttp/promises/composer.json (modified) (1 diff)
-
trunk/vendor/guzzlehttp/psr7/CHANGELOG.md (modified) (1 diff)
-
trunk/vendor/guzzlehttp/psr7/README.md (modified) (1 diff)
-
trunk/vendor/guzzlehttp/psr7/composer.json (modified) (1 diff)
-
trunk/vendor/guzzlehttp/psr7/src/MessageTrait.php (modified) (1 diff)
-
trunk/vendor/guzzlehttp/psr7/src/Utils.php (modified) (2 diffs)
-
trunk/vendor/sveaekonomi/checkout/README.md (modified) (3 diffs)
-
trunk/vendor/sveaekonomi/checkout/VERSION (modified) (1 diff)
-
trunk/vendor/sveaekonomi/checkout/composer.json (modified) (2 diffs)
-
trunk/vendor/sveaekonomi/checkout/src/CheckoutClient.php (modified) (1 diff)
-
trunk/vendor/sveaekonomi/checkout/src/Transport/ApiClient.php (modified) (2 diffs)
-
trunk/vendor/sveaekonomi/checkout/src/Transport/Http/CurlRequest.php (modified) (1 diff)
-
trunk/vendor/sveaekonomi/checkout/src/Validation/Admin/ValidateDeliverOrderData.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
svea-checkout-for-woocommerce/tags/3.5.0/assets/js/frontend/application.min.js
r3320066 r3454688 1 (e=>{class t{constructor(e){this.$elm=e,this.isCompany="business"===wc_sco_params.default_company_type,this.validationCallbackListener=null,this.isCompanyListener=null,this.postalCodeListener=null,this.hasOngoingPayment=!1,this.syncZipCode=wc_sco_params.sync_zip_code,this.attributionKey=wc_sco_params.attribution_key,this.validationFailedMessage=wc_sco_params.validation_failed,this.ajaxUrl=wc_checkout_params.wc_ajax_url,this.refreshNonce=wc_sco_params.refresh_sco_snippet_nonce,this.checkoutNonce=wc_sco_params.sco_checkout_order,this.nShiftNonce=wc_sco_params.update_sco_order_nshift_information,this.checkoutNonceSelector="#woocommerce-process-checkout-nonce",this.attachEvents()}attachEvents(){const t=()=>{this.observeSveaData(),e(".svea-skeleton-loader").remove()};"scoApi"in window&&window.scoApi?t():e(document).on("checkoutReady",t),this.attachCheckoutEvents()}attachCheckoutEvents(){this.currentCountry=e(".wc-svea-checkout-page #billing_country").val(),this.currentState=e(".wc-svea-checkout-page #billing_state").val(),e(document).on("change",".wc-svea-checkout-page #billing_country",(t=>{const s=e(".wc-svea-checkout-page #billing_country").val();this.currentCountry!=s&&(this.refreshData(),this.currentCountry=s)})),e(document).on("change",".wc-svea-checkout-page #billing_state",(t=>{const s=e(".wc-svea-checkout-page #billing_state").val();this.currentState!=s&&(this.refreshData(),this.currentState=s)})),e(document).on("change",".wc-svea-checkout-page #shipping_method .shipping_method",this.refreshData.bind(this));if(e(document).on("change",[".woocommerce-additional-fields input",".woocommerce-additional-fields textarea",".woocommerce-additional-fields select"].join(", "),this.maybeTriggerReloadOfSvea.bind(this)),window.wc_sco_compat&&window.wc_sco_compat.fields_trigger_update.length){const t=window.wc_sco_compat.fields_trigger_update.join(", ");e(document).on("change",t,this.refreshData.bind(this))}e(document).on("sco_refresh_data",this.refreshData.bind(this)),e("body").on("update_checkout",this.refreshData.bind(this)),e("body").on("click","#sco-change-payment",this.changePaymentMethod.bind(this))}maybeTriggerReloadOfSvea(){this.hasOngoingPayment&&(window.scoApi.setCheckoutEnabled(!1),window.scoApi.setCheckoutEnabled(!0))}observeSveaData(){"1"===this.syncZipCode&&(this.postalCodeListener&&this.postalCodeListener(),this.postalCodeListener=window.scoApi.observeEvent("identity.postalCode",this.postalCodeChange.bind(this))),document.removeEventListener("sveaCheckout:errorValidationCallback",this.validationError.bind(this)),document.addEventListener("sveaCheckout:errorValidationCallback",this.validationError.bind(this)),document.removeEventListener("sveaCheckout:shippingConfirmed",this.shippingConfirmed.bind(this)),document.addEventListener("sveaCheckout:shippingConfirmed",this.shippingConfirmed.bind(this)),this.isCompanyListener&&this.isCompanyListener(),this.isCompanyListener=window.scoApi.observeEvent("identity.isCompany",this.isCompanyChange.bind(this)),this.validationCallbackListener&&this.validationCallbackListener(),this.validationCallbackListener=window.scoApi.observeEvent("order.validationCallback",this.submitOrder.bind(this))}submitOrder(t){this.hasOngoingPayment=!0;const s=e("form.woocommerce-checkout").serialize(),o=this.serializeFormToObject(s),a=Object.assign(o,{post_data:s,security:this.checkoutNonce,ship_to_different_address:1,payment_method:"svea_checkout"});e.ajax({type:"POST",url:this.ajaxUrl.toString().replace("%%endpoint%%","sco_checkout_order"),data:a,success:s=>{let o=!1;if(void 0!==s.result)if("failure"===s.result){if(s.reload)return void e.ajax({type:"GET",url:this.ajaxUrl.toString().replace("%%endpoint%%","sco_renew_nonce"),success:s=>{if(s.success)return e(this.checkoutNonceSelector).val(s.data.wc),this.checkoutNonce=s.data.sco,this.submitOrder(t)}});this.showErrors(s.messages)}else"success"===s.result&&(o=!0);t.callback&&t.callback({valid:o})}})}postalCodeChange(t){let s=e("#billing_postcode").val(),o=t.value||"";(o&&s!==o||"••••"===o)&&(e("#billing_postcode").val(o),this.refreshData())}isCompanyChange(e){void 0!==e.value&&e.value!==this.isCompany&&(this.isCompany=e.value,setTimeout((()=>{this.refreshData()})))}validationError(e){let t=e.detail.message||this.validationFailedMessage;this.showErrors(t,!0),this.refreshData(null,!0)}shippingConfirmed(t){const s={security:this.nShiftNonce,price:t.detail.price,name:t.detail.name};this.setCheckoutUpdating(!0),e.ajax({type:"POST",url:this.ajaxUrl.toString().replace("%%endpoint%%","update_sco_order_nshift_information"),data:s,success:e=>{e&&e.fragments&&this.updateFragments(e.fragments),this.setCheckoutUpdating(!1)}})}refreshData(t,s=!1){const o=e("form.woocommerce-checkout").serialize(),a=this.serializeFormToObject(o,!1);"object"==typeof s&&(s=!0);const i=Object.assign(a,{security:this.refreshNonce,post_data:o,force:s});this.setCheckoutUpdating(!0),e.ajax({type:"POST",url:this.ajaxUrl.toString().replace("%%endpoint%%","refresh_sco_snippet"),data:i,success:t=>{this.isUpdating=!1,!0!==t.reload&&"true"!==t.reload?(e(".woocommerce-NoticeGroup-updateOrderReview").remove(),t&&t.fragments&&this.updateFragments(t.fragments),"failure"===t.result&&(this.removeErrors(),t.messages?this.showErrors(t.messages):this.showErrors(t)),e(document.body).trigger("updated_checkout",[t]),this.setCheckoutUpdating(!1)):window.location.reload()},complete:()=>{this.isUpdating=!1}})}updateFragments(t){e.each(t,(function(t,s){e(t).html(s),e(t).unblock()}))}showErrors(t,s=!1){this.removeErrors(),void 0===s&&(s=!0),s?this.$elm.prepend('<ul class="woocommerce-error"><li>'+t+"</li></ul>"):this.$elm.prepend(t),this.$elm.find(".input-text, select, input:checkbox").blur(),e("html, body").animate({scrollTop:this.$elm.offset().top-100},1e3)}setCheckoutUpdating(t){e(".wc-svea-checkout-page").toggleClass("updating",t),window.scoApi&&window.scoApi.setCheckoutEnabled(!t)}serializeFormToObject(e,t=!0){let s={};return e.split("&").forEach((e=>{let[o,a]=e.split("=");(t||0!==o.indexOf(this.attributionKey))&&(s[decodeURIComponent(o)]=decodeURIComponent(a))})),s}removeErrors(){e(".woocommerce-error, .woocommerce-message").remove()}changePaymentMethod(t){t.preventDefault(),e.ajax({url:wc_checkout_params.wc_ajax_url.toString().replace("%%endpoint%%","sco_change_payment_method"),method:"POST",data:{svea:!1,security:wc_ checkout_params.change_payment_method},success:e=>{e.success&&window.location.reload()}})}static instance(){e(this).length>0&&e(this).each(((s,o)=>{o.sveaCheckout=new t(e(o))}))}}function s(t){"svea_checkout"===t&&e.ajax({url:wc_checkout_params.wc_ajax_url.toString().replace("%%endpoint%%","sco_change_payment_method"),method:"POST",data:{svea:!0,security:wc_checkout_params.change_payment_method},success:e=>{e.success&&window.location.reload()}})}e.fn.sveaCheckout=t.instance,e(document).ready((t=>{e(".wc-svea-checkout-page").sveaCheckout(),e(document.body).on("init_checkout",(t=>{e("body").on("change","input[name=payment_method]",(t=>{s(e(t.target).val()),console.log("change")})),e(document.body).on("updated_checkout",(()=>{s(e("input[name=payment_method]:checked").val())}))}))}))})(jQuery);1 (e=>{class t{constructor(e){this.$elm=e,this.isCompany="business"===wc_sco_params.default_company_type,this.validationCallbackListener=null,this.isCompanyListener=null,this.postalCodeListener=null,this.hasOngoingPayment=!1,this.syncZipCode=wc_sco_params.sync_zip_code,this.attributionKey=wc_sco_params.attribution_key,this.validationFailedMessage=wc_sco_params.validation_failed,this.ajaxUrl=wc_checkout_params.wc_ajax_url,this.refreshNonce=wc_sco_params.refresh_sco_snippet_nonce,this.checkoutNonce=wc_sco_params.sco_checkout_order,this.nShiftNonce=wc_sco_params.update_sco_order_nshift_information,this.checkoutNonceSelector="#woocommerce-process-checkout-nonce",this.attachEvents()}attachEvents(){const t=()=>{this.observeSveaData(),e(".svea-skeleton-loader").remove()};"scoApi"in window&&window.scoApi?t():e(document).on("checkoutReady",t),this.attachCheckoutEvents()}attachCheckoutEvents(){this.currentCountry=e(".wc-svea-checkout-page #billing_country").val(),this.currentState=e(".wc-svea-checkout-page #billing_state").val(),e(document).on("change",".wc-svea-checkout-page #billing_country",(t=>{const s=e(".wc-svea-checkout-page #billing_country").val();this.currentCountry!=s&&(this.refreshData(),this.currentCountry=s)})),e(document).on("change",".wc-svea-checkout-page #billing_state",(t=>{const s=e(".wc-svea-checkout-page #billing_state").val();this.currentState!=s&&(this.refreshData(),this.currentState=s)})),e(document).on("change",".wc-svea-checkout-page #shipping_method .shipping_method",this.refreshData.bind(this));if(e(document).on("change",[".woocommerce-additional-fields input",".woocommerce-additional-fields textarea",".woocommerce-additional-fields select"].join(", "),this.maybeTriggerReloadOfSvea.bind(this)),window.wc_sco_compat&&window.wc_sco_compat.fields_trigger_update.length){const t=window.wc_sco_compat.fields_trigger_update.join(", ");e(document).on("change",t,this.refreshData.bind(this))}e(document).on("sco_refresh_data",this.refreshData.bind(this)),e("body").on("update_checkout",this.refreshData.bind(this)),e("body").on("click","#sco-change-payment",this.changePaymentMethod.bind(this))}maybeTriggerReloadOfSvea(){this.hasOngoingPayment&&(window.scoApi.setCheckoutEnabled(!1),window.scoApi.setCheckoutEnabled(!0))}observeSveaData(){"1"===this.syncZipCode&&(this.postalCodeListener&&this.postalCodeListener(),this.postalCodeListener=window.scoApi.observeEvent("identity.postalCode",this.postalCodeChange.bind(this))),document.removeEventListener("sveaCheckout:errorValidationCallback",this.validationError.bind(this)),document.addEventListener("sveaCheckout:errorValidationCallback",this.validationError.bind(this)),document.removeEventListener("sveaCheckout:shippingConfirmed",this.shippingConfirmed.bind(this)),document.addEventListener("sveaCheckout:shippingConfirmed",this.shippingConfirmed.bind(this)),this.isCompanyListener&&this.isCompanyListener(),this.isCompanyListener=window.scoApi.observeEvent("identity.isCompany",this.isCompanyChange.bind(this)),this.validationCallbackListener&&this.validationCallbackListener(),this.validationCallbackListener=window.scoApi.observeEvent("order.validationCallback",this.submitOrder.bind(this))}submitOrder(t){this.hasOngoingPayment=!0;const s=e("form.woocommerce-checkout").serialize(),o=this.serializeFormToObject(s),a=Object.assign(o,{post_data:s,security:this.checkoutNonce,ship_to_different_address:1,payment_method:"svea_checkout"});e.ajax({type:"POST",url:this.ajaxUrl.toString().replace("%%endpoint%%","sco_checkout_order"),data:a,success:s=>{let o=!1;if(void 0!==s.result)if("failure"===s.result){if(s.reload)return void e.ajax({type:"GET",url:this.ajaxUrl.toString().replace("%%endpoint%%","sco_renew_nonce"),success:s=>{if(s.success)return e(this.checkoutNonceSelector).val(s.data.wc),this.checkoutNonce=s.data.sco,this.submitOrder(t)}});this.showErrors(s.messages)}else"success"===s.result&&(o=!0);t.callback&&t.callback({valid:o})}})}postalCodeChange(t){let s=e("#billing_postcode").val(),o=t.value||"";(o&&s!==o||"••••"===o)&&(e("#billing_postcode").val(o),this.refreshData())}isCompanyChange(e){void 0!==e.value&&e.value!==this.isCompany&&(this.isCompany=e.value,setTimeout((()=>{this.refreshData()})))}validationError(e){let t=e.detail.message||this.validationFailedMessage;this.showErrors(t,!0),this.refreshData(null,!0)}shippingConfirmed(t){const s={security:this.nShiftNonce,price:t.detail.price,name:t.detail.name};this.setCheckoutUpdating(!0),e.ajax({type:"POST",url:this.ajaxUrl.toString().replace("%%endpoint%%","update_sco_order_nshift_information"),data:s,success:e=>{e&&e.fragments&&this.updateFragments(e.fragments),this.setCheckoutUpdating(!1)}})}refreshData(t,s=!1){const o=e("form.woocommerce-checkout").serialize(),a=this.serializeFormToObject(o,!1);"object"==typeof s&&(s=!0);const i=Object.assign(a,{security:this.refreshNonce,post_data:o,force:s});this.setCheckoutUpdating(!0),e.ajax({type:"POST",url:this.ajaxUrl.toString().replace("%%endpoint%%","refresh_sco_snippet"),data:i,success:t=>{this.isUpdating=!1,!0!==t.reload&&"true"!==t.reload?(e(".woocommerce-NoticeGroup-updateOrderReview").remove(),t&&t.fragments&&this.updateFragments(t.fragments),"failure"===t.result&&(this.removeErrors(),t.messages?this.showErrors(t.messages):this.showErrors(t)),e(document.body).trigger("updated_checkout",[t]),this.setCheckoutUpdating(!1)):window.location.reload()},complete:()=>{this.isUpdating=!1}})}updateFragments(t){e.each(t,(function(t,s){e(t).html(s),e(t).unblock()}))}showErrors(t,s=!1){this.removeErrors(),void 0===s&&(s=!0),s?this.$elm.prepend('<ul class="woocommerce-error"><li>'+t+"</li></ul>"):this.$elm.prepend(t),this.$elm.find(".input-text, select, input:checkbox").blur(),e("html, body").animate({scrollTop:this.$elm.offset().top-100},1e3)}setCheckoutUpdating(t){e(".wc-svea-checkout-page").toggleClass("updating",t),window.scoApi&&window.scoApi.setCheckoutEnabled(!t)}serializeFormToObject(e,t=!0){let s={};return e.split("&").forEach((e=>{let[o,a]=e.split("=");(t||0!==o.indexOf(this.attributionKey))&&(s[decodeURIComponent(o)]=decodeURIComponent(a))})),s}removeErrors(){e(".woocommerce-error, .woocommerce-message").remove()}changePaymentMethod(t){t.preventDefault(),e.ajax({url:wc_checkout_params.wc_ajax_url.toString().replace("%%endpoint%%","sco_change_payment_method"),method:"POST",data:{svea:!1,security:wc_sco_params.change_payment_method},success:e=>{e.success&&window.location.reload()}})}static instance(){e(this).length>0&&e(this).each(((s,o)=>{o.sveaCheckout=new t(e(o))}))}}function s(t){"svea_checkout"===t&&e.ajax({url:wc_checkout_params.wc_ajax_url.toString().replace("%%endpoint%%","sco_change_payment_method"),method:"POST",data:{svea:!0,security:wc_sco_params.change_payment_method},success:e=>{e.success&&window.location.reload()}})}e.fn.sveaCheckout=t.instance,e(document).ready((t=>{e(".wc-svea-checkout-page").sveaCheckout(),e(document.body).on("init_checkout",(t=>{e("body").on("change","input[name=payment_method]",(t=>{s(e(t.target).val())})),e(document.body).on("updated_checkout",(()=>{s(e("input[name=payment_method]:checked").val())}))}))}))})(jQuery); -
svea-checkout-for-woocommerce/tags/3.5.0/inc/Admin.php
r3398960 r3454688 399 399 $wc_order->update_status( 'cancelled', esc_html__( 'Payment not accepted in Svea', 'svea-checkout-for-woocommerce' ) ); 400 400 } else { 401 if ( $wc_order->get_status() === self::AWAITING_ORDER_STATUS ) { 402 // Move through WooCommerce pending to support third-party status listeners before completion. 403 $wc_order->update_status( 'pending' ); 404 } 405 401 406 $wc_order->payment_complete( $svea_order_id ); 402 407 wp_clear_scheduled_hook( 'sco_check_pa_order_status', [ $svea_order_id ] ); -
svea-checkout-for-woocommerce/tags/3.5.0/inc/Compat/Polylang_Compat.php
r3202226 r3454688 50 50 */ 51 51 public function change_push_uri( $data ) { 52 if ( ! empty( $data['MerchantSettings'] ) && \function_exists( 'pll_current_language' ) ) {53 $language_slug = \pll_current_language();52 if ( ! empty( $data['MerchantSettings'] ) && function_exists( 'pll_current_language' ) ) { 53 $language_slug = pll_current_language(); 54 54 55 55 $args = [ … … 57 57 ]; 58 58 59 $data['MerchantSettings']['PushUri'] = $ data['MerchantSettings']['PushUri'] . '&' . http_build_query( $args);60 $data['MerchantSettings']['CheckoutValidationCallBackUri'] = $ data['MerchantSettings']['CheckoutValidationCallBackUri'] . '&' . http_build_query( $args);61 $data['MerchantSettings']['WebhookUri'] = $ data['MerchantSettings']['WebhookUri'] . '&' . http_build_query( $args);59 $data['MerchantSettings']['PushUri'] = $this->restore_curly_braces( add_query_arg( $args, $data['MerchantSettings']['PushUri'] ) ); 60 $data['MerchantSettings']['CheckoutValidationCallBackUri'] = $this->restore_curly_braces( add_query_arg( $args, $data['MerchantSettings']['CheckoutValidationCallBackUri'] ) ); 61 $data['MerchantSettings']['WebhookUri'] = $this->restore_curly_braces( add_query_arg( $args, $data['MerchantSettings']['WebhookUri'] ) ); 62 62 } 63 63 64 64 return $data; 65 65 } 66 67 /** 68 * Restore the curly bracers that add_query_arg might have destroyed 69 * 70 * @param string $url 71 * @return string 72 */ 73 private function restore_curly_braces( $url ) { 74 $url = str_replace( '%7B', '{', $url ); 75 $url = str_replace( '%7D', '}', $url ); 76 77 return $url; 78 } 66 79 } -
svea-checkout-for-woocommerce/tags/3.5.0/inc/Models/Svea_Checkout.php
r3398960 r3454688 194 194 case isset( $checkout_data['Recurring'] ) && $checkout_data['Recurring'] !== $this->is_recurring(): 195 195 case ! isset( $checkout_data['CountryCode'] ) || $checkout_data['CountryCode'] !== WC()->customer->get_billing_country(): 196 case $checkout_data['Status'] !== 'Created': 197 case $checkout_data['CountryCode'] !== WC()->customer->get_billing_country(): 198 case $checkout_data['Status'] === 'Final': 199 case $checkout_data['Status'] === 'Cancelled': 196 case strtoupper( $checkout_data['Status'] ) !== 'CREATED': 200 197 case ! isset( $checkout_data['MerchantSettings']['UseClientSideValidation'] ) || $checkout_data['MerchantSettings']['UseClientSideValidation'] !== true: 201 198 $need_new = true; -
svea-checkout-for-woocommerce/tags/3.5.0/inc/Rule_Integration.php
r3398960 r3454688 297 297 } 298 298 299 /** @var \WC_Product $product */ 299 300 $product = $item['data']; 300 301 … … 525 526 $is_company = ! empty( $svea_data['Customer']['IsCompany'] ) && $svea_data['Customer']['IsCompany'] === true; 526 527 $first_name = $billing_address['FirstName'] ?? ''; 528 $last_name = $billing_address['LastName'] ?? ''; 527 529 528 530 if ( ( empty( $first_name ) || empty( $last_name ) ) && ! empty( $billing_address['FullName'] ) ) { … … 712 714 private function send_event( $tag, array $subscriber, array $fields, $retrying = false, $action = null ) { 713 715 $endpoint = self::ENDPOINT; 714 715 if ( empty( $endpoint ) ) { 716 return false; 717 } 716 $subscriber_id = ''; 718 717 719 718 if ( $action === null ) { … … 743 742 if ( $action === 'create' ) { 744 743 $payload['update_on_duplicate'] = true; 745 } else { 746 if ( empty( $subscriber_id ) ) { 747 return false; 748 } 744 } else if ( empty( $subscriber_id ) ) { 745 return false; 749 746 } 750 747 … … 877 874 * @param string $method HTTP method. 878 875 * @param string $endpoint Endpoint URL. 879 * @param string $api_key Rule API key.880 876 * @param array|null $payload Optional payload. 881 877 * @return array|WP_Error -
svea-checkout-for-woocommerce/tags/3.5.0/inc/Template_Handler.php
r3439569 r3454688 266 266 } 267 267 268 // Check if there exists an order already 269 $current_order_id = WC()->session->get( 'order_awaiting_payment' ); 270 $current_sco_id = WC()->session->get( 'sco_order_id' ); 271 272 if ( $current_order_id && $current_sco_id ) { 273 // Load the order to see if it needs to be updated 274 $wc_order = wc_get_order( $current_order_id ); 275 276 if ( $wc_order && $wc_order->get_meta( '_svea_co_order_id' ) !== $current_sco_id ) { 277 // Remove the current order awaiting payment ID and create a new order 278 WC()->session->set( 'order_awaiting_payment', null ); 279 } 280 } 281 268 282 WC()->checkout()->process_checkout(); 269 283 wp_die( 0 ); … … 309 323 if ( $this->is_svea() && ! wp_doing_ajax() ) { 310 324 // Flush checkout fields cache 311 WC()->checkout()-> checkout_fields = null;325 WC()->checkout()->__set( 'checkout_fields', null ); 312 326 313 327 // Remove all default fields from WooCommerce to see what gets added by third party plugins … … 426 440 */ 427 441 public function change_payment_method() { 442 if ( ! isset( $_POST['security'] ) || ! wp_verify_nonce( $_POST['security'], 'change-payment-method' ) ) { 443 echo 'Nonce fail'; 444 exit; 445 } 446 428 447 $use_svea = isset( $_POST['svea'] ) && sanitize_text_field( $_POST['svea'] ) === 'true'; // phpcs:ignore WordPress.Security.NonceVerification.Missing 429 448 -
svea-checkout-for-woocommerce/tags/3.5.0/inc/WC_Gateway_Svea_Checkout.php
r3409597 r3454688 7 7 use Svea_Checkout_For_Woocommerce\Models\Svea_Checkout; 8 8 use Svea_Checkout_For_Woocommerce\Models\Svea_Payment_Admin; 9 use WP_Filesystem_Direct; 9 10 10 11 if ( ! defined( 'ABSPATH' ) ) { … … 1990 1991 1991 1992 /** 1993 * Generate HTML for Apple Pay certificate upload field 1994 * 1995 * @param string $key Field key 1996 * @param array $data Field data 1997 * @return string 1998 */ 1999 public function generate_apple_pay_certificate_html( $key, $data ) { 2000 $field_key = $this->get_field_key( $key ); 2001 $defaults = [ 2002 'title' => '', 2003 'disabled' => false, 2004 'class' => '', 2005 'css' => '', 2006 'placeholder' => '', 2007 'type' => 'file', 2008 'desc_tip' => false, 2009 'description' => '', 2010 'custom_attributes' => [], 2011 ]; 2012 2013 $data = wp_parse_args( $data, $defaults ); 2014 2015 // Check if certificate exists 2016 $cert_path = ABSPATH . '.well-known/apple-developer-merchantid-domain-association'; 2017 $cert_exists = file_exists( $cert_path ); 2018 2019 $description = sprintf( 2020 /* translators: %s: file path */ 2021 esc_html__( 'The upload will try to put the file here, if that\'s not correct then please upload the certificate manually: %s', 'svea-checkout-for-woocommerce' ), 2022 '<code>' . esc_html( $cert_path ) . '</code>' 2023 ); 2024 2025 if ( $cert_exists ) { 2026 $description .= '<br><strong style="color: green;">' . esc_html__( 'Certificate is currently uploaded.', 'svea-checkout-for-woocommerce' ) . '</strong>'; 2027 } 2028 2029 ob_start(); 2030 ?> 2031 <tr valign="top"> 2032 <th scope="row" class="titledesc"> 2033 <label for="<?php echo esc_attr( $field_key ); ?>"><?php echo wp_kses_post( $data['title'] ); ?></label> 2034 </th> 2035 <td class="forminp"> 2036 <fieldset> 2037 <legend class="screen-reader-text"><span><?php echo wp_kses_post( $data['title'] ); ?></span></legend> 2038 <input 2039 class="input-text regular-input <?php echo esc_attr( $data['class'] ); ?>" 2040 type="file" 2041 name="<?php echo esc_attr( $field_key ); ?>" 2042 id="<?php echo esc_attr( $field_key ); ?>" 2043 style="<?php echo esc_attr( $data['css'] ); ?>" 2044 <?php disabled( $data['disabled'], true ); ?> 2045 <?php echo $this->get_custom_attribute_html( $data ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?> 2046 /> 2047 <p class="description"><?php echo wp_kses_post( $description ); ?></p> 2048 </fieldset> 2049 </td> 2050 </tr> 2051 <?php 2052 return ob_get_clean(); 2053 } 2054 2055 /** 2056 * Process admin options and handle Apple Pay certificate upload 2057 * 2058 * @return bool 2059 */ 2060 public function process_admin_options() { 2061 // Handle Apple Pay certificate upload 2062 // Nonce verification is handled by WooCommerce parent class 2063 $field_key = $this->get_field_key( 'apple_pay_certificate' ); 2064 2065 // phpcs:ignore WordPress.Security.NonceVerification.Missing -- Nonce is verified by WooCommerce parent class 2066 if ( ! isset( $_FILES[ $field_key ] ) || empty( $_FILES[ $field_key ]['tmp_name'] ) ) { 2067 return parent::process_admin_options(); 2068 } 2069 2070 // phpcs:ignore WordPress.Security.NonceVerification.Missing, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- Nonce verified by parent, file validation done below 2071 $file = $_FILES[ $field_key ]; 2072 2073 // Validate file size (max 1MB for certificate files) 2074 $max_size = MB_IN_BYTES; 2075 if ( ! isset( $file['size'] ) || $file['size'] > $max_size ) { 2076 \WC_Admin_Settings::add_error( 2077 sprintf( 2078 /* translators: %s: maximum file size */ 2079 esc_html__( 'Apple Pay certificate file is too large. Maximum size is %s.', 'svea-checkout-for-woocommerce' ), 2080 size_format( $max_size ) 2081 ) 2082 ); 2083 return parent::process_admin_options(); 2084 } 2085 2086 // Validate file upload 2087 if ( $file['error'] !== UPLOAD_ERR_OK ) { 2088 \WC_Admin_Settings::add_error( 2089 esc_html__( 'Apple Pay certificate upload failed. Please try again.', 'svea-checkout-for-woocommerce' ) 2090 ); 2091 } else { 2092 // Validate content type - strict validation for security 2093 // Using finfo for MIME type detection as it's reliable and sufficient for this use case 2094 $allowed_types = [ 2095 'application/octet-stream', 2096 'text/plain', 2097 'application/x-apple-aspen-config', 2098 ]; 2099 2100 $finfo = finfo_open( FILEINFO_MIME_TYPE ); 2101 if ( false === $finfo ) { 2102 \WC_Admin_Settings::add_error( 2103 esc_html__( 'Failed to initialize file type detection. Please try again or contact your system administrator.', 'svea-checkout-for-woocommerce' ) 2104 ); 2105 } else { 2106 $mime_type = finfo_file( $finfo, $file['tmp_name'] ); 2107 finfo_close( $finfo ); 2108 2109 // Strict content type validation for security 2110 if ( ! in_array( $mime_type, $allowed_types, true ) ) { 2111 \WC_Admin_Settings::add_error( 2112 sprintf( 2113 /* translators: %s: detected MIME type */ 2114 esc_html__( 'Invalid file type detected: %s. Please upload the Apple Pay certificate file.', 'svea-checkout-for-woocommerce' ), 2115 esc_html( $mime_type ) 2116 ) 2117 ); 2118 } else { 2119 // Create .well-known directory if it doesn't exist 2120 $well_known_dir = ABSPATH . '.well-known'; 2121 if ( ! file_exists( $well_known_dir ) ) { 2122 $mkdir_result = wp_mkdir_p( $well_known_dir ); 2123 if ( false === $mkdir_result ) { 2124 \WC_Admin_Settings::add_error( 2125 esc_html__( 'Failed to create .well-known directory. Please check file permissions.', 'svea-checkout-for-woocommerce' ) 2126 ); 2127 return parent::process_admin_options(); 2128 } 2129 } 2130 2131 /** @var WP_Filesystem_direct $wp_filesystem */ 2132 global $wp_filesystem; 2133 require_once ABSPATH . 'wp-admin/includes/file.php'; 2134 // Initialize the WP filesystem 2135 WP_Filesystem(); 2136 2137 // Verify directory is writable 2138 if ( ! $wp_filesystem->is_writable( $well_known_dir ) ) { 2139 \WC_Admin_Settings::add_error( 2140 esc_html__( 'The .well-known directory is not writable. Please check file permissions.', 'svea-checkout-for-woocommerce' ) 2141 ); 2142 return parent::process_admin_options(); 2143 } 2144 2145 // Set target path - use fixed filename to prevent path traversal 2146 $target_filename = 'apple-developer-merchantid-domain-association'; 2147 $target_path = $well_known_dir . '/' . $target_filename; 2148 2149 // Verify target path is within expected directory (security check) 2150 $real_target_dir = realpath( dirname( $target_path ) ); 2151 $real_expected_dir = realpath( $well_known_dir ); 2152 if ( $real_target_dir !== $real_expected_dir ) { 2153 \WC_Admin_Settings::add_error( 2154 esc_html__( 'Invalid target path detected. Upload blocked for security.', 'svea-checkout-for-woocommerce' ) 2155 ); 2156 return parent::process_admin_options(); 2157 } 2158 2159 // Move the uploaded file 2160 if ( move_uploaded_file( $file['tmp_name'], $target_path ) ) { 2161 // Set appropriate permissions 2162 // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_operations_chmod -- Setting standard file permissions for uploaded certificate 2163 $chmod_result = chmod( $target_path, 0644 ); 2164 if ( false === $chmod_result ) { 2165 // Log warning but don't fail the upload 2166 self::log( 'Failed to set permissions on Apple Pay certificate file', 'warning' ); 2167 } 2168 2169 \WC_Admin_Settings::add_message( 2170 esc_html__( 'Apple Pay certificate uploaded successfully.', 'svea-checkout-for-woocommerce' ) 2171 ); 2172 } else { 2173 \WC_Admin_Settings::add_error( 2174 esc_html__( 'Failed to move Apple Pay certificate to target location. Please check file permissions.', 'svea-checkout-for-woocommerce' ) 2175 ); 2176 } 2177 } 2178 } 2179 } 2180 2181 // Call parent to handle other settings 2182 return parent::process_admin_options(); 2183 } 2184 2185 /** 1992 2186 * Initialize Gateway Settings Form Fields 1993 2187 */ -
svea-checkout-for-woocommerce/tags/3.5.0/inc/Webhook_Handler.php
r3409597 r3454688 83 83 84 84 /** 85 * Get caller IP 86 * 87 * @return string 85 * Get caller IP address for webhook validation. 86 * 87 * Security Note: IP restriction is only an additional defense layer and should not 88 * be the sole security measure. HTTP headers like X-Forwarded-For can be spoofed 89 * by attackers unless the server configuration properly strips client-supplied headers. 90 * 91 * For maximum security: 92 * - Use REMOTE_ADDR if not behind a reverse proxy 93 * - Ensure your reverse proxy/CDN strips client-supplied headers before adding its own 94 * - Consider implementing HMAC-based webhook authentication as the primary security control 95 * 96 * @return string IP address to validate 88 97 */ 89 98 private function get_referer_ip() { 90 if ( ! empty( $_SERVER['HTTP_CLIENT_IP'] ) ) { 91 $ip = $_SERVER['HTTP_CLIENT_IP']; 92 } else if ( ! empty( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) { 93 $ip = $_SERVER['HTTP_X_FORWARDED_FOR']; 94 } else { 95 $ip = $_SERVER['REMOTE_ADDR']; 96 } 97 98 return $ip; 99 $preferred_header = ''; 100 101 if ( $this->gateway ) { 102 $preferred_header = $this->get_configured_ip_header(); 103 } 104 105 $ip = $_SERVER['REMOTE_ADDR']; 106 107 if ( $preferred_header === 'yes' ) { // auto-detect 108 if ( ! empty( $_SERVER['HTTP_CLIENT_IP'] ) ) { 109 $ip = $_SERVER['HTTP_CLIENT_IP']; 110 } else if ( ! empty( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) { 111 $ip = $_SERVER['HTTP_X_FORWARDED_FOR']; 112 } 113 } else if ( ! empty( $_SERVER[ $preferred_header ] ) ) { 114 $ip = $_SERVER[ $preferred_header ]; 115 } 116 117 // Explode in case of multiple IPs from proxy 118 return explode( ',', $ip )[0]; 119 } 120 121 /** 122 * Get configured proxy header to trust. 123 * 124 * @return string "yes" for auto-detect, or specific header name. 125 */ 126 private function get_configured_ip_header() { 127 $header = $this->gateway->get_option( 'use_ip_restriction' ); 128 129 if ( $header === 'custom' ) { 130 $header = $this->gateway->get_option( 'ip_restriction_header' ); 131 132 if ( strpos( $header, 'HTTP_' ) !== 0 ) { 133 $header = 'HTTP_' . $header; 134 } 135 136 $header = str_replace( '-', '_', strtoupper( $header ) ); 137 // Strip any characters that are not alphanumeric or underscore to prevent header injection attacks 138 $header = preg_replace( '/[^A-Z0-9_]/', '', $header ); 139 } 140 141 return trim( $header ); 99 142 } 100 143 … … 105 148 */ 106 149 public function validate_referer() { 107 if ( $this->gateway->get_option( 'use_ip_restriction' ) !== 'yes' ) {150 if ( $this->gateway->get_option( 'use_ip_restriction' ) === 'no' ) { 108 151 return; 109 152 } 153 110 154 $ip_address = $this->get_referer_ip(); 111 155 $ref_ip = ip2long( $ip_address ); … … 145 189 146 190 $webhook_data = json_decode( $raw_webhook ); 147 $webhook_data->description = json_decode( $webhook_data->description );148 // phpcs:disable WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase149 $this->gateway::log( sprintf( 'Webhook callback received for Svea cart (%s) received', $webhook_data->orderId ) );150 191 151 192 $this->validate_referer(); 152 193 153 if ( empty( $webhook_data->orderId ) ) { 194 $svea_order_id = absint( $webhook_data->orderId ?? 0 ); // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase 195 if ( empty( $svea_order_id ) ) { 154 196 $this->gateway::log( 'No orderID was found. Aborting' ); 155 197 exit; 156 198 } 157 199 158 $wc_order = self::get_order_by_svea_id( $webhook_data->orderId ); 200 $wc_order = self::get_order_by_svea_id( $svea_order_id ); 201 202 if ( empty( $wc_order ) ) { 203 $this->gateway::log( 'Received webhook but the order does not exists' ); 204 exit; 205 } 206 207 // phpcs:disable WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase 208 $this->gateway::log( sprintf( 'Webhook callback received for Svea cart (%s) received', $svea_order_id ) ); 159 209 160 210 $svea_order = new Svea_Checkout( false ); … … 162 212 163 213 try { 164 self::$svea_order = $svea_order->get( $ webhook_data->orderId );214 self::$svea_order = $svea_order->get( $svea_order_id ); 165 215 } catch ( \Exception $e ) { 166 WC_Gateway_Svea_Checkout::log( sprintf( 'Error in push webhook when getting order id %s. Message from Svea: %s', $ this->svea_order_id, $e->getMessage() ) );216 WC_Gateway_Svea_Checkout::log( sprintf( 'Error in push webhook when getting order id %s. Message from Svea: %s', $svea_order_id, $e->getMessage() ) ); 167 217 status_header( 404 ); 168 218 exit; … … 197 247 } 198 248 199 if ( empty( $wc_order ) ) { 200 $this->gateway::log( sprintf( 'Received webhook but the order does not exists (%s)', $webhook_data->orderId ) ); 201 exit; 249 $shipping_information = self::$svea_order['ShippingInformation'] ?? []; 250 $shipping_provider = $shipping_information['ShippingProvider'] ?? []; 251 252 $shipping_type = sanitize_text_field( $shipping_provider['Type'] ?? $shipping_provider['type'] ?? '' ); 253 if ( ! empty( $shipping_type ) ) { 254 $wc_order->update_meta_data( '_sco_nshift_type', $shipping_type ); 255 } 256 257 $shipping_description = $shipping_provider['Description'] ?? $shipping_provider['description'] ?? null; 258 if ( is_array( $shipping_description ) ) { 259 $shipping_description = (object) $shipping_description; 260 } 261 262 if ( is_object( $shipping_description ) && ! empty( $shipping_description->tmsReference ) ) { 263 $wc_order->update_meta_data( '_sco_nshift_tms_ref', sanitize_text_field( $shipping_description->tmsReference ) ); 264 } 265 266 $selected_shipping_option = $shipping_provider['ShippingOption'] ?? []; 267 $carrier_id = ''; 268 $carrier_name = ''; 269 if ( empty( $selected_shipping_option ) && is_object( $shipping_description ) && ! empty( $shipping_description->selectedShippingOption ) ) { 270 $selected_shipping_option = $shipping_description->selectedShippingOption; 271 } 272 273 if ( is_array( $selected_shipping_option ) ) { 274 $carrier_id = sanitize_text_field( $selected_shipping_option['Id'] ?? $selected_shipping_option['id'] ?? '' ); 275 $carrier_name = sanitize_text_field( $selected_shipping_option['Carrier'] ?? $selected_shipping_option['carrier'] ?? '' ); 276 } 277 278 if ( ! empty( $carrier_id ) ) { 279 $wc_order->update_meta_data( '_sco_nshift_carrier_id', $carrier_id ); 280 } 281 282 if ( ! empty( $carrier_name ) ) { 283 $wc_order->update_meta_data( '_sco_nshift_carrier_name', $carrier_name ); 202 284 } 203 285 204 286 // Save the data 205 if ( ! empty( $webhook_data->type ) ) { 206 $wc_order->update_meta_data( '_sco_nshift_type', $webhook_data->type ); 207 } 208 209 if ( ! empty( $webhook_data->description->tmsReference ) ) { 210 $wc_order->update_meta_data( '_sco_nshift_tms_ref', $webhook_data->description->tmsReference ); 211 } 212 213 if ( ! empty( $webhook_data->description->selectedShippingOption ) ) { 214 $wc_order->update_meta_data( '_sco_nshift_carrier_id', $webhook_data->description->selectedShippingOption->id ); 215 $wc_order->update_meta_data( '_sco_nshift_carrier_name', $webhook_data->description->selectedShippingOption->carrier ); 216 } 217 218 // Save the whole thing as a complete string 219 $wc_order->update_meta_data( '_sco_nshift_data', $webhook_data ); 287 if ( ! empty( $shipping_information ) ) { 288 $wc_order->update_meta_data( '_sco_nshift_data', $shipping_information ); 289 } 220 290 221 291 $wc_order->save(); … … 538 608 } 539 609 540 if ( $this->gateway->get_option( 'use_ip_restriction' ) === 'yes' ) { 541 $this->validate_referer(); 542 } 610 $this->validate_referer(); 543 611 544 612 $this->gateway::log( sprintf( 'Received push for order %s', $this->svea_order_id ) ); … … 597 665 } 598 666 599 if ( $this->gateway->get_option( 'use_ip_restriction' ) === 'yes' ) { 600 $this->validate_referer(); 601 } 667 $this->validate_referer(); 602 668 603 669 $wc_order = wc_get_order( $wc_order_id ); -
svea-checkout-for-woocommerce/tags/3.5.0/inc/settings-svea-checkout.php
r3398960 r3454688 556 556 ], 557 557 'use_ip_restriction' => [ 558 'title' => esc_html__( 'Use IP restriction', 'svea-checkout-for-woocommerce' ), 559 'type' => 'checkbox', 558 'title' => esc_html__( 'IP restriction', 'svea-checkout-for-woocommerce' ), 559 'type' => 'select', 560 'options' => [ 561 'yes' => esc_html__( 'Yes (auto-detect)', 'svea-checkout-for-woocommerce' ), 562 'REMOTE_ADDR' => esc_html__( 'REMOTE_ADDR (No reverse proxy)', 'svea-checkout-for-woocommerce' ), 563 'HTTP_CLIENT_IP' => esc_html__( 'HTTP_CLIENT_IP', 'svea-checkout-for-woocommerce' ), 564 'HTTP_X_FORWARDED_FOR' => esc_html__( 'HTTP_X_FORWARDED_FOR', 'svea-checkout-for-woocommerce' ), 565 'custom' => esc_html__( 'Custom header', 'svea-checkout-for-woocommerce' ), 566 'no' => esc_html__( 'Disable', 'svea-checkout-for-woocommerce' ), 567 ], 568 'default' => 'REMOTE_ADDR', 560 569 'description' => __( 561 'Verify the IP to one of Sveas server.<br /> 562 This functionality only works if you do not use a reverse proxy on your server. <br /> 563 <strong>Do not touch this if you do not know what you are doing</strong>.', 570 '<strong>Security Notice:</strong> IP restriction provides an additional layer of defense but is not a complete security measure. When using "auto-detect" or custom headers, ensure your server configuration properly strips client-supplied headers to prevent IP spoofing. Use "REMOTE_ADDR (No reverse proxy)" for the most secure option if not behind a proxy. For production environments, consider implementing additional webhook authentication mechanisms.', 564 571 'svea-checkout-for-woocommerce' 565 572 ), 566 'default' => 'yes', 573 ], 574 'ip_restriction_header' => [ 575 'title' => esc_html__( 'IP restriction custom header', 'svea-checkout-for-woocommerce' ), 576 'type' => 'text', 577 'description' => __( 578 '<strong>Warning:</strong> Custom headers can be spoofed by attackers unless your server is properly configured to strip client-supplied headers. Only use this option if you are certain your reverse proxy or CDN is configured to set this header and remove any client-provided values. Example: HTTP_X_REAL_IP or X-Real-IP.', 579 'svea-checkout-for-woocommerce' 580 ), 581 'default' => '', 567 582 ], 568 583 'other_settings_hr' => [ … … 580 595 'default' => 'no', 581 596 ], 597 'apple_pay_hr' => [ 598 'title' => '<hr>', 599 'type' => 'title', 600 ], 601 'apple_pay_title' => [ 602 'title' => esc_html__( 'Apple Pay', 'svea-checkout-for-woocommerce' ), 603 'type' => 'title', 604 ], 605 'apple_pay_certificate' => [ 606 'title' => esc_html__( 'Apple Pay Certificate', 'svea-checkout-for-woocommerce' ), 607 'type' => 'apple_pay_certificate', 608 ], 582 609 ] 583 610 ); -
svea-checkout-for-woocommerce/tags/3.5.0/readme.txt
r3439569 r3454688 10 10 License: Apache 2.0 11 11 License URI: https://www.apache.org/licenses/LICENSE-2.0 12 Stable tag: 3. 4.312 Stable tag: 3.5.0 13 13 14 14 Supercharge your WooCommerce Store with powerful features to pay via Svea Checkout! … … 91 91 == Upgrade Notice == 92 92 93 = 3.5.0 = 94 3.5.0 is a minor release 95 93 96 = 3.4.3 = 94 97 3.4.3 is a patch release … … 420 423 421 424 == Changelog == 425 426 = 3.5.0 2026-02-05 = 427 - Updated to the latest SDK version for Svea Checkout (1.7.0) which includes a timeout for API requests. 428 - Allow custom headers to be used for IP-restriction. 429 - Changed the order flow of a pending order to go via the "Awaiting payment" to ensure third party plugins can use the same hooks as for non pending orders. 430 - Added Apple Pay certificate upload setting in gateway configuration. 431 - Ensure the usage of nonces across all ajax requests. 432 - Ensure escaping of all output in the template. 433 - Use information from the Checkout API instead of post body when using nShift. 434 - Removed legacy code for session table which isn't needed anymore. 422 435 423 436 = 3.4.3 2026-01-14 = -
svea-checkout-for-woocommerce/tags/3.5.0/svea-checkout-for-woocommerce.php
r3439569 r3454688 3 3 namespace Svea_Checkout_For_Woocommerce; 4 4 5 use Svea\Checkout\Transport\Connector; 5 6 use Svea_Checkout_For_Woocommerce\Compat\Compat; 6 7 … … 14 15 * Plugin URI: https://wordpress.org/plugins/svea-checkout-for-woocommerce/ 15 16 * Description: Process payments in WooCommerce via Svea Checkout. 16 * Version: 3. 4.317 * Version: 3.5.0 17 18 * Requires Plugins: woocommerce 18 19 * Author: The Generation AB … … 47 48 * Version of plugin 48 49 */ 49 const VERSION = '3. 4.3';50 const VERSION = '3.5.0'; 50 51 51 52 /** … … 62 63 */ 63 64 public $instore; 64 65 /**66 * Session_Table class67 *68 * @var Session_Table69 */70 public $session_table;71 65 72 66 /** … … 286 280 $this->instore = new Instore(); 287 281 $this->instore->init(); 288 289 $this->session_table = new Session_Table();290 $this->session_table->init();291 282 } 292 283 -
svea-checkout-for-woocommerce/tags/3.5.0/templates/svea-checkout.php
r3320066 r3454688 68 68 69 69 <div class="order-review-wrapper"> 70 <input id="billing_postcode" type="hidden" name="billing_postcode" value="<?php echo WC()->customer->get_billing_postcode(); ?>">70 <input id="billing_postcode" type="hidden" name="billing_postcode" value="<?php echo esc_attr( WC()->customer->get_billing_postcode() ); ?>"> 71 71 72 72 <?php do_action( 'woocommerce_checkout_before_order_review_heading' ); ?> -
svea-checkout-for-woocommerce/tags/3.5.0/vendor/autoload.php
r3320066 r3454688 20 20 require_once __DIR__ . '/composer/autoload_real.php'; 21 21 22 return ComposerAutoloaderInit 4cfdf47045179a2c4f6ff86b1bce3df2::getLoader();22 return ComposerAutoloaderInit07e217451f0a071aa7dcb642a1b22b09::getLoader(); -
svea-checkout-for-woocommerce/tags/3.5.0/vendor/composer/autoload_classmap.php
r3398960 r3454688 212 212 'Svea_Checkout_For_Woocommerce\\Rule_Integration' => $baseDir . '/inc/Rule_Integration.php', 213 213 'Svea_Checkout_For_Woocommerce\\Scripts' => $baseDir . '/inc/Scripts.php', 214 'Svea_Checkout_For_Woocommerce\\Session_Table' => $baseDir . '/inc/Session_Table.php',215 214 'Svea_Checkout_For_Woocommerce\\Template_Handler' => $baseDir . '/inc/Template_Handler.php', 216 215 'Svea_Checkout_For_Woocommerce\\Utils\\Array_Utils' => $baseDir . '/inc/Utils/Array_Utils.php', -
svea-checkout-for-woocommerce/tags/3.5.0/vendor/composer/autoload_real.php
r3320066 r3454688 3 3 // autoload_real.php @generated by Composer 4 4 5 class ComposerAutoloaderInit 4cfdf47045179a2c4f6ff86b1bce3df25 class ComposerAutoloaderInit07e217451f0a071aa7dcb642a1b22b09 6 6 { 7 7 private static $loader; … … 25 25 require __DIR__ . '/platform_check.php'; 26 26 27 spl_autoload_register(array('ComposerAutoloaderInit 4cfdf47045179a2c4f6ff86b1bce3df2', 'loadClassLoader'), true, true);27 spl_autoload_register(array('ComposerAutoloaderInit07e217451f0a071aa7dcb642a1b22b09', 'loadClassLoader'), true, true); 28 28 self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__)); 29 spl_autoload_unregister(array('ComposerAutoloaderInit 4cfdf47045179a2c4f6ff86b1bce3df2', 'loadClassLoader'));29 spl_autoload_unregister(array('ComposerAutoloaderInit07e217451f0a071aa7dcb642a1b22b09', 'loadClassLoader')); 30 30 31 31 require __DIR__ . '/autoload_static.php'; 32 call_user_func(\Composer\Autoload\ComposerStaticInit 4cfdf47045179a2c4f6ff86b1bce3df2::getInitializer($loader));32 call_user_func(\Composer\Autoload\ComposerStaticInit07e217451f0a071aa7dcb642a1b22b09::getInitializer($loader)); 33 33 34 34 $loader->register(true); 35 35 36 $filesToLoad = \Composer\Autoload\ComposerStaticInit 4cfdf47045179a2c4f6ff86b1bce3df2::$files;36 $filesToLoad = \Composer\Autoload\ComposerStaticInit07e217451f0a071aa7dcb642a1b22b09::$files; 37 37 $requireFile = \Closure::bind(static function ($fileIdentifier, $file) { 38 38 if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { -
svea-checkout-for-woocommerce/tags/3.5.0/vendor/composer/autoload_static.php
r3398960 r3454688 5 5 namespace Composer\Autoload; 6 6 7 class ComposerStaticInit 4cfdf47045179a2c4f6ff86b1bce3df27 class ComposerStaticInit07e217451f0a071aa7dcb642a1b22b09 8 8 { 9 9 public static $files = array ( … … 275 275 'Svea_Checkout_For_Woocommerce\\Rule_Integration' => __DIR__ . '/../..' . '/inc/Rule_Integration.php', 276 276 'Svea_Checkout_For_Woocommerce\\Scripts' => __DIR__ . '/../..' . '/inc/Scripts.php', 277 'Svea_Checkout_For_Woocommerce\\Session_Table' => __DIR__ . '/../..' . '/inc/Session_Table.php',278 277 'Svea_Checkout_For_Woocommerce\\Template_Handler' => __DIR__ . '/../..' . '/inc/Template_Handler.php', 279 278 'Svea_Checkout_For_Woocommerce\\Utils\\Array_Utils' => __DIR__ . '/../..' . '/inc/Utils/Array_Utils.php', … … 287 286 { 288 287 return \Closure::bind(function () use ($loader) { 289 $loader->prefixLengthsPsr4 = ComposerStaticInit 4cfdf47045179a2c4f6ff86b1bce3df2::$prefixLengthsPsr4;290 $loader->prefixDirsPsr4 = ComposerStaticInit 4cfdf47045179a2c4f6ff86b1bce3df2::$prefixDirsPsr4;291 $loader->classMap = ComposerStaticInit 4cfdf47045179a2c4f6ff86b1bce3df2::$classMap;288 $loader->prefixLengthsPsr4 = ComposerStaticInit07e217451f0a071aa7dcb642a1b22b09::$prefixLengthsPsr4; 289 $loader->prefixDirsPsr4 = ComposerStaticInit07e217451f0a071aa7dcb642a1b22b09::$prefixDirsPsr4; 290 $loader->classMap = ComposerStaticInit07e217451f0a071aa7dcb642a1b22b09::$classMap; 292 291 293 292 }, null, ClassLoader::class); -
svea-checkout-for-woocommerce/tags/3.5.0/vendor/composer/installed.json
r3320066 r3454688 3 3 { 4 4 "name": "guzzlehttp/guzzle", 5 "version": "7. 9.3",6 "version_normalized": "7. 9.3.0",5 "version": "7.10.0", 6 "version_normalized": "7.10.0.0", 7 7 "source": { 8 8 "type": "git", 9 9 "url": "https://github.com/guzzle/guzzle.git", 10 "reference": " 7b2f29fe81dc4da0ca0ea7d42107a0845946ea77"11 }, 12 "dist": { 13 "type": "zip", 14 "url": "https://api.github.com/repos/guzzle/guzzle/zipball/ 7b2f29fe81dc4da0ca0ea7d42107a0845946ea77",15 "reference": " 7b2f29fe81dc4da0ca0ea7d42107a0845946ea77",10 "reference": "b51ac707cfa420b7bfd4e4d5e510ba8008e822b4" 11 }, 12 "dist": { 13 "type": "zip", 14 "url": "https://api.github.com/repos/guzzle/guzzle/zipball/b51ac707cfa420b7bfd4e4d5e510ba8008e822b4", 15 "reference": "b51ac707cfa420b7bfd4e4d5e510ba8008e822b4", 16 16 "shasum": "" 17 17 }, 18 18 "require": { 19 19 "ext-json": "*", 20 "guzzlehttp/promises": "^ 1.5.3 || ^2.0.3",21 "guzzlehttp/psr7": "^2. 7.0",20 "guzzlehttp/promises": "^2.3", 21 "guzzlehttp/psr7": "^2.8", 22 22 "php": "^7.2.5 || ^8.0", 23 23 "psr/http-client": "^1.0", … … 40 40 "psr/log": "Required for using the Log middleware" 41 41 }, 42 "time": "2025-0 3-27T13:37:11+00:00",42 "time": "2025-08-23T22:36:01+00:00", 43 43 "type": "library", 44 44 "extra": { … … 112 112 "support": { 113 113 "issues": "https://github.com/guzzle/guzzle/issues", 114 "source": "https://github.com/guzzle/guzzle/tree/7. 9.3"114 "source": "https://github.com/guzzle/guzzle/tree/7.10.0" 115 115 }, 116 116 "funding": [ … … 132 132 { 133 133 "name": "guzzlehttp/promises", 134 "version": "2. 2.0",135 "version_normalized": "2. 2.0.0",134 "version": "2.3.0", 135 "version_normalized": "2.3.0.0", 136 136 "source": { 137 137 "type": "git", 138 138 "url": "https://github.com/guzzle/promises.git", 139 "reference": " 7c69f28996b0a6920945dd20b3857e499d9ca96c"140 }, 141 "dist": { 142 "type": "zip", 143 "url": "https://api.github.com/repos/guzzle/promises/zipball/ 7c69f28996b0a6920945dd20b3857e499d9ca96c",144 "reference": " 7c69f28996b0a6920945dd20b3857e499d9ca96c",139 "reference": "481557b130ef3790cf82b713667b43030dc9c957" 140 }, 141 "dist": { 142 "type": "zip", 143 "url": "https://api.github.com/repos/guzzle/promises/zipball/481557b130ef3790cf82b713667b43030dc9c957", 144 "reference": "481557b130ef3790cf82b713667b43030dc9c957", 145 145 "shasum": "" 146 146 }, … … 150 150 "require-dev": { 151 151 "bamarni/composer-bin-plugin": "^1.8.2", 152 "phpunit/phpunit": "^8.5. 39 || ^9.6.20"153 }, 154 "time": "2025-0 3-27T13:27:01+00:00",152 "phpunit/phpunit": "^8.5.44 || ^9.6.25" 153 }, 154 "time": "2025-08-22T14:34:08+00:00", 155 155 "type": "library", 156 156 "extra": { … … 198 198 "support": { 199 199 "issues": "https://github.com/guzzle/promises/issues", 200 "source": "https://github.com/guzzle/promises/tree/2. 2.0"200 "source": "https://github.com/guzzle/promises/tree/2.3.0" 201 201 }, 202 202 "funding": [ … … 218 218 { 219 219 "name": "guzzlehttp/psr7", 220 "version": "2. 7.1",221 "version_normalized": "2. 7.1.0",220 "version": "2.8.0", 221 "version_normalized": "2.8.0.0", 222 222 "source": { 223 223 "type": "git", 224 224 "url": "https://github.com/guzzle/psr7.git", 225 "reference": " c2270caaabe631b3b44c85f99e5a04bbb8060d16"226 }, 227 "dist": { 228 "type": "zip", 229 "url": "https://api.github.com/repos/guzzle/psr7/zipball/ c2270caaabe631b3b44c85f99e5a04bbb8060d16",230 "reference": " c2270caaabe631b3b44c85f99e5a04bbb8060d16",225 "reference": "21dc724a0583619cd1652f673303492272778051" 226 }, 227 "dist": { 228 "type": "zip", 229 "url": "https://api.github.com/repos/guzzle/psr7/zipball/21dc724a0583619cd1652f673303492272778051", 230 "reference": "21dc724a0583619cd1652f673303492272778051", 231 231 "shasum": "" 232 232 }, … … 244 244 "bamarni/composer-bin-plugin": "^1.8.2", 245 245 "http-interop/http-factory-tests": "0.9.0", 246 "phpunit/phpunit": "^8.5. 39 || ^9.6.20"246 "phpunit/phpunit": "^8.5.44 || ^9.6.25" 247 247 }, 248 248 "suggest": { 249 249 "laminas/laminas-httphandlerrunner": "Emit PSR-7 responses" 250 250 }, 251 "time": "2025-0 3-27T12:30:47+00:00",251 "time": "2025-08-23T21:21:41+00:00", 252 252 "type": "library", 253 253 "extra": { … … 317 317 "support": { 318 318 "issues": "https://github.com/guzzle/psr7/issues", 319 "source": "https://github.com/guzzle/psr7/tree/2. 7.1"319 "source": "https://github.com/guzzle/psr7/tree/2.8.0" 320 320 }, 321 321 "funding": [ … … 553 553 { 554 554 "name": "sveaekonomi/checkout", 555 "version": "1. 6.0",556 "version_normalized": "1. 6.0.0",555 "version": "1.7.0", 556 "version_normalized": "1.7.0.0", 557 557 "source": { 558 558 "type": "git", 559 559 "url": "https://github.com/sveawebpay/php-checkout.git", 560 "reference": "d 184c949b60b96595cb786320bf049a5fbaf91df"561 }, 562 "dist": { 563 "type": "zip", 564 "url": "https://api.github.com/repos/sveawebpay/php-checkout/zipball/d 184c949b60b96595cb786320bf049a5fbaf91df",565 "reference": "d 184c949b60b96595cb786320bf049a5fbaf91df",560 "reference": "d6314fff51bee74154301be63d12918aa8e90ccc" 561 }, 562 "dist": { 563 "type": "zip", 564 "url": "https://api.github.com/repos/sveawebpay/php-checkout/zipball/d6314fff51bee74154301be63d12918aa8e90ccc", 565 "reference": "d6314fff51bee74154301be63d12918aa8e90ccc", 566 566 "shasum": "" 567 567 }, … … 579 579 "symfony/dependency-injection": "^2.7.51 || ^2.8.50 || ^3.4.26 || ^4.1.12 || ^4.2.7" 580 580 }, 581 "time": "202 5-06-30T13:03:15+00:00",581 "time": "2026-02-05T10:57:04+00:00", 582 582 "type": "library", 583 583 "installation-source": "dist", 584 584 "autoload": { 585 585 "psr-4": { 586 "Svea\\Checkout\\": "src "586 "Svea\\Checkout\\": "src/" 587 587 } 588 588 }, … … 600 600 "support": { 601 601 "issues": "https://github.com/sveawebpay/php-checkout/issues", 602 "source": "https://github.com/sveawebpay/php-checkout/tree/1. 6.0"602 "source": "https://github.com/sveawebpay/php-checkout/tree/1.7.0" 603 603 }, 604 604 "install-path": "../sveaekonomi/checkout" -
svea-checkout-for-woocommerce/tags/3.5.0/vendor/composer/installed.php
r3320066 r3454688 12 12 'versions' => array( 13 13 'guzzlehttp/guzzle' => array( 14 'pretty_version' => '7. 9.3',15 'version' => '7. 9.3.0',16 'reference' => ' 7b2f29fe81dc4da0ca0ea7d42107a0845946ea77',14 'pretty_version' => '7.10.0', 15 'version' => '7.10.0.0', 16 'reference' => 'b51ac707cfa420b7bfd4e4d5e510ba8008e822b4', 17 17 'type' => 'library', 18 18 'install_path' => __DIR__ . '/../guzzlehttp/guzzle', … … 21 21 ), 22 22 'guzzlehttp/promises' => array( 23 'pretty_version' => '2. 2.0',24 'version' => '2. 2.0.0',25 'reference' => ' 7c69f28996b0a6920945dd20b3857e499d9ca96c',23 'pretty_version' => '2.3.0', 24 'version' => '2.3.0.0', 25 'reference' => '481557b130ef3790cf82b713667b43030dc9c957', 26 26 'type' => 'library', 27 27 'install_path' => __DIR__ . '/../guzzlehttp/promises', … … 30 30 ), 31 31 'guzzlehttp/psr7' => array( 32 'pretty_version' => '2. 7.1',33 'version' => '2. 7.1.0',34 'reference' => ' c2270caaabe631b3b44c85f99e5a04bbb8060d16',32 'pretty_version' => '2.8.0', 33 'version' => '2.8.0.0', 34 'reference' => '21dc724a0583619cd1652f673303492272778051', 35 35 'type' => 'library', 36 36 'install_path' => __DIR__ . '/../guzzlehttp/psr7', … … 93 93 ), 94 94 'sveaekonomi/checkout' => array( 95 'pretty_version' => '1. 6.0',96 'version' => '1. 6.0.0',97 'reference' => 'd 184c949b60b96595cb786320bf049a5fbaf91df',95 'pretty_version' => '1.7.0', 96 'version' => '1.7.0.0', 97 'reference' => 'd6314fff51bee74154301be63d12918aa8e90ccc', 98 98 'type' => 'library', 99 99 'install_path' => __DIR__ . '/../sveaekonomi/checkout', -
svea-checkout-for-woocommerce/tags/3.5.0/vendor/guzzlehttp/guzzle/CHANGELOG.md
r3320066 r3454688 2 2 3 3 Please refer to [UPGRADING](UPGRADING.md) guide for upgrading to a major version. 4 5 ## 7.10.0 - 2025-08-23 6 7 ### Added 8 9 - Support for PHP 8.5 10 11 ### Changed 12 13 - Adjusted `guzzlehttp/promises` version constraint to `^2.3` 14 - Adjusted `guzzlehttp/psr7` version constraint to `^2.8` 4 15 5 16 -
svea-checkout-for-woocommerce/tags/3.5.0/vendor/guzzlehttp/guzzle/composer.json
r3172745 r3454688 82 82 "php": "^7.2.5 || ^8.0", 83 83 "ext-json": "*", 84 "guzzlehttp/promises": "^ 1.5.3 || ^2.0.3",85 "guzzlehttp/psr7": "^2. 7.0",84 "guzzlehttp/promises": "^2.3", 85 "guzzlehttp/psr7": "^2.8", 86 86 "psr/http-client": "^1.0", 87 87 "symfony/deprecation-contracts": "^2.2 || ^3.0" -
svea-checkout-for-woocommerce/tags/3.5.0/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php
r3172745 r3454688 126 126 127 127 if (\count($this->handles) >= $this->maxHandles) { 128 \curl_close($resource); 128 if (PHP_VERSION_ID < 80000) { 129 \curl_close($resource); 130 } 129 131 } else { 130 132 // Remove all callback functions as they can hold onto references … … 730 732 { 731 733 foreach ($this->handles as $id => $handle) { 732 \curl_close($handle); 734 if (PHP_VERSION_ID < 80000) { 735 \curl_close($handle); 736 } 737 733 738 unset($this->handles[$id]); 734 739 } -
svea-checkout-for-woocommerce/tags/3.5.0/vendor/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php
r3172745 r3454688 241 241 unset($this->delays[$id], $this->handles[$id]); 242 242 \curl_multi_remove_handle($this->_mh, $handle); 243 \curl_close($handle); 243 244 if (PHP_VERSION_ID < 80000) { 245 \curl_close($handle); 246 } 244 247 245 248 return true; -
svea-checkout-for-woocommerce/tags/3.5.0/vendor/guzzlehttp/guzzle/src/Handler/StreamHandler.php
r3320066 r3454688 334 334 335 335 return $this->createResource( 336 function () use ($uri, &$http_response_header,$contextResource, $context, $options, $request) {336 function () use ($uri, $contextResource, $context, $options, $request) { 337 337 $resource = @\fopen((string) $uri, 'r', false, $contextResource); 338 339 // See https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_the_http_response_header_predefined_variable 340 if (function_exists('http_get_last_response_headers')) { 341 /** @var array|null */ 342 $http_response_header = \http_get_last_response_headers(); 343 } 344 338 345 $this->lastHeaders = $http_response_header ?? []; 339 346 -
svea-checkout-for-woocommerce/tags/3.5.0/vendor/guzzlehttp/guzzle/src/Middleware.php
r3172745 r3454688 188 188 * formatter. 189 189 * 190 * @phpstan-param \Psr\Log\LogLevel::* $logLevel Level at which to log requests.191 *192 190 * @param LoggerInterface $logger Logs messages. 193 191 * @param MessageFormatterInterface|MessageFormatter $formatter Formatter used to create message strings. 194 192 * @param string $logLevel Level at which to log requests. 193 * 194 * @phpstan-param \Psr\Log\LogLevel::* $logLevel Level at which to log requests. 195 195 * 196 196 * @return callable Returns a function that accepts the next handler. -
svea-checkout-for-woocommerce/tags/3.5.0/vendor/guzzlehttp/promises/CHANGELOG.md
r3320066 r3454688 1 1 # CHANGELOG 2 3 4 ## 2.3.0 - 2025-08-22 5 6 ### Added 7 8 - PHP 8.5 support 2 9 3 10 -
svea-checkout-for-woocommerce/tags/3.5.0/vendor/guzzlehttp/promises/README.md
r3172745 r3454688 42 42 |---------|---------------------|--------------| 43 43 | 1.x | Security fixes only | >=5.5,<8.3 | 44 | 2.x | Latest | >=7.2.5,<8. 5|44 | 2.x | Latest | >=7.2.5,<8.6 | 45 45 46 46 -
svea-checkout-for-woocommerce/tags/3.5.0/vendor/guzzlehttp/promises/composer.json
r3172745 r3454688 31 31 "require-dev": { 32 32 "bamarni/composer-bin-plugin": "^1.8.2", 33 "phpunit/phpunit": "^8.5. 39 || ^9.6.20"33 "phpunit/phpunit": "^8.5.44 || ^9.6.25" 34 34 }, 35 35 "autoload": { -
svea-checkout-for-woocommerce/tags/3.5.0/vendor/guzzlehttp/psr7/CHANGELOG.md
r3320066 r3454688 5 5 The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) 6 6 and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). 7 8 ## 2.8.0 - 2025-08-23 9 10 ### Added 11 12 - Allow empty lists as header values 13 14 ### Changed 15 16 - PHP 8.5 support 7 17 8 18 ## 2.7.1 - 2025-03-27 -
svea-checkout-for-woocommerce/tags/3.5.0/vendor/guzzlehttp/psr7/README.md
r3172745 r3454688 26 26 |---------|---------------------|--------------| 27 27 | 1.x | EOL (2024-06-30) | >=5.4,<8.2 | 28 | 2.x | Latest | >=7.2.5,<8. 5|28 | 2.x | Latest | >=7.2.5,<8.6 | 29 29 30 30 -
svea-checkout-for-woocommerce/tags/3.5.0/vendor/guzzlehttp/psr7/composer.json
r3172745 r3454688 63 63 "bamarni/composer-bin-plugin": "^1.8.2", 64 64 "http-interop/http-factory-tests": "0.9.0", 65 "phpunit/phpunit": "^8.5. 39 || ^9.6.20"65 "phpunit/phpunit": "^8.5.44 || ^9.6.25" 66 66 }, 67 67 "suggest": { -
svea-checkout-for-woocommerce/tags/3.5.0/vendor/guzzlehttp/psr7/src/MessageTrait.php
r3088414 r3454688 173 173 if (!is_array($value)) { 174 174 return $this->trimAndValidateHeaderValues([$value]); 175 }176 177 if (count($value) === 0) {178 throw new \InvalidArgumentException('Header value can not be an empty array.');179 175 } 180 176 -
svea-checkout-for-woocommerce/tags/3.5.0/vendor/guzzlehttp/psr7/src/Utils.php
r3172745 r3454688 398 398 399 399 if ($ex) { 400 /** @var $ex \RuntimeException*/400 /** @var \RuntimeException $ex */ 401 401 throw $ex; 402 402 } … … 445 445 446 446 if ($ex) { 447 /** @var $ex \RuntimeException*/447 /** @var \RuntimeException $ex */ 448 448 throw $ex; 449 449 } -
svea-checkout-for-woocommerce/tags/3.5.0/vendor/sveaekonomi/checkout/README.md
r3320066 r3454688 54 54 You can also download the library and upload it onto your server. 55 55 56 ### 1.3 Define API timeout (optional) 57 The default timeout for API requests is set to 5 seconds. If you want to change this value you can define the constant `SVEA_CHECKOUT_API_TIMEOUT` before including the library. 58 59 ```php 60 // Set timeout to 10 seconds 61 define('SVEA_CHECKOUT_API_TIMEOUT', 10); 62 // Include the library 63 include 'vendor/autoload.php'; 64 ``` 65 56 66 ### 2. General information 57 67 … … 60 70 61 71 The connector defines what credentials should be used and which environment should be used. 62 63 72 64 73 Parameters for creating Connector are: checkoutMerchantId, checkoutSecret and base API url(environment). … … 794 803 | LEASINGAPPROVED | Leasing (Automatically approved leasing contract) 795 804 | TRUSTLY | The customer paid with Trustly | 805 | APPLEPAY | The customer paid with Apple Pay | 806 | APPLEPAY_PF | The customer paid with Apple Pay via a payment facilitator | 796 807 | Directbank (varies) | The customer paid the order with direct bank e.g. Nordea, SEB. See below for all available parameters | 797 808 -
svea-checkout-for-woocommerce/tags/3.5.0/vendor/sveaekonomi/checkout/VERSION
r3320066 r3454688 1 1. 6.01 1.7.0 -
svea-checkout-for-woocommerce/tags/3.5.0/vendor/sveaekonomi/checkout/composer.json
r3320066 r3454688 1 1 { 2 2 "name": "sveaekonomi/checkout", 3 "version": "1. 6.0",3 "version": "1.7.0", 4 4 "description": "Php integration library for Svea Checkout", 5 5 "license": "Apache-2.0", … … 12 12 "autoload": { 13 13 "psr-4": { 14 "Svea\\Checkout\\": "src "14 "Svea\\Checkout\\": "src/" 15 15 } 16 16 }, -
svea-checkout-for-woocommerce/tags/3.5.0/vendor/sveaekonomi/checkout/src/CheckoutClient.php
r3320066 r3454688 26 26 namespace Svea\Checkout; 27 27 28 use Indeed\Uap\PreviousRanks; 29 use Opis\JsonSchema\Variables\RefVariablesContainer; 28 30 use Svea\Checkout\Implementation\ImplementationInterface; 29 31 use Svea\Checkout\Transport\Connector; -
svea-checkout-for-woocommerce/tags/3.5.0/vendor/sveaekonomi/checkout/src/Transport/ApiClient.php
r2005541 r3454688 52 52 $this->httpClient->setOption(CURLOPT_RETURNTRANSFER, 1); 53 53 $this->httpClient->setOption(CURLOPT_HEADER, 1); 54 $this->httpClient->setOption(CURLOPT_SSL_VERIFYPEER, false);55 54 56 55 if ($request->getMethod() === 'POST') { … … 68 67 $this->httpClient->setOption(CURLOPT_POSTFIELDS, $request->getBody()); 69 68 } 69 70 // Set a default timeout of 5 seconds if none is defined 71 $timeout = defined('SVEA_CHECKOUT_API_TIMEOUT') ? SVEA_CHECKOUT_API_TIMEOUT : 5; 72 $this->httpClient->setOption(CURLOPT_TIMEOUT, $timeout); 70 73 71 74 $httpResponse = $this->httpClient->execute(); -
svea-checkout-for-woocommerce/tags/3.5.0/vendor/sveaekonomi/checkout/src/Transport/Http/CurlRequest.php
r1898244 r3454688 11 11 { 12 12 /** 13 * @var null| resource13 * @var null|mixed 14 14 */ 15 15 private $handle = null; -
svea-checkout-for-woocommerce/tags/3.5.0/vendor/sveaekonomi/checkout/src/Validation/Admin/ValidateDeliverOrderData.php
r2846828 r3454688 19 19 $this->mustBeInteger($data['orderid'], 'Order Id'); 20 20 21 $this->mustBeSet($data, 'orderrowids', 'Order Id');21 $this->mustBeSet($data, 'orderrowids', 'Order Row Ids'); 22 22 $this->mustBeArray($data['orderrowids'], 'Order Row Ids'); 23 23 -
svea-checkout-for-woocommerce/trunk/assets/js/frontend/application.min.js
r3320066 r3454688 1 (e=>{class t{constructor(e){this.$elm=e,this.isCompany="business"===wc_sco_params.default_company_type,this.validationCallbackListener=null,this.isCompanyListener=null,this.postalCodeListener=null,this.hasOngoingPayment=!1,this.syncZipCode=wc_sco_params.sync_zip_code,this.attributionKey=wc_sco_params.attribution_key,this.validationFailedMessage=wc_sco_params.validation_failed,this.ajaxUrl=wc_checkout_params.wc_ajax_url,this.refreshNonce=wc_sco_params.refresh_sco_snippet_nonce,this.checkoutNonce=wc_sco_params.sco_checkout_order,this.nShiftNonce=wc_sco_params.update_sco_order_nshift_information,this.checkoutNonceSelector="#woocommerce-process-checkout-nonce",this.attachEvents()}attachEvents(){const t=()=>{this.observeSveaData(),e(".svea-skeleton-loader").remove()};"scoApi"in window&&window.scoApi?t():e(document).on("checkoutReady",t),this.attachCheckoutEvents()}attachCheckoutEvents(){this.currentCountry=e(".wc-svea-checkout-page #billing_country").val(),this.currentState=e(".wc-svea-checkout-page #billing_state").val(),e(document).on("change",".wc-svea-checkout-page #billing_country",(t=>{const s=e(".wc-svea-checkout-page #billing_country").val();this.currentCountry!=s&&(this.refreshData(),this.currentCountry=s)})),e(document).on("change",".wc-svea-checkout-page #billing_state",(t=>{const s=e(".wc-svea-checkout-page #billing_state").val();this.currentState!=s&&(this.refreshData(),this.currentState=s)})),e(document).on("change",".wc-svea-checkout-page #shipping_method .shipping_method",this.refreshData.bind(this));if(e(document).on("change",[".woocommerce-additional-fields input",".woocommerce-additional-fields textarea",".woocommerce-additional-fields select"].join(", "),this.maybeTriggerReloadOfSvea.bind(this)),window.wc_sco_compat&&window.wc_sco_compat.fields_trigger_update.length){const t=window.wc_sco_compat.fields_trigger_update.join(", ");e(document).on("change",t,this.refreshData.bind(this))}e(document).on("sco_refresh_data",this.refreshData.bind(this)),e("body").on("update_checkout",this.refreshData.bind(this)),e("body").on("click","#sco-change-payment",this.changePaymentMethod.bind(this))}maybeTriggerReloadOfSvea(){this.hasOngoingPayment&&(window.scoApi.setCheckoutEnabled(!1),window.scoApi.setCheckoutEnabled(!0))}observeSveaData(){"1"===this.syncZipCode&&(this.postalCodeListener&&this.postalCodeListener(),this.postalCodeListener=window.scoApi.observeEvent("identity.postalCode",this.postalCodeChange.bind(this))),document.removeEventListener("sveaCheckout:errorValidationCallback",this.validationError.bind(this)),document.addEventListener("sveaCheckout:errorValidationCallback",this.validationError.bind(this)),document.removeEventListener("sveaCheckout:shippingConfirmed",this.shippingConfirmed.bind(this)),document.addEventListener("sveaCheckout:shippingConfirmed",this.shippingConfirmed.bind(this)),this.isCompanyListener&&this.isCompanyListener(),this.isCompanyListener=window.scoApi.observeEvent("identity.isCompany",this.isCompanyChange.bind(this)),this.validationCallbackListener&&this.validationCallbackListener(),this.validationCallbackListener=window.scoApi.observeEvent("order.validationCallback",this.submitOrder.bind(this))}submitOrder(t){this.hasOngoingPayment=!0;const s=e("form.woocommerce-checkout").serialize(),o=this.serializeFormToObject(s),a=Object.assign(o,{post_data:s,security:this.checkoutNonce,ship_to_different_address:1,payment_method:"svea_checkout"});e.ajax({type:"POST",url:this.ajaxUrl.toString().replace("%%endpoint%%","sco_checkout_order"),data:a,success:s=>{let o=!1;if(void 0!==s.result)if("failure"===s.result){if(s.reload)return void e.ajax({type:"GET",url:this.ajaxUrl.toString().replace("%%endpoint%%","sco_renew_nonce"),success:s=>{if(s.success)return e(this.checkoutNonceSelector).val(s.data.wc),this.checkoutNonce=s.data.sco,this.submitOrder(t)}});this.showErrors(s.messages)}else"success"===s.result&&(o=!0);t.callback&&t.callback({valid:o})}})}postalCodeChange(t){let s=e("#billing_postcode").val(),o=t.value||"";(o&&s!==o||"••••"===o)&&(e("#billing_postcode").val(o),this.refreshData())}isCompanyChange(e){void 0!==e.value&&e.value!==this.isCompany&&(this.isCompany=e.value,setTimeout((()=>{this.refreshData()})))}validationError(e){let t=e.detail.message||this.validationFailedMessage;this.showErrors(t,!0),this.refreshData(null,!0)}shippingConfirmed(t){const s={security:this.nShiftNonce,price:t.detail.price,name:t.detail.name};this.setCheckoutUpdating(!0),e.ajax({type:"POST",url:this.ajaxUrl.toString().replace("%%endpoint%%","update_sco_order_nshift_information"),data:s,success:e=>{e&&e.fragments&&this.updateFragments(e.fragments),this.setCheckoutUpdating(!1)}})}refreshData(t,s=!1){const o=e("form.woocommerce-checkout").serialize(),a=this.serializeFormToObject(o,!1);"object"==typeof s&&(s=!0);const i=Object.assign(a,{security:this.refreshNonce,post_data:o,force:s});this.setCheckoutUpdating(!0),e.ajax({type:"POST",url:this.ajaxUrl.toString().replace("%%endpoint%%","refresh_sco_snippet"),data:i,success:t=>{this.isUpdating=!1,!0!==t.reload&&"true"!==t.reload?(e(".woocommerce-NoticeGroup-updateOrderReview").remove(),t&&t.fragments&&this.updateFragments(t.fragments),"failure"===t.result&&(this.removeErrors(),t.messages?this.showErrors(t.messages):this.showErrors(t)),e(document.body).trigger("updated_checkout",[t]),this.setCheckoutUpdating(!1)):window.location.reload()},complete:()=>{this.isUpdating=!1}})}updateFragments(t){e.each(t,(function(t,s){e(t).html(s),e(t).unblock()}))}showErrors(t,s=!1){this.removeErrors(),void 0===s&&(s=!0),s?this.$elm.prepend('<ul class="woocommerce-error"><li>'+t+"</li></ul>"):this.$elm.prepend(t),this.$elm.find(".input-text, select, input:checkbox").blur(),e("html, body").animate({scrollTop:this.$elm.offset().top-100},1e3)}setCheckoutUpdating(t){e(".wc-svea-checkout-page").toggleClass("updating",t),window.scoApi&&window.scoApi.setCheckoutEnabled(!t)}serializeFormToObject(e,t=!0){let s={};return e.split("&").forEach((e=>{let[o,a]=e.split("=");(t||0!==o.indexOf(this.attributionKey))&&(s[decodeURIComponent(o)]=decodeURIComponent(a))})),s}removeErrors(){e(".woocommerce-error, .woocommerce-message").remove()}changePaymentMethod(t){t.preventDefault(),e.ajax({url:wc_checkout_params.wc_ajax_url.toString().replace("%%endpoint%%","sco_change_payment_method"),method:"POST",data:{svea:!1,security:wc_ checkout_params.change_payment_method},success:e=>{e.success&&window.location.reload()}})}static instance(){e(this).length>0&&e(this).each(((s,o)=>{o.sveaCheckout=new t(e(o))}))}}function s(t){"svea_checkout"===t&&e.ajax({url:wc_checkout_params.wc_ajax_url.toString().replace("%%endpoint%%","sco_change_payment_method"),method:"POST",data:{svea:!0,security:wc_checkout_params.change_payment_method},success:e=>{e.success&&window.location.reload()}})}e.fn.sveaCheckout=t.instance,e(document).ready((t=>{e(".wc-svea-checkout-page").sveaCheckout(),e(document.body).on("init_checkout",(t=>{e("body").on("change","input[name=payment_method]",(t=>{s(e(t.target).val()),console.log("change")})),e(document.body).on("updated_checkout",(()=>{s(e("input[name=payment_method]:checked").val())}))}))}))})(jQuery);1 (e=>{class t{constructor(e){this.$elm=e,this.isCompany="business"===wc_sco_params.default_company_type,this.validationCallbackListener=null,this.isCompanyListener=null,this.postalCodeListener=null,this.hasOngoingPayment=!1,this.syncZipCode=wc_sco_params.sync_zip_code,this.attributionKey=wc_sco_params.attribution_key,this.validationFailedMessage=wc_sco_params.validation_failed,this.ajaxUrl=wc_checkout_params.wc_ajax_url,this.refreshNonce=wc_sco_params.refresh_sco_snippet_nonce,this.checkoutNonce=wc_sco_params.sco_checkout_order,this.nShiftNonce=wc_sco_params.update_sco_order_nshift_information,this.checkoutNonceSelector="#woocommerce-process-checkout-nonce",this.attachEvents()}attachEvents(){const t=()=>{this.observeSveaData(),e(".svea-skeleton-loader").remove()};"scoApi"in window&&window.scoApi?t():e(document).on("checkoutReady",t),this.attachCheckoutEvents()}attachCheckoutEvents(){this.currentCountry=e(".wc-svea-checkout-page #billing_country").val(),this.currentState=e(".wc-svea-checkout-page #billing_state").val(),e(document).on("change",".wc-svea-checkout-page #billing_country",(t=>{const s=e(".wc-svea-checkout-page #billing_country").val();this.currentCountry!=s&&(this.refreshData(),this.currentCountry=s)})),e(document).on("change",".wc-svea-checkout-page #billing_state",(t=>{const s=e(".wc-svea-checkout-page #billing_state").val();this.currentState!=s&&(this.refreshData(),this.currentState=s)})),e(document).on("change",".wc-svea-checkout-page #shipping_method .shipping_method",this.refreshData.bind(this));if(e(document).on("change",[".woocommerce-additional-fields input",".woocommerce-additional-fields textarea",".woocommerce-additional-fields select"].join(", "),this.maybeTriggerReloadOfSvea.bind(this)),window.wc_sco_compat&&window.wc_sco_compat.fields_trigger_update.length){const t=window.wc_sco_compat.fields_trigger_update.join(", ");e(document).on("change",t,this.refreshData.bind(this))}e(document).on("sco_refresh_data",this.refreshData.bind(this)),e("body").on("update_checkout",this.refreshData.bind(this)),e("body").on("click","#sco-change-payment",this.changePaymentMethod.bind(this))}maybeTriggerReloadOfSvea(){this.hasOngoingPayment&&(window.scoApi.setCheckoutEnabled(!1),window.scoApi.setCheckoutEnabled(!0))}observeSveaData(){"1"===this.syncZipCode&&(this.postalCodeListener&&this.postalCodeListener(),this.postalCodeListener=window.scoApi.observeEvent("identity.postalCode",this.postalCodeChange.bind(this))),document.removeEventListener("sveaCheckout:errorValidationCallback",this.validationError.bind(this)),document.addEventListener("sveaCheckout:errorValidationCallback",this.validationError.bind(this)),document.removeEventListener("sveaCheckout:shippingConfirmed",this.shippingConfirmed.bind(this)),document.addEventListener("sveaCheckout:shippingConfirmed",this.shippingConfirmed.bind(this)),this.isCompanyListener&&this.isCompanyListener(),this.isCompanyListener=window.scoApi.observeEvent("identity.isCompany",this.isCompanyChange.bind(this)),this.validationCallbackListener&&this.validationCallbackListener(),this.validationCallbackListener=window.scoApi.observeEvent("order.validationCallback",this.submitOrder.bind(this))}submitOrder(t){this.hasOngoingPayment=!0;const s=e("form.woocommerce-checkout").serialize(),o=this.serializeFormToObject(s),a=Object.assign(o,{post_data:s,security:this.checkoutNonce,ship_to_different_address:1,payment_method:"svea_checkout"});e.ajax({type:"POST",url:this.ajaxUrl.toString().replace("%%endpoint%%","sco_checkout_order"),data:a,success:s=>{let o=!1;if(void 0!==s.result)if("failure"===s.result){if(s.reload)return void e.ajax({type:"GET",url:this.ajaxUrl.toString().replace("%%endpoint%%","sco_renew_nonce"),success:s=>{if(s.success)return e(this.checkoutNonceSelector).val(s.data.wc),this.checkoutNonce=s.data.sco,this.submitOrder(t)}});this.showErrors(s.messages)}else"success"===s.result&&(o=!0);t.callback&&t.callback({valid:o})}})}postalCodeChange(t){let s=e("#billing_postcode").val(),o=t.value||"";(o&&s!==o||"••••"===o)&&(e("#billing_postcode").val(o),this.refreshData())}isCompanyChange(e){void 0!==e.value&&e.value!==this.isCompany&&(this.isCompany=e.value,setTimeout((()=>{this.refreshData()})))}validationError(e){let t=e.detail.message||this.validationFailedMessage;this.showErrors(t,!0),this.refreshData(null,!0)}shippingConfirmed(t){const s={security:this.nShiftNonce,price:t.detail.price,name:t.detail.name};this.setCheckoutUpdating(!0),e.ajax({type:"POST",url:this.ajaxUrl.toString().replace("%%endpoint%%","update_sco_order_nshift_information"),data:s,success:e=>{e&&e.fragments&&this.updateFragments(e.fragments),this.setCheckoutUpdating(!1)}})}refreshData(t,s=!1){const o=e("form.woocommerce-checkout").serialize(),a=this.serializeFormToObject(o,!1);"object"==typeof s&&(s=!0);const i=Object.assign(a,{security:this.refreshNonce,post_data:o,force:s});this.setCheckoutUpdating(!0),e.ajax({type:"POST",url:this.ajaxUrl.toString().replace("%%endpoint%%","refresh_sco_snippet"),data:i,success:t=>{this.isUpdating=!1,!0!==t.reload&&"true"!==t.reload?(e(".woocommerce-NoticeGroup-updateOrderReview").remove(),t&&t.fragments&&this.updateFragments(t.fragments),"failure"===t.result&&(this.removeErrors(),t.messages?this.showErrors(t.messages):this.showErrors(t)),e(document.body).trigger("updated_checkout",[t]),this.setCheckoutUpdating(!1)):window.location.reload()},complete:()=>{this.isUpdating=!1}})}updateFragments(t){e.each(t,(function(t,s){e(t).html(s),e(t).unblock()}))}showErrors(t,s=!1){this.removeErrors(),void 0===s&&(s=!0),s?this.$elm.prepend('<ul class="woocommerce-error"><li>'+t+"</li></ul>"):this.$elm.prepend(t),this.$elm.find(".input-text, select, input:checkbox").blur(),e("html, body").animate({scrollTop:this.$elm.offset().top-100},1e3)}setCheckoutUpdating(t){e(".wc-svea-checkout-page").toggleClass("updating",t),window.scoApi&&window.scoApi.setCheckoutEnabled(!t)}serializeFormToObject(e,t=!0){let s={};return e.split("&").forEach((e=>{let[o,a]=e.split("=");(t||0!==o.indexOf(this.attributionKey))&&(s[decodeURIComponent(o)]=decodeURIComponent(a))})),s}removeErrors(){e(".woocommerce-error, .woocommerce-message").remove()}changePaymentMethod(t){t.preventDefault(),e.ajax({url:wc_checkout_params.wc_ajax_url.toString().replace("%%endpoint%%","sco_change_payment_method"),method:"POST",data:{svea:!1,security:wc_sco_params.change_payment_method},success:e=>{e.success&&window.location.reload()}})}static instance(){e(this).length>0&&e(this).each(((s,o)=>{o.sveaCheckout=new t(e(o))}))}}function s(t){"svea_checkout"===t&&e.ajax({url:wc_checkout_params.wc_ajax_url.toString().replace("%%endpoint%%","sco_change_payment_method"),method:"POST",data:{svea:!0,security:wc_sco_params.change_payment_method},success:e=>{e.success&&window.location.reload()}})}e.fn.sveaCheckout=t.instance,e(document).ready((t=>{e(".wc-svea-checkout-page").sveaCheckout(),e(document.body).on("init_checkout",(t=>{e("body").on("change","input[name=payment_method]",(t=>{s(e(t.target).val())})),e(document.body).on("updated_checkout",(()=>{s(e("input[name=payment_method]:checked").val())}))}))}))})(jQuery); -
svea-checkout-for-woocommerce/trunk/inc/Admin.php
r3398960 r3454688 399 399 $wc_order->update_status( 'cancelled', esc_html__( 'Payment not accepted in Svea', 'svea-checkout-for-woocommerce' ) ); 400 400 } else { 401 if ( $wc_order->get_status() === self::AWAITING_ORDER_STATUS ) { 402 // Move through WooCommerce pending to support third-party status listeners before completion. 403 $wc_order->update_status( 'pending' ); 404 } 405 401 406 $wc_order->payment_complete( $svea_order_id ); 402 407 wp_clear_scheduled_hook( 'sco_check_pa_order_status', [ $svea_order_id ] ); -
svea-checkout-for-woocommerce/trunk/inc/Compat/Polylang_Compat.php
r3202226 r3454688 50 50 */ 51 51 public function change_push_uri( $data ) { 52 if ( ! empty( $data['MerchantSettings'] ) && \function_exists( 'pll_current_language' ) ) {53 $language_slug = \pll_current_language();52 if ( ! empty( $data['MerchantSettings'] ) && function_exists( 'pll_current_language' ) ) { 53 $language_slug = pll_current_language(); 54 54 55 55 $args = [ … … 57 57 ]; 58 58 59 $data['MerchantSettings']['PushUri'] = $ data['MerchantSettings']['PushUri'] . '&' . http_build_query( $args);60 $data['MerchantSettings']['CheckoutValidationCallBackUri'] = $ data['MerchantSettings']['CheckoutValidationCallBackUri'] . '&' . http_build_query( $args);61 $data['MerchantSettings']['WebhookUri'] = $ data['MerchantSettings']['WebhookUri'] . '&' . http_build_query( $args);59 $data['MerchantSettings']['PushUri'] = $this->restore_curly_braces( add_query_arg( $args, $data['MerchantSettings']['PushUri'] ) ); 60 $data['MerchantSettings']['CheckoutValidationCallBackUri'] = $this->restore_curly_braces( add_query_arg( $args, $data['MerchantSettings']['CheckoutValidationCallBackUri'] ) ); 61 $data['MerchantSettings']['WebhookUri'] = $this->restore_curly_braces( add_query_arg( $args, $data['MerchantSettings']['WebhookUri'] ) ); 62 62 } 63 63 64 64 return $data; 65 65 } 66 67 /** 68 * Restore the curly bracers that add_query_arg might have destroyed 69 * 70 * @param string $url 71 * @return string 72 */ 73 private function restore_curly_braces( $url ) { 74 $url = str_replace( '%7B', '{', $url ); 75 $url = str_replace( '%7D', '}', $url ); 76 77 return $url; 78 } 66 79 } -
svea-checkout-for-woocommerce/trunk/inc/Models/Svea_Checkout.php
r3398960 r3454688 194 194 case isset( $checkout_data['Recurring'] ) && $checkout_data['Recurring'] !== $this->is_recurring(): 195 195 case ! isset( $checkout_data['CountryCode'] ) || $checkout_data['CountryCode'] !== WC()->customer->get_billing_country(): 196 case $checkout_data['Status'] !== 'Created': 197 case $checkout_data['CountryCode'] !== WC()->customer->get_billing_country(): 198 case $checkout_data['Status'] === 'Final': 199 case $checkout_data['Status'] === 'Cancelled': 196 case strtoupper( $checkout_data['Status'] ) !== 'CREATED': 200 197 case ! isset( $checkout_data['MerchantSettings']['UseClientSideValidation'] ) || $checkout_data['MerchantSettings']['UseClientSideValidation'] !== true: 201 198 $need_new = true; -
svea-checkout-for-woocommerce/trunk/inc/Rule_Integration.php
r3398960 r3454688 297 297 } 298 298 299 /** @var \WC_Product $product */ 299 300 $product = $item['data']; 300 301 … … 525 526 $is_company = ! empty( $svea_data['Customer']['IsCompany'] ) && $svea_data['Customer']['IsCompany'] === true; 526 527 $first_name = $billing_address['FirstName'] ?? ''; 528 $last_name = $billing_address['LastName'] ?? ''; 527 529 528 530 if ( ( empty( $first_name ) || empty( $last_name ) ) && ! empty( $billing_address['FullName'] ) ) { … … 712 714 private function send_event( $tag, array $subscriber, array $fields, $retrying = false, $action = null ) { 713 715 $endpoint = self::ENDPOINT; 714 715 if ( empty( $endpoint ) ) { 716 return false; 717 } 716 $subscriber_id = ''; 718 717 719 718 if ( $action === null ) { … … 743 742 if ( $action === 'create' ) { 744 743 $payload['update_on_duplicate'] = true; 745 } else { 746 if ( empty( $subscriber_id ) ) { 747 return false; 748 } 744 } else if ( empty( $subscriber_id ) ) { 745 return false; 749 746 } 750 747 … … 877 874 * @param string $method HTTP method. 878 875 * @param string $endpoint Endpoint URL. 879 * @param string $api_key Rule API key.880 876 * @param array|null $payload Optional payload. 881 877 * @return array|WP_Error -
svea-checkout-for-woocommerce/trunk/inc/Template_Handler.php
r3439569 r3454688 266 266 } 267 267 268 // Check if there exists an order already 269 $current_order_id = WC()->session->get( 'order_awaiting_payment' ); 270 $current_sco_id = WC()->session->get( 'sco_order_id' ); 271 272 if ( $current_order_id && $current_sco_id ) { 273 // Load the order to see if it needs to be updated 274 $wc_order = wc_get_order( $current_order_id ); 275 276 if ( $wc_order && $wc_order->get_meta( '_svea_co_order_id' ) !== $current_sco_id ) { 277 // Remove the current order awaiting payment ID and create a new order 278 WC()->session->set( 'order_awaiting_payment', null ); 279 } 280 } 281 268 282 WC()->checkout()->process_checkout(); 269 283 wp_die( 0 ); … … 309 323 if ( $this->is_svea() && ! wp_doing_ajax() ) { 310 324 // Flush checkout fields cache 311 WC()->checkout()-> checkout_fields = null;325 WC()->checkout()->__set( 'checkout_fields', null ); 312 326 313 327 // Remove all default fields from WooCommerce to see what gets added by third party plugins … … 426 440 */ 427 441 public function change_payment_method() { 442 if ( ! isset( $_POST['security'] ) || ! wp_verify_nonce( $_POST['security'], 'change-payment-method' ) ) { 443 echo 'Nonce fail'; 444 exit; 445 } 446 428 447 $use_svea = isset( $_POST['svea'] ) && sanitize_text_field( $_POST['svea'] ) === 'true'; // phpcs:ignore WordPress.Security.NonceVerification.Missing 429 448 -
svea-checkout-for-woocommerce/trunk/inc/WC_Gateway_Svea_Checkout.php
r3409597 r3454688 7 7 use Svea_Checkout_For_Woocommerce\Models\Svea_Checkout; 8 8 use Svea_Checkout_For_Woocommerce\Models\Svea_Payment_Admin; 9 use WP_Filesystem_Direct; 9 10 10 11 if ( ! defined( 'ABSPATH' ) ) { … … 1990 1991 1991 1992 /** 1993 * Generate HTML for Apple Pay certificate upload field 1994 * 1995 * @param string $key Field key 1996 * @param array $data Field data 1997 * @return string 1998 */ 1999 public function generate_apple_pay_certificate_html( $key, $data ) { 2000 $field_key = $this->get_field_key( $key ); 2001 $defaults = [ 2002 'title' => '', 2003 'disabled' => false, 2004 'class' => '', 2005 'css' => '', 2006 'placeholder' => '', 2007 'type' => 'file', 2008 'desc_tip' => false, 2009 'description' => '', 2010 'custom_attributes' => [], 2011 ]; 2012 2013 $data = wp_parse_args( $data, $defaults ); 2014 2015 // Check if certificate exists 2016 $cert_path = ABSPATH . '.well-known/apple-developer-merchantid-domain-association'; 2017 $cert_exists = file_exists( $cert_path ); 2018 2019 $description = sprintf( 2020 /* translators: %s: file path */ 2021 esc_html__( 'The upload will try to put the file here, if that\'s not correct then please upload the certificate manually: %s', 'svea-checkout-for-woocommerce' ), 2022 '<code>' . esc_html( $cert_path ) . '</code>' 2023 ); 2024 2025 if ( $cert_exists ) { 2026 $description .= '<br><strong style="color: green;">' . esc_html__( 'Certificate is currently uploaded.', 'svea-checkout-for-woocommerce' ) . '</strong>'; 2027 } 2028 2029 ob_start(); 2030 ?> 2031 <tr valign="top"> 2032 <th scope="row" class="titledesc"> 2033 <label for="<?php echo esc_attr( $field_key ); ?>"><?php echo wp_kses_post( $data['title'] ); ?></label> 2034 </th> 2035 <td class="forminp"> 2036 <fieldset> 2037 <legend class="screen-reader-text"><span><?php echo wp_kses_post( $data['title'] ); ?></span></legend> 2038 <input 2039 class="input-text regular-input <?php echo esc_attr( $data['class'] ); ?>" 2040 type="file" 2041 name="<?php echo esc_attr( $field_key ); ?>" 2042 id="<?php echo esc_attr( $field_key ); ?>" 2043 style="<?php echo esc_attr( $data['css'] ); ?>" 2044 <?php disabled( $data['disabled'], true ); ?> 2045 <?php echo $this->get_custom_attribute_html( $data ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?> 2046 /> 2047 <p class="description"><?php echo wp_kses_post( $description ); ?></p> 2048 </fieldset> 2049 </td> 2050 </tr> 2051 <?php 2052 return ob_get_clean(); 2053 } 2054 2055 /** 2056 * Process admin options and handle Apple Pay certificate upload 2057 * 2058 * @return bool 2059 */ 2060 public function process_admin_options() { 2061 // Handle Apple Pay certificate upload 2062 // Nonce verification is handled by WooCommerce parent class 2063 $field_key = $this->get_field_key( 'apple_pay_certificate' ); 2064 2065 // phpcs:ignore WordPress.Security.NonceVerification.Missing -- Nonce is verified by WooCommerce parent class 2066 if ( ! isset( $_FILES[ $field_key ] ) || empty( $_FILES[ $field_key ]['tmp_name'] ) ) { 2067 return parent::process_admin_options(); 2068 } 2069 2070 // phpcs:ignore WordPress.Security.NonceVerification.Missing, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- Nonce verified by parent, file validation done below 2071 $file = $_FILES[ $field_key ]; 2072 2073 // Validate file size (max 1MB for certificate files) 2074 $max_size = MB_IN_BYTES; 2075 if ( ! isset( $file['size'] ) || $file['size'] > $max_size ) { 2076 \WC_Admin_Settings::add_error( 2077 sprintf( 2078 /* translators: %s: maximum file size */ 2079 esc_html__( 'Apple Pay certificate file is too large. Maximum size is %s.', 'svea-checkout-for-woocommerce' ), 2080 size_format( $max_size ) 2081 ) 2082 ); 2083 return parent::process_admin_options(); 2084 } 2085 2086 // Validate file upload 2087 if ( $file['error'] !== UPLOAD_ERR_OK ) { 2088 \WC_Admin_Settings::add_error( 2089 esc_html__( 'Apple Pay certificate upload failed. Please try again.', 'svea-checkout-for-woocommerce' ) 2090 ); 2091 } else { 2092 // Validate content type - strict validation for security 2093 // Using finfo for MIME type detection as it's reliable and sufficient for this use case 2094 $allowed_types = [ 2095 'application/octet-stream', 2096 'text/plain', 2097 'application/x-apple-aspen-config', 2098 ]; 2099 2100 $finfo = finfo_open( FILEINFO_MIME_TYPE ); 2101 if ( false === $finfo ) { 2102 \WC_Admin_Settings::add_error( 2103 esc_html__( 'Failed to initialize file type detection. Please try again or contact your system administrator.', 'svea-checkout-for-woocommerce' ) 2104 ); 2105 } else { 2106 $mime_type = finfo_file( $finfo, $file['tmp_name'] ); 2107 finfo_close( $finfo ); 2108 2109 // Strict content type validation for security 2110 if ( ! in_array( $mime_type, $allowed_types, true ) ) { 2111 \WC_Admin_Settings::add_error( 2112 sprintf( 2113 /* translators: %s: detected MIME type */ 2114 esc_html__( 'Invalid file type detected: %s. Please upload the Apple Pay certificate file.', 'svea-checkout-for-woocommerce' ), 2115 esc_html( $mime_type ) 2116 ) 2117 ); 2118 } else { 2119 // Create .well-known directory if it doesn't exist 2120 $well_known_dir = ABSPATH . '.well-known'; 2121 if ( ! file_exists( $well_known_dir ) ) { 2122 $mkdir_result = wp_mkdir_p( $well_known_dir ); 2123 if ( false === $mkdir_result ) { 2124 \WC_Admin_Settings::add_error( 2125 esc_html__( 'Failed to create .well-known directory. Please check file permissions.', 'svea-checkout-for-woocommerce' ) 2126 ); 2127 return parent::process_admin_options(); 2128 } 2129 } 2130 2131 /** @var WP_Filesystem_direct $wp_filesystem */ 2132 global $wp_filesystem; 2133 require_once ABSPATH . 'wp-admin/includes/file.php'; 2134 // Initialize the WP filesystem 2135 WP_Filesystem(); 2136 2137 // Verify directory is writable 2138 if ( ! $wp_filesystem->is_writable( $well_known_dir ) ) { 2139 \WC_Admin_Settings::add_error( 2140 esc_html__( 'The .well-known directory is not writable. Please check file permissions.', 'svea-checkout-for-woocommerce' ) 2141 ); 2142 return parent::process_admin_options(); 2143 } 2144 2145 // Set target path - use fixed filename to prevent path traversal 2146 $target_filename = 'apple-developer-merchantid-domain-association'; 2147 $target_path = $well_known_dir . '/' . $target_filename; 2148 2149 // Verify target path is within expected directory (security check) 2150 $real_target_dir = realpath( dirname( $target_path ) ); 2151 $real_expected_dir = realpath( $well_known_dir ); 2152 if ( $real_target_dir !== $real_expected_dir ) { 2153 \WC_Admin_Settings::add_error( 2154 esc_html__( 'Invalid target path detected. Upload blocked for security.', 'svea-checkout-for-woocommerce' ) 2155 ); 2156 return parent::process_admin_options(); 2157 } 2158 2159 // Move the uploaded file 2160 if ( move_uploaded_file( $file['tmp_name'], $target_path ) ) { 2161 // Set appropriate permissions 2162 // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_operations_chmod -- Setting standard file permissions for uploaded certificate 2163 $chmod_result = chmod( $target_path, 0644 ); 2164 if ( false === $chmod_result ) { 2165 // Log warning but don't fail the upload 2166 self::log( 'Failed to set permissions on Apple Pay certificate file', 'warning' ); 2167 } 2168 2169 \WC_Admin_Settings::add_message( 2170 esc_html__( 'Apple Pay certificate uploaded successfully.', 'svea-checkout-for-woocommerce' ) 2171 ); 2172 } else { 2173 \WC_Admin_Settings::add_error( 2174 esc_html__( 'Failed to move Apple Pay certificate to target location. Please check file permissions.', 'svea-checkout-for-woocommerce' ) 2175 ); 2176 } 2177 } 2178 } 2179 } 2180 2181 // Call parent to handle other settings 2182 return parent::process_admin_options(); 2183 } 2184 2185 /** 1992 2186 * Initialize Gateway Settings Form Fields 1993 2187 */ -
svea-checkout-for-woocommerce/trunk/inc/Webhook_Handler.php
r3409597 r3454688 83 83 84 84 /** 85 * Get caller IP 86 * 87 * @return string 85 * Get caller IP address for webhook validation. 86 * 87 * Security Note: IP restriction is only an additional defense layer and should not 88 * be the sole security measure. HTTP headers like X-Forwarded-For can be spoofed 89 * by attackers unless the server configuration properly strips client-supplied headers. 90 * 91 * For maximum security: 92 * - Use REMOTE_ADDR if not behind a reverse proxy 93 * - Ensure your reverse proxy/CDN strips client-supplied headers before adding its own 94 * - Consider implementing HMAC-based webhook authentication as the primary security control 95 * 96 * @return string IP address to validate 88 97 */ 89 98 private function get_referer_ip() { 90 if ( ! empty( $_SERVER['HTTP_CLIENT_IP'] ) ) { 91 $ip = $_SERVER['HTTP_CLIENT_IP']; 92 } else if ( ! empty( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) { 93 $ip = $_SERVER['HTTP_X_FORWARDED_FOR']; 94 } else { 95 $ip = $_SERVER['REMOTE_ADDR']; 96 } 97 98 return $ip; 99 $preferred_header = ''; 100 101 if ( $this->gateway ) { 102 $preferred_header = $this->get_configured_ip_header(); 103 } 104 105 $ip = $_SERVER['REMOTE_ADDR']; 106 107 if ( $preferred_header === 'yes' ) { // auto-detect 108 if ( ! empty( $_SERVER['HTTP_CLIENT_IP'] ) ) { 109 $ip = $_SERVER['HTTP_CLIENT_IP']; 110 } else if ( ! empty( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) { 111 $ip = $_SERVER['HTTP_X_FORWARDED_FOR']; 112 } 113 } else if ( ! empty( $_SERVER[ $preferred_header ] ) ) { 114 $ip = $_SERVER[ $preferred_header ]; 115 } 116 117 // Explode in case of multiple IPs from proxy 118 return explode( ',', $ip )[0]; 119 } 120 121 /** 122 * Get configured proxy header to trust. 123 * 124 * @return string "yes" for auto-detect, or specific header name. 125 */ 126 private function get_configured_ip_header() { 127 $header = $this->gateway->get_option( 'use_ip_restriction' ); 128 129 if ( $header === 'custom' ) { 130 $header = $this->gateway->get_option( 'ip_restriction_header' ); 131 132 if ( strpos( $header, 'HTTP_' ) !== 0 ) { 133 $header = 'HTTP_' . $header; 134 } 135 136 $header = str_replace( '-', '_', strtoupper( $header ) ); 137 // Strip any characters that are not alphanumeric or underscore to prevent header injection attacks 138 $header = preg_replace( '/[^A-Z0-9_]/', '', $header ); 139 } 140 141 return trim( $header ); 99 142 } 100 143 … … 105 148 */ 106 149 public function validate_referer() { 107 if ( $this->gateway->get_option( 'use_ip_restriction' ) !== 'yes' ) {150 if ( $this->gateway->get_option( 'use_ip_restriction' ) === 'no' ) { 108 151 return; 109 152 } 153 110 154 $ip_address = $this->get_referer_ip(); 111 155 $ref_ip = ip2long( $ip_address ); … … 145 189 146 190 $webhook_data = json_decode( $raw_webhook ); 147 $webhook_data->description = json_decode( $webhook_data->description );148 // phpcs:disable WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase149 $this->gateway::log( sprintf( 'Webhook callback received for Svea cart (%s) received', $webhook_data->orderId ) );150 191 151 192 $this->validate_referer(); 152 193 153 if ( empty( $webhook_data->orderId ) ) { 194 $svea_order_id = absint( $webhook_data->orderId ?? 0 ); // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase 195 if ( empty( $svea_order_id ) ) { 154 196 $this->gateway::log( 'No orderID was found. Aborting' ); 155 197 exit; 156 198 } 157 199 158 $wc_order = self::get_order_by_svea_id( $webhook_data->orderId ); 200 $wc_order = self::get_order_by_svea_id( $svea_order_id ); 201 202 if ( empty( $wc_order ) ) { 203 $this->gateway::log( 'Received webhook but the order does not exists' ); 204 exit; 205 } 206 207 // phpcs:disable WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase 208 $this->gateway::log( sprintf( 'Webhook callback received for Svea cart (%s) received', $svea_order_id ) ); 159 209 160 210 $svea_order = new Svea_Checkout( false ); … … 162 212 163 213 try { 164 self::$svea_order = $svea_order->get( $ webhook_data->orderId );214 self::$svea_order = $svea_order->get( $svea_order_id ); 165 215 } catch ( \Exception $e ) { 166 WC_Gateway_Svea_Checkout::log( sprintf( 'Error in push webhook when getting order id %s. Message from Svea: %s', $ this->svea_order_id, $e->getMessage() ) );216 WC_Gateway_Svea_Checkout::log( sprintf( 'Error in push webhook when getting order id %s. Message from Svea: %s', $svea_order_id, $e->getMessage() ) ); 167 217 status_header( 404 ); 168 218 exit; … … 197 247 } 198 248 199 if ( empty( $wc_order ) ) { 200 $this->gateway::log( sprintf( 'Received webhook but the order does not exists (%s)', $webhook_data->orderId ) ); 201 exit; 249 $shipping_information = self::$svea_order['ShippingInformation'] ?? []; 250 $shipping_provider = $shipping_information['ShippingProvider'] ?? []; 251 252 $shipping_type = sanitize_text_field( $shipping_provider['Type'] ?? $shipping_provider['type'] ?? '' ); 253 if ( ! empty( $shipping_type ) ) { 254 $wc_order->update_meta_data( '_sco_nshift_type', $shipping_type ); 255 } 256 257 $shipping_description = $shipping_provider['Description'] ?? $shipping_provider['description'] ?? null; 258 if ( is_array( $shipping_description ) ) { 259 $shipping_description = (object) $shipping_description; 260 } 261 262 if ( is_object( $shipping_description ) && ! empty( $shipping_description->tmsReference ) ) { 263 $wc_order->update_meta_data( '_sco_nshift_tms_ref', sanitize_text_field( $shipping_description->tmsReference ) ); 264 } 265 266 $selected_shipping_option = $shipping_provider['ShippingOption'] ?? []; 267 $carrier_id = ''; 268 $carrier_name = ''; 269 if ( empty( $selected_shipping_option ) && is_object( $shipping_description ) && ! empty( $shipping_description->selectedShippingOption ) ) { 270 $selected_shipping_option = $shipping_description->selectedShippingOption; 271 } 272 273 if ( is_array( $selected_shipping_option ) ) { 274 $carrier_id = sanitize_text_field( $selected_shipping_option['Id'] ?? $selected_shipping_option['id'] ?? '' ); 275 $carrier_name = sanitize_text_field( $selected_shipping_option['Carrier'] ?? $selected_shipping_option['carrier'] ?? '' ); 276 } 277 278 if ( ! empty( $carrier_id ) ) { 279 $wc_order->update_meta_data( '_sco_nshift_carrier_id', $carrier_id ); 280 } 281 282 if ( ! empty( $carrier_name ) ) { 283 $wc_order->update_meta_data( '_sco_nshift_carrier_name', $carrier_name ); 202 284 } 203 285 204 286 // Save the data 205 if ( ! empty( $webhook_data->type ) ) { 206 $wc_order->update_meta_data( '_sco_nshift_type', $webhook_data->type ); 207 } 208 209 if ( ! empty( $webhook_data->description->tmsReference ) ) { 210 $wc_order->update_meta_data( '_sco_nshift_tms_ref', $webhook_data->description->tmsReference ); 211 } 212 213 if ( ! empty( $webhook_data->description->selectedShippingOption ) ) { 214 $wc_order->update_meta_data( '_sco_nshift_carrier_id', $webhook_data->description->selectedShippingOption->id ); 215 $wc_order->update_meta_data( '_sco_nshift_carrier_name', $webhook_data->description->selectedShippingOption->carrier ); 216 } 217 218 // Save the whole thing as a complete string 219 $wc_order->update_meta_data( '_sco_nshift_data', $webhook_data ); 287 if ( ! empty( $shipping_information ) ) { 288 $wc_order->update_meta_data( '_sco_nshift_data', $shipping_information ); 289 } 220 290 221 291 $wc_order->save(); … … 538 608 } 539 609 540 if ( $this->gateway->get_option( 'use_ip_restriction' ) === 'yes' ) { 541 $this->validate_referer(); 542 } 610 $this->validate_referer(); 543 611 544 612 $this->gateway::log( sprintf( 'Received push for order %s', $this->svea_order_id ) ); … … 597 665 } 598 666 599 if ( $this->gateway->get_option( 'use_ip_restriction' ) === 'yes' ) { 600 $this->validate_referer(); 601 } 667 $this->validate_referer(); 602 668 603 669 $wc_order = wc_get_order( $wc_order_id ); -
svea-checkout-for-woocommerce/trunk/inc/settings-svea-checkout.php
r3398960 r3454688 556 556 ], 557 557 'use_ip_restriction' => [ 558 'title' => esc_html__( 'Use IP restriction', 'svea-checkout-for-woocommerce' ), 559 'type' => 'checkbox', 558 'title' => esc_html__( 'IP restriction', 'svea-checkout-for-woocommerce' ), 559 'type' => 'select', 560 'options' => [ 561 'yes' => esc_html__( 'Yes (auto-detect)', 'svea-checkout-for-woocommerce' ), 562 'REMOTE_ADDR' => esc_html__( 'REMOTE_ADDR (No reverse proxy)', 'svea-checkout-for-woocommerce' ), 563 'HTTP_CLIENT_IP' => esc_html__( 'HTTP_CLIENT_IP', 'svea-checkout-for-woocommerce' ), 564 'HTTP_X_FORWARDED_FOR' => esc_html__( 'HTTP_X_FORWARDED_FOR', 'svea-checkout-for-woocommerce' ), 565 'custom' => esc_html__( 'Custom header', 'svea-checkout-for-woocommerce' ), 566 'no' => esc_html__( 'Disable', 'svea-checkout-for-woocommerce' ), 567 ], 568 'default' => 'REMOTE_ADDR', 560 569 'description' => __( 561 'Verify the IP to one of Sveas server.<br /> 562 This functionality only works if you do not use a reverse proxy on your server. <br /> 563 <strong>Do not touch this if you do not know what you are doing</strong>.', 570 '<strong>Security Notice:</strong> IP restriction provides an additional layer of defense but is not a complete security measure. When using "auto-detect" or custom headers, ensure your server configuration properly strips client-supplied headers to prevent IP spoofing. Use "REMOTE_ADDR (No reverse proxy)" for the most secure option if not behind a proxy. For production environments, consider implementing additional webhook authentication mechanisms.', 564 571 'svea-checkout-for-woocommerce' 565 572 ), 566 'default' => 'yes', 573 ], 574 'ip_restriction_header' => [ 575 'title' => esc_html__( 'IP restriction custom header', 'svea-checkout-for-woocommerce' ), 576 'type' => 'text', 577 'description' => __( 578 '<strong>Warning:</strong> Custom headers can be spoofed by attackers unless your server is properly configured to strip client-supplied headers. Only use this option if you are certain your reverse proxy or CDN is configured to set this header and remove any client-provided values. Example: HTTP_X_REAL_IP or X-Real-IP.', 579 'svea-checkout-for-woocommerce' 580 ), 581 'default' => '', 567 582 ], 568 583 'other_settings_hr' => [ … … 580 595 'default' => 'no', 581 596 ], 597 'apple_pay_hr' => [ 598 'title' => '<hr>', 599 'type' => 'title', 600 ], 601 'apple_pay_title' => [ 602 'title' => esc_html__( 'Apple Pay', 'svea-checkout-for-woocommerce' ), 603 'type' => 'title', 604 ], 605 'apple_pay_certificate' => [ 606 'title' => esc_html__( 'Apple Pay Certificate', 'svea-checkout-for-woocommerce' ), 607 'type' => 'apple_pay_certificate', 608 ], 582 609 ] 583 610 ); -
svea-checkout-for-woocommerce/trunk/readme.txt
r3439569 r3454688 10 10 License: Apache 2.0 11 11 License URI: https://www.apache.org/licenses/LICENSE-2.0 12 Stable tag: 3. 4.312 Stable tag: 3.5.0 13 13 14 14 Supercharge your WooCommerce Store with powerful features to pay via Svea Checkout! … … 91 91 == Upgrade Notice == 92 92 93 = 3.5.0 = 94 3.5.0 is a minor release 95 93 96 = 3.4.3 = 94 97 3.4.3 is a patch release … … 420 423 421 424 == Changelog == 425 426 = 3.5.0 2026-02-05 = 427 - Updated to the latest SDK version for Svea Checkout (1.7.0) which includes a timeout for API requests. 428 - Allow custom headers to be used for IP-restriction. 429 - Changed the order flow of a pending order to go via the "Awaiting payment" to ensure third party plugins can use the same hooks as for non pending orders. 430 - Added Apple Pay certificate upload setting in gateway configuration. 431 - Ensure the usage of nonces across all ajax requests. 432 - Ensure escaping of all output in the template. 433 - Use information from the Checkout API instead of post body when using nShift. 434 - Removed legacy code for session table which isn't needed anymore. 422 435 423 436 = 3.4.3 2026-01-14 = -
svea-checkout-for-woocommerce/trunk/svea-checkout-for-woocommerce.php
r3439569 r3454688 3 3 namespace Svea_Checkout_For_Woocommerce; 4 4 5 use Svea\Checkout\Transport\Connector; 5 6 use Svea_Checkout_For_Woocommerce\Compat\Compat; 6 7 … … 14 15 * Plugin URI: https://wordpress.org/plugins/svea-checkout-for-woocommerce/ 15 16 * Description: Process payments in WooCommerce via Svea Checkout. 16 * Version: 3. 4.317 * Version: 3.5.0 17 18 * Requires Plugins: woocommerce 18 19 * Author: The Generation AB … … 47 48 * Version of plugin 48 49 */ 49 const VERSION = '3. 4.3';50 const VERSION = '3.5.0'; 50 51 51 52 /** … … 62 63 */ 63 64 public $instore; 64 65 /**66 * Session_Table class67 *68 * @var Session_Table69 */70 public $session_table;71 65 72 66 /** … … 286 280 $this->instore = new Instore(); 287 281 $this->instore->init(); 288 289 $this->session_table = new Session_Table();290 $this->session_table->init();291 282 } 292 283 -
svea-checkout-for-woocommerce/trunk/templates/svea-checkout.php
r3320066 r3454688 68 68 69 69 <div class="order-review-wrapper"> 70 <input id="billing_postcode" type="hidden" name="billing_postcode" value="<?php echo WC()->customer->get_billing_postcode(); ?>">70 <input id="billing_postcode" type="hidden" name="billing_postcode" value="<?php echo esc_attr( WC()->customer->get_billing_postcode() ); ?>"> 71 71 72 72 <?php do_action( 'woocommerce_checkout_before_order_review_heading' ); ?> -
svea-checkout-for-woocommerce/trunk/vendor/autoload.php
r3320066 r3454688 20 20 require_once __DIR__ . '/composer/autoload_real.php'; 21 21 22 return ComposerAutoloaderInit 4cfdf47045179a2c4f6ff86b1bce3df2::getLoader();22 return ComposerAutoloaderInit07e217451f0a071aa7dcb642a1b22b09::getLoader(); -
svea-checkout-for-woocommerce/trunk/vendor/composer/autoload_classmap.php
r3398960 r3454688 212 212 'Svea_Checkout_For_Woocommerce\\Rule_Integration' => $baseDir . '/inc/Rule_Integration.php', 213 213 'Svea_Checkout_For_Woocommerce\\Scripts' => $baseDir . '/inc/Scripts.php', 214 'Svea_Checkout_For_Woocommerce\\Session_Table' => $baseDir . '/inc/Session_Table.php',215 214 'Svea_Checkout_For_Woocommerce\\Template_Handler' => $baseDir . '/inc/Template_Handler.php', 216 215 'Svea_Checkout_For_Woocommerce\\Utils\\Array_Utils' => $baseDir . '/inc/Utils/Array_Utils.php', -
svea-checkout-for-woocommerce/trunk/vendor/composer/autoload_real.php
r3320066 r3454688 3 3 // autoload_real.php @generated by Composer 4 4 5 class ComposerAutoloaderInit 4cfdf47045179a2c4f6ff86b1bce3df25 class ComposerAutoloaderInit07e217451f0a071aa7dcb642a1b22b09 6 6 { 7 7 private static $loader; … … 25 25 require __DIR__ . '/platform_check.php'; 26 26 27 spl_autoload_register(array('ComposerAutoloaderInit 4cfdf47045179a2c4f6ff86b1bce3df2', 'loadClassLoader'), true, true);27 spl_autoload_register(array('ComposerAutoloaderInit07e217451f0a071aa7dcb642a1b22b09', 'loadClassLoader'), true, true); 28 28 self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__)); 29 spl_autoload_unregister(array('ComposerAutoloaderInit 4cfdf47045179a2c4f6ff86b1bce3df2', 'loadClassLoader'));29 spl_autoload_unregister(array('ComposerAutoloaderInit07e217451f0a071aa7dcb642a1b22b09', 'loadClassLoader')); 30 30 31 31 require __DIR__ . '/autoload_static.php'; 32 call_user_func(\Composer\Autoload\ComposerStaticInit 4cfdf47045179a2c4f6ff86b1bce3df2::getInitializer($loader));32 call_user_func(\Composer\Autoload\ComposerStaticInit07e217451f0a071aa7dcb642a1b22b09::getInitializer($loader)); 33 33 34 34 $loader->register(true); 35 35 36 $filesToLoad = \Composer\Autoload\ComposerStaticInit 4cfdf47045179a2c4f6ff86b1bce3df2::$files;36 $filesToLoad = \Composer\Autoload\ComposerStaticInit07e217451f0a071aa7dcb642a1b22b09::$files; 37 37 $requireFile = \Closure::bind(static function ($fileIdentifier, $file) { 38 38 if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { -
svea-checkout-for-woocommerce/trunk/vendor/composer/autoload_static.php
r3398960 r3454688 5 5 namespace Composer\Autoload; 6 6 7 class ComposerStaticInit 4cfdf47045179a2c4f6ff86b1bce3df27 class ComposerStaticInit07e217451f0a071aa7dcb642a1b22b09 8 8 { 9 9 public static $files = array ( … … 275 275 'Svea_Checkout_For_Woocommerce\\Rule_Integration' => __DIR__ . '/../..' . '/inc/Rule_Integration.php', 276 276 'Svea_Checkout_For_Woocommerce\\Scripts' => __DIR__ . '/../..' . '/inc/Scripts.php', 277 'Svea_Checkout_For_Woocommerce\\Session_Table' => __DIR__ . '/../..' . '/inc/Session_Table.php',278 277 'Svea_Checkout_For_Woocommerce\\Template_Handler' => __DIR__ . '/../..' . '/inc/Template_Handler.php', 279 278 'Svea_Checkout_For_Woocommerce\\Utils\\Array_Utils' => __DIR__ . '/../..' . '/inc/Utils/Array_Utils.php', … … 287 286 { 288 287 return \Closure::bind(function () use ($loader) { 289 $loader->prefixLengthsPsr4 = ComposerStaticInit 4cfdf47045179a2c4f6ff86b1bce3df2::$prefixLengthsPsr4;290 $loader->prefixDirsPsr4 = ComposerStaticInit 4cfdf47045179a2c4f6ff86b1bce3df2::$prefixDirsPsr4;291 $loader->classMap = ComposerStaticInit 4cfdf47045179a2c4f6ff86b1bce3df2::$classMap;288 $loader->prefixLengthsPsr4 = ComposerStaticInit07e217451f0a071aa7dcb642a1b22b09::$prefixLengthsPsr4; 289 $loader->prefixDirsPsr4 = ComposerStaticInit07e217451f0a071aa7dcb642a1b22b09::$prefixDirsPsr4; 290 $loader->classMap = ComposerStaticInit07e217451f0a071aa7dcb642a1b22b09::$classMap; 292 291 293 292 }, null, ClassLoader::class); -
svea-checkout-for-woocommerce/trunk/vendor/composer/installed.json
r3320066 r3454688 3 3 { 4 4 "name": "guzzlehttp/guzzle", 5 "version": "7. 9.3",6 "version_normalized": "7. 9.3.0",5 "version": "7.10.0", 6 "version_normalized": "7.10.0.0", 7 7 "source": { 8 8 "type": "git", 9 9 "url": "https://github.com/guzzle/guzzle.git", 10 "reference": " 7b2f29fe81dc4da0ca0ea7d42107a0845946ea77"11 }, 12 "dist": { 13 "type": "zip", 14 "url": "https://api.github.com/repos/guzzle/guzzle/zipball/ 7b2f29fe81dc4da0ca0ea7d42107a0845946ea77",15 "reference": " 7b2f29fe81dc4da0ca0ea7d42107a0845946ea77",10 "reference": "b51ac707cfa420b7bfd4e4d5e510ba8008e822b4" 11 }, 12 "dist": { 13 "type": "zip", 14 "url": "https://api.github.com/repos/guzzle/guzzle/zipball/b51ac707cfa420b7bfd4e4d5e510ba8008e822b4", 15 "reference": "b51ac707cfa420b7bfd4e4d5e510ba8008e822b4", 16 16 "shasum": "" 17 17 }, 18 18 "require": { 19 19 "ext-json": "*", 20 "guzzlehttp/promises": "^ 1.5.3 || ^2.0.3",21 "guzzlehttp/psr7": "^2. 7.0",20 "guzzlehttp/promises": "^2.3", 21 "guzzlehttp/psr7": "^2.8", 22 22 "php": "^7.2.5 || ^8.0", 23 23 "psr/http-client": "^1.0", … … 40 40 "psr/log": "Required for using the Log middleware" 41 41 }, 42 "time": "2025-0 3-27T13:37:11+00:00",42 "time": "2025-08-23T22:36:01+00:00", 43 43 "type": "library", 44 44 "extra": { … … 112 112 "support": { 113 113 "issues": "https://github.com/guzzle/guzzle/issues", 114 "source": "https://github.com/guzzle/guzzle/tree/7. 9.3"114 "source": "https://github.com/guzzle/guzzle/tree/7.10.0" 115 115 }, 116 116 "funding": [ … … 132 132 { 133 133 "name": "guzzlehttp/promises", 134 "version": "2. 2.0",135 "version_normalized": "2. 2.0.0",134 "version": "2.3.0", 135 "version_normalized": "2.3.0.0", 136 136 "source": { 137 137 "type": "git", 138 138 "url": "https://github.com/guzzle/promises.git", 139 "reference": " 7c69f28996b0a6920945dd20b3857e499d9ca96c"140 }, 141 "dist": { 142 "type": "zip", 143 "url": "https://api.github.com/repos/guzzle/promises/zipball/ 7c69f28996b0a6920945dd20b3857e499d9ca96c",144 "reference": " 7c69f28996b0a6920945dd20b3857e499d9ca96c",139 "reference": "481557b130ef3790cf82b713667b43030dc9c957" 140 }, 141 "dist": { 142 "type": "zip", 143 "url": "https://api.github.com/repos/guzzle/promises/zipball/481557b130ef3790cf82b713667b43030dc9c957", 144 "reference": "481557b130ef3790cf82b713667b43030dc9c957", 145 145 "shasum": "" 146 146 }, … … 150 150 "require-dev": { 151 151 "bamarni/composer-bin-plugin": "^1.8.2", 152 "phpunit/phpunit": "^8.5. 39 || ^9.6.20"153 }, 154 "time": "2025-0 3-27T13:27:01+00:00",152 "phpunit/phpunit": "^8.5.44 || ^9.6.25" 153 }, 154 "time": "2025-08-22T14:34:08+00:00", 155 155 "type": "library", 156 156 "extra": { … … 198 198 "support": { 199 199 "issues": "https://github.com/guzzle/promises/issues", 200 "source": "https://github.com/guzzle/promises/tree/2. 2.0"200 "source": "https://github.com/guzzle/promises/tree/2.3.0" 201 201 }, 202 202 "funding": [ … … 218 218 { 219 219 "name": "guzzlehttp/psr7", 220 "version": "2. 7.1",221 "version_normalized": "2. 7.1.0",220 "version": "2.8.0", 221 "version_normalized": "2.8.0.0", 222 222 "source": { 223 223 "type": "git", 224 224 "url": "https://github.com/guzzle/psr7.git", 225 "reference": " c2270caaabe631b3b44c85f99e5a04bbb8060d16"226 }, 227 "dist": { 228 "type": "zip", 229 "url": "https://api.github.com/repos/guzzle/psr7/zipball/ c2270caaabe631b3b44c85f99e5a04bbb8060d16",230 "reference": " c2270caaabe631b3b44c85f99e5a04bbb8060d16",225 "reference": "21dc724a0583619cd1652f673303492272778051" 226 }, 227 "dist": { 228 "type": "zip", 229 "url": "https://api.github.com/repos/guzzle/psr7/zipball/21dc724a0583619cd1652f673303492272778051", 230 "reference": "21dc724a0583619cd1652f673303492272778051", 231 231 "shasum": "" 232 232 }, … … 244 244 "bamarni/composer-bin-plugin": "^1.8.2", 245 245 "http-interop/http-factory-tests": "0.9.0", 246 "phpunit/phpunit": "^8.5. 39 || ^9.6.20"246 "phpunit/phpunit": "^8.5.44 || ^9.6.25" 247 247 }, 248 248 "suggest": { 249 249 "laminas/laminas-httphandlerrunner": "Emit PSR-7 responses" 250 250 }, 251 "time": "2025-0 3-27T12:30:47+00:00",251 "time": "2025-08-23T21:21:41+00:00", 252 252 "type": "library", 253 253 "extra": { … … 317 317 "support": { 318 318 "issues": "https://github.com/guzzle/psr7/issues", 319 "source": "https://github.com/guzzle/psr7/tree/2. 7.1"319 "source": "https://github.com/guzzle/psr7/tree/2.8.0" 320 320 }, 321 321 "funding": [ … … 553 553 { 554 554 "name": "sveaekonomi/checkout", 555 "version": "1. 6.0",556 "version_normalized": "1. 6.0.0",555 "version": "1.7.0", 556 "version_normalized": "1.7.0.0", 557 557 "source": { 558 558 "type": "git", 559 559 "url": "https://github.com/sveawebpay/php-checkout.git", 560 "reference": "d 184c949b60b96595cb786320bf049a5fbaf91df"561 }, 562 "dist": { 563 "type": "zip", 564 "url": "https://api.github.com/repos/sveawebpay/php-checkout/zipball/d 184c949b60b96595cb786320bf049a5fbaf91df",565 "reference": "d 184c949b60b96595cb786320bf049a5fbaf91df",560 "reference": "d6314fff51bee74154301be63d12918aa8e90ccc" 561 }, 562 "dist": { 563 "type": "zip", 564 "url": "https://api.github.com/repos/sveawebpay/php-checkout/zipball/d6314fff51bee74154301be63d12918aa8e90ccc", 565 "reference": "d6314fff51bee74154301be63d12918aa8e90ccc", 566 566 "shasum": "" 567 567 }, … … 579 579 "symfony/dependency-injection": "^2.7.51 || ^2.8.50 || ^3.4.26 || ^4.1.12 || ^4.2.7" 580 580 }, 581 "time": "202 5-06-30T13:03:15+00:00",581 "time": "2026-02-05T10:57:04+00:00", 582 582 "type": "library", 583 583 "installation-source": "dist", 584 584 "autoload": { 585 585 "psr-4": { 586 "Svea\\Checkout\\": "src "586 "Svea\\Checkout\\": "src/" 587 587 } 588 588 }, … … 600 600 "support": { 601 601 "issues": "https://github.com/sveawebpay/php-checkout/issues", 602 "source": "https://github.com/sveawebpay/php-checkout/tree/1. 6.0"602 "source": "https://github.com/sveawebpay/php-checkout/tree/1.7.0" 603 603 }, 604 604 "install-path": "../sveaekonomi/checkout" -
svea-checkout-for-woocommerce/trunk/vendor/composer/installed.php
r3320066 r3454688 12 12 'versions' => array( 13 13 'guzzlehttp/guzzle' => array( 14 'pretty_version' => '7. 9.3',15 'version' => '7. 9.3.0',16 'reference' => ' 7b2f29fe81dc4da0ca0ea7d42107a0845946ea77',14 'pretty_version' => '7.10.0', 15 'version' => '7.10.0.0', 16 'reference' => 'b51ac707cfa420b7bfd4e4d5e510ba8008e822b4', 17 17 'type' => 'library', 18 18 'install_path' => __DIR__ . '/../guzzlehttp/guzzle', … … 21 21 ), 22 22 'guzzlehttp/promises' => array( 23 'pretty_version' => '2. 2.0',24 'version' => '2. 2.0.0',25 'reference' => ' 7c69f28996b0a6920945dd20b3857e499d9ca96c',23 'pretty_version' => '2.3.0', 24 'version' => '2.3.0.0', 25 'reference' => '481557b130ef3790cf82b713667b43030dc9c957', 26 26 'type' => 'library', 27 27 'install_path' => __DIR__ . '/../guzzlehttp/promises', … … 30 30 ), 31 31 'guzzlehttp/psr7' => array( 32 'pretty_version' => '2. 7.1',33 'version' => '2. 7.1.0',34 'reference' => ' c2270caaabe631b3b44c85f99e5a04bbb8060d16',32 'pretty_version' => '2.8.0', 33 'version' => '2.8.0.0', 34 'reference' => '21dc724a0583619cd1652f673303492272778051', 35 35 'type' => 'library', 36 36 'install_path' => __DIR__ . '/../guzzlehttp/psr7', … … 93 93 ), 94 94 'sveaekonomi/checkout' => array( 95 'pretty_version' => '1. 6.0',96 'version' => '1. 6.0.0',97 'reference' => 'd 184c949b60b96595cb786320bf049a5fbaf91df',95 'pretty_version' => '1.7.0', 96 'version' => '1.7.0.0', 97 'reference' => 'd6314fff51bee74154301be63d12918aa8e90ccc', 98 98 'type' => 'library', 99 99 'install_path' => __DIR__ . '/../sveaekonomi/checkout', -
svea-checkout-for-woocommerce/trunk/vendor/guzzlehttp/guzzle/CHANGELOG.md
r3320066 r3454688 2 2 3 3 Please refer to [UPGRADING](UPGRADING.md) guide for upgrading to a major version. 4 5 ## 7.10.0 - 2025-08-23 6 7 ### Added 8 9 - Support for PHP 8.5 10 11 ### Changed 12 13 - Adjusted `guzzlehttp/promises` version constraint to `^2.3` 14 - Adjusted `guzzlehttp/psr7` version constraint to `^2.8` 4 15 5 16 -
svea-checkout-for-woocommerce/trunk/vendor/guzzlehttp/guzzle/composer.json
r3172745 r3454688 82 82 "php": "^7.2.5 || ^8.0", 83 83 "ext-json": "*", 84 "guzzlehttp/promises": "^ 1.5.3 || ^2.0.3",85 "guzzlehttp/psr7": "^2. 7.0",84 "guzzlehttp/promises": "^2.3", 85 "guzzlehttp/psr7": "^2.8", 86 86 "psr/http-client": "^1.0", 87 87 "symfony/deprecation-contracts": "^2.2 || ^3.0" -
svea-checkout-for-woocommerce/trunk/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php
r3172745 r3454688 126 126 127 127 if (\count($this->handles) >= $this->maxHandles) { 128 \curl_close($resource); 128 if (PHP_VERSION_ID < 80000) { 129 \curl_close($resource); 130 } 129 131 } else { 130 132 // Remove all callback functions as they can hold onto references … … 730 732 { 731 733 foreach ($this->handles as $id => $handle) { 732 \curl_close($handle); 734 if (PHP_VERSION_ID < 80000) { 735 \curl_close($handle); 736 } 737 733 738 unset($this->handles[$id]); 734 739 } -
svea-checkout-for-woocommerce/trunk/vendor/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php
r3172745 r3454688 241 241 unset($this->delays[$id], $this->handles[$id]); 242 242 \curl_multi_remove_handle($this->_mh, $handle); 243 \curl_close($handle); 243 244 if (PHP_VERSION_ID < 80000) { 245 \curl_close($handle); 246 } 244 247 245 248 return true; -
svea-checkout-for-woocommerce/trunk/vendor/guzzlehttp/guzzle/src/Handler/StreamHandler.php
r3320066 r3454688 334 334 335 335 return $this->createResource( 336 function () use ($uri, &$http_response_header,$contextResource, $context, $options, $request) {336 function () use ($uri, $contextResource, $context, $options, $request) { 337 337 $resource = @\fopen((string) $uri, 'r', false, $contextResource); 338 339 // See https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_the_http_response_header_predefined_variable 340 if (function_exists('http_get_last_response_headers')) { 341 /** @var array|null */ 342 $http_response_header = \http_get_last_response_headers(); 343 } 344 338 345 $this->lastHeaders = $http_response_header ?? []; 339 346 -
svea-checkout-for-woocommerce/trunk/vendor/guzzlehttp/guzzle/src/Middleware.php
r3172745 r3454688 188 188 * formatter. 189 189 * 190 * @phpstan-param \Psr\Log\LogLevel::* $logLevel Level at which to log requests.191 *192 190 * @param LoggerInterface $logger Logs messages. 193 191 * @param MessageFormatterInterface|MessageFormatter $formatter Formatter used to create message strings. 194 192 * @param string $logLevel Level at which to log requests. 193 * 194 * @phpstan-param \Psr\Log\LogLevel::* $logLevel Level at which to log requests. 195 195 * 196 196 * @return callable Returns a function that accepts the next handler. -
svea-checkout-for-woocommerce/trunk/vendor/guzzlehttp/promises/CHANGELOG.md
r3320066 r3454688 1 1 # CHANGELOG 2 3 4 ## 2.3.0 - 2025-08-22 5 6 ### Added 7 8 - PHP 8.5 support 2 9 3 10 -
svea-checkout-for-woocommerce/trunk/vendor/guzzlehttp/promises/README.md
r3172745 r3454688 42 42 |---------|---------------------|--------------| 43 43 | 1.x | Security fixes only | >=5.5,<8.3 | 44 | 2.x | Latest | >=7.2.5,<8. 5|44 | 2.x | Latest | >=7.2.5,<8.6 | 45 45 46 46 -
svea-checkout-for-woocommerce/trunk/vendor/guzzlehttp/promises/composer.json
r3172745 r3454688 31 31 "require-dev": { 32 32 "bamarni/composer-bin-plugin": "^1.8.2", 33 "phpunit/phpunit": "^8.5. 39 || ^9.6.20"33 "phpunit/phpunit": "^8.5.44 || ^9.6.25" 34 34 }, 35 35 "autoload": { -
svea-checkout-for-woocommerce/trunk/vendor/guzzlehttp/psr7/CHANGELOG.md
r3320066 r3454688 5 5 The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) 6 6 and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). 7 8 ## 2.8.0 - 2025-08-23 9 10 ### Added 11 12 - Allow empty lists as header values 13 14 ### Changed 15 16 - PHP 8.5 support 7 17 8 18 ## 2.7.1 - 2025-03-27 -
svea-checkout-for-woocommerce/trunk/vendor/guzzlehttp/psr7/README.md
r3172745 r3454688 26 26 |---------|---------------------|--------------| 27 27 | 1.x | EOL (2024-06-30) | >=5.4,<8.2 | 28 | 2.x | Latest | >=7.2.5,<8. 5|28 | 2.x | Latest | >=7.2.5,<8.6 | 29 29 30 30 -
svea-checkout-for-woocommerce/trunk/vendor/guzzlehttp/psr7/composer.json
r3172745 r3454688 63 63 "bamarni/composer-bin-plugin": "^1.8.2", 64 64 "http-interop/http-factory-tests": "0.9.0", 65 "phpunit/phpunit": "^8.5. 39 || ^9.6.20"65 "phpunit/phpunit": "^8.5.44 || ^9.6.25" 66 66 }, 67 67 "suggest": { -
svea-checkout-for-woocommerce/trunk/vendor/guzzlehttp/psr7/src/MessageTrait.php
r3088414 r3454688 173 173 if (!is_array($value)) { 174 174 return $this->trimAndValidateHeaderValues([$value]); 175 }176 177 if (count($value) === 0) {178 throw new \InvalidArgumentException('Header value can not be an empty array.');179 175 } 180 176 -
svea-checkout-for-woocommerce/trunk/vendor/guzzlehttp/psr7/src/Utils.php
r3172745 r3454688 398 398 399 399 if ($ex) { 400 /** @var $ex \RuntimeException*/400 /** @var \RuntimeException $ex */ 401 401 throw $ex; 402 402 } … … 445 445 446 446 if ($ex) { 447 /** @var $ex \RuntimeException*/447 /** @var \RuntimeException $ex */ 448 448 throw $ex; 449 449 } -
svea-checkout-for-woocommerce/trunk/vendor/sveaekonomi/checkout/README.md
r3320066 r3454688 54 54 You can also download the library and upload it onto your server. 55 55 56 ### 1.3 Define API timeout (optional) 57 The default timeout for API requests is set to 5 seconds. If you want to change this value you can define the constant `SVEA_CHECKOUT_API_TIMEOUT` before including the library. 58 59 ```php 60 // Set timeout to 10 seconds 61 define('SVEA_CHECKOUT_API_TIMEOUT', 10); 62 // Include the library 63 include 'vendor/autoload.php'; 64 ``` 65 56 66 ### 2. General information 57 67 … … 60 70 61 71 The connector defines what credentials should be used and which environment should be used. 62 63 72 64 73 Parameters for creating Connector are: checkoutMerchantId, checkoutSecret and base API url(environment). … … 794 803 | LEASINGAPPROVED | Leasing (Automatically approved leasing contract) 795 804 | TRUSTLY | The customer paid with Trustly | 805 | APPLEPAY | The customer paid with Apple Pay | 806 | APPLEPAY_PF | The customer paid with Apple Pay via a payment facilitator | 796 807 | Directbank (varies) | The customer paid the order with direct bank e.g. Nordea, SEB. See below for all available parameters | 797 808 -
svea-checkout-for-woocommerce/trunk/vendor/sveaekonomi/checkout/VERSION
r3320066 r3454688 1 1. 6.01 1.7.0 -
svea-checkout-for-woocommerce/trunk/vendor/sveaekonomi/checkout/composer.json
r3320066 r3454688 1 1 { 2 2 "name": "sveaekonomi/checkout", 3 "version": "1. 6.0",3 "version": "1.7.0", 4 4 "description": "Php integration library for Svea Checkout", 5 5 "license": "Apache-2.0", … … 12 12 "autoload": { 13 13 "psr-4": { 14 "Svea\\Checkout\\": "src "14 "Svea\\Checkout\\": "src/" 15 15 } 16 16 }, -
svea-checkout-for-woocommerce/trunk/vendor/sveaekonomi/checkout/src/CheckoutClient.php
r3320066 r3454688 26 26 namespace Svea\Checkout; 27 27 28 use Indeed\Uap\PreviousRanks; 29 use Opis\JsonSchema\Variables\RefVariablesContainer; 28 30 use Svea\Checkout\Implementation\ImplementationInterface; 29 31 use Svea\Checkout\Transport\Connector; -
svea-checkout-for-woocommerce/trunk/vendor/sveaekonomi/checkout/src/Transport/ApiClient.php
r2005541 r3454688 52 52 $this->httpClient->setOption(CURLOPT_RETURNTRANSFER, 1); 53 53 $this->httpClient->setOption(CURLOPT_HEADER, 1); 54 $this->httpClient->setOption(CURLOPT_SSL_VERIFYPEER, false);55 54 56 55 if ($request->getMethod() === 'POST') { … … 68 67 $this->httpClient->setOption(CURLOPT_POSTFIELDS, $request->getBody()); 69 68 } 69 70 // Set a default timeout of 5 seconds if none is defined 71 $timeout = defined('SVEA_CHECKOUT_API_TIMEOUT') ? SVEA_CHECKOUT_API_TIMEOUT : 5; 72 $this->httpClient->setOption(CURLOPT_TIMEOUT, $timeout); 70 73 71 74 $httpResponse = $this->httpClient->execute(); -
svea-checkout-for-woocommerce/trunk/vendor/sveaekonomi/checkout/src/Transport/Http/CurlRequest.php
r1898244 r3454688 11 11 { 12 12 /** 13 * @var null| resource13 * @var null|mixed 14 14 */ 15 15 private $handle = null; -
svea-checkout-for-woocommerce/trunk/vendor/sveaekonomi/checkout/src/Validation/Admin/ValidateDeliverOrderData.php
r2846828 r3454688 19 19 $this->mustBeInteger($data['orderid'], 'Order Id'); 20 20 21 $this->mustBeSet($data, 'orderrowids', 'Order Id');21 $this->mustBeSet($data, 'orderrowids', 'Order Row Ids'); 22 22 $this->mustBeArray($data['orderrowids'], 'Order Row Ids'); 23 23
Note: See TracChangeset
for help on using the changeset viewer.