Plugin Directory

Changeset 3454688


Ignore:
Timestamp:
02/05/2026 02:01:34 PM (2 months ago)
Author:
thegeneration
Message:

Tagging version 3.5.0

Location:
svea-checkout-for-woocommerce
Files:
2 added
2 deleted
78 edited
1 copied

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  
    399399            $wc_order->update_status( 'cancelled', esc_html__( 'Payment not accepted in Svea', 'svea-checkout-for-woocommerce' ) );
    400400        } 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
    401406            $wc_order->payment_complete( $svea_order_id );
    402407            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  
    5050     */
    5151    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();
    5454
    5555            $args = [
     
    5757            ];
    5858
    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'] ) );
    6262        }
    6363
    6464        return $data;
    6565    }
     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    }
    6679}
  • svea-checkout-for-woocommerce/tags/3.5.0/inc/Models/Svea_Checkout.php

    r3398960 r3454688  
    194194            case isset( $checkout_data['Recurring'] ) && $checkout_data['Recurring'] !== $this->is_recurring():
    195195            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':
    200197            case ! isset( $checkout_data['MerchantSettings']['UseClientSideValidation'] ) || $checkout_data['MerchantSettings']['UseClientSideValidation'] !== true:
    201198                $need_new = true;
  • svea-checkout-for-woocommerce/tags/3.5.0/inc/Rule_Integration.php

    r3398960 r3454688  
    297297            }
    298298
     299            /** @var \WC_Product $product */
    299300            $product = $item['data'];
    300301
     
    525526        $is_company = ! empty( $svea_data['Customer']['IsCompany'] ) && $svea_data['Customer']['IsCompany'] === true;
    526527        $first_name = $billing_address['FirstName'] ?? '';
     528        $last_name = $billing_address['LastName'] ?? '';
    527529
    528530        if ( ( empty( $first_name ) || empty( $last_name ) ) && ! empty( $billing_address['FullName'] ) ) {
     
    712714    private function send_event( $tag, array $subscriber, array $fields, $retrying = false, $action = null ) {
    713715        $endpoint = self::ENDPOINT;
    714 
    715         if ( empty( $endpoint ) ) {
    716             return false;
    717         }
     716        $subscriber_id = '';
    718717
    719718        if ( $action === null ) {
     
    743742        if ( $action === 'create' ) {
    744743            $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;
    749746        }
    750747
     
    877874     * @param string     $method   HTTP method.
    878875     * @param string     $endpoint Endpoint URL.
    879      * @param string     $api_key  Rule API key.
    880876     * @param array|null $payload  Optional payload.
    881877     * @return array|WP_Error
  • svea-checkout-for-woocommerce/tags/3.5.0/inc/Template_Handler.php

    r3439569 r3454688  
    266266        }
    267267
     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
    268282        WC()->checkout()->process_checkout();
    269283        wp_die( 0 );
     
    309323        if ( $this->is_svea() && ! wp_doing_ajax() ) {
    310324            // Flush checkout fields cache
    311             WC()->checkout()->checkout_fields = null;
     325            WC()->checkout()->__set( 'checkout_fields', null );
    312326
    313327            // Remove all default fields from WooCommerce to see what gets added by third party plugins
     
    426440     */
    427441    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
    428447        $use_svea = isset( $_POST['svea'] ) && sanitize_text_field( $_POST['svea'] ) === 'true'; // phpcs:ignore WordPress.Security.NonceVerification.Missing
    429448
  • svea-checkout-for-woocommerce/tags/3.5.0/inc/WC_Gateway_Svea_Checkout.php

    r3409597 r3454688  
    77use Svea_Checkout_For_Woocommerce\Models\Svea_Checkout;
    88use Svea_Checkout_For_Woocommerce\Models\Svea_Payment_Admin;
     9use WP_Filesystem_Direct;
    910
    1011if ( ! defined( 'ABSPATH' ) ) {
     
    19901991
    19911992    /**
     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    /**
    19922186     * Initialize Gateway Settings Form Fields
    19932187     */
  • svea-checkout-for-woocommerce/tags/3.5.0/inc/Webhook_Handler.php

    r3409597 r3454688  
    8383
    8484    /**
    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
    8897     */
    8998    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 );
    99142    }
    100143
     
    105148     */
    106149    public function validate_referer() {
    107         if ( $this->gateway->get_option( 'use_ip_restriction' ) !== 'yes' ) {
     150        if ( $this->gateway->get_option( 'use_ip_restriction' ) === 'no' ) {
    108151            return;
    109152        }
     153
    110154        $ip_address = $this->get_referer_ip();
    111155        $ref_ip = ip2long( $ip_address );
     
    145189
    146190        $webhook_data = json_decode( $raw_webhook );
    147         $webhook_data->description = json_decode( $webhook_data->description );
    148         // phpcs:disable WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
    149         $this->gateway::log( sprintf( 'Webhook callback received for Svea cart (%s) received', $webhook_data->orderId ) );
    150191
    151192        $this->validate_referer();
    152193
    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 ) ) {
    154196            $this->gateway::log( 'No orderID was found. Aborting' );
    155197            exit;
    156198        }
    157199
    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 ) );
    159209
    160210        $svea_order = new Svea_Checkout( false );
     
    162212
    163213        try {
    164             self::$svea_order = $svea_order->get( $webhook_data->orderId );
     214            self::$svea_order = $svea_order->get( $svea_order_id );
    165215        } 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() ) );
    167217            status_header( 404 );
    168218            exit;
     
    197247        }
    198248
    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 );
    202284        }
    203285
    204286        // 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        }
    220290
    221291        $wc_order->save();
     
    538608        }
    539609
    540         if ( $this->gateway->get_option( 'use_ip_restriction' ) === 'yes' ) {
    541             $this->validate_referer();
    542         }
     610        $this->validate_referer();
    543611
    544612        $this->gateway::log( sprintf( 'Received push for order %s', $this->svea_order_id ) );
     
    597665        }
    598666
    599         if ( $this->gateway->get_option( 'use_ip_restriction' ) === 'yes' ) {
    600             $this->validate_referer();
    601         }
     667        $this->validate_referer();
    602668
    603669        $wc_order = wc_get_order( $wc_order_id );
  • svea-checkout-for-woocommerce/tags/3.5.0/inc/settings-svea-checkout.php

    r3398960 r3454688  
    556556        ],
    557557        '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',
    560569            '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.',
    564571                'svea-checkout-for-woocommerce'
    565572            ),
    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'     => '',
    567582        ],
    568583        'other_settings_hr'               => [
     
    580595            'default' => 'no',
    581596        ],
     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        ],
    582609    ]
    583610);
  • svea-checkout-for-woocommerce/tags/3.5.0/readme.txt

    r3439569 r3454688  
    1010License: Apache 2.0
    1111License URI: https://www.apache.org/licenses/LICENSE-2.0
    12 Stable tag: 3.4.3
     12Stable tag: 3.5.0
    1313
    1414Supercharge your WooCommerce Store with powerful features to pay via Svea Checkout!
     
    9191== Upgrade Notice ==
    9292
     93= 3.5.0 =
     943.5.0 is a minor release
     95
    9396= 3.4.3 =
    94973.4.3 is a patch release
     
    420423
    421424== 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.
    422435
    423436= 3.4.3 2026-01-14 =
  • svea-checkout-for-woocommerce/tags/3.5.0/svea-checkout-for-woocommerce.php

    r3439569 r3454688  
    33namespace Svea_Checkout_For_Woocommerce;
    44
     5use Svea\Checkout\Transport\Connector;
    56use Svea_Checkout_For_Woocommerce\Compat\Compat;
    67
     
    1415 * Plugin URI: https://wordpress.org/plugins/svea-checkout-for-woocommerce/
    1516 * Description: Process payments in WooCommerce via Svea Checkout.
    16  * Version: 3.4.3
     17 * Version: 3.5.0
    1718 * Requires Plugins: woocommerce
    1819 * Author: The Generation AB
     
    4748         * Version of plugin
    4849         */
    49         const VERSION = '3.4.3';
     50        const VERSION = '3.5.0';
    5051
    5152        /**
     
    6263         */
    6364        public $instore;
    64 
    65         /**
    66          * Session_Table class
    67          *
    68          * @var Session_Table
    69          */
    70         public $session_table;
    7165
    7266        /**
     
    286280            $this->instore = new Instore();
    287281            $this->instore->init();
    288 
    289             $this->session_table = new Session_Table();
    290             $this->session_table->init();
    291282        }
    292283
  • svea-checkout-for-woocommerce/tags/3.5.0/templates/svea-checkout.php

    r3320066 r3454688  
    6868
    6969            <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() ); ?>">
    7171
    7272                <?php do_action( 'woocommerce_checkout_before_order_review_heading' ); ?>
  • svea-checkout-for-woocommerce/tags/3.5.0/vendor/autoload.php

    r3320066 r3454688  
    2020require_once __DIR__ . '/composer/autoload_real.php';
    2121
    22 return ComposerAutoloaderInit4cfdf47045179a2c4f6ff86b1bce3df2::getLoader();
     22return ComposerAutoloaderInit07e217451f0a071aa7dcb642a1b22b09::getLoader();
  • svea-checkout-for-woocommerce/tags/3.5.0/vendor/composer/autoload_classmap.php

    r3398960 r3454688  
    212212    'Svea_Checkout_For_Woocommerce\\Rule_Integration' => $baseDir . '/inc/Rule_Integration.php',
    213213    'Svea_Checkout_For_Woocommerce\\Scripts' => $baseDir . '/inc/Scripts.php',
    214     'Svea_Checkout_For_Woocommerce\\Session_Table' => $baseDir . '/inc/Session_Table.php',
    215214    'Svea_Checkout_For_Woocommerce\\Template_Handler' => $baseDir . '/inc/Template_Handler.php',
    216215    '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  
    33// autoload_real.php @generated by Composer
    44
    5 class ComposerAutoloaderInit4cfdf47045179a2c4f6ff86b1bce3df2
     5class ComposerAutoloaderInit07e217451f0a071aa7dcb642a1b22b09
    66{
    77    private static $loader;
     
    2525        require __DIR__ . '/platform_check.php';
    2626
    27         spl_autoload_register(array('ComposerAutoloaderInit4cfdf47045179a2c4f6ff86b1bce3df2', 'loadClassLoader'), true, true);
     27        spl_autoload_register(array('ComposerAutoloaderInit07e217451f0a071aa7dcb642a1b22b09', 'loadClassLoader'), true, true);
    2828        self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
    29         spl_autoload_unregister(array('ComposerAutoloaderInit4cfdf47045179a2c4f6ff86b1bce3df2', 'loadClassLoader'));
     29        spl_autoload_unregister(array('ComposerAutoloaderInit07e217451f0a071aa7dcb642a1b22b09', 'loadClassLoader'));
    3030
    3131        require __DIR__ . '/autoload_static.php';
    32         call_user_func(\Composer\Autoload\ComposerStaticInit4cfdf47045179a2c4f6ff86b1bce3df2::getInitializer($loader));
     32        call_user_func(\Composer\Autoload\ComposerStaticInit07e217451f0a071aa7dcb642a1b22b09::getInitializer($loader));
    3333
    3434        $loader->register(true);
    3535
    36         $filesToLoad = \Composer\Autoload\ComposerStaticInit4cfdf47045179a2c4f6ff86b1bce3df2::$files;
     36        $filesToLoad = \Composer\Autoload\ComposerStaticInit07e217451f0a071aa7dcb642a1b22b09::$files;
    3737        $requireFile = \Closure::bind(static function ($fileIdentifier, $file) {
    3838            if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
  • svea-checkout-for-woocommerce/tags/3.5.0/vendor/composer/autoload_static.php

    r3398960 r3454688  
    55namespace Composer\Autoload;
    66
    7 class ComposerStaticInit4cfdf47045179a2c4f6ff86b1bce3df2
     7class ComposerStaticInit07e217451f0a071aa7dcb642a1b22b09
    88{
    99    public static $files = array (
     
    275275        'Svea_Checkout_For_Woocommerce\\Rule_Integration' => __DIR__ . '/../..' . '/inc/Rule_Integration.php',
    276276        'Svea_Checkout_For_Woocommerce\\Scripts' => __DIR__ . '/../..' . '/inc/Scripts.php',
    277         'Svea_Checkout_For_Woocommerce\\Session_Table' => __DIR__ . '/../..' . '/inc/Session_Table.php',
    278277        'Svea_Checkout_For_Woocommerce\\Template_Handler' => __DIR__ . '/../..' . '/inc/Template_Handler.php',
    279278        'Svea_Checkout_For_Woocommerce\\Utils\\Array_Utils' => __DIR__ . '/../..' . '/inc/Utils/Array_Utils.php',
     
    287286    {
    288287        return \Closure::bind(function () use ($loader) {
    289             $loader->prefixLengthsPsr4 = ComposerStaticInit4cfdf47045179a2c4f6ff86b1bce3df2::$prefixLengthsPsr4;
    290             $loader->prefixDirsPsr4 = ComposerStaticInit4cfdf47045179a2c4f6ff86b1bce3df2::$prefixDirsPsr4;
    291             $loader->classMap = ComposerStaticInit4cfdf47045179a2c4f6ff86b1bce3df2::$classMap;
     288            $loader->prefixLengthsPsr4 = ComposerStaticInit07e217451f0a071aa7dcb642a1b22b09::$prefixLengthsPsr4;
     289            $loader->prefixDirsPsr4 = ComposerStaticInit07e217451f0a071aa7dcb642a1b22b09::$prefixDirsPsr4;
     290            $loader->classMap = ComposerStaticInit07e217451f0a071aa7dcb642a1b22b09::$classMap;
    292291
    293292        }, null, ClassLoader::class);
  • svea-checkout-for-woocommerce/tags/3.5.0/vendor/composer/installed.json

    r3320066 r3454688  
    33        {
    44            "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",
    77            "source": {
    88                "type": "git",
    99                "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",
    1616                "shasum": ""
    1717            },
    1818            "require": {
    1919                "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",
    2222                "php": "^7.2.5 || ^8.0",
    2323                "psr/http-client": "^1.0",
     
    4040                "psr/log": "Required for using the Log middleware"
    4141            },
    42             "time": "2025-03-27T13:37:11+00:00",
     42            "time": "2025-08-23T22:36:01+00:00",
    4343            "type": "library",
    4444            "extra": {
     
    112112            "support": {
    113113                "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"
    115115            },
    116116            "funding": [
     
    132132        {
    133133            "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",
    136136            "source": {
    137137                "type": "git",
    138138                "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",
    145145                "shasum": ""
    146146            },
     
    150150            "require-dev": {
    151151                "bamarni/composer-bin-plugin": "^1.8.2",
    152                 "phpunit/phpunit": "^8.5.39 || ^9.6.20"
    153             },
    154             "time": "2025-03-27T13:27:01+00:00",
     152                "phpunit/phpunit": "^8.5.44 || ^9.6.25"
     153            },
     154            "time": "2025-08-22T14:34:08+00:00",
    155155            "type": "library",
    156156            "extra": {
     
    198198            "support": {
    199199                "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"
    201201            },
    202202            "funding": [
     
    218218        {
    219219            "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",
    222222            "source": {
    223223                "type": "git",
    224224                "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",
    231231                "shasum": ""
    232232            },
     
    244244                "bamarni/composer-bin-plugin": "^1.8.2",
    245245                "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"
    247247            },
    248248            "suggest": {
    249249                "laminas/laminas-httphandlerrunner": "Emit PSR-7 responses"
    250250            },
    251             "time": "2025-03-27T12:30:47+00:00",
     251            "time": "2025-08-23T21:21:41+00:00",
    252252            "type": "library",
    253253            "extra": {
     
    317317            "support": {
    318318                "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"
    320320            },
    321321            "funding": [
     
    553553        {
    554554            "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",
    557557            "source": {
    558558                "type": "git",
    559559                "url": "https://github.com/sveawebpay/php-checkout.git",
    560                 "reference": "d184c949b60b96595cb786320bf049a5fbaf91df"
    561             },
    562             "dist": {
    563                 "type": "zip",
    564                 "url": "https://api.github.com/repos/sveawebpay/php-checkout/zipball/d184c949b60b96595cb786320bf049a5fbaf91df",
    565                 "reference": "d184c949b60b96595cb786320bf049a5fbaf91df",
     560                "reference": "d6314fff51bee74154301be63d12918aa8e90ccc"
     561            },
     562            "dist": {
     563                "type": "zip",
     564                "url": "https://api.github.com/repos/sveawebpay/php-checkout/zipball/d6314fff51bee74154301be63d12918aa8e90ccc",
     565                "reference": "d6314fff51bee74154301be63d12918aa8e90ccc",
    566566                "shasum": ""
    567567            },
     
    579579                "symfony/dependency-injection": "^2.7.51 || ^2.8.50 || ^3.4.26 || ^4.1.12 || ^4.2.7"
    580580            },
    581             "time": "2025-06-30T13:03:15+00:00",
     581            "time": "2026-02-05T10:57:04+00:00",
    582582            "type": "library",
    583583            "installation-source": "dist",
    584584            "autoload": {
    585585                "psr-4": {
    586                     "Svea\\Checkout\\": "src"
     586                    "Svea\\Checkout\\": "src/"
    587587                }
    588588            },
     
    600600            "support": {
    601601                "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"
    603603            },
    604604            "install-path": "../sveaekonomi/checkout"
  • svea-checkout-for-woocommerce/tags/3.5.0/vendor/composer/installed.php

    r3320066 r3454688  
    1212    'versions' => array(
    1313        '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',
    1717            'type' => 'library',
    1818            'install_path' => __DIR__ . '/../guzzlehttp/guzzle',
     
    2121        ),
    2222        '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',
    2626            'type' => 'library',
    2727            'install_path' => __DIR__ . '/../guzzlehttp/promises',
     
    3030        ),
    3131        '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',
    3535            'type' => 'library',
    3636            'install_path' => __DIR__ . '/../guzzlehttp/psr7',
     
    9393        ),
    9494        'sveaekonomi/checkout' => array(
    95             'pretty_version' => '1.6.0',
    96             'version' => '1.6.0.0',
    97             'reference' => 'd184c949b60b96595cb786320bf049a5fbaf91df',
     95            'pretty_version' => '1.7.0',
     96            'version' => '1.7.0.0',
     97            'reference' => 'd6314fff51bee74154301be63d12918aa8e90ccc',
    9898            'type' => 'library',
    9999            'install_path' => __DIR__ . '/../sveaekonomi/checkout',
  • svea-checkout-for-woocommerce/tags/3.5.0/vendor/guzzlehttp/guzzle/CHANGELOG.md

    r3320066 r3454688  
    22
    33Please 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`
    415
    516
  • svea-checkout-for-woocommerce/tags/3.5.0/vendor/guzzlehttp/guzzle/composer.json

    r3172745 r3454688  
    8282        "php": "^7.2.5 || ^8.0",
    8383        "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",
    8686        "psr/http-client": "^1.0",
    8787        "symfony/deprecation-contracts": "^2.2 || ^3.0"
  • svea-checkout-for-woocommerce/tags/3.5.0/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php

    r3172745 r3454688  
    126126
    127127        if (\count($this->handles) >= $this->maxHandles) {
    128             \curl_close($resource);
     128            if (PHP_VERSION_ID < 80000) {
     129                \curl_close($resource);
     130            }
    129131        } else {
    130132            // Remove all callback functions as they can hold onto references
     
    730732    {
    731733        foreach ($this->handles as $id => $handle) {
    732             \curl_close($handle);
     734            if (PHP_VERSION_ID < 80000) {
     735                \curl_close($handle);
     736            }
     737
    733738            unset($this->handles[$id]);
    734739        }
  • svea-checkout-for-woocommerce/tags/3.5.0/vendor/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php

    r3172745 r3454688  
    241241        unset($this->delays[$id], $this->handles[$id]);
    242242        \curl_multi_remove_handle($this->_mh, $handle);
    243         \curl_close($handle);
     243
     244        if (PHP_VERSION_ID < 80000) {
     245            \curl_close($handle);
     246        }
    244247
    245248        return true;
  • svea-checkout-for-woocommerce/tags/3.5.0/vendor/guzzlehttp/guzzle/src/Handler/StreamHandler.php

    r3320066 r3454688  
    334334
    335335        return $this->createResource(
    336             function () use ($uri, &$http_response_header, $contextResource, $context, $options, $request) {
     336            function () use ($uri, $contextResource, $context, $options, $request) {
    337337                $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
    338345                $this->lastHeaders = $http_response_header ?? [];
    339346
  • svea-checkout-for-woocommerce/tags/3.5.0/vendor/guzzlehttp/guzzle/src/Middleware.php

    r3172745 r3454688  
    188188     * formatter.
    189189     *
    190      * @phpstan-param \Psr\Log\LogLevel::* $logLevel  Level at which to log requests.
    191      *
    192190     * @param LoggerInterface                            $logger    Logs messages.
    193191     * @param MessageFormatterInterface|MessageFormatter $formatter Formatter used to create message strings.
    194192     * @param string                                     $logLevel  Level at which to log requests.
     193     *
     194     * @phpstan-param \Psr\Log\LogLevel::* $logLevel Level at which to log requests.
    195195     *
    196196     * @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  
    11# CHANGELOG
     2
     3
     4## 2.3.0 - 2025-08-22
     5
     6### Added
     7
     8- PHP 8.5 support
    29
    310
  • svea-checkout-for-woocommerce/tags/3.5.0/vendor/guzzlehttp/promises/README.md

    r3172745 r3454688  
    4242|---------|---------------------|--------------|
    4343| 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 |
    4545
    4646
  • svea-checkout-for-woocommerce/tags/3.5.0/vendor/guzzlehttp/promises/composer.json

    r3172745 r3454688  
    3131    "require-dev": {
    3232        "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"
    3434    },
    3535    "autoload": {
  • svea-checkout-for-woocommerce/tags/3.5.0/vendor/guzzlehttp/psr7/CHANGELOG.md

    r3320066 r3454688  
    55The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
    66and 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
    717
    818## 2.7.1 - 2025-03-27
  • svea-checkout-for-woocommerce/tags/3.5.0/vendor/guzzlehttp/psr7/README.md

    r3172745 r3454688  
    2626|---------|---------------------|--------------|
    2727| 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 |
    2929
    3030
  • svea-checkout-for-woocommerce/tags/3.5.0/vendor/guzzlehttp/psr7/composer.json

    r3172745 r3454688  
    6363        "bamarni/composer-bin-plugin": "^1.8.2",
    6464        "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"
    6666    },
    6767    "suggest": {
  • svea-checkout-for-woocommerce/tags/3.5.0/vendor/guzzlehttp/psr7/src/MessageTrait.php

    r3088414 r3454688  
    173173        if (!is_array($value)) {
    174174            return $this->trimAndValidateHeaderValues([$value]);
    175         }
    176 
    177         if (count($value) === 0) {
    178             throw new \InvalidArgumentException('Header value can not be an empty array.');
    179175        }
    180176
  • svea-checkout-for-woocommerce/tags/3.5.0/vendor/guzzlehttp/psr7/src/Utils.php

    r3172745 r3454688  
    398398
    399399        if ($ex) {
    400             /** @var $ex \RuntimeException */
     400            /** @var \RuntimeException $ex */
    401401            throw $ex;
    402402        }
     
    445445
    446446        if ($ex) {
    447             /** @var $ex \RuntimeException */
     447            /** @var \RuntimeException $ex */
    448448            throw $ex;
    449449        }
  • svea-checkout-for-woocommerce/tags/3.5.0/vendor/sveaekonomi/checkout/README.md

    r3320066 r3454688  
    5454You can also download the library and upload it onto your server.
    5555
     56### 1.3 Define API timeout (optional)
     57The 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
     61define('SVEA_CHECKOUT_API_TIMEOUT', 10);
     62// Include the library
     63include 'vendor/autoload.php';
     64```
     65
    5666### 2. General information
    5767
     
    6070
    6171The connector defines what credentials should be used and which environment should be used.
    62 
    6372
    6473Parameters for creating Connector are: checkoutMerchantId, checkoutSecret and base API url(environment).
     
    794803| LEASINGAPPROVED | Leasing (Automatically approved leasing contract)
    795804| 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 |
    796807| Directbank (varies)  |    The customer paid the order with direct bank e.g. Nordea, SEB. See below for all available parameters |
    797808
  • svea-checkout-for-woocommerce/tags/3.5.0/vendor/sveaekonomi/checkout/VERSION

    r3320066 r3454688  
    1 1.6.0
     11.7.0
  • svea-checkout-for-woocommerce/tags/3.5.0/vendor/sveaekonomi/checkout/composer.json

    r3320066 r3454688  
    11{
    22  "name": "sveaekonomi/checkout",
    3   "version": "1.6.0",
     3  "version": "1.7.0",
    44  "description": "Php integration library for Svea Checkout",
    55  "license": "Apache-2.0",
     
    1212  "autoload": {
    1313    "psr-4": {
    14       "Svea\\Checkout\\": "src"
     14      "Svea\\Checkout\\": "src/"
    1515    }
    1616  },
  • svea-checkout-for-woocommerce/tags/3.5.0/vendor/sveaekonomi/checkout/src/CheckoutClient.php

    r3320066 r3454688  
    2626namespace Svea\Checkout;
    2727
     28use Indeed\Uap\PreviousRanks;
     29use Opis\JsonSchema\Variables\RefVariablesContainer;
    2830use Svea\Checkout\Implementation\ImplementationInterface;
    2931use Svea\Checkout\Transport\Connector;
  • svea-checkout-for-woocommerce/tags/3.5.0/vendor/sveaekonomi/checkout/src/Transport/ApiClient.php

    r2005541 r3454688  
    5252        $this->httpClient->setOption(CURLOPT_RETURNTRANSFER, 1);
    5353        $this->httpClient->setOption(CURLOPT_HEADER, 1);
    54         $this->httpClient->setOption(CURLOPT_SSL_VERIFYPEER, false);
    5554
    5655        if ($request->getMethod() === 'POST') {
     
    6867            $this->httpClient->setOption(CURLOPT_POSTFIELDS, $request->getBody());
    6968        }
     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);
    7073
    7174        $httpResponse = $this->httpClient->execute();
  • svea-checkout-for-woocommerce/tags/3.5.0/vendor/sveaekonomi/checkout/src/Transport/Http/CurlRequest.php

    r1898244 r3454688  
    1111{
    1212    /**
    13      * @var null|resource
     13     * @var null|mixed
    1414     */
    1515    private $handle = null;
  • svea-checkout-for-woocommerce/tags/3.5.0/vendor/sveaekonomi/checkout/src/Validation/Admin/ValidateDeliverOrderData.php

    r2846828 r3454688  
    1919        $this->mustBeInteger($data['orderid'], 'Order Id');
    2020
    21         $this->mustBeSet($data, 'orderrowids', 'Order Id');
     21        $this->mustBeSet($data, 'orderrowids', 'Order Row Ids');
    2222        $this->mustBeArray($data['orderrowids'], 'Order Row Ids');
    2323
  • 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  
    399399            $wc_order->update_status( 'cancelled', esc_html__( 'Payment not accepted in Svea', 'svea-checkout-for-woocommerce' ) );
    400400        } 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
    401406            $wc_order->payment_complete( $svea_order_id );
    402407            wp_clear_scheduled_hook( 'sco_check_pa_order_status', [ $svea_order_id ] );
  • svea-checkout-for-woocommerce/trunk/inc/Compat/Polylang_Compat.php

    r3202226 r3454688  
    5050     */
    5151    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();
    5454
    5555            $args = [
     
    5757            ];
    5858
    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'] ) );
    6262        }
    6363
    6464        return $data;
    6565    }
     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    }
    6679}
  • svea-checkout-for-woocommerce/trunk/inc/Models/Svea_Checkout.php

    r3398960 r3454688  
    194194            case isset( $checkout_data['Recurring'] ) && $checkout_data['Recurring'] !== $this->is_recurring():
    195195            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':
    200197            case ! isset( $checkout_data['MerchantSettings']['UseClientSideValidation'] ) || $checkout_data['MerchantSettings']['UseClientSideValidation'] !== true:
    201198                $need_new = true;
  • svea-checkout-for-woocommerce/trunk/inc/Rule_Integration.php

    r3398960 r3454688  
    297297            }
    298298
     299            /** @var \WC_Product $product */
    299300            $product = $item['data'];
    300301
     
    525526        $is_company = ! empty( $svea_data['Customer']['IsCompany'] ) && $svea_data['Customer']['IsCompany'] === true;
    526527        $first_name = $billing_address['FirstName'] ?? '';
     528        $last_name = $billing_address['LastName'] ?? '';
    527529
    528530        if ( ( empty( $first_name ) || empty( $last_name ) ) && ! empty( $billing_address['FullName'] ) ) {
     
    712714    private function send_event( $tag, array $subscriber, array $fields, $retrying = false, $action = null ) {
    713715        $endpoint = self::ENDPOINT;
    714 
    715         if ( empty( $endpoint ) ) {
    716             return false;
    717         }
     716        $subscriber_id = '';
    718717
    719718        if ( $action === null ) {
     
    743742        if ( $action === 'create' ) {
    744743            $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;
    749746        }
    750747
     
    877874     * @param string     $method   HTTP method.
    878875     * @param string     $endpoint Endpoint URL.
    879      * @param string     $api_key  Rule API key.
    880876     * @param array|null $payload  Optional payload.
    881877     * @return array|WP_Error
  • svea-checkout-for-woocommerce/trunk/inc/Template_Handler.php

    r3439569 r3454688  
    266266        }
    267267
     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
    268282        WC()->checkout()->process_checkout();
    269283        wp_die( 0 );
     
    309323        if ( $this->is_svea() && ! wp_doing_ajax() ) {
    310324            // Flush checkout fields cache
    311             WC()->checkout()->checkout_fields = null;
     325            WC()->checkout()->__set( 'checkout_fields', null );
    312326
    313327            // Remove all default fields from WooCommerce to see what gets added by third party plugins
     
    426440     */
    427441    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
    428447        $use_svea = isset( $_POST['svea'] ) && sanitize_text_field( $_POST['svea'] ) === 'true'; // phpcs:ignore WordPress.Security.NonceVerification.Missing
    429448
  • svea-checkout-for-woocommerce/trunk/inc/WC_Gateway_Svea_Checkout.php

    r3409597 r3454688  
    77use Svea_Checkout_For_Woocommerce\Models\Svea_Checkout;
    88use Svea_Checkout_For_Woocommerce\Models\Svea_Payment_Admin;
     9use WP_Filesystem_Direct;
    910
    1011if ( ! defined( 'ABSPATH' ) ) {
     
    19901991
    19911992    /**
     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    /**
    19922186     * Initialize Gateway Settings Form Fields
    19932187     */
  • svea-checkout-for-woocommerce/trunk/inc/Webhook_Handler.php

    r3409597 r3454688  
    8383
    8484    /**
    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
    8897     */
    8998    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 );
    99142    }
    100143
     
    105148     */
    106149    public function validate_referer() {
    107         if ( $this->gateway->get_option( 'use_ip_restriction' ) !== 'yes' ) {
     150        if ( $this->gateway->get_option( 'use_ip_restriction' ) === 'no' ) {
    108151            return;
    109152        }
     153
    110154        $ip_address = $this->get_referer_ip();
    111155        $ref_ip = ip2long( $ip_address );
     
    145189
    146190        $webhook_data = json_decode( $raw_webhook );
    147         $webhook_data->description = json_decode( $webhook_data->description );
    148         // phpcs:disable WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
    149         $this->gateway::log( sprintf( 'Webhook callback received for Svea cart (%s) received', $webhook_data->orderId ) );
    150191
    151192        $this->validate_referer();
    152193
    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 ) ) {
    154196            $this->gateway::log( 'No orderID was found. Aborting' );
    155197            exit;
    156198        }
    157199
    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 ) );
    159209
    160210        $svea_order = new Svea_Checkout( false );
     
    162212
    163213        try {
    164             self::$svea_order = $svea_order->get( $webhook_data->orderId );
     214            self::$svea_order = $svea_order->get( $svea_order_id );
    165215        } 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() ) );
    167217            status_header( 404 );
    168218            exit;
     
    197247        }
    198248
    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 );
    202284        }
    203285
    204286        // 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        }
    220290
    221291        $wc_order->save();
     
    538608        }
    539609
    540         if ( $this->gateway->get_option( 'use_ip_restriction' ) === 'yes' ) {
    541             $this->validate_referer();
    542         }
     610        $this->validate_referer();
    543611
    544612        $this->gateway::log( sprintf( 'Received push for order %s', $this->svea_order_id ) );
     
    597665        }
    598666
    599         if ( $this->gateway->get_option( 'use_ip_restriction' ) === 'yes' ) {
    600             $this->validate_referer();
    601         }
     667        $this->validate_referer();
    602668
    603669        $wc_order = wc_get_order( $wc_order_id );
  • svea-checkout-for-woocommerce/trunk/inc/settings-svea-checkout.php

    r3398960 r3454688  
    556556        ],
    557557        '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',
    560569            '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.',
    564571                'svea-checkout-for-woocommerce'
    565572            ),
    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'     => '',
    567582        ],
    568583        'other_settings_hr'               => [
     
    580595            'default' => 'no',
    581596        ],
     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        ],
    582609    ]
    583610);
  • svea-checkout-for-woocommerce/trunk/readme.txt

    r3439569 r3454688  
    1010License: Apache 2.0
    1111License URI: https://www.apache.org/licenses/LICENSE-2.0
    12 Stable tag: 3.4.3
     12Stable tag: 3.5.0
    1313
    1414Supercharge your WooCommerce Store with powerful features to pay via Svea Checkout!
     
    9191== Upgrade Notice ==
    9292
     93= 3.5.0 =
     943.5.0 is a minor release
     95
    9396= 3.4.3 =
    94973.4.3 is a patch release
     
    420423
    421424== 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.
    422435
    423436= 3.4.3 2026-01-14 =
  • svea-checkout-for-woocommerce/trunk/svea-checkout-for-woocommerce.php

    r3439569 r3454688  
    33namespace Svea_Checkout_For_Woocommerce;
    44
     5use Svea\Checkout\Transport\Connector;
    56use Svea_Checkout_For_Woocommerce\Compat\Compat;
    67
     
    1415 * Plugin URI: https://wordpress.org/plugins/svea-checkout-for-woocommerce/
    1516 * Description: Process payments in WooCommerce via Svea Checkout.
    16  * Version: 3.4.3
     17 * Version: 3.5.0
    1718 * Requires Plugins: woocommerce
    1819 * Author: The Generation AB
     
    4748         * Version of plugin
    4849         */
    49         const VERSION = '3.4.3';
     50        const VERSION = '3.5.0';
    5051
    5152        /**
     
    6263         */
    6364        public $instore;
    64 
    65         /**
    66          * Session_Table class
    67          *
    68          * @var Session_Table
    69          */
    70         public $session_table;
    7165
    7266        /**
     
    286280            $this->instore = new Instore();
    287281            $this->instore->init();
    288 
    289             $this->session_table = new Session_Table();
    290             $this->session_table->init();
    291282        }
    292283
  • svea-checkout-for-woocommerce/trunk/templates/svea-checkout.php

    r3320066 r3454688  
    6868
    6969            <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() ); ?>">
    7171
    7272                <?php do_action( 'woocommerce_checkout_before_order_review_heading' ); ?>
  • svea-checkout-for-woocommerce/trunk/vendor/autoload.php

    r3320066 r3454688  
    2020require_once __DIR__ . '/composer/autoload_real.php';
    2121
    22 return ComposerAutoloaderInit4cfdf47045179a2c4f6ff86b1bce3df2::getLoader();
     22return ComposerAutoloaderInit07e217451f0a071aa7dcb642a1b22b09::getLoader();
  • svea-checkout-for-woocommerce/trunk/vendor/composer/autoload_classmap.php

    r3398960 r3454688  
    212212    'Svea_Checkout_For_Woocommerce\\Rule_Integration' => $baseDir . '/inc/Rule_Integration.php',
    213213    'Svea_Checkout_For_Woocommerce\\Scripts' => $baseDir . '/inc/Scripts.php',
    214     'Svea_Checkout_For_Woocommerce\\Session_Table' => $baseDir . '/inc/Session_Table.php',
    215214    'Svea_Checkout_For_Woocommerce\\Template_Handler' => $baseDir . '/inc/Template_Handler.php',
    216215    '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  
    33// autoload_real.php @generated by Composer
    44
    5 class ComposerAutoloaderInit4cfdf47045179a2c4f6ff86b1bce3df2
     5class ComposerAutoloaderInit07e217451f0a071aa7dcb642a1b22b09
    66{
    77    private static $loader;
     
    2525        require __DIR__ . '/platform_check.php';
    2626
    27         spl_autoload_register(array('ComposerAutoloaderInit4cfdf47045179a2c4f6ff86b1bce3df2', 'loadClassLoader'), true, true);
     27        spl_autoload_register(array('ComposerAutoloaderInit07e217451f0a071aa7dcb642a1b22b09', 'loadClassLoader'), true, true);
    2828        self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
    29         spl_autoload_unregister(array('ComposerAutoloaderInit4cfdf47045179a2c4f6ff86b1bce3df2', 'loadClassLoader'));
     29        spl_autoload_unregister(array('ComposerAutoloaderInit07e217451f0a071aa7dcb642a1b22b09', 'loadClassLoader'));
    3030
    3131        require __DIR__ . '/autoload_static.php';
    32         call_user_func(\Composer\Autoload\ComposerStaticInit4cfdf47045179a2c4f6ff86b1bce3df2::getInitializer($loader));
     32        call_user_func(\Composer\Autoload\ComposerStaticInit07e217451f0a071aa7dcb642a1b22b09::getInitializer($loader));
    3333
    3434        $loader->register(true);
    3535
    36         $filesToLoad = \Composer\Autoload\ComposerStaticInit4cfdf47045179a2c4f6ff86b1bce3df2::$files;
     36        $filesToLoad = \Composer\Autoload\ComposerStaticInit07e217451f0a071aa7dcb642a1b22b09::$files;
    3737        $requireFile = \Closure::bind(static function ($fileIdentifier, $file) {
    3838            if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
  • svea-checkout-for-woocommerce/trunk/vendor/composer/autoload_static.php

    r3398960 r3454688  
    55namespace Composer\Autoload;
    66
    7 class ComposerStaticInit4cfdf47045179a2c4f6ff86b1bce3df2
     7class ComposerStaticInit07e217451f0a071aa7dcb642a1b22b09
    88{
    99    public static $files = array (
     
    275275        'Svea_Checkout_For_Woocommerce\\Rule_Integration' => __DIR__ . '/../..' . '/inc/Rule_Integration.php',
    276276        'Svea_Checkout_For_Woocommerce\\Scripts' => __DIR__ . '/../..' . '/inc/Scripts.php',
    277         'Svea_Checkout_For_Woocommerce\\Session_Table' => __DIR__ . '/../..' . '/inc/Session_Table.php',
    278277        'Svea_Checkout_For_Woocommerce\\Template_Handler' => __DIR__ . '/../..' . '/inc/Template_Handler.php',
    279278        'Svea_Checkout_For_Woocommerce\\Utils\\Array_Utils' => __DIR__ . '/../..' . '/inc/Utils/Array_Utils.php',
     
    287286    {
    288287        return \Closure::bind(function () use ($loader) {
    289             $loader->prefixLengthsPsr4 = ComposerStaticInit4cfdf47045179a2c4f6ff86b1bce3df2::$prefixLengthsPsr4;
    290             $loader->prefixDirsPsr4 = ComposerStaticInit4cfdf47045179a2c4f6ff86b1bce3df2::$prefixDirsPsr4;
    291             $loader->classMap = ComposerStaticInit4cfdf47045179a2c4f6ff86b1bce3df2::$classMap;
     288            $loader->prefixLengthsPsr4 = ComposerStaticInit07e217451f0a071aa7dcb642a1b22b09::$prefixLengthsPsr4;
     289            $loader->prefixDirsPsr4 = ComposerStaticInit07e217451f0a071aa7dcb642a1b22b09::$prefixDirsPsr4;
     290            $loader->classMap = ComposerStaticInit07e217451f0a071aa7dcb642a1b22b09::$classMap;
    292291
    293292        }, null, ClassLoader::class);
  • svea-checkout-for-woocommerce/trunk/vendor/composer/installed.json

    r3320066 r3454688  
    33        {
    44            "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",
    77            "source": {
    88                "type": "git",
    99                "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",
    1616                "shasum": ""
    1717            },
    1818            "require": {
    1919                "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",
    2222                "php": "^7.2.5 || ^8.0",
    2323                "psr/http-client": "^1.0",
     
    4040                "psr/log": "Required for using the Log middleware"
    4141            },
    42             "time": "2025-03-27T13:37:11+00:00",
     42            "time": "2025-08-23T22:36:01+00:00",
    4343            "type": "library",
    4444            "extra": {
     
    112112            "support": {
    113113                "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"
    115115            },
    116116            "funding": [
     
    132132        {
    133133            "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",
    136136            "source": {
    137137                "type": "git",
    138138                "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",
    145145                "shasum": ""
    146146            },
     
    150150            "require-dev": {
    151151                "bamarni/composer-bin-plugin": "^1.8.2",
    152                 "phpunit/phpunit": "^8.5.39 || ^9.6.20"
    153             },
    154             "time": "2025-03-27T13:27:01+00:00",
     152                "phpunit/phpunit": "^8.5.44 || ^9.6.25"
     153            },
     154            "time": "2025-08-22T14:34:08+00:00",
    155155            "type": "library",
    156156            "extra": {
     
    198198            "support": {
    199199                "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"
    201201            },
    202202            "funding": [
     
    218218        {
    219219            "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",
    222222            "source": {
    223223                "type": "git",
    224224                "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",
    231231                "shasum": ""
    232232            },
     
    244244                "bamarni/composer-bin-plugin": "^1.8.2",
    245245                "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"
    247247            },
    248248            "suggest": {
    249249                "laminas/laminas-httphandlerrunner": "Emit PSR-7 responses"
    250250            },
    251             "time": "2025-03-27T12:30:47+00:00",
     251            "time": "2025-08-23T21:21:41+00:00",
    252252            "type": "library",
    253253            "extra": {
     
    317317            "support": {
    318318                "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"
    320320            },
    321321            "funding": [
     
    553553        {
    554554            "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",
    557557            "source": {
    558558                "type": "git",
    559559                "url": "https://github.com/sveawebpay/php-checkout.git",
    560                 "reference": "d184c949b60b96595cb786320bf049a5fbaf91df"
    561             },
    562             "dist": {
    563                 "type": "zip",
    564                 "url": "https://api.github.com/repos/sveawebpay/php-checkout/zipball/d184c949b60b96595cb786320bf049a5fbaf91df",
    565                 "reference": "d184c949b60b96595cb786320bf049a5fbaf91df",
     560                "reference": "d6314fff51bee74154301be63d12918aa8e90ccc"
     561            },
     562            "dist": {
     563                "type": "zip",
     564                "url": "https://api.github.com/repos/sveawebpay/php-checkout/zipball/d6314fff51bee74154301be63d12918aa8e90ccc",
     565                "reference": "d6314fff51bee74154301be63d12918aa8e90ccc",
    566566                "shasum": ""
    567567            },
     
    579579                "symfony/dependency-injection": "^2.7.51 || ^2.8.50 || ^3.4.26 || ^4.1.12 || ^4.2.7"
    580580            },
    581             "time": "2025-06-30T13:03:15+00:00",
     581            "time": "2026-02-05T10:57:04+00:00",
    582582            "type": "library",
    583583            "installation-source": "dist",
    584584            "autoload": {
    585585                "psr-4": {
    586                     "Svea\\Checkout\\": "src"
     586                    "Svea\\Checkout\\": "src/"
    587587                }
    588588            },
     
    600600            "support": {
    601601                "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"
    603603            },
    604604            "install-path": "../sveaekonomi/checkout"
  • svea-checkout-for-woocommerce/trunk/vendor/composer/installed.php

    r3320066 r3454688  
    1212    'versions' => array(
    1313        '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',
    1717            'type' => 'library',
    1818            'install_path' => __DIR__ . '/../guzzlehttp/guzzle',
     
    2121        ),
    2222        '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',
    2626            'type' => 'library',
    2727            'install_path' => __DIR__ . '/../guzzlehttp/promises',
     
    3030        ),
    3131        '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',
    3535            'type' => 'library',
    3636            'install_path' => __DIR__ . '/../guzzlehttp/psr7',
     
    9393        ),
    9494        'sveaekonomi/checkout' => array(
    95             'pretty_version' => '1.6.0',
    96             'version' => '1.6.0.0',
    97             'reference' => 'd184c949b60b96595cb786320bf049a5fbaf91df',
     95            'pretty_version' => '1.7.0',
     96            'version' => '1.7.0.0',
     97            'reference' => 'd6314fff51bee74154301be63d12918aa8e90ccc',
    9898            'type' => 'library',
    9999            'install_path' => __DIR__ . '/../sveaekonomi/checkout',
  • svea-checkout-for-woocommerce/trunk/vendor/guzzlehttp/guzzle/CHANGELOG.md

    r3320066 r3454688  
    22
    33Please 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`
    415
    516
  • svea-checkout-for-woocommerce/trunk/vendor/guzzlehttp/guzzle/composer.json

    r3172745 r3454688  
    8282        "php": "^7.2.5 || ^8.0",
    8383        "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",
    8686        "psr/http-client": "^1.0",
    8787        "symfony/deprecation-contracts": "^2.2 || ^3.0"
  • svea-checkout-for-woocommerce/trunk/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php

    r3172745 r3454688  
    126126
    127127        if (\count($this->handles) >= $this->maxHandles) {
    128             \curl_close($resource);
     128            if (PHP_VERSION_ID < 80000) {
     129                \curl_close($resource);
     130            }
    129131        } else {
    130132            // Remove all callback functions as they can hold onto references
     
    730732    {
    731733        foreach ($this->handles as $id => $handle) {
    732             \curl_close($handle);
     734            if (PHP_VERSION_ID < 80000) {
     735                \curl_close($handle);
     736            }
     737
    733738            unset($this->handles[$id]);
    734739        }
  • svea-checkout-for-woocommerce/trunk/vendor/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php

    r3172745 r3454688  
    241241        unset($this->delays[$id], $this->handles[$id]);
    242242        \curl_multi_remove_handle($this->_mh, $handle);
    243         \curl_close($handle);
     243
     244        if (PHP_VERSION_ID < 80000) {
     245            \curl_close($handle);
     246        }
    244247
    245248        return true;
  • svea-checkout-for-woocommerce/trunk/vendor/guzzlehttp/guzzle/src/Handler/StreamHandler.php

    r3320066 r3454688  
    334334
    335335        return $this->createResource(
    336             function () use ($uri, &$http_response_header, $contextResource, $context, $options, $request) {
     336            function () use ($uri, $contextResource, $context, $options, $request) {
    337337                $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
    338345                $this->lastHeaders = $http_response_header ?? [];
    339346
  • svea-checkout-for-woocommerce/trunk/vendor/guzzlehttp/guzzle/src/Middleware.php

    r3172745 r3454688  
    188188     * formatter.
    189189     *
    190      * @phpstan-param \Psr\Log\LogLevel::* $logLevel  Level at which to log requests.
    191      *
    192190     * @param LoggerInterface                            $logger    Logs messages.
    193191     * @param MessageFormatterInterface|MessageFormatter $formatter Formatter used to create message strings.
    194192     * @param string                                     $logLevel  Level at which to log requests.
     193     *
     194     * @phpstan-param \Psr\Log\LogLevel::* $logLevel Level at which to log requests.
    195195     *
    196196     * @return callable Returns a function that accepts the next handler.
  • svea-checkout-for-woocommerce/trunk/vendor/guzzlehttp/promises/CHANGELOG.md

    r3320066 r3454688  
    11# CHANGELOG
     2
     3
     4## 2.3.0 - 2025-08-22
     5
     6### Added
     7
     8- PHP 8.5 support
    29
    310
  • svea-checkout-for-woocommerce/trunk/vendor/guzzlehttp/promises/README.md

    r3172745 r3454688  
    4242|---------|---------------------|--------------|
    4343| 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 |
    4545
    4646
  • svea-checkout-for-woocommerce/trunk/vendor/guzzlehttp/promises/composer.json

    r3172745 r3454688  
    3131    "require-dev": {
    3232        "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"
    3434    },
    3535    "autoload": {
  • svea-checkout-for-woocommerce/trunk/vendor/guzzlehttp/psr7/CHANGELOG.md

    r3320066 r3454688  
    55The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
    66and 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
    717
    818## 2.7.1 - 2025-03-27
  • svea-checkout-for-woocommerce/trunk/vendor/guzzlehttp/psr7/README.md

    r3172745 r3454688  
    2626|---------|---------------------|--------------|
    2727| 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 |
    2929
    3030
  • svea-checkout-for-woocommerce/trunk/vendor/guzzlehttp/psr7/composer.json

    r3172745 r3454688  
    6363        "bamarni/composer-bin-plugin": "^1.8.2",
    6464        "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"
    6666    },
    6767    "suggest": {
  • svea-checkout-for-woocommerce/trunk/vendor/guzzlehttp/psr7/src/MessageTrait.php

    r3088414 r3454688  
    173173        if (!is_array($value)) {
    174174            return $this->trimAndValidateHeaderValues([$value]);
    175         }
    176 
    177         if (count($value) === 0) {
    178             throw new \InvalidArgumentException('Header value can not be an empty array.');
    179175        }
    180176
  • svea-checkout-for-woocommerce/trunk/vendor/guzzlehttp/psr7/src/Utils.php

    r3172745 r3454688  
    398398
    399399        if ($ex) {
    400             /** @var $ex \RuntimeException */
     400            /** @var \RuntimeException $ex */
    401401            throw $ex;
    402402        }
     
    445445
    446446        if ($ex) {
    447             /** @var $ex \RuntimeException */
     447            /** @var \RuntimeException $ex */
    448448            throw $ex;
    449449        }
  • svea-checkout-for-woocommerce/trunk/vendor/sveaekonomi/checkout/README.md

    r3320066 r3454688  
    5454You can also download the library and upload it onto your server.
    5555
     56### 1.3 Define API timeout (optional)
     57The 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
     61define('SVEA_CHECKOUT_API_TIMEOUT', 10);
     62// Include the library
     63include 'vendor/autoload.php';
     64```
     65
    5666### 2. General information
    5767
     
    6070
    6171The connector defines what credentials should be used and which environment should be used.
    62 
    6372
    6473Parameters for creating Connector are: checkoutMerchantId, checkoutSecret and base API url(environment).
     
    794803| LEASINGAPPROVED | Leasing (Automatically approved leasing contract)
    795804| 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 |
    796807| Directbank (varies)  |    The customer paid the order with direct bank e.g. Nordea, SEB. See below for all available parameters |
    797808
  • svea-checkout-for-woocommerce/trunk/vendor/sveaekonomi/checkout/VERSION

    r3320066 r3454688  
    1 1.6.0
     11.7.0
  • svea-checkout-for-woocommerce/trunk/vendor/sveaekonomi/checkout/composer.json

    r3320066 r3454688  
    11{
    22  "name": "sveaekonomi/checkout",
    3   "version": "1.6.0",
     3  "version": "1.7.0",
    44  "description": "Php integration library for Svea Checkout",
    55  "license": "Apache-2.0",
     
    1212  "autoload": {
    1313    "psr-4": {
    14       "Svea\\Checkout\\": "src"
     14      "Svea\\Checkout\\": "src/"
    1515    }
    1616  },
  • svea-checkout-for-woocommerce/trunk/vendor/sveaekonomi/checkout/src/CheckoutClient.php

    r3320066 r3454688  
    2626namespace Svea\Checkout;
    2727
     28use Indeed\Uap\PreviousRanks;
     29use Opis\JsonSchema\Variables\RefVariablesContainer;
    2830use Svea\Checkout\Implementation\ImplementationInterface;
    2931use Svea\Checkout\Transport\Connector;
  • svea-checkout-for-woocommerce/trunk/vendor/sveaekonomi/checkout/src/Transport/ApiClient.php

    r2005541 r3454688  
    5252        $this->httpClient->setOption(CURLOPT_RETURNTRANSFER, 1);
    5353        $this->httpClient->setOption(CURLOPT_HEADER, 1);
    54         $this->httpClient->setOption(CURLOPT_SSL_VERIFYPEER, false);
    5554
    5655        if ($request->getMethod() === 'POST') {
     
    6867            $this->httpClient->setOption(CURLOPT_POSTFIELDS, $request->getBody());
    6968        }
     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);
    7073
    7174        $httpResponse = $this->httpClient->execute();
  • svea-checkout-for-woocommerce/trunk/vendor/sveaekonomi/checkout/src/Transport/Http/CurlRequest.php

    r1898244 r3454688  
    1111{
    1212    /**
    13      * @var null|resource
     13     * @var null|mixed
    1414     */
    1515    private $handle = null;
  • svea-checkout-for-woocommerce/trunk/vendor/sveaekonomi/checkout/src/Validation/Admin/ValidateDeliverOrderData.php

    r2846828 r3454688  
    1919        $this->mustBeInteger($data['orderid'], 'Order Id');
    2020
    21         $this->mustBeSet($data, 'orderrowids', 'Order Id');
     21        $this->mustBeSet($data, 'orderrowids', 'Order Row Ids');
    2222        $this->mustBeArray($data['orderrowids'], 'Order Row Ids');
    2323
Note: See TracChangeset for help on using the changeset viewer.