Changeset 3320066
- Timestamp:
- 06/30/2025 01:24:26 PM (9 months ago)
- Location:
- svea-checkout-for-woocommerce
- Files:
-
- 8 added
- 80 edited
- 1 copied
-
tags/3.3.0 (copied) (copied from svea-checkout-for-woocommerce/trunk)
-
tags/3.3.0/assets/js/frontend/application.min.js (modified) (1 diff)
-
tags/3.3.0/inc/Admin.php (modified) (10 diffs)
-
tags/3.3.0/inc/Compat/Compat.php (modified) (1 diff)
-
tags/3.3.0/inc/Compat/Gift_Cards_For_WC_Compat.php (modified) (1 diff)
-
tags/3.3.0/inc/Emails/Awaiting_Svea_Email.php (modified) (2 diffs)
-
tags/3.3.0/inc/Models/Svea_Checkout.php (modified) (8 diffs)
-
tags/3.3.0/inc/Models/Svea_Instore.php (modified) (1 diff)
-
tags/3.3.0/inc/Models/Svea_Item.php (modified) (12 diffs)
-
tags/3.3.0/inc/Models/Svea_Payment_Admin.php (modified) (3 diffs)
-
tags/3.3.0/inc/Template_Handler.php (modified) (10 diffs)
-
tags/3.3.0/inc/WC_Gateway_Svea_Checkout.php (modified) (14 diffs)
-
tags/3.3.0/inc/WC_Shipping_Svea_Nshift.php (modified) (2 diffs)
-
tags/3.3.0/inc/Webhook_Handler.php (modified) (7 diffs)
-
tags/3.3.0/readme.txt (modified) (4 diffs)
-
tags/3.3.0/svea-checkout-for-woocommerce.php (modified) (3 diffs)
-
tags/3.3.0/templates/backend/metabox.php (modified) (1 diff)
-
tags/3.3.0/templates/checkout/additional-fields.php (modified) (1 diff)
-
tags/3.3.0/templates/myaccount (added)
-
tags/3.3.0/templates/myaccount/svea-change-payment-method.php (added)
-
tags/3.3.0/templates/svea-checkout.php (modified) (1 diff)
-
tags/3.3.0/vendor/autoload.php (modified) (1 diff)
-
tags/3.3.0/vendor/composer/autoload_classmap.php (modified) (3 diffs)
-
tags/3.3.0/vendor/composer/autoload_real.php (modified) (2 diffs)
-
tags/3.3.0/vendor/composer/autoload_static.php (modified) (5 diffs)
-
tags/3.3.0/vendor/composer/installed.json (modified) (13 diffs)
-
tags/3.3.0/vendor/composer/installed.php (modified) (4 diffs)
-
tags/3.3.0/vendor/guzzlehttp/guzzle/CHANGELOG.md (modified) (1 diff)
-
tags/3.3.0/vendor/guzzlehttp/guzzle/src/Cookie/SetCookie.php (modified) (1 diff)
-
tags/3.3.0/vendor/guzzlehttp/guzzle/src/Handler/Proxy.php (modified) (2 diffs)
-
tags/3.3.0/vendor/guzzlehttp/guzzle/src/Handler/StreamHandler.php (modified) (1 diff)
-
tags/3.3.0/vendor/guzzlehttp/guzzle/src/Pool.php (modified) (1 diff)
-
tags/3.3.0/vendor/guzzlehttp/guzzle/src/Utils.php (modified) (1 diff)
-
tags/3.3.0/vendor/guzzlehttp/guzzle/src/functions.php (modified) (1 diff)
-
tags/3.3.0/vendor/guzzlehttp/promises/CHANGELOG.md (modified) (1 diff)
-
tags/3.3.0/vendor/guzzlehttp/psr7/CHANGELOG.md (modified) (1 diff)
-
tags/3.3.0/vendor/guzzlehttp/psr7/src/UploadedFile.php (modified) (3 diffs)
-
tags/3.3.0/vendor/guzzlehttp/psr7/src/Uri.php (modified) (1 diff)
-
tags/3.3.0/vendor/sveaekonomi/checkout/README.md (modified) (46 diffs)
-
tags/3.3.0/vendor/sveaekonomi/checkout/VERSION (modified) (1 diff)
-
tags/3.3.0/vendor/sveaekonomi/checkout/composer.json (modified) (2 diffs)
-
tags/3.3.0/vendor/sveaekonomi/checkout/src/CheckoutClient.php (modified) (1 diff)
-
tags/3.3.0/vendor/sveaekonomi/checkout/src/Implementation/ChangePaymentMethod.php (added)
-
tags/3.3.0/vendor/sveaekonomi/checkout/src/Implementation/ImplementationFactory.php (modified) (9 diffs)
-
tags/3.3.0/vendor/sveaekonomi/checkout/src/Validation/ValidateChangePaymentMethodData.php (added)
-
trunk/assets/js/frontend/application.min.js (modified) (1 diff)
-
trunk/inc/Admin.php (modified) (10 diffs)
-
trunk/inc/Compat/Compat.php (modified) (1 diff)
-
trunk/inc/Compat/Gift_Cards_For_WC_Compat.php (modified) (1 diff)
-
trunk/inc/Emails/Awaiting_Svea_Email.php (modified) (2 diffs)
-
trunk/inc/Models/Svea_Checkout.php (modified) (8 diffs)
-
trunk/inc/Models/Svea_Instore.php (modified) (1 diff)
-
trunk/inc/Models/Svea_Item.php (modified) (12 diffs)
-
trunk/inc/Models/Svea_Payment_Admin.php (modified) (3 diffs)
-
trunk/inc/Template_Handler.php (modified) (10 diffs)
-
trunk/inc/WC_Gateway_Svea_Checkout.php (modified) (14 diffs)
-
trunk/inc/WC_Shipping_Svea_Nshift.php (modified) (2 diffs)
-
trunk/inc/Webhook_Handler.php (modified) (7 diffs)
-
trunk/readme.txt (modified) (4 diffs)
-
trunk/svea-checkout-for-woocommerce.php (modified) (3 diffs)
-
trunk/templates/backend/metabox.php (modified) (1 diff)
-
trunk/templates/checkout/additional-fields.php (modified) (1 diff)
-
trunk/templates/myaccount (added)
-
trunk/templates/myaccount/svea-change-payment-method.php (added)
-
trunk/templates/svea-checkout.php (modified) (1 diff)
-
trunk/vendor/autoload.php (modified) (1 diff)
-
trunk/vendor/composer/autoload_classmap.php (modified) (3 diffs)
-
trunk/vendor/composer/autoload_real.php (modified) (2 diffs)
-
trunk/vendor/composer/autoload_static.php (modified) (5 diffs)
-
trunk/vendor/composer/installed.json (modified) (13 diffs)
-
trunk/vendor/composer/installed.php (modified) (4 diffs)
-
trunk/vendor/guzzlehttp/guzzle/CHANGELOG.md (modified) (1 diff)
-
trunk/vendor/guzzlehttp/guzzle/src/Cookie/SetCookie.php (modified) (1 diff)
-
trunk/vendor/guzzlehttp/guzzle/src/Handler/Proxy.php (modified) (2 diffs)
-
trunk/vendor/guzzlehttp/guzzle/src/Handler/StreamHandler.php (modified) (1 diff)
-
trunk/vendor/guzzlehttp/guzzle/src/Pool.php (modified) (1 diff)
-
trunk/vendor/guzzlehttp/guzzle/src/Utils.php (modified) (1 diff)
-
trunk/vendor/guzzlehttp/guzzle/src/functions.php (modified) (1 diff)
-
trunk/vendor/guzzlehttp/promises/CHANGELOG.md (modified) (1 diff)
-
trunk/vendor/guzzlehttp/psr7/CHANGELOG.md (modified) (1 diff)
-
trunk/vendor/guzzlehttp/psr7/src/UploadedFile.php (modified) (3 diffs)
-
trunk/vendor/guzzlehttp/psr7/src/Uri.php (modified) (1 diff)
-
trunk/vendor/sveaekonomi/checkout/README.md (modified) (46 diffs)
-
trunk/vendor/sveaekonomi/checkout/VERSION (modified) (1 diff)
-
trunk/vendor/sveaekonomi/checkout/composer.json (modified) (2 diffs)
-
trunk/vendor/sveaekonomi/checkout/src/CheckoutClient.php (modified) (1 diff)
-
trunk/vendor/sveaekonomi/checkout/src/Implementation/ChangePaymentMethod.php (added)
-
trunk/vendor/sveaekonomi/checkout/src/Implementation/ImplementationFactory.php (modified) (9 diffs)
-
trunk/vendor/sveaekonomi/checkout/src/Validation/ValidateChangePaymentMethodData.php (added)
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 56 56 add_action( 'add_meta_boxes', [ $this, 'add_metabox' ] ); 57 57 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 ); 59 59 60 60 add_filter( 'woocommerce_register_shop_order_post_statuses', [ $this, 'register_order_status' ] ); … … 68 68 add_action( 'woocommerce_order_status_' . self::AWAITING_ORDER_STATUS . '_to_completed_notification', [ $this, 'add_completed_email_trigger' ], 10, 2 ); 69 69 70 add_action( 'sco_check_pa_order_status', [ $this, 'c heck_pa_order_status' ] );70 add_action( 'sco_check_pa_order_status', [ $this, 'cron_check_pa_order_status' ] ); 71 71 72 72 add_filter( 'woocommerce_valid_order_statuses_for_payment_complete', [ $this, 'allow_awaiting_svea_status_to_be_completed' ] ); … … 86 86 add_action( 'woocommerce_process_product_meta', [ $this, 'save_product_fields' ] ); 87 87 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 ); 88 98 } 89 99 … … 312 322 public function check_pa_order_status( $order ) { 313 323 if ( is_numeric( $order ) ) { 314 /** @var \WC_Order $wc_order */315 324 $wc_order = Webhook_Handler::get_order_by_svea_id( $order ); 316 325 $svea_order_id = $order; 317 326 } else { 318 /** @var \WC_Order $wc_order */319 327 $wc_order = $order; 320 328 $svea_order_id = $wc_order->get_meta( '_svea_co_order_id' ); … … 334 342 } catch ( \Exception $e ) { 335 343 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' );341 344 return ''; 342 345 } … … 442 445 * Save some refs 443 446 * 444 * @param \ Automattic\WooCommerce\Admin\Overrides\Order $wc_order447 * @param \WC_Order $wc_order 445 448 * @param array $svea_order 446 449 * @return void … … 461 464 462 465 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'] ) ); 464 467 } 465 468 } … … 533 536 * Renders the metabox 534 537 * 535 * @param \WP_ post|\WC_Order $name538 * @param \WP_Post|\WC_Order $post_or_order_object 536 539 * @return void 537 540 */ … … 576 579 * 577 580 * @param \WC_Order_Item $order_item 578 * @return void581 * @return array 579 582 */ 580 583 public function get_order_row_data( $order_item ) { … … 612 615 */ 613 616 public function admin_remove_order_item( $order_item_id ) { 617 /** @var \WC_Order_Item_Data_Store $data_store */ 614 618 $data_store = \WC_Data_Store::load( 'order-item' ); 615 619 -
svea-checkout-for-woocommerce/tags/3.3.0/inc/Compat/Compat.php
r3264850 r3320066 20 20 */ 21 21 public $polylang; 22 23 /**24 * WPML compatibility class25 *26 * @var WPML_Compat27 */28 public $wpml;29 22 30 23 /** -
svea-checkout-for-woocommerce/tags/3.3.0/inc/Compat/Gift_Cards_For_WC_Compat.php
r3203722 r3320066 2 2 namespace Svea_Checkout_For_Woocommerce\Compat; 3 3 4 use Svea_Checkout_For_Woocommerce\Helper;5 4 use Svea_Checkout_For_Woocommerce\Models\Svea_Item; 6 5 -
svea-checkout-for-woocommerce/tags/3.3.0/inc/Emails/Awaiting_Svea_Email.php
r3009386 r3320066 1 1 <?php 2 namespace Svea_Checkout_For_Woocommerce\Emails; 3 2 4 /** 3 5 * Class Awaiting_Svea_Email file. … … 17 19 * Customer awaiting further info from Svea 18 20 */ 19 class Awaiting_Svea_Email extends WC_Email {21 class Awaiting_Svea_Email extends \WC_Email { 20 22 21 23 /** -
svea-checkout-for-woocommerce/tags/3.3.0/inc/Models/Svea_Checkout.php
r3264850 r3320066 90 90 * Setup Svea connector 91 91 * 92 * @param \WC_Cart $cart 92 * @param string $currency 93 * @param string $country 93 94 * @return void 94 95 */ … … 257 258 * Create a new order in Svea from the cart 258 259 * 259 * @param bool $force260 260 * @return array 261 261 */ … … 268 268 269 269 // Set preset values 270 if ( isset( $user_email ) &&! empty( $user_email ) ) {270 if ( ! empty( $user_email ) ) { 271 271 array_push( 272 272 $preset_values, … … 279 279 } 280 280 281 if ( isset( $user_zipcode ) &&! empty( $user_zipcode ) ) {281 if ( ! empty( $user_zipcode ) ) { 282 282 array_push( 283 283 $preset_values, … … 290 290 } 291 291 292 if ( isset( $user_phone ) &&! empty( $user_phone ) ) {292 if ( ! empty( $user_phone ) ) { 293 293 array_push( 294 294 $preset_values, … … 536 536 537 537 /** 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 /** 538 560 * Get the minimum age for the order (null if no restrictions) 539 561 * … … 547 569 * Get the plugin version 548 570 * 549 * @return void571 * @return string 550 572 */ 551 573 public function get_plugin_version() { … … 556 578 * Get merchant settings 557 579 * 558 * @param string $token559 580 * @return array 560 581 */ -
svea-checkout-for-woocommerce/tags/3.3.0/inc/Models/Svea_Instore.php
r3202226 r3320066 85 85 * 86 86 * @param \WC_Order|null $wc_order 87 * @param bool $admin88 *89 87 * @return void 90 88 */ -
svea-checkout-for-woocommerce/tags/3.3.0/inc/Models/Svea_Item.php
r3309749 r3320066 34 34 * Unit price (price each) 35 35 * 36 * @var float 37 */ 38 public $unit_price; 39 40 /** 41 * Tax percentage, 25, 12, 6 etc 42 * 36 43 * @var int 37 44 */ 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) 42 56 * 43 57 * @var int 44 58 */ 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 49 77 * 50 78 * @var string 51 79 */ 52 public $type = 'product';53 54 /**55 * Discount percent (0-100)56 *57 * @var int58 */59 public $discount_percent = 0;60 61 /**62 * Discount amount63 *64 * @var float65 */66 public $discount_amount = 0;67 68 /**69 * Diff from WooCommerce70 *71 * @var float72 */73 private $sum_diff = 0;74 75 /**76 * Temporary reference77 *78 * @var string79 */80 80 public $temporary_reference = ''; 81 81 … … 90 90 * Weight in grams 91 91 * 92 * @var int92 * @var float 93 93 */ 94 94 private $weight = 0; … … 97 97 * Length in mm 98 98 * 99 * @var int99 * @var float 100 100 */ 101 101 private $length = 0; … … 104 104 * Height in mm 105 105 * 106 * @var int106 * @var float 107 107 */ 108 108 private $height = 0; … … 111 111 * Width in mm 112 112 * 113 * @var int113 * @var float 114 114 */ 115 115 private $width = 0; … … 193 193 // Prevent division by 0 194 194 if ( $shipping->get_cost() > 0 ) { 195 $tax_percentage = ( $total_tax / $shipping->get_cost() ) * 100;195 $tax_percentage = ( $total_tax / (float) $shipping->get_cost() ) * 100; 196 196 } 197 197 … … 225 225 if ( ! empty( $meta_data['nshift_data'] ) ) { 226 226 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(); 229 229 230 230 $shipping_row->sku = $shipping->get_id(); … … 383 383 } 384 384 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(); 386 386 387 387 $tax_percentage = 0; 388 388 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; 390 390 } 391 391 … … 394 394 $this->quantity = $item->get_quantity(); 395 395 $this->unit_price = $unit_price; 396 $this->tax_percentage = $tax_percentage ? ?0;396 $this->tax_percentage = $tax_percentage ?: 0; 397 397 398 398 if ( $set_ref ) { … … 418 418 $this->quantity = $item->get_quantity(); 419 419 $this->unit_price = $unit_price; 420 $this->tax_percentage = $tax_percentage ? ?0;420 $this->tax_percentage = $tax_percentage ?: 0; 421 421 422 422 if ( $set_ref ) { … … 435 435 */ 436 436 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(); 438 438 439 439 $total_tax = floatval( $item->get_total_tax() ); … … 452 452 $this->quantity = $item->get_quantity(); 453 453 $this->unit_price = $unit_price; 454 $this->tax_percentage = $tax_percentage ? ?0;454 $this->tax_percentage = $tax_percentage ?: 0; 455 455 456 456 if ( $set_ref ) { -
svea-checkout-for-woocommerce/tags/3.3.0/inc/Models/Svea_Payment_Admin.php
r3172745 r3320066 77 77 * 78 78 * @param \WC_Order $wc_order WooCommerce order 79 * @param bool $admin Use the admin client80 79 */ 81 80 public function __construct( $wc_order = null ) { … … 219 218 * Add order row to existing order 220 219 * 221 * @param array $data222 * 220 * @param int $id 221 * @param array $row_data 223 222 * @return array 224 223 */ … … 297 296 * @param int $id 298 297 * @param array $data 299 * @return array298 * @return void 300 299 */ 301 300 public function deliver_order( $id, $data ) { -
svea-checkout-for-woocommerce/tags/3.3.0/inc/Template_Handler.php
r3309749 r3320066 27 27 add_action( 'wc_ajax_sco_change_payment_method', [ $this, 'change_payment_method' ], 100 ); 28 28 29 add_action( 'wc_ajax_sco_renew_nonce', [ $this, 'renew_checkout_nonce' ] ); 29 30 add_action( 'wc_ajax_sco_checkout_order', [ $this, 'sco_checkout_order' ] ); 30 31 … … 44 45 45 46 // Remove checkout fields if they are not needed 46 add_action( 'w oocommerce_checkout_before_order_review', [ $this, 'maybe_remove_checkout_fields' ]);47 add_action( 'wp', [ $this, 'maybe_remove_checkout_fields' ], 5 ); 47 48 48 49 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 → 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 49 196 } 50 197 … … 74 221 */ 75 222 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 } 77 232 wc_maybe_define_constant( 'WOOCOMMERCE_CHECKOUT', true ); 78 233 … … 152 307 */ 153 308 public function maybe_remove_checkout_fields() { 154 if ( $this->is_svea() ) {309 if ( $this->is_svea() && ! wp_doing_ajax() ) { 155 310 // 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 ); 157 312 add_filter( 'woocommerce_checkout_fields', [ $this, 'maybe_remove_order_comments_field' ] ); 158 313 } … … 277 432 278 433 /** @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(); 280 435 281 436 if ( ! empty( $available_gateways ) ) { … … 318 473 319 474 // 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' ) { 321 476 WC_Gateway_Svea_Checkout::log( sprintf( 'Order %s is not in final state, status: %s', $svea_order_id, $svea_checkout_module['Status'] ) ); 322 477 wp_safe_redirect( wc_get_checkout_url() ); … … 324 479 } 325 480 326 /** @var \Automattic\WooCommerce\Admin\Overrides\Order $ order */481 /** @var \Automattic\WooCommerce\Admin\Overrides\Order $wc_order */ 327 482 $wc_order = $wc_orders[0]; 328 483 … … 340 495 * Get the iframe snippet from Svea 341 496 * 342 * @return string497 * @return void 343 498 */ 344 499 public static function get_svea_snippet() { … … 647 802 648 803 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; 650 805 } 651 806 … … 732 887 * This function returns the Svea Checkout module. 733 888 * 734 * @param \WC_Cart $cart WooCommerce cart 735 * @return array|string The Svea Checkout snippet 889 * @return array The Svea Checkout snippet 736 890 */ 737 891 public static function get_svea_checkout_module() { -
svea-checkout-for-woocommerce/tags/3.3.0/inc/WC_Gateway_Svea_Checkout.php
r3264850 r3320066 46 46 47 47 /** 48 * List of activated customer types49 * 50 * @var array48 * String of activated customer type(s) 49 * 50 * @var string 51 51 */ 52 52 private $customer_types; … … 503 503 504 504 /** 505 * Is the nShift integration enabled?506 *507 * @return bool508 */509 public static function is_nshift_enabled() {510 return self::$nshift_enabled;511 }512 513 /**514 * Is zero sum enabled?515 *516 * @return bool517 */518 public static function is_zero_sum_enabled() {519 return self::$zero_sum_enabled;520 }521 522 /**523 * Get the store minimum age524 *525 * @return int526 */527 public static function get_store_minimum_age() {528 return (int) self::$store_minimum_age;529 }530 531 /**532 * Get the shipping options html533 *534 * @param string $key535 * @param array $value536 * @param array $field537 * @return string538 */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 <?php564 565 $html = ob_get_clean();566 return $html;567 }568 569 /**570 * Get the name of the payment method571 *572 * @param string $key573 * @return string574 */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 reference587 *588 * @param string $key589 * @return string590 */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 /**602 505 * Add hooks 603 506 * … … 608 511 add_action( 'woocommerce_order_details_after_order_table', [ $this, 'svea_co_display_extra_order_meta' ], 11 ); 609 512 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' ] ); 611 514 add_action( 'woocommerce_update_options_payment_gateways_' . $this->id, [ $this, 'clear_merchant_validation_cache' ] ); 612 515 … … 637 540 638 541 // 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' ] ); 641 544 642 545 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 ); 643 605 } 644 606 … … 651 613 public function cancel_subscription( $wc_order ) { 652 614 if ( empty( $wc_order->get_meta( '_svea_co_token' ) ) ) { 653 return false;615 return; 654 616 } 655 617 … … 683 645 'woocommerce_subscriptions_paid_for_failed_renewal_order', 684 646 [ \WC_Subscriptions_Change_Payment_Gateway::class, 'change_failing_payment_method' ], 685 10, 686 2 647 10 687 648 ); 688 649 } … … 732 693 * @param array $values 733 694 * @param \WC_Order $wc_order 734 * @return \WC_Order_Item695 * @return void 735 696 */ 736 697 public function append_cart_item_key_to_order_row( $item, $cart_item_key, $values, $wc_order ) { … … 738 699 $item->update_meta_data( '_svea_co_cart_key', $cart_item_key ); 739 700 } 740 741 return $item;742 701 } 743 702 … … 749 708 * @param array $package 750 709 * @param \WC_Order $wc_order 751 * @return \WC_Order_Item_Shipping710 * @return void 752 711 */ 753 712 public function append_cart_item_key_to_order_row_shipping( $item, $package_key, $package, $wc_order ) { … … 760 719 } 761 720 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 ); 763 722 } 764 723 … … 798 757 * 799 758 * @param array $merchant_data Merchant data to fetch part payment plans for 800 * @return array| WP_Error List of payment plan campaigns759 * @return array|\WP_Error List of payment plan campaigns 801 760 */ 802 761 public function get_part_payment_plans( $merchant_data ) { 803 804 762 // Get campaigns from cache to save bandwidth and loading time 805 763 $campaigns = get_transient( sprintf( self::PART_PAYMENT_TRANSIENT_FORMAT, $merchant_data['CountryCode'] ) ); … … 1191 1149 1192 1150 /** 1193 * Get the customer type s(both|company|individual)1194 * 1195 * @return string []1151 * Get the customer type(s) (both|company|individual) 1152 * 1153 * @return string 1196 1154 */ 1197 1155 public function get_customer_types() { … … 1469 1427 1470 1428 // Map row ID's in Svea to WooCommerce 1471 if ( ! empty( $wc_order ) &&is_array( $item_mapping ) ) {1429 if ( is_array( $item_mapping ) ) { 1472 1430 $wc_items = $wc_order->get_items( [ 'line_item', 'fee', 'shipping' ] ); 1473 1431 … … 1934 1892 } 1935 1893 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(); 1937 1895 1938 1896 return $this->process_refund( $order_id, $refund_amount ); -
svea-checkout-for-woocommerce/tags/3.3.0/inc/WC_Shipping_Svea_Nshift.php
r3172745 r3320066 38 38 $this->init(); 39 39 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' ] ); 41 41 add_action( 'woocommerce_cart_emptied', [ $this, 'clear_session' ] ); 42 42 } … … 67 67 */ 68 68 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 ); 76 70 } 77 71 -
svea-checkout-for-woocommerce/tags/3.3.0/inc/Webhook_Handler.php
r3264850 r3320066 157 157 self::$svea_order = $svea_order->get( $webhook_data->orderId ); 158 158 } 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() ) ); 160 160 status_header( 404 ); 161 161 exit; … … 231 231 } 232 232 233 $this->svea_order_id = sanitize_text_field( $_GET['svea_order_id'] ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended233 $this->svea_order_id = (int) sanitize_text_field( $_GET['svea_order_id'] ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended 234 234 235 235 $this->gateway::log( sprintf( 'Validation callback for Svea order ID (%s) received', $this->svea_order_id ) ); … … 336 336 * 337 337 * @param string $msg Message 338 * @param string$valid Valid or not338 * @param bool $valid Valid or not 339 339 * @param string $order_number Client order number 340 340 * @return void … … 355 355 356 356 wp_send_json( $response ); 357 die;358 357 } 359 358 … … 614 613 615 614 $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 ) ); 617 616 618 617 $this->gateway::log( sprintf( 'Push callback finalized order. Svea ID:%s OrderID: %s', $this->svea_order_id, $wc_order->get_id() ) ); … … 624 623 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 ] ); 625 624 } else { 626 $wc_order->payment_complete( $this->svea_order_id );625 $wc_order->payment_complete( (string) $this->svea_order_id ); 627 626 } 628 627 … … 808 807 809 808 // Update the cost and taxes 810 $shipping_item->set_total( $shipping_fee );809 $shipping_item->set_total( (string) $shipping_fee ); 811 810 $shipping_item->set_taxes( $actual_taxes ); 812 811 $shipping_item->delete_meta_data( 'nshift_taxes' ); -
svea-checkout-for-woocommerce/tags/3.3.0/readme.txt
r3309749 r3320066 10 10 License: Apache 2.0 11 11 License URI: https://www.apache.org/licenses/LICENSE-2.0 12 Stable tag: 3. 2.512 Stable tag: 3.3.0 13 13 14 14 Supercharge your WooCommerce Store with powerful features to pay via Svea Checkout! … … 71 71 2. Check the box **Display product part payment module** 72 72 3. Select where on the page you want to display the module 73 4. View the part payment module on the product page for elig able products. If the module is not displayed it might be due to the price since part payment plans often require a minimum amount.73 4. 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. 74 74 75 75 There'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 = 78 For support, please check the [support forum](https://wordpress.org/support/plugin/svea-checkout-for-woocommerce/) to see if your question has already been answered. 79 If 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/ 80 If 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/ 76 81 77 82 == Installation == … … 86 91 == Upgrade Notice == 87 92 93 = 3.3.0 = 94 3.3.0 is a minor release 95 88 96 = 3.2.5 = 89 97 3.2.5 is a patch release … … 376 384 377 385 == 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 378 391 379 392 = 3.2.5 2025-06-11 = -
svea-checkout-for-woocommerce/tags/3.3.0/svea-checkout-for-woocommerce.php
r3309749 r3320066 14 14 * Plugin URI: https://wordpress.org/plugins/svea-checkout-for-woocommerce/ 15 15 * Description: Process payments in WooCommerce via Svea Checkout. 16 * Version: 3. 2.516 * Version: 3.3.0 17 17 * Requires Plugins: woocommerce 18 18 * Author: The Generation AB … … 47 47 * Version of plugin 48 48 */ 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'; 60 50 61 51 /** … … 146 136 */ 147 137 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' ); 150 140 } 151 141 -
svea-checkout-for-woocommerce/tags/3.3.0/templates/backend/metabox.php
r3172745 r3320066 1 <?php if ( $is_awaiting_status ) : ?> 1 <?php 2 if ( ! defined( 'ABSPATH' ) ) { exit; } // Exit if accessed directly 3 4 if ( isset( $is_awaiting_status ) && $is_awaiting_status ) : ?> 2 5 <p> 3 6 <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 22 22 <p class="form-row form-row-wide create-account"> 23 23 <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> 25 25 </label> 26 26 </p> -
svea-checkout-for-woocommerce/tags/3.3.0/templates/svea-checkout.php
r3281259 r3320066 99 99 100 100 <?php if ( 101 count( WC()->payment_gateways ->get_available_payment_gateways() ) > 1 &&101 count( WC()->payment_gateways()->get_available_payment_gateways() ) > 1 && 102 102 apply_filters( 'woocommerce_sco_show_change_payment_button', true ) 103 103 ) : ?> -
svea-checkout-for-woocommerce/tags/3.3.0/vendor/autoload.php
r3281259 r3320066 20 20 require_once __DIR__ . '/composer/autoload_real.php'; 21 21 22 return ComposerAutoloaderInit 9ff79c494c0893bca5aca8141f25854b::getLoader();22 return ComposerAutoloaderInit4cfdf47045179a2c4f6ff86b1bce3df2::getLoader(); -
svea-checkout-for-woocommerce/tags/3.3.0/vendor/composer/autoload_classmap.php
r3264850 r3320066 131 131 'Svea\\Checkout\\Implementation\\Admin\\ReplaceOrderRows' => $vendorDir . '/sveaekonomi/checkout/src/Implementation/Admin/ReplaceOrderRows.php', 132 132 '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', 133 134 'Svea\\Checkout\\Implementation\\CreateOrder' => $vendorDir . '/sveaekonomi/checkout/src/Implementation/CreateOrder.php', 134 135 'Svea\\Checkout\\Implementation\\CreateTokenOrder' => $vendorDir . '/sveaekonomi/checkout/src/Implementation/CreateTokenOrder.php', … … 162 163 'Svea\\Checkout\\Validation\\Admin\\ValidateReplaceOrderRowsData' => $vendorDir . '/sveaekonomi/checkout/src/Validation/Admin/ValidateReplaceOrderRowsData.php', 163 164 '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', 164 166 'Svea\\Checkout\\Validation\\ValidateCreateOrderData' => $vendorDir . '/sveaekonomi/checkout/src/Validation/ValidateCreateOrderData.php', 165 167 'Svea\\Checkout\\Validation\\ValidateCreateTokenOrderData' => $vendorDir . '/sveaekonomi/checkout/src/Validation/ValidateCreateTokenOrderData.php', … … 198 200 'Svea_Checkout_For_Woocommerce\\Compat\\WPC_Product_Bundles_Compat' => $baseDir . '/inc/Compat/WPC_Product_Bundles_Compat.php', 199 201 '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', 200 203 'Svea_Checkout_For_Woocommerce\\Helper' => $baseDir . '/inc/Helper.php', 201 204 'Svea_Checkout_For_Woocommerce\\I18n' => $baseDir . '/inc/I18n.php', -
svea-checkout-for-woocommerce/tags/3.3.0/vendor/composer/autoload_real.php
r3172745 r3320066 3 3 // autoload_real.php @generated by Composer 4 4 5 class ComposerAutoloaderInit 9ff79c494c0893bca5aca8141f25854b5 class ComposerAutoloaderInit4cfdf47045179a2c4f6ff86b1bce3df2 6 6 { 7 7 private static $loader; … … 25 25 require __DIR__ . '/platform_check.php'; 26 26 27 spl_autoload_register(array('ComposerAutoloaderInit 9ff79c494c0893bca5aca8141f25854b', 'loadClassLoader'), true, true);27 spl_autoload_register(array('ComposerAutoloaderInit4cfdf47045179a2c4f6ff86b1bce3df2', 'loadClassLoader'), true, true); 28 28 self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__)); 29 spl_autoload_unregister(array('ComposerAutoloaderInit 9ff79c494c0893bca5aca8141f25854b', 'loadClassLoader'));29 spl_autoload_unregister(array('ComposerAutoloaderInit4cfdf47045179a2c4f6ff86b1bce3df2', 'loadClassLoader')); 30 30 31 31 require __DIR__ . '/autoload_static.php'; 32 call_user_func(\Composer\Autoload\ComposerStaticInit 9ff79c494c0893bca5aca8141f25854b::getInitializer($loader));32 call_user_func(\Composer\Autoload\ComposerStaticInit4cfdf47045179a2c4f6ff86b1bce3df2::getInitializer($loader)); 33 33 34 34 $loader->register(true); 35 35 36 $filesToLoad = \Composer\Autoload\ComposerStaticInit 9ff79c494c0893bca5aca8141f25854b::$files;36 $filesToLoad = \Composer\Autoload\ComposerStaticInit4cfdf47045179a2c4f6ff86b1bce3df2::$files; 37 37 $requireFile = \Closure::bind(static function ($fileIdentifier, $file) { 38 38 if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { -
svea-checkout-for-woocommerce/tags/3.3.0/vendor/composer/autoload_static.php
r3264850 r3320066 5 5 namespace Composer\Autoload; 6 6 7 class ComposerStaticInit 9ff79c494c0893bca5aca8141f25854b7 class ComposerStaticInit4cfdf47045179a2c4f6ff86b1bce3df2 8 8 { 9 9 public static $files = array ( … … 194 194 'Svea\\Checkout\\Implementation\\Admin\\ReplaceOrderRows' => __DIR__ . '/..' . '/sveaekonomi/checkout/src/Implementation/Admin/ReplaceOrderRows.php', 195 195 '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', 196 197 'Svea\\Checkout\\Implementation\\CreateOrder' => __DIR__ . '/..' . '/sveaekonomi/checkout/src/Implementation/CreateOrder.php', 197 198 'Svea\\Checkout\\Implementation\\CreateTokenOrder' => __DIR__ . '/..' . '/sveaekonomi/checkout/src/Implementation/CreateTokenOrder.php', … … 225 226 'Svea\\Checkout\\Validation\\Admin\\ValidateReplaceOrderRowsData' => __DIR__ . '/..' . '/sveaekonomi/checkout/src/Validation/Admin/ValidateReplaceOrderRowsData.php', 226 227 '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', 227 229 'Svea\\Checkout\\Validation\\ValidateCreateOrderData' => __DIR__ . '/..' . '/sveaekonomi/checkout/src/Validation/ValidateCreateOrderData.php', 228 230 'Svea\\Checkout\\Validation\\ValidateCreateTokenOrderData' => __DIR__ . '/..' . '/sveaekonomi/checkout/src/Validation/ValidateCreateTokenOrderData.php', … … 261 263 'Svea_Checkout_For_Woocommerce\\Compat\\WPC_Product_Bundles_Compat' => __DIR__ . '/../..' . '/inc/Compat/WPC_Product_Bundles_Compat.php', 262 264 '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', 263 266 'Svea_Checkout_For_Woocommerce\\Helper' => __DIR__ . '/../..' . '/inc/Helper.php', 264 267 'Svea_Checkout_For_Woocommerce\\I18n' => __DIR__ . '/../..' . '/inc/I18n.php', … … 283 286 { 284 287 return \Closure::bind(function () use ($loader) { 285 $loader->prefixLengthsPsr4 = ComposerStaticInit 9ff79c494c0893bca5aca8141f25854b::$prefixLengthsPsr4;286 $loader->prefixDirsPsr4 = ComposerStaticInit 9ff79c494c0893bca5aca8141f25854b::$prefixDirsPsr4;287 $loader->classMap = ComposerStaticInit 9ff79c494c0893bca5aca8141f25854b::$classMap;288 $loader->prefixLengthsPsr4 = ComposerStaticInit4cfdf47045179a2c4f6ff86b1bce3df2::$prefixLengthsPsr4; 289 $loader->prefixDirsPsr4 = ComposerStaticInit4cfdf47045179a2c4f6ff86b1bce3df2::$prefixDirsPsr4; 290 $loader->classMap = ComposerStaticInit4cfdf47045179a2c4f6ff86b1bce3df2::$classMap; 288 291 289 292 }, null, ClassLoader::class); -
svea-checkout-for-woocommerce/tags/3.3.0/vendor/composer/installed.json
r3202226 r3320066 3 3 { 4 4 "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", 7 7 "source": { 8 8 "type": "git", 9 9 "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", 16 16 "shasum": "" 17 17 }, … … 40 40 "psr/log": "Required for using the Log middleware" 41 41 }, 42 "time": "202 4-07-24T11:22:20+00:00",42 "time": "2025-03-27T13:37:11+00:00", 43 43 "type": "library", 44 44 "extra": { … … 112 112 "support": { 113 113 "issues": "https://github.com/guzzle/guzzle/issues", 114 "source": "https://github.com/guzzle/guzzle/tree/7.9. 2"114 "source": "https://github.com/guzzle/guzzle/tree/7.9.3" 115 115 }, 116 116 "funding": [ … … 132 132 { 133 133 "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", 136 136 "source": { 137 137 "type": "git", 138 138 "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", 145 145 "shasum": "" 146 146 }, … … 152 152 "phpunit/phpunit": "^8.5.39 || ^9.6.20" 153 153 }, 154 "time": "202 4-10-17T10:06:22+00:00",154 "time": "2025-03-27T13:27:01+00:00", 155 155 "type": "library", 156 156 "extra": { … … 198 198 "support": { 199 199 "issues": "https://github.com/guzzle/promises/issues", 200 "source": "https://github.com/guzzle/promises/tree/2. 0.4"200 "source": "https://github.com/guzzle/promises/tree/2.2.0" 201 201 }, 202 202 "funding": [ … … 218 218 { 219 219 "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", 222 222 "source": { 223 223 "type": "git", 224 224 "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", 231 231 "shasum": "" 232 232 }, … … 249 249 "laminas/laminas-httphandlerrunner": "Emit PSR-7 responses" 250 250 }, 251 "time": "202 4-07-18T11:15:46+00:00",251 "time": "2025-03-27T12:30:47+00:00", 252 252 "type": "library", 253 253 "extra": { … … 317 317 "support": { 318 318 "issues": "https://github.com/guzzle/psr7/issues", 319 "source": "https://github.com/guzzle/psr7/tree/2.7. 0"319 "source": "https://github.com/guzzle/psr7/tree/2.7.1" 320 320 }, 321 321 "funding": [ … … 553 553 { 554 554 "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", 557 557 "source": { 558 558 "type": "git", 559 559 "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", 566 566 "shasum": "" 567 567 }, … … 579 579 "symfony/dependency-injection": "^2.7.51 || ^2.8.50 || ^3.4.26 || ^4.1.12 || ^4.2.7" 580 580 }, 581 "time": "202 4-11-13T10:20:09+00:00",581 "time": "2025-06-30T13:03:15+00:00", 582 582 "type": "library", 583 583 "installation-source": "dist", … … 600 600 "support": { 601 601 "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" 603 603 }, 604 604 "install-path": "../sveaekonomi/checkout" … … 684 684 "type": "library", 685 685 "extra": { 686 "thanks": { 687 "url": "https://github.com/symfony/contracts", 688 "name": "symfony/contracts" 689 }, 686 690 "branch-alias": { 687 691 "dev-main": "3.0-dev" 688 },689 "thanks": {690 "name": "symfony/contracts",691 "url": "https://github.com/symfony/contracts"692 692 } 693 693 }, -
svea-checkout-for-woocommerce/tags/3.3.0/vendor/composer/installed.php
r3202226 r3320066 12 12 'versions' => array( 13 13 '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', 17 17 'type' => 'library', 18 18 'install_path' => __DIR__ . '/../guzzlehttp/guzzle', … … 21 21 ), 22 22 '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', 26 26 'type' => 'library', 27 27 'install_path' => __DIR__ . '/../guzzlehttp/promises', … … 30 30 ), 31 31 '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', 35 35 'type' => 'library', 36 36 'install_path' => __DIR__ . '/../guzzlehttp/psr7', … … 93 93 ), 94 94 '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', 98 98 'type' => 'library', 99 99 'install_path' => __DIR__ . '/../sveaekonomi/checkout', -
svea-checkout-for-woocommerce/tags/3.3.0/vendor/guzzlehttp/guzzle/CHANGELOG.md
r3172745 r3320066 2 2 3 3 Please 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 4 12 5 13 -
svea-checkout-for-woocommerce/tags/3.3.0/vendor/guzzlehttp/guzzle/src/Cookie/SetCookie.php
r3088414 r3320066 63 63 $data[$search] = (int) $value; 64 64 } 65 } elseif ($search === 'Secure' || $search === 'Discard' || $search === 'HttpOnly') { 66 if ($value) { 67 $data[$search] = true; 68 } 65 69 } else { 66 70 $data[$search] = $value; -
svea-checkout-for-woocommerce/tags/3.3.0/vendor/guzzlehttp/guzzle/src/Handler/Proxy.php
r3088414 r3320066 18 18 * requests to another handler. 19 19 * 20 * @param callable( \Psr\Http\Message\RequestInterface, array): \GuzzleHttp\Promise\PromiseInterface $default Handler used for normal responses21 * @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. 22 22 * 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. 24 24 */ 25 25 public static function wrapSync(callable $default, callable $sync): callable … … 38 38 * through the StreamHandler. 39 39 * 40 * @param callable( \Psr\Http\Message\RequestInterface, array): \GuzzleHttp\Promise\PromiseInterface $default Handler used for non-streaming responses41 * @param callable( \Psr\Http\Message\RequestInterface, array): \GuzzleHttp\Promise\PromiseInterface $streaming Handler used for streaming responses40 * @param callable(RequestInterface, array): PromiseInterface $default Handler used for non-streaming responses 41 * @param callable(RequestInterface, array): PromiseInterface $streaming Handler used for streaming responses 42 42 * 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. 44 44 */ 45 45 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 54 54 55 55 // 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 ) { 58 64 $request = $request->withHeader('Content-Length', '0'); 59 65 } -
svea-checkout-for-woocommerce/tags/3.3.0/vendor/guzzlehttp/guzzle/src/Pool.php
r3088414 r3320066 87 87 * @param array|\Iterator $requests Requests to send concurrently. 88 88 * @param array $options Passes through the options available in 89 * {@see \GuzzleHttp\Pool::__construct}89 * {@see Pool::__construct} 90 90 * 91 91 * @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 80 80 * The returned handler is not wrapped by any default middlewares. 81 81 * 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. 83 83 * 84 84 * @throws \RuntimeException if no viable Handler is available. -
svea-checkout-for-woocommerce/tags/3.3.0/vendor/guzzlehttp/guzzle/src/functions.php
r3088414 r3320066 51 51 * The returned handler is not wrapped by any default middlewares. 52 52 * 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. 54 54 * 55 55 * @throws \RuntimeException if no viable Handler is available. -
svea-checkout-for-woocommerce/tags/3.3.0/vendor/guzzlehttp/promises/CHANGELOG.md
r3172745 r3320066 1 1 # 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 2 16 3 17 -
svea-checkout-for-woocommerce/tags/3.3.0/vendor/guzzlehttp/psr7/CHANGELOG.md
r3172745 r3320066 5 5 The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) 6 6 and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). 7 8 ## 2.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 7 17 8 18 ## 2.7.0 - 2024-07-18 -
svea-checkout-for-woocommerce/tags/3.3.0/vendor/guzzlehttp/psr7/src/UploadedFile.php
r3172745 r3320066 12 12 class UploadedFile implements UploadedFileInterface 13 13 { 14 private const ERROR S= [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', 23 23 ]; 24 24 … … 105 105 private function setError(int $error): void 106 106 { 107 if ( false === in_array($error, UploadedFile::ERRORS, true)) {107 if (!isset(UploadedFile::ERROR_MAP[$error])) { 108 108 throw new InvalidArgumentException( 109 109 'Invalid error status for UploadedFile' … … 138 138 { 139 139 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])); 141 141 } 142 142 -
svea-checkout-for-woocommerce/tags/3.3.0/vendor/guzzlehttp/psr7/src/Uri.php
r3172745 r3320066 108 108 // If IPv6 109 109 $prefix = ''; 110 if (preg_match('%^(.*://\[[0-9:a-f ]+\])(.*?)$%', $url, $matches)) {110 if (preg_match('%^(.*://\[[0-9:a-fA-F]+\])(.*?)$%', $url, $matches)) { 111 111 /** @var array{0:string, 1:string, 2:string} $matches */ 112 112 $prefix = $matches[1]; -
svea-checkout-for-woocommerce/tags/3.3.0/vendor/sveaekonomi/checkout/README.md
r2983864 r3320066 9 9 * [6. Create recurring order](#6-create-recurring-order) 10 10 * [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) 17 18 ## Introduction 18 19 The 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. 19 20 20 21 21 The checkout supports both B2C and B2B payments, fast customer identification and caches customers behavio ur.22 The checkout supports both B2C and B2B payments, fast customer identification and caches customers behavior. 22 23 23 24 … … 135 136 | IdentityFlags | | Array of [*IdentityFlags*](#1012-identityflags) | Array of [*IdentityFlags*](#812-identityflags) used to hide certain features of the iframe | 136 137 | 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 av ilable 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) | 138 139 | MerchantData | | String | Metadata visible in the checkout API, returned when the order is fetched through the API. | 139 140 … … 375 376 ``` 376 377 377 ### 8. Response 378 ### 8. Change payment method for recurring order 379 Svea Checkout allows you to let customers change the payment method for an existing recurring order. 380 This 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 387 You use the changePaymentMethod endpoint via the \Svea\Checkout\CheckoutClient. 388 This will generate a new checkout session where the customer can select a new payment method. 389 Once 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 394 include 'vendor/autoload.php'; 395 396 // without composer 397 require_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; 410 echo $sveaCheckoutIframe ?: ''; 411 ``` 412 413 After 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 378 416 The response contains information about the order such as Cart, Status, PaymentType and much more. 379 417 … … 542 580 echo $response['Gui']['Snippet'] 543 581 ``` 544 ### 9. Additional requests545 546 #### 9.1 GetAvailablePartPaymentCampaigns582 ### 10. Additional requests 583 584 #### 10.1 GetAvailablePartPaymentCampaigns 547 585 548 586 GetAvailablePartPaymentCampaigns can be used to fetch the details of all the campaigns that are available on the merchant … … 635 673 If 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. 636 674 637 ### 1 0. Data structures638 639 #### 1 0.1 MerchantSettings675 ### 11. Data structures 676 677 #### 11.1 MerchantSettings 640 678 641 679 | Parameters | Required | Type | Description | Limits | 642 680 |------------------------------|-----------|-----------|--------------|---------| 643 | TermsUri | * | string | URI to a page which contains terms of the web shop. | 1-500 characters, must be a valid Url |644 | CheckoutUri | * | string | URI to the page in the web shop that loads the Checkout. | 1-500 characters, must be a valid Url |645 | 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 |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 | 646 684 | 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 | 647 685 | 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 | … … 649 687 | 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 | 650 688 651 #### 1 0.2 Items689 #### 11.2 Items 652 690 653 691 | Parameters | Required | Type | Description | … … 655 693 | Items | * | List of [*OrderRows*](#103-orderrow) | See structure below | 656 694 657 #### 1 0.3 OrderRow695 #### 11.3 OrderRow 658 696 659 697 | Parameters | Required | Type | Description | Limits | 660 698 |------------------------------|------------|-----------|--------------|---------| 661 | ArticleNumber | | String | Article number 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 | 662 700 | Name | * | String | Article name | 1-40 characters | 663 701 | Quantity | * | Integer | Set as basis point (1/100) e.g 2 = 200 | 1-9 digits. Minor currency | 664 702 | 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 discount percent of the product. | 0-100 |703 | DiscountPercent | | Integer | The discount percent of the product. | 0-100 | 666 704 | VatPercent | * | Integer | The VAT percentage of the current product. | Valid vat percentage for that country. Minor currency. | 667 705 | 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 temporaryreferenceas 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. | | 669 707 | MerchantData | | String | Can be used to store data, the data is not displayed anywhere but in the API 670 708 671 #### 1 0.4 PresetValue709 #### 11.4 PresetValue 672 710 673 711 | Parameters | Required | Type | Description | … … 685 723 | PhoneNumber | String | | 1-18 digits, can include “+”, “-“s and space | 686 724 | PostalCode | String | | Company specific validation | 687 | IsCompany | Boolean | | Required if nationalidis set |688 689 #### 1 0.5 Gui725 | IsCompany | Boolean | | Required if "nationalid" is set | 726 727 #### 11.5 Gui 690 728 691 729 | Parameters | Type | Description | … … 694 732 | Snippet | String | HTML-snippet including javascript to populate the iFrame. | 695 733 696 #### 1 0.6 Customer734 #### 11.6 Customer 697 735 698 736 | Parameters | Type | Description | 699 737 |------------------------------|-----------|--------------| 700 | NationalId | String | Personal- or organization number. |701 | IsCompany | Boolean | True if nationalId is organisation number, 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. | 702 740 | CountryCode | String | Defined by two-letter ISO 3166-1 alpha-2, i.e. SE, DE, FI etc.| 703 741 | Id | Integer | Customer-specific id | 704 742 705 #### 1 0.7 Address743 #### 11.7 Address 706 744 707 745 | Parameters | Type | Description | … … 718 756 | AddressLines | Array of strings | Null unless international flow is used 719 757 720 #### 1 0.8 CheckoutOrderStatus758 #### 11.8 CheckoutOrderStatus 721 759 722 760 The order can only be considered “ready to send to customer” when the CheckoutOrderStatus is Final. No other status can guarantee payment. … … 728 766 | 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| 729 767 730 #### 1 0.9 Locale768 #### 11.9 Locale 731 769 | Parameter | Description | 732 770 |-----------|-----------------| … … 739 777 740 778 741 #### 1 0.10 PaymentType779 #### 11.10 PaymentType 742 780 | Parameter | Description | 743 781 |-------------|-----------------| … … 755 793 | LEASINGUNAPPROVED | Leasing (Manual approve process by Sveas leasing department, check Store pay admin page) | 756 794 | LEASINGAPPROVED | Leasing (Automatically approved leasing contract) 757 | TRUSTLY | The customer pai ed with Trustly |795 | TRUSTLY | The customer paid with Trustly | 758 796 | Directbank (varies) | The customer paid the order with direct bank e.g. Nordea, SEB. See below for all available parameters | 759 797 … … 778 816 779 817 780 #### 1 0.11 CampaignCodeInfo818 #### 11.11 CampaignCodeInfo 781 819 | Parameter | Type | Description | 782 820 |---------------------------|-----------|-------------| … … 794 832 | PaymentPlanType | Integer | Type of campaign | 795 833 796 #### 1 0.12 IdentityFlags834 #### 11.12 IdentityFlags 797 835 | Parameter | Type | Description | 798 836 |---------------------------|-----------|-------------| … … 801 839 | HideAnonymous | Boolean | Hides anonymous flow, forcing users to identify with their nationalId to perform a purchase | 802 840 803 #### 1 0.13 CheckoutValidationCallbackResponse841 #### 11.13 CheckoutValidationCallbackResponse 804 842 If 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". 805 843 … … 811 849 | ClientOrderNumber | | String | Max 32 characters. Set if you want the ClientOrderNumber to be updated. | 812 850 813 ### 1 1. HttpStatusCodes851 ### 12. HttpStatusCodes 814 852 | Parameter | Type | Description | 815 853 |-----------|---------------|-------------| … … 827 865 If the returned ResultCode is not present in the above tables please contact Svea Ekonomi for further information. 828 866 829 ## 1 2. Order administration867 ## 13. Order administration 830 868 831 869 [See full examples](examples/admin) … … 843 881 \Exception - For any other error 844 882 845 ### 1 2.1 Get order883 ### 13.1 Get order 846 884 This method is used to get the entire order with all its relevant information. Including its deliveries, rows, credits and addresses. 847 885 … … 856 894 | Parameters OUT | Type | Description | 857 895 |-------------------------------|-----------|--------------| 858 | Order | array | An array containing all the order details. See [1 2.14 Data objects](#1215-data-objects) |859 860 861 862 ### 1 2.2 Get task896 | 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 863 901 A task will explain the status of a previously performed operation. When finished it will point towards the new resource with the Location. 864 902 #### Parameters … … 874 912 | Task | [Task](#12154-task) | An object containing details regarding a queued task | 875 913 876 ### 1 2.3 Deliver order914 ### 13.3 Deliver order 877 915 Creates a delivery on a checkout order. Assuming the order got the **CanDeliverOrder** action. 878 916 … … 894 932 | HeaderLocation | string | URI to the created task. (Absolute URL) | 895 933 896 ### 1 2.3.1 Row Delivery Options934 ### 13.3.1 Row Delivery Options 897 935 898 936 | Parameter | Type | Description | … … 901 939 | quantity | int | Number of items to credit | 902 940 903 ### 1 2.4 Deliver order with lower amount941 ### 13.4 Deliver order with lower amount 904 942 Creates 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. 905 943 … … 918 956 | HeaderLocation | string | URI to the created task (Absolute URL) | 919 957 920 ### 1 2.5 Cancel Order958 ### 13.5 Cancel Order 921 959 Cancel an order before it has been delivered. Assuming the order has the action **CanCancelOrder**. 922 960 … … 930 968 If the order is successfully cancelled, Response is empty. 931 969 932 ### 1 2.6 Cancel order amount970 ### 13.6 Cancel order amount 933 971 By specifying a higher amount than the current order cancelled amount then the order cancelled amount will increase, 934 972 assuming the order has the action **CanCancelOrderAmount**. The delta between the new *CancelledAmount* and the former *CancelledAmount* will be cancelled. … … 946 984 If order amount is successfully cancelled, Response is empty. 947 985 948 ### 1 2.7 Cancel order row986 ### 13.7 Cancel order row 949 987 Changes the status of an order row to *Cancelled*, assuming the order has the action **CanCancelOrderRow** and the OrderRow has the action **CanCancelRow**. 950 988 … … 959 997 If order row is successfully cancelled, Response is empty. 960 998 961 ### 1 2.8 Credit order rows999 ### 13.8 Credit order rows 962 1000 Creates 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** 963 1001 … … 977 1015 On the returned URL can be checked status of the task. 978 1016 979 ### 1 2.8.1 Row Crediting Options1017 ### 13.8.1 Row Crediting Options 980 1018 981 1019 | Parameter | Type | Description | … … 984 1022 | quantity | int | Number of items to credit | 985 1023 986 ### 1 2.9 Credit new order row1024 ### 13.9 Credit new order row 987 1025 By specifying a new credit row, a new credit row will be created on the delivery, assuming the delivery has action **CanCreditNewRow**. 988 1026 … … 1001 1039 On the returned URL can be checked status of the task. 1002 1040 1003 ### 1 2.10 Credit order rows with fee1041 ### 13.10 Credit order rows with fee 1004 1042 Creates 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. 1005 1043 … … 1019 1057 1020 1058 On the returned URL can be checked status of the task. 1021 ### 1 2.11 Credit amount1059 ### 13.11 Credit amount 1022 1060 By 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. 1023 1061 … … 1034 1072 If order amount is successfully credited, Response is empty. 1035 1073 1036 ### 1 2.12 Add order row1074 ### 13.12 Add order row 1037 1075 This method is used to add order rows to an order, assuming the order has the action **CanAddOrderRow**. 1038 1076 If the new order amount will exceed the current order amount, a credit check will be performed. … … 1052 1090 On the returned URL (HeaderLocation) can be checked status of the task. 1053 1091 1054 ### 1 2.13 Update order row1092 ### 13.13 Update order row 1055 1093 This method is used to update an order row, assuming the order has action "CanUpdateOrderRow" and the order row has the action **CanUpdateRow**. 1056 1094 The method will update all fields set in the payload, if a field is not set the row will keep the current value. … … 1067 1105 If order row is successfully updated, Response is empty. 1068 1106 1069 ### 1 2.14 Replace order rows1107 ### 13.14 Replace order rows 1070 1108 This method is used to update an order row, assuming the order has action "CanUpdateOrderRow". 1071 1109 This method will delete all the present rows and replace with the ones set in the payload. … … 1082 1120 1083 1121 1084 ### 1 2.15 Data objects1085 1086 #### 1 2.15.1 Order1122 ### 13.15 Data objects 1123 1124 #### 13.15.1 Order 1087 1125 | Parameter | Type | Description | 1088 1126 |-----------------------|---------------|-----------------------------------------------------------| … … 1095 1133 | 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.| 1096 1134 | CreationDate | DateTime | Date and time when the order was created| 1097 | NationalId | string | Personal- or organization number.|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.| 1099 1137 | OrderAmount | int | The total amount on the order. Minor unit| 1100 1138 | CancelledAmount | int | The total cancelled amount on the order. Minor uit| … … 1105 1143 | Actions | List of String | A list of actions possible on the order.| 1106 1144 1107 #### 1 2.15.2 Delivery1145 #### 13.15.2 Delivery 1108 1146 1109 1147 | Parameter | Type | Description | … … 1118 1156 | Actions | List of string | A list of actions possible on the delivery.| 1119 1157 1120 #### 1 2.15.3 Credit1158 #### 13.15.3 Credit 1121 1159 1122 1160 | Parameter | Type | Description | … … 1126 1164 | Actions | List of String | A list of actions possible on the credit.| 1127 1165 1128 #### 1 2.15.4 Task1166 #### 13.15.4 Task 1129 1167 1130 1168 | Parameter | Type | Description | … … 1133 1171 | Status | String | Status of the task | 1134 1172 1135 #### 1 2.15.5 Order Row1173 #### 13.15.5 Order Row 1136 1174 1137 1175 |Parameter |R | RO | Type | Description | Limits| 1138 1176 |-----------------------|---|----|----------|-------------------------------|-------------------| 1139 1177 | OrderRowId | | * |int | Order row id from underlying system, unique on order. | Not possible to set through API, only get.| 1140 | ArticleNumber | | |string | Article number 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. | 1141 1179 | Name | * | |string | Article name. | 1-40 characters. | 1142 1180 | Quantity | * | |int | Quantity of the product. | 1-9 digits. Minor unit.| 1143 1181 | UnitPrice | * | |int | Price of the product including VAT. | 1-13 digits, can be negative. Minor currency.| 1144 | DiscountPercent | | |int | The discount percent of the product. | 0-9900. Minor unit|1182 | DiscountPercent | | |int | The discount percent of the product. | 0-9900. Minor unit| 1145 1183 | VatPercent | * | |int | The VAT percentage of the current product. | Valid vat percentage for that country . Minor unit.0-10000| 1146 1184 | Unit | | |string | The unit type, e.g., “st”, “pc”, “kg” etc. | 0-4 characters. | … … 1148 1186 | 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.| 1149 1187 1150 #### 1 2.15.6 Address1188 #### 13.15.6 Address 1151 1189 1152 1190 | Parameter | Type | Description | … … 1159 1197 | CountryCode | string | 2-letter ISO country code | 1160 1198 1161 #### 1 2.15.7 Order Status1199 #### 13.15.7 Order Status 1162 1200 1163 1201 | Parameter | Description | … … 1168 1206 | Failed | The payment for this order has failed | 1169 1207 1170 #### 1 2.15.8 Order actions1208 #### 13.15.8 Order actions 1171 1209 1172 1210 | Parameter | Description | … … 1180 1218 | CanUpdateOrderRow || 1181 1219 1182 #### 1 2.15.9 Delivery actions1220 #### 13.15.9 Delivery actions 1183 1221 1184 1222 | Parameter | Description | … … 1188 1226 | CanCreditAmount || 1189 1227 1190 #### 1 2.15.10 Order Row actions1228 #### 13.15.10 Order Row actions 1191 1229 1192 1230 | Parameter | Description | … … 1197 1235 | CanUpdateRow || 1198 1236 1199 ## 1 3. Javascript API1237 ## 14. Javascript API 1200 1238 1201 1239 (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.21 1.6.0 -
svea-checkout-for-woocommerce/tags/3.3.0/vendor/sveaekonomi/checkout/composer.json
r3202226 r3320066 1 1 { 2 2 "name": "sveaekonomi/checkout", 3 "version": "1. 5.3",3 "version": "1.6.0", 4 4 "description": "Php integration library for Svea Checkout", 5 5 "license": "Apache-2.0", … … 26 26 "phploc/phploc": "^2.0.1", 27 27 "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" 29 29 }, 30 30 "scripts": { -
svea-checkout-for-woocommerce/tags/3.3.0/vendor/sveaekonomi/checkout/src/CheckoutClient.php
r2983864 r3320066 70 70 71 71 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 72 84 } 73 85 -
svea-checkout-for-woocommerce/tags/3.3.0/vendor/sveaekonomi/checkout/src/Implementation/ImplementationFactory.php
r2983864 r3320066 5 5 use Svea\Checkout\Transport\Connector; 6 6 use Svea\Checkout\Validation\ValidateCreateOrderData; 7 use Svea\Checkout\Validation\ValidateChangePaymentMethodData; 7 8 use Svea\Checkout\Validation\ValidateCreateTokenOrderData; 8 9 use Svea\Checkout\Validation\ValidateGetOrderData; … … 17 18 /** 18 19 * @param Connector $connector 19 * @return ImplementationInterface20 * @return CreateOrder 20 21 */ 21 22 public static function returnCreateOrderClass(Connector $connector) … … 26 27 /** 27 28 * @param Connector $connector 28 * @return ImplementationInterface29 * @return CreateTokenOrder 29 30 */ 30 public static function returnCreateTokenOrderClass(Connector $connector) { 31 public static function returnCreateTokenOrderClass(Connector $connector) 32 { 31 33 return new CreateTokenOrder($connector, new ValidateCreateTokenOrderData()); 32 34 } … … 34 36 /** 35 37 * @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 37 48 */ 38 49 public static function returnGetOrderClass(Connector $connector) … … 43 54 /** 44 55 * @param Connector $connector 45 * @return ImplementationInterface56 * @return GetTokenOrder 46 57 */ 47 58 public static function returnGetTokenOrderClass(Connector $connector) … … 52 63 /** 53 64 * @param Connector $connector 54 * @return ImplementationInterface65 * @return GetToken 55 66 */ 56 67 public static function returnGetTokenClass(Connector $connector) … … 61 72 /** 62 73 * @param Connector $connector 63 * @return ImplementationInterface74 * @return UpdateToken 64 75 */ 65 76 public static function returnUpdateTokenClass(Connector $connector) … … 70 81 /** 71 82 * @param Connector $connector 72 * @return ImplementationInterface83 * @return UpdateOrder 73 84 */ 74 85 public static function returnUpdateOrderClass(Connector $connector) … … 79 90 /** 80 91 * @param Connector $connector 81 * @return ImplementationInterface92 * @return GetAvailablePartPaymentCampaigns 82 93 */ 83 94 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 56 56 add_action( 'add_meta_boxes', [ $this, 'add_metabox' ] ); 57 57 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 ); 59 59 60 60 add_filter( 'woocommerce_register_shop_order_post_statuses', [ $this, 'register_order_status' ] ); … … 68 68 add_action( 'woocommerce_order_status_' . self::AWAITING_ORDER_STATUS . '_to_completed_notification', [ $this, 'add_completed_email_trigger' ], 10, 2 ); 69 69 70 add_action( 'sco_check_pa_order_status', [ $this, 'c heck_pa_order_status' ] );70 add_action( 'sco_check_pa_order_status', [ $this, 'cron_check_pa_order_status' ] ); 71 71 72 72 add_filter( 'woocommerce_valid_order_statuses_for_payment_complete', [ $this, 'allow_awaiting_svea_status_to_be_completed' ] ); … … 86 86 add_action( 'woocommerce_process_product_meta', [ $this, 'save_product_fields' ] ); 87 87 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 ); 88 98 } 89 99 … … 312 322 public function check_pa_order_status( $order ) { 313 323 if ( is_numeric( $order ) ) { 314 /** @var \WC_Order $wc_order */315 324 $wc_order = Webhook_Handler::get_order_by_svea_id( $order ); 316 325 $svea_order_id = $order; 317 326 } else { 318 /** @var \WC_Order $wc_order */319 327 $wc_order = $order; 320 328 $svea_order_id = $wc_order->get_meta( '_svea_co_order_id' ); … … 334 342 } catch ( \Exception $e ) { 335 343 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' );341 344 return ''; 342 345 } … … 442 445 * Save some refs 443 446 * 444 * @param \ Automattic\WooCommerce\Admin\Overrides\Order $wc_order447 * @param \WC_Order $wc_order 445 448 * @param array $svea_order 446 449 * @return void … … 461 464 462 465 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'] ) ); 464 467 } 465 468 } … … 533 536 * Renders the metabox 534 537 * 535 * @param \WP_ post|\WC_Order $name538 * @param \WP_Post|\WC_Order $post_or_order_object 536 539 * @return void 537 540 */ … … 576 579 * 577 580 * @param \WC_Order_Item $order_item 578 * @return void581 * @return array 579 582 */ 580 583 public function get_order_row_data( $order_item ) { … … 612 615 */ 613 616 public function admin_remove_order_item( $order_item_id ) { 617 /** @var \WC_Order_Item_Data_Store $data_store */ 614 618 $data_store = \WC_Data_Store::load( 'order-item' ); 615 619 -
svea-checkout-for-woocommerce/trunk/inc/Compat/Compat.php
r3264850 r3320066 20 20 */ 21 21 public $polylang; 22 23 /**24 * WPML compatibility class25 *26 * @var WPML_Compat27 */28 public $wpml;29 22 30 23 /** -
svea-checkout-for-woocommerce/trunk/inc/Compat/Gift_Cards_For_WC_Compat.php
r3203722 r3320066 2 2 namespace Svea_Checkout_For_Woocommerce\Compat; 3 3 4 use Svea_Checkout_For_Woocommerce\Helper;5 4 use Svea_Checkout_For_Woocommerce\Models\Svea_Item; 6 5 -
svea-checkout-for-woocommerce/trunk/inc/Emails/Awaiting_Svea_Email.php
r3009386 r3320066 1 1 <?php 2 namespace Svea_Checkout_For_Woocommerce\Emails; 3 2 4 /** 3 5 * Class Awaiting_Svea_Email file. … … 17 19 * Customer awaiting further info from Svea 18 20 */ 19 class Awaiting_Svea_Email extends WC_Email {21 class Awaiting_Svea_Email extends \WC_Email { 20 22 21 23 /** -
svea-checkout-for-woocommerce/trunk/inc/Models/Svea_Checkout.php
r3264850 r3320066 90 90 * Setup Svea connector 91 91 * 92 * @param \WC_Cart $cart 92 * @param string $currency 93 * @param string $country 93 94 * @return void 94 95 */ … … 257 258 * Create a new order in Svea from the cart 258 259 * 259 * @param bool $force260 260 * @return array 261 261 */ … … 268 268 269 269 // Set preset values 270 if ( isset( $user_email ) &&! empty( $user_email ) ) {270 if ( ! empty( $user_email ) ) { 271 271 array_push( 272 272 $preset_values, … … 279 279 } 280 280 281 if ( isset( $user_zipcode ) &&! empty( $user_zipcode ) ) {281 if ( ! empty( $user_zipcode ) ) { 282 282 array_push( 283 283 $preset_values, … … 290 290 } 291 291 292 if ( isset( $user_phone ) &&! empty( $user_phone ) ) {292 if ( ! empty( $user_phone ) ) { 293 293 array_push( 294 294 $preset_values, … … 536 536 537 537 /** 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 /** 538 560 * Get the minimum age for the order (null if no restrictions) 539 561 * … … 547 569 * Get the plugin version 548 570 * 549 * @return void571 * @return string 550 572 */ 551 573 public function get_plugin_version() { … … 556 578 * Get merchant settings 557 579 * 558 * @param string $token559 580 * @return array 560 581 */ -
svea-checkout-for-woocommerce/trunk/inc/Models/Svea_Instore.php
r3202226 r3320066 85 85 * 86 86 * @param \WC_Order|null $wc_order 87 * @param bool $admin88 *89 87 * @return void 90 88 */ -
svea-checkout-for-woocommerce/trunk/inc/Models/Svea_Item.php
r3309749 r3320066 34 34 * Unit price (price each) 35 35 * 36 * @var float 37 */ 38 public $unit_price; 39 40 /** 41 * Tax percentage, 25, 12, 6 etc 42 * 36 43 * @var int 37 44 */ 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) 42 56 * 43 57 * @var int 44 58 */ 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 49 77 * 50 78 * @var string 51 79 */ 52 public $type = 'product';53 54 /**55 * Discount percent (0-100)56 *57 * @var int58 */59 public $discount_percent = 0;60 61 /**62 * Discount amount63 *64 * @var float65 */66 public $discount_amount = 0;67 68 /**69 * Diff from WooCommerce70 *71 * @var float72 */73 private $sum_diff = 0;74 75 /**76 * Temporary reference77 *78 * @var string79 */80 80 public $temporary_reference = ''; 81 81 … … 90 90 * Weight in grams 91 91 * 92 * @var int92 * @var float 93 93 */ 94 94 private $weight = 0; … … 97 97 * Length in mm 98 98 * 99 * @var int99 * @var float 100 100 */ 101 101 private $length = 0; … … 104 104 * Height in mm 105 105 * 106 * @var int106 * @var float 107 107 */ 108 108 private $height = 0; … … 111 111 * Width in mm 112 112 * 113 * @var int113 * @var float 114 114 */ 115 115 private $width = 0; … … 193 193 // Prevent division by 0 194 194 if ( $shipping->get_cost() > 0 ) { 195 $tax_percentage = ( $total_tax / $shipping->get_cost() ) * 100;195 $tax_percentage = ( $total_tax / (float) $shipping->get_cost() ) * 100; 196 196 } 197 197 … … 225 225 if ( ! empty( $meta_data['nshift_data'] ) ) { 226 226 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(); 229 229 230 230 $shipping_row->sku = $shipping->get_id(); … … 383 383 } 384 384 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(); 386 386 387 387 $tax_percentage = 0; 388 388 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; 390 390 } 391 391 … … 394 394 $this->quantity = $item->get_quantity(); 395 395 $this->unit_price = $unit_price; 396 $this->tax_percentage = $tax_percentage ? ?0;396 $this->tax_percentage = $tax_percentage ?: 0; 397 397 398 398 if ( $set_ref ) { … … 418 418 $this->quantity = $item->get_quantity(); 419 419 $this->unit_price = $unit_price; 420 $this->tax_percentage = $tax_percentage ? ?0;420 $this->tax_percentage = $tax_percentage ?: 0; 421 421 422 422 if ( $set_ref ) { … … 435 435 */ 436 436 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(); 438 438 439 439 $total_tax = floatval( $item->get_total_tax() ); … … 452 452 $this->quantity = $item->get_quantity(); 453 453 $this->unit_price = $unit_price; 454 $this->tax_percentage = $tax_percentage ? ?0;454 $this->tax_percentage = $tax_percentage ?: 0; 455 455 456 456 if ( $set_ref ) { -
svea-checkout-for-woocommerce/trunk/inc/Models/Svea_Payment_Admin.php
r3172745 r3320066 77 77 * 78 78 * @param \WC_Order $wc_order WooCommerce order 79 * @param bool $admin Use the admin client80 79 */ 81 80 public function __construct( $wc_order = null ) { … … 219 218 * Add order row to existing order 220 219 * 221 * @param array $data222 * 220 * @param int $id 221 * @param array $row_data 223 222 * @return array 224 223 */ … … 297 296 * @param int $id 298 297 * @param array $data 299 * @return array298 * @return void 300 299 */ 301 300 public function deliver_order( $id, $data ) { -
svea-checkout-for-woocommerce/trunk/inc/Template_Handler.php
r3309749 r3320066 27 27 add_action( 'wc_ajax_sco_change_payment_method', [ $this, 'change_payment_method' ], 100 ); 28 28 29 add_action( 'wc_ajax_sco_renew_nonce', [ $this, 'renew_checkout_nonce' ] ); 29 30 add_action( 'wc_ajax_sco_checkout_order', [ $this, 'sco_checkout_order' ] ); 30 31 … … 44 45 45 46 // Remove checkout fields if they are not needed 46 add_action( 'w oocommerce_checkout_before_order_review', [ $this, 'maybe_remove_checkout_fields' ]);47 add_action( 'wp', [ $this, 'maybe_remove_checkout_fields' ], 5 ); 47 48 48 49 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 → 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 49 196 } 50 197 … … 74 221 */ 75 222 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 } 77 232 wc_maybe_define_constant( 'WOOCOMMERCE_CHECKOUT', true ); 78 233 … … 152 307 */ 153 308 public function maybe_remove_checkout_fields() { 154 if ( $this->is_svea() ) {309 if ( $this->is_svea() && ! wp_doing_ajax() ) { 155 310 // 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 ); 157 312 add_filter( 'woocommerce_checkout_fields', [ $this, 'maybe_remove_order_comments_field' ] ); 158 313 } … … 277 432 278 433 /** @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(); 280 435 281 436 if ( ! empty( $available_gateways ) ) { … … 318 473 319 474 // 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' ) { 321 476 WC_Gateway_Svea_Checkout::log( sprintf( 'Order %s is not in final state, status: %s', $svea_order_id, $svea_checkout_module['Status'] ) ); 322 477 wp_safe_redirect( wc_get_checkout_url() ); … … 324 479 } 325 480 326 /** @var \Automattic\WooCommerce\Admin\Overrides\Order $ order */481 /** @var \Automattic\WooCommerce\Admin\Overrides\Order $wc_order */ 327 482 $wc_order = $wc_orders[0]; 328 483 … … 340 495 * Get the iframe snippet from Svea 341 496 * 342 * @return string497 * @return void 343 498 */ 344 499 public static function get_svea_snippet() { … … 647 802 648 803 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; 650 805 } 651 806 … … 732 887 * This function returns the Svea Checkout module. 733 888 * 734 * @param \WC_Cart $cart WooCommerce cart 735 * @return array|string The Svea Checkout snippet 889 * @return array The Svea Checkout snippet 736 890 */ 737 891 public static function get_svea_checkout_module() { -
svea-checkout-for-woocommerce/trunk/inc/WC_Gateway_Svea_Checkout.php
r3264850 r3320066 46 46 47 47 /** 48 * List of activated customer types49 * 50 * @var array48 * String of activated customer type(s) 49 * 50 * @var string 51 51 */ 52 52 private $customer_types; … … 503 503 504 504 /** 505 * Is the nShift integration enabled?506 *507 * @return bool508 */509 public static function is_nshift_enabled() {510 return self::$nshift_enabled;511 }512 513 /**514 * Is zero sum enabled?515 *516 * @return bool517 */518 public static function is_zero_sum_enabled() {519 return self::$zero_sum_enabled;520 }521 522 /**523 * Get the store minimum age524 *525 * @return int526 */527 public static function get_store_minimum_age() {528 return (int) self::$store_minimum_age;529 }530 531 /**532 * Get the shipping options html533 *534 * @param string $key535 * @param array $value536 * @param array $field537 * @return string538 */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 <?php564 565 $html = ob_get_clean();566 return $html;567 }568 569 /**570 * Get the name of the payment method571 *572 * @param string $key573 * @return string574 */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 reference587 *588 * @param string $key589 * @return string590 */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 /**602 505 * Add hooks 603 506 * … … 608 511 add_action( 'woocommerce_order_details_after_order_table', [ $this, 'svea_co_display_extra_order_meta' ], 11 ); 609 512 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' ] ); 611 514 add_action( 'woocommerce_update_options_payment_gateways_' . $this->id, [ $this, 'clear_merchant_validation_cache' ] ); 612 515 … … 637 540 638 541 // 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' ] ); 641 544 642 545 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 ); 643 605 } 644 606 … … 651 613 public function cancel_subscription( $wc_order ) { 652 614 if ( empty( $wc_order->get_meta( '_svea_co_token' ) ) ) { 653 return false;615 return; 654 616 } 655 617 … … 683 645 'woocommerce_subscriptions_paid_for_failed_renewal_order', 684 646 [ \WC_Subscriptions_Change_Payment_Gateway::class, 'change_failing_payment_method' ], 685 10, 686 2 647 10 687 648 ); 688 649 } … … 732 693 * @param array $values 733 694 * @param \WC_Order $wc_order 734 * @return \WC_Order_Item695 * @return void 735 696 */ 736 697 public function append_cart_item_key_to_order_row( $item, $cart_item_key, $values, $wc_order ) { … … 738 699 $item->update_meta_data( '_svea_co_cart_key', $cart_item_key ); 739 700 } 740 741 return $item;742 701 } 743 702 … … 749 708 * @param array $package 750 709 * @param \WC_Order $wc_order 751 * @return \WC_Order_Item_Shipping710 * @return void 752 711 */ 753 712 public function append_cart_item_key_to_order_row_shipping( $item, $package_key, $package, $wc_order ) { … … 760 719 } 761 720 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 ); 763 722 } 764 723 … … 798 757 * 799 758 * @param array $merchant_data Merchant data to fetch part payment plans for 800 * @return array| WP_Error List of payment plan campaigns759 * @return array|\WP_Error List of payment plan campaigns 801 760 */ 802 761 public function get_part_payment_plans( $merchant_data ) { 803 804 762 // Get campaigns from cache to save bandwidth and loading time 805 763 $campaigns = get_transient( sprintf( self::PART_PAYMENT_TRANSIENT_FORMAT, $merchant_data['CountryCode'] ) ); … … 1191 1149 1192 1150 /** 1193 * Get the customer type s(both|company|individual)1194 * 1195 * @return string []1151 * Get the customer type(s) (both|company|individual) 1152 * 1153 * @return string 1196 1154 */ 1197 1155 public function get_customer_types() { … … 1469 1427 1470 1428 // Map row ID's in Svea to WooCommerce 1471 if ( ! empty( $wc_order ) &&is_array( $item_mapping ) ) {1429 if ( is_array( $item_mapping ) ) { 1472 1430 $wc_items = $wc_order->get_items( [ 'line_item', 'fee', 'shipping' ] ); 1473 1431 … … 1934 1892 } 1935 1893 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(); 1937 1895 1938 1896 return $this->process_refund( $order_id, $refund_amount ); -
svea-checkout-for-woocommerce/trunk/inc/WC_Shipping_Svea_Nshift.php
r3172745 r3320066 38 38 $this->init(); 39 39 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' ] ); 41 41 add_action( 'woocommerce_cart_emptied', [ $this, 'clear_session' ] ); 42 42 } … … 67 67 */ 68 68 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 ); 76 70 } 77 71 -
svea-checkout-for-woocommerce/trunk/inc/Webhook_Handler.php
r3264850 r3320066 157 157 self::$svea_order = $svea_order->get( $webhook_data->orderId ); 158 158 } 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() ) ); 160 160 status_header( 404 ); 161 161 exit; … … 231 231 } 232 232 233 $this->svea_order_id = sanitize_text_field( $_GET['svea_order_id'] ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended233 $this->svea_order_id = (int) sanitize_text_field( $_GET['svea_order_id'] ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended 234 234 235 235 $this->gateway::log( sprintf( 'Validation callback for Svea order ID (%s) received', $this->svea_order_id ) ); … … 336 336 * 337 337 * @param string $msg Message 338 * @param string$valid Valid or not338 * @param bool $valid Valid or not 339 339 * @param string $order_number Client order number 340 340 * @return void … … 355 355 356 356 wp_send_json( $response ); 357 die;358 357 } 359 358 … … 614 613 615 614 $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 ) ); 617 616 618 617 $this->gateway::log( sprintf( 'Push callback finalized order. Svea ID:%s OrderID: %s', $this->svea_order_id, $wc_order->get_id() ) ); … … 624 623 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 ] ); 625 624 } else { 626 $wc_order->payment_complete( $this->svea_order_id );625 $wc_order->payment_complete( (string) $this->svea_order_id ); 627 626 } 628 627 … … 808 807 809 808 // Update the cost and taxes 810 $shipping_item->set_total( $shipping_fee );809 $shipping_item->set_total( (string) $shipping_fee ); 811 810 $shipping_item->set_taxes( $actual_taxes ); 812 811 $shipping_item->delete_meta_data( 'nshift_taxes' ); -
svea-checkout-for-woocommerce/trunk/readme.txt
r3309749 r3320066 10 10 License: Apache 2.0 11 11 License URI: https://www.apache.org/licenses/LICENSE-2.0 12 Stable tag: 3. 2.512 Stable tag: 3.3.0 13 13 14 14 Supercharge your WooCommerce Store with powerful features to pay via Svea Checkout! … … 71 71 2. Check the box **Display product part payment module** 72 72 3. Select where on the page you want to display the module 73 4. View the part payment module on the product page for elig able products. If the module is not displayed it might be due to the price since part payment plans often require a minimum amount.73 4. 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. 74 74 75 75 There'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 = 78 For support, please check the [support forum](https://wordpress.org/support/plugin/svea-checkout-for-woocommerce/) to see if your question has already been answered. 79 If 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/ 80 If 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/ 76 81 77 82 == Installation == … … 86 91 == Upgrade Notice == 87 92 93 = 3.3.0 = 94 3.3.0 is a minor release 95 88 96 = 3.2.5 = 89 97 3.2.5 is a patch release … … 376 384 377 385 == 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 378 391 379 392 = 3.2.5 2025-06-11 = -
svea-checkout-for-woocommerce/trunk/svea-checkout-for-woocommerce.php
r3309749 r3320066 14 14 * Plugin URI: https://wordpress.org/plugins/svea-checkout-for-woocommerce/ 15 15 * Description: Process payments in WooCommerce via Svea Checkout. 16 * Version: 3. 2.516 * Version: 3.3.0 17 17 * Requires Plugins: woocommerce 18 18 * Author: The Generation AB … … 47 47 * Version of plugin 48 48 */ 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'; 60 50 61 51 /** … … 146 136 */ 147 137 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' ); 150 140 } 151 141 -
svea-checkout-for-woocommerce/trunk/templates/backend/metabox.php
r3172745 r3320066 1 <?php if ( $is_awaiting_status ) : ?> 1 <?php 2 if ( ! defined( 'ABSPATH' ) ) { exit; } // Exit if accessed directly 3 4 if ( isset( $is_awaiting_status ) && $is_awaiting_status ) : ?> 2 5 <p> 3 6 <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 22 22 <p class="form-row form-row-wide create-account"> 23 23 <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> 25 25 </label> 26 26 </p> -
svea-checkout-for-woocommerce/trunk/templates/svea-checkout.php
r3281259 r3320066 99 99 100 100 <?php if ( 101 count( WC()->payment_gateways ->get_available_payment_gateways() ) > 1 &&101 count( WC()->payment_gateways()->get_available_payment_gateways() ) > 1 && 102 102 apply_filters( 'woocommerce_sco_show_change_payment_button', true ) 103 103 ) : ?> -
svea-checkout-for-woocommerce/trunk/vendor/autoload.php
r3281259 r3320066 20 20 require_once __DIR__ . '/composer/autoload_real.php'; 21 21 22 return ComposerAutoloaderInit 9ff79c494c0893bca5aca8141f25854b::getLoader();22 return ComposerAutoloaderInit4cfdf47045179a2c4f6ff86b1bce3df2::getLoader(); -
svea-checkout-for-woocommerce/trunk/vendor/composer/autoload_classmap.php
r3264850 r3320066 131 131 'Svea\\Checkout\\Implementation\\Admin\\ReplaceOrderRows' => $vendorDir . '/sveaekonomi/checkout/src/Implementation/Admin/ReplaceOrderRows.php', 132 132 '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', 133 134 'Svea\\Checkout\\Implementation\\CreateOrder' => $vendorDir . '/sveaekonomi/checkout/src/Implementation/CreateOrder.php', 134 135 'Svea\\Checkout\\Implementation\\CreateTokenOrder' => $vendorDir . '/sveaekonomi/checkout/src/Implementation/CreateTokenOrder.php', … … 162 163 'Svea\\Checkout\\Validation\\Admin\\ValidateReplaceOrderRowsData' => $vendorDir . '/sveaekonomi/checkout/src/Validation/Admin/ValidateReplaceOrderRowsData.php', 163 164 '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', 164 166 'Svea\\Checkout\\Validation\\ValidateCreateOrderData' => $vendorDir . '/sveaekonomi/checkout/src/Validation/ValidateCreateOrderData.php', 165 167 'Svea\\Checkout\\Validation\\ValidateCreateTokenOrderData' => $vendorDir . '/sveaekonomi/checkout/src/Validation/ValidateCreateTokenOrderData.php', … … 198 200 'Svea_Checkout_For_Woocommerce\\Compat\\WPC_Product_Bundles_Compat' => $baseDir . '/inc/Compat/WPC_Product_Bundles_Compat.php', 199 201 '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', 200 203 'Svea_Checkout_For_Woocommerce\\Helper' => $baseDir . '/inc/Helper.php', 201 204 'Svea_Checkout_For_Woocommerce\\I18n' => $baseDir . '/inc/I18n.php', -
svea-checkout-for-woocommerce/trunk/vendor/composer/autoload_real.php
r3172745 r3320066 3 3 // autoload_real.php @generated by Composer 4 4 5 class ComposerAutoloaderInit 9ff79c494c0893bca5aca8141f25854b5 class ComposerAutoloaderInit4cfdf47045179a2c4f6ff86b1bce3df2 6 6 { 7 7 private static $loader; … … 25 25 require __DIR__ . '/platform_check.php'; 26 26 27 spl_autoload_register(array('ComposerAutoloaderInit 9ff79c494c0893bca5aca8141f25854b', 'loadClassLoader'), true, true);27 spl_autoload_register(array('ComposerAutoloaderInit4cfdf47045179a2c4f6ff86b1bce3df2', 'loadClassLoader'), true, true); 28 28 self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__)); 29 spl_autoload_unregister(array('ComposerAutoloaderInit 9ff79c494c0893bca5aca8141f25854b', 'loadClassLoader'));29 spl_autoload_unregister(array('ComposerAutoloaderInit4cfdf47045179a2c4f6ff86b1bce3df2', 'loadClassLoader')); 30 30 31 31 require __DIR__ . '/autoload_static.php'; 32 call_user_func(\Composer\Autoload\ComposerStaticInit 9ff79c494c0893bca5aca8141f25854b::getInitializer($loader));32 call_user_func(\Composer\Autoload\ComposerStaticInit4cfdf47045179a2c4f6ff86b1bce3df2::getInitializer($loader)); 33 33 34 34 $loader->register(true); 35 35 36 $filesToLoad = \Composer\Autoload\ComposerStaticInit 9ff79c494c0893bca5aca8141f25854b::$files;36 $filesToLoad = \Composer\Autoload\ComposerStaticInit4cfdf47045179a2c4f6ff86b1bce3df2::$files; 37 37 $requireFile = \Closure::bind(static function ($fileIdentifier, $file) { 38 38 if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { -
svea-checkout-for-woocommerce/trunk/vendor/composer/autoload_static.php
r3264850 r3320066 5 5 namespace Composer\Autoload; 6 6 7 class ComposerStaticInit 9ff79c494c0893bca5aca8141f25854b7 class ComposerStaticInit4cfdf47045179a2c4f6ff86b1bce3df2 8 8 { 9 9 public static $files = array ( … … 194 194 'Svea\\Checkout\\Implementation\\Admin\\ReplaceOrderRows' => __DIR__ . '/..' . '/sveaekonomi/checkout/src/Implementation/Admin/ReplaceOrderRows.php', 195 195 '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', 196 197 'Svea\\Checkout\\Implementation\\CreateOrder' => __DIR__ . '/..' . '/sveaekonomi/checkout/src/Implementation/CreateOrder.php', 197 198 'Svea\\Checkout\\Implementation\\CreateTokenOrder' => __DIR__ . '/..' . '/sveaekonomi/checkout/src/Implementation/CreateTokenOrder.php', … … 225 226 'Svea\\Checkout\\Validation\\Admin\\ValidateReplaceOrderRowsData' => __DIR__ . '/..' . '/sveaekonomi/checkout/src/Validation/Admin/ValidateReplaceOrderRowsData.php', 226 227 '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', 227 229 'Svea\\Checkout\\Validation\\ValidateCreateOrderData' => __DIR__ . '/..' . '/sveaekonomi/checkout/src/Validation/ValidateCreateOrderData.php', 228 230 'Svea\\Checkout\\Validation\\ValidateCreateTokenOrderData' => __DIR__ . '/..' . '/sveaekonomi/checkout/src/Validation/ValidateCreateTokenOrderData.php', … … 261 263 'Svea_Checkout_For_Woocommerce\\Compat\\WPC_Product_Bundles_Compat' => __DIR__ . '/../..' . '/inc/Compat/WPC_Product_Bundles_Compat.php', 262 264 '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', 263 266 'Svea_Checkout_For_Woocommerce\\Helper' => __DIR__ . '/../..' . '/inc/Helper.php', 264 267 'Svea_Checkout_For_Woocommerce\\I18n' => __DIR__ . '/../..' . '/inc/I18n.php', … … 283 286 { 284 287 return \Closure::bind(function () use ($loader) { 285 $loader->prefixLengthsPsr4 = ComposerStaticInit 9ff79c494c0893bca5aca8141f25854b::$prefixLengthsPsr4;286 $loader->prefixDirsPsr4 = ComposerStaticInit 9ff79c494c0893bca5aca8141f25854b::$prefixDirsPsr4;287 $loader->classMap = ComposerStaticInit 9ff79c494c0893bca5aca8141f25854b::$classMap;288 $loader->prefixLengthsPsr4 = ComposerStaticInit4cfdf47045179a2c4f6ff86b1bce3df2::$prefixLengthsPsr4; 289 $loader->prefixDirsPsr4 = ComposerStaticInit4cfdf47045179a2c4f6ff86b1bce3df2::$prefixDirsPsr4; 290 $loader->classMap = ComposerStaticInit4cfdf47045179a2c4f6ff86b1bce3df2::$classMap; 288 291 289 292 }, null, ClassLoader::class); -
svea-checkout-for-woocommerce/trunk/vendor/composer/installed.json
r3202226 r3320066 3 3 { 4 4 "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", 7 7 "source": { 8 8 "type": "git", 9 9 "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", 16 16 "shasum": "" 17 17 }, … … 40 40 "psr/log": "Required for using the Log middleware" 41 41 }, 42 "time": "202 4-07-24T11:22:20+00:00",42 "time": "2025-03-27T13:37:11+00:00", 43 43 "type": "library", 44 44 "extra": { … … 112 112 "support": { 113 113 "issues": "https://github.com/guzzle/guzzle/issues", 114 "source": "https://github.com/guzzle/guzzle/tree/7.9. 2"114 "source": "https://github.com/guzzle/guzzle/tree/7.9.3" 115 115 }, 116 116 "funding": [ … … 132 132 { 133 133 "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", 136 136 "source": { 137 137 "type": "git", 138 138 "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", 145 145 "shasum": "" 146 146 }, … … 152 152 "phpunit/phpunit": "^8.5.39 || ^9.6.20" 153 153 }, 154 "time": "202 4-10-17T10:06:22+00:00",154 "time": "2025-03-27T13:27:01+00:00", 155 155 "type": "library", 156 156 "extra": { … … 198 198 "support": { 199 199 "issues": "https://github.com/guzzle/promises/issues", 200 "source": "https://github.com/guzzle/promises/tree/2. 0.4"200 "source": "https://github.com/guzzle/promises/tree/2.2.0" 201 201 }, 202 202 "funding": [ … … 218 218 { 219 219 "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", 222 222 "source": { 223 223 "type": "git", 224 224 "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", 231 231 "shasum": "" 232 232 }, … … 249 249 "laminas/laminas-httphandlerrunner": "Emit PSR-7 responses" 250 250 }, 251 "time": "202 4-07-18T11:15:46+00:00",251 "time": "2025-03-27T12:30:47+00:00", 252 252 "type": "library", 253 253 "extra": { … … 317 317 "support": { 318 318 "issues": "https://github.com/guzzle/psr7/issues", 319 "source": "https://github.com/guzzle/psr7/tree/2.7. 0"319 "source": "https://github.com/guzzle/psr7/tree/2.7.1" 320 320 }, 321 321 "funding": [ … … 553 553 { 554 554 "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", 557 557 "source": { 558 558 "type": "git", 559 559 "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", 566 566 "shasum": "" 567 567 }, … … 579 579 "symfony/dependency-injection": "^2.7.51 || ^2.8.50 || ^3.4.26 || ^4.1.12 || ^4.2.7" 580 580 }, 581 "time": "202 4-11-13T10:20:09+00:00",581 "time": "2025-06-30T13:03:15+00:00", 582 582 "type": "library", 583 583 "installation-source": "dist", … … 600 600 "support": { 601 601 "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" 603 603 }, 604 604 "install-path": "../sveaekonomi/checkout" … … 684 684 "type": "library", 685 685 "extra": { 686 "thanks": { 687 "url": "https://github.com/symfony/contracts", 688 "name": "symfony/contracts" 689 }, 686 690 "branch-alias": { 687 691 "dev-main": "3.0-dev" 688 },689 "thanks": {690 "name": "symfony/contracts",691 "url": "https://github.com/symfony/contracts"692 692 } 693 693 }, -
svea-checkout-for-woocommerce/trunk/vendor/composer/installed.php
r3202226 r3320066 12 12 'versions' => array( 13 13 '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', 17 17 'type' => 'library', 18 18 'install_path' => __DIR__ . '/../guzzlehttp/guzzle', … … 21 21 ), 22 22 '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', 26 26 'type' => 'library', 27 27 'install_path' => __DIR__ . '/../guzzlehttp/promises', … … 30 30 ), 31 31 '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', 35 35 'type' => 'library', 36 36 'install_path' => __DIR__ . '/../guzzlehttp/psr7', … … 93 93 ), 94 94 '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', 98 98 'type' => 'library', 99 99 'install_path' => __DIR__ . '/../sveaekonomi/checkout', -
svea-checkout-for-woocommerce/trunk/vendor/guzzlehttp/guzzle/CHANGELOG.md
r3172745 r3320066 2 2 3 3 Please 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 4 12 5 13 -
svea-checkout-for-woocommerce/trunk/vendor/guzzlehttp/guzzle/src/Cookie/SetCookie.php
r3088414 r3320066 63 63 $data[$search] = (int) $value; 64 64 } 65 } elseif ($search === 'Secure' || $search === 'Discard' || $search === 'HttpOnly') { 66 if ($value) { 67 $data[$search] = true; 68 } 65 69 } else { 66 70 $data[$search] = $value; -
svea-checkout-for-woocommerce/trunk/vendor/guzzlehttp/guzzle/src/Handler/Proxy.php
r3088414 r3320066 18 18 * requests to another handler. 19 19 * 20 * @param callable( \Psr\Http\Message\RequestInterface, array): \GuzzleHttp\Promise\PromiseInterface $default Handler used for normal responses21 * @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. 22 22 * 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. 24 24 */ 25 25 public static function wrapSync(callable $default, callable $sync): callable … … 38 38 * through the StreamHandler. 39 39 * 40 * @param callable( \Psr\Http\Message\RequestInterface, array): \GuzzleHttp\Promise\PromiseInterface $default Handler used for non-streaming responses41 * @param callable( \Psr\Http\Message\RequestInterface, array): \GuzzleHttp\Promise\PromiseInterface $streaming Handler used for streaming responses40 * @param callable(RequestInterface, array): PromiseInterface $default Handler used for non-streaming responses 41 * @param callable(RequestInterface, array): PromiseInterface $streaming Handler used for streaming responses 42 42 * 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. 44 44 */ 45 45 public static function wrapStreaming(callable $default, callable $streaming): callable -
svea-checkout-for-woocommerce/trunk/vendor/guzzlehttp/guzzle/src/Handler/StreamHandler.php
r3172745 r3320066 54 54 55 55 // 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 ) { 58 64 $request = $request->withHeader('Content-Length', '0'); 59 65 } -
svea-checkout-for-woocommerce/trunk/vendor/guzzlehttp/guzzle/src/Pool.php
r3088414 r3320066 87 87 * @param array|\Iterator $requests Requests to send concurrently. 88 88 * @param array $options Passes through the options available in 89 * {@see \GuzzleHttp\Pool::__construct}89 * {@see Pool::__construct} 90 90 * 91 91 * @return array Returns an array containing the response or an exception -
svea-checkout-for-woocommerce/trunk/vendor/guzzlehttp/guzzle/src/Utils.php
r3172745 r3320066 80 80 * The returned handler is not wrapped by any default middlewares. 81 81 * 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. 83 83 * 84 84 * @throws \RuntimeException if no viable Handler is available. -
svea-checkout-for-woocommerce/trunk/vendor/guzzlehttp/guzzle/src/functions.php
r3088414 r3320066 51 51 * The returned handler is not wrapped by any default middlewares. 52 52 * 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. 54 54 * 55 55 * @throws \RuntimeException if no viable Handler is available. -
svea-checkout-for-woocommerce/trunk/vendor/guzzlehttp/promises/CHANGELOG.md
r3172745 r3320066 1 1 # 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 2 16 3 17 -
svea-checkout-for-woocommerce/trunk/vendor/guzzlehttp/psr7/CHANGELOG.md
r3172745 r3320066 5 5 The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) 6 6 and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). 7 8 ## 2.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 7 17 8 18 ## 2.7.0 - 2024-07-18 -
svea-checkout-for-woocommerce/trunk/vendor/guzzlehttp/psr7/src/UploadedFile.php
r3172745 r3320066 12 12 class UploadedFile implements UploadedFileInterface 13 13 { 14 private const ERROR S= [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', 23 23 ]; 24 24 … … 105 105 private function setError(int $error): void 106 106 { 107 if ( false === in_array($error, UploadedFile::ERRORS, true)) {107 if (!isset(UploadedFile::ERROR_MAP[$error])) { 108 108 throw new InvalidArgumentException( 109 109 'Invalid error status for UploadedFile' … … 138 138 { 139 139 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])); 141 141 } 142 142 -
svea-checkout-for-woocommerce/trunk/vendor/guzzlehttp/psr7/src/Uri.php
r3172745 r3320066 108 108 // If IPv6 109 109 $prefix = ''; 110 if (preg_match('%^(.*://\[[0-9:a-f ]+\])(.*?)$%', $url, $matches)) {110 if (preg_match('%^(.*://\[[0-9:a-fA-F]+\])(.*?)$%', $url, $matches)) { 111 111 /** @var array{0:string, 1:string, 2:string} $matches */ 112 112 $prefix = $matches[1]; -
svea-checkout-for-woocommerce/trunk/vendor/sveaekonomi/checkout/README.md
r2983864 r3320066 9 9 * [6. Create recurring order](#6-create-recurring-order) 10 10 * [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) 17 18 ## Introduction 18 19 The 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. 19 20 20 21 21 The checkout supports both B2C and B2B payments, fast customer identification and caches customers behavio ur.22 The checkout supports both B2C and B2B payments, fast customer identification and caches customers behavior. 22 23 23 24 … … 135 136 | IdentityFlags | | Array of [*IdentityFlags*](#1012-identityflags) | Array of [*IdentityFlags*](#812-identityflags) used to hide certain features of the iframe | 136 137 | 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 av ilable 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) | 138 139 | MerchantData | | String | Metadata visible in the checkout API, returned when the order is fetched through the API. | 139 140 … … 375 376 ``` 376 377 377 ### 8. Response 378 ### 8. Change payment method for recurring order 379 Svea Checkout allows you to let customers change the payment method for an existing recurring order. 380 This 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 387 You use the changePaymentMethod endpoint via the \Svea\Checkout\CheckoutClient. 388 This will generate a new checkout session where the customer can select a new payment method. 389 Once 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 394 include 'vendor/autoload.php'; 395 396 // without composer 397 require_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; 410 echo $sveaCheckoutIframe ?: ''; 411 ``` 412 413 After 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 378 416 The response contains information about the order such as Cart, Status, PaymentType and much more. 379 417 … … 542 580 echo $response['Gui']['Snippet'] 543 581 ``` 544 ### 9. Additional requests545 546 #### 9.1 GetAvailablePartPaymentCampaigns582 ### 10. Additional requests 583 584 #### 10.1 GetAvailablePartPaymentCampaigns 547 585 548 586 GetAvailablePartPaymentCampaigns can be used to fetch the details of all the campaigns that are available on the merchant … … 635 673 If 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. 636 674 637 ### 1 0. Data structures638 639 #### 1 0.1 MerchantSettings675 ### 11. Data structures 676 677 #### 11.1 MerchantSettings 640 678 641 679 | Parameters | Required | Type | Description | Limits | 642 680 |------------------------------|-----------|-----------|--------------|---------| 643 | TermsUri | * | string | URI to a page which contains terms of the web shop. | 1-500 characters, must be a valid Url |644 | CheckoutUri | * | string | URI to the page in the web shop that loads the Checkout. | 1-500 characters, must be a valid Url |645 | 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 |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 | 646 684 | 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 | 647 685 | 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 | … … 649 687 | 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 | 650 688 651 #### 1 0.2 Items689 #### 11.2 Items 652 690 653 691 | Parameters | Required | Type | Description | … … 655 693 | Items | * | List of [*OrderRows*](#103-orderrow) | See structure below | 656 694 657 #### 1 0.3 OrderRow695 #### 11.3 OrderRow 658 696 659 697 | Parameters | Required | Type | Description | Limits | 660 698 |------------------------------|------------|-----------|--------------|---------| 661 | ArticleNumber | | String | Article number 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 | 662 700 | Name | * | String | Article name | 1-40 characters | 663 701 | Quantity | * | Integer | Set as basis point (1/100) e.g 2 = 200 | 1-9 digits. Minor currency | 664 702 | 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 discount percent of the product. | 0-100 |703 | DiscountPercent | | Integer | The discount percent of the product. | 0-100 | 666 704 | VatPercent | * | Integer | The VAT percentage of the current product. | Valid vat percentage for that country. Minor currency. | 667 705 | 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 temporaryreferenceas 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. | | 669 707 | MerchantData | | String | Can be used to store data, the data is not displayed anywhere but in the API 670 708 671 #### 1 0.4 PresetValue709 #### 11.4 PresetValue 672 710 673 711 | Parameters | Required | Type | Description | … … 685 723 | PhoneNumber | String | | 1-18 digits, can include “+”, “-“s and space | 686 724 | PostalCode | String | | Company specific validation | 687 | IsCompany | Boolean | | Required if nationalidis set |688 689 #### 1 0.5 Gui725 | IsCompany | Boolean | | Required if "nationalid" is set | 726 727 #### 11.5 Gui 690 728 691 729 | Parameters | Type | Description | … … 694 732 | Snippet | String | HTML-snippet including javascript to populate the iFrame. | 695 733 696 #### 1 0.6 Customer734 #### 11.6 Customer 697 735 698 736 | Parameters | Type | Description | 699 737 |------------------------------|-----------|--------------| 700 | NationalId | String | Personal- or organization number. |701 | IsCompany | Boolean | True if nationalId is organisation number, 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. | 702 740 | CountryCode | String | Defined by two-letter ISO 3166-1 alpha-2, i.e. SE, DE, FI etc.| 703 741 | Id | Integer | Customer-specific id | 704 742 705 #### 1 0.7 Address743 #### 11.7 Address 706 744 707 745 | Parameters | Type | Description | … … 718 756 | AddressLines | Array of strings | Null unless international flow is used 719 757 720 #### 1 0.8 CheckoutOrderStatus758 #### 11.8 CheckoutOrderStatus 721 759 722 760 The order can only be considered “ready to send to customer” when the CheckoutOrderStatus is Final. No other status can guarantee payment. … … 728 766 | 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| 729 767 730 #### 1 0.9 Locale768 #### 11.9 Locale 731 769 | Parameter | Description | 732 770 |-----------|-----------------| … … 739 777 740 778 741 #### 1 0.10 PaymentType779 #### 11.10 PaymentType 742 780 | Parameter | Description | 743 781 |-------------|-----------------| … … 755 793 | LEASINGUNAPPROVED | Leasing (Manual approve process by Sveas leasing department, check Store pay admin page) | 756 794 | LEASINGAPPROVED | Leasing (Automatically approved leasing contract) 757 | TRUSTLY | The customer pai ed with Trustly |795 | TRUSTLY | The customer paid with Trustly | 758 796 | Directbank (varies) | The customer paid the order with direct bank e.g. Nordea, SEB. See below for all available parameters | 759 797 … … 778 816 779 817 780 #### 1 0.11 CampaignCodeInfo818 #### 11.11 CampaignCodeInfo 781 819 | Parameter | Type | Description | 782 820 |---------------------------|-----------|-------------| … … 794 832 | PaymentPlanType | Integer | Type of campaign | 795 833 796 #### 1 0.12 IdentityFlags834 #### 11.12 IdentityFlags 797 835 | Parameter | Type | Description | 798 836 |---------------------------|-----------|-------------| … … 801 839 | HideAnonymous | Boolean | Hides anonymous flow, forcing users to identify with their nationalId to perform a purchase | 802 840 803 #### 1 0.13 CheckoutValidationCallbackResponse841 #### 11.13 CheckoutValidationCallbackResponse 804 842 If 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". 805 843 … … 811 849 | ClientOrderNumber | | String | Max 32 characters. Set if you want the ClientOrderNumber to be updated. | 812 850 813 ### 1 1. HttpStatusCodes851 ### 12. HttpStatusCodes 814 852 | Parameter | Type | Description | 815 853 |-----------|---------------|-------------| … … 827 865 If the returned ResultCode is not present in the above tables please contact Svea Ekonomi for further information. 828 866 829 ## 1 2. Order administration867 ## 13. Order administration 830 868 831 869 [See full examples](examples/admin) … … 843 881 \Exception - For any other error 844 882 845 ### 1 2.1 Get order883 ### 13.1 Get order 846 884 This method is used to get the entire order with all its relevant information. Including its deliveries, rows, credits and addresses. 847 885 … … 856 894 | Parameters OUT | Type | Description | 857 895 |-------------------------------|-----------|--------------| 858 | Order | array | An array containing all the order details. See [1 2.14 Data objects](#1215-data-objects) |859 860 861 862 ### 1 2.2 Get task896 | 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 863 901 A task will explain the status of a previously performed operation. When finished it will point towards the new resource with the Location. 864 902 #### Parameters … … 874 912 | Task | [Task](#12154-task) | An object containing details regarding a queued task | 875 913 876 ### 1 2.3 Deliver order914 ### 13.3 Deliver order 877 915 Creates a delivery on a checkout order. Assuming the order got the **CanDeliverOrder** action. 878 916 … … 894 932 | HeaderLocation | string | URI to the created task. (Absolute URL) | 895 933 896 ### 1 2.3.1 Row Delivery Options934 ### 13.3.1 Row Delivery Options 897 935 898 936 | Parameter | Type | Description | … … 901 939 | quantity | int | Number of items to credit | 902 940 903 ### 1 2.4 Deliver order with lower amount941 ### 13.4 Deliver order with lower amount 904 942 Creates 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. 905 943 … … 918 956 | HeaderLocation | string | URI to the created task (Absolute URL) | 919 957 920 ### 1 2.5 Cancel Order958 ### 13.5 Cancel Order 921 959 Cancel an order before it has been delivered. Assuming the order has the action **CanCancelOrder**. 922 960 … … 930 968 If the order is successfully cancelled, Response is empty. 931 969 932 ### 1 2.6 Cancel order amount970 ### 13.6 Cancel order amount 933 971 By specifying a higher amount than the current order cancelled amount then the order cancelled amount will increase, 934 972 assuming the order has the action **CanCancelOrderAmount**. The delta between the new *CancelledAmount* and the former *CancelledAmount* will be cancelled. … … 946 984 If order amount is successfully cancelled, Response is empty. 947 985 948 ### 1 2.7 Cancel order row986 ### 13.7 Cancel order row 949 987 Changes the status of an order row to *Cancelled*, assuming the order has the action **CanCancelOrderRow** and the OrderRow has the action **CanCancelRow**. 950 988 … … 959 997 If order row is successfully cancelled, Response is empty. 960 998 961 ### 1 2.8 Credit order rows999 ### 13.8 Credit order rows 962 1000 Creates 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** 963 1001 … … 977 1015 On the returned URL can be checked status of the task. 978 1016 979 ### 1 2.8.1 Row Crediting Options1017 ### 13.8.1 Row Crediting Options 980 1018 981 1019 | Parameter | Type | Description | … … 984 1022 | quantity | int | Number of items to credit | 985 1023 986 ### 1 2.9 Credit new order row1024 ### 13.9 Credit new order row 987 1025 By specifying a new credit row, a new credit row will be created on the delivery, assuming the delivery has action **CanCreditNewRow**. 988 1026 … … 1001 1039 On the returned URL can be checked status of the task. 1002 1040 1003 ### 1 2.10 Credit order rows with fee1041 ### 13.10 Credit order rows with fee 1004 1042 Creates 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. 1005 1043 … … 1019 1057 1020 1058 On the returned URL can be checked status of the task. 1021 ### 1 2.11 Credit amount1059 ### 13.11 Credit amount 1022 1060 By 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. 1023 1061 … … 1034 1072 If order amount is successfully credited, Response is empty. 1035 1073 1036 ### 1 2.12 Add order row1074 ### 13.12 Add order row 1037 1075 This method is used to add order rows to an order, assuming the order has the action **CanAddOrderRow**. 1038 1076 If the new order amount will exceed the current order amount, a credit check will be performed. … … 1052 1090 On the returned URL (HeaderLocation) can be checked status of the task. 1053 1091 1054 ### 1 2.13 Update order row1092 ### 13.13 Update order row 1055 1093 This method is used to update an order row, assuming the order has action "CanUpdateOrderRow" and the order row has the action **CanUpdateRow**. 1056 1094 The method will update all fields set in the payload, if a field is not set the row will keep the current value. … … 1067 1105 If order row is successfully updated, Response is empty. 1068 1106 1069 ### 1 2.14 Replace order rows1107 ### 13.14 Replace order rows 1070 1108 This method is used to update an order row, assuming the order has action "CanUpdateOrderRow". 1071 1109 This method will delete all the present rows and replace with the ones set in the payload. … … 1082 1120 1083 1121 1084 ### 1 2.15 Data objects1085 1086 #### 1 2.15.1 Order1122 ### 13.15 Data objects 1123 1124 #### 13.15.1 Order 1087 1125 | Parameter | Type | Description | 1088 1126 |-----------------------|---------------|-----------------------------------------------------------| … … 1095 1133 | 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.| 1096 1134 | CreationDate | DateTime | Date and time when the order was created| 1097 | NationalId | string | Personal- or organization number.|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.| 1099 1137 | OrderAmount | int | The total amount on the order. Minor unit| 1100 1138 | CancelledAmount | int | The total cancelled amount on the order. Minor uit| … … 1105 1143 | Actions | List of String | A list of actions possible on the order.| 1106 1144 1107 #### 1 2.15.2 Delivery1145 #### 13.15.2 Delivery 1108 1146 1109 1147 | Parameter | Type | Description | … … 1118 1156 | Actions | List of string | A list of actions possible on the delivery.| 1119 1157 1120 #### 1 2.15.3 Credit1158 #### 13.15.3 Credit 1121 1159 1122 1160 | Parameter | Type | Description | … … 1126 1164 | Actions | List of String | A list of actions possible on the credit.| 1127 1165 1128 #### 1 2.15.4 Task1166 #### 13.15.4 Task 1129 1167 1130 1168 | Parameter | Type | Description | … … 1133 1171 | Status | String | Status of the task | 1134 1172 1135 #### 1 2.15.5 Order Row1173 #### 13.15.5 Order Row 1136 1174 1137 1175 |Parameter |R | RO | Type | Description | Limits| 1138 1176 |-----------------------|---|----|----------|-------------------------------|-------------------| 1139 1177 | OrderRowId | | * |int | Order row id from underlying system, unique on order. | Not possible to set through API, only get.| 1140 | ArticleNumber | | |string | Article number 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. | 1141 1179 | Name | * | |string | Article name. | 1-40 characters. | 1142 1180 | Quantity | * | |int | Quantity of the product. | 1-9 digits. Minor unit.| 1143 1181 | UnitPrice | * | |int | Price of the product including VAT. | 1-13 digits, can be negative. Minor currency.| 1144 | DiscountPercent | | |int | The discount percent of the product. | 0-9900. Minor unit|1182 | DiscountPercent | | |int | The discount percent of the product. | 0-9900. Minor unit| 1145 1183 | VatPercent | * | |int | The VAT percentage of the current product. | Valid vat percentage for that country . Minor unit.0-10000| 1146 1184 | Unit | | |string | The unit type, e.g., “st”, “pc”, “kg” etc. | 0-4 characters. | … … 1148 1186 | 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.| 1149 1187 1150 #### 1 2.15.6 Address1188 #### 13.15.6 Address 1151 1189 1152 1190 | Parameter | Type | Description | … … 1159 1197 | CountryCode | string | 2-letter ISO country code | 1160 1198 1161 #### 1 2.15.7 Order Status1199 #### 13.15.7 Order Status 1162 1200 1163 1201 | Parameter | Description | … … 1168 1206 | Failed | The payment for this order has failed | 1169 1207 1170 #### 1 2.15.8 Order actions1208 #### 13.15.8 Order actions 1171 1209 1172 1210 | Parameter | Description | … … 1180 1218 | CanUpdateOrderRow || 1181 1219 1182 #### 1 2.15.9 Delivery actions1220 #### 13.15.9 Delivery actions 1183 1221 1184 1222 | Parameter | Description | … … 1188 1226 | CanCreditAmount || 1189 1227 1190 #### 1 2.15.10 Order Row actions1228 #### 13.15.10 Order Row actions 1191 1229 1192 1230 | Parameter | Description | … … 1197 1235 | CanUpdateRow || 1198 1236 1199 ## 1 3. Javascript API1237 ## 14. Javascript API 1200 1238 1201 1239 (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.21 1.6.0 -
svea-checkout-for-woocommerce/trunk/vendor/sveaekonomi/checkout/composer.json
r3202226 r3320066 1 1 { 2 2 "name": "sveaekonomi/checkout", 3 "version": "1. 5.3",3 "version": "1.6.0", 4 4 "description": "Php integration library for Svea Checkout", 5 5 "license": "Apache-2.0", … … 26 26 "phploc/phploc": "^2.0.1", 27 27 "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" 29 29 }, 30 30 "scripts": { -
svea-checkout-for-woocommerce/trunk/vendor/sveaekonomi/checkout/src/CheckoutClient.php
r2983864 r3320066 70 70 71 71 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 72 84 } 73 85 -
svea-checkout-for-woocommerce/trunk/vendor/sveaekonomi/checkout/src/Implementation/ImplementationFactory.php
r2983864 r3320066 5 5 use Svea\Checkout\Transport\Connector; 6 6 use Svea\Checkout\Validation\ValidateCreateOrderData; 7 use Svea\Checkout\Validation\ValidateChangePaymentMethodData; 7 8 use Svea\Checkout\Validation\ValidateCreateTokenOrderData; 8 9 use Svea\Checkout\Validation\ValidateGetOrderData; … … 17 18 /** 18 19 * @param Connector $connector 19 * @return ImplementationInterface20 * @return CreateOrder 20 21 */ 21 22 public static function returnCreateOrderClass(Connector $connector) … … 26 27 /** 27 28 * @param Connector $connector 28 * @return ImplementationInterface29 * @return CreateTokenOrder 29 30 */ 30 public static function returnCreateTokenOrderClass(Connector $connector) { 31 public static function returnCreateTokenOrderClass(Connector $connector) 32 { 31 33 return new CreateTokenOrder($connector, new ValidateCreateTokenOrderData()); 32 34 } … … 34 36 /** 35 37 * @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 37 48 */ 38 49 public static function returnGetOrderClass(Connector $connector) … … 43 54 /** 44 55 * @param Connector $connector 45 * @return ImplementationInterface56 * @return GetTokenOrder 46 57 */ 47 58 public static function returnGetTokenOrderClass(Connector $connector) … … 52 63 /** 53 64 * @param Connector $connector 54 * @return ImplementationInterface65 * @return GetToken 55 66 */ 56 67 public static function returnGetTokenClass(Connector $connector) … … 61 72 /** 62 73 * @param Connector $connector 63 * @return ImplementationInterface74 * @return UpdateToken 64 75 */ 65 76 public static function returnUpdateTokenClass(Connector $connector) … … 70 81 /** 71 82 * @param Connector $connector 72 * @return ImplementationInterface83 * @return UpdateOrder 73 84 */ 74 85 public static function returnUpdateOrderClass(Connector $connector) … … 79 90 /** 80 91 * @param Connector $connector 81 * @return ImplementationInterface92 * @return GetAvailablePartPaymentCampaigns 82 93 */ 83 94 public static function returnGetAvailablePartPaymentCampaignsClass(Connector $connector)
Note: See TracChangeset
for help on using the changeset viewer.