Plugin Directory

Changeset 3320066


Ignore:
Timestamp:
06/30/2025 01:24:26 PM (9 months ago)
Author:
thegeneration
Message:

Tagging version 3.3.0

Location:
svea-checkout-for-woocommerce
Files:
8 added
80 edited
1 copied

Legend:

Unmodified
Added
Removed
  • svea-checkout-for-woocommerce/tags/3.3.0/assets/js/frontend/application.min.js

    r3202226 r3320066  
    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.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.triggerValidationCallbackEvent(this.submitOrder.bind(this)),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),i=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:i,success:e=>{let s=!1;void 0!==e.result&&("failure"===e.result?this.showErrors(e.messages):"success"===e.result&&(s=!0)),t.callback&&t.callback({valid:s})}})}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(),i=this.serializeFormToObject(o,!1);"object"==typeof s&&(s=!0);const a=Object.assign(i,{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:a,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,i]=e.split("=");(t||0!==o.indexOf(this.attributionKey))&&(s[decodeURIComponent(o)]=decodeURIComponent(i))})),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_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);
  • svea-checkout-for-woocommerce/tags/3.3.0/inc/Admin.php

    r3203722 r3320066  
    5656        add_action( 'add_meta_boxes', [ $this, 'add_metabox' ] );
    5757
    58         add_action( 'woocommerce_order_item_get_taxes', [ $this, 'correct_taxes' ], 10, 2 );
     58        add_filter( 'woocommerce_order_item_get_taxes', [ $this, 'correct_taxes' ], 10, 2 );
    5959
    6060        add_filter( 'woocommerce_register_shop_order_post_statuses', [ $this, 'register_order_status' ] );
     
    6868        add_action( 'woocommerce_order_status_' . self::AWAITING_ORDER_STATUS . '_to_completed_notification', [ $this, 'add_completed_email_trigger' ], 10, 2 );
    6969
    70         add_action( 'sco_check_pa_order_status', [ $this, 'check_pa_order_status' ] );
     70        add_action( 'sco_check_pa_order_status', [ $this, 'cron_check_pa_order_status' ] );
    7171
    7272        add_filter( 'woocommerce_valid_order_statuses_for_payment_complete', [ $this, 'allow_awaiting_svea_status_to_be_completed' ] );
     
    8686        add_action( 'woocommerce_process_product_meta', [ $this, 'save_product_fields' ] );
    8787        add_action( 'woocommerce_save_product_variation', [ $this, 'save_variation_fields' ] );
     88    }
     89
     90    /**
     91     * Cron job to check the status of a Svea order
     92     *
     93     * @param int $order_id
     94     * @return void
     95     */
     96    public function cron_check_pa_order_status( $order_id ) {
     97        $this->check_pa_order_status( $order_id );
    8898    }
    8999
     
    312322    public function check_pa_order_status( $order ) {
    313323        if ( is_numeric( $order ) ) {
    314             /** @var \WC_Order $wc_order */
    315324            $wc_order = Webhook_Handler::get_order_by_svea_id( $order );
    316325            $svea_order_id = $order;
    317326        } else {
    318             /** @var \WC_Order $wc_order */
    319327            $wc_order = $order;
    320328            $svea_order_id = $wc_order->get_meta( '_svea_co_order_id' );
     
    334342        } catch ( \Exception $e ) {
    335343            WC_Gateway_Svea_Checkout::log( sprintf( 'Received error when fetching information from Svea: %s', $e->getMessage() ) );
    336             return '';
    337         }
    338 
    339         if ( ! isset( $pa_order ) ) {
    340             WC_Gateway_Svea_Checkout::log( 'Tried fetching order from PaymentAdmin but failed. Aborting' );
    341344            return '';
    342345        }
     
    442445     * Save some refs
    443446     *
    444      * @param \Automattic\WooCommerce\Admin\Overrides\Order $wc_order
     447     * @param \WC_Order $wc_order
    445448     * @param array $svea_order
    446449     * @return void
     
    461464
    462465                    if ( ! empty( $svea_ref ) ) {
    463                         $wc_order->update_meta_data( '_svea_co_billing_reference_' . $svea_ref['key'], wc_clean( $reference['Value'] ) );
     466                        $wc_order->update_meta_data( '_svea_co_billing_reference_' . strtolower( $reference['Type'] ), wc_clean( $reference['Value'] ) );
    464467                    }
    465468                }
     
    533536     * Renders the metabox
    534537     *
    535      * @param \WP_post|\WC_Order $name
     538     * @param \WP_Post|\WC_Order $post_or_order_object
    536539     * @return void
    537540     */
     
    576579     *
    577580     * @param \WC_Order_Item $order_item
    578      * @return void
     581     * @return array
    579582     */
    580583    public function get_order_row_data( $order_item ) {
     
    612615     */
    613616    public function admin_remove_order_item( $order_item_id ) {
     617        /** @var \WC_Order_Item_Data_Store $data_store */
    614618        $data_store = \WC_Data_Store::load( 'order-item' );
    615619
  • svea-checkout-for-woocommerce/tags/3.3.0/inc/Compat/Compat.php

    r3264850 r3320066  
    2020     */
    2121    public $polylang;
    22 
    23     /**
    24      * WPML compatibility class
    25      *
    26      * @var WPML_Compat
    27      */
    28     public $wpml;
    2922
    3023    /**
  • svea-checkout-for-woocommerce/tags/3.3.0/inc/Compat/Gift_Cards_For_WC_Compat.php

    r3203722 r3320066  
    22namespace Svea_Checkout_For_Woocommerce\Compat;
    33
    4 use Svea_Checkout_For_Woocommerce\Helper;
    54use Svea_Checkout_For_Woocommerce\Models\Svea_Item;
    65
  • svea-checkout-for-woocommerce/tags/3.3.0/inc/Emails/Awaiting_Svea_Email.php

    r3009386 r3320066  
    11<?php
     2namespace Svea_Checkout_For_Woocommerce\Emails;
     3
    24/**
    35 * Class Awaiting_Svea_Email file.
     
    1719     * Customer awaiting further info from Svea
    1820     */
    19     class Awaiting_Svea_Email extends WC_Email {
     21    class Awaiting_Svea_Email extends \WC_Email {
    2022
    2123        /**
  • svea-checkout-for-woocommerce/tags/3.3.0/inc/Models/Svea_Checkout.php

    r3264850 r3320066  
    9090     * Setup Svea connector
    9191     *
    92      * @param \WC_Cart $cart
     92     * @param string $currency
     93     * @param string $country
    9394     * @return void
    9495     */
     
    257258     * Create a new order in Svea from the cart
    258259     *
    259      * @param bool $force
    260260     * @return array
    261261     */
     
    268268
    269269        // Set preset values
    270         if ( isset( $user_email ) && ! empty( $user_email ) ) {
     270        if ( ! empty( $user_email ) ) {
    271271            array_push(
    272272                $preset_values,
     
    279279        }
    280280
    281         if ( isset( $user_zipcode ) && ! empty( $user_zipcode ) ) {
     281        if ( ! empty( $user_zipcode ) ) {
    282282            array_push(
    283283                $preset_values,
     
    290290        }
    291291
    292         if ( isset( $user_phone ) && ! empty( $user_phone ) ) {
     292        if ( ! empty( $user_phone ) ) {
    293293            array_push(
    294294                $preset_values,
     
    536536
    537537    /**
     538     * Initiate a change of payment method in Svea. This returns an iframe where all the magic happens.
     539     *
     540     * @param string $token
     541     * @return array
     542     */
     543    public function change_payment_method( string $token ) {
     544        $data = [
     545            'Token'    => $token,
     546            'TermsUrl' => wc_get_page_permalink( 'terms' ),
     547        ];
     548
     549        try {
     550            $response = $this->client->changePaymentMethod( $data );
     551
     552            return $response;
     553        } catch ( \Exception $e ) {
     554            WC_Gateway_Svea_Checkout::log( sprintf( 'Received error when changing payment method. Code: %s, Message: %s', $e->getCode(), $e->getMessage() ) );
     555            return $this->create_error_msg( $e->getMessage() );
     556        }
     557    }
     558
     559    /**
    538560     * Get the minimum age for the order (null if no restrictions)
    539561     *
     
    547569     * Get the plugin version
    548570     *
    549      * @return void
     571     * @return string
    550572     */
    551573    public function get_plugin_version() {
     
    556578     * Get merchant settings
    557579     *
    558      * @param string $token
    559580     * @return array
    560581     */
  • svea-checkout-for-woocommerce/tags/3.3.0/inc/Models/Svea_Instore.php

    r3202226 r3320066  
    8585     *
    8686     * @param \WC_Order|null $wc_order
    87      * @param bool $admin
    88      *
    8987     * @return void
    9088     */
  • svea-checkout-for-woocommerce/tags/3.3.0/inc/Models/Svea_Item.php

    r3309749 r3320066  
    3434     * Unit price (price each)
    3535     *
     36     * @var float
     37     */
     38    public $unit_price;
     39
     40    /**
     41     * Tax percentage, 25, 12, 6 etc
     42     *
    3643     * @var int
    3744     */
    38     public $unit_price;
    39 
    40     /**
    41      * Tax percentage, 25, 12, 6 etc
     45    public $tax_percentage;
     46
     47    /**
     48     * Row type, only used internally and never sent to Svea
     49     *
     50     * @var string
     51     */
     52    public $type = 'product';
     53
     54    /**
     55     * Discount percent (0-100)
    4256     *
    4357     * @var int
    4458     */
    45     public $tax_percentage;
    46 
    47     /**
    48      * Row type, only used internally and never sent to Svea
     59    public $discount_percent = 0;
     60
     61    /**
     62     * Discount amount
     63     *
     64     * @var float
     65     */
     66    public $discount_amount = 0;
     67
     68    /**
     69     * Diff from WooCommerce
     70     *
     71     * @var float
     72     */
     73    private $sum_diff = 0;
     74
     75    /**
     76     * Temporary reference
    4977     *
    5078     * @var string
    5179     */
    52     public $type = 'product';
    53 
    54     /**
    55      * Discount percent (0-100)
    56      *
    57      * @var int
    58      */
    59     public $discount_percent = 0;
    60 
    61     /**
    62      * Discount amount
    63      *
    64      * @var float
    65      */
    66     public $discount_amount = 0;
    67 
    68     /**
    69      * Diff from WooCommerce
    70      *
    71      * @var float
    72      */
    73     private $sum_diff = 0;
    74 
    75     /**
    76      * Temporary reference
    77      *
    78      * @var string
    79      */
    8080    public $temporary_reference = '';
    8181
     
    9090     * Weight in grams
    9191     *
    92      * @var int
     92     * @var float
    9393     */
    9494    private $weight = 0;
     
    9797     * Length in mm
    9898     *
    99      * @var int
     99     * @var float
    100100     */
    101101    private $length = 0;
     
    104104     * Height in mm
    105105     *
    106      * @var int
     106     * @var float
    107107     */
    108108    private $height = 0;
     
    111111     * Width in mm
    112112     *
    113      * @var int
     113     * @var float
    114114     */
    115115    private $width = 0;
     
    193193        // Prevent division by 0
    194194        if ( $shipping->get_cost() > 0 ) {
    195             $tax_percentage = ( $total_tax / $shipping->get_cost() ) * 100;
     195            $tax_percentage = ( $total_tax / (float) $shipping->get_cost() ) * 100;
    196196        }
    197197
     
    225225        if ( ! empty( $meta_data['nshift_data'] ) ) {
    226226            foreach ( $meta_data['nshift_data'] as $percent => $amounts ) {
    227                 /** @var Svea_Item $shipping_row */
    228                 $shipping_row = new $this();
     227                /** @var static $shipping_row */
     228                $shipping_row = new static();
    229229
    230230                $shipping_row->sku = $shipping->get_id();
     
    383383        }
    384384
    385         $unit_price = ( $item->get_total() + $item->get_total_tax() ) / $item->get_quantity();
     385        $unit_price = ( (float) $item->get_total() + (float) $item->get_total_tax() ) / $item->get_quantity();
    386386
    387387        $tax_percentage = 0;
    388388        if ( $item->get_total_tax() ) {
    389             $tax_percentage = $this->round_price( $item->get_total_tax() / $item->get_total() ) * 100;
     389            $tax_percentage = $this->round_price( (float) $item->get_total_tax() / (float) $item->get_total() ) * 100;
    390390        }
    391391
     
    394394        $this->quantity = $item->get_quantity();
    395395        $this->unit_price = $unit_price;
    396         $this->tax_percentage = $tax_percentage ?? 0;
     396        $this->tax_percentage = $tax_percentage ?: 0;
    397397
    398398        if ( $set_ref ) {
     
    418418        $this->quantity = $item->get_quantity();
    419419        $this->unit_price = $unit_price;
    420         $this->tax_percentage = $tax_percentage ?? 0;
     420        $this->tax_percentage = $tax_percentage ?: 0;
    421421
    422422        if ( $set_ref ) {
     
    435435     */
    436436    public function map_order_item_shipping( $item, $set_ref = false ) {
    437         $unit_price = ( $item->get_total() + $item->get_total_tax() ) / $item->get_quantity();
     437        $unit_price = ( (float) $item->get_total() + (float) $item->get_total_tax() ) / $item->get_quantity();
    438438
    439439        $total_tax = floatval( $item->get_total_tax() );
     
    452452        $this->quantity = $item->get_quantity();
    453453        $this->unit_price = $unit_price;
    454         $this->tax_percentage = $tax_percentage ?? 0;
     454        $this->tax_percentage = $tax_percentage ?: 0;
    455455
    456456        if ( $set_ref ) {
  • svea-checkout-for-woocommerce/tags/3.3.0/inc/Models/Svea_Payment_Admin.php

    r3172745 r3320066  
    7777     *
    7878     * @param \WC_Order $wc_order WooCommerce order
    79      * @param bool $admin Use the admin client
    8079     */
    8180    public function __construct( $wc_order = null ) {
     
    219218     * Add order row to existing order
    220219     *
    221      * @param array $data
    222      *
     220     * @param int $id
     221     * @param array $row_data
    223222     * @return array
    224223     */
     
    297296     * @param int $id
    298297     * @param array $data
    299      * @return array
     298     * @return void
    300299     */
    301300    public function deliver_order( $id, $data ) {
  • svea-checkout-for-woocommerce/tags/3.3.0/inc/Template_Handler.php

    r3309749 r3320066  
    2727        add_action( 'wc_ajax_sco_change_payment_method', [ $this, 'change_payment_method' ], 100 );
    2828
     29        add_action( 'wc_ajax_sco_renew_nonce', [ $this, 'renew_checkout_nonce' ] );
    2930        add_action( 'wc_ajax_sco_checkout_order', [ $this, 'sco_checkout_order' ] );
    3031
     
    4445
    4546        // Remove checkout fields if they are not needed
    46         add_action( 'woocommerce_checkout_before_order_review', [ $this, 'maybe_remove_checkout_fields' ] );
     47        add_action( 'wp', [ $this, 'maybe_remove_checkout_fields' ], 5 );
    4748
    4849        add_filter( 'woocommerce_my_account_my_orders_actions', [ $this, 'remove_pay_button_action' ], 10, 2 );
     50
     51        add_filter( 'wcs_view_subscription_actions', [ $this, 'modify_change_payment_button' ], 20, 2 );
     52
     53        add_filter( 'woocommerce_get_settings_advanced', [ $this, 'add_endpoint_account_settings' ] );
     54        add_filter( 'woocommerce_get_query_vars', [ $this, 'add_sco_query_vars' ] );
     55        add_action( 'woocommerce_account_svea_change_payment_method_endpoint', [ $this, 'display_change_payment_method' ] );
     56    }
     57
     58    /**
     59     * Get a new nonce for the checkout
     60     *
     61     * @return void
     62     */
     63    public function renew_checkout_nonce() {
     64        // Clear WC errors
     65        wc_clear_notices();
     66        wp_send_json_success(
     67            [
     68                'wc'  => wp_create_nonce( 'woocommerce-process_checkout' ),
     69                'sco' => wp_create_nonce( 'sco-checkout-order' ),
     70            ]
     71        );
     72    }
     73
     74    /**
     75     * Display the change payment method page
     76     *
     77     * @return void
     78     */
     79    public function display_change_payment_method() {
     80        global $wp;
     81
     82        $subscription_id = isset( $wp->query_vars['svea_change_payment_method'] ) ? absint( $wp->query_vars['svea_change_payment_method'] ) : 0;
     83        $subscription = wcs_get_subscription( $subscription_id );
     84
     85        if ( ! $subscription || ! $subscription->has_status( 'active' ) ) {
     86            wc_add_notice( __( 'Invalid subscription.', 'svea-checkout-for-woocommerce' ), 'error' );
     87            return;
     88        }
     89
     90        // Check if the subscription is using Svea Checkout
     91        if ( $subscription->get_payment_method() !== WC_Gateway_Svea_Checkout::GATEWAY_ID ) {
     92            wc_add_notice( __( 'This subscription has to use Svea Checkout.', 'svea-checkout-for-woocommerce' ), 'error' );
     93            return;
     94        }
     95
     96        // Validate key from query param
     97        if ( ! isset( $_GET['key'] ) || $subscription->get_order_key() !== sanitize_text_field( wp_unslash( $_GET['key'] ) ) ) {
     98            wc_add_notice( __( 'Invalid subscription key.', 'svea-checkout-for-woocommerce' ), 'error' );
     99            return;
     100        }
     101
     102        // Validate nonce
     103        if ( ! isset( $_GET['sco_payment_nonce'] ) || ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_GET['sco_payment_nonce'] ) ), 'sco_payment_nonce-' . $subscription->get_id() ) ) {
     104            wc_add_notice( __( 'Invalid nonce.', 'svea-checkout-for-woocommerce' ), 'error' );
     105            return;
     106        }
     107
     108        $svea_checkout = new Svea_Checkout( false );
     109        $svea_checkout->setup_client( $subscription->get_currency(), $subscription->get_billing_country() );
     110
     111        $svea_checkout_data = $svea_checkout->change_payment_method( $subscription->get_meta( '_svea_co_token' ) );
     112
     113        wc_get_template( 'myaccount/svea-change-payment-method.php', compact( 'svea_checkout_data' ), '', SVEA_CHECKOUT_FOR_WOOCOMMERCE_DIR . '/templates/' );
     114    }
     115
     116    /**
     117     * Get the "change payment method" endpoint for Svea
     118     *
     119     * @return string
     120     */
     121    public function get_change_payment_method_endpoint() {
     122        return get_option( 'woocommerce_myaccount_svea_subscription_payment_method_endpoint', 'svea-change-payment-method' );
     123    }
     124
     125    /**
     126     * Add Svea Checkout query vars
     127     *
     128     * @param array $query_vars
     129     * @return array
     130     */
     131    public function add_sco_query_vars( $query_vars ) {
     132        $svea_query_vars = [
     133            'svea_change_payment_method' => $this->get_change_payment_method_endpoint(),
     134        ];
     135
     136        return array_merge( $query_vars, $svea_query_vars );
     137    }
     138
     139    /**
     140     * Add a new endpoint for the Svea change payment method
     141     *
     142     * @param array $settings
     143     * @return array
     144     */
     145    public function add_endpoint_account_settings( $settings ) {
     146        $new_setting = [
     147            'title'    => __( 'Change payment method (Svea)', 'svea-checkout-for-woocommerce' ),
     148            'desc'     => __( 'Endpoint for the My Account &rarr; Change Svea Subscription Payment Method page', 'svea-checkout-for-woocommerce' ),
     149            'id'       => 'woocommerce_myaccount_svea_subscription_payment_method_endpoint',
     150            'type'     => 'text',
     151            'default'  => 'svea-change-payment-method',
     152            'desc_tip' => true,
     153        ];
     154
     155        if ( class_exists( 'WC_Subscriptions_Admin' ) ) {
     156            \WC_Subscriptions_Admin::insert_setting_after( $settings, 'woocommerce_myaccount_view_order_endpoint', $new_setting );
     157        }
     158
     159        return $settings;
     160    }
     161
     162    /**
     163     * Modify the "Change payment" button on the subscription page
     164     *
     165     * @param array $actions
     166     * @param \WC_Subscription $subscription
     167     * @return array
     168     */
     169    public function modify_change_payment_button( $actions, $subscription ) {
     170        if ( ! $subscription instanceof \WC_Subscription ) {
     171            return $actions;
     172        }
     173
     174        if ( $subscription->get_payment_method() !== WC_Gateway_Svea_Checkout::GATEWAY_ID ) {
     175            return $actions;
     176        }
     177
     178        // This will only be set if other payment methods are available
     179        if ( ! isset( $actions['change_payment_method'] ) ) {
     180            $actions['change_payment_method'] = [
     181                'name' => _x( 'Change payment', 'label on button, imperative', 'svea-checkout-for-woocommerce' ),
     182            ];
     183        }
     184
     185        $actions['change_payment_method']['url'] = add_query_arg(
     186            [
     187                'change_payment_method' => 'svea',
     188                'sco_payment_nonce'     => wp_create_nonce( 'sco_payment_nonce-' . $subscription->get_id() ),
     189                'key'                   => $subscription->get_order_key(),
     190            ],
     191            wc_get_endpoint_url( $this->get_change_payment_method_endpoint(), $subscription->get_id(), wc_get_page_permalink( 'myaccount' ) )
     192        );
     193
     194        return $actions;
     195
    49196    }
    50197
     
    74221     */
    75222    public function sco_checkout_order() {
    76         check_ajax_referer( 'sco-checkout-order', 'security' );
     223        $success = check_ajax_referer( 'sco-checkout-order', 'security', false );
     224        if ( ! $success ) {
     225            wp_send_json(
     226                [
     227                    'result' => 'failure',
     228                    'reload' => true,
     229                ]
     230            );
     231        }
    77232        wc_maybe_define_constant( 'WOOCOMMERCE_CHECKOUT', true );
    78233
     
    152307     */
    153308    public function maybe_remove_checkout_fields() {
    154         if ( $this->is_svea() ) {
     309        if ( $this->is_svea() && ! wp_doing_ajax() ) {
    155310            // Remove all default fields from WooCommerce to see what gets added by third party plugins
    156             add_filter( 'woocommerce_checkout_fields', [ $this, 'remove_billing_and_shipping_fields' ], PHP_INT_MAX );
     311            add_filter( 'woocommerce_checkout_fields', [ $this, 'remove_billing_and_shipping_fields' ], 100000 );
    157312            add_filter( 'woocommerce_checkout_fields', [ $this, 'maybe_remove_order_comments_field' ] );
    158313        }
     
    277432
    278433        /** @var \WC_Payment_Gateway[] $available_gateways */
    279         $available_gateways = WC()->payment_gateways->get_available_payment_gateways();
     434        $available_gateways = WC()->payment_gateways()->get_available_payment_gateways();
    280435
    281436        if ( ! empty( $available_gateways ) ) {
     
    318473
    319474                // Check if status is final
    320                 if ( strtoupper( $svea_checkout_module['Status'] ) !== 'FINAL' ) {
     475                if ( isset( $svea_checkout_module['Status'] ) && strtoupper( $svea_checkout_module['Status'] ) !== 'FINAL' ) {
    321476                    WC_Gateway_Svea_Checkout::log( sprintf( 'Order %s is not in final state, status: %s', $svea_order_id, $svea_checkout_module['Status'] ) );
    322477                    wp_safe_redirect( wc_get_checkout_url() );
     
    324479                }
    325480
    326                 /** @var \Automattic\WooCommerce\Admin\Overrides\Order $order */
     481                /** @var \Automattic\WooCommerce\Admin\Overrides\Order $wc_order */
    327482                $wc_order = $wc_orders[0];
    328483
     
    340495     * Get the iframe snippet from Svea
    341496     *
    342      * @return string
     497     * @return void
    343498     */
    344499    public static function get_svea_snippet() {
     
    647802
    648803        if ( ! $reload && ! WC_Gateway_Svea_Checkout::is_zero_sum_enabled() ) {
    649             $reload = WC()->cart->total <= 0 ? true : false;
     804            $reload = (float) WC()->cart->get_total() <= 0 ? true : false;
    650805        }
    651806
     
    732887     * This function returns the Svea Checkout module.
    733888     *
    734      * @param \WC_Cart $cart WooCommerce cart
    735      * @return array|string The Svea Checkout snippet
     889     * @return array The Svea Checkout snippet
    736890     */
    737891    public static function get_svea_checkout_module() {
  • svea-checkout-for-woocommerce/tags/3.3.0/inc/WC_Gateway_Svea_Checkout.php

    r3264850 r3320066  
    4646
    4747    /**
    48      * List of activated customer types
    49      *
    50      * @var array
     48     * String of activated customer type(s)
     49     *
     50     * @var string
    5151     */
    5252    private $customer_types;
     
    503503
    504504    /**
    505      * Is the nShift integration enabled?
    506      *
    507      * @return bool
    508      */
    509     public static function is_nshift_enabled() {
    510         return self::$nshift_enabled;
    511     }
    512 
    513     /**
    514      * Is zero sum enabled?
    515      *
    516      * @return bool
    517      */
    518     public static function is_zero_sum_enabled() {
    519         return self::$zero_sum_enabled;
    520     }
    521 
    522     /**
    523      * Get the store minimum age
    524      *
    525      * @return int
    526      */
    527     public static function get_store_minimum_age() {
    528         return (int) self::$store_minimum_age;
    529     }
    530 
    531     /**
    532      * Get the shipping options html
    533      *
    534      * @param string $key
    535      * @param array $value
    536      * @param array $field
    537      * @return string
    538      */
    539     public function generate_nshift_shipping_options_html( string $key, $field_settings ) {
    540         $fields = $field_settings['fields'] ?? [];
    541         if ( empty( $fields ) ) return '';
    542 
    543         ob_start();
    544         ?>
    545         <tr valign="top">
    546             <th scope="row" class="titledesc">
    547                 <label><?php echo wp_kses_post( $field_settings['title'] ); ?></label>
    548             </th>
    549             <td class="forminp">
    550                 <div class="nshift-shipping-wrapper">
    551                     <div class="rows"></div>
    552 
    553                     <div class="buttons">
    554                         <div class="remove button">-</div>
    555                         <div class="add button button-primary">+</div>
    556                     </div>
    557                 </div>
    558                 <script type="text/html" id="nshift-shipping-row">
    559                     <?php echo wp_kses_post( $this->generate_settings_html( $fields ) ); ?>
    560                 </script>
    561             </td>
    562         </tr>
    563         <?php
    564 
    565         $html = ob_get_clean();
    566         return $html;
    567     }
    568 
    569     /**
    570      * Get the name of the payment method
    571      *
    572      * @param string $key
    573      * @return string
    574      */
    575     public function get_payment_method_name( $key ) {
    576         $method = '';
    577 
    578         if ( isset( $this->svea_payment_methods[ $key ] ) ) {
    579             $method = $this->svea_payment_methods[ $key ];
    580         }
    581 
    582         return apply_filters( 'woocommerce_sco_payment_method_name', $method, $key, $this );
    583     }
    584 
    585     /**
    586      * Get the name of the billing reference
    587      *
    588      * @param string $key
    589      * @return string
    590      */
    591     public function get_billing_reference_value( $key ) {
    592         $method = '';
    593 
    594         if ( isset( $this->svea_billing_references[ $key ] ) ) {
    595             $method = $this->svea_billing_references[ $key ];
    596         }
    597 
    598         return apply_filters( 'woocommerce_sco_billing_reference_name', $method, $key, $this );
    599     }
    600 
    601     /**
    602505     * Add hooks
    603506     *
     
    608511        add_action( 'woocommerce_order_details_after_order_table', [ $this, 'svea_co_display_extra_order_meta' ], 11 );
    609512        add_action( 'woocommerce_email_after_order_table', [ $this, 'svea_co_display_extra_admin_order_meta' ], 11 );
    610         add_action( 'woocommerce_update_options_payment_gateways_' . $this->id, [ $this, 'process_admin_options' ] );
     513        add_filter( 'woocommerce_update_options_payment_gateways_' . $this->id, [ $this, 'process_admin_options' ] );
    611514        add_action( 'woocommerce_update_options_payment_gateways_' . $this->id, [ $this, 'clear_merchant_validation_cache' ] );
    612515
     
    637540
    638541        // Subscription related hooks
    639         add_filter( 'woocommerce_scheduled_subscription_payment_' . self::GATEWAY_ID, [ $this, 'scheduled_subscription_payment' ], 10, 2 );
    640         add_filter( 'woocommerce_subscription_cancelled_' . self::GATEWAY_ID, [ $this, 'cancel_subscription' ] );
     542        add_action( 'woocommerce_scheduled_subscription_payment_' . self::GATEWAY_ID, [ $this, 'scheduled_subscription_payment' ], 10, 2 );
     543        add_action( 'woocommerce_subscription_cancelled_' . self::GATEWAY_ID, [ $this, 'cancel_subscription' ] );
    641544
    642545        self::$hooks_enabled = true;
     546    }
     547
     548    /**
     549     * Is the nShift integration enabled?
     550     *
     551     * @return bool
     552     */
     553    public static function is_nshift_enabled() {
     554        return self::$nshift_enabled;
     555    }
     556
     557    /**
     558     * Is zero sum enabled?
     559     *
     560     * @return bool
     561     */
     562    public static function is_zero_sum_enabled() {
     563        return self::$zero_sum_enabled;
     564    }
     565
     566    /**
     567     * Get the store minimum age
     568     *
     569     * @return int
     570     */
     571    public static function get_store_minimum_age() {
     572        return (int) self::$store_minimum_age;
     573    }
     574
     575    /**
     576     * Get the name of the payment method
     577     *
     578     * @param string $key
     579     * @return string
     580     */
     581    public function get_payment_method_name( $key ) {
     582        $method = '';
     583
     584        if ( isset( $this->svea_payment_methods[ $key ] ) ) {
     585            $method = $this->svea_payment_methods[ $key ];
     586        }
     587
     588        return apply_filters( 'woocommerce_sco_payment_method_name', $method, $key, $this );
     589    }
     590
     591    /**
     592     * Get the name of the billing reference
     593     *
     594     * @param string $key
     595     * @return string
     596     */
     597    public function get_billing_reference_value( $key ) {
     598        $method = '';
     599
     600        if ( isset( $this->svea_billing_references[ $key ] ) ) {
     601            $method = $this->svea_billing_references[ $key ];
     602        }
     603
     604        return apply_filters( 'woocommerce_sco_billing_reference_name', $method, $key, $this );
    643605    }
    644606
     
    651613    public function cancel_subscription( $wc_order ) {
    652614        if ( empty( $wc_order->get_meta( '_svea_co_token' ) ) ) {
    653             return false;
     615            return;
    654616        }
    655617
     
    683645                'woocommerce_subscriptions_paid_for_failed_renewal_order',
    684646                [ \WC_Subscriptions_Change_Payment_Gateway::class, 'change_failing_payment_method' ],
    685                 10,
    686                 2
     647                10
    687648            );
    688649        }
     
    732693     * @param array $values
    733694     * @param \WC_Order $wc_order
    734      * @return \WC_Order_Item
     695     * @return void
    735696     */
    736697    public function append_cart_item_key_to_order_row( $item, $cart_item_key, $values, $wc_order ) {
     
    738699            $item->update_meta_data( '_svea_co_cart_key', $cart_item_key );
    739700        }
    740 
    741         return $item;
    742701    }
    743702
     
    749708     * @param array $package
    750709     * @param \WC_Order $wc_order
    751      * @return \WC_Order_Item_Shipping
     710     * @return void
    752711     */
    753712    public function append_cart_item_key_to_order_row_shipping( $item, $package_key, $package, $wc_order ) {
     
    760719        }
    761720
    762         return $this->append_cart_item_key_to_order_row( $item, $package_key . '_' . $key, [], $wc_order );
     721        $this->append_cart_item_key_to_order_row( $item, $package_key . '_' . $key, [], $wc_order );
    763722    }
    764723
     
    798757     *
    799758     * @param array $merchant_data Merchant data to fetch part payment plans for
    800      * @return array|WP_Error List of payment plan campaigns
     759     * @return array|\WP_Error List of payment plan campaigns
    801760     */
    802761    public function get_part_payment_plans( $merchant_data ) {
    803 
    804762        // Get campaigns from cache to save bandwidth and loading time
    805763        $campaigns = get_transient( sprintf( self::PART_PAYMENT_TRANSIENT_FORMAT, $merchant_data['CountryCode'] ) );
     
    11911149
    11921150    /**
    1193      * Get the customer types (both|company|individual)
    1194      *
    1195      * @return string[]
     1151     * Get the customer type(s) (both|company|individual)
     1152     *
     1153     * @return string
    11961154     */
    11971155    public function get_customer_types() {
     
    14691427
    14701428        // Map row ID's in Svea to WooCommerce
    1471         if ( ! empty( $wc_order ) && is_array( $item_mapping ) ) {
     1429        if ( is_array( $item_mapping ) ) {
    14721430            $wc_items = $wc_order->get_items( [ 'line_item', 'fee', 'shipping' ] );
    14731431
     
    19341892        }
    19351893
    1936         $refund_amount = $wc_order->get_total() - $wc_order->get_total_refunded();
     1894        $refund_amount = (float) $wc_order->get_total() - (float) $wc_order->get_total_refunded();
    19371895
    19381896        return $this->process_refund( $order_id, $refund_amount );
  • svea-checkout-for-woocommerce/tags/3.3.0/inc/WC_Shipping_Svea_Nshift.php

    r3172745 r3320066  
    3838        $this->init();
    3939
    40         add_action( 'woocommerce_update_options_shipping_' . $this->id, [ $this, 'process_admin_options' ] );
     40        add_filter( 'woocommerce_update_options_shipping_' . $this->id, [ $this, 'process_admin_options' ] );
    4141        add_action( 'woocommerce_cart_emptied', [ $this, 'clear_session' ] );
    4242    }
     
    6767     */
    6868    private function get_cost() {
    69         $cost = WC()->session->get( 'sco_nshift_price', false );
    70 
    71         if ( $cost === false ) {
    72             return 0;
    73         }
    74 
    75         return $cost;
     69        return (float) WC()->session->get( 'sco_nshift_price', 0 );
    7670    }
    7771
  • svea-checkout-for-woocommerce/tags/3.3.0/inc/Webhook_Handler.php

    r3264850 r3320066  
    157157            self::$svea_order = $svea_order->get( $webhook_data->orderId );
    158158        } catch ( \Exception $e ) {
    159             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() );
     159            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() ) );
    160160            status_header( 404 );
    161161            exit;
     
    231231        }
    232232
    233         $this->svea_order_id = sanitize_text_field( $_GET['svea_order_id'] ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended
     233        $this->svea_order_id = (int) sanitize_text_field( $_GET['svea_order_id'] ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended
    234234
    235235        $this->gateway::log( sprintf( 'Validation callback for Svea order ID (%s) received', $this->svea_order_id ) );
     
    336336     *
    337337     * @param string $msg Message
    338      * @param string $valid Valid or not
     338     * @param bool $valid Valid or not
    339339     * @param string $order_number Client order number
    340340     * @return void
     
    355355
    356356        wp_send_json( $response );
    357         die;
    358357    }
    359358
     
    614613
    615614            $wc_order->update_meta_data( '_svea_co_is_company', (bool) self::$svea_order['IsCompany'] );
    616             $wc_order->update_meta_data( '_svea_co_order_final', current_time( 'timestamp', true ) );
     615            $wc_order->update_meta_data( '_svea_co_order_final', (string) current_time( 'timestamp', true ) );
    617616
    618617            $this->gateway::log( sprintf( 'Push callback finalized order. Svea ID:%s OrderID: %s', $this->svea_order_id, $wc_order->get_id() ) );
     
    624623                wp_schedule_single_event( time() + apply_filters( 'woocommerce_sco_pending_status_retry_time', HOUR_IN_SECONDS ), 'sco_check_pa_order_status', [ $this->svea_order_id ] );
    625624            } else {
    626                 $wc_order->payment_complete( $this->svea_order_id );
     625                $wc_order->payment_complete( (string) $this->svea_order_id );
    627626            }
    628627
     
    808807
    809808        // Update the cost and taxes
    810         $shipping_item->set_total( $shipping_fee );
     809        $shipping_item->set_total( (string) $shipping_fee );
    811810        $shipping_item->set_taxes( $actual_taxes );
    812811        $shipping_item->delete_meta_data( 'nshift_taxes' );
  • svea-checkout-for-woocommerce/tags/3.3.0/readme.txt

    r3309749 r3320066  
    1010License: Apache 2.0
    1111License URI: https://www.apache.org/licenses/LICENSE-2.0
    12 Stable tag: 3.2.5
     12Stable tag: 3.3.0
    1313
    1414Supercharge your WooCommerce Store with powerful features to pay via Svea Checkout!
     
    71712. Check the box **Display product part payment module**
    72723. Select where on the page you want to display the module
    73 4. View the part payment module on the product page for eligable products. If the module is not displayed it might be due to the price since part payment plans often require a minimum amount.
     734. View the part payment module on the product page for eligible products. If the module is not displayed it might be due to the price since part payment plans often require a minimum amount.
    7474
    7575There's also a shortcode available to display the part payment module on a product page. Add the shortcode `[svea_checkout_part_payment_module]` to the product page you want to use it on. Or call `do_shortcode()` through a template file.
     76
     77= Support =
     78For support, please check the [support forum](https://wordpress.org/support/plugin/svea-checkout-for-woocommerce/) to see if your question has already been answered.
     79If you need quick and easy assistance, try our chat bot, which has been specially trained on common questions and detailed information about Svea's payment solutions: https://thegeneration.se/support-svea-chatbot/
     80If you have other questions or need more in-depth support involving sensitive information, please fill out the form at https://thegeneration.se/support-for-svea/
    7681
    7782== Installation ==
     
    8691== Upgrade Notice ==
    8792
     93= 3.3.0 =
     943.3.0 is a minor release
     95
    8896= 3.2.5 =
    89973.2.5 is a patch release
     
    376384
    377385== Changelog ==
     386
     387= 3.3.0 2025-06-30 =
     388- Added support for changing the payment method on recurring orders processed via Svea Checkout.
     389- Remove default fields which could appear when the option "Hide shipping costs until an address is entered" is selected
     390- General improvements
    378391
    379392= 3.2.5 2025-06-11 =
  • svea-checkout-for-woocommerce/tags/3.3.0/svea-checkout-for-woocommerce.php

    r3309749 r3320066  
    1414 * Plugin URI: https://wordpress.org/plugins/svea-checkout-for-woocommerce/
    1515 * Description: Process payments in WooCommerce via Svea Checkout.
    16  * Version: 3.2.5
     16 * Version: 3.3.0
    1717 * Requires Plugins: woocommerce
    1818 * Author: The Generation AB
     
    4747         * Version of plugin
    4848         */
    49         const VERSION = '3.2.5';
    50 
    51         /**
    52          * @var string
    53          */
    54         private $plugin_description;
    55 
    56         /**
    57          * @var string
    58          */
    59         private $plugin_label;
     49        const VERSION = '3.3.0';
    6050
    6151        /**
     
    146136         */
    147137        public function load_labels() {
    148             $this->plugin_description = esc_html__( 'Svea Checkout for WooCommerce', 'svea-checkout-for-woocommerce' );
    149             $this->plugin_label = esc_html__( 'Process payments in WooCommerce via Svea Checkout', 'svea-checkout-for-woocommerce' );
     138            __( 'Svea Checkout for WooCommerce', 'svea-checkout-for-woocommerce' );
     139            __( 'Process payments in WooCommerce via Svea Checkout', 'svea-checkout-for-woocommerce' );
    150140        }
    151141
  • svea-checkout-for-woocommerce/tags/3.3.0/templates/backend/metabox.php

    r3172745 r3320066  
    1 <?php if ( $is_awaiting_status ) : ?>
     1<?php
     2if ( ! defined( 'ABSPATH' ) ) { exit; } // Exit if accessed directly
     3
     4if ( isset( $is_awaiting_status ) && $is_awaiting_status ) : ?>
    25    <p>
    36        <strong><?php esc_html_e( 'Awaiting status', 'svea-checkout-for-woocommerce' ); ?></strong><br>
  • svea-checkout-for-woocommerce/tags/3.3.0/templates/checkout/additional-fields.php

    r3202226 r3320066  
    2222                <p class="form-row form-row-wide create-account">
    2323                    <label class="woocommerce-form__label woocommerce-form__label-for-checkbox checkbox">
    24                         <input class="woocommerce-form__input woocommerce-form__input-checkbox input-checkbox" id="createaccount" <?php checked( ( true === $checkout->get_value( 'createaccount' ) || ( true === apply_filters( 'woocommerce_create_account_default_checked', false ) ) ), true ); ?> type="checkbox" name="createaccount" value="1" /> <span><?php esc_html_e( 'Create an account?', 'woocommerce' ); ?></span>
     24                        <input class="woocommerce-form__input woocommerce-form__input-checkbox input-checkbox" id="createaccount" <?php checked( ( true === (bool) $checkout->get_value( 'createaccount' ) || ( true === apply_filters( 'woocommerce_create_account_default_checked', false ) ) ), true ); ?> type="checkbox" name="createaccount" value="1" /> <span><?php esc_html_e( 'Create an account?', 'woocommerce' ); ?></span>
    2525                    </label>
    2626                </p>
  • svea-checkout-for-woocommerce/tags/3.3.0/templates/svea-checkout.php

    r3281259 r3320066  
    9999
    100100                    <?php if (
    101                         count( WC()->payment_gateways->get_available_payment_gateways() ) > 1 &&
     101                        count( WC()->payment_gateways()->get_available_payment_gateways() ) > 1 &&
    102102                        apply_filters( 'woocommerce_sco_show_change_payment_button', true )
    103103                    ) : ?>
  • svea-checkout-for-woocommerce/tags/3.3.0/vendor/autoload.php

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

    r3264850 r3320066  
    131131    'Svea\\Checkout\\Implementation\\Admin\\ReplaceOrderRows' => $vendorDir . '/sveaekonomi/checkout/src/Implementation/Admin/ReplaceOrderRows.php',
    132132    'Svea\\Checkout\\Implementation\\Admin\\UpdateOrderRow' => $vendorDir . '/sveaekonomi/checkout/src/Implementation/Admin/UpdateOrderRow.php',
     133    'Svea\\Checkout\\Implementation\\ChangePaymentMethod' => $vendorDir . '/sveaekonomi/checkout/src/Implementation/ChangePaymentMethod.php',
    133134    'Svea\\Checkout\\Implementation\\CreateOrder' => $vendorDir . '/sveaekonomi/checkout/src/Implementation/CreateOrder.php',
    134135    'Svea\\Checkout\\Implementation\\CreateTokenOrder' => $vendorDir . '/sveaekonomi/checkout/src/Implementation/CreateTokenOrder.php',
     
    162163    'Svea\\Checkout\\Validation\\Admin\\ValidateReplaceOrderRowsData' => $vendorDir . '/sveaekonomi/checkout/src/Validation/Admin/ValidateReplaceOrderRowsData.php',
    163164    'Svea\\Checkout\\Validation\\Admin\\ValidateUpdateOrderRowData' => $vendorDir . '/sveaekonomi/checkout/src/Validation/Admin/ValidateUpdateOrderRowData.php',
     165    'Svea\\Checkout\\Validation\\ValidateChangePaymentMethodData' => $vendorDir . '/sveaekonomi/checkout/src/Validation/ValidateChangePaymentMethodData.php',
    164166    'Svea\\Checkout\\Validation\\ValidateCreateOrderData' => $vendorDir . '/sveaekonomi/checkout/src/Validation/ValidateCreateOrderData.php',
    165167    'Svea\\Checkout\\Validation\\ValidateCreateTokenOrderData' => $vendorDir . '/sveaekonomi/checkout/src/Validation/ValidateCreateTokenOrderData.php',
     
    198200    'Svea_Checkout_For_Woocommerce\\Compat\\WPC_Product_Bundles_Compat' => $baseDir . '/inc/Compat/WPC_Product_Bundles_Compat.php',
    199201    'Svea_Checkout_For_Woocommerce\\Compat\\Yith_Gift_Cards_Compat' => $baseDir . '/inc/Compat/Yith_Gift_Cards_Compat.php',
     202    'Svea_Checkout_For_Woocommerce\\Emails\\Awaiting_Svea_Email' => $baseDir . '/inc/Emails/Awaiting_Svea_Email.php',
    200203    'Svea_Checkout_For_Woocommerce\\Helper' => $baseDir . '/inc/Helper.php',
    201204    'Svea_Checkout_For_Woocommerce\\I18n' => $baseDir . '/inc/I18n.php',
  • svea-checkout-for-woocommerce/tags/3.3.0/vendor/composer/autoload_real.php

    r3172745 r3320066  
    33// autoload_real.php @generated by Composer
    44
    5 class ComposerAutoloaderInit9ff79c494c0893bca5aca8141f25854b
     5class ComposerAutoloaderInit4cfdf47045179a2c4f6ff86b1bce3df2
    66{
    77    private static $loader;
     
    2525        require __DIR__ . '/platform_check.php';
    2626
    27         spl_autoload_register(array('ComposerAutoloaderInit9ff79c494c0893bca5aca8141f25854b', 'loadClassLoader'), true, true);
     27        spl_autoload_register(array('ComposerAutoloaderInit4cfdf47045179a2c4f6ff86b1bce3df2', 'loadClassLoader'), true, true);
    2828        self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
    29         spl_autoload_unregister(array('ComposerAutoloaderInit9ff79c494c0893bca5aca8141f25854b', 'loadClassLoader'));
     29        spl_autoload_unregister(array('ComposerAutoloaderInit4cfdf47045179a2c4f6ff86b1bce3df2', 'loadClassLoader'));
    3030
    3131        require __DIR__ . '/autoload_static.php';
    32         call_user_func(\Composer\Autoload\ComposerStaticInit9ff79c494c0893bca5aca8141f25854b::getInitializer($loader));
     32        call_user_func(\Composer\Autoload\ComposerStaticInit4cfdf47045179a2c4f6ff86b1bce3df2::getInitializer($loader));
    3333
    3434        $loader->register(true);
    3535
    36         $filesToLoad = \Composer\Autoload\ComposerStaticInit9ff79c494c0893bca5aca8141f25854b::$files;
     36        $filesToLoad = \Composer\Autoload\ComposerStaticInit4cfdf47045179a2c4f6ff86b1bce3df2::$files;
    3737        $requireFile = \Closure::bind(static function ($fileIdentifier, $file) {
    3838            if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
  • svea-checkout-for-woocommerce/tags/3.3.0/vendor/composer/autoload_static.php

    r3264850 r3320066  
    55namespace Composer\Autoload;
    66
    7 class ComposerStaticInit9ff79c494c0893bca5aca8141f25854b
     7class ComposerStaticInit4cfdf47045179a2c4f6ff86b1bce3df2
    88{
    99    public static $files = array (
     
    194194        'Svea\\Checkout\\Implementation\\Admin\\ReplaceOrderRows' => __DIR__ . '/..' . '/sveaekonomi/checkout/src/Implementation/Admin/ReplaceOrderRows.php',
    195195        'Svea\\Checkout\\Implementation\\Admin\\UpdateOrderRow' => __DIR__ . '/..' . '/sveaekonomi/checkout/src/Implementation/Admin/UpdateOrderRow.php',
     196        'Svea\\Checkout\\Implementation\\ChangePaymentMethod' => __DIR__ . '/..' . '/sveaekonomi/checkout/src/Implementation/ChangePaymentMethod.php',
    196197        'Svea\\Checkout\\Implementation\\CreateOrder' => __DIR__ . '/..' . '/sveaekonomi/checkout/src/Implementation/CreateOrder.php',
    197198        'Svea\\Checkout\\Implementation\\CreateTokenOrder' => __DIR__ . '/..' . '/sveaekonomi/checkout/src/Implementation/CreateTokenOrder.php',
     
    225226        'Svea\\Checkout\\Validation\\Admin\\ValidateReplaceOrderRowsData' => __DIR__ . '/..' . '/sveaekonomi/checkout/src/Validation/Admin/ValidateReplaceOrderRowsData.php',
    226227        'Svea\\Checkout\\Validation\\Admin\\ValidateUpdateOrderRowData' => __DIR__ . '/..' . '/sveaekonomi/checkout/src/Validation/Admin/ValidateUpdateOrderRowData.php',
     228        'Svea\\Checkout\\Validation\\ValidateChangePaymentMethodData' => __DIR__ . '/..' . '/sveaekonomi/checkout/src/Validation/ValidateChangePaymentMethodData.php',
    227229        'Svea\\Checkout\\Validation\\ValidateCreateOrderData' => __DIR__ . '/..' . '/sveaekonomi/checkout/src/Validation/ValidateCreateOrderData.php',
    228230        'Svea\\Checkout\\Validation\\ValidateCreateTokenOrderData' => __DIR__ . '/..' . '/sveaekonomi/checkout/src/Validation/ValidateCreateTokenOrderData.php',
     
    261263        'Svea_Checkout_For_Woocommerce\\Compat\\WPC_Product_Bundles_Compat' => __DIR__ . '/../..' . '/inc/Compat/WPC_Product_Bundles_Compat.php',
    262264        'Svea_Checkout_For_Woocommerce\\Compat\\Yith_Gift_Cards_Compat' => __DIR__ . '/../..' . '/inc/Compat/Yith_Gift_Cards_Compat.php',
     265        'Svea_Checkout_For_Woocommerce\\Emails\\Awaiting_Svea_Email' => __DIR__ . '/../..' . '/inc/Emails/Awaiting_Svea_Email.php',
    263266        'Svea_Checkout_For_Woocommerce\\Helper' => __DIR__ . '/../..' . '/inc/Helper.php',
    264267        'Svea_Checkout_For_Woocommerce\\I18n' => __DIR__ . '/../..' . '/inc/I18n.php',
     
    283286    {
    284287        return \Closure::bind(function () use ($loader) {
    285             $loader->prefixLengthsPsr4 = ComposerStaticInit9ff79c494c0893bca5aca8141f25854b::$prefixLengthsPsr4;
    286             $loader->prefixDirsPsr4 = ComposerStaticInit9ff79c494c0893bca5aca8141f25854b::$prefixDirsPsr4;
    287             $loader->classMap = ComposerStaticInit9ff79c494c0893bca5aca8141f25854b::$classMap;
     288            $loader->prefixLengthsPsr4 = ComposerStaticInit4cfdf47045179a2c4f6ff86b1bce3df2::$prefixLengthsPsr4;
     289            $loader->prefixDirsPsr4 = ComposerStaticInit4cfdf47045179a2c4f6ff86b1bce3df2::$prefixDirsPsr4;
     290            $loader->classMap = ComposerStaticInit4cfdf47045179a2c4f6ff86b1bce3df2::$classMap;
    288291
    289292        }, null, ClassLoader::class);
  • svea-checkout-for-woocommerce/tags/3.3.0/vendor/composer/installed.json

    r3202226 r3320066  
    33        {
    44            "name": "guzzlehttp/guzzle",
    5             "version": "7.9.2",
    6             "version_normalized": "7.9.2.0",
     5            "version": "7.9.3",
     6            "version_normalized": "7.9.3.0",
    77            "source": {
    88                "type": "git",
    99                "url": "https://github.com/guzzle/guzzle.git",
    10                 "reference": "d281ed313b989f213357e3be1a179f02196ac99b"
    11             },
    12             "dist": {
    13                 "type": "zip",
    14                 "url": "https://api.github.com/repos/guzzle/guzzle/zipball/d281ed313b989f213357e3be1a179f02196ac99b",
    15                 "reference": "d281ed313b989f213357e3be1a179f02196ac99b",
     10                "reference": "7b2f29fe81dc4da0ca0ea7d42107a0845946ea77"
     11            },
     12            "dist": {
     13                "type": "zip",
     14                "url": "https://api.github.com/repos/guzzle/guzzle/zipball/7b2f29fe81dc4da0ca0ea7d42107a0845946ea77",
     15                "reference": "7b2f29fe81dc4da0ca0ea7d42107a0845946ea77",
    1616                "shasum": ""
    1717            },
     
    4040                "psr/log": "Required for using the Log middleware"
    4141            },
    42             "time": "2024-07-24T11:22:20+00:00",
     42            "time": "2025-03-27T13:37:11+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.2"
     114                "source": "https://github.com/guzzle/guzzle/tree/7.9.3"
    115115            },
    116116            "funding": [
     
    132132        {
    133133            "name": "guzzlehttp/promises",
    134             "version": "2.0.4",
    135             "version_normalized": "2.0.4.0",
     134            "version": "2.2.0",
     135            "version_normalized": "2.2.0.0",
    136136            "source": {
    137137                "type": "git",
    138138                "url": "https://github.com/guzzle/promises.git",
    139                 "reference": "f9c436286ab2892c7db7be8c8da4ef61ccf7b455"
    140             },
    141             "dist": {
    142                 "type": "zip",
    143                 "url": "https://api.github.com/repos/guzzle/promises/zipball/f9c436286ab2892c7db7be8c8da4ef61ccf7b455",
    144                 "reference": "f9c436286ab2892c7db7be8c8da4ef61ccf7b455",
     139                "reference": "7c69f28996b0a6920945dd20b3857e499d9ca96c"
     140            },
     141            "dist": {
     142                "type": "zip",
     143                "url": "https://api.github.com/repos/guzzle/promises/zipball/7c69f28996b0a6920945dd20b3857e499d9ca96c",
     144                "reference": "7c69f28996b0a6920945dd20b3857e499d9ca96c",
    145145                "shasum": ""
    146146            },
     
    152152                "phpunit/phpunit": "^8.5.39 || ^9.6.20"
    153153            },
    154             "time": "2024-10-17T10:06:22+00:00",
     154            "time": "2025-03-27T13:27:01+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.0.4"
     200                "source": "https://github.com/guzzle/promises/tree/2.2.0"
    201201            },
    202202            "funding": [
     
    218218        {
    219219            "name": "guzzlehttp/psr7",
    220             "version": "2.7.0",
    221             "version_normalized": "2.7.0.0",
     220            "version": "2.7.1",
     221            "version_normalized": "2.7.1.0",
    222222            "source": {
    223223                "type": "git",
    224224                "url": "https://github.com/guzzle/psr7.git",
    225                 "reference": "a70f5c95fb43bc83f07c9c948baa0dc1829bf201"
    226             },
    227             "dist": {
    228                 "type": "zip",
    229                 "url": "https://api.github.com/repos/guzzle/psr7/zipball/a70f5c95fb43bc83f07c9c948baa0dc1829bf201",
    230                 "reference": "a70f5c95fb43bc83f07c9c948baa0dc1829bf201",
     225                "reference": "c2270caaabe631b3b44c85f99e5a04bbb8060d16"
     226            },
     227            "dist": {
     228                "type": "zip",
     229                "url": "https://api.github.com/repos/guzzle/psr7/zipball/c2270caaabe631b3b44c85f99e5a04bbb8060d16",
     230                "reference": "c2270caaabe631b3b44c85f99e5a04bbb8060d16",
    231231                "shasum": ""
    232232            },
     
    249249                "laminas/laminas-httphandlerrunner": "Emit PSR-7 responses"
    250250            },
    251             "time": "2024-07-18T11:15:46+00:00",
     251            "time": "2025-03-27T12:30:47+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.0"
     319                "source": "https://github.com/guzzle/psr7/tree/2.7.1"
    320320            },
    321321            "funding": [
     
    553553        {
    554554            "name": "sveaekonomi/checkout",
    555             "version": "1.5.3",
    556             "version_normalized": "1.5.3.0",
     555            "version": "1.6.0",
     556            "version_normalized": "1.6.0.0",
    557557            "source": {
    558558                "type": "git",
    559559                "url": "https://github.com/sveawebpay/php-checkout.git",
    560                 "reference": "6241c3f894322775a8d574843f56bf1e2df884c1"
    561             },
    562             "dist": {
    563                 "type": "zip",
    564                 "url": "https://api.github.com/repos/sveawebpay/php-checkout/zipball/6241c3f894322775a8d574843f56bf1e2df884c1",
    565                 "reference": "6241c3f894322775a8d574843f56bf1e2df884c1",
     560                "reference": "d184c949b60b96595cb786320bf049a5fbaf91df"
     561            },
     562            "dist": {
     563                "type": "zip",
     564                "url": "https://api.github.com/repos/sveawebpay/php-checkout/zipball/d184c949b60b96595cb786320bf049a5fbaf91df",
     565                "reference": "d184c949b60b96595cb786320bf049a5fbaf91df",
    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": "2024-11-13T10:20:09+00:00",
     581            "time": "2025-06-30T13:03:15+00:00",
    582582            "type": "library",
    583583            "installation-source": "dist",
     
    600600            "support": {
    601601                "issues": "https://github.com/sveawebpay/php-checkout/issues",
    602                 "source": "https://github.com/sveawebpay/php-checkout/tree/1.5.3"
     602                "source": "https://github.com/sveawebpay/php-checkout/tree/1.6.0"
    603603            },
    604604            "install-path": "../sveaekonomi/checkout"
     
    684684            "type": "library",
    685685            "extra": {
     686                "thanks": {
     687                    "url": "https://github.com/symfony/contracts",
     688                    "name": "symfony/contracts"
     689                },
    686690                "branch-alias": {
    687691                    "dev-main": "3.0-dev"
    688                 },
    689                 "thanks": {
    690                     "name": "symfony/contracts",
    691                     "url": "https://github.com/symfony/contracts"
    692692                }
    693693            },
  • svea-checkout-for-woocommerce/tags/3.3.0/vendor/composer/installed.php

    r3202226 r3320066  
    1212    'versions' => array(
    1313        'guzzlehttp/guzzle' => array(
    14             'pretty_version' => '7.9.2',
    15             'version' => '7.9.2.0',
    16             'reference' => 'd281ed313b989f213357e3be1a179f02196ac99b',
     14            'pretty_version' => '7.9.3',
     15            'version' => '7.9.3.0',
     16            'reference' => '7b2f29fe81dc4da0ca0ea7d42107a0845946ea77',
    1717            'type' => 'library',
    1818            'install_path' => __DIR__ . '/../guzzlehttp/guzzle',
     
    2121        ),
    2222        'guzzlehttp/promises' => array(
    23             'pretty_version' => '2.0.4',
    24             'version' => '2.0.4.0',
    25             'reference' => 'f9c436286ab2892c7db7be8c8da4ef61ccf7b455',
     23            'pretty_version' => '2.2.0',
     24            'version' => '2.2.0.0',
     25            'reference' => '7c69f28996b0a6920945dd20b3857e499d9ca96c',
    2626            'type' => 'library',
    2727            'install_path' => __DIR__ . '/../guzzlehttp/promises',
     
    3030        ),
    3131        'guzzlehttp/psr7' => array(
    32             'pretty_version' => '2.7.0',
    33             'version' => '2.7.0.0',
    34             'reference' => 'a70f5c95fb43bc83f07c9c948baa0dc1829bf201',
     32            'pretty_version' => '2.7.1',
     33            'version' => '2.7.1.0',
     34            'reference' => 'c2270caaabe631b3b44c85f99e5a04bbb8060d16',
    3535            'type' => 'library',
    3636            'install_path' => __DIR__ . '/../guzzlehttp/psr7',
     
    9393        ),
    9494        'sveaekonomi/checkout' => array(
    95             'pretty_version' => '1.5.3',
    96             'version' => '1.5.3.0',
    97             'reference' => '6241c3f894322775a8d574843f56bf1e2df884c1',
     95            'pretty_version' => '1.6.0',
     96            'version' => '1.6.0.0',
     97            'reference' => 'd184c949b60b96595cb786320bf049a5fbaf91df',
    9898            'type' => 'library',
    9999            'install_path' => __DIR__ . '/../sveaekonomi/checkout',
  • svea-checkout-for-woocommerce/tags/3.3.0/vendor/guzzlehttp/guzzle/CHANGELOG.md

    r3172745 r3320066  
    22
    33Please refer to [UPGRADING](UPGRADING.md) guide for upgrading to a major version.
     4
     5
     6## 7.9.3 - 2025-03-27
     7
     8### Changed
     9
     10- Remove explicit content-length header for GET requests
     11- Improve compatibility with bad servers for boolean cookie values
    412
    513
  • svea-checkout-for-woocommerce/tags/3.3.0/vendor/guzzlehttp/guzzle/src/Cookie/SetCookie.php

    r3088414 r3320066  
    6363                                $data[$search] = (int) $value;
    6464                            }
     65                        } elseif ($search === 'Secure' || $search === 'Discard' || $search === 'HttpOnly') {
     66                            if ($value) {
     67                                $data[$search] = true;
     68                            }
    6569                        } else {
    6670                            $data[$search] = $value;
  • svea-checkout-for-woocommerce/tags/3.3.0/vendor/guzzlehttp/guzzle/src/Handler/Proxy.php

    r3088414 r3320066  
    1818     * requests to another handler.
    1919     *
    20      * @param callable(\Psr\Http\Message\RequestInterface, array): \GuzzleHttp\Promise\PromiseInterface $default Handler used for normal responses
    21      * @param callable(\Psr\Http\Message\RequestInterface, array): \GuzzleHttp\Promise\PromiseInterface $sync    Handler used for synchronous responses.
     20     * @param callable(RequestInterface, array): PromiseInterface $default Handler used for normal responses
     21     * @param callable(RequestInterface, array): PromiseInterface $sync    Handler used for synchronous responses.
    2222     *
    23      * @return callable(\Psr\Http\Message\RequestInterface, array): \GuzzleHttp\Promise\PromiseInterface Returns the composed handler.
     23     * @return callable(RequestInterface, array): PromiseInterface Returns the composed handler.
    2424     */
    2525    public static function wrapSync(callable $default, callable $sync): callable
     
    3838     * through the StreamHandler.
    3939     *
    40      * @param callable(\Psr\Http\Message\RequestInterface, array): \GuzzleHttp\Promise\PromiseInterface $default   Handler used for non-streaming responses
    41      * @param callable(\Psr\Http\Message\RequestInterface, array): \GuzzleHttp\Promise\PromiseInterface $streaming Handler used for streaming responses
     40     * @param callable(RequestInterface, array): PromiseInterface $default   Handler used for non-streaming responses
     41     * @param callable(RequestInterface, array): PromiseInterface $streaming Handler used for streaming responses
    4242     *
    43      * @return callable(\Psr\Http\Message\RequestInterface, array): \GuzzleHttp\Promise\PromiseInterface Returns the composed handler.
     43     * @return callable(RequestInterface, array): PromiseInterface Returns the composed handler.
    4444     */
    4545    public static function wrapStreaming(callable $default, callable $streaming): callable
  • svea-checkout-for-woocommerce/tags/3.3.0/vendor/guzzlehttp/guzzle/src/Handler/StreamHandler.php

    r3172745 r3320066  
    5454
    5555            // Append a content-length header if body size is zero to match
    56             // cURL's behavior.
    57             if (0 === $request->getBody()->getSize()) {
     56            // the behavior of `CurlHandler`
     57            if (
     58                (
     59                    0 === \strcasecmp('PUT', $request->getMethod())
     60                    || 0 === \strcasecmp('POST', $request->getMethod())
     61                )
     62                && 0 === $request->getBody()->getSize()
     63            ) {
    5864                $request = $request->withHeader('Content-Length', '0');
    5965            }
  • svea-checkout-for-woocommerce/tags/3.3.0/vendor/guzzlehttp/guzzle/src/Pool.php

    r3088414 r3320066  
    8787     * @param array|\Iterator $requests Requests to send concurrently.
    8888     * @param array           $options  Passes through the options available in
    89      *                                  {@see \GuzzleHttp\Pool::__construct}
     89     *                                  {@see Pool::__construct}
    9090     *
    9191     * @return array Returns an array containing the response or an exception
  • svea-checkout-for-woocommerce/tags/3.3.0/vendor/guzzlehttp/guzzle/src/Utils.php

    r3172745 r3320066  
    8080     * The returned handler is not wrapped by any default middlewares.
    8181     *
    82      * @return callable(\Psr\Http\Message\RequestInterface, array): \GuzzleHttp\Promise\PromiseInterface Returns the best handler for the given system.
     82     * @return callable(\Psr\Http\Message\RequestInterface, array): Promise\PromiseInterface Returns the best handler for the given system.
    8383     *
    8484     * @throws \RuntimeException if no viable Handler is available.
  • svea-checkout-for-woocommerce/tags/3.3.0/vendor/guzzlehttp/guzzle/src/functions.php

    r3088414 r3320066  
    5151 * The returned handler is not wrapped by any default middlewares.
    5252 *
    53  * @return callable(\Psr\Http\Message\RequestInterface, array): \GuzzleHttp\Promise\PromiseInterface Returns the best handler for the given system.
     53 * @return callable(\Psr\Http\Message\RequestInterface, array): Promise\PromiseInterface Returns the best handler for the given system.
    5454 *
    5555 * @throws \RuntimeException if no viable Handler is available.
  • svea-checkout-for-woocommerce/tags/3.3.0/vendor/guzzlehttp/promises/CHANGELOG.md

    r3172745 r3320066  
    11# CHANGELOG
     2
     3
     4## 2.2.0 - 2025-03-27
     5
     6### Fixed
     7
     8- Revert "Allow an empty EachPromise to be resolved by running the queue"
     9
     10
     11## 2.1.0 - 2025-03-27
     12
     13### Added
     14
     15- Allow an empty EachPromise to be resolved by running the queue
    216
    317
  • svea-checkout-for-woocommerce/tags/3.3.0/vendor/guzzlehttp/psr7/CHANGELOG.md

    r3172745 r3320066  
    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.7.1 - 2025-03-27
     9
     10### Fixed
     11
     12- Fixed uppercase IPv6 addresses in URI
     13
     14### Changed
     15
     16- Improve uploaded file error message
    717
    818## 2.7.0 - 2024-07-18
  • svea-checkout-for-woocommerce/tags/3.3.0/vendor/guzzlehttp/psr7/src/UploadedFile.php

    r3172745 r3320066  
    1212class UploadedFile implements UploadedFileInterface
    1313{
    14     private const ERRORS = [
    15         UPLOAD_ERR_OK,
    16         UPLOAD_ERR_INI_SIZE,
    17         UPLOAD_ERR_FORM_SIZE,
    18         UPLOAD_ERR_PARTIAL,
    19         UPLOAD_ERR_NO_FILE,
    20         UPLOAD_ERR_NO_TMP_DIR,
    21         UPLOAD_ERR_CANT_WRITE,
    22         UPLOAD_ERR_EXTENSION,
     14    private const ERROR_MAP = [
     15        UPLOAD_ERR_OK => 'UPLOAD_ERR_OK',
     16        UPLOAD_ERR_INI_SIZE => 'UPLOAD_ERR_INI_SIZE',
     17        UPLOAD_ERR_FORM_SIZE => 'UPLOAD_ERR_FORM_SIZE',
     18        UPLOAD_ERR_PARTIAL => 'UPLOAD_ERR_PARTIAL',
     19        UPLOAD_ERR_NO_FILE => 'UPLOAD_ERR_NO_FILE',
     20        UPLOAD_ERR_NO_TMP_DIR => 'UPLOAD_ERR_NO_TMP_DIR',
     21        UPLOAD_ERR_CANT_WRITE => 'UPLOAD_ERR_CANT_WRITE',
     22        UPLOAD_ERR_EXTENSION => 'UPLOAD_ERR_EXTENSION',
    2323    ];
    2424
     
    105105    private function setError(int $error): void
    106106    {
    107         if (false === in_array($error, UploadedFile::ERRORS, true)) {
     107        if (!isset(UploadedFile::ERROR_MAP[$error])) {
    108108            throw new InvalidArgumentException(
    109109                'Invalid error status for UploadedFile'
     
    138138    {
    139139        if (false === $this->isOk()) {
    140             throw new RuntimeException('Cannot retrieve stream due to upload error');
     140            throw new RuntimeException(\sprintf('Cannot retrieve stream due to upload error (%s)', self::ERROR_MAP[$this->error]));
    141141        }
    142142
  • svea-checkout-for-woocommerce/tags/3.3.0/vendor/guzzlehttp/psr7/src/Uri.php

    r3172745 r3320066  
    108108        // If IPv6
    109109        $prefix = '';
    110         if (preg_match('%^(.*://\[[0-9:a-f]+\])(.*?)$%', $url, $matches)) {
     110        if (preg_match('%^(.*://\[[0-9:a-fA-F]+\])(.*?)$%', $url, $matches)) {
    111111            /** @var array{0:string, 1:string, 2:string} $matches */
    112112            $prefix = $matches[1];
  • svea-checkout-for-woocommerce/tags/3.3.0/vendor/sveaekonomi/checkout/README.md

    r2983864 r3320066  
    99* [6. Create recurring order](#6-create-recurring-order)
    1010* [7. Get recurring order](#7-get-recurring-order)
    11 * [8. Response](#8-response)
    12 * [9. Additional requests](#9-additional-requests)
    13 * [10. Data structures](#10-data-structures)
    14 * [11. HttpStatusCodes](#11-httpstatuscodes)
    15 * [12. Order administration](#12-order-administration)
    16 * [13. Javascript API](#13-javascript-api)
     11* [8. Change payment method for recurring order](#8-change-payment-method-for-recurring-order)
     12* [9. Response](#9-response)
     13* [10. Additional requests](#10-additional-requests)
     14* [11. Data structures](#11-data-structures)
     15* [12. HttpStatusCodes](#12-httpstatuscodes)
     16* [13. Order administration](#13-order-administration)
     17* [14. Javascript API](#14-javascript-api)
    1718## Introduction
    1819The checkout offers a complete solution with a variety of payment methods. The payment methods that are currently available in the checkout are invoice, payment plan, account credit, card payments and payment by bank.
    1920
    2021
    21 The checkout supports both B2C and B2B payments, fast customer identification and caches customers behaviour.
     22The checkout supports both B2C and B2B payments, fast customer identification and caches customers behavior.
    2223
    2324
     
    135136| IdentityFlags                     |          | Array of [*IdentityFlags*](#1012-identityflags) | Array of [*IdentityFlags*](#812-identityflags) used to hide certain features of the iframe |
    136137| PartnerKey                        |          | Guid                                            | Optional, provided by Svea on request. Used to create statistics.                               |
    137 | Recurring                         |          | Boolean                                         | Optional, if set to true the order will be a recurring order. (Only avilable if the merchant account has this feature enabled)                                 |
     138| Recurring                         |          | Boolean                                         | Optional, if set to true the order will be a recurring order. (Only available if the merchant account has this feature enabled)                                 |
    138139| MerchantData                      |          | String                                          | Metadata visible in the checkout API, returned when the order is fetched through the API.     |
    139140 
     
    375376```
    376377
    377 ### 8. Response
     378### 8. Change payment method for recurring order
     379Svea Checkout allows you to let customers change the payment method for an existing recurring order.
     380This feature is useful if a customer's card expires.
     381
     382#### Prerequisites
     383- The recurring order must be created and active.
     384- You need a "token" associated with the subscription.
     385
     386#### How it works
     387You use the changePaymentMethod endpoint via the \Svea\Checkout\CheckoutClient.
     388This will generate a new checkout session where the customer can select a new payment method.
     389Once the customer completes the flow, the new payment method will be linked to the recurring order.
     390
     391#### Example
     392```php
     393// include the library
     394include 'vendor/autoload.php';
     395
     396// without composer
     397require_once 'include.php';
     398
     399$checkoutClient = new \Svea\Checkout\CheckoutClient($connector);
     400
     401$data = [
     402    'token' => '12345678-90ab-cdef-1234-567890abcdef',
     403    'termsUrl' => 'http://yourdomain.se/terms'
     404];
     405
     406$response = $checkoutClient->changePaymentMethod($data);
     407
     408// Show the customer this snippet that lets them select a new payment method.
     409$sveaCheckoutIframe = $response['Gui']['Snippet'] ?? null;
     410echo $sveaCheckoutIframe ?: '';
     411```
     412
     413After the customer has completed the payment method change, Svea will update the payment details on the current token. No change needed from your side.
     414
     415### 9. Response
    378416The response contains information about the order such as Cart, Status, PaymentType and much more.
    379417
     
    542580echo $response['Gui']['Snippet']
    543581```
    544 ### 9. Additional requests
    545 
    546 #### 9.1 GetAvailablePartPaymentCampaigns
     582### 10. Additional requests
     583
     584#### 10.1 GetAvailablePartPaymentCampaigns
    547585
    548586GetAvailablePartPaymentCampaigns can be used to fetch the details of all the campaigns that are available on the merchant
     
    635673If you are a finnish merchant you have to display ALL the values described [here](https://www.kkv.fi/sv/beslut-och-publikationer/publikationer/konsumentrombudsmannens-riktlinjer/enligt-substans/tillhandahallande-av-konsumentkrediter/#luottolinjausSVE5.1) to be compliant with finnish laws.
    636674
    637 ### 10. Data structures
    638 
    639 #### 10.1 MerchantSettings
     675### 11. Data structures
     676
     677#### 11.1 MerchantSettings
    640678
    641679| Parameters                | Required  | Type      | Description  | Limits  |
    642680|------------------------------|-----------|-----------|--------------|---------|
    643 | TermsUri                     |    *      | string    | URI to a page which contains terms of the webshop. | 1-500 characters, must be a valid Url |
    644 | CheckoutUri                  |    *      | string    | URI to the page in the webshop that loads the Checkout.  | 1-500 characters, must be a valid Url |
    645 | ConfirmationUri              |    *      | string    | URI to the page in the webshop displaying specific information to a customer after the order has been confirmed. | 1-500 characters, must be a valid Url |
     681| TermsUri                     |    *      | string    | URI to a page which contains terms of the web shop. | 1-500 characters, must be a valid Url |
     682| CheckoutUri                  |    *      | string    | URI to the page in the web shop that loads the Checkout.  | 1-500 characters, must be a valid Url |
     683| ConfirmationUri              |    *      | string    | URI to the page in the web shop displaying specific information to a customer after the order has been confirmed. | 1-500 characters, must be a valid Url |
    646684| PushUri                      |    *      | string    | URI to a location that is expecting callbacks when CheckoutOrderStatus is changed. Uri should use the {checkout.order.uri} placeholder.  | 1-500 characters, must be a valid Url |
    647685| CheckoutValidationCallBackUri|           | string    | An optional URl to a location that is expecting callbacks from the Checkout to validate order’s stock status, and also the possibility to update checkout with an updated ClientOrderNumber. Uri may have a {checkout.order.uri} placeholder which will be replaced with the CheckoutOrderId. Please refer below [*CheckoutValidationCallbackResponse*](#1013-checkoutvalidationcallbackresponse) to see the expected response. | 1-500 characters, must be a valid Url |
     
    649687| PromotedPartPaymentCampaign  |           | integer   | Valid CampaignID. If used then the chosen campaign will be shown as the first payment method in all payment method lists. | Must be valid CampaignID |
    650688
    651 #### 10.2 Items
     689#### 11.2 Items
    652690
    653691| Parameters                | Required  | Type                                 | Description         |
     
    655693| Items                        |    *      | List of [*OrderRows*](#103-orderrow)  | See structure below |
    656694
    657 #### 10.3 OrderRow
     695#### 11.3 OrderRow
    658696
    659697| Parameters                | Required   | Type      | Description  | Limits  |
    660698|------------------------------|------------|-----------|--------------|---------|
    661 | ArticleNumber                |            | String    | Articlenumber as a string, can contain letters and numbers. | Maximum 1000 characters |
     699| ArticleNumber                |            | String    | Article number as a string, can contain letters and numbers. | Maximum 1000 characters |
    662700| Name                         |    *       | String    | Article name | 1-40 characters |
    663701| Quantity                     |    *       | Integer       | Set as basis point (1/100) e.g  2 = 200      | 1-9 digits. Minor currency |
    664702| UnitPrice                    |    *       | Integer       | Set as basis point (1/100) e.g. 25.00 = 2500 | 1-13 digits, can be negative. Minor currency |
    665 | DiscountPercent              |            | Integer       | The discountpercent of the product. | 0-100 |
     703| DiscountPercent              |            | Integer       | The discount percent of the product. | 0-100 |
    666704| VatPercent                   |    *       | Integer       | The VAT percentage of the current product. | Valid vat percentage for that country. Minor currency.  |
    667705| Unit                         |            | String        | The unit type, e.g., “st”, “pc”, “kg” etc. | 0-4 characters|
    668 | TemporaryReference           |            | String        | Can be used when creating or updating an order. The returned rows will have their corresponding temporaryreference as they were given in the indata. It will not be stored and will not be returned in GetOrder.  | |
     706| TemporaryReference           |            | String        | Can be used when creating or updating an order. The returned rows will have their corresponding "temporaryreference" as they were given in the indata. It will not be stored and will not be returned in GetOrder.  | |
    669707| MerchantData                 |            | String        | Can be used to store data, the data is not displayed anywhere but in the API
    670708
    671 #### 10.4 PresetValue
     709#### 11.4 PresetValue
    672710
    673711| Parameters             | Required  | Type          | Description  |
     
    685723| PhoneNumber               | String        |              | 1-18 digits, can include “+”, “-“s and space |
    686724| PostalCode                | String        |              | Company specific validation |
    687 | IsCompany                 | Boolean       |              | Required if nationalid is set |
    688 
    689 #### 10.5 Gui
     725| IsCompany                 | Boolean       |              | Required if "nationalid" is set |
     726
     727#### 11.5 Gui
    690728
    691729| Parameters               |  Type      | Description  |
     
    694732| Snippet                      | String     | HTML-snippet including javascript to populate the iFrame. |
    695733
    696 #### 10.6 Customer
     734#### 11.6 Customer
    697735
    698736| Parameters               | Type      | Description  |
    699737|------------------------------|-----------|--------------|
    700 | NationalId                   | String    | Personal- or organizationnumber. |
    701 | IsCompany                    | Boolean   | True if nationalId is organisationnumber, false if nationalid is personalnumber.   |
     738| NationalId                   | String    | Personal- or organization number. |
     739| IsCompany                    | Boolean   | True if nationalId is organisation number, false if "nationalid" is personal number.   |
    702740| CountryCode                  | String    |  Defined by two-letter ISO 3166-1 alpha-2, i.e. SE, DE, FI etc.|
    703741| Id                           | Integer   | Customer-specific id |
    704742
    705 #### 10.7 Address
     743#### 11.7 Address
    706744
    707745| Parameters                | Type      | Description  |
     
    718756| AddressLines                 | Array of strings | Null unless international flow is used
    719757
    720 #### 10.8 CheckoutOrderStatus
     758#### 11.8 CheckoutOrderStatus
    721759
    722760The order can only be considered “ready to send to customer” when the CheckoutOrderStatus is Final. No other status can guarantee payment.
     
    728766| Final                        | The order is completed in the checkout and managed by WebPay’s subsystems. The order can now be administrated using either the library or browsing to the admin user interface|
    729767
    730 #### 10.9 Locale
     768#### 11.9 Locale
    731769| Parameter | Description     |
    732770|-----------|-----------------|
     
    739777
    740778
    741 #### 10.10 PaymentType
     779#### 11.10 PaymentType
    742780| Parameter   | Description     |
    743781|-------------|-----------------|
     
    755793| LEASINGUNAPPROVED | Leasing (Manual approve process by Sveas leasing department, check Store pay admin page) |
    756794| LEASINGAPPROVED | Leasing (Automatically approved leasing contract)
    757 | TRUSTLY            | The customer paied with Trustly |
     795| TRUSTLY            | The customer paid with Trustly |
    758796| Directbank (varies)  |    The customer paid the order with direct bank e.g. Nordea, SEB. See below for all available parameters |
    759797
     
    778816
    779817
    780 #### 10.11 CampaignCodeInfo
     818#### 11.11 CampaignCodeInfo
    781819| Parameter                 | Type      | Description |
    782820|---------------------------|-----------|-------------|
     
    794832| PaymentPlanType           | Integer   | Type of campaign |
    795833
    796 #### 10.12 IdentityFlags
     834#### 11.12 IdentityFlags
    797835| Parameter                 | Type      | Description |
    798836|---------------------------|-----------|-------------|
     
    801839| HideAnonymous           | Boolean   | Hides anonymous flow, forcing users to identify with their nationalId to perform a purchase |
    802840
    803 #### 10.13 CheckoutValidationCallbackResponse
     841#### 11.13 CheckoutValidationCallbackResponse
    804842If a CheckoutValidationCallbackUri is set on an order when it's created, Svea will send a HTTP GET request to the specified URI when a customer clicks on "Confirm Order".
    805843
     
    811849| ClientOrderNumber |          | String  | Max 32 characters. Set if you want the ClientOrderNumber to be updated. |
    812850
    813 ### 11. HttpStatusCodes
     851### 12. HttpStatusCodes
    814852| Parameter | Type          | Description |
    815853|-----------|---------------|-------------|
     
    827865If the returned ResultCode is not present in the above tables please contact Svea Ekonomi for further information.
    828866
    829 ## 12. Order administration
     867## 13. Order administration
    830868
    831869[See full examples](examples/admin)
     
    843881\Exception - For any other error
    844882
    845 ### 12.1 Get order
     883### 13.1 Get order
    846884This method is used to get the entire order with all its relevant information. Including its deliveries, rows, credits and addresses.
    847885
     
    856894| Parameters OUT                | Type      | Description  |
    857895|-------------------------------|-----------|--------------|
    858 | Order          | array     | An array containing all the order details. See [12.14 Data objects](#1215-data-objects) |
    859 
    860 
    861 
    862 ### 12.2 Get task
     896| Order          | array     | An array containing all the order details. See [13.14 Data objects](#1215-data-objects) |
     897
     898
     899
     900### 13.2 Get task
    863901A task will explain the status of a previously performed operation. When finished it will point towards the new resource with the Location.
    864902#### Parameters
     
    874912| Task                          | [Task](#12154-task)      | An object containing details regarding a queued task |
    875913
    876 ### 12.3 Deliver order
     914### 13.3 Deliver order
    877915Creates a delivery on a checkout order. Assuming the order got the **CanDeliverOrder** action.
    878916
     
    894932| HeaderLocation                | string    | URI to the created task. (Absolute URL) |
    895933
    896 ### 12.3.1 Row Delivery Options
     934### 13.3.1 Row Delivery Options
    897935
    898936| Parameter                     | Type       | Description  |
     
    901939| quantity                      | int        | Number of items to credit |
    902940
    903 ### 12.4 Deliver order with lower amount
     941### 13.4 Deliver order with lower amount
    904942Creates a delivery on a checkout order with a lower amount than the total, canceling the remaining amount. Assuming the order got **CanDeliverOrder** and **CanCancelAmount** action.
    905943
     
    918956| HeaderLocation       | string | URI to the created task (Absolute URL)  |
    919957
    920 ### 12.5 Cancel Order
     958### 13.5 Cancel Order
    921959Cancel an order before it has been delivered. Assuming the order has the action **CanCancelOrder**.
    922960
     
    930968If the order is successfully cancelled, Response is empty.
    931969
    932 ### 12.6 Cancel order amount
     970### 13.6 Cancel order amount
    933971By specifying a higher amount than the current order cancelled amount then the order cancelled amount will increase,
    934972assuming the order has the action **CanCancelOrderAmount**. The delta between the new *CancelledAmount* and the former *CancelledAmount* will be cancelled.
     
    946984If order amount is successfully cancelled, Response is empty.
    947985
    948 ### 12.7 Cancel order row
     986### 13.7 Cancel order row
    949987Changes the status of an order row to *Cancelled*, assuming the order has the action **CanCancelOrderRow** and the OrderRow has the action **CanCancelRow**.
    950988
     
    959997If order row is successfully cancelled, Response is empty.
    960998
    961 ### 12.8 Credit order rows
     999### 13.8 Credit order rows
    9621000Creates a new credit on the specified delivery with specified order rows. Assuming the delivery has action **CanCreditOrderRows** and the specified order rows also has action **CanCreditRow**
    9631001
     
    9771015On the returned URL can be checked status of the task.
    9781016
    979 ### 12.8.1 Row Crediting Options
     1017### 13.8.1 Row Crediting Options
    9801018
    9811019| Parameter                     | Type       | Description  |
     
    9841022| quantity                      | int        | Number of items to credit |
    9851023
    986 ### 12.9 Credit new order row
     1024### 13.9 Credit new order row
    9871025By specifying a new credit row, a new credit row will be created on the delivery, assuming the delivery has action **CanCreditNewRow**.
    9881026
     
    10011039On the returned URL can be checked status of the task.
    10021040
    1003 ### 12.10 Credit order rows with fee
     1041### 13.10 Credit order rows with fee
    10041042Creates a new credit on the specified delivery with specified order rows. Assuming the delivery has action **CanCreditOrderRows** and the specified order rows also has action **CanCreditRow**. Adds the ability to add a fee to the credit.
    10051043
     
    10191057
    10201058On the returned URL can be checked status of the task.
    1021 ### 12.11 Credit amount
     1059### 13.11 Credit amount
    10221060By specifying a credited amount larger than the current credited amount. A credit is being made on the specified delivery. The credited amount cannot be lower than the current credited amount or larger than the delivered amount.
    10231061
     
    10341072If order amount is successfully credited, Response is empty.
    10351073
    1036 ### 12.12 Add order row
     1074### 13.12 Add order row
    10371075This method is used to add order rows to an order, assuming the order has the action **CanAddOrderRow**.
    10381076If the new order amount will exceed the current order amount, a credit check will be performed.
     
    10521090On the returned URL (HeaderLocation) can be checked status of the task.
    10531091
    1054 ### 12.13 Update order row
     1092### 13.13 Update order row
    10551093This method is used to update an order row, assuming the order has action "CanUpdateOrderRow" and the order row has the action **CanUpdateRow**.
    10561094The method will update all fields set in the payload, if a field is not set the row will keep the current value.
     
    10671105If order row is successfully updated, Response is empty.
    10681106
    1069 ### 12.14 Replace order rows
     1107### 13.14 Replace order rows
    10701108This method is used to update an order row, assuming the order has action "CanUpdateOrderRow".
    10711109This method will delete all the present rows and replace with the ones set in the payload.
     
    10821120
    10831121
    1084 ### 12.15 Data objects
    1085 
    1086 #### 12.15.1 Order
     1122### 13.15 Data objects
     1123
     1124#### 13.15.1 Order
    10871125| Parameter             |   Type        | Description                                               |
    10881126|-----------------------|---------------|-----------------------------------------------------------|
     
    10951133| PaymentType           | string        | The final payment method for the order. Will only have a value when the order is locked, otherwise null. See list of possible PaymentType below.|
    10961134| CreationDate          | DateTime      | Date and time when the order was created|
    1097 | NationalId            | string        | Personal- or organizationnumber.|
    1098 | IsCompany             | boolean       | True if nationalid is organisationnumber, false if nationalid is personalnumber.| 
     1135| NationalId            | string        | Personal- or organization number.|
     1136| IsCompany             | boolean       | True if "nationalid" is organisation number, false if "nationalid" is personal number.| 
    10991137| OrderAmount           | int           | The total amount on the order. Minor unit|
    11001138| CancelledAmount       | int           | The total cancelled amount on the order. Minor uit|
     
    11051143| Actions               | List of String | A list of actions possible on the order.|
    11061144
    1107 #### 12.15.2 Delivery
     1145#### 13.15.2 Delivery
    11081146
    11091147| Parameter             |   Type        | Description                                               |
     
    11181156| Actions               | List of string | A list of actions possible on the delivery.|
    11191157
    1120 #### 12.15.3 Credit
     1158#### 13.15.3 Credit
    11211159
    11221160| Parameter             |   Type        | Description                                               |
     
    11261164| Actions               | List of String | A list of actions possible on the credit.|
    11271165
    1128 #### 12.15.4 Task
     1166#### 13.15.4 Task
    11291167
    11301168| Parameter             |   Type        | Description                                               |
     
    11331171| Status                | String        | Status of the task |
    11341172
    1135 #### 12.15.5 Order Row
     1173#### 13.15.5 Order Row
    11361174
    11371175|Parameter              |R  | RO | Type     | Description                   |   Limits|
    11381176|-----------------------|---|----|----------|-------------------------------|-------------------|
    11391177| OrderRowId            |   | *  |int      | Order row id from underlying system, unique on order. | Not possible to set through API, only get.|
    1140 | ArticleNumber         |   |    |string    | Articlenumber as a string, can contain letters and numbers. | Maximum 256 characters.   |
     1178| ArticleNumber         |   |    |string    | Article number as a string, can contain letters and numbers. | Maximum 256 characters.   |
    11411179| Name                  | * |    |string    | Article name. | 1-40 characters. |
    11421180| Quantity              | * |    |int      | Quantity of the product. | 1-9 digits. Minor unit.|
    11431181| UnitPrice             | * |    |int      | Price of the product including VAT. | 1-13 digits, can be negative. Minor currency.|
    1144 | DiscountPercent       |   |    |int      | The discountpercent of the product. | 0-9900. Minor unit|
     1182| DiscountPercent       |   |    |int      | The discount percent of the product. | 0-9900. Minor unit|
    11451183| VatPercent            | * |    |int      | The VAT percentage of the current product. | Valid vat percentage for that country . Minor unit.0-10000|
    11461184| Unit                  |   |    |string    | The unit type, e.g., “st”, “pc”, “kg” etc.  | 0-4 characters. |
     
    11481186| Actions               |   | *  |List of string | A list of actions possible on the order row. See list of OrderRow actions below. | Not possible to set through API, only get.|
    11491187
    1150 #### 12.15.6 Address
     1188#### 13.15.6 Address
    11511189
    11521190| Parameter             |   Type        | Description                                               |
     
    11591197| CountryCode           |   string      |   2-letter ISO country code |
    11601198
    1161 #### 12.15.7 Order Status
     1199#### 13.15.7 Order Status
    11621200
    11631201| Parameter             |  Description                                               |
     
    11681206| Failed                | The payment for this order has failed |
    11691207
    1170 #### 12.15.8 Order actions
     1208#### 13.15.8 Order actions
    11711209
    11721210| Parameter                 |  Description                                               |
     
    11801218| CanUpdateOrderRow         ||
    11811219
    1182 #### 12.15.9 Delivery actions
     1220#### 13.15.9 Delivery actions
    11831221
    11841222| Parameter             |  Description                                               |
     
    11881226| CanCreditAmount       ||     
    11891227
    1190 #### 12.15.10 Order Row actions
     1228#### 13.15.10 Order Row actions
    11911229
    11921230| Parameter             |  Description                                               |
     
    11971235| CanUpdateRow          ||
    11981236
    1199 ## 13. Javascript API
     1237## 14. Javascript API
    12001238
    12011239(Please note that the API is still considered a work in progress and might see significant changes.)
  • svea-checkout-for-woocommerce/tags/3.3.0/vendor/sveaekonomi/checkout/VERSION

    r3172745 r3320066  
    1 1.5.2
     11.6.0
  • svea-checkout-for-woocommerce/tags/3.3.0/vendor/sveaekonomi/checkout/composer.json

    r3202226 r3320066  
    11{
    22  "name": "sveaekonomi/checkout",
    3   "version": "1.5.3",
     3  "version": "1.6.0",
    44  "description": "Php integration library for Svea Checkout",
    55  "license": "Apache-2.0",
     
    2626    "phploc/phploc": "^2.0.1",
    2727    "sebastian/phpcpd": "^2.0.4",
    28     "symfony/dependency-injection": "^2.7.51 || ^2.8.50 || ^3.4.26 || ^4.1.12 || ^4.2.7"
     28      "symfony/dependency-injection": "^2.7.51 || ^2.8.50 || ^3.4.26 || ^4.1.12 || ^4.2.7"
    2929  },
    3030  "scripts": {
  • svea-checkout-for-woocommerce/tags/3.3.0/vendor/sveaekonomi/checkout/src/CheckoutClient.php

    r2983864 r3320066  
    7070
    7171        return $this->executeAction($class, $data);
     72    }
     73
     74    /**
     75     * Change payment method for existing Svea Checkout order.
     76     *
     77     * @param array $data
     78     * @return mixed
     79     */
     80    public function changePaymentMethod( array $data )
     81    {
     82        return $this->executeAction(ImplementationFactory::returnChangePaymentMethodClass($this->connector), $data);
     83       
    7284    }
    7385
  • svea-checkout-for-woocommerce/tags/3.3.0/vendor/sveaekonomi/checkout/src/Implementation/ImplementationFactory.php

    r2983864 r3320066  
    55use Svea\Checkout\Transport\Connector;
    66use Svea\Checkout\Validation\ValidateCreateOrderData;
     7use Svea\Checkout\Validation\ValidateChangePaymentMethodData;
    78use Svea\Checkout\Validation\ValidateCreateTokenOrderData;
    89use Svea\Checkout\Validation\ValidateGetOrderData;
     
    1718    /**
    1819     * @param Connector $connector
    19      * @return ImplementationInterface
     20     * @return CreateOrder
    2021     */
    2122    public static function returnCreateOrderClass(Connector $connector)
     
    2627    /**
    2728     * @param Connector $connector
    28      * @return ImplementationInterface
     29     * @return CreateTokenOrder
    2930     */
    30     public static function returnCreateTokenOrderClass(Connector $connector) {
     31    public static function returnCreateTokenOrderClass(Connector $connector)
     32    {
    3133        return new CreateTokenOrder($connector, new ValidateCreateTokenOrderData());
    3234    }
     
    3436    /**
    3537     * @param Connector $connector
    36      * @return ImplementationInterface
     38     * @return ChangePaymentMethod
     39     */
     40    public static function returnChangePaymentMethodClass(Connector $connector)
     41    {
     42        return new ChangePaymentMethod($connector, new ValidateChangePaymentMethodData());
     43    }
     44
     45    /**
     46     * @param Connector $connector
     47     * @return GetOrder
    3748     */
    3849    public static function returnGetOrderClass(Connector $connector)
     
    4354    /**
    4455     * @param Connector $connector
    45      * @return ImplementationInterface
     56     * @return GetTokenOrder
    4657     */
    4758    public static function returnGetTokenOrderClass(Connector $connector)
     
    5263    /**
    5364     * @param Connector $connector
    54      * @return ImplementationInterface
     65     * @return GetToken
    5566     */
    5667    public static function returnGetTokenClass(Connector $connector)
     
    6172    /**
    6273     * @param Connector $connector
    63      * @return ImplementationInterface
     74     * @return UpdateToken
    6475     */
    6576    public static function returnUpdateTokenClass(Connector $connector)
     
    7081    /**
    7182     * @param Connector $connector
    72      * @return ImplementationInterface
     83     * @return UpdateOrder
    7384     */
    7485    public static function returnUpdateOrderClass(Connector $connector)
     
    7990    /**
    8091     * @param Connector $connector
    81      * @return ImplementationInterface
     92     * @return GetAvailablePartPaymentCampaigns
    8293     */
    8394    public static function returnGetAvailablePartPaymentCampaignsClass(Connector $connector)
  • svea-checkout-for-woocommerce/trunk/assets/js/frontend/application.min.js

    r3202226 r3320066  
    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.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.triggerValidationCallbackEvent(this.submitOrder.bind(this)),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),i=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:i,success:e=>{let s=!1;void 0!==e.result&&("failure"===e.result?this.showErrors(e.messages):"success"===e.result&&(s=!0)),t.callback&&t.callback({valid:s})}})}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(),i=this.serializeFormToObject(o,!1);"object"==typeof s&&(s=!0);const a=Object.assign(i,{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:a,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,i]=e.split("=");(t||0!==o.indexOf(this.attributionKey))&&(s[decodeURIComponent(o)]=decodeURIComponent(i))})),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_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);
  • svea-checkout-for-woocommerce/trunk/inc/Admin.php

    r3203722 r3320066  
    5656        add_action( 'add_meta_boxes', [ $this, 'add_metabox' ] );
    5757
    58         add_action( 'woocommerce_order_item_get_taxes', [ $this, 'correct_taxes' ], 10, 2 );
     58        add_filter( 'woocommerce_order_item_get_taxes', [ $this, 'correct_taxes' ], 10, 2 );
    5959
    6060        add_filter( 'woocommerce_register_shop_order_post_statuses', [ $this, 'register_order_status' ] );
     
    6868        add_action( 'woocommerce_order_status_' . self::AWAITING_ORDER_STATUS . '_to_completed_notification', [ $this, 'add_completed_email_trigger' ], 10, 2 );
    6969
    70         add_action( 'sco_check_pa_order_status', [ $this, 'check_pa_order_status' ] );
     70        add_action( 'sco_check_pa_order_status', [ $this, 'cron_check_pa_order_status' ] );
    7171
    7272        add_filter( 'woocommerce_valid_order_statuses_for_payment_complete', [ $this, 'allow_awaiting_svea_status_to_be_completed' ] );
     
    8686        add_action( 'woocommerce_process_product_meta', [ $this, 'save_product_fields' ] );
    8787        add_action( 'woocommerce_save_product_variation', [ $this, 'save_variation_fields' ] );
     88    }
     89
     90    /**
     91     * Cron job to check the status of a Svea order
     92     *
     93     * @param int $order_id
     94     * @return void
     95     */
     96    public function cron_check_pa_order_status( $order_id ) {
     97        $this->check_pa_order_status( $order_id );
    8898    }
    8999
     
    312322    public function check_pa_order_status( $order ) {
    313323        if ( is_numeric( $order ) ) {
    314             /** @var \WC_Order $wc_order */
    315324            $wc_order = Webhook_Handler::get_order_by_svea_id( $order );
    316325            $svea_order_id = $order;
    317326        } else {
    318             /** @var \WC_Order $wc_order */
    319327            $wc_order = $order;
    320328            $svea_order_id = $wc_order->get_meta( '_svea_co_order_id' );
     
    334342        } catch ( \Exception $e ) {
    335343            WC_Gateway_Svea_Checkout::log( sprintf( 'Received error when fetching information from Svea: %s', $e->getMessage() ) );
    336             return '';
    337         }
    338 
    339         if ( ! isset( $pa_order ) ) {
    340             WC_Gateway_Svea_Checkout::log( 'Tried fetching order from PaymentAdmin but failed. Aborting' );
    341344            return '';
    342345        }
     
    442445     * Save some refs
    443446     *
    444      * @param \Automattic\WooCommerce\Admin\Overrides\Order $wc_order
     447     * @param \WC_Order $wc_order
    445448     * @param array $svea_order
    446449     * @return void
     
    461464
    462465                    if ( ! empty( $svea_ref ) ) {
    463                         $wc_order->update_meta_data( '_svea_co_billing_reference_' . $svea_ref['key'], wc_clean( $reference['Value'] ) );
     466                        $wc_order->update_meta_data( '_svea_co_billing_reference_' . strtolower( $reference['Type'] ), wc_clean( $reference['Value'] ) );
    464467                    }
    465468                }
     
    533536     * Renders the metabox
    534537     *
    535      * @param \WP_post|\WC_Order $name
     538     * @param \WP_Post|\WC_Order $post_or_order_object
    536539     * @return void
    537540     */
     
    576579     *
    577580     * @param \WC_Order_Item $order_item
    578      * @return void
     581     * @return array
    579582     */
    580583    public function get_order_row_data( $order_item ) {
     
    612615     */
    613616    public function admin_remove_order_item( $order_item_id ) {
     617        /** @var \WC_Order_Item_Data_Store $data_store */
    614618        $data_store = \WC_Data_Store::load( 'order-item' );
    615619
  • svea-checkout-for-woocommerce/trunk/inc/Compat/Compat.php

    r3264850 r3320066  
    2020     */
    2121    public $polylang;
    22 
    23     /**
    24      * WPML compatibility class
    25      *
    26      * @var WPML_Compat
    27      */
    28     public $wpml;
    2922
    3023    /**
  • svea-checkout-for-woocommerce/trunk/inc/Compat/Gift_Cards_For_WC_Compat.php

    r3203722 r3320066  
    22namespace Svea_Checkout_For_Woocommerce\Compat;
    33
    4 use Svea_Checkout_For_Woocommerce\Helper;
    54use Svea_Checkout_For_Woocommerce\Models\Svea_Item;
    65
  • svea-checkout-for-woocommerce/trunk/inc/Emails/Awaiting_Svea_Email.php

    r3009386 r3320066  
    11<?php
     2namespace Svea_Checkout_For_Woocommerce\Emails;
     3
    24/**
    35 * Class Awaiting_Svea_Email file.
     
    1719     * Customer awaiting further info from Svea
    1820     */
    19     class Awaiting_Svea_Email extends WC_Email {
     21    class Awaiting_Svea_Email extends \WC_Email {
    2022
    2123        /**
  • svea-checkout-for-woocommerce/trunk/inc/Models/Svea_Checkout.php

    r3264850 r3320066  
    9090     * Setup Svea connector
    9191     *
    92      * @param \WC_Cart $cart
     92     * @param string $currency
     93     * @param string $country
    9394     * @return void
    9495     */
     
    257258     * Create a new order in Svea from the cart
    258259     *
    259      * @param bool $force
    260260     * @return array
    261261     */
     
    268268
    269269        // Set preset values
    270         if ( isset( $user_email ) && ! empty( $user_email ) ) {
     270        if ( ! empty( $user_email ) ) {
    271271            array_push(
    272272                $preset_values,
     
    279279        }
    280280
    281         if ( isset( $user_zipcode ) && ! empty( $user_zipcode ) ) {
     281        if ( ! empty( $user_zipcode ) ) {
    282282            array_push(
    283283                $preset_values,
     
    290290        }
    291291
    292         if ( isset( $user_phone ) && ! empty( $user_phone ) ) {
     292        if ( ! empty( $user_phone ) ) {
    293293            array_push(
    294294                $preset_values,
     
    536536
    537537    /**
     538     * Initiate a change of payment method in Svea. This returns an iframe where all the magic happens.
     539     *
     540     * @param string $token
     541     * @return array
     542     */
     543    public function change_payment_method( string $token ) {
     544        $data = [
     545            'Token'    => $token,
     546            'TermsUrl' => wc_get_page_permalink( 'terms' ),
     547        ];
     548
     549        try {
     550            $response = $this->client->changePaymentMethod( $data );
     551
     552            return $response;
     553        } catch ( \Exception $e ) {
     554            WC_Gateway_Svea_Checkout::log( sprintf( 'Received error when changing payment method. Code: %s, Message: %s', $e->getCode(), $e->getMessage() ) );
     555            return $this->create_error_msg( $e->getMessage() );
     556        }
     557    }
     558
     559    /**
    538560     * Get the minimum age for the order (null if no restrictions)
    539561     *
     
    547569     * Get the plugin version
    548570     *
    549      * @return void
     571     * @return string
    550572     */
    551573    public function get_plugin_version() {
     
    556578     * Get merchant settings
    557579     *
    558      * @param string $token
    559580     * @return array
    560581     */
  • svea-checkout-for-woocommerce/trunk/inc/Models/Svea_Instore.php

    r3202226 r3320066  
    8585     *
    8686     * @param \WC_Order|null $wc_order
    87      * @param bool $admin
    88      *
    8987     * @return void
    9088     */
  • svea-checkout-for-woocommerce/trunk/inc/Models/Svea_Item.php

    r3309749 r3320066  
    3434     * Unit price (price each)
    3535     *
     36     * @var float
     37     */
     38    public $unit_price;
     39
     40    /**
     41     * Tax percentage, 25, 12, 6 etc
     42     *
    3643     * @var int
    3744     */
    38     public $unit_price;
    39 
    40     /**
    41      * Tax percentage, 25, 12, 6 etc
     45    public $tax_percentage;
     46
     47    /**
     48     * Row type, only used internally and never sent to Svea
     49     *
     50     * @var string
     51     */
     52    public $type = 'product';
     53
     54    /**
     55     * Discount percent (0-100)
    4256     *
    4357     * @var int
    4458     */
    45     public $tax_percentage;
    46 
    47     /**
    48      * Row type, only used internally and never sent to Svea
     59    public $discount_percent = 0;
     60
     61    /**
     62     * Discount amount
     63     *
     64     * @var float
     65     */
     66    public $discount_amount = 0;
     67
     68    /**
     69     * Diff from WooCommerce
     70     *
     71     * @var float
     72     */
     73    private $sum_diff = 0;
     74
     75    /**
     76     * Temporary reference
    4977     *
    5078     * @var string
    5179     */
    52     public $type = 'product';
    53 
    54     /**
    55      * Discount percent (0-100)
    56      *
    57      * @var int
    58      */
    59     public $discount_percent = 0;
    60 
    61     /**
    62      * Discount amount
    63      *
    64      * @var float
    65      */
    66     public $discount_amount = 0;
    67 
    68     /**
    69      * Diff from WooCommerce
    70      *
    71      * @var float
    72      */
    73     private $sum_diff = 0;
    74 
    75     /**
    76      * Temporary reference
    77      *
    78      * @var string
    79      */
    8080    public $temporary_reference = '';
    8181
     
    9090     * Weight in grams
    9191     *
    92      * @var int
     92     * @var float
    9393     */
    9494    private $weight = 0;
     
    9797     * Length in mm
    9898     *
    99      * @var int
     99     * @var float
    100100     */
    101101    private $length = 0;
     
    104104     * Height in mm
    105105     *
    106      * @var int
     106     * @var float
    107107     */
    108108    private $height = 0;
     
    111111     * Width in mm
    112112     *
    113      * @var int
     113     * @var float
    114114     */
    115115    private $width = 0;
     
    193193        // Prevent division by 0
    194194        if ( $shipping->get_cost() > 0 ) {
    195             $tax_percentage = ( $total_tax / $shipping->get_cost() ) * 100;
     195            $tax_percentage = ( $total_tax / (float) $shipping->get_cost() ) * 100;
    196196        }
    197197
     
    225225        if ( ! empty( $meta_data['nshift_data'] ) ) {
    226226            foreach ( $meta_data['nshift_data'] as $percent => $amounts ) {
    227                 /** @var Svea_Item $shipping_row */
    228                 $shipping_row = new $this();
     227                /** @var static $shipping_row */
     228                $shipping_row = new static();
    229229
    230230                $shipping_row->sku = $shipping->get_id();
     
    383383        }
    384384
    385         $unit_price = ( $item->get_total() + $item->get_total_tax() ) / $item->get_quantity();
     385        $unit_price = ( (float) $item->get_total() + (float) $item->get_total_tax() ) / $item->get_quantity();
    386386
    387387        $tax_percentage = 0;
    388388        if ( $item->get_total_tax() ) {
    389             $tax_percentage = $this->round_price( $item->get_total_tax() / $item->get_total() ) * 100;
     389            $tax_percentage = $this->round_price( (float) $item->get_total_tax() / (float) $item->get_total() ) * 100;
    390390        }
    391391
     
    394394        $this->quantity = $item->get_quantity();
    395395        $this->unit_price = $unit_price;
    396         $this->tax_percentage = $tax_percentage ?? 0;
     396        $this->tax_percentage = $tax_percentage ?: 0;
    397397
    398398        if ( $set_ref ) {
     
    418418        $this->quantity = $item->get_quantity();
    419419        $this->unit_price = $unit_price;
    420         $this->tax_percentage = $tax_percentage ?? 0;
     420        $this->tax_percentage = $tax_percentage ?: 0;
    421421
    422422        if ( $set_ref ) {
     
    435435     */
    436436    public function map_order_item_shipping( $item, $set_ref = false ) {
    437         $unit_price = ( $item->get_total() + $item->get_total_tax() ) / $item->get_quantity();
     437        $unit_price = ( (float) $item->get_total() + (float) $item->get_total_tax() ) / $item->get_quantity();
    438438
    439439        $total_tax = floatval( $item->get_total_tax() );
     
    452452        $this->quantity = $item->get_quantity();
    453453        $this->unit_price = $unit_price;
    454         $this->tax_percentage = $tax_percentage ?? 0;
     454        $this->tax_percentage = $tax_percentage ?: 0;
    455455
    456456        if ( $set_ref ) {
  • svea-checkout-for-woocommerce/trunk/inc/Models/Svea_Payment_Admin.php

    r3172745 r3320066  
    7777     *
    7878     * @param \WC_Order $wc_order WooCommerce order
    79      * @param bool $admin Use the admin client
    8079     */
    8180    public function __construct( $wc_order = null ) {
     
    219218     * Add order row to existing order
    220219     *
    221      * @param array $data
    222      *
     220     * @param int $id
     221     * @param array $row_data
    223222     * @return array
    224223     */
     
    297296     * @param int $id
    298297     * @param array $data
    299      * @return array
     298     * @return void
    300299     */
    301300    public function deliver_order( $id, $data ) {
  • svea-checkout-for-woocommerce/trunk/inc/Template_Handler.php

    r3309749 r3320066  
    2727        add_action( 'wc_ajax_sco_change_payment_method', [ $this, 'change_payment_method' ], 100 );
    2828
     29        add_action( 'wc_ajax_sco_renew_nonce', [ $this, 'renew_checkout_nonce' ] );
    2930        add_action( 'wc_ajax_sco_checkout_order', [ $this, 'sco_checkout_order' ] );
    3031
     
    4445
    4546        // Remove checkout fields if they are not needed
    46         add_action( 'woocommerce_checkout_before_order_review', [ $this, 'maybe_remove_checkout_fields' ] );
     47        add_action( 'wp', [ $this, 'maybe_remove_checkout_fields' ], 5 );
    4748
    4849        add_filter( 'woocommerce_my_account_my_orders_actions', [ $this, 'remove_pay_button_action' ], 10, 2 );
     50
     51        add_filter( 'wcs_view_subscription_actions', [ $this, 'modify_change_payment_button' ], 20, 2 );
     52
     53        add_filter( 'woocommerce_get_settings_advanced', [ $this, 'add_endpoint_account_settings' ] );
     54        add_filter( 'woocommerce_get_query_vars', [ $this, 'add_sco_query_vars' ] );
     55        add_action( 'woocommerce_account_svea_change_payment_method_endpoint', [ $this, 'display_change_payment_method' ] );
     56    }
     57
     58    /**
     59     * Get a new nonce for the checkout
     60     *
     61     * @return void
     62     */
     63    public function renew_checkout_nonce() {
     64        // Clear WC errors
     65        wc_clear_notices();
     66        wp_send_json_success(
     67            [
     68                'wc'  => wp_create_nonce( 'woocommerce-process_checkout' ),
     69                'sco' => wp_create_nonce( 'sco-checkout-order' ),
     70            ]
     71        );
     72    }
     73
     74    /**
     75     * Display the change payment method page
     76     *
     77     * @return void
     78     */
     79    public function display_change_payment_method() {
     80        global $wp;
     81
     82        $subscription_id = isset( $wp->query_vars['svea_change_payment_method'] ) ? absint( $wp->query_vars['svea_change_payment_method'] ) : 0;
     83        $subscription = wcs_get_subscription( $subscription_id );
     84
     85        if ( ! $subscription || ! $subscription->has_status( 'active' ) ) {
     86            wc_add_notice( __( 'Invalid subscription.', 'svea-checkout-for-woocommerce' ), 'error' );
     87            return;
     88        }
     89
     90        // Check if the subscription is using Svea Checkout
     91        if ( $subscription->get_payment_method() !== WC_Gateway_Svea_Checkout::GATEWAY_ID ) {
     92            wc_add_notice( __( 'This subscription has to use Svea Checkout.', 'svea-checkout-for-woocommerce' ), 'error' );
     93            return;
     94        }
     95
     96        // Validate key from query param
     97        if ( ! isset( $_GET['key'] ) || $subscription->get_order_key() !== sanitize_text_field( wp_unslash( $_GET['key'] ) ) ) {
     98            wc_add_notice( __( 'Invalid subscription key.', 'svea-checkout-for-woocommerce' ), 'error' );
     99            return;
     100        }
     101
     102        // Validate nonce
     103        if ( ! isset( $_GET['sco_payment_nonce'] ) || ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_GET['sco_payment_nonce'] ) ), 'sco_payment_nonce-' . $subscription->get_id() ) ) {
     104            wc_add_notice( __( 'Invalid nonce.', 'svea-checkout-for-woocommerce' ), 'error' );
     105            return;
     106        }
     107
     108        $svea_checkout = new Svea_Checkout( false );
     109        $svea_checkout->setup_client( $subscription->get_currency(), $subscription->get_billing_country() );
     110
     111        $svea_checkout_data = $svea_checkout->change_payment_method( $subscription->get_meta( '_svea_co_token' ) );
     112
     113        wc_get_template( 'myaccount/svea-change-payment-method.php', compact( 'svea_checkout_data' ), '', SVEA_CHECKOUT_FOR_WOOCOMMERCE_DIR . '/templates/' );
     114    }
     115
     116    /**
     117     * Get the "change payment method" endpoint for Svea
     118     *
     119     * @return string
     120     */
     121    public function get_change_payment_method_endpoint() {
     122        return get_option( 'woocommerce_myaccount_svea_subscription_payment_method_endpoint', 'svea-change-payment-method' );
     123    }
     124
     125    /**
     126     * Add Svea Checkout query vars
     127     *
     128     * @param array $query_vars
     129     * @return array
     130     */
     131    public function add_sco_query_vars( $query_vars ) {
     132        $svea_query_vars = [
     133            'svea_change_payment_method' => $this->get_change_payment_method_endpoint(),
     134        ];
     135
     136        return array_merge( $query_vars, $svea_query_vars );
     137    }
     138
     139    /**
     140     * Add a new endpoint for the Svea change payment method
     141     *
     142     * @param array $settings
     143     * @return array
     144     */
     145    public function add_endpoint_account_settings( $settings ) {
     146        $new_setting = [
     147            'title'    => __( 'Change payment method (Svea)', 'svea-checkout-for-woocommerce' ),
     148            'desc'     => __( 'Endpoint for the My Account &rarr; Change Svea Subscription Payment Method page', 'svea-checkout-for-woocommerce' ),
     149            'id'       => 'woocommerce_myaccount_svea_subscription_payment_method_endpoint',
     150            'type'     => 'text',
     151            'default'  => 'svea-change-payment-method',
     152            'desc_tip' => true,
     153        ];
     154
     155        if ( class_exists( 'WC_Subscriptions_Admin' ) ) {
     156            \WC_Subscriptions_Admin::insert_setting_after( $settings, 'woocommerce_myaccount_view_order_endpoint', $new_setting );
     157        }
     158
     159        return $settings;
     160    }
     161
     162    /**
     163     * Modify the "Change payment" button on the subscription page
     164     *
     165     * @param array $actions
     166     * @param \WC_Subscription $subscription
     167     * @return array
     168     */
     169    public function modify_change_payment_button( $actions, $subscription ) {
     170        if ( ! $subscription instanceof \WC_Subscription ) {
     171            return $actions;
     172        }
     173
     174        if ( $subscription->get_payment_method() !== WC_Gateway_Svea_Checkout::GATEWAY_ID ) {
     175            return $actions;
     176        }
     177
     178        // This will only be set if other payment methods are available
     179        if ( ! isset( $actions['change_payment_method'] ) ) {
     180            $actions['change_payment_method'] = [
     181                'name' => _x( 'Change payment', 'label on button, imperative', 'svea-checkout-for-woocommerce' ),
     182            ];
     183        }
     184
     185        $actions['change_payment_method']['url'] = add_query_arg(
     186            [
     187                'change_payment_method' => 'svea',
     188                'sco_payment_nonce'     => wp_create_nonce( 'sco_payment_nonce-' . $subscription->get_id() ),
     189                'key'                   => $subscription->get_order_key(),
     190            ],
     191            wc_get_endpoint_url( $this->get_change_payment_method_endpoint(), $subscription->get_id(), wc_get_page_permalink( 'myaccount' ) )
     192        );
     193
     194        return $actions;
     195
    49196    }
    50197
     
    74221     */
    75222    public function sco_checkout_order() {
    76         check_ajax_referer( 'sco-checkout-order', 'security' );
     223        $success = check_ajax_referer( 'sco-checkout-order', 'security', false );
     224        if ( ! $success ) {
     225            wp_send_json(
     226                [
     227                    'result' => 'failure',
     228                    'reload' => true,
     229                ]
     230            );
     231        }
    77232        wc_maybe_define_constant( 'WOOCOMMERCE_CHECKOUT', true );
    78233
     
    152307     */
    153308    public function maybe_remove_checkout_fields() {
    154         if ( $this->is_svea() ) {
     309        if ( $this->is_svea() && ! wp_doing_ajax() ) {
    155310            // Remove all default fields from WooCommerce to see what gets added by third party plugins
    156             add_filter( 'woocommerce_checkout_fields', [ $this, 'remove_billing_and_shipping_fields' ], PHP_INT_MAX );
     311            add_filter( 'woocommerce_checkout_fields', [ $this, 'remove_billing_and_shipping_fields' ], 100000 );
    157312            add_filter( 'woocommerce_checkout_fields', [ $this, 'maybe_remove_order_comments_field' ] );
    158313        }
     
    277432
    278433        /** @var \WC_Payment_Gateway[] $available_gateways */
    279         $available_gateways = WC()->payment_gateways->get_available_payment_gateways();
     434        $available_gateways = WC()->payment_gateways()->get_available_payment_gateways();
    280435
    281436        if ( ! empty( $available_gateways ) ) {
     
    318473
    319474                // Check if status is final
    320                 if ( strtoupper( $svea_checkout_module['Status'] ) !== 'FINAL' ) {
     475                if ( isset( $svea_checkout_module['Status'] ) && strtoupper( $svea_checkout_module['Status'] ) !== 'FINAL' ) {
    321476                    WC_Gateway_Svea_Checkout::log( sprintf( 'Order %s is not in final state, status: %s', $svea_order_id, $svea_checkout_module['Status'] ) );
    322477                    wp_safe_redirect( wc_get_checkout_url() );
     
    324479                }
    325480
    326                 /** @var \Automattic\WooCommerce\Admin\Overrides\Order $order */
     481                /** @var \Automattic\WooCommerce\Admin\Overrides\Order $wc_order */
    327482                $wc_order = $wc_orders[0];
    328483
     
    340495     * Get the iframe snippet from Svea
    341496     *
    342      * @return string
     497     * @return void
    343498     */
    344499    public static function get_svea_snippet() {
     
    647802
    648803        if ( ! $reload && ! WC_Gateway_Svea_Checkout::is_zero_sum_enabled() ) {
    649             $reload = WC()->cart->total <= 0 ? true : false;
     804            $reload = (float) WC()->cart->get_total() <= 0 ? true : false;
    650805        }
    651806
     
    732887     * This function returns the Svea Checkout module.
    733888     *
    734      * @param \WC_Cart $cart WooCommerce cart
    735      * @return array|string The Svea Checkout snippet
     889     * @return array The Svea Checkout snippet
    736890     */
    737891    public static function get_svea_checkout_module() {
  • svea-checkout-for-woocommerce/trunk/inc/WC_Gateway_Svea_Checkout.php

    r3264850 r3320066  
    4646
    4747    /**
    48      * List of activated customer types
    49      *
    50      * @var array
     48     * String of activated customer type(s)
     49     *
     50     * @var string
    5151     */
    5252    private $customer_types;
     
    503503
    504504    /**
    505      * Is the nShift integration enabled?
    506      *
    507      * @return bool
    508      */
    509     public static function is_nshift_enabled() {
    510         return self::$nshift_enabled;
    511     }
    512 
    513     /**
    514      * Is zero sum enabled?
    515      *
    516      * @return bool
    517      */
    518     public static function is_zero_sum_enabled() {
    519         return self::$zero_sum_enabled;
    520     }
    521 
    522     /**
    523      * Get the store minimum age
    524      *
    525      * @return int
    526      */
    527     public static function get_store_minimum_age() {
    528         return (int) self::$store_minimum_age;
    529     }
    530 
    531     /**
    532      * Get the shipping options html
    533      *
    534      * @param string $key
    535      * @param array $value
    536      * @param array $field
    537      * @return string
    538      */
    539     public function generate_nshift_shipping_options_html( string $key, $field_settings ) {
    540         $fields = $field_settings['fields'] ?? [];
    541         if ( empty( $fields ) ) return '';
    542 
    543         ob_start();
    544         ?>
    545         <tr valign="top">
    546             <th scope="row" class="titledesc">
    547                 <label><?php echo wp_kses_post( $field_settings['title'] ); ?></label>
    548             </th>
    549             <td class="forminp">
    550                 <div class="nshift-shipping-wrapper">
    551                     <div class="rows"></div>
    552 
    553                     <div class="buttons">
    554                         <div class="remove button">-</div>
    555                         <div class="add button button-primary">+</div>
    556                     </div>
    557                 </div>
    558                 <script type="text/html" id="nshift-shipping-row">
    559                     <?php echo wp_kses_post( $this->generate_settings_html( $fields ) ); ?>
    560                 </script>
    561             </td>
    562         </tr>
    563         <?php
    564 
    565         $html = ob_get_clean();
    566         return $html;
    567     }
    568 
    569     /**
    570      * Get the name of the payment method
    571      *
    572      * @param string $key
    573      * @return string
    574      */
    575     public function get_payment_method_name( $key ) {
    576         $method = '';
    577 
    578         if ( isset( $this->svea_payment_methods[ $key ] ) ) {
    579             $method = $this->svea_payment_methods[ $key ];
    580         }
    581 
    582         return apply_filters( 'woocommerce_sco_payment_method_name', $method, $key, $this );
    583     }
    584 
    585     /**
    586      * Get the name of the billing reference
    587      *
    588      * @param string $key
    589      * @return string
    590      */
    591     public function get_billing_reference_value( $key ) {
    592         $method = '';
    593 
    594         if ( isset( $this->svea_billing_references[ $key ] ) ) {
    595             $method = $this->svea_billing_references[ $key ];
    596         }
    597 
    598         return apply_filters( 'woocommerce_sco_billing_reference_name', $method, $key, $this );
    599     }
    600 
    601     /**
    602505     * Add hooks
    603506     *
     
    608511        add_action( 'woocommerce_order_details_after_order_table', [ $this, 'svea_co_display_extra_order_meta' ], 11 );
    609512        add_action( 'woocommerce_email_after_order_table', [ $this, 'svea_co_display_extra_admin_order_meta' ], 11 );
    610         add_action( 'woocommerce_update_options_payment_gateways_' . $this->id, [ $this, 'process_admin_options' ] );
     513        add_filter( 'woocommerce_update_options_payment_gateways_' . $this->id, [ $this, 'process_admin_options' ] );
    611514        add_action( 'woocommerce_update_options_payment_gateways_' . $this->id, [ $this, 'clear_merchant_validation_cache' ] );
    612515
     
    637540
    638541        // Subscription related hooks
    639         add_filter( 'woocommerce_scheduled_subscription_payment_' . self::GATEWAY_ID, [ $this, 'scheduled_subscription_payment' ], 10, 2 );
    640         add_filter( 'woocommerce_subscription_cancelled_' . self::GATEWAY_ID, [ $this, 'cancel_subscription' ] );
     542        add_action( 'woocommerce_scheduled_subscription_payment_' . self::GATEWAY_ID, [ $this, 'scheduled_subscription_payment' ], 10, 2 );
     543        add_action( 'woocommerce_subscription_cancelled_' . self::GATEWAY_ID, [ $this, 'cancel_subscription' ] );
    641544
    642545        self::$hooks_enabled = true;
     546    }
     547
     548    /**
     549     * Is the nShift integration enabled?
     550     *
     551     * @return bool
     552     */
     553    public static function is_nshift_enabled() {
     554        return self::$nshift_enabled;
     555    }
     556
     557    /**
     558     * Is zero sum enabled?
     559     *
     560     * @return bool
     561     */
     562    public static function is_zero_sum_enabled() {
     563        return self::$zero_sum_enabled;
     564    }
     565
     566    /**
     567     * Get the store minimum age
     568     *
     569     * @return int
     570     */
     571    public static function get_store_minimum_age() {
     572        return (int) self::$store_minimum_age;
     573    }
     574
     575    /**
     576     * Get the name of the payment method
     577     *
     578     * @param string $key
     579     * @return string
     580     */
     581    public function get_payment_method_name( $key ) {
     582        $method = '';
     583
     584        if ( isset( $this->svea_payment_methods[ $key ] ) ) {
     585            $method = $this->svea_payment_methods[ $key ];
     586        }
     587
     588        return apply_filters( 'woocommerce_sco_payment_method_name', $method, $key, $this );
     589    }
     590
     591    /**
     592     * Get the name of the billing reference
     593     *
     594     * @param string $key
     595     * @return string
     596     */
     597    public function get_billing_reference_value( $key ) {
     598        $method = '';
     599
     600        if ( isset( $this->svea_billing_references[ $key ] ) ) {
     601            $method = $this->svea_billing_references[ $key ];
     602        }
     603
     604        return apply_filters( 'woocommerce_sco_billing_reference_name', $method, $key, $this );
    643605    }
    644606
     
    651613    public function cancel_subscription( $wc_order ) {
    652614        if ( empty( $wc_order->get_meta( '_svea_co_token' ) ) ) {
    653             return false;
     615            return;
    654616        }
    655617
     
    683645                'woocommerce_subscriptions_paid_for_failed_renewal_order',
    684646                [ \WC_Subscriptions_Change_Payment_Gateway::class, 'change_failing_payment_method' ],
    685                 10,
    686                 2
     647                10
    687648            );
    688649        }
     
    732693     * @param array $values
    733694     * @param \WC_Order $wc_order
    734      * @return \WC_Order_Item
     695     * @return void
    735696     */
    736697    public function append_cart_item_key_to_order_row( $item, $cart_item_key, $values, $wc_order ) {
     
    738699            $item->update_meta_data( '_svea_co_cart_key', $cart_item_key );
    739700        }
    740 
    741         return $item;
    742701    }
    743702
     
    749708     * @param array $package
    750709     * @param \WC_Order $wc_order
    751      * @return \WC_Order_Item_Shipping
     710     * @return void
    752711     */
    753712    public function append_cart_item_key_to_order_row_shipping( $item, $package_key, $package, $wc_order ) {
     
    760719        }
    761720
    762         return $this->append_cart_item_key_to_order_row( $item, $package_key . '_' . $key, [], $wc_order );
     721        $this->append_cart_item_key_to_order_row( $item, $package_key . '_' . $key, [], $wc_order );
    763722    }
    764723
     
    798757     *
    799758     * @param array $merchant_data Merchant data to fetch part payment plans for
    800      * @return array|WP_Error List of payment plan campaigns
     759     * @return array|\WP_Error List of payment plan campaigns
    801760     */
    802761    public function get_part_payment_plans( $merchant_data ) {
    803 
    804762        // Get campaigns from cache to save bandwidth and loading time
    805763        $campaigns = get_transient( sprintf( self::PART_PAYMENT_TRANSIENT_FORMAT, $merchant_data['CountryCode'] ) );
     
    11911149
    11921150    /**
    1193      * Get the customer types (both|company|individual)
    1194      *
    1195      * @return string[]
     1151     * Get the customer type(s) (both|company|individual)
     1152     *
     1153     * @return string
    11961154     */
    11971155    public function get_customer_types() {
     
    14691427
    14701428        // Map row ID's in Svea to WooCommerce
    1471         if ( ! empty( $wc_order ) && is_array( $item_mapping ) ) {
     1429        if ( is_array( $item_mapping ) ) {
    14721430            $wc_items = $wc_order->get_items( [ 'line_item', 'fee', 'shipping' ] );
    14731431
     
    19341892        }
    19351893
    1936         $refund_amount = $wc_order->get_total() - $wc_order->get_total_refunded();
     1894        $refund_amount = (float) $wc_order->get_total() - (float) $wc_order->get_total_refunded();
    19371895
    19381896        return $this->process_refund( $order_id, $refund_amount );
  • svea-checkout-for-woocommerce/trunk/inc/WC_Shipping_Svea_Nshift.php

    r3172745 r3320066  
    3838        $this->init();
    3939
    40         add_action( 'woocommerce_update_options_shipping_' . $this->id, [ $this, 'process_admin_options' ] );
     40        add_filter( 'woocommerce_update_options_shipping_' . $this->id, [ $this, 'process_admin_options' ] );
    4141        add_action( 'woocommerce_cart_emptied', [ $this, 'clear_session' ] );
    4242    }
     
    6767     */
    6868    private function get_cost() {
    69         $cost = WC()->session->get( 'sco_nshift_price', false );
    70 
    71         if ( $cost === false ) {
    72             return 0;
    73         }
    74 
    75         return $cost;
     69        return (float) WC()->session->get( 'sco_nshift_price', 0 );
    7670    }
    7771
  • svea-checkout-for-woocommerce/trunk/inc/Webhook_Handler.php

    r3264850 r3320066  
    157157            self::$svea_order = $svea_order->get( $webhook_data->orderId );
    158158        } catch ( \Exception $e ) {
    159             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() );
     159            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() ) );
    160160            status_header( 404 );
    161161            exit;
     
    231231        }
    232232
    233         $this->svea_order_id = sanitize_text_field( $_GET['svea_order_id'] ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended
     233        $this->svea_order_id = (int) sanitize_text_field( $_GET['svea_order_id'] ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended
    234234
    235235        $this->gateway::log( sprintf( 'Validation callback for Svea order ID (%s) received', $this->svea_order_id ) );
     
    336336     *
    337337     * @param string $msg Message
    338      * @param string $valid Valid or not
     338     * @param bool $valid Valid or not
    339339     * @param string $order_number Client order number
    340340     * @return void
     
    355355
    356356        wp_send_json( $response );
    357         die;
    358357    }
    359358
     
    614613
    615614            $wc_order->update_meta_data( '_svea_co_is_company', (bool) self::$svea_order['IsCompany'] );
    616             $wc_order->update_meta_data( '_svea_co_order_final', current_time( 'timestamp', true ) );
     615            $wc_order->update_meta_data( '_svea_co_order_final', (string) current_time( 'timestamp', true ) );
    617616
    618617            $this->gateway::log( sprintf( 'Push callback finalized order. Svea ID:%s OrderID: %s', $this->svea_order_id, $wc_order->get_id() ) );
     
    624623                wp_schedule_single_event( time() + apply_filters( 'woocommerce_sco_pending_status_retry_time', HOUR_IN_SECONDS ), 'sco_check_pa_order_status', [ $this->svea_order_id ] );
    625624            } else {
    626                 $wc_order->payment_complete( $this->svea_order_id );
     625                $wc_order->payment_complete( (string) $this->svea_order_id );
    627626            }
    628627
     
    808807
    809808        // Update the cost and taxes
    810         $shipping_item->set_total( $shipping_fee );
     809        $shipping_item->set_total( (string) $shipping_fee );
    811810        $shipping_item->set_taxes( $actual_taxes );
    812811        $shipping_item->delete_meta_data( 'nshift_taxes' );
  • svea-checkout-for-woocommerce/trunk/readme.txt

    r3309749 r3320066  
    1010License: Apache 2.0
    1111License URI: https://www.apache.org/licenses/LICENSE-2.0
    12 Stable tag: 3.2.5
     12Stable tag: 3.3.0
    1313
    1414Supercharge your WooCommerce Store with powerful features to pay via Svea Checkout!
     
    71712. Check the box **Display product part payment module**
    72723. Select where on the page you want to display the module
    73 4. View the part payment module on the product page for eligable products. If the module is not displayed it might be due to the price since part payment plans often require a minimum amount.
     734. View the part payment module on the product page for eligible products. If the module is not displayed it might be due to the price since part payment plans often require a minimum amount.
    7474
    7575There's also a shortcode available to display the part payment module on a product page. Add the shortcode `[svea_checkout_part_payment_module]` to the product page you want to use it on. Or call `do_shortcode()` through a template file.
     76
     77= Support =
     78For support, please check the [support forum](https://wordpress.org/support/plugin/svea-checkout-for-woocommerce/) to see if your question has already been answered.
     79If you need quick and easy assistance, try our chat bot, which has been specially trained on common questions and detailed information about Svea's payment solutions: https://thegeneration.se/support-svea-chatbot/
     80If you have other questions or need more in-depth support involving sensitive information, please fill out the form at https://thegeneration.se/support-for-svea/
    7681
    7782== Installation ==
     
    8691== Upgrade Notice ==
    8792
     93= 3.3.0 =
     943.3.0 is a minor release
     95
    8896= 3.2.5 =
    89973.2.5 is a patch release
     
    376384
    377385== Changelog ==
     386
     387= 3.3.0 2025-06-30 =
     388- Added support for changing the payment method on recurring orders processed via Svea Checkout.
     389- Remove default fields which could appear when the option "Hide shipping costs until an address is entered" is selected
     390- General improvements
    378391
    379392= 3.2.5 2025-06-11 =
  • svea-checkout-for-woocommerce/trunk/svea-checkout-for-woocommerce.php

    r3309749 r3320066  
    1414 * Plugin URI: https://wordpress.org/plugins/svea-checkout-for-woocommerce/
    1515 * Description: Process payments in WooCommerce via Svea Checkout.
    16  * Version: 3.2.5
     16 * Version: 3.3.0
    1717 * Requires Plugins: woocommerce
    1818 * Author: The Generation AB
     
    4747         * Version of plugin
    4848         */
    49         const VERSION = '3.2.5';
    50 
    51         /**
    52          * @var string
    53          */
    54         private $plugin_description;
    55 
    56         /**
    57          * @var string
    58          */
    59         private $plugin_label;
     49        const VERSION = '3.3.0';
    6050
    6151        /**
     
    146136         */
    147137        public function load_labels() {
    148             $this->plugin_description = esc_html__( 'Svea Checkout for WooCommerce', 'svea-checkout-for-woocommerce' );
    149             $this->plugin_label = esc_html__( 'Process payments in WooCommerce via Svea Checkout', 'svea-checkout-for-woocommerce' );
     138            __( 'Svea Checkout for WooCommerce', 'svea-checkout-for-woocommerce' );
     139            __( 'Process payments in WooCommerce via Svea Checkout', 'svea-checkout-for-woocommerce' );
    150140        }
    151141
  • svea-checkout-for-woocommerce/trunk/templates/backend/metabox.php

    r3172745 r3320066  
    1 <?php if ( $is_awaiting_status ) : ?>
     1<?php
     2if ( ! defined( 'ABSPATH' ) ) { exit; } // Exit if accessed directly
     3
     4if ( isset( $is_awaiting_status ) && $is_awaiting_status ) : ?>
    25    <p>
    36        <strong><?php esc_html_e( 'Awaiting status', 'svea-checkout-for-woocommerce' ); ?></strong><br>
  • svea-checkout-for-woocommerce/trunk/templates/checkout/additional-fields.php

    r3202226 r3320066  
    2222                <p class="form-row form-row-wide create-account">
    2323                    <label class="woocommerce-form__label woocommerce-form__label-for-checkbox checkbox">
    24                         <input class="woocommerce-form__input woocommerce-form__input-checkbox input-checkbox" id="createaccount" <?php checked( ( true === $checkout->get_value( 'createaccount' ) || ( true === apply_filters( 'woocommerce_create_account_default_checked', false ) ) ), true ); ?> type="checkbox" name="createaccount" value="1" /> <span><?php esc_html_e( 'Create an account?', 'woocommerce' ); ?></span>
     24                        <input class="woocommerce-form__input woocommerce-form__input-checkbox input-checkbox" id="createaccount" <?php checked( ( true === (bool) $checkout->get_value( 'createaccount' ) || ( true === apply_filters( 'woocommerce_create_account_default_checked', false ) ) ), true ); ?> type="checkbox" name="createaccount" value="1" /> <span><?php esc_html_e( 'Create an account?', 'woocommerce' ); ?></span>
    2525                    </label>
    2626                </p>
  • svea-checkout-for-woocommerce/trunk/templates/svea-checkout.php

    r3281259 r3320066  
    9999
    100100                    <?php if (
    101                         count( WC()->payment_gateways->get_available_payment_gateways() ) > 1 &&
     101                        count( WC()->payment_gateways()->get_available_payment_gateways() ) > 1 &&
    102102                        apply_filters( 'woocommerce_sco_show_change_payment_button', true )
    103103                    ) : ?>
  • svea-checkout-for-woocommerce/trunk/vendor/autoload.php

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

    r3264850 r3320066  
    131131    'Svea\\Checkout\\Implementation\\Admin\\ReplaceOrderRows' => $vendorDir . '/sveaekonomi/checkout/src/Implementation/Admin/ReplaceOrderRows.php',
    132132    'Svea\\Checkout\\Implementation\\Admin\\UpdateOrderRow' => $vendorDir . '/sveaekonomi/checkout/src/Implementation/Admin/UpdateOrderRow.php',
     133    'Svea\\Checkout\\Implementation\\ChangePaymentMethod' => $vendorDir . '/sveaekonomi/checkout/src/Implementation/ChangePaymentMethod.php',
    133134    'Svea\\Checkout\\Implementation\\CreateOrder' => $vendorDir . '/sveaekonomi/checkout/src/Implementation/CreateOrder.php',
    134135    'Svea\\Checkout\\Implementation\\CreateTokenOrder' => $vendorDir . '/sveaekonomi/checkout/src/Implementation/CreateTokenOrder.php',
     
    162163    'Svea\\Checkout\\Validation\\Admin\\ValidateReplaceOrderRowsData' => $vendorDir . '/sveaekonomi/checkout/src/Validation/Admin/ValidateReplaceOrderRowsData.php',
    163164    'Svea\\Checkout\\Validation\\Admin\\ValidateUpdateOrderRowData' => $vendorDir . '/sveaekonomi/checkout/src/Validation/Admin/ValidateUpdateOrderRowData.php',
     165    'Svea\\Checkout\\Validation\\ValidateChangePaymentMethodData' => $vendorDir . '/sveaekonomi/checkout/src/Validation/ValidateChangePaymentMethodData.php',
    164166    'Svea\\Checkout\\Validation\\ValidateCreateOrderData' => $vendorDir . '/sveaekonomi/checkout/src/Validation/ValidateCreateOrderData.php',
    165167    'Svea\\Checkout\\Validation\\ValidateCreateTokenOrderData' => $vendorDir . '/sveaekonomi/checkout/src/Validation/ValidateCreateTokenOrderData.php',
     
    198200    'Svea_Checkout_For_Woocommerce\\Compat\\WPC_Product_Bundles_Compat' => $baseDir . '/inc/Compat/WPC_Product_Bundles_Compat.php',
    199201    'Svea_Checkout_For_Woocommerce\\Compat\\Yith_Gift_Cards_Compat' => $baseDir . '/inc/Compat/Yith_Gift_Cards_Compat.php',
     202    'Svea_Checkout_For_Woocommerce\\Emails\\Awaiting_Svea_Email' => $baseDir . '/inc/Emails/Awaiting_Svea_Email.php',
    200203    'Svea_Checkout_For_Woocommerce\\Helper' => $baseDir . '/inc/Helper.php',
    201204    'Svea_Checkout_For_Woocommerce\\I18n' => $baseDir . '/inc/I18n.php',
  • svea-checkout-for-woocommerce/trunk/vendor/composer/autoload_real.php

    r3172745 r3320066  
    33// autoload_real.php @generated by Composer
    44
    5 class ComposerAutoloaderInit9ff79c494c0893bca5aca8141f25854b
     5class ComposerAutoloaderInit4cfdf47045179a2c4f6ff86b1bce3df2
    66{
    77    private static $loader;
     
    2525        require __DIR__ . '/platform_check.php';
    2626
    27         spl_autoload_register(array('ComposerAutoloaderInit9ff79c494c0893bca5aca8141f25854b', 'loadClassLoader'), true, true);
     27        spl_autoload_register(array('ComposerAutoloaderInit4cfdf47045179a2c4f6ff86b1bce3df2', 'loadClassLoader'), true, true);
    2828        self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
    29         spl_autoload_unregister(array('ComposerAutoloaderInit9ff79c494c0893bca5aca8141f25854b', 'loadClassLoader'));
     29        spl_autoload_unregister(array('ComposerAutoloaderInit4cfdf47045179a2c4f6ff86b1bce3df2', 'loadClassLoader'));
    3030
    3131        require __DIR__ . '/autoload_static.php';
    32         call_user_func(\Composer\Autoload\ComposerStaticInit9ff79c494c0893bca5aca8141f25854b::getInitializer($loader));
     32        call_user_func(\Composer\Autoload\ComposerStaticInit4cfdf47045179a2c4f6ff86b1bce3df2::getInitializer($loader));
    3333
    3434        $loader->register(true);
    3535
    36         $filesToLoad = \Composer\Autoload\ComposerStaticInit9ff79c494c0893bca5aca8141f25854b::$files;
     36        $filesToLoad = \Composer\Autoload\ComposerStaticInit4cfdf47045179a2c4f6ff86b1bce3df2::$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

    r3264850 r3320066  
    55namespace Composer\Autoload;
    66
    7 class ComposerStaticInit9ff79c494c0893bca5aca8141f25854b
     7class ComposerStaticInit4cfdf47045179a2c4f6ff86b1bce3df2
    88{
    99    public static $files = array (
     
    194194        'Svea\\Checkout\\Implementation\\Admin\\ReplaceOrderRows' => __DIR__ . '/..' . '/sveaekonomi/checkout/src/Implementation/Admin/ReplaceOrderRows.php',
    195195        'Svea\\Checkout\\Implementation\\Admin\\UpdateOrderRow' => __DIR__ . '/..' . '/sveaekonomi/checkout/src/Implementation/Admin/UpdateOrderRow.php',
     196        'Svea\\Checkout\\Implementation\\ChangePaymentMethod' => __DIR__ . '/..' . '/sveaekonomi/checkout/src/Implementation/ChangePaymentMethod.php',
    196197        'Svea\\Checkout\\Implementation\\CreateOrder' => __DIR__ . '/..' . '/sveaekonomi/checkout/src/Implementation/CreateOrder.php',
    197198        'Svea\\Checkout\\Implementation\\CreateTokenOrder' => __DIR__ . '/..' . '/sveaekonomi/checkout/src/Implementation/CreateTokenOrder.php',
     
    225226        'Svea\\Checkout\\Validation\\Admin\\ValidateReplaceOrderRowsData' => __DIR__ . '/..' . '/sveaekonomi/checkout/src/Validation/Admin/ValidateReplaceOrderRowsData.php',
    226227        'Svea\\Checkout\\Validation\\Admin\\ValidateUpdateOrderRowData' => __DIR__ . '/..' . '/sveaekonomi/checkout/src/Validation/Admin/ValidateUpdateOrderRowData.php',
     228        'Svea\\Checkout\\Validation\\ValidateChangePaymentMethodData' => __DIR__ . '/..' . '/sveaekonomi/checkout/src/Validation/ValidateChangePaymentMethodData.php',
    227229        'Svea\\Checkout\\Validation\\ValidateCreateOrderData' => __DIR__ . '/..' . '/sveaekonomi/checkout/src/Validation/ValidateCreateOrderData.php',
    228230        'Svea\\Checkout\\Validation\\ValidateCreateTokenOrderData' => __DIR__ . '/..' . '/sveaekonomi/checkout/src/Validation/ValidateCreateTokenOrderData.php',
     
    261263        'Svea_Checkout_For_Woocommerce\\Compat\\WPC_Product_Bundles_Compat' => __DIR__ . '/../..' . '/inc/Compat/WPC_Product_Bundles_Compat.php',
    262264        'Svea_Checkout_For_Woocommerce\\Compat\\Yith_Gift_Cards_Compat' => __DIR__ . '/../..' . '/inc/Compat/Yith_Gift_Cards_Compat.php',
     265        'Svea_Checkout_For_Woocommerce\\Emails\\Awaiting_Svea_Email' => __DIR__ . '/../..' . '/inc/Emails/Awaiting_Svea_Email.php',
    263266        'Svea_Checkout_For_Woocommerce\\Helper' => __DIR__ . '/../..' . '/inc/Helper.php',
    264267        'Svea_Checkout_For_Woocommerce\\I18n' => __DIR__ . '/../..' . '/inc/I18n.php',
     
    283286    {
    284287        return \Closure::bind(function () use ($loader) {
    285             $loader->prefixLengthsPsr4 = ComposerStaticInit9ff79c494c0893bca5aca8141f25854b::$prefixLengthsPsr4;
    286             $loader->prefixDirsPsr4 = ComposerStaticInit9ff79c494c0893bca5aca8141f25854b::$prefixDirsPsr4;
    287             $loader->classMap = ComposerStaticInit9ff79c494c0893bca5aca8141f25854b::$classMap;
     288            $loader->prefixLengthsPsr4 = ComposerStaticInit4cfdf47045179a2c4f6ff86b1bce3df2::$prefixLengthsPsr4;
     289            $loader->prefixDirsPsr4 = ComposerStaticInit4cfdf47045179a2c4f6ff86b1bce3df2::$prefixDirsPsr4;
     290            $loader->classMap = ComposerStaticInit4cfdf47045179a2c4f6ff86b1bce3df2::$classMap;
    288291
    289292        }, null, ClassLoader::class);
  • svea-checkout-for-woocommerce/trunk/vendor/composer/installed.json

    r3202226 r3320066  
    33        {
    44            "name": "guzzlehttp/guzzle",
    5             "version": "7.9.2",
    6             "version_normalized": "7.9.2.0",
     5            "version": "7.9.3",
     6            "version_normalized": "7.9.3.0",
    77            "source": {
    88                "type": "git",
    99                "url": "https://github.com/guzzle/guzzle.git",
    10                 "reference": "d281ed313b989f213357e3be1a179f02196ac99b"
    11             },
    12             "dist": {
    13                 "type": "zip",
    14                 "url": "https://api.github.com/repos/guzzle/guzzle/zipball/d281ed313b989f213357e3be1a179f02196ac99b",
    15                 "reference": "d281ed313b989f213357e3be1a179f02196ac99b",
     10                "reference": "7b2f29fe81dc4da0ca0ea7d42107a0845946ea77"
     11            },
     12            "dist": {
     13                "type": "zip",
     14                "url": "https://api.github.com/repos/guzzle/guzzle/zipball/7b2f29fe81dc4da0ca0ea7d42107a0845946ea77",
     15                "reference": "7b2f29fe81dc4da0ca0ea7d42107a0845946ea77",
    1616                "shasum": ""
    1717            },
     
    4040                "psr/log": "Required for using the Log middleware"
    4141            },
    42             "time": "2024-07-24T11:22:20+00:00",
     42            "time": "2025-03-27T13:37:11+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.2"
     114                "source": "https://github.com/guzzle/guzzle/tree/7.9.3"
    115115            },
    116116            "funding": [
     
    132132        {
    133133            "name": "guzzlehttp/promises",
    134             "version": "2.0.4",
    135             "version_normalized": "2.0.4.0",
     134            "version": "2.2.0",
     135            "version_normalized": "2.2.0.0",
    136136            "source": {
    137137                "type": "git",
    138138                "url": "https://github.com/guzzle/promises.git",
    139                 "reference": "f9c436286ab2892c7db7be8c8da4ef61ccf7b455"
    140             },
    141             "dist": {
    142                 "type": "zip",
    143                 "url": "https://api.github.com/repos/guzzle/promises/zipball/f9c436286ab2892c7db7be8c8da4ef61ccf7b455",
    144                 "reference": "f9c436286ab2892c7db7be8c8da4ef61ccf7b455",
     139                "reference": "7c69f28996b0a6920945dd20b3857e499d9ca96c"
     140            },
     141            "dist": {
     142                "type": "zip",
     143                "url": "https://api.github.com/repos/guzzle/promises/zipball/7c69f28996b0a6920945dd20b3857e499d9ca96c",
     144                "reference": "7c69f28996b0a6920945dd20b3857e499d9ca96c",
    145145                "shasum": ""
    146146            },
     
    152152                "phpunit/phpunit": "^8.5.39 || ^9.6.20"
    153153            },
    154             "time": "2024-10-17T10:06:22+00:00",
     154            "time": "2025-03-27T13:27:01+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.0.4"
     200                "source": "https://github.com/guzzle/promises/tree/2.2.0"
    201201            },
    202202            "funding": [
     
    218218        {
    219219            "name": "guzzlehttp/psr7",
    220             "version": "2.7.0",
    221             "version_normalized": "2.7.0.0",
     220            "version": "2.7.1",
     221            "version_normalized": "2.7.1.0",
    222222            "source": {
    223223                "type": "git",
    224224                "url": "https://github.com/guzzle/psr7.git",
    225                 "reference": "a70f5c95fb43bc83f07c9c948baa0dc1829bf201"
    226             },
    227             "dist": {
    228                 "type": "zip",
    229                 "url": "https://api.github.com/repos/guzzle/psr7/zipball/a70f5c95fb43bc83f07c9c948baa0dc1829bf201",
    230                 "reference": "a70f5c95fb43bc83f07c9c948baa0dc1829bf201",
     225                "reference": "c2270caaabe631b3b44c85f99e5a04bbb8060d16"
     226            },
     227            "dist": {
     228                "type": "zip",
     229                "url": "https://api.github.com/repos/guzzle/psr7/zipball/c2270caaabe631b3b44c85f99e5a04bbb8060d16",
     230                "reference": "c2270caaabe631b3b44c85f99e5a04bbb8060d16",
    231231                "shasum": ""
    232232            },
     
    249249                "laminas/laminas-httphandlerrunner": "Emit PSR-7 responses"
    250250            },
    251             "time": "2024-07-18T11:15:46+00:00",
     251            "time": "2025-03-27T12:30:47+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.0"
     319                "source": "https://github.com/guzzle/psr7/tree/2.7.1"
    320320            },
    321321            "funding": [
     
    553553        {
    554554            "name": "sveaekonomi/checkout",
    555             "version": "1.5.3",
    556             "version_normalized": "1.5.3.0",
     555            "version": "1.6.0",
     556            "version_normalized": "1.6.0.0",
    557557            "source": {
    558558                "type": "git",
    559559                "url": "https://github.com/sveawebpay/php-checkout.git",
    560                 "reference": "6241c3f894322775a8d574843f56bf1e2df884c1"
    561             },
    562             "dist": {
    563                 "type": "zip",
    564                 "url": "https://api.github.com/repos/sveawebpay/php-checkout/zipball/6241c3f894322775a8d574843f56bf1e2df884c1",
    565                 "reference": "6241c3f894322775a8d574843f56bf1e2df884c1",
     560                "reference": "d184c949b60b96595cb786320bf049a5fbaf91df"
     561            },
     562            "dist": {
     563                "type": "zip",
     564                "url": "https://api.github.com/repos/sveawebpay/php-checkout/zipball/d184c949b60b96595cb786320bf049a5fbaf91df",
     565                "reference": "d184c949b60b96595cb786320bf049a5fbaf91df",
    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": "2024-11-13T10:20:09+00:00",
     581            "time": "2025-06-30T13:03:15+00:00",
    582582            "type": "library",
    583583            "installation-source": "dist",
     
    600600            "support": {
    601601                "issues": "https://github.com/sveawebpay/php-checkout/issues",
    602                 "source": "https://github.com/sveawebpay/php-checkout/tree/1.5.3"
     602                "source": "https://github.com/sveawebpay/php-checkout/tree/1.6.0"
    603603            },
    604604            "install-path": "../sveaekonomi/checkout"
     
    684684            "type": "library",
    685685            "extra": {
     686                "thanks": {
     687                    "url": "https://github.com/symfony/contracts",
     688                    "name": "symfony/contracts"
     689                },
    686690                "branch-alias": {
    687691                    "dev-main": "3.0-dev"
    688                 },
    689                 "thanks": {
    690                     "name": "symfony/contracts",
    691                     "url": "https://github.com/symfony/contracts"
    692692                }
    693693            },
  • svea-checkout-for-woocommerce/trunk/vendor/composer/installed.php

    r3202226 r3320066  
    1212    'versions' => array(
    1313        'guzzlehttp/guzzle' => array(
    14             'pretty_version' => '7.9.2',
    15             'version' => '7.9.2.0',
    16             'reference' => 'd281ed313b989f213357e3be1a179f02196ac99b',
     14            'pretty_version' => '7.9.3',
     15            'version' => '7.9.3.0',
     16            'reference' => '7b2f29fe81dc4da0ca0ea7d42107a0845946ea77',
    1717            'type' => 'library',
    1818            'install_path' => __DIR__ . '/../guzzlehttp/guzzle',
     
    2121        ),
    2222        'guzzlehttp/promises' => array(
    23             'pretty_version' => '2.0.4',
    24             'version' => '2.0.4.0',
    25             'reference' => 'f9c436286ab2892c7db7be8c8da4ef61ccf7b455',
     23            'pretty_version' => '2.2.0',
     24            'version' => '2.2.0.0',
     25            'reference' => '7c69f28996b0a6920945dd20b3857e499d9ca96c',
    2626            'type' => 'library',
    2727            'install_path' => __DIR__ . '/../guzzlehttp/promises',
     
    3030        ),
    3131        'guzzlehttp/psr7' => array(
    32             'pretty_version' => '2.7.0',
    33             'version' => '2.7.0.0',
    34             'reference' => 'a70f5c95fb43bc83f07c9c948baa0dc1829bf201',
     32            'pretty_version' => '2.7.1',
     33            'version' => '2.7.1.0',
     34            'reference' => 'c2270caaabe631b3b44c85f99e5a04bbb8060d16',
    3535            'type' => 'library',
    3636            'install_path' => __DIR__ . '/../guzzlehttp/psr7',
     
    9393        ),
    9494        'sveaekonomi/checkout' => array(
    95             'pretty_version' => '1.5.3',
    96             'version' => '1.5.3.0',
    97             'reference' => '6241c3f894322775a8d574843f56bf1e2df884c1',
     95            'pretty_version' => '1.6.0',
     96            'version' => '1.6.0.0',
     97            'reference' => 'd184c949b60b96595cb786320bf049a5fbaf91df',
    9898            'type' => 'library',
    9999            'install_path' => __DIR__ . '/../sveaekonomi/checkout',
  • svea-checkout-for-woocommerce/trunk/vendor/guzzlehttp/guzzle/CHANGELOG.md

    r3172745 r3320066  
    22
    33Please refer to [UPGRADING](UPGRADING.md) guide for upgrading to a major version.
     4
     5
     6## 7.9.3 - 2025-03-27
     7
     8### Changed
     9
     10- Remove explicit content-length header for GET requests
     11- Improve compatibility with bad servers for boolean cookie values
    412
    513
  • svea-checkout-for-woocommerce/trunk/vendor/guzzlehttp/guzzle/src/Cookie/SetCookie.php

    r3088414 r3320066  
    6363                                $data[$search] = (int) $value;
    6464                            }
     65                        } elseif ($search === 'Secure' || $search === 'Discard' || $search === 'HttpOnly') {
     66                            if ($value) {
     67                                $data[$search] = true;
     68                            }
    6569                        } else {
    6670                            $data[$search] = $value;
  • svea-checkout-for-woocommerce/trunk/vendor/guzzlehttp/guzzle/src/Handler/Proxy.php

    r3088414 r3320066  
    1818     * requests to another handler.
    1919     *
    20      * @param callable(\Psr\Http\Message\RequestInterface, array): \GuzzleHttp\Promise\PromiseInterface $default Handler used for normal responses
    21      * @param callable(\Psr\Http\Message\RequestInterface, array): \GuzzleHttp\Promise\PromiseInterface $sync    Handler used for synchronous responses.
     20     * @param callable(RequestInterface, array): PromiseInterface $default Handler used for normal responses
     21     * @param callable(RequestInterface, array): PromiseInterface $sync    Handler used for synchronous responses.
    2222     *
    23      * @return callable(\Psr\Http\Message\RequestInterface, array): \GuzzleHttp\Promise\PromiseInterface Returns the composed handler.
     23     * @return callable(RequestInterface, array): PromiseInterface Returns the composed handler.
    2424     */
    2525    public static function wrapSync(callable $default, callable $sync): callable
     
    3838     * through the StreamHandler.
    3939     *
    40      * @param callable(\Psr\Http\Message\RequestInterface, array): \GuzzleHttp\Promise\PromiseInterface $default   Handler used for non-streaming responses
    41      * @param callable(\Psr\Http\Message\RequestInterface, array): \GuzzleHttp\Promise\PromiseInterface $streaming Handler used for streaming responses
     40     * @param callable(RequestInterface, array): PromiseInterface $default   Handler used for non-streaming responses
     41     * @param callable(RequestInterface, array): PromiseInterface $streaming Handler used for streaming responses
    4242     *
    43      * @return callable(\Psr\Http\Message\RequestInterface, array): \GuzzleHttp\Promise\PromiseInterface Returns the composed handler.
     43     * @return callable(RequestInterface, array): PromiseInterface Returns the composed handler.
    4444     */
    4545    public static function wrapStreaming(callable $default, callable $streaming): callable
  • svea-checkout-for-woocommerce/trunk/vendor/guzzlehttp/guzzle/src/Handler/StreamHandler.php

    r3172745 r3320066  
    5454
    5555            // Append a content-length header if body size is zero to match
    56             // cURL's behavior.
    57             if (0 === $request->getBody()->getSize()) {
     56            // the behavior of `CurlHandler`
     57            if (
     58                (
     59                    0 === \strcasecmp('PUT', $request->getMethod())
     60                    || 0 === \strcasecmp('POST', $request->getMethod())
     61                )
     62                && 0 === $request->getBody()->getSize()
     63            ) {
    5864                $request = $request->withHeader('Content-Length', '0');
    5965            }
  • svea-checkout-for-woocommerce/trunk/vendor/guzzlehttp/guzzle/src/Pool.php

    r3088414 r3320066  
    8787     * @param array|\Iterator $requests Requests to send concurrently.
    8888     * @param array           $options  Passes through the options available in
    89      *                                  {@see \GuzzleHttp\Pool::__construct}
     89     *                                  {@see Pool::__construct}
    9090     *
    9191     * @return array Returns an array containing the response or an exception
  • svea-checkout-for-woocommerce/trunk/vendor/guzzlehttp/guzzle/src/Utils.php

    r3172745 r3320066  
    8080     * The returned handler is not wrapped by any default middlewares.
    8181     *
    82      * @return callable(\Psr\Http\Message\RequestInterface, array): \GuzzleHttp\Promise\PromiseInterface Returns the best handler for the given system.
     82     * @return callable(\Psr\Http\Message\RequestInterface, array): Promise\PromiseInterface Returns the best handler for the given system.
    8383     *
    8484     * @throws \RuntimeException if no viable Handler is available.
  • svea-checkout-for-woocommerce/trunk/vendor/guzzlehttp/guzzle/src/functions.php

    r3088414 r3320066  
    5151 * The returned handler is not wrapped by any default middlewares.
    5252 *
    53  * @return callable(\Psr\Http\Message\RequestInterface, array): \GuzzleHttp\Promise\PromiseInterface Returns the best handler for the given system.
     53 * @return callable(\Psr\Http\Message\RequestInterface, array): Promise\PromiseInterface Returns the best handler for the given system.
    5454 *
    5555 * @throws \RuntimeException if no viable Handler is available.
  • svea-checkout-for-woocommerce/trunk/vendor/guzzlehttp/promises/CHANGELOG.md

    r3172745 r3320066  
    11# CHANGELOG
     2
     3
     4## 2.2.0 - 2025-03-27
     5
     6### Fixed
     7
     8- Revert "Allow an empty EachPromise to be resolved by running the queue"
     9
     10
     11## 2.1.0 - 2025-03-27
     12
     13### Added
     14
     15- Allow an empty EachPromise to be resolved by running the queue
    216
    317
  • svea-checkout-for-woocommerce/trunk/vendor/guzzlehttp/psr7/CHANGELOG.md

    r3172745 r3320066  
    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.7.1 - 2025-03-27
     9
     10### Fixed
     11
     12- Fixed uppercase IPv6 addresses in URI
     13
     14### Changed
     15
     16- Improve uploaded file error message
    717
    818## 2.7.0 - 2024-07-18
  • svea-checkout-for-woocommerce/trunk/vendor/guzzlehttp/psr7/src/UploadedFile.php

    r3172745 r3320066  
    1212class UploadedFile implements UploadedFileInterface
    1313{
    14     private const ERRORS = [
    15         UPLOAD_ERR_OK,
    16         UPLOAD_ERR_INI_SIZE,
    17         UPLOAD_ERR_FORM_SIZE,
    18         UPLOAD_ERR_PARTIAL,
    19         UPLOAD_ERR_NO_FILE,
    20         UPLOAD_ERR_NO_TMP_DIR,
    21         UPLOAD_ERR_CANT_WRITE,
    22         UPLOAD_ERR_EXTENSION,
     14    private const ERROR_MAP = [
     15        UPLOAD_ERR_OK => 'UPLOAD_ERR_OK',
     16        UPLOAD_ERR_INI_SIZE => 'UPLOAD_ERR_INI_SIZE',
     17        UPLOAD_ERR_FORM_SIZE => 'UPLOAD_ERR_FORM_SIZE',
     18        UPLOAD_ERR_PARTIAL => 'UPLOAD_ERR_PARTIAL',
     19        UPLOAD_ERR_NO_FILE => 'UPLOAD_ERR_NO_FILE',
     20        UPLOAD_ERR_NO_TMP_DIR => 'UPLOAD_ERR_NO_TMP_DIR',
     21        UPLOAD_ERR_CANT_WRITE => 'UPLOAD_ERR_CANT_WRITE',
     22        UPLOAD_ERR_EXTENSION => 'UPLOAD_ERR_EXTENSION',
    2323    ];
    2424
     
    105105    private function setError(int $error): void
    106106    {
    107         if (false === in_array($error, UploadedFile::ERRORS, true)) {
     107        if (!isset(UploadedFile::ERROR_MAP[$error])) {
    108108            throw new InvalidArgumentException(
    109109                'Invalid error status for UploadedFile'
     
    138138    {
    139139        if (false === $this->isOk()) {
    140             throw new RuntimeException('Cannot retrieve stream due to upload error');
     140            throw new RuntimeException(\sprintf('Cannot retrieve stream due to upload error (%s)', self::ERROR_MAP[$this->error]));
    141141        }
    142142
  • svea-checkout-for-woocommerce/trunk/vendor/guzzlehttp/psr7/src/Uri.php

    r3172745 r3320066  
    108108        // If IPv6
    109109        $prefix = '';
    110         if (preg_match('%^(.*://\[[0-9:a-f]+\])(.*?)$%', $url, $matches)) {
     110        if (preg_match('%^(.*://\[[0-9:a-fA-F]+\])(.*?)$%', $url, $matches)) {
    111111            /** @var array{0:string, 1:string, 2:string} $matches */
    112112            $prefix = $matches[1];
  • svea-checkout-for-woocommerce/trunk/vendor/sveaekonomi/checkout/README.md

    r2983864 r3320066  
    99* [6. Create recurring order](#6-create-recurring-order)
    1010* [7. Get recurring order](#7-get-recurring-order)
    11 * [8. Response](#8-response)
    12 * [9. Additional requests](#9-additional-requests)
    13 * [10. Data structures](#10-data-structures)
    14 * [11. HttpStatusCodes](#11-httpstatuscodes)
    15 * [12. Order administration](#12-order-administration)
    16 * [13. Javascript API](#13-javascript-api)
     11* [8. Change payment method for recurring order](#8-change-payment-method-for-recurring-order)
     12* [9. Response](#9-response)
     13* [10. Additional requests](#10-additional-requests)
     14* [11. Data structures](#11-data-structures)
     15* [12. HttpStatusCodes](#12-httpstatuscodes)
     16* [13. Order administration](#13-order-administration)
     17* [14. Javascript API](#14-javascript-api)
    1718## Introduction
    1819The checkout offers a complete solution with a variety of payment methods. The payment methods that are currently available in the checkout are invoice, payment plan, account credit, card payments and payment by bank.
    1920
    2021
    21 The checkout supports both B2C and B2B payments, fast customer identification and caches customers behaviour.
     22The checkout supports both B2C and B2B payments, fast customer identification and caches customers behavior.
    2223
    2324
     
    135136| IdentityFlags                     |          | Array of [*IdentityFlags*](#1012-identityflags) | Array of [*IdentityFlags*](#812-identityflags) used to hide certain features of the iframe |
    136137| PartnerKey                        |          | Guid                                            | Optional, provided by Svea on request. Used to create statistics.                               |
    137 | Recurring                         |          | Boolean                                         | Optional, if set to true the order will be a recurring order. (Only avilable if the merchant account has this feature enabled)                                 |
     138| Recurring                         |          | Boolean                                         | Optional, if set to true the order will be a recurring order. (Only available if the merchant account has this feature enabled)                                 |
    138139| MerchantData                      |          | String                                          | Metadata visible in the checkout API, returned when the order is fetched through the API.     |
    139140 
     
    375376```
    376377
    377 ### 8. Response
     378### 8. Change payment method for recurring order
     379Svea Checkout allows you to let customers change the payment method for an existing recurring order.
     380This feature is useful if a customer's card expires.
     381
     382#### Prerequisites
     383- The recurring order must be created and active.
     384- You need a "token" associated with the subscription.
     385
     386#### How it works
     387You use the changePaymentMethod endpoint via the \Svea\Checkout\CheckoutClient.
     388This will generate a new checkout session where the customer can select a new payment method.
     389Once the customer completes the flow, the new payment method will be linked to the recurring order.
     390
     391#### Example
     392```php
     393// include the library
     394include 'vendor/autoload.php';
     395
     396// without composer
     397require_once 'include.php';
     398
     399$checkoutClient = new \Svea\Checkout\CheckoutClient($connector);
     400
     401$data = [
     402    'token' => '12345678-90ab-cdef-1234-567890abcdef',
     403    'termsUrl' => 'http://yourdomain.se/terms'
     404];
     405
     406$response = $checkoutClient->changePaymentMethod($data);
     407
     408// Show the customer this snippet that lets them select a new payment method.
     409$sveaCheckoutIframe = $response['Gui']['Snippet'] ?? null;
     410echo $sveaCheckoutIframe ?: '';
     411```
     412
     413After the customer has completed the payment method change, Svea will update the payment details on the current token. No change needed from your side.
     414
     415### 9. Response
    378416The response contains information about the order such as Cart, Status, PaymentType and much more.
    379417
     
    542580echo $response['Gui']['Snippet']
    543581```
    544 ### 9. Additional requests
    545 
    546 #### 9.1 GetAvailablePartPaymentCampaigns
     582### 10. Additional requests
     583
     584#### 10.1 GetAvailablePartPaymentCampaigns
    547585
    548586GetAvailablePartPaymentCampaigns can be used to fetch the details of all the campaigns that are available on the merchant
     
    635673If you are a finnish merchant you have to display ALL the values described [here](https://www.kkv.fi/sv/beslut-och-publikationer/publikationer/konsumentrombudsmannens-riktlinjer/enligt-substans/tillhandahallande-av-konsumentkrediter/#luottolinjausSVE5.1) to be compliant with finnish laws.
    636674
    637 ### 10. Data structures
    638 
    639 #### 10.1 MerchantSettings
     675### 11. Data structures
     676
     677#### 11.1 MerchantSettings
    640678
    641679| Parameters                | Required  | Type      | Description  | Limits  |
    642680|------------------------------|-----------|-----------|--------------|---------|
    643 | TermsUri                     |    *      | string    | URI to a page which contains terms of the webshop. | 1-500 characters, must be a valid Url |
    644 | CheckoutUri                  |    *      | string    | URI to the page in the webshop that loads the Checkout.  | 1-500 characters, must be a valid Url |
    645 | ConfirmationUri              |    *      | string    | URI to the page in the webshop displaying specific information to a customer after the order has been confirmed. | 1-500 characters, must be a valid Url |
     681| TermsUri                     |    *      | string    | URI to a page which contains terms of the web shop. | 1-500 characters, must be a valid Url |
     682| CheckoutUri                  |    *      | string    | URI to the page in the web shop that loads the Checkout.  | 1-500 characters, must be a valid Url |
     683| ConfirmationUri              |    *      | string    | URI to the page in the web shop displaying specific information to a customer after the order has been confirmed. | 1-500 characters, must be a valid Url |
    646684| PushUri                      |    *      | string    | URI to a location that is expecting callbacks when CheckoutOrderStatus is changed. Uri should use the {checkout.order.uri} placeholder.  | 1-500 characters, must be a valid Url |
    647685| CheckoutValidationCallBackUri|           | string    | An optional URl to a location that is expecting callbacks from the Checkout to validate order’s stock status, and also the possibility to update checkout with an updated ClientOrderNumber. Uri may have a {checkout.order.uri} placeholder which will be replaced with the CheckoutOrderId. Please refer below [*CheckoutValidationCallbackResponse*](#1013-checkoutvalidationcallbackresponse) to see the expected response. | 1-500 characters, must be a valid Url |
     
    649687| PromotedPartPaymentCampaign  |           | integer   | Valid CampaignID. If used then the chosen campaign will be shown as the first payment method in all payment method lists. | Must be valid CampaignID |
    650688
    651 #### 10.2 Items
     689#### 11.2 Items
    652690
    653691| Parameters                | Required  | Type                                 | Description         |
     
    655693| Items                        |    *      | List of [*OrderRows*](#103-orderrow)  | See structure below |
    656694
    657 #### 10.3 OrderRow
     695#### 11.3 OrderRow
    658696
    659697| Parameters                | Required   | Type      | Description  | Limits  |
    660698|------------------------------|------------|-----------|--------------|---------|
    661 | ArticleNumber                |            | String    | Articlenumber as a string, can contain letters and numbers. | Maximum 1000 characters |
     699| ArticleNumber                |            | String    | Article number as a string, can contain letters and numbers. | Maximum 1000 characters |
    662700| Name                         |    *       | String    | Article name | 1-40 characters |
    663701| Quantity                     |    *       | Integer       | Set as basis point (1/100) e.g  2 = 200      | 1-9 digits. Minor currency |
    664702| UnitPrice                    |    *       | Integer       | Set as basis point (1/100) e.g. 25.00 = 2500 | 1-13 digits, can be negative. Minor currency |
    665 | DiscountPercent              |            | Integer       | The discountpercent of the product. | 0-100 |
     703| DiscountPercent              |            | Integer       | The discount percent of the product. | 0-100 |
    666704| VatPercent                   |    *       | Integer       | The VAT percentage of the current product. | Valid vat percentage for that country. Minor currency.  |
    667705| Unit                         |            | String        | The unit type, e.g., “st”, “pc”, “kg” etc. | 0-4 characters|
    668 | TemporaryReference           |            | String        | Can be used when creating or updating an order. The returned rows will have their corresponding temporaryreference as they were given in the indata. It will not be stored and will not be returned in GetOrder.  | |
     706| TemporaryReference           |            | String        | Can be used when creating or updating an order. The returned rows will have their corresponding "temporaryreference" as they were given in the indata. It will not be stored and will not be returned in GetOrder.  | |
    669707| MerchantData                 |            | String        | Can be used to store data, the data is not displayed anywhere but in the API
    670708
    671 #### 10.4 PresetValue
     709#### 11.4 PresetValue
    672710
    673711| Parameters             | Required  | Type          | Description  |
     
    685723| PhoneNumber               | String        |              | 1-18 digits, can include “+”, “-“s and space |
    686724| PostalCode                | String        |              | Company specific validation |
    687 | IsCompany                 | Boolean       |              | Required if nationalid is set |
    688 
    689 #### 10.5 Gui
     725| IsCompany                 | Boolean       |              | Required if "nationalid" is set |
     726
     727#### 11.5 Gui
    690728
    691729| Parameters               |  Type      | Description  |
     
    694732| Snippet                      | String     | HTML-snippet including javascript to populate the iFrame. |
    695733
    696 #### 10.6 Customer
     734#### 11.6 Customer
    697735
    698736| Parameters               | Type      | Description  |
    699737|------------------------------|-----------|--------------|
    700 | NationalId                   | String    | Personal- or organizationnumber. |
    701 | IsCompany                    | Boolean   | True if nationalId is organisationnumber, false if nationalid is personalnumber.   |
     738| NationalId                   | String    | Personal- or organization number. |
     739| IsCompany                    | Boolean   | True if nationalId is organisation number, false if "nationalid" is personal number.   |
    702740| CountryCode                  | String    |  Defined by two-letter ISO 3166-1 alpha-2, i.e. SE, DE, FI etc.|
    703741| Id                           | Integer   | Customer-specific id |
    704742
    705 #### 10.7 Address
     743#### 11.7 Address
    706744
    707745| Parameters                | Type      | Description  |
     
    718756| AddressLines                 | Array of strings | Null unless international flow is used
    719757
    720 #### 10.8 CheckoutOrderStatus
     758#### 11.8 CheckoutOrderStatus
    721759
    722760The order can only be considered “ready to send to customer” when the CheckoutOrderStatus is Final. No other status can guarantee payment.
     
    728766| Final                        | The order is completed in the checkout and managed by WebPay’s subsystems. The order can now be administrated using either the library or browsing to the admin user interface|
    729767
    730 #### 10.9 Locale
     768#### 11.9 Locale
    731769| Parameter | Description     |
    732770|-----------|-----------------|
     
    739777
    740778
    741 #### 10.10 PaymentType
     779#### 11.10 PaymentType
    742780| Parameter   | Description     |
    743781|-------------|-----------------|
     
    755793| LEASINGUNAPPROVED | Leasing (Manual approve process by Sveas leasing department, check Store pay admin page) |
    756794| LEASINGAPPROVED | Leasing (Automatically approved leasing contract)
    757 | TRUSTLY            | The customer paied with Trustly |
     795| TRUSTLY            | The customer paid with Trustly |
    758796| Directbank (varies)  |    The customer paid the order with direct bank e.g. Nordea, SEB. See below for all available parameters |
    759797
     
    778816
    779817
    780 #### 10.11 CampaignCodeInfo
     818#### 11.11 CampaignCodeInfo
    781819| Parameter                 | Type      | Description |
    782820|---------------------------|-----------|-------------|
     
    794832| PaymentPlanType           | Integer   | Type of campaign |
    795833
    796 #### 10.12 IdentityFlags
     834#### 11.12 IdentityFlags
    797835| Parameter                 | Type      | Description |
    798836|---------------------------|-----------|-------------|
     
    801839| HideAnonymous           | Boolean   | Hides anonymous flow, forcing users to identify with their nationalId to perform a purchase |
    802840
    803 #### 10.13 CheckoutValidationCallbackResponse
     841#### 11.13 CheckoutValidationCallbackResponse
    804842If a CheckoutValidationCallbackUri is set on an order when it's created, Svea will send a HTTP GET request to the specified URI when a customer clicks on "Confirm Order".
    805843
     
    811849| ClientOrderNumber |          | String  | Max 32 characters. Set if you want the ClientOrderNumber to be updated. |
    812850
    813 ### 11. HttpStatusCodes
     851### 12. HttpStatusCodes
    814852| Parameter | Type          | Description |
    815853|-----------|---------------|-------------|
     
    827865If the returned ResultCode is not present in the above tables please contact Svea Ekonomi for further information.
    828866
    829 ## 12. Order administration
     867## 13. Order administration
    830868
    831869[See full examples](examples/admin)
     
    843881\Exception - For any other error
    844882
    845 ### 12.1 Get order
     883### 13.1 Get order
    846884This method is used to get the entire order with all its relevant information. Including its deliveries, rows, credits and addresses.
    847885
     
    856894| Parameters OUT                | Type      | Description  |
    857895|-------------------------------|-----------|--------------|
    858 | Order          | array     | An array containing all the order details. See [12.14 Data objects](#1215-data-objects) |
    859 
    860 
    861 
    862 ### 12.2 Get task
     896| Order          | array     | An array containing all the order details. See [13.14 Data objects](#1215-data-objects) |
     897
     898
     899
     900### 13.2 Get task
    863901A task will explain the status of a previously performed operation. When finished it will point towards the new resource with the Location.
    864902#### Parameters
     
    874912| Task                          | [Task](#12154-task)      | An object containing details regarding a queued task |
    875913
    876 ### 12.3 Deliver order
     914### 13.3 Deliver order
    877915Creates a delivery on a checkout order. Assuming the order got the **CanDeliverOrder** action.
    878916
     
    894932| HeaderLocation                | string    | URI to the created task. (Absolute URL) |
    895933
    896 ### 12.3.1 Row Delivery Options
     934### 13.3.1 Row Delivery Options
    897935
    898936| Parameter                     | Type       | Description  |
     
    901939| quantity                      | int        | Number of items to credit |
    902940
    903 ### 12.4 Deliver order with lower amount
     941### 13.4 Deliver order with lower amount
    904942Creates a delivery on a checkout order with a lower amount than the total, canceling the remaining amount. Assuming the order got **CanDeliverOrder** and **CanCancelAmount** action.
    905943
     
    918956| HeaderLocation       | string | URI to the created task (Absolute URL)  |
    919957
    920 ### 12.5 Cancel Order
     958### 13.5 Cancel Order
    921959Cancel an order before it has been delivered. Assuming the order has the action **CanCancelOrder**.
    922960
     
    930968If the order is successfully cancelled, Response is empty.
    931969
    932 ### 12.6 Cancel order amount
     970### 13.6 Cancel order amount
    933971By specifying a higher amount than the current order cancelled amount then the order cancelled amount will increase,
    934972assuming the order has the action **CanCancelOrderAmount**. The delta between the new *CancelledAmount* and the former *CancelledAmount* will be cancelled.
     
    946984If order amount is successfully cancelled, Response is empty.
    947985
    948 ### 12.7 Cancel order row
     986### 13.7 Cancel order row
    949987Changes the status of an order row to *Cancelled*, assuming the order has the action **CanCancelOrderRow** and the OrderRow has the action **CanCancelRow**.
    950988
     
    959997If order row is successfully cancelled, Response is empty.
    960998
    961 ### 12.8 Credit order rows
     999### 13.8 Credit order rows
    9621000Creates a new credit on the specified delivery with specified order rows. Assuming the delivery has action **CanCreditOrderRows** and the specified order rows also has action **CanCreditRow**
    9631001
     
    9771015On the returned URL can be checked status of the task.
    9781016
    979 ### 12.8.1 Row Crediting Options
     1017### 13.8.1 Row Crediting Options
    9801018
    9811019| Parameter                     | Type       | Description  |
     
    9841022| quantity                      | int        | Number of items to credit |
    9851023
    986 ### 12.9 Credit new order row
     1024### 13.9 Credit new order row
    9871025By specifying a new credit row, a new credit row will be created on the delivery, assuming the delivery has action **CanCreditNewRow**.
    9881026
     
    10011039On the returned URL can be checked status of the task.
    10021040
    1003 ### 12.10 Credit order rows with fee
     1041### 13.10 Credit order rows with fee
    10041042Creates a new credit on the specified delivery with specified order rows. Assuming the delivery has action **CanCreditOrderRows** and the specified order rows also has action **CanCreditRow**. Adds the ability to add a fee to the credit.
    10051043
     
    10191057
    10201058On the returned URL can be checked status of the task.
    1021 ### 12.11 Credit amount
     1059### 13.11 Credit amount
    10221060By specifying a credited amount larger than the current credited amount. A credit is being made on the specified delivery. The credited amount cannot be lower than the current credited amount or larger than the delivered amount.
    10231061
     
    10341072If order amount is successfully credited, Response is empty.
    10351073
    1036 ### 12.12 Add order row
     1074### 13.12 Add order row
    10371075This method is used to add order rows to an order, assuming the order has the action **CanAddOrderRow**.
    10381076If the new order amount will exceed the current order amount, a credit check will be performed.
     
    10521090On the returned URL (HeaderLocation) can be checked status of the task.
    10531091
    1054 ### 12.13 Update order row
     1092### 13.13 Update order row
    10551093This method is used to update an order row, assuming the order has action "CanUpdateOrderRow" and the order row has the action **CanUpdateRow**.
    10561094The method will update all fields set in the payload, if a field is not set the row will keep the current value.
     
    10671105If order row is successfully updated, Response is empty.
    10681106
    1069 ### 12.14 Replace order rows
     1107### 13.14 Replace order rows
    10701108This method is used to update an order row, assuming the order has action "CanUpdateOrderRow".
    10711109This method will delete all the present rows and replace with the ones set in the payload.
     
    10821120
    10831121
    1084 ### 12.15 Data objects
    1085 
    1086 #### 12.15.1 Order
     1122### 13.15 Data objects
     1123
     1124#### 13.15.1 Order
    10871125| Parameter             |   Type        | Description                                               |
    10881126|-----------------------|---------------|-----------------------------------------------------------|
     
    10951133| PaymentType           | string        | The final payment method for the order. Will only have a value when the order is locked, otherwise null. See list of possible PaymentType below.|
    10961134| CreationDate          | DateTime      | Date and time when the order was created|
    1097 | NationalId            | string        | Personal- or organizationnumber.|
    1098 | IsCompany             | boolean       | True if nationalid is organisationnumber, false if nationalid is personalnumber.| 
     1135| NationalId            | string        | Personal- or organization number.|
     1136| IsCompany             | boolean       | True if "nationalid" is organisation number, false if "nationalid" is personal number.| 
    10991137| OrderAmount           | int           | The total amount on the order. Minor unit|
    11001138| CancelledAmount       | int           | The total cancelled amount on the order. Minor uit|
     
    11051143| Actions               | List of String | A list of actions possible on the order.|
    11061144
    1107 #### 12.15.2 Delivery
     1145#### 13.15.2 Delivery
    11081146
    11091147| Parameter             |   Type        | Description                                               |
     
    11181156| Actions               | List of string | A list of actions possible on the delivery.|
    11191157
    1120 #### 12.15.3 Credit
     1158#### 13.15.3 Credit
    11211159
    11221160| Parameter             |   Type        | Description                                               |
     
    11261164| Actions               | List of String | A list of actions possible on the credit.|
    11271165
    1128 #### 12.15.4 Task
     1166#### 13.15.4 Task
    11291167
    11301168| Parameter             |   Type        | Description                                               |
     
    11331171| Status                | String        | Status of the task |
    11341172
    1135 #### 12.15.5 Order Row
     1173#### 13.15.5 Order Row
    11361174
    11371175|Parameter              |R  | RO | Type     | Description                   |   Limits|
    11381176|-----------------------|---|----|----------|-------------------------------|-------------------|
    11391177| OrderRowId            |   | *  |int      | Order row id from underlying system, unique on order. | Not possible to set through API, only get.|
    1140 | ArticleNumber         |   |    |string    | Articlenumber as a string, can contain letters and numbers. | Maximum 256 characters.   |
     1178| ArticleNumber         |   |    |string    | Article number as a string, can contain letters and numbers. | Maximum 256 characters.   |
    11411179| Name                  | * |    |string    | Article name. | 1-40 characters. |
    11421180| Quantity              | * |    |int      | Quantity of the product. | 1-9 digits. Minor unit.|
    11431181| UnitPrice             | * |    |int      | Price of the product including VAT. | 1-13 digits, can be negative. Minor currency.|
    1144 | DiscountPercent       |   |    |int      | The discountpercent of the product. | 0-9900. Minor unit|
     1182| DiscountPercent       |   |    |int      | The discount percent of the product. | 0-9900. Minor unit|
    11451183| VatPercent            | * |    |int      | The VAT percentage of the current product. | Valid vat percentage for that country . Minor unit.0-10000|
    11461184| Unit                  |   |    |string    | The unit type, e.g., “st”, “pc”, “kg” etc.  | 0-4 characters. |
     
    11481186| Actions               |   | *  |List of string | A list of actions possible on the order row. See list of OrderRow actions below. | Not possible to set through API, only get.|
    11491187
    1150 #### 12.15.6 Address
     1188#### 13.15.6 Address
    11511189
    11521190| Parameter             |   Type        | Description                                               |
     
    11591197| CountryCode           |   string      |   2-letter ISO country code |
    11601198
    1161 #### 12.15.7 Order Status
     1199#### 13.15.7 Order Status
    11621200
    11631201| Parameter             |  Description                                               |
     
    11681206| Failed                | The payment for this order has failed |
    11691207
    1170 #### 12.15.8 Order actions
     1208#### 13.15.8 Order actions
    11711209
    11721210| Parameter                 |  Description                                               |
     
    11801218| CanUpdateOrderRow         ||
    11811219
    1182 #### 12.15.9 Delivery actions
     1220#### 13.15.9 Delivery actions
    11831221
    11841222| Parameter             |  Description                                               |
     
    11881226| CanCreditAmount       ||     
    11891227
    1190 #### 12.15.10 Order Row actions
     1228#### 13.15.10 Order Row actions
    11911229
    11921230| Parameter             |  Description                                               |
     
    11971235| CanUpdateRow          ||
    11981236
    1199 ## 13. Javascript API
     1237## 14. Javascript API
    12001238
    12011239(Please note that the API is still considered a work in progress and might see significant changes.)
  • svea-checkout-for-woocommerce/trunk/vendor/sveaekonomi/checkout/VERSION

    r3172745 r3320066  
    1 1.5.2
     11.6.0
  • svea-checkout-for-woocommerce/trunk/vendor/sveaekonomi/checkout/composer.json

    r3202226 r3320066  
    11{
    22  "name": "sveaekonomi/checkout",
    3   "version": "1.5.3",
     3  "version": "1.6.0",
    44  "description": "Php integration library for Svea Checkout",
    55  "license": "Apache-2.0",
     
    2626    "phploc/phploc": "^2.0.1",
    2727    "sebastian/phpcpd": "^2.0.4",
    28     "symfony/dependency-injection": "^2.7.51 || ^2.8.50 || ^3.4.26 || ^4.1.12 || ^4.2.7"
     28      "symfony/dependency-injection": "^2.7.51 || ^2.8.50 || ^3.4.26 || ^4.1.12 || ^4.2.7"
    2929  },
    3030  "scripts": {
  • svea-checkout-for-woocommerce/trunk/vendor/sveaekonomi/checkout/src/CheckoutClient.php

    r2983864 r3320066  
    7070
    7171        return $this->executeAction($class, $data);
     72    }
     73
     74    /**
     75     * Change payment method for existing Svea Checkout order.
     76     *
     77     * @param array $data
     78     * @return mixed
     79     */
     80    public function changePaymentMethod( array $data )
     81    {
     82        return $this->executeAction(ImplementationFactory::returnChangePaymentMethodClass($this->connector), $data);
     83       
    7284    }
    7385
  • svea-checkout-for-woocommerce/trunk/vendor/sveaekonomi/checkout/src/Implementation/ImplementationFactory.php

    r2983864 r3320066  
    55use Svea\Checkout\Transport\Connector;
    66use Svea\Checkout\Validation\ValidateCreateOrderData;
     7use Svea\Checkout\Validation\ValidateChangePaymentMethodData;
    78use Svea\Checkout\Validation\ValidateCreateTokenOrderData;
    89use Svea\Checkout\Validation\ValidateGetOrderData;
     
    1718    /**
    1819     * @param Connector $connector
    19      * @return ImplementationInterface
     20     * @return CreateOrder
    2021     */
    2122    public static function returnCreateOrderClass(Connector $connector)
     
    2627    /**
    2728     * @param Connector $connector
    28      * @return ImplementationInterface
     29     * @return CreateTokenOrder
    2930     */
    30     public static function returnCreateTokenOrderClass(Connector $connector) {
     31    public static function returnCreateTokenOrderClass(Connector $connector)
     32    {
    3133        return new CreateTokenOrder($connector, new ValidateCreateTokenOrderData());
    3234    }
     
    3436    /**
    3537     * @param Connector $connector
    36      * @return ImplementationInterface
     38     * @return ChangePaymentMethod
     39     */
     40    public static function returnChangePaymentMethodClass(Connector $connector)
     41    {
     42        return new ChangePaymentMethod($connector, new ValidateChangePaymentMethodData());
     43    }
     44
     45    /**
     46     * @param Connector $connector
     47     * @return GetOrder
    3748     */
    3849    public static function returnGetOrderClass(Connector $connector)
     
    4354    /**
    4455     * @param Connector $connector
    45      * @return ImplementationInterface
     56     * @return GetTokenOrder
    4657     */
    4758    public static function returnGetTokenOrderClass(Connector $connector)
     
    5263    /**
    5364     * @param Connector $connector
    54      * @return ImplementationInterface
     65     * @return GetToken
    5566     */
    5667    public static function returnGetTokenClass(Connector $connector)
     
    6172    /**
    6273     * @param Connector $connector
    63      * @return ImplementationInterface
     74     * @return UpdateToken
    6475     */
    6576    public static function returnUpdateTokenClass(Connector $connector)
     
    7081    /**
    7182     * @param Connector $connector
    72      * @return ImplementationInterface
     83     * @return UpdateOrder
    7384     */
    7485    public static function returnUpdateOrderClass(Connector $connector)
     
    7990    /**
    8091     * @param Connector $connector
    81      * @return ImplementationInterface
     92     * @return GetAvailablePartPaymentCampaigns
    8293     */
    8394    public static function returnGetAvailablePartPaymentCampaignsClass(Connector $connector)
Note: See TracChangeset for help on using the changeset viewer.