Flexible Shipping for WooCommerce - Version 3.3.1

Version Description

If you are upgrading from the old Flexible Shipping version (1.3.2, woo-flexible-shipping) make sure to completely delete the old version first. If you install the new version without deleting the old one you may break your WordPress installation.

Download this release

Release Info

Developer jablonowski
Plugin Icon 128x128 Flexible Shipping for WooCommerce
Version 3.3.1
Comparing to
See all releases

Code changes from version 3.2.0 to 3.3.1

Files changed (62) hide show
  1. assets/css/admin.css +11 -1
  2. assets/css/admin.min.css +1 -1
  3. assets/js/admin.js +0 -4
  4. assets/js/admin_saas_platform.js +291 -0
  5. assets/js/admin_saas_platform.min.js +1 -1
  6. classes/class-flexible-shipping-plugin.php +11 -1
  7. classes/csv/class-csv-importer-exception.php +7 -0
  8. classes/csv/class-csv-importer.php +300 -0
  9. classes/saas/collection-points/class-saas-collection-points-map.php +1 -1
  10. classes/shipment/saas/class-shipment-saas-ajax.php +8 -0
  11. classes/shipment/saas/class-shipment-saas-attachments-ajax.php +220 -0
  12. classes/shipment/saas/class-shipment-saas-attachments-upload-dir.php +42 -0
  13. classes/shipment/saas/class-shipment-saas-attachments.php +125 -0
  14. classes/shipment/saas/class-shipment-saas-metabox-attachments.php +64 -0
  15. classes/shipment/saas/class-shipment-saas-metabox.php +13 -0
  16. classes/shipment/saas/class-shipment-saas.php +1 -1
  17. classes/shipment/saas/views/order-metabox-shipment-attachments.php +72 -0
  18. classes/shipment/saas/views/order-metabox-single-attachment.php +39 -0
  19. classes/shipping-method.php +8 -183
  20. flexible-shipping.php +7 -6
  21. lang/flexible-shipping-pl_PL.mo +0 -0
  22. lang/flexible-shipping-pl_PL.po +165 -103
  23. readme.txt +7 -1
  24. vendor/autoload.php +1 -1
  25. vendor/composer/autoload_classmap.php +17 -2
  26. vendor/composer/autoload_real.php +7 -7
  27. vendor/composer/autoload_static.php +21 -6
  28. vendor/composer/installed.json +18 -18
  29. vendor/wpdesk/wp-autoloader/.gitignore +2 -1
  30. vendor/wpdesk/wp-autoloader/CHANGELOG.md +3 -0
  31. vendor/wpdesk/wp-autoloader/composer.json +2 -3
  32. vendor/wpdesk/wp-autoloader/phpunit-integration.xml +28 -0
  33. vendor/wpdesk/wp-autoloader/phpunit-unit.xml +21 -0
  34. vendor/wpdesk/wp-autoloader/src/Loader/Flow/Composer_Flow_Loader.php +97 -0
  35. vendor/wpdesk/wp-autoloader/src/Loader/Flow/Composer_Flow_Loader_Info.php +75 -0
  36. vendor/wpdesk/wp-autoloader/src/Loader/Loader_Manager.php +2 -2
  37. vendor/wpdesk/wp-autoloader/tests/docker-compose.yaml +172 -0
  38. vendor/wpdesk/wp-autoloader/tests/integration/bootstrap.php +28 -0
  39. vendor/wpdesk/wp-autoloader/tests/unit/bootstrap.php +9 -0
  40. vendor/wpdesk/wp-basic-requirements/CHANGELOG.md +10 -0
  41. vendor/wpdesk/wp-basic-requirements/src/Basic_Requirement_Checker.php +390 -383
  42. vendor/wpdesk/wp-basic-requirements/src/Basic_Requirement_Checker_Factory.php +22 -0
  43. vendor/wpdesk/wp-basic-requirements/src/Requirement_Checker.php +81 -0
  44. vendor/wpdesk/wp-basic-requirements/src/Requirement_Checker_Factory.php +15 -0
  45. vendor/wpdesk/wp-basic-requirements/tests/unit/Test_Basic_Requirement_Checker.php +7 -7
  46. vendor/wpdesk/wp-saas-platform-client/src/ApiClient/ClientImplementation.php +1 -1
  47. vendor/wpdesk/wp-saas-platform-client/src/HttpClient/HttpClientResponse.php +3 -0
  48. vendor/wpdesk/wp-saas-platform-client/src/Model/ShipmentDocument/SendDocumentsResponse.php +23 -0
  49. vendor/wpdesk/wp-saas-platform-client/src/Model/ShipmentDocument/ShipmentDocument.php +193 -0
  50. vendor/wpdesk/wp-saas-platform-client/src/Model/ShipmentDocument/ShipmentDocumentRequest.php +74 -0
  51. vendor/wpdesk/wp-saas-platform-client/src/Platform.php +71 -4
  52. vendor/wpdesk/wp-saas-platform-client/src/Request/{Cancel → ShipmentCancel}/PostCancelRequest.php +1 -1
  53. vendor/wpdesk/wp-saas-platform-client/src/Request/ShipmentDocument/DeleteShipmentDocumentRequest.php +35 -0
  54. vendor/wpdesk/wp-saas-platform-client/src/Request/ShipmentDocument/PostShipmentDocumentRequest.php +45 -0
  55. vendor/wpdesk/wp-saas-platform-client/src/Request/ShipmentDocumentsSend/PostSendRequest.php +41 -0
  56. vendor/wpdesk/wp-saas-platform-client/src/Response/RawResponse.php +13 -0
  57. vendor/wpdesk/wp-saas-platform-client/src/Response/Response.php +7 -1
  58. vendor/wpdesk/wp-saas-platform-client/src/Response/{Cancel → ShipmentCancel}/PostCancelResponse.php +1 -1
  59. vendor/wpdesk/wp-saas-platform-client/src/Response/ShipmentDocument/DeleteShipmentDocumentResponse.php +11 -0
  60. vendor/wpdesk/wp-saas-platform-client/src/Response/ShipmentDocument/PostShipmentDocumentResponse.php +21 -0
  61. vendor/wpdesk/wp-saas-platform-client/src/Response/ShipmentDocumentsSend/PostSendResponse.php +21 -0
  62. vendor/wpdesk/wp-saas-platform-client/src/Response/Traits/ApiResponseDecorator.php +10 -0
assets/css/admin.css CHANGED
@@ -217,7 +217,7 @@ table.flexible_shipping_method_rules tfoot th {
217
  }
218
 
219
  .flexible_shipping_shipment_message_error {
220
- color: #a00;
221
  }
222
 
223
  .flexible_shipping_shipment_message_error span {
@@ -376,6 +376,16 @@ span.flexible_shipping_saas_connection_error {
376
  }
377
 
378
 
 
 
 
 
 
 
 
 
 
 
379
  table.flexible_shipping_services {
380
  max-width: 550px;
381
  }
217
  }
218
 
219
  .flexible_shipping_shipment_message_error {
220
+ color: #a00 !important;
221
  }
222
 
223
  .flexible_shipping_shipment_message_error span {
376
  }
377
 
378
 
379
+ div.flexible-shipping-shipment-attachments p {
380
+ display: inline;
381
+ }
382
+
383
+ .flexible_shipping_shipment_attachment_message {
384
+ padding-top: 10px;
385
+ color: green;
386
+ }
387
+
388
+
389
  table.flexible_shipping_services {
390
  max-width: 550px;
391
  }
assets/css/admin.min.css CHANGED
@@ -1 +1 @@
1
- table.flexible_shipping_methods th.select,table.flexible_shipping_methods td.select{text-align:center;width:40px;margin-top:-7px;margin-left:-6px;padding:2px}table.flexible_shipping_methods .checkbox-select-all{margin:0 12px 0 8px}table.flexible_shipping_methods th.integration,table.flexible_shipping_methods td.integration{text-align:center;width:130px}table.flexible_shipping_methods tr.highlight td{background-color:#e4f2fd}table.flexible_shipping_methods.wc_shipping th{font-weight:400;width:auto}table.flexible_shipping_methods td.ui-sortable-handle:before,table.flexible_shipping_services td.ui-sortable-handle:before{content:'\f333';font-family:Dashicons;text-align:center;line-height:1;color:#999;display:block;width:17px;float:left;height:100%;line-height:24px}table.flexible_shipping_method_rules th,table.flexible_shipping_method_rules th{padding:5px 10px 5px 0}table.flexible_shipping_method_rules td p,table.flexible_shipping_method_rules td p input,table.flexible_shipping_method_rules td p select{margin:0;width:100%;box-shadow:none;padding:0 !important}table.flexible_shipping_method_rules td p input[type=text]{text-align:right;padding:0 5px 0 5px !important;width:100% !important}table.flexible_shipping_method_rules td p select{margin:0;width:100% !important;box-shadow:none;line-height:28px;height:37px;vertical-align:middle}table.flexible_shipping_method_rules td p input[type=checkbox]{margin:0;width:auto}table.flexible_shipping_method_rules th,table.flexible_shipping_method_rules td{text-align:center}table.flexible_shipping_method_rules th.shipping_class,table.flexible_shipping_method_rules td.shipping_class{text-align:center;width:200px}table.flexible_shipping_method_rules td.shipping_class span{border:0}table.flexible_shipping_method_rules th.stop,table.flexible_shipping_method_rules td.stop{text-align:center;width:30px}table.flexible_shipping_method_rules th.cancel,table.flexible_shipping_method_rules td.cancel{text-align:center;width:60px}.woocommerce table.form-table .flexible_shipping_method_rules th span.woocommerce-help-tip{float:none;margin:0}.woocommerce table.form-table .flexible_shipping_method_rules .select2-container{margin:0}.woocommerce table.form-table .fs-locations-table .select2-container{max-width:none}.woocommerce table.form-table .fs-locations-table th .woocommerce-help-tip{float:none}div.flexilble_shipping_export_import{float:right}table.flexible_shipping_method_rules tfoot th{padding:10px}.woocommerce_page_wc-settings #mainform{position:relative}.flexible-shipping-pro-box{max-width:280px;min-width:180px;right:0;position:absolute;top:135px}@media screen and (max-width:1199px){.flexible-shipping-pro-box{display:none}}.column-flexible_shipping{width:130px}.column-flexible_shipping .shipping-status{float:left;margin-right:8px;margin-top:4px;text-align:left;width:18px}.column-flexible_shipping .shipping-status .created:after{color:#d0c21f !important}.column-flexible_shipping .shipping-actions a.button{float:left;margin:0 4px 2px 0;display:block;height:2em !important;padding:0 !important;position:relative;text-indent:-9999px;width:2em}.column-flexible_shipping .shipping-actions a.button:after{font-family:WooCommerce;font-variant:normal;font-weight:400;height:100%;left:0;line-height:1.85;margin:0;position:absolute;text-align:center;text-indent:0;text-transform:none;top:0;width:100%}.column-flexible_shipping .shipping-actions a.button.get-label:after{content:"\e01e"}.column-flexible_shipping .shipping-actions a.button.track:after{content:"\e01b"}.column-flexible_shipping mark.failed:after{color:#a00 !important}.column-flexible_shipping mark.manifest:after{color:#2ea2cc !important}.flexible_shipping_shipment_message{color:green}.flexible_shipping_shipment_message_error{color:#a00}.flexible_shipping_shipment_message_error span{color:#444;font-weight:bold}.wp-admin select{height:100%}.button.flexible-printing-button-print{height:auto !important;white-space:normal !important;word-wrap:break-word !important}.inspire-settings{display:table;width:100%}.inspire-settings .inspire-main-content,.inspire-settings .inspire-sidebar{display:table-cell;height:500px;margin:0;padding:0;vertical-align:top}.inspire-settings .inspire-main-content{min-width:800px}.inspire-settings .inspire-sidebar{padding-left:30px;width:250px}.flexible-shipping-info ol{margin-top:0}#wpbody-content .flexible-shipping-info .metabox-holder{padding-top:0}#adminmenu #toplevel_page_flexible-shipping .menu-icon-generic div.wp-menu-image::before{font-family:WooCommerce !important;content:'\e01d'}.fs-new-service{color:#006799}span.flexible_shipping_saas_connection_error{color:#a00;font-weight:bold}.fs-order-item-fallback{margin-top:.5em;color:#888}.flexible_shipping_shipment_content p select{max-width:95%}.flexible_shipping_shipment_content span.description{display:block}.fs-saas-button-cancel-created{float:right;color:#a00;margin-top:5px}.fs-saas-button-cancel-created:hover{color:#a00;cursor:pointer}.flexible_shipping_shipment_content input[type=checkbox]{float:left;margin-right:5px;margin-top:2px !important;opacity:1;border-color:#888}.flexible_shipping_shipment_content input[type=checkbox]:disabled{opacity:.7;border-color:rgba(51,51,51,0.5)}.flexible_shipping_shipment_content p.fs-saas-status span{font-weight:bold;color:#444}.flexible_shipping_shipment_content p.fs-saas-status-fs-new{color:#ffba00}.flexible_shipping_shipment_content p.fs-saas-status-fs-created{color:#d0c21f}.flexible_shipping_shipment_content p.fs-saas-status-fs-confirmed{color:#444}.flexible_shipping_shipment_content p.fs-saas-status-fs-failed{color:#a00}.flexible_shipping_shipment_content p.fs-saas-status-fs-manifest{color:#2ea2cc}.flexible_shipping_shipment_content p.connection-error{font-weight:bold;color:#a00}.fs-saas-shipment span{font-weight:bold}.fs-saas-labels-counts span{font-weight:bold}.fs-saas-no-labels-left{color:#a00}table.flexible_shipping_services{max-width:550px}table.flexible_shipping_services .sort{width:1%}table.flexible_shipping_services .service_code{width:30px}table.flexible_shipping_services .select{text-align:center;width:1%}table.flexible_shipping_services .select input{margin:0 8px 0 8px}.woocommerce table.form-table table.flexible_shipping_services td.service_name input{width:100%}input.woocommerce_flexible_shipping_service_name{width:100%}.updated .fs-banner__button-container{padding:.75rem 0 0}.notice-info.fs-connect__container{border-left:0;padding:0;box-shadow:0 0 0 1px #dfdfdf,0 1px 2px #dfdfdf}@media screen and (max-width:782px){.notice-info.fs-connect__container{padding:0 !important}}.fs-connect__container{display:block;position:relative;box-sizing:border-box}.fs-connect__inner-container>a:first-child{z-index:1}.fs-connect__inner-container{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-wrap:nowrap;flex-wrap:nowrap;-ms-flex-pack:left;justify-content:left}.fs-connect__content-container{width:1250px;position:relative;padding:2rem;z-index:0}@media(min-width:782px){.fs-connect__content-container{padding:2rem 2rem 4rem 2rem}}.fs-connect__content-container p{color:#555;font-size:.875rem}.fs-connect__content-container h2{margin-top:0;color:#555;line-height:1.6}.fs-connect__content-icon{float:right;margin:0 1.5rem 0 2.25rem}.fs-connect__content-icon svg{fill:#0085ba;height:180px;width:auto}@media(max-width:782px){.fs-connect__content-icon.fs-connect-illo{float:none;width:100%;text-align:center;margin:2.25rem 0 1.5rem}}.fs-connect__slide{display:none}.fs-connect__slide.fs__slide-is-active{display:block}@media(min-width:782px){.fs-connect__content-container .fs-banner__button-container{position:absolute;bottom:.5rem}}.fs-banner__button-container .button-primary{margin:0 .3125rem .3125rem 0}.fs-connect__vertical-nav{background-color:#f1f1f1}@media(min-width:600px){.fs-connect__vertical-nav{-ms-flex-direction:column;flex-direction:column;-ms-flex-pack:start;justify-content:flex-start}}@media(max-width:600px){.fs-connect__vertical-nav{display:none}}.fs-connect__vertical-nav-container{width:15rem}.vertical-menu__feature-item-label{display:none}@media(min-width:600px){.vertical-menu__feature-item{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-align:center;align-items:center;border:0;padding:.5rem;border-bottom:1px solid #dfdfdf;border-right:1px solid #dfdfdf;border-left:3px solid #f9f9f9;background-color:#f9f9f9;color:#555;cursor:pointer}.vertical-menu__feature-item:last-of-type{position:relative;top:1px}.vertical-menu__feature-item-is-selected{border-left:3px solid #0085ba;border-right:1px solid #fff;background-color:#fff;color:#2e4453}.vertical-menu__feature-item-is-selected.fs-feature-intro{border-left:3px solid #00be28}.vertical-menu__feature-item-icon{width:1.25rem;height:1.25rem;padding:.25rem;text-align:center}.vertical-menu__feature-item svg{fill:#555;vertical-align:middle}.vertical-menu__feature-item-is-selected svg{fill:#0085ba}.vertical-menu__feature-item-label{display:block;padding:.5rem}}.fs-couriers{margin-top:2.5em}.fs-courier{position:relative;margin-bottom:2.5em;text-align:center}.fs-courier img{height:50px;width:auto}.fs-courier-label{background-color:#333;border-radius:3px;color:#fff;padding:0 4px 1px;position:absolute;right:0;top:-10px}@media(min-width:1200px){.fs-couriers{align-items:center;display:flex;flex-wrap:wrap;justify-content:flex-start}.fs-courier{width:20%}}.admin_page_flexible_shipping_connect_register .notice.is-dismissible,.admin_page_flexible_shipping_connect_register .update-nag,.admin_page_flexible_shipping_connect_register .updated,.admin_page_flexible_shipping_connect_register .settings-error{display:none !important}.fs-page-wrap{margin:0 auto;max-width:45rem}.fs-page-wrap h1{font-weight:normal;margin-bottom:.67em;text-align:center}.fs-box{display:block;position:relative;margin:0 auto 20px;padding:16px;box-sizing:border-box;background:white;box-shadow:0 0 0 1px #dfdfdf,0 1px 2px #dfdfdf}.fs-box:after{content:".";display:block;height:0;clear:both;visibility:hidden}.admin_page_flexible_shipping_connect_register .fs-box,.fs-box.text-center{text-align:center}.admin_page_flexible_shipping_connect_register .fs-box p{margin:1.5em 0}.fs-box input[type="email"]{padding:8px 10px}.fs-actions{padding-left:40px}.fs-actions button:active{vertical-align:inherit !important}.fs-actions .spinner{float:none;margin-top:0}.fs-cols{display:flex;flex-wrap:wrap;justify-content:space-between}.fs-inner-box{box-sizing:border-box;margin-top:30px;padding:0 20px}.fs-inner-box h4{font-size:1.2em;margin-bottom:.37em}.fs-inner-box svg{fill:#0085ba;height:70px;width:auto}@media(min-width:600px){.fs-inner-box{width:33.33%}}
1
+ table.flexible_shipping_methods th.select,table.flexible_shipping_methods td.select{text-align:center;width:40px;margin-top:-7px;margin-left:-6px;padding:2px}table.flexible_shipping_methods .checkbox-select-all{margin:0 12px 0 8px}table.flexible_shipping_methods th.integration,table.flexible_shipping_methods td.integration{text-align:center;width:130px}table.flexible_shipping_methods tr.highlight td{background-color:#e4f2fd}table.flexible_shipping_methods.wc_shipping th{font-weight:400;width:auto}table.flexible_shipping_methods td.ui-sortable-handle:before,table.flexible_shipping_services td.ui-sortable-handle:before{content:'\f333';font-family:Dashicons;text-align:center;line-height:1;color:#999;display:block;width:17px;float:left;height:100%;line-height:24px}table.flexible_shipping_method_rules th,table.flexible_shipping_method_rules th{padding:5px 10px 5px 0}table.flexible_shipping_method_rules td p,table.flexible_shipping_method_rules td p input,table.flexible_shipping_method_rules td p select{margin:0;width:100%;box-shadow:none;padding:0 !important}table.flexible_shipping_method_rules td p input[type=text]{text-align:right;padding:0 5px 0 5px !important;width:100% !important}table.flexible_shipping_method_rules td p select{margin:0;width:100% !important;box-shadow:none;line-height:28px;height:37px;vertical-align:middle}table.flexible_shipping_method_rules td p input[type=checkbox]{margin:0;width:auto}table.flexible_shipping_method_rules th,table.flexible_shipping_method_rules td{text-align:center}table.flexible_shipping_method_rules th.shipping_class,table.flexible_shipping_method_rules td.shipping_class{text-align:center;width:200px}table.flexible_shipping_method_rules td.shipping_class span{border:0}table.flexible_shipping_method_rules th.stop,table.flexible_shipping_method_rules td.stop{text-align:center;width:30px}table.flexible_shipping_method_rules th.cancel,table.flexible_shipping_method_rules td.cancel{text-align:center;width:60px}.woocommerce table.form-table .flexible_shipping_method_rules th span.woocommerce-help-tip{float:none;margin:0}.woocommerce table.form-table .flexible_shipping_method_rules .select2-container{margin:0}.woocommerce table.form-table .fs-locations-table .select2-container{max-width:none}.woocommerce table.form-table .fs-locations-table th .woocommerce-help-tip{float:none}div.flexilble_shipping_export_import{float:right}table.flexible_shipping_method_rules tfoot th{padding:10px}.woocommerce_page_wc-settings #mainform{position:relative}.flexible-shipping-pro-box{max-width:280px;min-width:180px;right:0;position:absolute;top:135px}@media screen and (max-width:1199px){.flexible-shipping-pro-box{display:none}}.column-flexible_shipping{width:130px}.column-flexible_shipping .shipping-status{float:left;margin-right:8px;margin-top:4px;text-align:left;width:18px}.column-flexible_shipping .shipping-status .created:after{color:#d0c21f !important}.column-flexible_shipping .shipping-actions a.button{float:left;margin:0 4px 2px 0;display:block;height:2em !important;padding:0 !important;position:relative;text-indent:-9999px;width:2em}.column-flexible_shipping .shipping-actions a.button:after{font-family:WooCommerce;font-variant:normal;font-weight:400;height:100%;left:0;line-height:1.85;margin:0;position:absolute;text-align:center;text-indent:0;text-transform:none;top:0;width:100%}.column-flexible_shipping .shipping-actions a.button.get-label:after{content:"\e01e"}.column-flexible_shipping .shipping-actions a.button.track:after{content:"\e01b"}.column-flexible_shipping mark.failed:after{color:#a00 !important}.column-flexible_shipping mark.manifest:after{color:#2ea2cc !important}.flexible_shipping_shipment_message{color:green}.flexible_shipping_shipment_message_error{color:#a00 !important}.flexible_shipping_shipment_message_error span{color:#444;font-weight:bold}.wp-admin select{height:100%}.button.flexible-printing-button-print{height:auto !important;white-space:normal !important;word-wrap:break-word !important}.inspire-settings{display:table;width:100%}.inspire-settings .inspire-main-content,.inspire-settings .inspire-sidebar{display:table-cell;height:500px;margin:0;padding:0;vertical-align:top}.inspire-settings .inspire-main-content{min-width:800px}.inspire-settings .inspire-sidebar{padding-left:30px;width:250px}.flexible-shipping-info ol{margin-top:0}#wpbody-content .flexible-shipping-info .metabox-holder{padding-top:0}#adminmenu #toplevel_page_flexible-shipping .menu-icon-generic div.wp-menu-image::before{font-family:WooCommerce !important;content:'\e01d'}.fs-new-service{color:#006799}span.flexible_shipping_saas_connection_error{color:#a00;font-weight:bold}.fs-order-item-fallback{margin-top:.5em;color:#888}.flexible_shipping_shipment_content p select{max-width:95%}.flexible_shipping_shipment_content span.description{display:block}.fs-saas-button-cancel-created{float:right;color:#a00;margin-top:5px}.fs-saas-button-cancel-created:hover{color:#a00;cursor:pointer}.flexible_shipping_shipment_content input[type=checkbox]{float:left;margin-right:5px;margin-top:2px !important;opacity:1;border-color:#888}.flexible_shipping_shipment_content input[type=checkbox]:disabled{opacity:.7;border-color:rgba(51,51,51,0.5)}.flexible_shipping_shipment_content p.fs-saas-status span{font-weight:bold;color:#444}.flexible_shipping_shipment_content p.fs-saas-status-fs-new{color:#ffba00}.flexible_shipping_shipment_content p.fs-saas-status-fs-created{color:#d0c21f}.flexible_shipping_shipment_content p.fs-saas-status-fs-confirmed{color:#444}.flexible_shipping_shipment_content p.fs-saas-status-fs-failed{color:#a00}.flexible_shipping_shipment_content p.fs-saas-status-fs-manifest{color:#2ea2cc}.flexible_shipping_shipment_content p.connection-error{font-weight:bold;color:#a00}.fs-saas-shipment span{font-weight:bold}.fs-saas-labels-counts span{font-weight:bold}.fs-saas-no-labels-left{color:#a00}div.flexible-shipping-shipment-attachments p{display:inline}.flexible_shipping_shipment_attachment_message{padding-top:10px;color:green}table.flexible_shipping_services{max-width:550px}table.flexible_shipping_services .sort{width:1%}table.flexible_shipping_services .service_code{width:30px}table.flexible_shipping_services .select{text-align:center;width:1%}table.flexible_shipping_services .select input{margin:0 8px 0 8px}.woocommerce table.form-table table.flexible_shipping_services td.service_name input{width:100%}input.woocommerce_flexible_shipping_service_name{width:100%}.updated .fs-banner__button-container{padding:.75rem 0 0}.notice-info.fs-connect__container{border-left:0;padding:0;box-shadow:0 0 0 1px #dfdfdf,0 1px 2px #dfdfdf}@media screen and (max-width:782px){.notice-info.fs-connect__container{padding:0 !important}}.fs-connect__container{display:block;position:relative;box-sizing:border-box}.fs-connect__inner-container>a:first-child{z-index:1}.fs-connect__inner-container{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-wrap:nowrap;flex-wrap:nowrap;-ms-flex-pack:left;justify-content:left}.fs-connect__content-container{width:1250px;position:relative;padding:2rem;z-index:0}@media(min-width:782px){.fs-connect__content-container{padding:2rem 2rem 4rem 2rem}}.fs-connect__content-container p{color:#555;font-size:.875rem}.fs-connect__content-container h2{margin-top:0;color:#555;line-height:1.6}.fs-connect__content-icon{float:right;margin:0 1.5rem 0 2.25rem}.fs-connect__content-icon svg{fill:#0085ba;height:180px;width:auto}@media(max-width:782px){.fs-connect__content-icon.fs-connect-illo{float:none;width:100%;text-align:center;margin:2.25rem 0 1.5rem}}.fs-connect__slide{display:none}.fs-connect__slide.fs__slide-is-active{display:block}@media(min-width:782px){.fs-connect__content-container .fs-banner__button-container{position:absolute;bottom:.5rem}}.fs-banner__button-container .button-primary{margin:0 .3125rem .3125rem 0}.fs-connect__vertical-nav{background-color:#f1f1f1}@media(min-width:600px){.fs-connect__vertical-nav{-ms-flex-direction:column;flex-direction:column;-ms-flex-pack:start;justify-content:flex-start}}@media(max-width:600px){.fs-connect__vertical-nav{display:none}}.fs-connect__vertical-nav-container{width:15rem}.vertical-menu__feature-item-label{display:none}@media(min-width:600px){.vertical-menu__feature-item{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-align:center;align-items:center;border:0;padding:.5rem;border-bottom:1px solid #dfdfdf;border-right:1px solid #dfdfdf;border-left:3px solid #f9f9f9;background-color:#f9f9f9;color:#555;cursor:pointer}.vertical-menu__feature-item:last-of-type{position:relative;top:1px}.vertical-menu__feature-item-is-selected{border-left:3px solid #0085ba;border-right:1px solid #fff;background-color:#fff;color:#2e4453}.vertical-menu__feature-item-is-selected.fs-feature-intro{border-left:3px solid #00be28}.vertical-menu__feature-item-icon{width:1.25rem;height:1.25rem;padding:.25rem;text-align:center}.vertical-menu__feature-item svg{fill:#555;vertical-align:middle}.vertical-menu__feature-item-is-selected svg{fill:#0085ba}.vertical-menu__feature-item-label{display:block;padding:.5rem}}.fs-couriers{margin-top:2.5em}.fs-courier{position:relative;margin-bottom:2.5em;text-align:center}.fs-courier img{height:50px;width:auto}.fs-courier-label{background-color:#333;border-radius:3px;color:#fff;padding:0 4px 1px;position:absolute;right:0;top:-10px}@media(min-width:1200px){.fs-couriers{align-items:center;display:flex;flex-wrap:wrap;justify-content:flex-start}.fs-courier{width:20%}}.admin_page_flexible_shipping_connect_register .notice.is-dismissible,.admin_page_flexible_shipping_connect_register .update-nag,.admin_page_flexible_shipping_connect_register .updated,.admin_page_flexible_shipping_connect_register .settings-error{display:none !important}.fs-page-wrap{margin:0 auto;max-width:45rem}.fs-page-wrap h1{font-weight:normal;margin-bottom:.67em;text-align:center}.fs-box{display:block;position:relative;margin:0 auto 20px;padding:16px;box-sizing:border-box;background:white;box-shadow:0 0 0 1px #dfdfdf,0 1px 2px #dfdfdf}.fs-box:after{content:".";display:block;height:0;clear:both;visibility:hidden}.admin_page_flexible_shipping_connect_register .fs-box,.fs-box.text-center{text-align:center}.admin_page_flexible_shipping_connect_register .fs-box p{margin:1.5em 0}.fs-box input[type="email"]{padding:8px 10px}.fs-actions{padding-left:40px}.fs-actions button:active{vertical-align:inherit !important}.fs-actions .spinner{float:none;margin-top:0}.fs-cols{display:flex;flex-wrap:wrap;justify-content:space-between}.fs-inner-box{box-sizing:border-box;margin-top:30px;padding:0 20px}.fs-inner-box h4{font-size:1.2em;margin-bottom:.37em}.fs-inner-box svg{fill:#0085ba;height:70px;width:auto}@media(min-width:600px){.fs-inner-box{width:33.33%}}
assets/js/admin.js CHANGED
@@ -131,21 +131,17 @@ function fs_ajax(button, id, fs_action) {
131
 
132
  jQuery('#flexible_shipping_shipment_' + id + ' .flexible_shipping_shipment_content input, #flexible_shipping_shipment_' + id + ' .flexible_shipping_shipment_content select, #flexible_shipping_shipment_' + id + ' .flexible_shipping_shipment_content textarea').each(function () {
133
  if (jQuery(this).attr('type') == 'radio') {
134
- //data[jQuery(this).attr('name')] = jQuery('#flexible_shipping_shipment_' + id + ' input[name=' + jQuery(this).attr('name') + ']:checked').val();
135
  data = fs_data_set_val( data, jQuery(this).attr('name'), jQuery('#flexible_shipping_shipment_' + id + ' input[name=' + jQuery(this).attr('name') + ']:checked').val() );
136
  }
137
  else if (jQuery(this).attr('type') == 'checkbox') {
138
  if (jQuery(this).is(':checked')) {
139
- //data[jQuery(this).attr('name')] = jQuery(this).val();
140
  data = fs_data_set_val( data, jQuery(this).attr('name'), jQuery(this).val() );
141
  }
142
  else {
143
- //data[jQuery(this).attr('name')] = '';
144
  data = fs_data_set_val( data, jQuery(this).attr('name'), '' );
145
  }
146
  }
147
  else {
148
- //data[jQuery(this).attr('name')] = jQuery(this).val();
149
  data = fs_data_set_val( data, jQuery(this).attr('name'), jQuery(this).val() );
150
  }
151
  });
131
 
132
  jQuery('#flexible_shipping_shipment_' + id + ' .flexible_shipping_shipment_content input, #flexible_shipping_shipment_' + id + ' .flexible_shipping_shipment_content select, #flexible_shipping_shipment_' + id + ' .flexible_shipping_shipment_content textarea').each(function () {
133
  if (jQuery(this).attr('type') == 'radio') {
 
134
  data = fs_data_set_val( data, jQuery(this).attr('name'), jQuery('#flexible_shipping_shipment_' + id + ' input[name=' + jQuery(this).attr('name') + ']:checked').val() );
135
  }
136
  else if (jQuery(this).attr('type') == 'checkbox') {
137
  if (jQuery(this).is(':checked')) {
 
138
  data = fs_data_set_val( data, jQuery(this).attr('name'), jQuery(this).val() );
139
  }
140
  else {
 
141
  data = fs_data_set_val( data, jQuery(this).attr('name'), '' );
142
  }
143
  }
144
  else {
 
145
  data = fs_data_set_val( data, jQuery(this).attr('name'), jQuery(this).val() );
146
  }
147
  });
assets/js/admin_saas_platform.js CHANGED
@@ -89,6 +89,282 @@ function fs_select2() {
89
  }
90
  }
91
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
92
  jQuery(document).on('click','.fs-saas-button-create', function( event ) {
93
  flexible_shipping_saas_click_action( 'send', this, event );
94
  });
@@ -108,6 +384,21 @@ jQuery(document).on('change', 'input[type=checkbox]', function( e ) {
108
  flexible_shipping_saas_checkbox_dependent_field(this);
109
  });
110
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
111
  jQuery(document).ready(function() {
112
  fs_select2();
113
  });
89
  }
90
  }
91
 
92
+ function flexible_shipping_saas_add_attachment( element, event ) {
93
+ event.stopImmediatePropagation();
94
+ event.preventDefault();
95
+
96
+ flexible_shipping_saas_choose_attachment( element, event );
97
+ }
98
+
99
+
100
+ function flexible_shipping_saas_send_attachments( element, event ) {
101
+ event.stopImmediatePropagation();
102
+ event.preventDefault();
103
+
104
+ var el = jQuery(element);
105
+
106
+ var shipment_id = el.data('shipment_id');
107
+
108
+ jQuery('#flexible_shipping_shipment_' + shipment_id + ' .flexible_shipping_shipment_attachment_message').hide();
109
+
110
+ var nonce = jQuery('#flexible_shipping_shipment_nonce_' + shipment_id).val();
111
+
112
+ jQuery.ajax({
113
+ url: fs_admin.ajax_url,
114
+ type: 'POST',
115
+ data: {
116
+ action: 'flexible_shipping_send_attachments_for_shipment',
117
+ nonce: nonce,
118
+ shipment_id: shipment_id,
119
+ },
120
+ dataType: 'json',
121
+ }).done(function (response) {
122
+ if (response) {
123
+ if (response == '0') {
124
+ jQuery('#flexible_shipping_shipment_' + shipment_id + ' .flexible_shipping_shipment_attachment_message').show();
125
+ jQuery('#flexible_shipping_shipment_' + shipment_id + ' .flexible_shipping_shipment_attachment_message').html("Invalid response: 0");
126
+ }
127
+ else if (response.status == 'success') {
128
+ jQuery('#flexible_shipping_shipment_' + shipment_id + ' .flexible-shipping-shipment-attachments').replaceWith(response.content);
129
+ jQuery('#flexible_shipping_shipment_' + shipment_id + ' .flexible_shipping_shipment_attachment_message').hide();
130
+ if ( typeof response.message != 'undefined' ) {
131
+ jQuery('#flexible_shipping_shipment_' + shipment_id + ' .flexible_shipping_shipment_attachment_message').show();
132
+ jQuery('#flexible_shipping_shipment_' + shipment_id + ' .flexible_shipping_shipment_attachment_message').html(response.message);
133
+ }
134
+ }
135
+ else {
136
+ if ( typeof response.content !== 'undefined' ) {
137
+ jQuery('#flexible_shipping_shipment_' + shipment_id + ' .flexible_shipping_shipment_attachment_message').removeClass("flexible_shipping_shipment_message_error");
138
+ jQuery('#flexible_shipping_shipment_' + shipment_id + ' .flexible-shipping-shipment-attachments').html(response.content);
139
+ }
140
+ jQuery('#flexible_shipping_shipment_' + shipment_id + ' .flexible_shipping_shipment_attachment_message').addClass("flexible_shipping_shipment_message_error");
141
+ jQuery('#flexible_shipping_shipment_' + shipment_id + ' .flexible_shipping_shipment_attachment_message').show();
142
+ jQuery('#flexible_shipping_shipment_' + shipment_id + ' .flexible_shipping_shipment_attachment_message').html(response.message);
143
+ }
144
+ }
145
+ else {
146
+ jQuery('#flexible_shipping_shipment_' + shipment_id + ' .flexible_shipping_shipment_attachment_message').addClass("flexible_shipping_shipment_message_error");
147
+ jQuery('#flexible_shipping_shipment_' + shipment_id + ' .flexible_shipping_shipment_attachment_message').show();
148
+ jQuery('#flexible_shipping_shipment_' + shipment_id + ' .flexible_shipping_shipment_attachment_message').html("Request failed: invalid method?");
149
+ }
150
+ }).always(function () {
151
+ }).fail(function (jqXHR, textStatus, errorThrown ) {
152
+ jQuery('#flexible_shipping_shipment_' + shipment_id + ' .flexible_shipping_shipment_attachment_message').addClass("flexible_shipping_shipment_message_error");
153
+ jQuery('#flexible_shipping_shipment_' + shipment_id + ' .flexible_shipping_shipment_attachment_message').show();
154
+ jQuery('#flexible_shipping_shipment_' + shipment_id + ' .flexible_shipping_shipment_attachment_message').html(errorThrown);
155
+ })
156
+ }
157
+
158
+ function flexible_shipping_saas_delete_attachment( element, event ) {
159
+ event.stopImmediatePropagation();
160
+ event.preventDefault();
161
+
162
+ var el = jQuery(element);
163
+
164
+ var shipment_id = el.data('shipment_id');
165
+ var saas_attachment_id = el.data('saas_attachment_id');
166
+
167
+ jQuery('#flexible_shipping_shipment_' + shipment_id + ' .flexible_shipping_shipment_attachment_message').hide();
168
+
169
+ var nonce = jQuery('#flexible_shipping_shipment_nonce_' + shipment_id).val();
170
+
171
+ jQuery.ajax({
172
+ url: fs_admin.ajax_url,
173
+ type: 'POST',
174
+ data: {
175
+ action: 'flexible_shipping_delete_attachment_for_shipment',
176
+ nonce: nonce,
177
+ shipment_id: shipment_id,
178
+ saas_attachment_id: saas_attachment_id,
179
+ },
180
+ dataType: 'json',
181
+ }).done(function (response) {
182
+ if (response) {
183
+ if (response == '0') {
184
+ jQuery('#flexible_shipping_shipment_' + shipment_id + ' .flexible_shipping_shipment_attachment_message').show();
185
+ jQuery('#flexible_shipping_shipment_' + shipment_id + ' .flexible_shipping_shipment_attachment_message').html("Invalid response: 0");
186
+ }
187
+ else if (response.status == 'success') {
188
+ jQuery('#flexible_shipping_shipment_' + shipment_id + ' .flexible-shipping-shipment-attachments').replaceWith(response.content);
189
+ jQuery('#flexible_shipping_shipment_' + shipment_id + ' .flexible_shipping_shipment_attachment_message').hide();
190
+ if ( typeof response.message != 'undefined' ) {
191
+ jQuery('#flexible_shipping_shipment_' + shipment_id + ' .flexible_shipping_shipment_attachment_message').show();
192
+ jQuery('#flexible_shipping_shipment_' + shipment_id + ' .flexible_shipping_shipment_attachment_message').html(response.message);
193
+ }
194
+ }
195
+ else {
196
+ if ( typeof response.content !== 'undefined' ) {
197
+ jQuery('#flexible_shipping_shipment_' + shipment_id + ' .flexible_shipping_shipment_attachment_message').removeClass("flexible_shipping_shipment_message_error");
198
+ jQuery('#flexible_shipping_shipment_' + shipment_id + ' .flexible-shipping-shipment-attachments').html(response.content);
199
+ }
200
+ jQuery('#flexible_shipping_shipment_' + shipment_id + ' .flexible_shipping_shipment_attachment_message').addClass("flexible_shipping_shipment_message_error");
201
+ jQuery('#flexible_shipping_shipment_' + shipment_id + ' .flexible_shipping_shipment_attachment_message').show();
202
+ jQuery('#flexible_shipping_shipment_' + shipment_id + ' .flexible_shipping_shipment_attachment_message').html(response.message);
203
+ }
204
+ }
205
+ else {
206
+ jQuery('#flexible_shipping_shipment_' + shipment_id + ' .flexible_shipping_shipment_attachment_message').addClass("flexible_shipping_shipment_message_error");
207
+ jQuery('#flexible_shipping_shipment_' + shipment_id + ' .flexible_shipping_shipment_attachment_message').show();
208
+ jQuery('#flexible_shipping_shipment_' + shipment_id + ' .flexible_shipping_shipment_attachment_message').html("Request failed: invalid method?");
209
+ }
210
+ }).always(function () {
211
+ }).fail(function (jqXHR, textStatus, errorThrown ) {
212
+ jQuery('#flexible_shipping_shipment_' + shipment_id + ' .flexible_shipping_shipment_attachment_message').addClass("flexible_shipping_shipment_message_error");
213
+ jQuery('#flexible_shipping_shipment_' + shipment_id + ' .flexible_shipping_shipment_attachment_message').show();
214
+ jQuery('#flexible_shipping_shipment_' + shipment_id + ' .flexible_shipping_shipment_attachment_message').html(errorThrown);
215
+ })
216
+ }
217
+
218
+
219
+ var downloadable_file_frame;
220
+ var el_content;
221
+ var el_attachment_id;
222
+ var el_attachment_filename;
223
+ var el_shipment_id;
224
+ var el_attachment_type;
225
+
226
+ function flexible_shipping_saas_choose_attachment( element, event ) {
227
+ event.stopImmediatePropagation();
228
+ event.preventDefault();
229
+
230
+ var el = jQuery(element);
231
+
232
+ el_content = el.closest('.flexible-shipping-shipment-attachments');
233
+ el_attachment_id = el_content.find('.flexible-shipping-shipment-attachments-attachment-id');
234
+ el_attachment_filename = el_content.find('.flexible-shipping-shipment-attachments-filename');
235
+ el_shipment_id = el.data('shipment_id');
236
+ el_attachment_type = el_content.find('.flexible-shipping-shipment-attachments-type').val();
237
+
238
+ // If the media frame already exists, reopen it.
239
+ if ( downloadable_file_frame ) {
240
+ downloadable_file_frame.open();
241
+ return;
242
+ }
243
+
244
+ var downloadable_file_states = [
245
+ // Main states.
246
+ new wp.media.controller.Library({
247
+ library: wp.media.query(),
248
+ multiple: true,
249
+ title: el.data('choose'),
250
+ priority: 20,
251
+ filterable: 'uploaded'
252
+ })
253
+ ];
254
+
255
+ // Create the media frame.
256
+ downloadable_file_frame = wp.media.frames.downloadable_file = wp.media({
257
+ // Set the title of the modal.
258
+ title: el.data('choose'),
259
+ library: {
260
+ type: ''
261
+ },
262
+ button: {
263
+ text: el.data('update')
264
+ },
265
+ multiple: true,
266
+ states: downloadable_file_states
267
+ });
268
+
269
+ // When an image is selected, run a callback.
270
+ downloadable_file_frame.on( 'select', function() {
271
+ var attachment_id = '';
272
+ var file_path = '';
273
+ var file_name = '';
274
+ var selection = downloadable_file_frame.state().get( 'selection' );
275
+
276
+ selection.map( function( attachment ) {
277
+ attachment = attachment.toJSON();
278
+
279
+ if ( attachment.id ) {
280
+ attachment_id = attachment.id;
281
+ }
282
+ if ( attachment.url ) {
283
+ file_path = attachment.url;
284
+ }
285
+ if ( attachment.filename ) {
286
+ file_name = attachment.filename;
287
+ }
288
+
289
+ el_attachment_filename.val(file_name).change();
290
+ el_attachment_id.val(attachment_id).change();
291
+
292
+ el.attr( 'disabled', true );
293
+
294
+ flexible_shipping_saas_add_attachment_to_shipment( el_shipment_id, attachment_id, el_attachment_type );
295
+
296
+ el.attr( 'disabled', false );
297
+
298
+ });
299
+
300
+ });
301
+
302
+ // Set post to 0 and set our custom type.
303
+ downloadable_file_frame.on( 'ready', function() {
304
+ downloadable_file_frame.uploader.options.uploader.params = {
305
+ type: 'shipment'
306
+ };
307
+ });
308
+
309
+ // Finally, open the modal.
310
+ downloadable_file_frame.open();
311
+ }
312
+
313
+
314
+ function flexible_shipping_saas_add_attachment_to_shipment( shipment_id, attachment_id, attachment_type ) {
315
+ jQuery('#flexible_shipping_shipment_' + shipment_id + ' .flexible_shipping_shipment_attachment_message').hide();
316
+
317
+ var nonce = jQuery('#flexible_shipping_shipment_nonce_' + shipment_id).val();
318
+
319
+ jQuery.ajax({
320
+ url: fs_admin.ajax_url,
321
+ type: 'POST',
322
+ data: {
323
+ action: 'flexible_shipping_add_attachment_to_shipment',
324
+ nonce: nonce,
325
+ shipment_id: shipment_id,
326
+ attachment_id: attachment_id,
327
+ attachment_type: attachment_type,
328
+ },
329
+ dataType: 'json',
330
+ }).done(function (response) {
331
+ if (response) {
332
+ if (response == '0') {
333
+ jQuery('#flexible_shipping_shipment_' + shipment_id + ' .flexible_shipping_shipment_attachment_message').show();
334
+ jQuery('#flexible_shipping_shipment_' + shipment_id + ' .flexible_shipping_shipment_attachment_message').html("Invalid response: 0");
335
+ }
336
+ else if (response.status == 'success') {
337
+ jQuery('#flexible_shipping_shipment_' + shipment_id + ' .flexible-shipping-shipment-attachments').replaceWith(response.content);
338
+ jQuery('#flexible_shipping_shipment_' + shipment_id + ' .flexible_shipping_shipment_attachment_message').hide();
339
+ if ( typeof response.message != 'undefined' ) {
340
+ jQuery('#flexible_shipping_shipment_' + shipment_id + ' .flexible_shipping_shipment_attachment_message').show();
341
+ jQuery('#flexible_shipping_shipment_' + shipment_id + ' .flexible_shipping_shipment_attachment_message').html(response.message);
342
+ }
343
+ }
344
+ else {
345
+ if ( typeof response.content !== 'undefined' ) {
346
+ jQuery('#flexible_shipping_shipment_' + shipment_id + ' .flexible_shipping_shipment_attachment_message').removeClass("flexible_shipping_shipment_message_error");
347
+ jQuery('#flexible_shipping_shipment_' + shipment_id + ' .flexible_shipping_shipment_content').html(response.content);
348
+ }
349
+ jQuery('#flexible_shipping_shipment_' + shipment_id + ' .flexible_shipping_shipment_attachment_message').addClass("flexible_shipping_shipment_message_error");
350
+ jQuery('#flexible_shipping_shipment_' + shipment_id + ' .flexible_shipping_shipment_attachment_message').show();
351
+ jQuery('#flexible_shipping_shipment_' + shipment_id + ' .flexible_shipping_shipment_attachment_message').html(response.message);
352
+ }
353
+ }
354
+ else {
355
+ jQuery('#flexible_shipping_shipment_' + shipment_id + ' .flexible_shipping_shipment_attachment_message').addClass("flexible_shipping_shipment_message_error");
356
+ jQuery('#flexible_shipping_shipment_' + shipment_id + ' .flexible_shipping_shipment_attachment_message').show();
357
+ jQuery('#flexible_shipping_shipment_' + shipment_id + ' .flexible_shipping_shipment_attachment_message').html("Request failed: invalid method?");
358
+ }
359
+ }).always(function () {
360
+ }).fail(function (jqXHR, textStatus, errorThrown ) {
361
+ jQuery('#flexible_shipping_shipment_' + shipment_id + ' .flexible_shipping_shipment_attachment_message').addClass("flexible_shipping_shipment_message_error");
362
+ jQuery('#flexible_shipping_shipment_' + shipment_id + ' .flexible_shipping_shipment_attachment_message').show();
363
+ jQuery('#flexible_shipping_shipment_' + shipment_id + ' .flexible_shipping_shipment_attachment_message').html(errorThrown);
364
+ })
365
+ }
366
+
367
+
368
  jQuery(document).on('click','.fs-saas-button-create', function( event ) {
369
  flexible_shipping_saas_click_action( 'send', this, event );
370
  });
384
  flexible_shipping_saas_checkbox_dependent_field(this);
385
  });
386
 
387
+
388
+ jQuery(document).on('click','.fs-saas-button-add-attachment', function( e ) {
389
+ flexible_shipping_saas_add_attachment( this, e );
390
+ });
391
+ jQuery(document).on('click','.fs-saas-button-delete-attachment', function( e ) {
392
+ flexible_shipping_saas_delete_attachment( this, e );
393
+ });
394
+ jQuery(document).on('click','.fs-saas-button-send-attachments', function( e ) {
395
+ flexible_shipping_saas_send_attachments( this, e );
396
+ });
397
+ jQuery(document).on('mouseover','.flexible_shipping_shipment_attachment_message', function( e ) {
398
+ // jQuery(this).hide();
399
+ });
400
+
401
+
402
  jQuery(document).ready(function() {
403
  fs_select2();
404
  });
assets/js/admin_saas_platform.min.js CHANGED
@@ -1 +1 @@
1
- function flexible_shipping_saas_integration_options(b){var a="."+b;jQuery(".flexible_shipping_method_rules").css("display","table-row");if(jQuery("#woocommerce_flexible_shipping_method_integration").val()==b){jQuery(a).closest("tr").css("display","table-row")}else{jQuery(a).closest("tr").css("display","none")}flexible_shipping_saas_rates_type_options()}function flexible_shipping_saas_rates_type_options(){if(jQuery("#woocommerce_flexible_shipping_method_integration").length){var a="."+jQuery("#woocommerce_flexible_shipping_method_integration").val();if(a!=="."){var b=jQuery(".fs-rates-type"+a).val();jQuery(a).each(function(c){var d=jQuery(this).closest("tr");if("custom"===b){if(!jQuery(this).hasClass("fs-method")){d.css("display","none")}else{d.css("display","table-row")}}if("live"===b){if(!jQuery(this).hasClass("fs-live")){d.css("display","none")}else{d.css("display","table-row")}}});jQuery(window).trigger("resize");jQuery(a).each(function(c){if("checkbox"===jQuery(this).attr("type")){jQuery(this).trigger("change")}})}}}function flexible_shipping_saas_click_action(c,a,b){let id=jQuery(a).attr("data-id");if(typeof id!=="undefined"){b.stopImmediatePropagation();b.preventDefault();let element_id=fs_id(a);fs_ajax(a,element_id,c)}}function flexible_shipping_saas_checkbox_dependent_field(c){var a=jQuery(c).data("dependent-field-id");if(typeof a!=="undefined"&&jQuery(c).is(":visible")){var e=jQuery("#"+a);if(jQuery(c).is(":checked")){e.closest("tr").css("display","table-row")}else{e.closest("tr").css("display","none")}}var b=jQuery(c).data("dependent-row-class");if(typeof b!=="undefined"){var d=jQuery("."+b);if(jQuery(c).is(":visible")){if(jQuery(c).is(":checked")){d.css("display","table-row")}else{d.css("display","none")}}else{d.css("display","table-row")}}}function fs_select2(){let elements=jQuery(".fs_select2");if(elements.length){if(jQuery.fn.selectWoo){elements.selectWoo()}else{elements.select2()}}}jQuery(document).on("click",".fs-saas-button-create",function(a){flexible_shipping_saas_click_action("send",this,a)});jQuery(document).on("click",".fs-saas-button-save",function(a){flexible_shipping_saas_click_action("save",this,event)});jQuery(document).on("click",".fs-saas-button-cancel-created",function(a){flexible_shipping_saas_click_action("cancel",this,event)});jQuery(document).on("change",".fs-rates-type",function(a){flexible_shipping_saas_rates_type_options()});jQuery(document).on("change","input[type=checkbox]",function(a){flexible_shipping_saas_checkbox_dependent_field(this)});jQuery(document).ready(function(){fs_select2()});
1
+ function flexible_shipping_saas_integration_options(b){var a="."+b;jQuery(".flexible_shipping_method_rules").css("display","table-row");if(jQuery("#woocommerce_flexible_shipping_method_integration").val()==b){jQuery(a).closest("tr").css("display","table-row")}else{jQuery(a).closest("tr").css("display","none")}flexible_shipping_saas_rates_type_options()}function flexible_shipping_saas_rates_type_options(){if(jQuery("#woocommerce_flexible_shipping_method_integration").length){var a="."+jQuery("#woocommerce_flexible_shipping_method_integration").val();if(a!=="."){var b=jQuery(".fs-rates-type"+a).val();jQuery(a).each(function(c){var d=jQuery(this).closest("tr");if("custom"===b){if(!jQuery(this).hasClass("fs-method")){d.css("display","none")}else{d.css("display","table-row")}}if("live"===b){if(!jQuery(this).hasClass("fs-live")){d.css("display","none")}else{d.css("display","table-row")}}});jQuery(window).trigger("resize");jQuery(a).each(function(c){if("checkbox"===jQuery(this).attr("type")){jQuery(this).trigger("change")}})}}}function flexible_shipping_saas_click_action(c,a,b){let id=jQuery(a).attr("data-id");if(typeof id!=="undefined"){b.stopImmediatePropagation();b.preventDefault();let element_id=fs_id(a);fs_ajax(a,element_id,c)}}function flexible_shipping_saas_checkbox_dependent_field(c){var a=jQuery(c).data("dependent-field-id");if(typeof a!=="undefined"&&jQuery(c).is(":visible")){var e=jQuery("#"+a);if(jQuery(c).is(":checked")){e.closest("tr").css("display","table-row")}else{e.closest("tr").css("display","none")}}var b=jQuery(c).data("dependent-row-class");if(typeof b!=="undefined"){var d=jQuery("."+b);if(jQuery(c).is(":visible")){if(jQuery(c).is(":checked")){d.css("display","table-row")}else{d.css("display","none")}}else{d.css("display","table-row")}}}function fs_select2(){let elements=jQuery(".fs_select2");if(elements.length){if(jQuery.fn.selectWoo){elements.selectWoo()}else{elements.select2()}}}function flexible_shipping_saas_add_attachment(a,b){b.stopImmediatePropagation();b.preventDefault();flexible_shipping_saas_choose_attachment(a,b)}function flexible_shipping_saas_send_attachments(a,d){d.stopImmediatePropagation();d.preventDefault();var c=jQuery(a);var e=c.data("shipment_id");jQuery("#flexible_shipping_shipment_"+e+" .flexible_shipping_shipment_attachment_message").hide();var b=jQuery("#flexible_shipping_shipment_nonce_"+e).val();jQuery.ajax({url:fs_admin.ajax_url,type:"POST",data:{action:"flexible_shipping_send_attachments_for_shipment",nonce:b,shipment_id:e},dataType:"json"}).done(function(f){if(f){if(f=="0"){jQuery("#flexible_shipping_shipment_"+e+" .flexible_shipping_shipment_attachment_message").show();jQuery("#flexible_shipping_shipment_"+e+" .flexible_shipping_shipment_attachment_message").html("Invalid response: 0")}else{if(f.status=="success"){jQuery("#flexible_shipping_shipment_"+e+" .flexible-shipping-shipment-attachments").replaceWith(f.content);jQuery("#flexible_shipping_shipment_"+e+" .flexible_shipping_shipment_attachment_message").hide();if(typeof f.message!="undefined"){jQuery("#flexible_shipping_shipment_"+e+" .flexible_shipping_shipment_attachment_message").show();jQuery("#flexible_shipping_shipment_"+e+" .flexible_shipping_shipment_attachment_message").html(f.message)}}else{if(typeof f.content!=="undefined"){jQuery("#flexible_shipping_shipment_"+e+" .flexible_shipping_shipment_attachment_message").removeClass("flexible_shipping_shipment_message_error");jQuery("#flexible_shipping_shipment_"+e+" .flexible-shipping-shipment-attachments").html(f.content)}jQuery("#flexible_shipping_shipment_"+e+" .flexible_shipping_shipment_attachment_message").addClass("flexible_shipping_shipment_message_error");jQuery("#flexible_shipping_shipment_"+e+" .flexible_shipping_shipment_attachment_message").show();jQuery("#flexible_shipping_shipment_"+e+" .flexible_shipping_shipment_attachment_message").html(f.message)}}}else{jQuery("#flexible_shipping_shipment_"+e+" .flexible_shipping_shipment_attachment_message").addClass("flexible_shipping_shipment_message_error");jQuery("#flexible_shipping_shipment_"+e+" .flexible_shipping_shipment_attachment_message").show();jQuery("#flexible_shipping_shipment_"+e+" .flexible_shipping_shipment_attachment_message").html("Request failed: invalid method?")}}).always(function(){}).fail(function(f,h,g){jQuery("#flexible_shipping_shipment_"+e+" .flexible_shipping_shipment_attachment_message").addClass("flexible_shipping_shipment_message_error");jQuery("#flexible_shipping_shipment_"+e+" .flexible_shipping_shipment_attachment_message").show();jQuery("#flexible_shipping_shipment_"+e+" .flexible_shipping_shipment_attachment_message").html(g)})}function flexible_shipping_saas_delete_attachment(b,e){e.stopImmediatePropagation();e.preventDefault();var d=jQuery(b);var f=d.data("shipment_id");var a=d.data("saas_attachment_id");jQuery("#flexible_shipping_shipment_"+f+" .flexible_shipping_shipment_attachment_message").hide();var c=jQuery("#flexible_shipping_shipment_nonce_"+f).val();jQuery.ajax({url:fs_admin.ajax_url,type:"POST",data:{action:"flexible_shipping_delete_attachment_for_shipment",nonce:c,shipment_id:f,saas_attachment_id:a},dataType:"json"}).done(function(g){if(g){if(g=="0"){jQuery("#flexible_shipping_shipment_"+f+" .flexible_shipping_shipment_attachment_message").show();jQuery("#flexible_shipping_shipment_"+f+" .flexible_shipping_shipment_attachment_message").html("Invalid response: 0")}else{if(g.status=="success"){jQuery("#flexible_shipping_shipment_"+f+" .flexible-shipping-shipment-attachments").replaceWith(g.content);jQuery("#flexible_shipping_shipment_"+f+" .flexible_shipping_shipment_attachment_message").hide();if(typeof g.message!="undefined"){jQuery("#flexible_shipping_shipment_"+f+" .flexible_shipping_shipment_attachment_message").show();jQuery("#flexible_shipping_shipment_"+f+" .flexible_shipping_shipment_attachment_message").html(g.message)}}else{if(typeof g.content!=="undefined"){jQuery("#flexible_shipping_shipment_"+f+" .flexible_shipping_shipment_attachment_message").removeClass("flexible_shipping_shipment_message_error");jQuery("#flexible_shipping_shipment_"+f+" .flexible-shipping-shipment-attachments").html(g.content)}jQuery("#flexible_shipping_shipment_"+f+" .flexible_shipping_shipment_attachment_message").addClass("flexible_shipping_shipment_message_error");jQuery("#flexible_shipping_shipment_"+f+" .flexible_shipping_shipment_attachment_message").show();jQuery("#flexible_shipping_shipment_"+f+" .flexible_shipping_shipment_attachment_message").html(g.message)}}}else{jQuery("#flexible_shipping_shipment_"+f+" .flexible_shipping_shipment_attachment_message").addClass("flexible_shipping_shipment_message_error");jQuery("#flexible_shipping_shipment_"+f+" .flexible_shipping_shipment_attachment_message").show();jQuery("#flexible_shipping_shipment_"+f+" .flexible_shipping_shipment_attachment_message").html("Request failed: invalid method?")}}).always(function(){}).fail(function(g,i,h){jQuery("#flexible_shipping_shipment_"+f+" .flexible_shipping_shipment_attachment_message").addClass("flexible_shipping_shipment_message_error");jQuery("#flexible_shipping_shipment_"+f+" .flexible_shipping_shipment_attachment_message").show();jQuery("#flexible_shipping_shipment_"+f+" .flexible_shipping_shipment_attachment_message").html(h)})}var downloadable_file_frame;var el_content;var el_attachment_id;var el_attachment_filename;var el_shipment_id;var el_attachment_type;function flexible_shipping_saas_choose_attachment(a,c){c.stopImmediatePropagation();c.preventDefault();var b=jQuery(a);el_content=b.closest(".flexible-shipping-shipment-attachments");el_attachment_id=el_content.find(".flexible-shipping-shipment-attachments-attachment-id");el_attachment_filename=el_content.find(".flexible-shipping-shipment-attachments-filename");el_shipment_id=b.data("shipment_id");el_attachment_type=el_content.find(".flexible-shipping-shipment-attachments-type").val();if(downloadable_file_frame){downloadable_file_frame.open();return}var d=[new wp.media.controller.Library({library:wp.media.query(),multiple:true,title:b.data("choose"),priority:20,filterable:"uploaded"})];downloadable_file_frame=wp.media.frames.downloadable_file=wp.media({title:b.data("choose"),library:{type:""},button:{text:b.data("update")},multiple:true,states:d});downloadable_file_frame.on("select",function(){var e="";var f="";var h="";var g=downloadable_file_frame.state().get("selection");g.map(function(i){i=i.toJSON();if(i.id){e=i.id}if(i.url){f=i.url}if(i.filename){h=i.filename}el_attachment_filename.val(h).change();el_attachment_id.val(e).change();b.attr("disabled",true);flexible_shipping_saas_add_attachment_to_shipment(el_shipment_id,e,el_attachment_type);b.attr("disabled",false)})});downloadable_file_frame.on("ready",function(){downloadable_file_frame.uploader.options.uploader.params={type:"shipment"}});downloadable_file_frame.open()}function flexible_shipping_saas_add_attachment_to_shipment(d,a,b){jQuery("#flexible_shipping_shipment_"+d+" .flexible_shipping_shipment_attachment_message").hide();var c=jQuery("#flexible_shipping_shipment_nonce_"+d).val();jQuery.ajax({url:fs_admin.ajax_url,type:"POST",data:{action:"flexible_shipping_add_attachment_to_shipment",nonce:c,shipment_id:d,attachment_id:a,attachment_type:b},dataType:"json"}).done(function(e){if(e){if(e=="0"){jQuery("#flexible_shipping_shipment_"+d+" .flexible_shipping_shipment_attachment_message").show();jQuery("#flexible_shipping_shipment_"+d+" .flexible_shipping_shipment_attachment_message").html("Invalid response: 0")}else{if(e.status=="success"){jQuery("#flexible_shipping_shipment_"+d+" .flexible-shipping-shipment-attachments").replaceWith(e.content);jQuery("#flexible_shipping_shipment_"+d+" .flexible_shipping_shipment_attachment_message").hide();if(typeof e.message!="undefined"){jQuery("#flexible_shipping_shipment_"+d+" .flexible_shipping_shipment_attachment_message").show();jQuery("#flexible_shipping_shipment_"+d+" .flexible_shipping_shipment_attachment_message").html(e.message)}}else{if(typeof e.content!=="undefined"){jQuery("#flexible_shipping_shipment_"+d+" .flexible_shipping_shipment_attachment_message").removeClass("flexible_shipping_shipment_message_error");jQuery("#flexible_shipping_shipment_"+d+" .flexible_shipping_shipment_content").html(e.content)}jQuery("#flexible_shipping_shipment_"+d+" .flexible_shipping_shipment_attachment_message").addClass("flexible_shipping_shipment_message_error");jQuery("#flexible_shipping_shipment_"+d+" .flexible_shipping_shipment_attachment_message").show();jQuery("#flexible_shipping_shipment_"+d+" .flexible_shipping_shipment_attachment_message").html(e.message)}}}else{jQuery("#flexible_shipping_shipment_"+d+" .flexible_shipping_shipment_attachment_message").addClass("flexible_shipping_shipment_message_error");jQuery("#flexible_shipping_shipment_"+d+" .flexible_shipping_shipment_attachment_message").show();jQuery("#flexible_shipping_shipment_"+d+" .flexible_shipping_shipment_attachment_message").html("Request failed: invalid method?")}}).always(function(){}).fail(function(e,g,f){jQuery("#flexible_shipping_shipment_"+d+" .flexible_shipping_shipment_attachment_message").addClass("flexible_shipping_shipment_message_error");jQuery("#flexible_shipping_shipment_"+d+" .flexible_shipping_shipment_attachment_message").show();jQuery("#flexible_shipping_shipment_"+d+" .flexible_shipping_shipment_attachment_message").html(f)})}jQuery(document).on("click",".fs-saas-button-create",function(a){flexible_shipping_saas_click_action("send",this,a)});jQuery(document).on("click",".fs-saas-button-save",function(a){flexible_shipping_saas_click_action("save",this,event)});jQuery(document).on("click",".fs-saas-button-cancel-created",function(a){flexible_shipping_saas_click_action("cancel",this,event)});jQuery(document).on("change",".fs-rates-type",function(a){flexible_shipping_saas_rates_type_options()});jQuery(document).on("change","input[type=checkbox]",function(a){flexible_shipping_saas_checkbox_dependent_field(this)});jQuery(document).on("click",".fs-saas-button-add-attachment",function(a){flexible_shipping_saas_add_attachment(this,a)});jQuery(document).on("click",".fs-saas-button-delete-attachment",function(a){flexible_shipping_saas_delete_attachment(this,a)});jQuery(document).on("click",".fs-saas-button-send-attachments",function(a){flexible_shipping_saas_send_attachments(this,a)});jQuery(document).on("mouseover",".flexible_shipping_shipment_attachment_message",function(a){});jQuery(document).ready(function(){fs_select2()});
classes/class-flexible-shipping-plugin.php CHANGED
@@ -17,7 +17,7 @@ class Flexible_Shipping_Plugin
17
  /**
18
  * @var string
19
  */
20
- private $scripts_version = FLEXIBLE_SHIPPING_VERSION . '.181';
21
 
22
  /**
23
  * @var WPDesk_Flexible_Shipping_Admin_Notices
@@ -137,6 +137,10 @@ class Flexible_Shipping_Plugin
137
 
138
  $this->add_hookable( new WPDesk_Flexible_Shipping_SaaS_Collection_Points_Map_Loader() );
139
 
 
 
 
 
140
  }
141
 
142
  /**
@@ -402,6 +406,12 @@ class Flexible_Shipping_Plugin
402
  ) );
403
  wp_enqueue_script( 'fs_admin' );
404
 
 
 
 
 
 
 
405
  wp_register_script( 'fs_admin_saas_platform', trailingslashit( $this->get_plugin_assets_url() ) . 'js/admin_saas_platform' . $suffix . '.js', array( 'jquery' ), $this->scripts_version );
406
  wp_enqueue_script( 'fs_admin_saas_platform' );
407
 
17
  /**
18
  * @var string
19
  */
20
+ private $scripts_version = FLEXIBLE_SHIPPING_VERSION . '.196';
21
 
22
  /**
23
  * @var WPDesk_Flexible_Shipping_Admin_Notices
137
 
138
  $this->add_hookable( new WPDesk_Flexible_Shipping_SaaS_Collection_Points_Map_Loader() );
139
 
140
+ $this->add_hookable( new WPDesk_Flexible_Shipping_Shipment_Saas_Attachments_Upload_Dir() );
141
+
142
+ $this->add_hookable( new WPDesk_Flexible_Shipping_Shipment_Saas_Attachments_Ajax() );
143
+
144
  }
145
 
146
  /**
406
  ) );
407
  wp_enqueue_script( 'fs_admin' );
408
 
409
+ $current_screen = get_current_screen();
410
+
411
+ if ( ! empty( $current_screen ) && 'shop_order' === $current_screen->id ) {
412
+ wp_enqueue_media();
413
+ }
414
+
415
  wp_register_script( 'fs_admin_saas_platform', trailingslashit( $this->get_plugin_assets_url() ) . 'js/admin_saas_platform' . $suffix . '.js', array( 'jquery' ), $this->scripts_version );
416
  wp_enqueue_script( 'fs_admin_saas_platform' );
417
 
classes/csv/class-csv-importer-exception.php ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Import rules from CSV.
5
+ */
6
+ class WPDesk_Flexible_Shipping_Csv_Importer_Exception extends RuntimeException {
7
+ }
classes/csv/class-csv-importer.php ADDED
@@ -0,0 +1,300 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Import shipping methods and rules from CSV.
5
+ */
6
+ class WPDesk_Flexible_Shipping_Csv_Importer {
7
+
8
+ /**
9
+ * Flexible Shipping shipping method.
10
+ *
11
+ * @var WPDesk_Flexible_Shipping
12
+ */
13
+ private $flexible_shipping_method;
14
+
15
+ /**
16
+ * WPDesk_Flexible_Shipping_Csv_Importer constructor.
17
+ *
18
+ * @param WPDesk_Flexible_Shipping $flexible_shipping_method Flexible shipping method.
19
+ */
20
+ public function __construct( $flexible_shipping_method ) {
21
+ $this->flexible_shipping_method = $flexible_shipping_method;
22
+ }
23
+
24
+ /**
25
+ * Load CSV from file.
26
+ *
27
+ * @param string $tmp_name File name.
28
+ *
29
+ * @return array
30
+ */
31
+ private function load_csv_from_file( $tmp_name ) {
32
+ return array_map( function ( $v ) {
33
+ return str_getcsv( $v, ';' );
34
+ }, file( $tmp_name ) );
35
+ }
36
+
37
+ /**
38
+ * Add columns to row.
39
+ *
40
+ * @param array $row Row.
41
+ * @param array $columns Columns.
42
+ * @return array
43
+ */
44
+ private function add_columns_to_row( array $row, array $columns ) {
45
+ foreach ( $columns as $col_key => $col ) {
46
+ $row[ $col ] = $row[ $col_key ];
47
+ }
48
+ return $row;
49
+ }
50
+
51
+ /**
52
+ * Convert rows to named values.
53
+ *
54
+ * @param array $csv_array CSV.
55
+ *
56
+ * @return array
57
+ */
58
+ private function convert_rows_to_named_values( array $csv_array ) {
59
+ $first = true;
60
+ $columns = array();
61
+ foreach ( $csv_array as $row_key => $csv_row ) {
62
+ if ( $first ) {
63
+ $columns = $csv_row;
64
+ } else {
65
+ $csv_array[ $row_key ] = $this->add_columns_to_row( $csv_array[ $row_key ], $columns );
66
+ }
67
+ $first = false;
68
+ }
69
+ return $csv_array;
70
+ }
71
+
72
+
73
+ /**
74
+ * Create new shipping method.
75
+ *
76
+ * @param array $csv_row CSV row.
77
+ * @param array $shipping_methods Shipping methods.
78
+ * @param int $import_row_count Rows count.
79
+ *
80
+ * @return array
81
+ * @throws WPDesk_Flexible_Shipping_Csv_Importer_Exception Exception.
82
+ */
83
+ private function new_shipping_method( array $csv_row, array $shipping_methods, $import_row_count ) {
84
+ $new_shipping_method = array( 'method_enabled' => 'no' );
85
+ if ( ! isset( $csv_row['Method Title'] ) || '' === trim( $csv_row['Method Title'] ) ) {
86
+ throw new WPDesk_Flexible_Shipping_Csv_Importer_Exception( __( 'Sorry, there has been an error. The CSV is invalid or incorrect file type.', 'flexible-shipping' ) );
87
+ }
88
+ $method_title = $csv_row['Method Title'];
89
+ $count = 0;
90
+ while ( $this->flexible_shipping_method->shipping_method_title_used( $method_title, $shipping_methods ) ) {
91
+ if ( 0 === $count ) {
92
+ $method_title = $csv_row['Method Title'] . ' (' . __( 'import', 'flexible-shipping' ) . ')';
93
+ } else {
94
+ $method_title = $csv_row['Method Title'] . ' (' . __( 'import', 'flexible-shipping' ) . ' ' . $count . ')';
95
+ }
96
+ $count ++;
97
+ }
98
+ $new_shipping_method['id'] = $this->flexible_shipping_method->shipping_method_next_id( $shipping_methods );
99
+ $new_shipping_method['id_for_shipping'] = $this->flexible_shipping_method->id . '_' . $this->flexible_shipping_method->instance_id . '_' . $new_shipping_method['id'];
100
+ $new_shipping_method['method_title'] = $method_title;
101
+ $new_shipping_method['method_description'] = $csv_row['Method Description'];
102
+ if ( '' !== trim( $csv_row['Free Shipping'] ) && ! is_numeric( str_replace( ',', '.', $csv_row['Free Shipping'] ) ) ) {
103
+ throw new WPDesk_Flexible_Shipping_Csv_Importer_Exception( sprintf(
104
+ // Translators: free shipping value and row number.
105
+ __( 'Free Shipping value %1$s is not valid number. Row number %2$d.', 'flexible-shipping' ), $csv_row['Free Shipping'], $import_row_count
106
+ ) );
107
+ }
108
+ $new_shipping_method[ WPDesk_Flexible_Shipping::FIELD_METHOD_FREE_SHIPPING ] = str_replace( ',', '.', $csv_row['Free Shipping'] );
109
+ if ( trim( $csv_row['Maximum Cost'] ) !== '' && ! is_numeric( str_replace( ',', '.', $csv_row['Maximum Cost'] ) ) ) {
110
+ throw new WPDesk_Flexible_Shipping_Csv_Importer_Exception( sprintf(
111
+ // Translators: maximum cost value and row number.
112
+ __( 'Maximum Cost value %1$s is not valid number. Row number %2$d.', 'flexible-shipping' ), $csv_row['Maximum Cost'], $import_row_count
113
+ ) );
114
+ }
115
+ $new_shipping_method['method_max_cost'] = str_replace( ',', '.', $csv_row['Maximum Cost'] );
116
+ $new_shipping_method['method_calculation_method'] = $csv_row['Calculation Method'];
117
+ if ( ! in_array(
118
+ $new_shipping_method['method_calculation_method'],
119
+ array( 'sum', 'lowest', 'highest' ),
120
+ true
121
+ ) ) {
122
+ throw new WPDesk_Flexible_Shipping_Csv_Importer_Exception( sprintf(
123
+ // Translators: row number.
124
+ __( 'Invalid value for Calculation Method in row number %d.', 'flexible-shipping' ), $import_row_count
125
+ ) );
126
+ }
127
+ $new_shipping_method['method_visibility'] = $csv_row['Visibility'];
128
+ if ( 'yes' !== $new_shipping_method['method_visibility'] ) {
129
+ $new_shipping_method['method_visibility'] = 'no';
130
+ }
131
+ $new_shipping_method['method_default'] = $csv_row['Default'];
132
+ if ( 'yes' !== $new_shipping_method['method_default'] ) {
133
+ $new_shipping_method['method_default'] = 'no';
134
+ }
135
+ $new_shipping_method['method_rules'] = array();
136
+
137
+ return $new_shipping_method;
138
+ }
139
+
140
+ /**
141
+ * Get numeric value from row.
142
+ *
143
+ * @param array $csv_row CSV row.
144
+ * @param string $column Column.
145
+ * @param int $import_row_count Row count.
146
+ *
147
+ * @return string
148
+ * @throws WPDesk_Flexible_Shipping_Csv_Importer_Exception Exception.
149
+ */
150
+ private function get_numeric_value_from_row( array $csv_row, $column, $import_row_count ) {
151
+ if ( '' !== trim( $csv_row[ $column ] ) && ! is_numeric( str_replace( ',', '.', $csv_row[ $column ] ) ) ) {
152
+ throw new WPDesk_Flexible_Shipping_Csv_Importer_Exception( sprintf(
153
+ // Translators: column name, value and row number.
154
+ __( '%1$s value %2$s is not valid number. Row number %3$d.', 'flexible-shipping' ),
155
+ $column,
156
+ $csv_row['Min'],
157
+ $import_row_count
158
+ ) );
159
+ }
160
+ return str_replace( ',', '.', $csv_row[ $column ] );
161
+ }
162
+
163
+ /**
164
+ * Maybe populate and create shipping classes.
165
+ *
166
+ * @param array $rule Rule.
167
+ *
168
+ * @return array
169
+ * @throws WPDesk_Flexible_Shipping_Csv_Importer_Exception Exception.
170
+ */
171
+ private function maybe_populate_and_create_shipping_classes( array $rule ) {
172
+ if ( '' !== trim( $rule['shipping_class'] ) ) {
173
+ $rule_shipping_classes = explode( ',', trim( $rule['shipping_class'] ) );
174
+ $rule['shipping_class'] = array();
175
+ foreach ( $rule_shipping_classes as $rule_shipping_class ) {
176
+ if ( ! in_array( $rule_shipping_class, array( 'all', 'any', 'none' ), true ) ) {
177
+ $shipping_class_found = false;
178
+ WC()->shipping()->shipping_classes = array();
179
+ $wc_shipping_classes = WC()->shipping()->get_shipping_classes();
180
+ foreach ( $wc_shipping_classes as $shipping_class ) {
181
+ if ( $shipping_class->name === $rule_shipping_class ) {
182
+ $rule['shipping_class'][] = $shipping_class->term_id;
183
+ $shipping_class_found = true;
184
+ }
185
+ }
186
+ if ( ! $shipping_class_found ) {
187
+ $term_id = wp_insert_term( $rule_shipping_class, 'product_shipping_class', array( 'description' => $rule_shipping_class ) );
188
+ if ( is_wp_error( $term_id ) ) {
189
+ throw new WPDesk_Flexible_Shipping_Csv_Importer_Exception( sprintf(
190
+ // Translators: rule shipping class and wp_error message.
191
+ __( 'Error while creating shipping class: %1$s, %2$s', 'flexible-shipping' ), $rule_shipping_class, $term_id->get_error_message()
192
+ ) );
193
+ } else {
194
+ $rule['shipping_class'][] = $term_id['term_id'];
195
+ }
196
+ }
197
+ } else {
198
+ $rule['shipping_class'][] = $rule_shipping_class;
199
+ }
200
+ }
201
+ }
202
+ return $rule;
203
+ }
204
+
205
+ /**
206
+ * New shipping method rule.
207
+ *
208
+ * @param array $csv_row CSV row.
209
+ * @param int $import_row_count Row count.
210
+ *
211
+ * @return array
212
+ * @throws WPDesk_Flexible_Shipping_Csv_Importer_Exception Exception.
213
+ */
214
+ private function new_rule( array $csv_row, $import_row_count ) {
215
+ $rule = array();
216
+ $rule['based_on'] = $csv_row['Based on'];
217
+ if ( ! in_array(
218
+ $rule['based_on'],
219
+ array( 'none', 'value', 'weight', 'item', 'cart_line_item' ),
220
+ true
221
+ ) ) {
222
+ throw new WPDesk_Flexible_Shipping_Csv_Importer_Exception( sprintf(
223
+ // Translators: row number.
224
+ __( 'Invalid value for Based On in row number %d.', 'flexible-shipping' ), $import_row_count
225
+ ) );
226
+ }
227
+
228
+ $rule['min'] = $this->get_numeric_value_from_row( $csv_row, 'Min', $import_row_count );
229
+ $rule['max'] = $this->get_numeric_value_from_row( $csv_row, 'Max', $import_row_count );
230
+ $rule['cost_per_order'] = $this->get_numeric_value_from_row( $csv_row, 'Cost per order', $import_row_count );
231
+ $rule['cost_additional'] = $this->get_numeric_value_from_row( $csv_row, 'Additional cost', $import_row_count );
232
+ $rule['per_value'] = $this->get_numeric_value_from_row( $csv_row, 'Value', $import_row_count );
233
+
234
+ $rule['shipping_class'] = trim( $csv_row['Shipping Class'] );
235
+
236
+ $rule = $this->maybe_populate_and_create_shipping_classes( $rule );
237
+
238
+ $rule['stop'] = $csv_row['Stop'];
239
+ if ( 'yes' === $rule['stop'] ) {
240
+ $rule['stop'] = 1;
241
+ } else {
242
+ $rule['stop'] = 0;
243
+ }
244
+ $rule['cancel'] = $csv_row['Cancel'];
245
+ if ( 'yes' === $rule['cancel'] ) {
246
+ $rule['cancel'] = 1;
247
+ } else {
248
+ $rule['cancel'] = 0;
249
+ }
250
+ return $rule;
251
+ }
252
+
253
+ /**
254
+ * Import file.
255
+ *
256
+ * @param string $tmp_name Tmp file name.
257
+ * @param array $shipping_methods Shipping methods.
258
+ * @return array
259
+ * @throws WPDesk_Flexible_Shipping_Csv_Importer_Exception Exception.
260
+ */
261
+ public function import( $tmp_name, array $shipping_methods ) {
262
+ $csv_array = $this->load_csv_from_file( $tmp_name );
263
+ $csv_array = $this->convert_rows_to_named_values( $csv_array );
264
+
265
+ $first = true;
266
+ $current_method_title = '';
267
+ $method_title = '';
268
+ $imported_shipping_method = array();
269
+ $import_row_count = 0;
270
+ foreach ( $csv_array as $row_key => $csv_row ) {
271
+ $import_row_count ++;
272
+ $new_method = false;
273
+ if ( ! $first ) {
274
+ if ( ! isset( $csv_row['Method Title'] ) || $current_method_title !== $csv_row['Method Title'] || ! isset( $csv_row['Based on'] ) || '' === $csv_row['Based on'] ) {
275
+ $new_method = true;
276
+
277
+ $imported_shipping_method = $this->new_shipping_method( $csv_row, $shipping_methods, $import_row_count );
278
+
279
+ $current_method_title = $imported_shipping_method['method_title'];
280
+ $method_title = $current_method_title;
281
+
282
+ } else {
283
+ $imported_shipping_method['method_rules'][] = $this->new_rule( $csv_row, $import_row_count );
284
+ }
285
+ }
286
+ if ( ! $first ) {
287
+ $shipping_methods[ $imported_shipping_method['id'] ] = $imported_shipping_method;
288
+ if ( $new_method ) {
289
+ WC_Admin_Settings::add_message( sprintf(
290
+ // Translators: imported method title and method title.
291
+ __( 'Shipping method %1$s imported as %2$s.', 'flexible-shipping' ), $current_method_title, $method_title
292
+ ) );
293
+ }
294
+ }
295
+ $first = false;
296
+ }
297
+
298
+ return $shipping_methods;
299
+ }
300
+ }
classes/saas/collection-points/class-saas-collection-points-map.php CHANGED
@@ -17,7 +17,7 @@ class WPDesk_Flexible_Shipping_SaaS_Collection_Points_Map_Loader implements \WPD
17
  *
18
  * @var string
19
  */
20
- private $scripts_version = FLEXIBLE_SHIPPING_VERSION . '.4';
21
 
22
  /**
23
  * Hooks.
17
  *
18
  * @var string
19
  */
20
+ private $scripts_version = FLEXIBLE_SHIPPING_VERSION . '.5';
21
 
22
  /**
23
  * Hooks.
classes/shipment/saas/class-shipment-saas-ajax.php CHANGED
@@ -77,6 +77,14 @@ class WPDesk_Flexible_Shipping_Shipment_Saas_Ajax {
77
  $this->save_fieldset_data( $fieldset, $data );
78
  }
79
  }
 
 
 
 
 
 
 
 
80
  }
81
 
82
  /**
77
  $this->save_fieldset_data( $fieldset, $data );
78
  }
79
  }
80
+ $id = $this->shipment->get_id();
81
+ $data_name = 'attachments_' . $id;
82
+ $meta_value = '';
83
+ if ( isset( $data[ $data_name ] ) ) {
84
+ $meta_value = $data[ $data_name ];
85
+ unset( $meta_value['{count}'] );
86
+ }
87
+ $this->shipment->set_meta( 'attachments', $meta_value );
88
  }
89
 
90
  /**
classes/shipment/saas/class-shipment-saas-attachments-ajax.php ADDED
@@ -0,0 +1,220 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Handle documents for shipments.
5
+ */
6
+ class WPDesk_Flexible_Shipping_Shipment_Saas_Attachments_Ajax implements \WPDesk\PluginBuilder\Plugin\Hookable {
7
+
8
+ const RESPONSE_STATUS = 'status';
9
+ const RESPONSE_MESSAGE = 'message';
10
+ const RESPONSE_STATUS_FAIL = 'fail';
11
+ const RESPONSE_STATUS_SUCCESS = 'success';
12
+
13
+ const FLEXIBLE_SHIPPING_SHIPMENT_NONCE = 'flexible_shipping_shipment_nonce';
14
+
15
+ /**
16
+ * Hooks.
17
+ */
18
+ public function hooks() {
19
+ add_action( 'wp_ajax_flexible_shipping_add_attachment_to_shipment', array( $this, 'handle_ajax_add_attachment' ) );
20
+ add_action( 'wp_ajax_flexible_shipping_delete_attachment_for_shipment', array( $this, 'handle_ajax_delete_attachment' ) );
21
+ add_action( 'wp_ajax_flexible_shipping_send_attachments_for_shipment', array( $this, 'handle_ajax_send_attachments' ) );
22
+ }
23
+
24
+ /**
25
+ * Get value from request parameter.
26
+ *
27
+ * @param string $parameter Parameter name.
28
+ *
29
+ * @return string|null
30
+ */
31
+ private function get_from_request( $parameter ) {
32
+ if ( isset( $_REQUEST[ $parameter ] ) ) { // WPCS: CSRF ok, input var ok.
33
+ return $_REQUEST[ $parameter ]; // WPCS: CSRF ok, input var ok.
34
+ }
35
+ return '';
36
+ }
37
+
38
+ /**
39
+ * Get shipment.
40
+ *
41
+ * @param int $shipment_id Shipment ID.
42
+ *
43
+ * @return WPDesk_Flexible_Shipping_Shipment_Saas|null
44
+ */
45
+ private function get_shipment( $shipment_id ) {
46
+ $shipment = fs_get_shipment( $shipment_id );
47
+ if ( $shipment instanceof WPDesk_Flexible_Shipping_Shipment_Saas ) {
48
+ return $shipment;
49
+ }
50
+ return null;
51
+ }
52
+
53
+ /**
54
+ * Handle AJAX add attachment request.
55
+ */
56
+ public function handle_ajax_add_attachment() {
57
+ $response = array(
58
+ self::RESPONSE_STATUS => self::RESPONSE_STATUS_FAIL,
59
+ self::RESPONSE_MESSAGE => __( 'Unknown error!', 'flexible-shipping' ),
60
+ );
61
+ if ( ! wp_verify_nonce( $this->get_from_request( 'nonce' ), self::FLEXIBLE_SHIPPING_SHIPMENT_NONCE ) ) {
62
+ $response[ self::RESPONSE_STATUS ] = self::RESPONSE_STATUS_FAIL;
63
+ $response[ self::RESPONSE_MESSAGE ] = __( 'Nonce verification error! Invalid request.', 'flexible-shipping' );
64
+ } else {
65
+ $shipment_id = $this->get_from_request( 'shipment_id' );
66
+ $attachment_id = $this->get_from_request( 'attachment_id' );
67
+ $attachment_type = $this->get_from_request( 'attachment_type' );
68
+
69
+ $shipment = $this->get_shipment( intval( $shipment_id ) );
70
+
71
+ $attachment = wp_get_attachment_metadata( $attachment_id );
72
+
73
+ if ( empty( $attachment_type ) ) {
74
+ $response[ self::RESPONSE_MESSAGE ] = __( 'Attachment type not selected!', 'flexible-shipping' );
75
+ } elseif ( false === $attachment ) {
76
+ $response[ self::RESPONSE_MESSAGE ] = __( 'Attachment not found!', 'flexible-shipping' );
77
+ } elseif ( empty( $shipment ) ) {
78
+ $response[ self::RESPONSE_MESSAGE ] = __( 'Shipment not found!', 'flexible-shipping' );
79
+ } else {
80
+
81
+ $shipment_document_request = new \WPDesk\SaasPlatformClient\Model\ShipmentDocument\ShipmentDocumentRequest();
82
+ $shipment_document_request->setDocumentType( $attachment_type );
83
+ $shipment_document_request->setFileContent( base64_encode( file_get_contents( get_attached_file( $attachment_id ) ) ) );
84
+ $ext = '.' . pathinfo( get_attached_file( $attachment_id ), PATHINFO_EXTENSION );
85
+ $shipment_document_request->setFileName( get_the_title( $attachment_id ) . $ext );
86
+
87
+ try {
88
+ $shipment_document = $shipment->get_platform()->requestPostShipmentDocument(
89
+ $shipment_document_request,
90
+ $shipment->get_shipping_service()->get_id(),
91
+ $shipment->get_saas_shipment_id()
92
+ );
93
+
94
+ if ( $shipment_document->isError() ) {
95
+ throw new RuntimeException( $shipment_document->getShipmentDocument()->getMessage() );
96
+ }
97
+
98
+ $shipment_attachments = new WPDesk_Flexible_Shipping_Shipment_Saas_Attachments( $shipment );
99
+ $shipment_attachments->add_attachment( $attachment_type, $attachment_id, $shipment_document->getShipmentDocument()->getId() );
100
+
101
+ $shipment->save();
102
+
103
+ $response[ self::RESPONSE_STATUS ] = self::RESPONSE_STATUS_SUCCESS;
104
+ $response['shipment_id'] = $shipment_id;
105
+ $response['attachment_id'] = $attachment_id;
106
+
107
+ $response[ self::RESPONSE_MESSAGE ] = __( 'Attachment added', 'flexible-shipping' );
108
+ $metabox_attachments = new WPDesk_Flexible_Shipping_Shipment_Saas_Metabox_Attachments( $shipment );
109
+ $response['content'] = $metabox_attachments->get_order_metabox_content();
110
+ } catch ( Exception $e ) {
111
+ $response[ self::RESPONSE_MESSAGE ] = $e->getMessage();
112
+ }
113
+ }
114
+ }
115
+ wp_send_json( $response );
116
+ }
117
+
118
+ /**
119
+ * Handle AJAX delete attachment request.
120
+ */
121
+ public function handle_ajax_delete_attachment() {
122
+ $response = array(
123
+ self::RESPONSE_STATUS => self::RESPONSE_STATUS_FAIL,
124
+ self::RESPONSE_MESSAGE => __( 'Unknown error!', 'flexible-shipping' ),
125
+ );
126
+ if ( ! wp_verify_nonce( $this->get_from_request( 'nonce' ), self::FLEXIBLE_SHIPPING_SHIPMENT_NONCE ) ) {
127
+ $response[ self::RESPONSE_STATUS ] = self::RESPONSE_STATUS_FAIL;
128
+ $response[ self::RESPONSE_MESSAGE ] = __( 'Nonce verification error! Invalid request.', 'flexible-shipping' );
129
+ } else {
130
+ $shipment_id = $this->get_from_request( 'shipment_id' );
131
+ $saas_attachment_id = $this->get_from_request( 'saas_attachment_id' );
132
+
133
+ $shipment = $this->get_shipment( intval( $shipment_id ) );
134
+
135
+ if ( empty( $shipment ) ) {
136
+ $response[ self::RESPONSE_MESSAGE ] = __( 'Shipment not found!', 'flexible-shipping' );
137
+ } else {
138
+
139
+ try {
140
+ $delete_response = $shipment->get_platform()->requestDeleteShipmentDocument( $saas_attachment_id );
141
+
142
+ if ( $delete_response->isError() ) {
143
+ throw new RuntimeException( $delete_response->getResponseMessage() );
144
+ }
145
+
146
+ $shipment_attachments = new WPDesk_Flexible_Shipping_Shipment_Saas_Attachments( $shipment );
147
+
148
+ $deleted = $shipment_attachments->delete_attachment_by_saas_attachment_id( $saas_attachment_id );
149
+
150
+ if ( $deleted ) {
151
+ $shipment->save();
152
+ $response[ self::RESPONSE_STATUS ] = self::RESPONSE_STATUS_SUCCESS;
153
+ $response[ self::RESPONSE_MESSAGE ] = __( 'Attachment deleted', 'flexible-shipping' );
154
+ } else {
155
+ $response[ self::RESPONSE_MESSAGE ] = __( 'Attachment not found!', 'flexible-shipping' );
156
+ }
157
+
158
+ $metabox_attachments = new WPDesk_Flexible_Shipping_Shipment_Saas_Metabox_Attachments( $shipment );
159
+ $response['content'] = $metabox_attachments->get_order_metabox_content();
160
+
161
+ } catch ( Exception $e ) {
162
+ $response[ self::RESPONSE_MESSAGE ] = $e->getMessage();
163
+ }
164
+ }
165
+ }
166
+ wp_send_json( $response );
167
+ }
168
+
169
+ /**
170
+ * Handle AJAX send attachments request.
171
+ */
172
+ public function handle_ajax_send_attachments() {
173
+ $response = array(
174
+ self::RESPONSE_STATUS => self::RESPONSE_STATUS_FAIL,
175
+ self::RESPONSE_MESSAGE => __( 'Unknown error!', 'flexible-shipping' ),
176
+ );
177
+ if ( ! wp_verify_nonce( $this->get_from_request( 'nonce' ), self::FLEXIBLE_SHIPPING_SHIPMENT_NONCE ) ) {
178
+ $response[ self::RESPONSE_STATUS ] = self::RESPONSE_STATUS_FAIL;
179
+ $response[ self::RESPONSE_MESSAGE ] = __( 'Nonce verification error! Invalid request.', 'flexible-shipping' );
180
+ } else {
181
+ $shipment_id = $this->get_from_request( 'shipment_id' );
182
+
183
+ $shipment = $this->get_shipment( intval( $shipment_id ) );
184
+
185
+ if ( empty( $shipment ) ) {
186
+ $response[ self::RESPONSE_MESSAGE ] = __( 'Shipment not found!', 'flexible-shipping' );
187
+ } else {
188
+
189
+ try {
190
+ $send_documents = $shipment->get_platform()->requestPostSendDocuments(
191
+ $shipment->get_saas_shipment_id(),
192
+ $shipment->get_shipping_service()->get_id()
193
+ );
194
+
195
+ if ( $send_documents->isError() ) {
196
+ // Translators: response code.
197
+ throw new RuntimeException( sprintf( __( 'Unable to send documents: %1$s' ), $send_documents->getResponseMessage() ) );
198
+ }
199
+
200
+
201
+ $shipment_attachments = new WPDesk_Flexible_Shipping_Shipment_Saas_Attachments( $shipment );
202
+ $shipment_attachments->mark_attachments_as_sent( $send_documents->getDocumentStatusesResponse()->getDocumentStatuses() );
203
+
204
+ $shipment->save();
205
+
206
+ $response[ self::RESPONSE_STATUS ] = self::RESPONSE_STATUS_SUCCESS;
207
+ $response[ self::RESPONSE_MESSAGE ] = __( 'Attachments send', 'flexible-shipping' );
208
+
209
+ $metabox_attachments = new WPDesk_Flexible_Shipping_Shipment_Saas_Metabox_Attachments( $shipment );
210
+ $response['content'] = $metabox_attachments->get_order_metabox_content();
211
+
212
+ } catch ( Exception $e ) {
213
+ $response[ self::RESPONSE_MESSAGE ] = $e->getMessage();
214
+ }
215
+ }
216
+ }
217
+ wp_send_json( $response );
218
+ }
219
+
220
+ }
classes/shipment/saas/class-shipment-saas-attachments-upload-dir.php ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Handle SaaS attachments upload dir.
5
+ */
6
+ class WPDesk_Flexible_Shipping_Shipment_Saas_Attachments_Upload_Dir implements \WPDesk\PluginBuilder\Plugin\Hookable {
7
+
8
+ const UPLOADS_PATH = '/woocommerce_uploads/shipment_attachments';
9
+
10
+ /**
11
+ * Hooks.
12
+ */
13
+ public function hooks() {
14
+ add_filter( 'upload_dir', array( $this, 'upload_dir' ) );
15
+ }
16
+
17
+ /**
18
+ * Change upload dir for downloadable files.
19
+ *
20
+ * @param array $path_data Array of paths.
21
+ *
22
+ * @return array
23
+ */
24
+ public function upload_dir( $path_data ) {
25
+ if ( isset( $_POST['type'] ) && WPDesk_Flexible_Shipping_Shipment_CPT::POST_TYPE_SHIPMENT === $_POST['type'] ) { // WPCS: CSRF ok, input var ok.
26
+
27
+ if ( empty( $path_data['subdir'] ) ) {
28
+ $path_data['path'] = $path_data['path'] . self::UPLOADS_PATH;
29
+ $path_data['url'] = $path_data['url'] . self::UPLOADS_PATH;
30
+ $path_data['subdir'] = self::UPLOADS_PATH;
31
+ } else {
32
+ $new_subdir = self::UPLOADS_PATH . $path_data['subdir'];
33
+
34
+ $path_data['path'] = str_replace( $path_data['subdir'], $new_subdir, $path_data['path'] );
35
+ $path_data['url'] = str_replace( $path_data['subdir'], $new_subdir, $path_data['url'] );
36
+ $path_data['subdir'] = str_replace( $path_data['subdir'], $new_subdir, $path_data['subdir'] );
37
+ }
38
+ }
39
+ return $path_data;
40
+ }
41
+
42
+ }
classes/shipment/saas/class-shipment-saas-attachments.php ADDED
@@ -0,0 +1,125 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Flexible Shipping SaaS Shipment Attachments.
5
+ */
6
+ class WPDesk_Flexible_Shipping_Shipment_Saas_Attachments {
7
+
8
+ const META_ATTACHMENTS = 'attachments';
9
+
10
+ const SAAS_ATTACHMENT_ID = 'saas_attachment_id';
11
+ const ATTACHMENT_ID = 'attachment_id';
12
+ const TYPE = 'type';
13
+
14
+ /**
15
+ * Shipment.
16
+ *
17
+ * @var WPDesk_Flexible_Shipping_Shipment_Saas
18
+ */
19
+ private $shipment;
20
+
21
+ /**
22
+ * WPDesk_Flexible_Shipping_Shipment_Saas_Attachments constructor.
23
+ *
24
+ * @param WPDesk_Flexible_Shipping_Shipment_Saas $shipment Shipment.
25
+ */
26
+ public function __construct( $shipment ) {
27
+ $this->shipment = $shipment;
28
+ }
29
+
30
+ /**
31
+ * Get attachments.
32
+ *
33
+ * @return array
34
+ */
35
+ public function get_attachments() {
36
+ $attachments = $this->shipment->get_meta( self::META_ATTACHMENTS, array() );
37
+ if ( ! is_array( $attachments ) ) {
38
+ $attachments = array( $attachments );
39
+ }
40
+ foreach ( $attachments as $attachment_key => $attachment ) {
41
+ if ( ! is_array( $attachment ) ) {
42
+ unset( $attachments[ $attachment_key ] );
43
+ } else {
44
+ $attachment_id = $attachment[ self::ATTACHMENT_ID ];
45
+ $ext = '.' . pathinfo( get_attached_file( $attachment_id ), PATHINFO_EXTENSION );
46
+
47
+ $attachments[ $attachment_key ]['filename'] = get_the_title( $attachment_id ) . $ext;
48
+ }
49
+ }
50
+ return $attachments;
51
+ }
52
+
53
+ /**
54
+ * Delete attachment by SaaS attachment ID.
55
+ *
56
+ * @param int $saas_attachment_id SaaS attachment id.
57
+ * @return bool
58
+ */
59
+ public function delete_attachment_by_saas_attachment_id( $saas_attachment_id ) {
60
+ $attachments = $this->get_attachments();
61
+ $deleted = false;
62
+ foreach ( $attachments as $attachment_key => $attachment ) {
63
+ if ( intval( $attachment[ self::SAAS_ATTACHMENT_ID ] ) === intval( $saas_attachment_id ) ) {
64
+ $deleted = true;
65
+ unset( $attachments[ $attachment_key ] );
66
+ $this->shipment->set_meta( self::META_ATTACHMENTS, $attachments );
67
+ }
68
+ }
69
+
70
+ return $deleted;
71
+ }
72
+
73
+ /**
74
+ * Add attachment.
75
+ *
76
+ * @param string $attachment_type Attachment type.
77
+ * @param int $attachment_id Attachment id.
78
+ * @param int $saas_attachment_id SaaS attachment id.
79
+ */
80
+ public function add_attachment( $attachment_type, $attachment_id, $saas_attachment_id ) {
81
+ $attachments = $this->get_attachments();
82
+ $attachments[] = array(
83
+ self::TYPE => $attachment_type,
84
+ self::ATTACHMENT_ID => $attachment_id,
85
+ self::SAAS_ATTACHMENT_ID => $saas_attachment_id,
86
+ );
87
+ $this->shipment->set_meta( self::META_ATTACHMENTS, $attachments );
88
+ }
89
+
90
+ /**
91
+ * Mark attachments as sent.
92
+ *
93
+ * @param array $attachment_statuses Attachment statuses.
94
+ */
95
+ public function mark_attachments_as_sent( $attachment_statuses ) {
96
+ $attachments = $this->get_attachments();
97
+ foreach ( $attachment_statuses as $attachment_status ) {
98
+ $document_id = intval( $attachment_status['documentId'] );
99
+ $document_sent = intval( $attachment_status['documentSent'] );
100
+ foreach ( $attachments as $attachment_key => $attachment ) {
101
+ if ( $document_id === $attachment[ self::SAAS_ATTACHMENT_ID ] ) {
102
+ if ( $document_sent ) {
103
+ $attachment['sent'] = 1;
104
+ } else {
105
+ unset( $attachment['sent'] );
106
+ }
107
+ $attachments[ $attachment_key ] = $attachment;
108
+ }
109
+ }
110
+ }
111
+
112
+ $this->shipment->set_meta( self::META_ATTACHMENTS, $attachments );
113
+
114
+ }
115
+
116
+ /**
117
+ * Are attachments available.
118
+ *
119
+ * @return bool
120
+ */
121
+ public function are_attachments_avaliable() {
122
+ return 'yes' === $this->shipment->get_meta( 'documents', 'no' );
123
+ }
124
+
125
+ }
classes/shipment/saas/class-shipment-saas-metabox-attachments.php ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Metabox attachments content.
5
+ */
6
+ class WPDesk_Flexible_Shipping_Shipment_Saas_Metabox_Attachments {
7
+
8
+ /**
9
+ * Shipment.
10
+ *
11
+ * @var WPDesk_Flexible_Shipping_Shipment_Saas
12
+ */
13
+ private $shipment;
14
+
15
+ /**
16
+ * WPDesk_Flexible_Shipping_Shipment_Saas_Ajax constructor.
17
+ *
18
+ * @param WPDesk_Flexible_Shipping_Shipment_Saas $shipment Shipment.
19
+ */
20
+ public function __construct( WPDesk_Flexible_Shipping_Shipment_Saas $shipment ) {
21
+ $this->shipment = $shipment;
22
+ }
23
+
24
+
25
+ /**
26
+ * Display order metabox attachments.
27
+ */
28
+ public function display_order_metabox_attachments() {
29
+ $shipment_id = $this->shipment->get_id();
30
+ $type_field_id = 'attachment_type';
31
+ $attachment_field_id = 'attachment_attachment_id';
32
+
33
+ $field_label = __( 'Attachments', 'flexible-shipping' );
34
+
35
+ $shipment_attachments = new WPDesk_Flexible_Shipping_Shipment_Saas_Attachments( $this->shipment );
36
+
37
+ $attachments = $shipment_attachments->get_attachments();
38
+
39
+ $attachment_types = array(
40
+ 'COMMERCIAL_INVOICE' => 'Invoice',
41
+ 'CERTIFICATE_OF_ORIGIN' => 'Origin cert',
42
+ 'NAFTA_CERTIFICATE_OF_ORIGIN' => 'NAFTA cert',
43
+ 'PRO_FORMA_INVOICE' => 'Pro Forma Inv',
44
+ 'OTHER' => 'Other',
45
+ );
46
+ if ( $this->shipment->get_status() === WPDesk_Flexible_Shipping_Shipment::STATUS_FS_CONFIRMED ) {
47
+ include 'views/order-metabox-shipment-attachments.php';
48
+ }
49
+ }
50
+
51
+ /**
52
+ * Get order metabox content.
53
+ *
54
+ * @return string
55
+ */
56
+ public function get_order_metabox_content() {
57
+ ob_start();
58
+ $this->display_order_metabox_attachments();
59
+ $content = ob_get_contents();
60
+ ob_end_clean();
61
+ return $content;
62
+ }
63
+
64
+ }
classes/shipment/saas/class-shipment-saas-metabox.php CHANGED
@@ -67,6 +67,17 @@ class WPDesk_Flexible_Shipping_Shipment_Saas_Metabox {
67
  }
68
  }
69
 
 
 
 
 
 
 
 
 
 
 
 
70
  /**
71
  * Get order metabox content.
72
  *
@@ -104,6 +115,8 @@ class WPDesk_Flexible_Shipping_Shipment_Saas_Metabox {
104
  }
105
  }
106
 
 
 
107
  $supports_label = $shipping_service->supports( 'supportsShipmentLabel' );
108
  $supports_cancel = $shipping_service->supports( 'supportsShipmentCancel' );
109
 
67
  }
68
  }
69
 
70
+ /**
71
+ * Display order metabox attachments.
72
+ */
73
+ private function display_order_metabox_attachments() {
74
+ $shipment_attachments = new WPDesk_Flexible_Shipping_Shipment_Saas_Attachments( $this->shipment );
75
+ if ( $shipment_attachments->are_attachments_avaliable() ) {
76
+ $metabox_attachments = new WPDesk_Flexible_Shipping_Shipment_Saas_Metabox_Attachments( $this->shipment );
77
+ $metabox_attachments->display_order_metabox_attachments();
78
+ }
79
+ }
80
+
81
  /**
82
  * Get order metabox content.
83
  *
115
  }
116
  }
117
 
118
+ $this->display_order_metabox_attachments();
119
+
120
  $supports_label = $shipping_service->supports( 'supportsShipmentLabel' );
121
  $supports_cancel = $shipping_service->supports( 'supportsShipmentCancel' );
122
 
classes/shipment/saas/class-shipment-saas.php CHANGED
@@ -667,7 +667,7 @@ class WPDesk_Flexible_Shipping_Shipment_Saas
667
  *
668
  * @return array|null|string
669
  */
670
- private function get_saas_shipment_id() {
671
  return $this->get_meta( self::META_SAAS_SHIPMENT_ID );
672
  }
673
 
667
  *
668
  * @return array|null|string
669
  */
670
+ public function get_saas_shipment_id() {
671
  return $this->get_meta( self::META_SAAS_SHIPMENT_ID );
672
  }
673
 
classes/shipment/saas/views/order-metabox-shipment-attachments.php ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Flexible Shipping
4
+ * @var string $type_field_id Type field ID.
5
+ * @var string $attachment_field_id Attachment field ID.
6
+ * @var string $field_label Field label.
7
+ * @var array $attachments Documents.
8
+ * @var array $attachment_types Allowed document types.
9
+ * @var string $shipment_id Shipment ID.
10
+ */
11
+ ?>
12
+ <?php $show_send_button = false; ?>
13
+ <div class="flexible-shipping-shipment-attachments">
14
+ <hr />
15
+ <h4><?php echo $field_label; ?></h4>
16
+ <div class="flexible-shipping-shipment-attachments-content">
17
+ <table>
18
+ <thead>
19
+ <tr>
20
+ <td><?php _e( 'Type', 'flexible-shipping' ); ?></td>
21
+ <td><?php _e( 'Filename', 'flexible-shipping' ); ?></td>
22
+ <td><?php _e( 'Sent', 'flexible-shipping' ); ?></td>
23
+ <td></td>
24
+ </tr>
25
+ </thead>
26
+ <tbody>
27
+ <?php foreach ( $attachments as $attachment ) : ?>
28
+ <?php $show_send_button = true; ?>
29
+ <?php $type_value = $attachment['type']; ?>
30
+ <?php $attachment_id_value = $attachment['attachment_id']; ?>
31
+ <?php $saas_attachment_id_value = $attachment['saas_attachment_id']; ?>
32
+ <?php $attachment_url = ''; ?>
33
+ <?php $filename_value = $attachment['filename']; ?>
34
+ <?php $sent_value = empty( $attachment['sent'] ) ? __( 'No', 'flexible-shipping' ) : __( 'Yes', 'flexible-shipping' ); ?>
35
+ <?php include 'order-metabox-single-attachment.php'; ?>
36
+ <?php endforeach; ?>
37
+ </tbody>
38
+ </table>
39
+ <?php if ( $show_send_button ) : ?>
40
+ <button
41
+ data-shipment_id="<?php echo esc_attr( $shipment_id ); ?>"
42
+ class="fs-saas-button-send-attachments button"
43
+ ><?php _e( 'Send', 'flexible-shipping' ); ?>
44
+ </button>
45
+ <?php endif; ?>
46
+ </div><br />
47
+ <?php
48
+ $args = array(
49
+ 'id' => $type_field_id,
50
+ 'type' => 'select',
51
+ 'class' => 'flexible-shipping-shipment-attachments-type',
52
+ 'options' => $attachment_types,
53
+ 'value' => $type_value,
54
+ );
55
+ woocommerce_wp_select( $args );
56
+
57
+ $args = array(
58
+ 'id' => $attachment_field_id,
59
+ 'class' => 'flexible-shipping-shipment-attachments-attachment-id',
60
+ 'type' => 'hidden',
61
+ 'value' => $attachment_id_value,
62
+ );
63
+ woocommerce_wp_hidden_input( $args );
64
+ ?>
65
+ <button
66
+ data-shipment_id="<?php echo esc_attr( $shipment_id ); ?>"
67
+ class="fs-saas-button-add-attachment button"
68
+ ><?php _e( 'Add', 'flexible-shipping' ); ?>
69
+ </button>
70
+ <div class="flexible_shipping_shipment_attachment_message" style="display:none;"></div>
71
+ <hr />
72
+ </div>
classes/shipment/saas/views/order-metabox-single-attachment.php ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Flexible Shipping
4
+ * @var array $attachment_types Allowed document types.
5
+ * @var string $type_value Type value.
6
+ *
7
+ * @var string $attachment_url Attachment URL.
8
+ *
9
+ * @var string $filename_value Attachment filename.
10
+ *
11
+ * @var string $shipment_id Shipment ID.
12
+ *
13
+ * @var string $saas_attachment_id_value SaaS attachment ID.
14
+ */
15
+ ?>
16
+ <div class="flexible-shipping-shipment-attachments-single-content">
17
+ <tr>
18
+ <td><?php echo $attachment_types[ $type_value ]; ?>:</td>
19
+ <td>
20
+ <!--
21
+ <a href="<?php echo $attachment_url; ?>" target="_blank"><?php echo $filename_value; ?></a>
22
+ -->
23
+ <?php echo $filename_value; ?>
24
+ </td>
25
+ <td>
26
+ <?php echo $sent_value; ?>
27
+ </td>
28
+ <td>
29
+ <a
30
+ class="fs-saas-button-delete-attachment"
31
+ href="#"
32
+ data-saas_attachment_id="<?php echo esc_attr( $saas_attachment_id_value ); ?>"
33
+ data-shipment_id="<?php echo esc_attr( $shipment_id ); ?>"
34
+ >
35
+ <?php _e( 'Delete', 'flexible-shipping' ); ?>
36
+ </a>
37
+ </td>
38
+ </tr>
39
+ </div>
classes/shipping-method.php CHANGED
@@ -200,7 +200,7 @@ if ( ! class_exists( 'WPDesk_Flexible_Shipping' ) ) {
200
  update_option( 'flexible_shipping_rates', $rates );
201
  }
202
 
203
- private function shipping_method_title_used( $title, $shipping_methods ) {
204
  foreach ( $shipping_methods as $shipping_method ) {
205
  if ( $title == $shipping_method['method_title'] ) {
206
  return true;
@@ -209,7 +209,7 @@ if ( ! class_exists( 'WPDesk_Flexible_Shipping' ) ) {
209
  return false;
210
  }
211
 
212
- private function shipping_method_next_id( $shipping_methods ) {
213
  $next_id = 0;
214
  foreach ( $shipping_methods as $shipping_method ) {
215
  if ( intval($shipping_method['id'] ) > $next_id ) {
@@ -318,189 +318,14 @@ if ( ! class_exists( 'WPDesk_Flexible_Shipping' ) ) {
318
  }
319
  else {
320
  if ( isset( $_POST['import_action'] ) && $_POST['import_action'] == '1' ) {
321
- //self::$messages = array();
322
  $tmp_name = $_FILES['import_file']['tmp_name'];
323
- $csv_array = array_map( function($v) { return str_getcsv( $v, ";" ); }, file( $tmp_name ) );
324
- $first = true;
325
- $columns = array();
326
- $methods = array();
327
- foreach ( $csv_array as $row_key => $csv_row ) {
328
- if ( $first ) {
329
- $columns = $csv_row;
330
- }
331
- else {
332
- foreach ( $columns as $col_key => $col ) {
333
- $csv_array[$row_key][$col] = $csv_row[$col_key];
334
- }
335
- }
336
- $first = false;
337
- }
338
  $shipping_methods = get_option( $this->shipping_methods_option, array() );
339
- $first = true;
340
- $current_method_title = '';
341
- $imported_shipping_method = array();
342
- $import_error = false;
343
- $import_row_count = 0;
344
- foreach ( $csv_array as $row_key => $csv_row ) {
345
- $import_row_count++;
346
- $new_method = false;
347
- if ( $first ) {
348
- $columns = $csv_row;
349
- }
350
- else {
351
- if ( !isset( $csv_row['Method Title'] ) || $current_method_title != $csv_row['Method Title'] || !isset( $csv_row['Based on'] ) || $csv_row['Based on'] == '' ) {
352
- $new_method = true;
353
- $imported_shipping_method = array( 'method_enabled' => 'no' );
354
- if ( !isset( $csv_row['Method Title'] ) || trim( $csv_row['Method Title'] ) == '' ) {
355
- WC_Admin_Settings::add_error( __('Sorry, there has been an error. The CSV is invalid or incorrect file type.', 'flexible-shipping' ) );
356
- //WC_Admin_Settings::add_error( sprintf(__('Shipping method title is not set in row number %d.', 'flexible-shipping' ), $import_row_count ) );
357
- WC_Admin_Settings::show_messages();
358
- return;
359
- }
360
- $current_method_title = $csv_row['Method Title'];
361
- $method_title = $csv_row['Method Title'];
362
- $count = 0;
363
- while ( $this->shipping_method_title_used( $method_title, $shipping_methods ) ) {
364
- if ( $count == 0 ) {
365
- $method_title = $csv_row['Method Title'] . ' (' . __( 'import', 'flexible-shipping' ) . ')';
366
- }
367
- else {
368
- $method_title = $csv_row['Method Title'] . ' (' . __( 'import', 'flexible-shipping' ) . ' ' . $count . ')';
369
- }
370
- $count++;
371
- }
372
- $imported_shipping_method['id'] = $this->shipping_method_next_id( $shipping_methods );
373
- $imported_shipping_method['id_for_shipping'] = $this->id . '_' . $this->instance_id . '_' . $imported_shipping_method['id'];
374
- $imported_shipping_method['method_title'] = $method_title;
375
- $imported_shipping_method['method_description'] = $csv_row['Method Description'];
376
- if ( trim( $csv_row['Free Shipping'] ) != '' && !is_numeric( str_replace( ',', '.', $csv_row['Free Shipping'] ) ) ) {
377
- WC_Admin_Settings::add_error( sprintf(__('Free Shipping value %s is not valid number. Row number %d.', 'flexible-shipping' ), $csv_row['Free Shipping'], $import_row_count ) );
378
- WC_Admin_Settings::show_messages();
379
- return;
380
- }
381
- $imported_shipping_method[self::FIELD_METHOD_FREE_SHIPPING] = str_replace( ',', '.', $csv_row['Free Shipping'] );
382
- if ( trim( $csv_row['Maximum Cost'] ) != '' && !is_numeric( str_replace( ',', '.', $csv_row['Maximum Cost'] ) ) ) {
383
- WC_Admin_Settings::add_error( sprintf(__('Maximum Cost value %s is not valid number. Row number %d.', 'flexible-shipping' ), $csv_row['Maximum Cost'], $import_row_count ) );
384
- WC_Admin_Settings::show_messages();
385
- return;
386
- }
387
- $imported_shipping_method['method_max_cost'] = str_replace( ',', '.', $csv_row['Maximum Cost'] );
388
- $imported_shipping_method['method_calculation_method'] = $csv_row['Calculation Method'];
389
- if ( !in_array( $imported_shipping_method['method_calculation_method'], array(
390
- 'sum',
391
- 'lowest',
392
- 'highest'
393
- ) ) ) {
394
- WC_Admin_Settings::add_error( sprintf(__('Invalid value for Calculation Method in row number %d.', 'flexible-shipping' ), $import_row_count ) );
395
- WC_Admin_Settings::show_messages();
396
- return;
397
- }
398
- $imported_shipping_method['method_visibility'] = $csv_row['Visibility'];
399
- if ( $imported_shipping_method['method_visibility'] !== 'yes' ) {
400
- $imported_shipping_method['method_visibility'] = 'no';
401
- }
402
- $imported_shipping_method['method_default'] = $csv_row['Default'];
403
- if ( $imported_shipping_method['method_default'] !== 'yes' ) {
404
- $imported_shipping_method['method_default'] = 'no';
405
- }
406
- $imported_shipping_method['method_rules'] = array();
407
- }
408
- else {
409
- $rule = array();
410
- $rule['based_on'] = $csv_row['Based on'];
411
- if ( !in_array( $rule['based_on'], array(
412
- 'none',
413
- 'value',
414
- 'weight',
415
- 'item',
416
- 'cart_line_item',
417
- ) ) ) {
418
- WC_Admin_Settings::add_error( sprintf(__('Invalid value for Based On in row number %d.', 'flexible-shipping' ), $import_row_count ) );
419
- WC_Admin_Settings::show_messages();
420
- return;
421
- }
422
- if ( trim( $csv_row['Min'] ) != '' && !is_numeric( str_replace( ',', '.', $csv_row['Min'] ) ) ) {
423
- WC_Admin_Settings::add_error( sprintf(__('Min value %s is not valid number. Row number %d.', 'flexible-shipping' ), $csv_row['Min'], $import_row_count ) );
424
- WC_Admin_Settings::show_messages();
425
- return;
426
- }
427
- $rule['min'] = str_replace( ',', '.', $csv_row['Min'] );
428
- if ( trim( $csv_row['Max'] ) != '' && !is_numeric( str_replace( ',', '.', $csv_row['Max'] ) ) ) {
429
- WC_Admin_Settings::add_error( sprintf(__('Max value %s is not valid number. Row number %d.', 'flexible-shipping' ), $csv_row['Max'], $import_row_count ) );
430
- WC_Admin_Settings::show_messages();
431
- return;
432
- }
433
- $rule['max'] = str_replace( ',', '.', $csv_row['Max'] );
434
- if ( trim( $csv_row['Cost per order'] ) != '' && !is_numeric( str_replace( ',', '.', $csv_row['Cost per order'] ) ) ) {
435
- WC_Admin_Settings::add_error( sprintf(__('Cost per order value %s is not valid number. Row number %d.', 'flexible-shipping' ), $csv_row['Cost per order'], $import_row_count ) );
436
- WC_Admin_Settings::show_messages();
437
- return;
438
- }
439
- $rule['cost_per_order'] = str_replace( ',', '.', $csv_row['Cost per order'] );
440
- if ( trim( $csv_row['Additional cost'] ) != '' && !is_numeric( str_replace( ',', '.', $csv_row['Additional cost'] ) ) ) {
441
- WC_Admin_Settings::add_error( sprintf(__('Additional cost value %s is not valid number. Row number %d.', 'flexible-shipping' ), $csv_row['Additional cost'], $import_row_count ) );
442
- WC_Admin_Settings::show_messages();
443
- return;
444
- }
445
- $rule['cost_additional'] = str_replace( ',', '.', $csv_row['Additional cost'] );
446
- if ( trim( $csv_row['Value'] ) != '' && !is_numeric( str_replace( ',', '.', $csv_row['Value'] ) ) ) {
447
- WC_Admin_Settings::add_error( sprintf(__('Value value %s is not valid number. Row number %d.', 'flexible-shipping' ), $csv_row['Value'], $import_row_count ) );
448
- WC_Admin_Settings::show_messages();
449
- return;
450
- }
451
- $rule['per_value'] = str_replace( ',', '.', $csv_row['Value'] );
452
-
453
- $rule['shipping_class'] = trim( $csv_row['Shipping Class'] );
454
-
455
- if ( trim( $rule['shipping_class'] ) != '' ) {
456
- $rule_shipping_classes = explode( ',', trim( $rule['shipping_class'] ) );
457
- $rule['shipping_class'] = array();
458
- foreach ( $rule_shipping_classes as $rule_shipping_class ) {
459
- if ( !in_array( $rule_shipping_class, array( 'all', 'any', 'none' ) ) ) {
460
- $shipping_class_found = false;
461
- $wc_shipping_classes = WC()->shipping->get_shipping_classes();
462
- foreach ( $wc_shipping_classes as $shipping_class ) {
463
- if ( $shipping_class->name == $rule_shipping_class ) {
464
- $rule['shipping_class'][] = $shipping_class->term_id;
465
- $shipping_class_found = true;
466
- }
467
- }
468
- if ( !$shipping_class_found ) {
469
- $term_id = wp_insert_term( $rule_shipping_class, 'product_shipping_class', array( 'description' => $rule_shipping_class ) );
470
- $rule['shipping_class'][] = $term_id['term_id'];
471
- }
472
- }
473
- else {
474
- $rule['shipping_class'][] = $rule_shipping_class;
475
- }
476
- }
477
- }
478
-
479
- $rule['stop'] = $csv_row['Stop'];
480
- if ( $rule['stop'] == 'yes' ) {
481
- $rule['stop'] = 1;
482
- }
483
- else {
484
- $rule['stop'] = 0;
485
- }
486
- $rule['cancel'] = $csv_row['Cancel'];
487
- if ( $rule['cancel'] == 'yes' ) {
488
- $rule['cancel'] = 1;
489
- }
490
- else {
491
- $rule['cancel'] = 0;
492
- }
493
- $imported_shipping_method['method_rules'][] = $rule;
494
- }
495
- }
496
- if ( !$first ) {
497
- $shipping_methods[$imported_shipping_method['id']] = $imported_shipping_method;
498
- if ( $new_method ) {
499
- WC_Admin_Settings::add_message( sprintf(__('Shipping method %s imported as %s.', 'flexible-shipping' ), $current_method_title, $method_title ) );
500
- }
501
- update_option( $this->shipping_methods_option, $shipping_methods );
502
- }
503
- $first = false;
504
  }
505
  WC_Admin_Settings::show_messages();
506
  }
200
  update_option( 'flexible_shipping_rates', $rates );
201
  }
202
 
203
+ public function shipping_method_title_used( $title, $shipping_methods ) {
204
  foreach ( $shipping_methods as $shipping_method ) {
205
  if ( $title == $shipping_method['method_title'] ) {
206
  return true;
209
  return false;
210
  }
211
 
212
+ public function shipping_method_next_id( $shipping_methods ) {
213
  $next_id = 0;
214
  foreach ( $shipping_methods as $shipping_method ) {
215
  if ( intval($shipping_method['id'] ) > $next_id ) {
318
  }
319
  else {
320
  if ( isset( $_POST['import_action'] ) && $_POST['import_action'] == '1' ) {
 
321
  $tmp_name = $_FILES['import_file']['tmp_name'];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
322
  $shipping_methods = get_option( $this->shipping_methods_option, array() );
323
+ try {
324
+ $importer = new WPDesk_Flexible_Shipping_Csv_Importer( $this );
325
+ $shipping_methods = $importer->import( $tmp_name, $shipping_methods );
326
+ update_option( $this->shipping_methods_option, $shipping_methods );
327
+ } catch ( Exception $e ) {
328
+ WC_Admin_Settings::add_message( $e->getMessage() );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
329
  }
330
  WC_Admin_Settings::show_messages();
331
  }
flexible-shipping.php CHANGED
@@ -3,15 +3,16 @@
3
  Plugin Name: Flexible Shipping
4
  Plugin URI: https://wordpress.org/plugins/flexible-shipping/
5
  Description: Create additional shipment methods in WooCommerce and enable pricing based on cart weight or total.
6
- Version: 3.2.0
7
  Author: WP Desk
8
  Author URI: https://www.wpdesk.net/
9
  Text Domain: flexible-shipping
10
  Domain Path: /lang/
11
  Requires at least: 4.5
12
- Tested up to: 5.1.0
13
- WC requires at least: 3.1.0
14
- WC tested up to: 3.5.6
 
15
 
16
  Copyright 2017 WP Desk Ltd.
17
 
@@ -44,8 +45,8 @@ if ( ! class_exists( 'WPDesk_Basic_Requirement_Checker' ) ) {
44
 
45
  /* THESE TWO VARIABLES CAN BE CHANGED AUTOMATICALLY */
46
 
47
- $plugin_version = '3.2.0';
48
- $plugin_release_timestamp = '2019-02-06';
49
 
50
  $plugin_name = 'Flexible Shipping';
51
  $plugin_class_name = 'Flexible_Shipping_Plugin';
3
  Plugin Name: Flexible Shipping
4
  Plugin URI: https://wordpress.org/plugins/flexible-shipping/
5
  Description: Create additional shipment methods in WooCommerce and enable pricing based on cart weight or total.
6
+ Version: 3.3.1
7
  Author: WP Desk
8
  Author URI: https://www.wpdesk.net/
9
  Text Domain: flexible-shipping
10
  Domain Path: /lang/
11
  Requires at least: 4.5
12
+ Tested up to: 5.1.1
13
+ WC requires at least: 3.1.0
14
+ WC tested up to: 3.6
15
+ Requires PHP: 5.6
16
 
17
  Copyright 2017 WP Desk Ltd.
18
 
45
 
46
  /* THESE TWO VARIABLES CAN BE CHANGED AUTOMATICALLY */
47
 
48
+ $plugin_version = '3.3.1';
49
+ $plugin_release_timestamp = '2019-04-01';
50
 
51
  $plugin_name = 'Flexible Shipping';
52
  $plugin_class_name = 'Flexible_Shipping_Plugin';
lang/flexible-shipping-pl_PL.mo CHANGED
Binary file
lang/flexible-shipping-pl_PL.po CHANGED
@@ -1,15 +1,15 @@
1
  msgid ""
2
  msgstr ""
3
  "Project-Id-Version: Flexible Shipping\n"
4
- "POT-Creation-Date: 2019-03-11 11:46+0100\n"
5
- "PO-Revision-Date: 2019-03-11 11:47+0100\n"
6
  "Last-Translator: Piotr Jabłonowski <piotr.jablonowski@wpdesk.net>\n"
7
  "Language-Team: Maciej Swoboda <maciej.swoboda@gmail.com>\n"
8
  "Language: pl_PL\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
- "X-Generator: Poedit 2.2.1\n"
13
  "X-Poedit-Basepath: ..\n"
14
  "X-Poedit-WPHeader: flexible-shipping.php\n"
15
  "Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 "
@@ -22,7 +22,6 @@ msgstr ""
22
  "X-Poedit-SearchPathExcluded-0: *.js\n"
23
  "X-Poedit-SearchPathExcluded-1: vendor\n"
24
 
25
- #. Plugin Name of the plugin/theme
26
  #: classes/abtests/class-ab-menu-page.php:76
27
  #: classes/abtests/class-ab-menu-page.php:77
28
  #: classes/abtests/class-ab-menu-page.php:102 classes/multilingual.php:44
@@ -188,19 +187,19 @@ msgstr ""
188
  msgid "Bulk shipping manifest - processed orders: %d"
189
  msgstr "Zbiorcze tworzenie protokołów nadania - przetworzone zamówienia: %d"
190
 
191
- #: classes/class-flexible-shipping-plugin.php:441
192
  msgid "Settings"
193
  msgstr "Ustawienia"
194
 
195
- #: classes/class-flexible-shipping-plugin.php:443
196
  msgid "Docs"
197
  msgstr "Docs"
198
 
199
- #: classes/class-flexible-shipping-plugin.php:444
200
  msgid "Support"
201
  msgstr "Wsparcie"
202
 
203
- #: classes/class-flexible-shipping-plugin.php:450
204
  msgid "Upgrade"
205
  msgstr "Kup PRO"
206
 
@@ -222,6 +221,52 @@ msgstr "Wybierz integrację"
222
  msgid "Add shipping"
223
  msgstr "Dodaj przesyłkę"
224
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
225
  #: classes/logger/class-saas-logger-downloader.php:57
226
  msgid "File not exists!"
227
  msgstr "Plik nie istnieje!"
@@ -1150,7 +1195,7 @@ msgstr ""
1150
  "Wysyłaj zamówienia szybciej z %1$sFlexible Shipping Connect%2$s%3$s"
1151
  "%4$sZarejestruj się teraz!%5$s"
1152
 
1153
- #: classes/settings/shipping-method-form.php:54 classes/shipping-method.php:911
1154
  msgid "Free"
1155
  msgstr "Bezpłatnie"
1156
 
@@ -1256,10 +1301,16 @@ msgid "See how to %sconfigure shipment methods%s."
1256
  msgstr "Zobacz jak %sskonfigurować metody wysyłki %s."
1257
 
1258
  #: classes/shipment/ajax.php:22
 
 
 
1259
  msgid "Unknown error!"
1260
  msgstr "Nieznany błąd!"
1261
 
1262
  #: classes/shipment/ajax.php:25
 
 
 
1263
  msgid "Nonce verification error! Invalid request."
1264
  msgstr "Błąd weryfikacji nonce! Nieprawidłowe żądanie."
1265
 
@@ -1272,7 +1323,7 @@ msgid "No data!"
1272
  msgstr "Brak danych!"
1273
 
1274
  #: classes/shipment/ajax.php:52
1275
- #: classes/shipment/saas/class-shipment-saas-ajax.php:123
1276
  msgid "Saved"
1277
  msgstr "Zapisano"
1278
 
@@ -1378,30 +1429,66 @@ msgstr "Dane przesyłki"
1378
  msgid "Shipment for order %s, %s"
1379
  msgstr "Przesyłka do zamówienia %s, %s"
1380
 
1381
- #: classes/shipment/saas/class-shipment-saas-ajax.php:90
1382
  #, php-format
1383
  msgid "%1$s Shipment plan exceeded. %2$sPlease upgrade your plan →%3$s"
1384
  msgstr "%1$s Przekroczono plan FS Connect %2$sProszę zmień swój plan →%3$s"
1385
 
1386
- #: classes/shipment/saas/class-shipment-saas-ajax.php:116
1387
  msgid "Shipment cannot be saved for this status!"
1388
  msgstr "Przesyłki nie można zapisać w tym statusie!"
1389
 
1390
- #: classes/shipment/saas/class-shipment-saas-ajax.php:144
1391
  #, php-format
1392
  msgid "Shipment created.%1$sFS Connect plan usage: %2$s/%3$s shipments"
1393
  msgstr ""
1394
  "Przesyłka utworzona.%1$sWykorzystanie planu FS Connect: %2$s/%3$s przesyłek"
1395
 
1396
- #: classes/shipment/saas/class-shipment-saas-ajax.php:185
1397
  msgid "Canceled"
1398
  msgstr "Anulowana"
1399
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1400
  #: classes/shipment/saas/class-shipment-saas-message-formatter.php:42
1401
  #, php-format
1402
  msgid "%1$s notice"
1403
  msgstr "%1$s komunikat"
1404
 
 
 
 
 
1405
  #: classes/shipment/saas/class-shipment-saas-send.php:191
1406
  #: classes/shipment/saas/class-shipment-saas.php:372
1407
  msgid "UPS! Something is wrong!"
@@ -1456,99 +1543,73 @@ msgstr "%1$sKoszt przesyłki:%2$s %3$s"
1456
  msgid "%1$sShipment status:%2$s %3$s"
1457
  msgstr "%1$s Status przesyłki: %2$s %3$s"
1458
 
1459
- #: classes/shipping-method.php:43
1460
- msgid "Shipping Title"
1461
- msgstr "Tytuł"
1462
-
1463
- #: classes/shipping-method.php:115
1464
- #: classes/views/html-shipping-method-rules.php:240
1465
- msgid "Add New"
1466
- msgstr "Dodaj nową"
1467
-
1468
- #: classes/shipping-method.php:355
1469
- msgid ""
1470
- "Sorry, there has been an error. The CSV is invalid or incorrect file type."
1471
- msgstr ""
1472
- "Przepraszamy, wystąpił błąd. Plik CSV jest niepoprawny lub typ pliku jest "
1473
- "nieprawidłowy."
1474
-
1475
- #: classes/shipping-method.php:365 classes/shipping-method.php:368
1476
- msgid "import"
1477
- msgstr "import"
1478
 
1479
- #: classes/shipping-method.php:377
1480
- #, php-format
1481
- msgid "Free Shipping value %s is not valid number. Row number %d."
1482
- msgstr "Wartość darmowej wysyłki %s jest niepoprawna. Numer wiersza %d."
1483
 
1484
- #: classes/shipping-method.php:383
1485
- #, php-format
1486
- msgid "Maximum Cost value %s is not valid number. Row number %d."
1487
- msgstr "Maksymalny koszt %s jest niepoprawny. Numer wiersza %d."
1488
 
1489
- #: classes/shipping-method.php:394
1490
- #, php-format
1491
- msgid "Invalid value for Calculation Method in row number %d."
1492
- msgstr "Nieprawidłowa wartość dla Metody obliczania w wierszu %d."
1493
 
1494
- #: classes/shipping-method.php:418
1495
- #, php-format
1496
- msgid "Invalid value for Based On in row number %d."
1497
- msgstr "Nieprawidłowa wartość dla Oparte na w wierszu %d."
 
1498
 
1499
- #: classes/shipping-method.php:423
1500
- #, php-format
1501
- msgid "Min value %s is not valid number. Row number %d."
1502
- msgstr "Wartość Min %s jest niepoprawna. Numer wiersza %d."
1503
 
1504
- #: classes/shipping-method.php:429
1505
- #, php-format
1506
- msgid "Max value %s is not valid number. Row number %d."
1507
- msgstr "Wartość Maks %s jest niepoprawna. Numer wiersza %d."
1508
-
1509
- #: classes/shipping-method.php:435
1510
- #, php-format
1511
- msgid "Cost per order value %s is not valid number. Row number %d."
1512
- msgstr "Wartość Koszt na zamówienie %s jest niepoprawna. Numer wiersza %d."
1513
 
1514
- #: classes/shipping-method.php:441
1515
- #, php-format
1516
- msgid "Additional cost value %s is not valid number. Row number %d."
1517
- msgstr "Wartość Dodatkowy koszt %s jest niepoprawna. Numer wiersza %d."
1518
 
1519
- #: classes/shipping-method.php:447
1520
- #, php-format
1521
- msgid "Value value %s is not valid number. Row number %d."
1522
- msgstr "Wartość w polu Wartość %s jest niepoprawna. Numer wiersza %d."
1523
 
1524
- #: classes/shipping-method.php:499
1525
- #, php-format
1526
- msgid "Shipping method %s imported as %s."
1527
- msgstr "Metoda wysyłki %s została zaimportowana jako %s."
1528
 
1529
- #: classes/shipping-method.php:559
1530
  msgid "New Shipping Method"
1531
  msgstr "Nowa metoda wysyłki"
1532
 
1533
- #: classes/shipping-method.php:562
1534
  msgid "Edit Shipping Method"
1535
  msgstr "Edytuj metodę wysyłki"
1536
 
1537
- #: classes/shipping-method.php:572 classes/shipping-method.php:614
1538
  #, php-format
1539
  msgid "Shipping method %s added."
1540
  msgstr "Metoda wysyłki dodana: %s."
1541
 
1542
- #: classes/shipping-method.php:597
1543
  #, php-format
1544
  msgid "Shipping method %s deleted."
1545
  msgstr "Metoda wysyłki usunięta: %s."
1546
 
1547
- #: classes/shipping-method.php:600
1548
  msgid "Shipping method not found."
1549
  msgstr "Metoda wysyłki nie znaleziona."
1550
 
1551
- #: classes/shipping-method.php:626
1552
  #, php-format
1553
  msgid "Shipping method %s updated."
1554
  msgstr "Metoda wysyłki zaktualizowana: %s."
@@ -1614,10 +1675,6 @@ msgstr ""
1614
  "Przeciągnij i upuść usługę, aby zmienić kolejność wyświetlania. Zatwierdź "
1615
  "zmiany klikając Zapisz zmiany poniżej."
1616
 
1617
- #: classes/views/html-order-add_shipping-metabox.php:15
1618
- msgid "Add"
1619
- msgstr "Dodaj"
1620
-
1621
  #: classes/views/html-orders-filter-form.php:4
1622
  #: classes/views/html-orders-filter-form.php:12
1623
  msgid "All shippings"
@@ -1909,25 +1966,33 @@ msgstr ""
1909
  msgid "Track shipment: "
1910
  msgstr "Śledź przesyłkę: "
1911
 
1912
- #. Plugin URI of the plugin/theme
1913
- msgid "https://wordpress.org/plugins/flexible-shipping/"
1914
- msgstr "https://pl.wordpress.org/plugins/flexible-shipping/"
1915
 
1916
- #. Description of the plugin/theme
1917
- msgid ""
1918
- "Create additional shipment methods in WooCommerce and enable pricing based "
1919
- "on cart weight or total."
1920
- msgstr ""
1921
- "Stwórz dodatkowe metody wysyłki w WooCommerce i włącz obliczanie kosztów w "
1922
- "oparciu o wagę lub wartość zamówienia."
1923
 
1924
- #. Author of the plugin/theme
1925
- msgid "WP Desk"
1926
- msgstr "WP Desk"
1927
 
1928
- #. Author URI of the plugin/theme
1929
- msgid "https://www.wpdesk.net/"
1930
- msgstr "https://www.wpdesk.pl/"
 
 
 
 
 
 
 
 
 
 
 
 
1931
 
1932
  #~ msgid "Test"
1933
  #~ msgstr "Test"
@@ -2147,9 +2212,6 @@ msgstr "https://www.wpdesk.pl/"
2147
  #~ msgid "Action"
2148
  #~ msgstr "Akcje"
2149
 
2150
- #~ msgid "Delete"
2151
- #~ msgstr "Usuń"
2152
-
2153
  #~ msgid ""
2154
  #~ "If you need more advanced rules based on shipment classes, product/item "
2155
  #~ "count or adding additional handling/insurance fees make sure to check "
1
  msgid ""
2
  msgstr ""
3
  "Project-Id-Version: Flexible Shipping\n"
4
+ "POT-Creation-Date: 2019-04-01 14:08+0200\n"
5
+ "PO-Revision-Date: 2019-04-01 14:15+0200\n"
6
  "Last-Translator: Piotr Jabłonowski <piotr.jablonowski@wpdesk.net>\n"
7
  "Language-Team: Maciej Swoboda <maciej.swoboda@gmail.com>\n"
8
  "Language: pl_PL\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
+ "X-Generator: Poedit 2.1.1\n"
13
  "X-Poedit-Basepath: ..\n"
14
  "X-Poedit-WPHeader: flexible-shipping.php\n"
15
  "Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 "
22
  "X-Poedit-SearchPathExcluded-0: *.js\n"
23
  "X-Poedit-SearchPathExcluded-1: vendor\n"
24
 
 
25
  #: classes/abtests/class-ab-menu-page.php:76
26
  #: classes/abtests/class-ab-menu-page.php:77
27
  #: classes/abtests/class-ab-menu-page.php:102 classes/multilingual.php:44
187
  msgid "Bulk shipping manifest - processed orders: %d"
188
  msgstr "Zbiorcze tworzenie protokołów nadania - przetworzone zamówienia: %d"
189
 
190
+ #: classes/class-flexible-shipping-plugin.php:451
191
  msgid "Settings"
192
  msgstr "Ustawienia"
193
 
194
+ #: classes/class-flexible-shipping-plugin.php:453
195
  msgid "Docs"
196
  msgstr "Docs"
197
 
198
+ #: classes/class-flexible-shipping-plugin.php:454
199
  msgid "Support"
200
  msgstr "Wsparcie"
201
 
202
+ #: classes/class-flexible-shipping-plugin.php:460
203
  msgid "Upgrade"
204
  msgstr "Kup PRO"
205
 
221
  msgid "Add shipping"
222
  msgstr "Dodaj przesyłkę"
223
 
224
+ #: classes/csv/class-csv-importer.php:86
225
+ msgid ""
226
+ "Sorry, there has been an error. The CSV is invalid or incorrect file type."
227
+ msgstr ""
228
+ "Przepraszamy, wystąpił błąd. Plik CSV jest niepoprawny lub typ pliku jest "
229
+ "nieprawidłowy."
230
+
231
+ #: classes/csv/class-csv-importer.php:92 classes/csv/class-csv-importer.php:94
232
+ msgid "import"
233
+ msgstr "import"
234
+
235
+ #: classes/csv/class-csv-importer.php:105
236
+ #, php-format
237
+ msgid "Free Shipping value %1$s is not valid number. Row number %2$d."
238
+ msgstr "Wartość darmowej wysyłki %1$s jest niepoprawna. Numer wiersza %2$d."
239
+
240
+ #: classes/csv/class-csv-importer.php:112
241
+ #, php-format
242
+ msgid "Maximum Cost value %1$s is not valid number. Row number %2$d."
243
+ msgstr "Maksymalny koszt %1$s jest niepoprawny. Numer wiersza %2$d."
244
+
245
+ #: classes/csv/class-csv-importer.php:124
246
+ #, php-format
247
+ msgid "Invalid value for Calculation Method in row number %d."
248
+ msgstr "Nieprawidłowa wartość dla Metody obliczania w wierszu %d."
249
+
250
+ #: classes/csv/class-csv-importer.php:154
251
+ #, php-format
252
+ msgid "%1$s value %2$s is not valid number. Row number %3$d."
253
+ msgstr "%1$s wartość %2$s jest niepoprawna. Numer wiersza %3$d."
254
+
255
+ #: classes/csv/class-csv-importer.php:191
256
+ #, php-format
257
+ msgid "Error while creating shipping class: %1$s, %2$s"
258
+ msgstr "Błąd podczas tworzenia klasy wysyłkowej: %1$s, %2$s"
259
+
260
+ #: classes/csv/class-csv-importer.php:224
261
+ #, php-format
262
+ msgid "Invalid value for Based On in row number %d."
263
+ msgstr "Nieprawidłowa wartość dla Oparte na w wierszu %d."
264
+
265
+ #: classes/csv/class-csv-importer.php:291
266
+ #, php-format
267
+ msgid "Shipping method %1$s imported as %2$s."
268
+ msgstr "Metoda wysyłki %1$s została zaimportowana jako %2$s."
269
+
270
  #: classes/logger/class-saas-logger-downloader.php:57
271
  msgid "File not exists!"
272
  msgstr "Plik nie istnieje!"
1195
  "Wysyłaj zamówienia szybciej z %1$sFlexible Shipping Connect%2$s%3$s"
1196
  "%4$sZarejestruj się teraz!%5$s"
1197
 
1198
+ #: classes/settings/shipping-method-form.php:54 classes/shipping-method.php:736
1199
  msgid "Free"
1200
  msgstr "Bezpłatnie"
1201
 
1301
  msgstr "Zobacz jak %sskonfigurować metody wysyłki %s."
1302
 
1303
  #: classes/shipment/ajax.php:22
1304
+ #: classes/shipment/saas/class-shipment-saas-attachments-ajax.php:59
1305
+ #: classes/shipment/saas/class-shipment-saas-attachments-ajax.php:124
1306
+ #: classes/shipment/saas/class-shipment-saas-attachments-ajax.php:175
1307
  msgid "Unknown error!"
1308
  msgstr "Nieznany błąd!"
1309
 
1310
  #: classes/shipment/ajax.php:25
1311
+ #: classes/shipment/saas/class-shipment-saas-attachments-ajax.php:63
1312
+ #: classes/shipment/saas/class-shipment-saas-attachments-ajax.php:128
1313
+ #: classes/shipment/saas/class-shipment-saas-attachments-ajax.php:179
1314
  msgid "Nonce verification error! Invalid request."
1315
  msgstr "Błąd weryfikacji nonce! Nieprawidłowe żądanie."
1316
 
1323
  msgstr "Brak danych!"
1324
 
1325
  #: classes/shipment/ajax.php:52
1326
+ #: classes/shipment/saas/class-shipment-saas-ajax.php:131
1327
  msgid "Saved"
1328
  msgstr "Zapisano"
1329
 
1429
  msgid "Shipment for order %s, %s"
1430
  msgstr "Przesyłka do zamówienia %s, %s"
1431
 
1432
+ #: classes/shipment/saas/class-shipment-saas-ajax.php:98
1433
  #, php-format
1434
  msgid "%1$s Shipment plan exceeded. %2$sPlease upgrade your plan →%3$s"
1435
  msgstr "%1$s Przekroczono plan FS Connect %2$sProszę zmień swój plan →%3$s"
1436
 
1437
+ #: classes/shipment/saas/class-shipment-saas-ajax.php:124
1438
  msgid "Shipment cannot be saved for this status!"
1439
  msgstr "Przesyłki nie można zapisać w tym statusie!"
1440
 
1441
+ #: classes/shipment/saas/class-shipment-saas-ajax.php:152
1442
  #, php-format
1443
  msgid "Shipment created.%1$sFS Connect plan usage: %2$s/%3$s shipments"
1444
  msgstr ""
1445
  "Przesyłka utworzona.%1$sWykorzystanie planu FS Connect: %2$s/%3$s przesyłek"
1446
 
1447
+ #: classes/shipment/saas/class-shipment-saas-ajax.php:193
1448
  msgid "Canceled"
1449
  msgstr "Anulowana"
1450
 
1451
+ #: classes/shipment/saas/class-shipment-saas-attachments-ajax.php:74
1452
+ msgid "Attachment type not selected!"
1453
+ msgstr "Typ załącznika nie został wybrany!"
1454
+
1455
+ #: classes/shipment/saas/class-shipment-saas-attachments-ajax.php:76
1456
+ #: classes/shipment/saas/class-shipment-saas-attachments-ajax.php:155
1457
+ msgid "Attachment not found!"
1458
+ msgstr "Załącznik nie został znaleziony!"
1459
+
1460
+ #: classes/shipment/saas/class-shipment-saas-attachments-ajax.php:78
1461
+ #: classes/shipment/saas/class-shipment-saas-attachments-ajax.php:136
1462
+ #: classes/shipment/saas/class-shipment-saas-attachments-ajax.php:186
1463
+ msgid "Shipment not found!"
1464
+ msgstr "Przesyłka nie została znaleziona!"
1465
+
1466
+ #: classes/shipment/saas/class-shipment-saas-attachments-ajax.php:107
1467
+ msgid "Attachment added"
1468
+ msgstr "Załącznik został dodany"
1469
+
1470
+ #: classes/shipment/saas/class-shipment-saas-attachments-ajax.php:153
1471
+ msgid "Attachment deleted"
1472
+ msgstr "Załącznik został usunięty"
1473
+
1474
+ #: classes/shipment/saas/class-shipment-saas-attachments-ajax.php:197
1475
+ #, php-format
1476
+ msgid "Unable to send documents: %1$s"
1477
+ msgstr "Nie można wysłać dokumentów: %1$s"
1478
+
1479
+ #: classes/shipment/saas/class-shipment-saas-attachments-ajax.php:207
1480
+ msgid "Attachments send"
1481
+ msgstr "Załączniki zostały wysłane"
1482
+
1483
  #: classes/shipment/saas/class-shipment-saas-message-formatter.php:42
1484
  #, php-format
1485
  msgid "%1$s notice"
1486
  msgstr "%1$s komunikat"
1487
 
1488
+ #: classes/shipment/saas/class-shipment-saas-metabox-attachments.php:33
1489
+ msgid "Attachments"
1490
+ msgstr "Załączniki"
1491
+
1492
  #: classes/shipment/saas/class-shipment-saas-send.php:191
1493
  #: classes/shipment/saas/class-shipment-saas.php:372
1494
  msgid "UPS! Something is wrong!"
1543
  msgid "%1$sShipment status:%2$s %3$s"
1544
  msgstr "%1$s Status przesyłki: %2$s %3$s"
1545
 
1546
+ #: classes/shipment/saas/views/order-metabox-shipment-attachments.php:20
1547
+ msgid "Type"
1548
+ msgstr "Typ"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1549
 
1550
+ #: classes/shipment/saas/views/order-metabox-shipment-attachments.php:21
1551
+ msgid "Filename"
1552
+ msgstr "Nazwa pliku"
 
1553
 
1554
+ #: classes/shipment/saas/views/order-metabox-shipment-attachments.php:22
1555
+ msgid "Sent"
1556
+ msgstr "Wysłany"
 
1557
 
1558
+ #: classes/shipment/saas/views/order-metabox-shipment-attachments.php:34
1559
+ msgid "No"
1560
+ msgstr "Nie"
 
1561
 
1562
+ #: classes/shipment/saas/views/order-metabox-shipment-attachments.php:34
1563
+ msgid "Yes"
1564
+ msgstr ""
1565
+ "T\n"
1566
+ "ak"
1567
 
1568
+ #: classes/shipment/saas/views/order-metabox-shipment-attachments.php:43
1569
+ msgid "Send"
1570
+ msgstr "Wysłany"
 
1571
 
1572
+ #: classes/shipment/saas/views/order-metabox-shipment-attachments.php:68
1573
+ #: classes/views/html-order-add_shipping-metabox.php:15
1574
+ msgid "Add"
1575
+ msgstr "Dodaj"
 
 
 
 
 
1576
 
1577
+ #: classes/shipment/saas/views/order-metabox-single-attachment.php:35
1578
+ msgid "Delete"
1579
+ msgstr "Usuń"
 
1580
 
1581
+ #: classes/shipping-method.php:43
1582
+ msgid "Shipping Title"
1583
+ msgstr "Tytuł"
 
1584
 
1585
+ #: classes/shipping-method.php:115
1586
+ #: classes/views/html-shipping-method-rules.php:240
1587
+ msgid "Add New"
1588
+ msgstr "Dodaj nową"
1589
 
1590
+ #: classes/shipping-method.php:384
1591
  msgid "New Shipping Method"
1592
  msgstr "Nowa metoda wysyłki"
1593
 
1594
+ #: classes/shipping-method.php:387
1595
  msgid "Edit Shipping Method"
1596
  msgstr "Edytuj metodę wysyłki"
1597
 
1598
+ #: classes/shipping-method.php:397 classes/shipping-method.php:439
1599
  #, php-format
1600
  msgid "Shipping method %s added."
1601
  msgstr "Metoda wysyłki dodana: %s."
1602
 
1603
+ #: classes/shipping-method.php:422
1604
  #, php-format
1605
  msgid "Shipping method %s deleted."
1606
  msgstr "Metoda wysyłki usunięta: %s."
1607
 
1608
+ #: classes/shipping-method.php:425
1609
  msgid "Shipping method not found."
1610
  msgstr "Metoda wysyłki nie znaleziona."
1611
 
1612
+ #: classes/shipping-method.php:451
1613
  #, php-format
1614
  msgid "Shipping method %s updated."
1615
  msgstr "Metoda wysyłki zaktualizowana: %s."
1675
  "Przeciągnij i upuść usługę, aby zmienić kolejność wyświetlania. Zatwierdź "
1676
  "zmiany klikając Zapisz zmiany poniżej."
1677
 
 
 
 
 
1678
  #: classes/views/html-orders-filter-form.php:4
1679
  #: classes/views/html-orders-filter-form.php:12
1680
  msgid "All shippings"
1966
  msgid "Track shipment: "
1967
  msgstr "Śledź przesyłkę: "
1968
 
1969
+ #~ msgid "Max value %s is not valid number. Row number %d."
1970
+ #~ msgstr "Wartość Maks %s jest niepoprawna. Numer wiersza %d."
 
1971
 
1972
+ #~ msgid "Cost per order value %s is not valid number. Row number %d."
1973
+ #~ msgstr "Wartość Koszt na zamówienie %s jest niepoprawna. Numer wiersza %d."
1974
+
1975
+ #~ msgid "Additional cost value %s is not valid number. Row number %d."
1976
+ #~ msgstr "Wartość Dodatkowy koszt %s jest niepoprawna. Numer wiersza %d."
 
 
1977
 
1978
+ #~ msgid "Value value %s is not valid number. Row number %d."
1979
+ #~ msgstr "Wartość w polu Wartość %s jest niepoprawna. Numer wiersza %d."
 
1980
 
1981
+ #~ msgid "https://wordpress.org/plugins/flexible-shipping/"
1982
+ #~ msgstr "https://pl.wordpress.org/plugins/flexible-shipping/"
1983
+
1984
+ #~ msgid ""
1985
+ #~ "Create additional shipment methods in WooCommerce and enable pricing "
1986
+ #~ "based on cart weight or total."
1987
+ #~ msgstr ""
1988
+ #~ "Stwórz dodatkowe metody wysyłki w WooCommerce i włącz obliczanie kosztów "
1989
+ #~ "w oparciu o wagę lub wartość zamówienia."
1990
+
1991
+ #~ msgid "WP Desk"
1992
+ #~ msgstr "WP Desk"
1993
+
1994
+ #~ msgid "https://www.wpdesk.net/"
1995
+ #~ msgstr "https://www.wpdesk.pl/"
1996
 
1997
  #~ msgid "Test"
1998
  #~ msgstr "Test"
2212
  #~ msgid "Action"
2213
  #~ msgstr "Akcje"
2214
 
 
 
 
2215
  #~ msgid ""
2216
  #~ "If you need more advanced rules based on shipment classes, product/item "
2217
  #~ "count or adding additional handling/insurance fees make sure to check "
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://flexibleshipping.com/table-rate/
4
  Tags: table rate, table rate shipping, woocommerce shipping, flexible shipping, woocommerce table rate shipping, cart based shipping, weight shipping, weight based shipping, totals based shipping, order based shipping, shipping zones, shipping classes
5
  Requires at least: 4.5
6
  Tested up to: 5.1.0
7
- Stable tag: 3.2.0
8
  Requires PHP: 5.6
9
  License: GPLv3 or later
10
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
@@ -175,6 +175,12 @@ If you are upgrading from the old Flexible Shipping version (1.3.2, woo-flexible
175
 
176
  == Changelog ==
177
 
 
 
 
 
 
 
178
  = 3.2.0 - 2019-03-11 =
179
  * Added support for UPS Access Points for FS Connect
180
  * Removed argument types for WooCommerce types (ie. WC_Order)
4
  Tags: table rate, table rate shipping, woocommerce shipping, flexible shipping, woocommerce table rate shipping, cart based shipping, weight shipping, weight based shipping, totals based shipping, order based shipping, shipping zones, shipping classes
5
  Requires at least: 4.5
6
  Tested up to: 5.1.0
7
+ Stable tag: 3.3.1
8
  Requires PHP: 5.6
9
  License: GPLv3 or later
10
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
175
 
176
  == Changelog ==
177
 
178
+ 3.3.1 - 2019-04-01
179
+ * Fixed CSV import with multiple shipping classes
180
+
181
+ 3.3.0 - 2019-03-19
182
+ * Added support for EDT (Electronic Trade Documents)
183
+
184
  = 3.2.0 - 2019-03-11 =
185
  * Added support for UPS Access Points for FS Connect
186
  * Removed argument types for WooCommerce types (ie. WC_Order)
vendor/autoload.php CHANGED
@@ -4,4 +4,4 @@
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
- return ComposerAutoloaderInit31450fef395a4f32c40a3045e54b4081::getLoader();
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
+ return ComposerAutoloaderInitd9c30b4fb507b157ad87e468dc8c9db0::getLoader();
vendor/composer/autoload_classmap.php CHANGED
@@ -331,6 +331,9 @@ return array(
331
  'WPDesk\\SaasPlatformClient\\Model\\Rate\\SingleRate' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Model/Rate/SingleRate.php',
332
  'WPDesk\\SaasPlatformClient\\Model\\Register' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Model/Register.php',
333
  'WPDesk\\SaasPlatformClient\\Model\\Reset' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Model/Reset.php',
 
 
 
334
  'WPDesk\\SaasPlatformClient\\Model\\Shipment\\Actor' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Model/Shipment/Actor.php',
335
  'WPDesk\\SaasPlatformClient\\Model\\Shipment\\Address' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Model/Shipment/Address.php',
336
  'WPDesk\\SaasPlatformClient\\Model\\Shipment\\ClientCommodity' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Model/Shipment/ClientCommodity.php',
@@ -367,13 +370,16 @@ return array(
367
  'WPDesk\\SaasPlatformClient\\Request\\Authentication\\RegisterRequest' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Request/Authentication/RegisterRequest.php',
368
  'WPDesk\\SaasPlatformClient\\Request\\Authentication\\TokenRequest' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Request/Authentication/TokenRequest.php',
369
  'WPDesk\\SaasPlatformClient\\Request\\BasicRequest' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Request/BasicRequest.php',
370
- 'WPDesk\\SaasPlatformClient\\Request\\Cancel\\PostCancelRequest' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Request/Cancel/PostCancelRequest.php',
371
  'WPDesk\\SaasPlatformClient\\Request\\Fields\\GetFieldsRequest' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Request/Fields/GetFieldsRequest.php',
372
  'WPDesk\\SaasPlatformClient\\Request\\Label\\PostLabelRequest' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Request/Label/PostLabelRequest.php',
373
  'WPDesk\\SaasPlatformClient\\Request\\ParcelCollectionPoints\\GetSingleRequest' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Request/ParcelCollectionPoints/GetSingleRequest.php',
374
  'WPDesk\\SaasPlatformClient\\Request\\ParcelCollectionPoints\\PostSearchRequest' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Request/ParcelCollectionPoints/PostSearchRequest.php',
375
  'WPDesk\\SaasPlatformClient\\Request\\Rate\\PostRateRequest' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Request/Rate/PostRateRequest.php',
376
  'WPDesk\\SaasPlatformClient\\Request\\Request' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Request/Request.php',
 
 
 
 
377
  'WPDesk\\SaasPlatformClient\\Request\\Shipment\\GetUserListShipmentRequest' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Request/Shipment/GetUserListShipmentRequest.php',
378
  'WPDesk\\SaasPlatformClient\\Request\\Shipment\\PostShipmentRequest' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Request/Shipment/PostShipmentRequest.php',
379
  'WPDesk\\SaasPlatformClient\\Request\\ShippingPlan\\PutShippingPlanRequest' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Request/ShippingPlan/PutShippingPlanRequest.php',
@@ -392,7 +398,6 @@ return array(
392
  'WPDesk\\SaasPlatformClient\\Response\\Authentication\\ConnectKeyResetResponse' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Response/Authentication/ConnectKeyResetResponse.php',
393
  'WPDesk\\SaasPlatformClient\\Response\\Authentication\\RegisterResponse' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Response/Authentication/RegisterResponse.php',
394
  'WPDesk\\SaasPlatformClient\\Response\\Authentication\\TokenResponse' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Response/Authentication/TokenResponse.php',
395
- 'WPDesk\\SaasPlatformClient\\Response\\Cancel\\PostCancelResponse' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Response/Cancel/PostCancelResponse.php',
396
  'WPDesk\\SaasPlatformClient\\Response\\Exception\\EmptyMessageFromResponse' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Response/Exception/EmptyMessageFromResponse.php',
397
  'WPDesk\\SaasPlatformClient\\Response\\Exception\\EmptyStatusFromResponse' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Response/Exception/EmptyStatusFromResponse.php',
398
  'WPDesk\\SaasPlatformClient\\Response\\Exception\\TriedExtractDataFromErrorResponse' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Response/Exception/TriedExtractDataFromErrorResponse.php',
@@ -405,6 +410,10 @@ return array(
405
  'WPDesk\\SaasPlatformClient\\Response\\Rate\\PostRateResponse' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Response/Rate/PostRateResponse.php',
406
  'WPDesk\\SaasPlatformClient\\Response\\RawResponse' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Response/RawResponse.php',
407
  'WPDesk\\SaasPlatformClient\\Response\\Response' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Response/Response.php',
 
 
 
 
408
  'WPDesk\\SaasPlatformClient\\Response\\Shipment\\GetListShipmentAdminContextResponse' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Response/Shipment/GetListShipmentAdminContextResponse.php',
409
  'WPDesk\\SaasPlatformClient\\Response\\Shipment\\PostShipmentResponse' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Response/Shipment/PostShipmentResponse.php',
410
  'WPDesk\\SaasPlatformClient\\Response\\ShippingServicesSettings\\GetSettingsResponse' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Response/ShippingServicesSettings/GetSettingsResponse.php',
@@ -441,6 +450,8 @@ return array(
441
  'WPDesk_Flexible_Shipping_Bulk_Actions' => $baseDir . '/classes/bulk-actions.php',
442
  'WPDesk_Flexible_Shipping_Cancel_Shipment_Exception' => $baseDir . '/classes/shipment/class-cancel-shipment-exception.php',
443
  'WPDesk_Flexible_Shipping_Checkout_Ajax_Request_Data' => $baseDir . '/classes/checkout/class-checkout-ajax-request-data.php',
 
 
444
  'WPDesk_Flexible_Shipping_Export' => $baseDir . '/classes/flexible-shipping-export.php',
445
  'WPDesk_Flexible_Shipping_Get_Label_Exception' => $baseDir . '/classes/shipment/class-get-label-exception.php',
446
  'WPDesk_Flexible_Shipping_Label_Not_Available_Exception' => $baseDir . '/classes/shipment/class-label-not-available-exception.php',
@@ -507,8 +518,12 @@ return array(
507
  'WPDesk_Flexible_Shipping_Shipment_Request_Fields' => $baseDir . '/classes/shipment/class-shipment-request-fields.php',
508
  'WPDesk_Flexible_Shipping_Shipment_Saas' => $baseDir . '/classes/shipment/saas/class-shipment-saas.php',
509
  'WPDesk_Flexible_Shipping_Shipment_Saas_Ajax' => $baseDir . '/classes/shipment/saas/class-shipment-saas-ajax.php',
 
 
 
510
  'WPDesk_Flexible_Shipping_Shipment_Saas_Message_Formatter' => $baseDir . '/classes/shipment/saas/class-shipment-saas-message-formatter.php',
511
  'WPDesk_Flexible_Shipping_Shipment_Saas_Metabox' => $baseDir . '/classes/shipment/saas/class-shipment-saas-metabox.php',
 
512
  'WPDesk_Flexible_Shipping_Shipment_Saas_Send' => $baseDir . '/classes/shipment/saas/class-shipment-saas-send.php',
513
  'WPDesk_Flexible_Shipping_Shipping_Manifest_CPT' => $baseDir . '/classes/manifest/cpt-shipping-manifest.php',
514
  'WPDesk_Flexible_Shipping_Shipping_Zone_Data_Extractor' => $baseDir . '/classes/class-shipping-zone-data-extractor.php',
331
  'WPDesk\\SaasPlatformClient\\Model\\Rate\\SingleRate' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Model/Rate/SingleRate.php',
332
  'WPDesk\\SaasPlatformClient\\Model\\Register' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Model/Register.php',
333
  'WPDesk\\SaasPlatformClient\\Model\\Reset' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Model/Reset.php',
334
+ 'WPDesk\\SaasPlatformClient\\Model\\ShipmentDocument\\SendDocumentsResponse' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Model/ShipmentDocument/SendDocumentsResponse.php',
335
+ 'WPDesk\\SaasPlatformClient\\Model\\ShipmentDocument\\ShipmentDocument' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Model/ShipmentDocument/ShipmentDocument.php',
336
+ 'WPDesk\\SaasPlatformClient\\Model\\ShipmentDocument\\ShipmentDocumentRequest' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Model/ShipmentDocument/ShipmentDocumentRequest.php',
337
  'WPDesk\\SaasPlatformClient\\Model\\Shipment\\Actor' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Model/Shipment/Actor.php',
338
  'WPDesk\\SaasPlatformClient\\Model\\Shipment\\Address' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Model/Shipment/Address.php',
339
  'WPDesk\\SaasPlatformClient\\Model\\Shipment\\ClientCommodity' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Model/Shipment/ClientCommodity.php',
370
  'WPDesk\\SaasPlatformClient\\Request\\Authentication\\RegisterRequest' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Request/Authentication/RegisterRequest.php',
371
  'WPDesk\\SaasPlatformClient\\Request\\Authentication\\TokenRequest' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Request/Authentication/TokenRequest.php',
372
  'WPDesk\\SaasPlatformClient\\Request\\BasicRequest' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Request/BasicRequest.php',
 
373
  'WPDesk\\SaasPlatformClient\\Request\\Fields\\GetFieldsRequest' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Request/Fields/GetFieldsRequest.php',
374
  'WPDesk\\SaasPlatformClient\\Request\\Label\\PostLabelRequest' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Request/Label/PostLabelRequest.php',
375
  'WPDesk\\SaasPlatformClient\\Request\\ParcelCollectionPoints\\GetSingleRequest' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Request/ParcelCollectionPoints/GetSingleRequest.php',
376
  'WPDesk\\SaasPlatformClient\\Request\\ParcelCollectionPoints\\PostSearchRequest' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Request/ParcelCollectionPoints/PostSearchRequest.php',
377
  'WPDesk\\SaasPlatformClient\\Request\\Rate\\PostRateRequest' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Request/Rate/PostRateRequest.php',
378
  'WPDesk\\SaasPlatformClient\\Request\\Request' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Request/Request.php',
379
+ 'WPDesk\\SaasPlatformClient\\Request\\ShipmentCancel\\PostCancelRequest' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Request/ShipmentCancel/PostCancelRequest.php',
380
+ 'WPDesk\\SaasPlatformClient\\Request\\ShipmentDocument\\DeleteShipmentDocumentRequest' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Request/ShipmentDocument/DeleteShipmentDocumentRequest.php',
381
+ 'WPDesk\\SaasPlatformClient\\Request\\ShipmentDocument\\PostShipmentDocumentRequest' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Request/ShipmentDocument/PostShipmentDocumentRequest.php',
382
+ 'WPDesk\\SaasPlatformClient\\Request\\ShipmentDocumentsSend\\PostSendRequest' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Request/ShipmentDocumentsSend/PostSendRequest.php',
383
  'WPDesk\\SaasPlatformClient\\Request\\Shipment\\GetUserListShipmentRequest' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Request/Shipment/GetUserListShipmentRequest.php',
384
  'WPDesk\\SaasPlatformClient\\Request\\Shipment\\PostShipmentRequest' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Request/Shipment/PostShipmentRequest.php',
385
  'WPDesk\\SaasPlatformClient\\Request\\ShippingPlan\\PutShippingPlanRequest' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Request/ShippingPlan/PutShippingPlanRequest.php',
398
  'WPDesk\\SaasPlatformClient\\Response\\Authentication\\ConnectKeyResetResponse' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Response/Authentication/ConnectKeyResetResponse.php',
399
  'WPDesk\\SaasPlatformClient\\Response\\Authentication\\RegisterResponse' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Response/Authentication/RegisterResponse.php',
400
  'WPDesk\\SaasPlatformClient\\Response\\Authentication\\TokenResponse' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Response/Authentication/TokenResponse.php',
 
401
  'WPDesk\\SaasPlatformClient\\Response\\Exception\\EmptyMessageFromResponse' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Response/Exception/EmptyMessageFromResponse.php',
402
  'WPDesk\\SaasPlatformClient\\Response\\Exception\\EmptyStatusFromResponse' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Response/Exception/EmptyStatusFromResponse.php',
403
  'WPDesk\\SaasPlatformClient\\Response\\Exception\\TriedExtractDataFromErrorResponse' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Response/Exception/TriedExtractDataFromErrorResponse.php',
410
  'WPDesk\\SaasPlatformClient\\Response\\Rate\\PostRateResponse' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Response/Rate/PostRateResponse.php',
411
  'WPDesk\\SaasPlatformClient\\Response\\RawResponse' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Response/RawResponse.php',
412
  'WPDesk\\SaasPlatformClient\\Response\\Response' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Response/Response.php',
413
+ 'WPDesk\\SaasPlatformClient\\Response\\ShipmentCancel\\PostCancelResponse' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Response/ShipmentCancel/PostCancelResponse.php',
414
+ 'WPDesk\\SaasPlatformClient\\Response\\ShipmentDocument\\DeleteShipmentDocumentResponse' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Response/ShipmentDocument/DeleteShipmentDocumentResponse.php',
415
+ 'WPDesk\\SaasPlatformClient\\Response\\ShipmentDocument\\PostShipmentDocumentResponse' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Response/ShipmentDocument/PostShipmentDocumentResponse.php',
416
+ 'WPDesk\\SaasPlatformClient\\Response\\ShipmentDocumentsSend\\PostSendResponse' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Response/ShipmentDocumentsSend/PostSendResponse.php',
417
  'WPDesk\\SaasPlatformClient\\Response\\Shipment\\GetListShipmentAdminContextResponse' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Response/Shipment/GetListShipmentAdminContextResponse.php',
418
  'WPDesk\\SaasPlatformClient\\Response\\Shipment\\PostShipmentResponse' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Response/Shipment/PostShipmentResponse.php',
419
  'WPDesk\\SaasPlatformClient\\Response\\ShippingServicesSettings\\GetSettingsResponse' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Response/ShippingServicesSettings/GetSettingsResponse.php',
450
  'WPDesk_Flexible_Shipping_Bulk_Actions' => $baseDir . '/classes/bulk-actions.php',
451
  'WPDesk_Flexible_Shipping_Cancel_Shipment_Exception' => $baseDir . '/classes/shipment/class-cancel-shipment-exception.php',
452
  'WPDesk_Flexible_Shipping_Checkout_Ajax_Request_Data' => $baseDir . '/classes/checkout/class-checkout-ajax-request-data.php',
453
+ 'WPDesk_Flexible_Shipping_Csv_Importer' => $baseDir . '/classes/csv/class-csv-importer.php',
454
+ 'WPDesk_Flexible_Shipping_Csv_Importer_Exception' => $baseDir . '/classes/csv/class-csv-importer-exception.php',
455
  'WPDesk_Flexible_Shipping_Export' => $baseDir . '/classes/flexible-shipping-export.php',
456
  'WPDesk_Flexible_Shipping_Get_Label_Exception' => $baseDir . '/classes/shipment/class-get-label-exception.php',
457
  'WPDesk_Flexible_Shipping_Label_Not_Available_Exception' => $baseDir . '/classes/shipment/class-label-not-available-exception.php',
518
  'WPDesk_Flexible_Shipping_Shipment_Request_Fields' => $baseDir . '/classes/shipment/class-shipment-request-fields.php',
519
  'WPDesk_Flexible_Shipping_Shipment_Saas' => $baseDir . '/classes/shipment/saas/class-shipment-saas.php',
520
  'WPDesk_Flexible_Shipping_Shipment_Saas_Ajax' => $baseDir . '/classes/shipment/saas/class-shipment-saas-ajax.php',
521
+ 'WPDesk_Flexible_Shipping_Shipment_Saas_Attachments' => $baseDir . '/classes/shipment/saas/class-shipment-saas-attachments.php',
522
+ 'WPDesk_Flexible_Shipping_Shipment_Saas_Attachments_Ajax' => $baseDir . '/classes/shipment/saas/class-shipment-saas-attachments-ajax.php',
523
+ 'WPDesk_Flexible_Shipping_Shipment_Saas_Attachments_Upload_Dir' => $baseDir . '/classes/shipment/saas/class-shipment-saas-attachments-upload-dir.php',
524
  'WPDesk_Flexible_Shipping_Shipment_Saas_Message_Formatter' => $baseDir . '/classes/shipment/saas/class-shipment-saas-message-formatter.php',
525
  'WPDesk_Flexible_Shipping_Shipment_Saas_Metabox' => $baseDir . '/classes/shipment/saas/class-shipment-saas-metabox.php',
526
+ 'WPDesk_Flexible_Shipping_Shipment_Saas_Metabox_Attachments' => $baseDir . '/classes/shipment/saas/class-shipment-saas-metabox-attachments.php',
527
  'WPDesk_Flexible_Shipping_Shipment_Saas_Send' => $baseDir . '/classes/shipment/saas/class-shipment-saas-send.php',
528
  'WPDesk_Flexible_Shipping_Shipping_Manifest_CPT' => $baseDir . '/classes/manifest/cpt-shipping-manifest.php',
529
  'WPDesk_Flexible_Shipping_Shipping_Zone_Data_Extractor' => $baseDir . '/classes/class-shipping-zone-data-extractor.php',
vendor/composer/autoload_real.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
- class ComposerAutoloaderInit31450fef395a4f32c40a3045e54b4081
6
  {
7
  private static $loader;
8
 
@@ -19,15 +19,15 @@ class ComposerAutoloaderInit31450fef395a4f32c40a3045e54b4081
19
  return self::$loader;
20
  }
21
 
22
- spl_autoload_register(array('ComposerAutoloaderInit31450fef395a4f32c40a3045e54b4081', 'loadClassLoader'), true, true);
23
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24
- spl_autoload_unregister(array('ComposerAutoloaderInit31450fef395a4f32c40a3045e54b4081', 'loadClassLoader'));
25
 
26
  $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
27
  if ($useStaticLoader) {
28
  require_once __DIR__ . '/autoload_static.php';
29
 
30
- call_user_func(\Composer\Autoload\ComposerStaticInit31450fef395a4f32c40a3045e54b4081::getInitializer($loader));
31
  } else {
32
  $map = require __DIR__ . '/autoload_namespaces.php';
33
  foreach ($map as $namespace => $path) {
@@ -48,19 +48,19 @@ class ComposerAutoloaderInit31450fef395a4f32c40a3045e54b4081
48
  $loader->register(true);
49
 
50
  if ($useStaticLoader) {
51
- $includeFiles = Composer\Autoload\ComposerStaticInit31450fef395a4f32c40a3045e54b4081::$files;
52
  } else {
53
  $includeFiles = require __DIR__ . '/autoload_files.php';
54
  }
55
  foreach ($includeFiles as $fileIdentifier => $file) {
56
- composerRequire31450fef395a4f32c40a3045e54b4081($fileIdentifier, $file);
57
  }
58
 
59
  return $loader;
60
  }
61
  }
62
 
63
- function composerRequire31450fef395a4f32c40a3045e54b4081($fileIdentifier, $file)
64
  {
65
  if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
66
  require $file;
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
+ class ComposerAutoloaderInitd9c30b4fb507b157ad87e468dc8c9db0
6
  {
7
  private static $loader;
8
 
19
  return self::$loader;
20
  }
21
 
22
+ spl_autoload_register(array('ComposerAutoloaderInitd9c30b4fb507b157ad87e468dc8c9db0', 'loadClassLoader'), true, true);
23
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24
+ spl_autoload_unregister(array('ComposerAutoloaderInitd9c30b4fb507b157ad87e468dc8c9db0', 'loadClassLoader'));
25
 
26
  $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
27
  if ($useStaticLoader) {
28
  require_once __DIR__ . '/autoload_static.php';
29
 
30
+ call_user_func(\Composer\Autoload\ComposerStaticInitd9c30b4fb507b157ad87e468dc8c9db0::getInitializer($loader));
31
  } else {
32
  $map = require __DIR__ . '/autoload_namespaces.php';
33
  foreach ($map as $namespace => $path) {
48
  $loader->register(true);
49
 
50
  if ($useStaticLoader) {
51
+ $includeFiles = Composer\Autoload\ComposerStaticInitd9c30b4fb507b157ad87e468dc8c9db0::$files;
52
  } else {
53
  $includeFiles = require __DIR__ . '/autoload_files.php';
54
  }
55
  foreach ($includeFiles as $fileIdentifier => $file) {
56
+ composerRequired9c30b4fb507b157ad87e468dc8c9db0($fileIdentifier, $file);
57
  }
58
 
59
  return $loader;
60
  }
61
  }
62
 
63
+ function composerRequired9c30b4fb507b157ad87e468dc8c9db0($fileIdentifier, $file)
64
  {
65
  if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
66
  require $file;
vendor/composer/autoload_static.php CHANGED
@@ -4,7 +4,7 @@
4
 
5
  namespace Composer\Autoload;
6
 
7
- class ComposerStaticInit31450fef395a4f32c40a3045e54b4081
8
  {
9
  public static $files = array (
10
  '46ae4ad8c3479aabff48f598a0e4b93f' => __DIR__ . '/..' . '/wpdesk/wp-mutex/src/WPDesk/functions.php',
@@ -420,6 +420,9 @@ class ComposerStaticInit31450fef395a4f32c40a3045e54b4081
420
  'WPDesk\\SaasPlatformClient\\Model\\Rate\\SingleRate' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Model/Rate/SingleRate.php',
421
  'WPDesk\\SaasPlatformClient\\Model\\Register' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Model/Register.php',
422
  'WPDesk\\SaasPlatformClient\\Model\\Reset' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Model/Reset.php',
 
 
 
423
  'WPDesk\\SaasPlatformClient\\Model\\Shipment\\Actor' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Model/Shipment/Actor.php',
424
  'WPDesk\\SaasPlatformClient\\Model\\Shipment\\Address' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Model/Shipment/Address.php',
425
  'WPDesk\\SaasPlatformClient\\Model\\Shipment\\ClientCommodity' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Model/Shipment/ClientCommodity.php',
@@ -456,13 +459,16 @@ class ComposerStaticInit31450fef395a4f32c40a3045e54b4081
456
  'WPDesk\\SaasPlatformClient\\Request\\Authentication\\RegisterRequest' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Request/Authentication/RegisterRequest.php',
457
  'WPDesk\\SaasPlatformClient\\Request\\Authentication\\TokenRequest' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Request/Authentication/TokenRequest.php',
458
  'WPDesk\\SaasPlatformClient\\Request\\BasicRequest' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Request/BasicRequest.php',
459
- 'WPDesk\\SaasPlatformClient\\Request\\Cancel\\PostCancelRequest' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Request/Cancel/PostCancelRequest.php',
460
  'WPDesk\\SaasPlatformClient\\Request\\Fields\\GetFieldsRequest' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Request/Fields/GetFieldsRequest.php',
461
  'WPDesk\\SaasPlatformClient\\Request\\Label\\PostLabelRequest' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Request/Label/PostLabelRequest.php',
462
  'WPDesk\\SaasPlatformClient\\Request\\ParcelCollectionPoints\\GetSingleRequest' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Request/ParcelCollectionPoints/GetSingleRequest.php',
463
  'WPDesk\\SaasPlatformClient\\Request\\ParcelCollectionPoints\\PostSearchRequest' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Request/ParcelCollectionPoints/PostSearchRequest.php',
464
  'WPDesk\\SaasPlatformClient\\Request\\Rate\\PostRateRequest' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Request/Rate/PostRateRequest.php',
465
  'WPDesk\\SaasPlatformClient\\Request\\Request' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Request/Request.php',
 
 
 
 
466
  'WPDesk\\SaasPlatformClient\\Request\\Shipment\\GetUserListShipmentRequest' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Request/Shipment/GetUserListShipmentRequest.php',
467
  'WPDesk\\SaasPlatformClient\\Request\\Shipment\\PostShipmentRequest' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Request/Shipment/PostShipmentRequest.php',
468
  'WPDesk\\SaasPlatformClient\\Request\\ShippingPlan\\PutShippingPlanRequest' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Request/ShippingPlan/PutShippingPlanRequest.php',
@@ -481,7 +487,6 @@ class ComposerStaticInit31450fef395a4f32c40a3045e54b4081
481
  'WPDesk\\SaasPlatformClient\\Response\\Authentication\\ConnectKeyResetResponse' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Response/Authentication/ConnectKeyResetResponse.php',
482
  'WPDesk\\SaasPlatformClient\\Response\\Authentication\\RegisterResponse' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Response/Authentication/RegisterResponse.php',
483
  'WPDesk\\SaasPlatformClient\\Response\\Authentication\\TokenResponse' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Response/Authentication/TokenResponse.php',
484
- 'WPDesk\\SaasPlatformClient\\Response\\Cancel\\PostCancelResponse' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Response/Cancel/PostCancelResponse.php',
485
  'WPDesk\\SaasPlatformClient\\Response\\Exception\\EmptyMessageFromResponse' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Response/Exception/EmptyMessageFromResponse.php',
486
  'WPDesk\\SaasPlatformClient\\Response\\Exception\\EmptyStatusFromResponse' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Response/Exception/EmptyStatusFromResponse.php',
487
  'WPDesk\\SaasPlatformClient\\Response\\Exception\\TriedExtractDataFromErrorResponse' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Response/Exception/TriedExtractDataFromErrorResponse.php',
@@ -494,6 +499,10 @@ class ComposerStaticInit31450fef395a4f32c40a3045e54b4081
494
  'WPDesk\\SaasPlatformClient\\Response\\Rate\\PostRateResponse' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Response/Rate/PostRateResponse.php',
495
  'WPDesk\\SaasPlatformClient\\Response\\RawResponse' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Response/RawResponse.php',
496
  'WPDesk\\SaasPlatformClient\\Response\\Response' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Response/Response.php',
 
 
 
 
497
  'WPDesk\\SaasPlatformClient\\Response\\Shipment\\GetListShipmentAdminContextResponse' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Response/Shipment/GetListShipmentAdminContextResponse.php',
498
  'WPDesk\\SaasPlatformClient\\Response\\Shipment\\PostShipmentResponse' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Response/Shipment/PostShipmentResponse.php',
499
  'WPDesk\\SaasPlatformClient\\Response\\ShippingServicesSettings\\GetSettingsResponse' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Response/ShippingServicesSettings/GetSettingsResponse.php',
@@ -530,6 +539,8 @@ class ComposerStaticInit31450fef395a4f32c40a3045e54b4081
530
  'WPDesk_Flexible_Shipping_Bulk_Actions' => __DIR__ . '/../..' . '/classes/bulk-actions.php',
531
  'WPDesk_Flexible_Shipping_Cancel_Shipment_Exception' => __DIR__ . '/../..' . '/classes/shipment/class-cancel-shipment-exception.php',
532
  'WPDesk_Flexible_Shipping_Checkout_Ajax_Request_Data' => __DIR__ . '/../..' . '/classes/checkout/class-checkout-ajax-request-data.php',
 
 
533
  'WPDesk_Flexible_Shipping_Export' => __DIR__ . '/../..' . '/classes/flexible-shipping-export.php',
534
  'WPDesk_Flexible_Shipping_Get_Label_Exception' => __DIR__ . '/../..' . '/classes/shipment/class-get-label-exception.php',
535
  'WPDesk_Flexible_Shipping_Label_Not_Available_Exception' => __DIR__ . '/../..' . '/classes/shipment/class-label-not-available-exception.php',
@@ -596,8 +607,12 @@ class ComposerStaticInit31450fef395a4f32c40a3045e54b4081
596
  'WPDesk_Flexible_Shipping_Shipment_Request_Fields' => __DIR__ . '/../..' . '/classes/shipment/class-shipment-request-fields.php',
597
  'WPDesk_Flexible_Shipping_Shipment_Saas' => __DIR__ . '/../..' . '/classes/shipment/saas/class-shipment-saas.php',
598
  'WPDesk_Flexible_Shipping_Shipment_Saas_Ajax' => __DIR__ . '/../..' . '/classes/shipment/saas/class-shipment-saas-ajax.php',
 
 
 
599
  'WPDesk_Flexible_Shipping_Shipment_Saas_Message_Formatter' => __DIR__ . '/../..' . '/classes/shipment/saas/class-shipment-saas-message-formatter.php',
600
  'WPDesk_Flexible_Shipping_Shipment_Saas_Metabox' => __DIR__ . '/../..' . '/classes/shipment/saas/class-shipment-saas-metabox.php',
 
601
  'WPDesk_Flexible_Shipping_Shipment_Saas_Send' => __DIR__ . '/../..' . '/classes/shipment/saas/class-shipment-saas-send.php',
602
  'WPDesk_Flexible_Shipping_Shipping_Manifest_CPT' => __DIR__ . '/../..' . '/classes/manifest/cpt-shipping-manifest.php',
603
  'WPDesk_Flexible_Shipping_Shipping_Zone_Data_Extractor' => __DIR__ . '/../..' . '/classes/class-shipping-zone-data-extractor.php',
@@ -641,9 +656,9 @@ class ComposerStaticInit31450fef395a4f32c40a3045e54b4081
641
  public static function getInitializer(ClassLoader $loader)
642
  {
643
  return \Closure::bind(function () use ($loader) {
644
- $loader->prefixLengthsPsr4 = ComposerStaticInit31450fef395a4f32c40a3045e54b4081::$prefixLengthsPsr4;
645
- $loader->prefixDirsPsr4 = ComposerStaticInit31450fef395a4f32c40a3045e54b4081::$prefixDirsPsr4;
646
- $loader->classMap = ComposerStaticInit31450fef395a4f32c40a3045e54b4081::$classMap;
647
 
648
  }, null, ClassLoader::class);
649
  }
4
 
5
  namespace Composer\Autoload;
6
 
7
+ class ComposerStaticInitd9c30b4fb507b157ad87e468dc8c9db0
8
  {
9
  public static $files = array (
10
  '46ae4ad8c3479aabff48f598a0e4b93f' => __DIR__ . '/..' . '/wpdesk/wp-mutex/src/WPDesk/functions.php',
420
  'WPDesk\\SaasPlatformClient\\Model\\Rate\\SingleRate' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Model/Rate/SingleRate.php',
421
  'WPDesk\\SaasPlatformClient\\Model\\Register' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Model/Register.php',
422
  'WPDesk\\SaasPlatformClient\\Model\\Reset' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Model/Reset.php',
423
+ 'WPDesk\\SaasPlatformClient\\Model\\ShipmentDocument\\SendDocumentsResponse' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Model/ShipmentDocument/SendDocumentsResponse.php',
424
+ 'WPDesk\\SaasPlatformClient\\Model\\ShipmentDocument\\ShipmentDocument' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Model/ShipmentDocument/ShipmentDocument.php',
425
+ 'WPDesk\\SaasPlatformClient\\Model\\ShipmentDocument\\ShipmentDocumentRequest' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Model/ShipmentDocument/ShipmentDocumentRequest.php',
426
  'WPDesk\\SaasPlatformClient\\Model\\Shipment\\Actor' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Model/Shipment/Actor.php',
427
  'WPDesk\\SaasPlatformClient\\Model\\Shipment\\Address' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Model/Shipment/Address.php',
428
  'WPDesk\\SaasPlatformClient\\Model\\Shipment\\ClientCommodity' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Model/Shipment/ClientCommodity.php',
459
  'WPDesk\\SaasPlatformClient\\Request\\Authentication\\RegisterRequest' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Request/Authentication/RegisterRequest.php',
460
  'WPDesk\\SaasPlatformClient\\Request\\Authentication\\TokenRequest' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Request/Authentication/TokenRequest.php',
461
  'WPDesk\\SaasPlatformClient\\Request\\BasicRequest' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Request/BasicRequest.php',
 
462
  'WPDesk\\SaasPlatformClient\\Request\\Fields\\GetFieldsRequest' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Request/Fields/GetFieldsRequest.php',
463
  'WPDesk\\SaasPlatformClient\\Request\\Label\\PostLabelRequest' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Request/Label/PostLabelRequest.php',
464
  'WPDesk\\SaasPlatformClient\\Request\\ParcelCollectionPoints\\GetSingleRequest' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Request/ParcelCollectionPoints/GetSingleRequest.php',
465
  'WPDesk\\SaasPlatformClient\\Request\\ParcelCollectionPoints\\PostSearchRequest' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Request/ParcelCollectionPoints/PostSearchRequest.php',
466
  'WPDesk\\SaasPlatformClient\\Request\\Rate\\PostRateRequest' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Request/Rate/PostRateRequest.php',
467
  'WPDesk\\SaasPlatformClient\\Request\\Request' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Request/Request.php',
468
+ 'WPDesk\\SaasPlatformClient\\Request\\ShipmentCancel\\PostCancelRequest' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Request/ShipmentCancel/PostCancelRequest.php',
469
+ 'WPDesk\\SaasPlatformClient\\Request\\ShipmentDocument\\DeleteShipmentDocumentRequest' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Request/ShipmentDocument/DeleteShipmentDocumentRequest.php',
470
+ 'WPDesk\\SaasPlatformClient\\Request\\ShipmentDocument\\PostShipmentDocumentRequest' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Request/ShipmentDocument/PostShipmentDocumentRequest.php',
471
+ 'WPDesk\\SaasPlatformClient\\Request\\ShipmentDocumentsSend\\PostSendRequest' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Request/ShipmentDocumentsSend/PostSendRequest.php',
472
  'WPDesk\\SaasPlatformClient\\Request\\Shipment\\GetUserListShipmentRequest' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Request/Shipment/GetUserListShipmentRequest.php',
473
  'WPDesk\\SaasPlatformClient\\Request\\Shipment\\PostShipmentRequest' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Request/Shipment/PostShipmentRequest.php',
474
  'WPDesk\\SaasPlatformClient\\Request\\ShippingPlan\\PutShippingPlanRequest' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Request/ShippingPlan/PutShippingPlanRequest.php',
487
  'WPDesk\\SaasPlatformClient\\Response\\Authentication\\ConnectKeyResetResponse' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Response/Authentication/ConnectKeyResetResponse.php',
488
  'WPDesk\\SaasPlatformClient\\Response\\Authentication\\RegisterResponse' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Response/Authentication/RegisterResponse.php',
489
  'WPDesk\\SaasPlatformClient\\Response\\Authentication\\TokenResponse' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Response/Authentication/TokenResponse.php',
 
490
  'WPDesk\\SaasPlatformClient\\Response\\Exception\\EmptyMessageFromResponse' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Response/Exception/EmptyMessageFromResponse.php',
491
  'WPDesk\\SaasPlatformClient\\Response\\Exception\\EmptyStatusFromResponse' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Response/Exception/EmptyStatusFromResponse.php',
492
  'WPDesk\\SaasPlatformClient\\Response\\Exception\\TriedExtractDataFromErrorResponse' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Response/Exception/TriedExtractDataFromErrorResponse.php',
499
  'WPDesk\\SaasPlatformClient\\Response\\Rate\\PostRateResponse' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Response/Rate/PostRateResponse.php',
500
  'WPDesk\\SaasPlatformClient\\Response\\RawResponse' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Response/RawResponse.php',
501
  'WPDesk\\SaasPlatformClient\\Response\\Response' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Response/Response.php',
502
+ 'WPDesk\\SaasPlatformClient\\Response\\ShipmentCancel\\PostCancelResponse' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Response/ShipmentCancel/PostCancelResponse.php',
503
+ 'WPDesk\\SaasPlatformClient\\Response\\ShipmentDocument\\DeleteShipmentDocumentResponse' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Response/ShipmentDocument/DeleteShipmentDocumentResponse.php',
504
+ 'WPDesk\\SaasPlatformClient\\Response\\ShipmentDocument\\PostShipmentDocumentResponse' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Response/ShipmentDocument/PostShipmentDocumentResponse.php',
505
+ 'WPDesk\\SaasPlatformClient\\Response\\ShipmentDocumentsSend\\PostSendResponse' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Response/ShipmentDocumentsSend/PostSendResponse.php',
506
  'WPDesk\\SaasPlatformClient\\Response\\Shipment\\GetListShipmentAdminContextResponse' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Response/Shipment/GetListShipmentAdminContextResponse.php',
507
  'WPDesk\\SaasPlatformClient\\Response\\Shipment\\PostShipmentResponse' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Response/Shipment/PostShipmentResponse.php',
508
  'WPDesk\\SaasPlatformClient\\Response\\ShippingServicesSettings\\GetSettingsResponse' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Response/ShippingServicesSettings/GetSettingsResponse.php',
539
  'WPDesk_Flexible_Shipping_Bulk_Actions' => __DIR__ . '/../..' . '/classes/bulk-actions.php',
540
  'WPDesk_Flexible_Shipping_Cancel_Shipment_Exception' => __DIR__ . '/../..' . '/classes/shipment/class-cancel-shipment-exception.php',
541
  'WPDesk_Flexible_Shipping_Checkout_Ajax_Request_Data' => __DIR__ . '/../..' . '/classes/checkout/class-checkout-ajax-request-data.php',
542
+ 'WPDesk_Flexible_Shipping_Csv_Importer' => __DIR__ . '/../..' . '/classes/csv/class-csv-importer.php',
543
+ 'WPDesk_Flexible_Shipping_Csv_Importer_Exception' => __DIR__ . '/../..' . '/classes/csv/class-csv-importer-exception.php',
544
  'WPDesk_Flexible_Shipping_Export' => __DIR__ . '/../..' . '/classes/flexible-shipping-export.php',
545
  'WPDesk_Flexible_Shipping_Get_Label_Exception' => __DIR__ . '/../..' . '/classes/shipment/class-get-label-exception.php',
546
  'WPDesk_Flexible_Shipping_Label_Not_Available_Exception' => __DIR__ . '/../..' . '/classes/shipment/class-label-not-available-exception.php',
607
  'WPDesk_Flexible_Shipping_Shipment_Request_Fields' => __DIR__ . '/../..' . '/classes/shipment/class-shipment-request-fields.php',
608
  'WPDesk_Flexible_Shipping_Shipment_Saas' => __DIR__ . '/../..' . '/classes/shipment/saas/class-shipment-saas.php',
609
  'WPDesk_Flexible_Shipping_Shipment_Saas_Ajax' => __DIR__ . '/../..' . '/classes/shipment/saas/class-shipment-saas-ajax.php',
610
+ 'WPDesk_Flexible_Shipping_Shipment_Saas_Attachments' => __DIR__ . '/../..' . '/classes/shipment/saas/class-shipment-saas-attachments.php',
611
+ 'WPDesk_Flexible_Shipping_Shipment_Saas_Attachments_Ajax' => __DIR__ . '/../..' . '/classes/shipment/saas/class-shipment-saas-attachments-ajax.php',
612
+ 'WPDesk_Flexible_Shipping_Shipment_Saas_Attachments_Upload_Dir' => __DIR__ . '/../..' . '/classes/shipment/saas/class-shipment-saas-attachments-upload-dir.php',
613
  'WPDesk_Flexible_Shipping_Shipment_Saas_Message_Formatter' => __DIR__ . '/../..' . '/classes/shipment/saas/class-shipment-saas-message-formatter.php',
614
  'WPDesk_Flexible_Shipping_Shipment_Saas_Metabox' => __DIR__ . '/../..' . '/classes/shipment/saas/class-shipment-saas-metabox.php',
615
+ 'WPDesk_Flexible_Shipping_Shipment_Saas_Metabox_Attachments' => __DIR__ . '/../..' . '/classes/shipment/saas/class-shipment-saas-metabox-attachments.php',
616
  'WPDesk_Flexible_Shipping_Shipment_Saas_Send' => __DIR__ . '/../..' . '/classes/shipment/saas/class-shipment-saas-send.php',
617
  'WPDesk_Flexible_Shipping_Shipping_Manifest_CPT' => __DIR__ . '/../..' . '/classes/manifest/cpt-shipping-manifest.php',
618
  'WPDesk_Flexible_Shipping_Shipping_Zone_Data_Extractor' => __DIR__ . '/../..' . '/classes/class-shipping-zone-data-extractor.php',
656
  public static function getInitializer(ClassLoader $loader)
657
  {
658
  return \Closure::bind(function () use ($loader) {
659
+ $loader->prefixLengthsPsr4 = ComposerStaticInitd9c30b4fb507b157ad87e468dc8c9db0::$prefixLengthsPsr4;
660
+ $loader->prefixDirsPsr4 = ComposerStaticInitd9c30b4fb507b157ad87e468dc8c9db0::$prefixDirsPsr4;
661
+ $loader->classMap = ComposerStaticInitd9c30b4fb507b157ad87e468dc8c9db0::$classMap;
662
 
663
  }, null, ClassLoader::class);
664
  }
vendor/composer/installed.json CHANGED
@@ -427,17 +427,17 @@
427
  },
428
  {
429
  "name": "wpdesk/wp-autoloader",
430
- "version": "1.1",
431
- "version_normalized": "1.1.0.0",
432
  "source": {
433
  "type": "git",
434
  "url": "https://gitlab.com/wpdesk/wp-autoloader.git",
435
- "reference": "2c471071e240b0f093610d45e20601369e3e3d92"
436
  },
437
  "dist": {
438
  "type": "zip",
439
- "url": "https://gitlab.com/api/v4/projects/wpdesk%2Fwp-autoloader/repository/archive.zip?sha=2c471071e240b0f093610d45e20601369e3e3d92",
440
- "reference": "2c471071e240b0f093610d45e20601369e3e3d92",
441
  "shasum": ""
442
  },
443
  "require": {
@@ -453,7 +453,7 @@
453
  "wimg/php-compatibility": "^8",
454
  "wp-coding-standards/wpcs": "^0.14.1"
455
  },
456
- "time": "2018-10-18T13:10:55+00:00",
457
  "type": "library",
458
  "installation-source": "dist",
459
  "notification-url": "https://packagist.org/downloads/",
@@ -466,17 +466,17 @@
466
  },
467
  {
468
  "name": "wpdesk/wp-basic-requirements",
469
- "version": "2.2",
470
- "version_normalized": "2.2.0.0",
471
  "source": {
472
  "type": "git",
473
  "url": "https://gitlab.com/wpdesk/wp-basic-requirements.git",
474
- "reference": "5cd4ac45986f3919bd63e2c4517dafe12fea5e97"
475
  },
476
  "dist": {
477
  "type": "zip",
478
- "url": "https://gitlab.com/api/v4/projects/wpdesk%2Fwp-basic-requirements/repository/archive.zip?sha=5cd4ac45986f3919bd63e2c4517dafe12fea5e97",
479
- "reference": "5cd4ac45986f3919bd63e2c4517dafe12fea5e97",
480
  "shasum": ""
481
  },
482
  "require": {
@@ -491,7 +491,7 @@
491
  "wimg/php-compatibility": "^8",
492
  "wp-coding-standards/wpcs": "^0.14.1"
493
  },
494
- "time": "2018-12-07T16:19:23+00:00",
495
  "type": "library",
496
  "installation-source": "dist",
497
  "notification-url": "https://packagist.org/downloads/",
@@ -744,17 +744,17 @@
744
  },
745
  {
746
  "name": "wpdesk/wp-saas-platform-client",
747
- "version": "1.9.1",
748
- "version_normalized": "1.9.1.0",
749
  "source": {
750
  "type": "git",
751
  "url": "https://gitlab.com/wpdesk/wp-saas-platform-client.git",
752
- "reference": "7da866aac957b49e8099b53a86831ef1ace4175f"
753
  },
754
  "dist": {
755
  "type": "zip",
756
- "url": "https://gitlab.com/api/v4/projects/wpdesk%2Fwp-saas-platform-client/repository/archive.zip?sha=7da866aac957b49e8099b53a86831ef1ace4175f",
757
- "reference": "7da866aac957b49e8099b53a86831ef1ace4175f",
758
  "shasum": ""
759
  },
760
  "require": {
@@ -772,7 +772,7 @@
772
  "squizlabs/php_codesniffer": "^3.0.2",
773
  "wp-coding-standards/wpcs": "^0.14.1"
774
  },
775
- "time": "2019-03-07T06:43:15+00:00",
776
  "type": "library",
777
  "installation-source": "dist",
778
  "autoload": {
427
  },
428
  {
429
  "name": "wpdesk/wp-autoloader",
430
+ "version": "1.2",
431
+ "version_normalized": "1.2.0.0",
432
  "source": {
433
  "type": "git",
434
  "url": "https://gitlab.com/wpdesk/wp-autoloader.git",
435
+ "reference": "0785174fe20b832321981224d0aacd83e4ae57ec"
436
  },
437
  "dist": {
438
  "type": "zip",
439
+ "url": "https://gitlab.com/api/v4/projects/wpdesk%2Fwp-autoloader/repository/archive.zip?sha=0785174fe20b832321981224d0aacd83e4ae57ec",
440
+ "reference": "0785174fe20b832321981224d0aacd83e4ae57ec",
441
  "shasum": ""
442
  },
443
  "require": {
453
  "wimg/php-compatibility": "^8",
454
  "wp-coding-standards/wpcs": "^0.14.1"
455
  },
456
+ "time": "2019-03-25T10:50:36+00:00",
457
  "type": "library",
458
  "installation-source": "dist",
459
  "notification-url": "https://packagist.org/downloads/",
466
  },
467
  {
468
  "name": "wpdesk/wp-basic-requirements",
469
+ "version": "2.3.1",
470
+ "version_normalized": "2.3.1.0",
471
  "source": {
472
  "type": "git",
473
  "url": "https://gitlab.com/wpdesk/wp-basic-requirements.git",
474
+ "reference": "97216ee83f871426669ac57b40cc666fdf61d7cc"
475
  },
476
  "dist": {
477
  "type": "zip",
478
+ "url": "https://gitlab.com/api/v4/projects/wpdesk%2Fwp-basic-requirements/repository/archive.zip?sha=97216ee83f871426669ac57b40cc666fdf61d7cc",
479
+ "reference": "97216ee83f871426669ac57b40cc666fdf61d7cc",
480
  "shasum": ""
481
  },
482
  "require": {
491
  "wimg/php-compatibility": "^8",
492
  "wp-coding-standards/wpcs": "^0.14.1"
493
  },
494
+ "time": "2019-03-25T13:11:11+00:00",
495
  "type": "library",
496
  "installation-source": "dist",
497
  "notification-url": "https://packagist.org/downloads/",
744
  },
745
  {
746
  "name": "wpdesk/wp-saas-platform-client",
747
+ "version": "1.10",
748
+ "version_normalized": "1.10.0.0",
749
  "source": {
750
  "type": "git",
751
  "url": "https://gitlab.com/wpdesk/wp-saas-platform-client.git",
752
+ "reference": "54327826936f8133481a917774e9b4fb2a8911f9"
753
  },
754
  "dist": {
755
  "type": "zip",
756
+ "url": "https://gitlab.com/api/v4/projects/wpdesk%2Fwp-saas-platform-client/repository/archive.zip?sha=54327826936f8133481a917774e9b4fb2a8911f9",
757
+ "reference": "54327826936f8133481a917774e9b4fb2a8911f9",
758
  "shasum": ""
759
  },
760
  "require": {
772
  "squizlabs/php_codesniffer": "^3.0.2",
773
  "wp-coding-standards/wpcs": "^0.14.1"
774
  },
775
+ "time": "2019-03-14T13:31:32+00:00",
776
  "type": "library",
777
  "installation-source": "dist",
778
  "autoload": {
vendor/wpdesk/wp-autoloader/.gitignore CHANGED
@@ -1,2 +1,3 @@
1
  /vendor/
2
- .idea
 
1
  /vendor/
2
+ .idea
3
+ composer.lock
vendor/wpdesk/wp-autoloader/CHANGELOG.md ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ ## [1.2.0] - 2019-03-25
2
+ ### Added
3
+ - Flow loader
vendor/wpdesk/wp-autoloader/composer.json CHANGED
@@ -23,12 +23,11 @@
23
  "autoload": {
24
  },
25
  "autoload-dev": {
 
26
  },
27
  "scripts": {
28
  "phpcs": "phpcs",
29
  "phpunit-unit": "phpunit --configuration phpunit-unit.xml --coverage-text --colors=never",
30
- "phpunit-unit-fast": "phpunit --configuration phpunit-unit.xml --no-coverage",
31
- "phpunit-integration": "phpunit --configuration phpunit-integration.xml --coverage-text --colors=never",
32
- "phpunit-integration-fast": "phpunit --configuration phpunit-integration.xml --no-coverage"
33
  }
34
  }
23
  "autoload": {
24
  },
25
  "autoload-dev": {
26
+ "classmap": ["src", "tests"]
27
  },
28
  "scripts": {
29
  "phpcs": "phpcs",
30
  "phpunit-unit": "phpunit --configuration phpunit-unit.xml --coverage-text --colors=never",
31
+ "phpunit-unit-fast": "phpunit --configuration phpunit-unit.xml --no-coverage"
 
 
32
  }
33
  }
vendor/wpdesk/wp-autoloader/phpunit-integration.xml ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <phpunit bootstrap="tests/integration/bootstrap.php"
2
+ backupGlobals="false"
3
+ >
4
+ <testsuites>
5
+ <testsuite>
6
+ <directory prefix="Test" suffix=".php">./tests/integration</directory>
7
+ </testsuite>
8
+ </testsuites>
9
+
10
+ <filter>
11
+ <whitelist>
12
+ <directory suffix=".php">src</directory>
13
+ </whitelist>
14
+ </filter>
15
+
16
+ <logging>
17
+ <log type="junit" target="build-coverage/report.junit.xml"/>
18
+ <log type="coverage-html" target="build-coverage/coverage" charset="UTF-8" yui="true" highlight="true"/>
19
+ <log type="coverage-text" target="build-coverage/coverage.txt"/>
20
+ <log type="coverage-clover" target="build-coverage/clover.xml"/>
21
+ </logging>
22
+
23
+ <php>
24
+ <env name="WP_DEVELOP_DIR" value="/tmp/wordpress-develop"/>
25
+ <env name="WC_DEVELOP_DIR" value="/tmp/woocommerce"/>
26
+ </php>
27
+
28
+ </phpunit>
vendor/wpdesk/wp-autoloader/phpunit-unit.xml ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <phpunit bootstrap="tests/unit/bootstrap.php">
2
+ <testsuites>
3
+ <testsuite>
4
+ <directory prefix="Test" suffix=".php">./tests/unit/</directory>
5
+ </testsuite>
6
+ </testsuites>
7
+
8
+ <filter>
9
+ <whitelist>
10
+ <directory suffix=".php">src</directory>
11
+ </whitelist>
12
+ </filter>
13
+
14
+ <logging>
15
+ <log type="junit" target="build-coverage/report.junit.xml"/>
16
+ <log type="coverage-html" target="build-coverage/coverage" charset="UTF-8" yui="true" highlight="true"/>
17
+ <log type="coverage-text" target="build-coverage/coverage.txt"/>
18
+ <log type="coverage-clover" target="build-coverage/clover.xml"/>
19
+ </logging>
20
+
21
+ </phpunit>
vendor/wpdesk/wp-autoloader/src/Loader/Flow/Composer_Flow_Loader.php ADDED
@@ -0,0 +1,97 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if (!interface_exists('WPDesk_Loader')) {
4
+ require_once(__DIR__ . '/../Loader.php');
5
+ }
6
+
7
+ /**
8
+ * Loader that can prepare autoload and use flow builders
9
+ */
10
+ class WPDesk_Composer_Flow_Loader implements WPDesk_Loader {
11
+ /** @var WPDesk_Composer_Flow_Loader_Info */
12
+ private $loader_info;
13
+
14
+ /** @var bool */
15
+ private $autoload_loaded = false;
16
+
17
+ /** @var bool */
18
+ private $plugin_loaded = false;
19
+
20
+ /** @var WPDesk_Loader_Manager|null */
21
+ private $manager;
22
+
23
+ /**
24
+ * WPDesk_Composer_Loader constructor.
25
+ *
26
+ * @param WPDesk_Composer_Loader_Info $loader_info
27
+ */
28
+ public function __construct( WPDesk_Composer_Flow_Loader_Info $loader_info) {
29
+ $this->loader_info = $loader_info;
30
+ }
31
+
32
+ /**
33
+ * @return int
34
+ */
35
+ public function get_load_priority() {
36
+ return $this->loader_info->get_load_priority();
37
+ }
38
+
39
+ /**
40
+ * @return int
41
+ */
42
+ public function get_create_priority() {
43
+ return $this->loader_info->get_load_priority();
44
+ }
45
+
46
+ /**
47
+ * Load composer autoload file
48
+ *
49
+ * @return void
50
+ */
51
+ public function notify_can_autoload() {
52
+ if (!$this->autoload_loaded) {
53
+ $this->autoload_loaded = true;
54
+ require_once( $this->loader_info->get_autoload_file()->getPathname() );
55
+ }
56
+ }
57
+
58
+ /**
59
+ * Load creation file
60
+ *
61
+ * @return void
62
+ */
63
+ public function notify_can_create_plugin() {
64
+ if (!$this->plugin_loaded) {
65
+ $this->plugin_loaded = true;
66
+ /** @noinspection PhpUnusedLocalVariableInspection */
67
+ $plugin_info = $this->loader_info->get_plugin_info();
68
+ $this->loader_info->get_build_flow()->run();
69
+ }
70
+ }
71
+
72
+ /**
73
+ * Well that's life. Do nothing.
74
+ *
75
+ * @return void
76
+ */
77
+ public function notify_cannot_autoload() {
78
+ }
79
+
80
+ /**
81
+ * Thanks for notification
82
+ *
83
+ * @return void
84
+ */
85
+ public function notify_all_loaded() {
86
+ }
87
+
88
+ /**
89
+ * @param WPDesk_Loader_Manager $manager
90
+ * @return void
91
+ */
92
+ public function update_manager( WPDesk_Loader_Manager $manager ) {
93
+ $this->manager = $manager;
94
+ }
95
+
96
+
97
+ }
vendor/wpdesk/wp-autoloader/src/Loader/Flow/Composer_Flow_Loader_Info.php ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Info required for Composer_Flow_Loader
5
+ */
6
+ class WPDesk_Composer_Flow_Loader_Info {
7
+ /** @var int */
8
+ private $load_priority;
9
+
10
+ /** @var \SplFileInfo */
11
+ private $autoload_file;
12
+
13
+ /** @var WPDesk_Plugin_Build_Flow */
14
+ private $build_flow;
15
+
16
+ /** @var WPDesk_Plugin_Info */
17
+ private $plugin_info;
18
+
19
+ /**
20
+ * @param int $load_priority
21
+ */
22
+ public function set_load_priority( $load_priority ) {
23
+ $this->load_priority = $load_priority;
24
+ }
25
+
26
+ /**
27
+ * @param SplFileInfo $autoload_file
28
+ */
29
+ public function set_autoload_file( $autoload_file ) {
30
+ $this->autoload_file = $autoload_file;
31
+ }
32
+
33
+ /**
34
+ * @param WPDesk_Plugin_Build_Flow $build_flow
35
+ */
36
+ public function set_build_flow( $build_flow ) {
37
+ $this->build_flow = $build_flow;
38
+ }
39
+
40
+ /**
41
+ * @return int
42
+ */
43
+ public function get_load_priority() {
44
+ return $this->load_priority;
45
+ }
46
+
47
+ /**
48
+ * @return SplFileInfo
49
+ */
50
+ public function get_autoload_file() {
51
+ return $this->autoload_file;
52
+ }
53
+
54
+ /**
55
+ * @return WPDesk_Plugin_Build_Flow
56
+ */
57
+ public function get_build_flow() {
58
+ return $this->build_flow;
59
+ }
60
+
61
+ /**
62
+ * @return WPDesk_Plugin_Info
63
+ */
64
+ public function get_plugin_info() {
65
+ return $this->plugin_info;
66
+ }
67
+
68
+ /**
69
+ * @param WPDesk_Plugin_Info $plugin_info
70
+ */
71
+ public function set_plugin_info( $plugin_info ) {
72
+ $this->plugin_info = $plugin_info;
73
+ }
74
+
75
+ }
vendor/wpdesk/wp-autoloader/src/Loader/Loader_Manager.php CHANGED
@@ -147,7 +147,7 @@ class WPDesk_Loader_Manager {
147
  */
148
  private function sort_loaders_load_priority_desc( $loaders ) {
149
  usort( $loaders, function ( WPDesk_Loader $a, WPDesk_Loader $b ) {
150
- return $b->get_load_priority() - $a->get_load_priority();
151
  } );
152
 
153
  return $loaders;
@@ -274,4 +274,4 @@ class WPDesk_Loader_Manager {
274
  throw reset( $this->exceptions );
275
  }
276
  }
277
- }
147
  */
148
  private function sort_loaders_load_priority_desc( $loaders ) {
149
  usort( $loaders, function ( WPDesk_Loader $a, WPDesk_Loader $b ) {
150
+ return $a->get_load_priority() - $b->get_load_priority();
151
  } );
152
 
153
  return $loaders;
274
  throw reset( $this->exceptions );
275
  }
276
  }
277
+ }
vendor/wpdesk/wp-autoloader/tests/docker-compose.yaml ADDED
@@ -0,0 +1,172 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ version: '2.0'
2
+
3
+ services:
4
+
5
+ wordpress:
6
+ image: wpdesknet/phpunit-woocommerce:0-0
7
+ volumes:
8
+ - .././:/opt/project
9
+ depends_on:
10
+ - mysql0
11
+ environment:
12
+ WORDPRESS_DB_NAME: wptest
13
+ WORDPRESS_DB_USER: mysql
14
+ WORDPRESS_DB_PASSWORD: mysql
15
+ WORDPRESS_DB_HOST: mysql0
16
+
17
+ wordpress-0-1:
18
+ image: wpdesknet/phpunit-woocommerce:0-1
19
+ volumes:
20
+ - .././:/opt/project
21
+ depends_on:
22
+ - mysql1
23
+ environment:
24
+ WORDPRESS_DB_NAME: wptest
25
+ WORDPRESS_DB_USER: mysql
26
+ WORDPRESS_DB_PASSWORD: mysql
27
+ WORDPRESS_DB_HOST: mysql1
28
+
29
+ wordpress-0-2:
30
+ image: wpdesknet/phpunit-woocommerce:0-2
31
+ volumes:
32
+ - .././:/opt/project
33
+ depends_on:
34
+ - mysql2
35
+ environment:
36
+ WORDPRESS_DB_NAME: wptest
37
+ WORDPRESS_DB_USER: mysql
38
+ WORDPRESS_DB_PASSWORD: mysql
39
+ WORDPRESS_DB_HOST: mysql2
40
+
41
+ wordpress-0-3:
42
+ image: wpdesknet/phpunit-woocommerce:0-3
43
+ volumes:
44
+ - .././:/opt/project
45
+ depends_on:
46
+ - mysql3
47
+ environment:
48
+ WORDPRESS_DB_NAME: wptest
49
+ WORDPRESS_DB_USER: mysql
50
+ WORDPRESS_DB_PASSWORD: mysql
51
+ WORDPRESS_DB_HOST: mysql3
52
+
53
+ wordpress-0-4:
54
+ image: wpdesknet/phpunit-woocommerce:0-4
55
+ volumes:
56
+ - .././:/opt/project
57
+ depends_on:
58
+ - mysql4
59
+ environment:
60
+ WORDPRESS_DB_NAME: wptest
61
+ WORDPRESS_DB_USER: mysql
62
+ WORDPRESS_DB_PASSWORD: mysql
63
+ WORDPRESS_DB_HOST: mysql4
64
+
65
+ wordpress-0-5:
66
+ image: wpdesknet/phpunit-woocommerce:0-5
67
+ volumes:
68
+ - .././:/opt/project
69
+ depends_on:
70
+ - mysql5
71
+ environment:
72
+ WORDPRESS_DB_NAME: wptest
73
+ WORDPRESS_DB_USER: mysql
74
+ WORDPRESS_DB_PASSWORD: mysql
75
+ WORDPRESS_DB_HOST: mysql5
76
+
77
+ wordpress-1-0:
78
+ image: wpdesknet/phpunit-woocommerce:1-0
79
+ volumes:
80
+ - .././:/opt/project
81
+ depends_on:
82
+ - mysql0
83
+ environment:
84
+ WORDPRESS_DB_NAME: wptest
85
+ WORDPRESS_DB_USER: mysql
86
+ WORDPRESS_DB_PASSWORD: mysql
87
+ WORDPRESS_DB_HOST: mysql0
88
+
89
+ wordpress-2-0:
90
+ image: wpdesknet/phpunit-woocommerce:2-0
91
+ volumes:
92
+ - .././:/opt/project
93
+ depends_on:
94
+ - mysql0
95
+ environment:
96
+ WORDPRESS_DB_NAME: wptest
97
+ WORDPRESS_DB_USER: mysql
98
+ WORDPRESS_DB_PASSWORD: mysql
99
+ WORDPRESS_DB_HOST: mysql0
100
+
101
+ wordpress-3-0:
102
+ image: wpdesknet/phpunit-woocommerce:3-0
103
+ volumes:
104
+ - .././:/opt/project
105
+ depends_on:
106
+ - mysql0
107
+ environment:
108
+ WORDPRESS_DB_NAME: wptest
109
+ WORDPRESS_DB_USER: mysql
110
+ WORDPRESS_DB_PASSWORD: mysql
111
+ WORDPRESS_DB_HOST: mysql0
112
+
113
+ wordpress-4-0:
114
+ image: wpdesknet/phpunit-woocommerce:4-0
115
+ volumes:
116
+ - .././:/opt/project
117
+ depends_on:
118
+ - mysql0
119
+ environment:
120
+ WORDPRESS_DB_NAME: wptest
121
+ WORDPRESS_DB_USER: mysql
122
+ WORDPRESS_DB_PASSWORD: mysql
123
+ WORDPRESS_DB_HOST: mysql0
124
+
125
+ mysql0:
126
+ image: mysql:5.7
127
+ environment:
128
+ MYSQL_ROOT_PASSWORD: mysql
129
+ MYSQL_DATABASE: wptest
130
+ MYSQL_USER: mysql
131
+ MYSQL_PASSWORD: mysql
132
+
133
+ mysql1:
134
+ image: mysql:5.7
135
+ environment:
136
+ MYSQL_ROOT_PASSWORD: mysql
137
+ MYSQL_DATABASE: wptest
138
+ MYSQL_USER: mysql
139
+ MYSQL_PASSWORD: mysql
140
+
141
+ mysql2:
142
+ image: mysql:5.7
143
+ environment:
144
+ MYSQL_ROOT_PASSWORD: mysql
145
+ MYSQL_DATABASE: wptest
146
+ MYSQL_USER: mysql
147
+ MYSQL_PASSWORD: mysql
148
+
149
+ mysql3:
150
+ image: mysql:5.7
151
+ environment:
152
+ MYSQL_ROOT_PASSWORD: mysql
153
+ MYSQL_DATABASE: wptest
154
+ MYSQL_USER: mysql
155
+ MYSQL_PASSWORD: mysql
156
+
157
+ mysql4:
158
+ image: mysql:5.7
159
+ environment:
160
+ MYSQL_ROOT_PASSWORD: mysql
161
+ MYSQL_DATABASE: wptest
162
+ MYSQL_USER: mysql
163
+ MYSQL_PASSWORD: mysql
164
+
165
+ mysql5:
166
+ image: mysql:5.7
167
+ environment:
168
+ MYSQL_ROOT_PASSWORD: mysql
169
+ MYSQL_DATABASE: wptest
170
+ MYSQL_USER: mysql
171
+ MYSQL_PASSWORD: mysql
172
+
vendor/wpdesk/wp-autoloader/tests/integration/bootstrap.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ ini_set('error_reporting', E_ALL); // or error_reporting(E_ALL);
4
+ ini_set('display_errors', '1');
5
+ ini_set('display_startup_errors', '1');
6
+
7
+ require_once __DIR__ . '/../../vendor/autoload.php';
8
+
9
+ // disable xdebug backtrace
10
+ if ( function_exists( 'xdebug_disable' ) ) {
11
+ xdebug_disable();
12
+ }
13
+
14
+ if ( getenv( 'PLUGIN_PATH' ) !== false ) {
15
+ define( 'PLUGIN_PATH', getenv( 'PLUGIN_PATH' ) );
16
+ } else {
17
+ define( 'PLUGIN_PATH', __DIR__ . DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR );
18
+ }
19
+
20
+ require_once( getenv( 'WP_DEVELOP_DIR' ) . '/tests/phpunit/includes/functions.php' );
21
+
22
+ tests_add_filter( 'muplugins_loaded', function () {
23
+ }, 100 );
24
+
25
+ putenv('WP_TESTS_DIR=' . getenv( 'WP_DEVELOP_DIR' ) . '/tests/phpunit');
26
+ require_once( getenv( 'WC_DEVELOP_DIR' ) . '/tests/bootstrap.php' );
27
+
28
+ do_action('plugins_loaded');
vendor/wpdesk/wp-autoloader/tests/unit/bootstrap.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * PHPUnit bootstrap file
4
+ */
5
+
6
+ require_once __DIR__ . '/../../vendor/autoload.php';
7
+
8
+ WP_Mock::setUsePatchwork( true );
9
+ WP_Mock::bootstrap();
vendor/wpdesk/wp-basic-requirements/CHANGELOG.md ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ ## [2.3.0] - 2019-03-25
2
+ ### Fixed
3
+ - Backward compatibility
4
+
5
+ ## [2.3.0] - 2019-03-25
6
+ ### Added
7
+ - Factory
8
+ - Interface
9
+ ### Changed
10
+ - Minor internal action renaming
vendor/wpdesk/wp-basic-requirements/src/Basic_Requirement_Checker.php CHANGED
@@ -4,393 +4,400 @@ if ( ! interface_exists( 'WPDesk_Translatable' ) ) {
4
  require_once 'Translatable.php';
5
  }
6
 
7
- /**
8
- * Checks requirements for plugin
9
- * have to be compatible with PHP 5.2.x
10
- */
11
- class WPDesk_Basic_Requirement_Checker implements WPDesk_Translatable {
12
- const EXTENSION_NAME_OPENSSL = 'openssl';
13
- const HOOK_ADMIN_NOTICES_ACTION = 'admin_notices';
14
-
15
- /** @var string */
16
- private $plugin_name;
17
- /** @var string */
18
- private $plugin_file;
19
- /** @var string */
20
- private $min_php_version;
21
- /** @var string */
22
- private $min_wp_version;
23
- /** @var string|null */
24
- private $min_wc_version = null;
25
- /** @var int|null */
26
- private $min_openssl_version = null;
27
- /** @var array */
28
- private $plugin_require;
29
- /** @var array */
30
- private $module_require;
31
- /** @var array */
32
- private $setting_require;
33
- /** @var array */
34
- private $notices;
35
- /** @var @string */
36
- private $text_domain;
37
-
38
- /**
39
- * @param string $plugin_file
40
- * @param string $plugin_name
41
- * @param string $text_domain
42
- * @param string $php_version
43
- * @param string $wp_version
44
- */
45
- public function __construct( $plugin_file, $plugin_name, $text_domain, $php_version, $wp_version ) {
46
- $this->plugin_file = $plugin_file;
47
- $this->plugin_name = $plugin_name;
48
- $this->text_domain = $text_domain;
49
-
50
- $this->set_min_php_require( $php_version );
51
- $this->set_min_wp_require( $wp_version );
52
-
53
- $this->plugin_require = array();
54
- $this->module_require = array();
55
- $this->setting_require = array();
56
- $this->notices = array();
57
- }
58
-
59
- /**
60
- * @param string $version
61
- *
62
- * @return $this
63
- */
64
- public function set_min_php_require( $version ) {
65
- $this->min_php_version = $version;
66
-
67
- return $this;
68
- }
69
-
70
- /**
71
- * @param string $version
72
- *
73
- * @return $this
74
- */
75
- public function set_min_wp_require( $version ) {
76
- $this->min_wp_version = $version;
77
-
78
- return $this;
79
- }
80
-
81
- /**
82
- * @param string $version
83
- *
84
- * @return $this
85
- */
86
- public function set_min_wc_require( $version ) {
87
- $this->min_wc_version = $version;
88
-
89
- return $this;
90
- }
91
-
92
- /**
93
- * @param $version
94
- *
95
- * @return $this
96
- */
97
- public function set_min_openssl_require( $version ) {
98
- $this->min_openssl_version = $version;
99
-
100
- return $this;
101
- }
102
-
103
- /**
104
- * @param string $plugin_name
105
- * @param string $nice_plugin_name Nice plugin name for better looks in notice
106
- *
107
- * @return $this
108
- */
109
- public function add_plugin_require( $plugin_name, $nice_plugin_name = null ) {
110
- if ( $nice_plugin_name === null ) {
111
- $this->plugin_require[ $plugin_name ] = $plugin_name;
112
- } else {
113
- $this->plugin_require[ $plugin_name ] = $nice_plugin_name;
114
- }
115
-
116
- return $this;
117
- }
118
-
119
- /**
120
- * @param string $module_name
121
- * @param string $nice_name Nice module name for better looks in notice
122
- *
123
- * @return $this
124
- */
125
- public function add_php_module_require( $module_name, $nice_name = null ) {
126
- if ( $nice_name === null ) {
127
- $this->module_require[ $module_name ] = $module_name;
128
- } else {
129
- $this->module_require[ $module_name ] = $nice_name;
130
- }
131
-
132
- return $this;
133
- }
134
-
135
- /**
136
- * @param string $setting
137
- * @param mixed $value
138
- *
139
- * @return $this
140
- */
141
- public function add_php_setting_require( $setting, $value ) {
142
- $this->setting_require[ $setting ] = $value;
143
-
144
- return $this;
145
- }
146
-
147
- /**
148
- * @return bool
149
- */
150
- public function are_requirements_met() {
151
- $this->notices = $this->prepare_requirement_notices();
152
-
153
- return count( $this->notices ) === 0;
154
- }
155
-
156
- /**
157
- * @return array
158
- */
159
- private function prepare_requirement_notices() {
160
- $notices = array();
161
- if ( ! self::is_php_at_least( $this->min_php_version ) ) {
162
- $notices[] = $this->prepare_notice_message( sprintf( __( 'The &#8220;%s&#8221; plugin cannot run on PHP versions older than %s. Please contact your host and ask them to upgrade.',
163
- $this->get_text_domain() ), esc_html( $this->plugin_name ), $this->min_php_version ) );
164
- }
165
- if ( ! self::is_wp_at_least( $this->min_wp_version ) ) {
166
- $notices[] = $this->prepare_notice_message( sprintf( __( 'The &#8220;%s&#8221; plugin cannot run on WordPress versions older than %s. Please update WordPress.',
167
- $this->get_text_domain() ), esc_html( $this->plugin_name ), $this->min_wp_version ) );
168
- }
169
- if ( $this->min_wc_version !== null && $this->can_check_plugin_version() && ! self::is_wc_at_least( $this->min_wc_version ) ) {
170
- $notices[] = $this->prepare_notice_message( sprintf( __( 'The &#8220;%s&#8221; plugin cannot run on WooCommerce versions older than %s. Please update WooCommerce.',
171
- $this->get_text_domain() ), esc_html( $this->plugin_name ), $this->min_wc_version ) );
172
- }
173
- if ( $this->min_openssl_version !== null && ! self::is_open_ssl_at_least( $this->min_openssl_version ) ) {
174
- $notices[] = $this->prepare_notice_message( sprintf( __( 'The &#8220;%s&#8221; plugin cannot run without OpenSSL module version at least %s. Please update OpenSSL module.',
175
- $this->get_text_domain() ), esc_html( $this->plugin_name ),
176
- '0x' . dechex( $this->min_openssl_version ) ) );
177
- }
178
-
179
- $notices = $this->append_plugin_require_notices( $notices );
180
- $notices = $this->append_module_require_notices( $notices );
181
- $notices = $this->append_settings_require_notices( $notices );
182
-
183
- return $notices;
184
- }
185
-
186
- /**
187
- * @param $min_version
188
- *
189
- * @return mixed
190
- */
191
- public static function is_php_at_least( $min_version ) {
192
- return version_compare( PHP_VERSION, $min_version, '>=' );
193
- }
194
-
195
- /**
196
- * Prepares message in html format
197
- *
198
- * @param string $message
199
- *
200
- * @return string
201
- */
202
- private function prepare_notice_message( $message ) {
203
- return '<div class="error"><p>' . $message . '</p></div>';
204
- }
205
-
206
- public function get_text_domain() {
207
- return $this->text_domain;
208
- }
209
-
210
- /**
211
- * @param string $min_version
212
- *
213
- * @return bool
214
- */
215
- public static function is_wp_at_least( $min_version ) {
216
- return version_compare( get_bloginfo( 'version' ), $min_version, '>=' );
217
- }
218
-
219
- /**
220
- * Are plugins loaded so we can check the version
221
- *
222
- * @return bool
223
- */
224
- private function can_check_plugin_version() {
225
- return did_action( 'plugins_loaded' ) > 0;
226
- }
227
-
228
- /**
229
- * Checks if plugin is active and have designated version. Needs to be enabled in deferred way.
230
- *
231
- * @param string $min_version
232
- *
233
- * @return bool
234
- */
235
- public static function is_wc_at_least( $min_version ) {
236
- return defined( 'WC_VERSION' ) &&
237
- version_compare( WC_VERSION, $min_version, '>=' );
238
- }
239
-
240
- /**
241
- * Checks if ssl version is valid
242
- *
243
- * @param int $required_version Version in hex. Version 9.6 is 0x000906000
244
- *
245
- * @see https://www.openssl.org/docs/man1.1.0/crypto/OPENSSL_VERSION_NUMBER.html
246
- *
247
- * @return bool
248
- */
249
- public static function is_open_ssl_at_least( $required_version ) {
250
- return defined( 'OPENSSL_VERSION_NUMBER' ) && OPENSSL_VERSION_NUMBER > (int) $required_version;
251
- }
252
-
253
- /**
254
- * @param array $notices
255
- *
256
- * @return array
257
- */
258
- private function append_plugin_require_notices( $notices ) {
259
- if ( count( $this->plugin_require ) > 0 ) {
260
- foreach ( $this->plugin_require as $plugin_name => $nice_plugin_name ) {
261
- if ( ! self::is_wp_plugin_active( $plugin_name ) ) {
262
- $notices[] = $this->prepare_notice_message( sprintf( __( 'The &#8220;%s&#8221; plugin cannot run without %s active. Please install and activate %s plugin.',
263
- $this->get_text_domain() ), esc_html( $this->plugin_name ),
264
- esc_html( basename( $nice_plugin_name ) ), esc_html( basename( $nice_plugin_name ) ) ) );
265
- }
266
- }
267
- }
268
-
269
- return $notices;
270
- }
271
-
272
- /**
273
- * Checks if plugin is active. Needs to be enabled in deferred way.
274
- *
275
- * @param string $plugin_file
276
- *
277
- * @return bool
278
- */
279
- public static function is_wp_plugin_active( $plugin_file ) {
280
- $active_plugins = (array) get_option( 'active_plugins', array() );
281
-
282
- if ( is_multisite() ) {
283
- $active_plugins = array_merge( $active_plugins, get_site_option( 'active_sitewide_plugins', array() ) );
284
- }
285
-
286
- return in_array( $plugin_file, $active_plugins ) || array_key_exists( $plugin_file, $active_plugins );
287
- }
288
-
289
- /**
290
- * @param array $notices
291
- *
292
- * @return array
293
- */
294
- private function append_module_require_notices( $notices ) {
295
- if ( count( $this->module_require ) > 0 ) {
296
- foreach ( $this->module_require as $module_name => $nice_module_name ) {
297
- if ( ! self::is_module_active( $module_name ) ) {
298
- $notices[] = $this->prepare_notice_message( sprintf( __( 'The &#8220;%s&#8221; plugin cannot run without %s php module installed. Please contact your host and ask them to install %s.',
299
- $this->get_text_domain() ), esc_html( $this->plugin_name ),
300
- esc_html( basename( $nice_module_name ) ), esc_html( basename( $nice_module_name ) ) ) );
301
- }
302
- }
303
- }
304
-
305
- return $notices;
306
- }
307
-
308
- /**
309
- * @param string $name
310
- *
311
- * @return bool
312
- */
313
- public static function is_module_active( $name ) {
314
- return extension_loaded( $name );
315
- }
316
-
317
- /**
318
- * @param array $notices
319
- *
320
- * @return array
321
- */
322
- private function append_settings_require_notices( $notices ) {
323
- if ( count( $this->setting_require ) > 0 ) {
324
- foreach ( $this->setting_require as $setting => $value ) {
325
- if ( ! self::is_setting_set( $setting, $value ) ) {
326
- $notices[] = $this->prepare_notice_message( sprintf( __( 'The &#8220;%s&#8221; plugin cannot run without %s php setting set to %s. Please contact your host and ask them to set %s.',
327
- $this->get_text_domain() ), esc_html( $this->plugin_name ), esc_html( basename( $setting ) ),
328
- esc_html( basename( $value ) ), esc_html( basename( $setting ) ) ) );
329
- }
330
- }
331
- }
332
-
333
- return $notices;
334
- }
335
-
336
- /**
337
- * @param string $name
338
- * @param mixed $value
339
- *
340
- * @return bool
341
- */
342
- public static function is_setting_set( $name, $value ) {
343
- return ini_get( $name ) === (string) $value;
344
- }
345
-
346
- /**
347
- * @return void
348
- *
349
- * @deprecated use render_notices or disable_plugin
350
- */
351
- public function disable_plugin_render_notice() {
352
- add_action( self::HOOK_ADMIN_NOTICES_ACTION, array( $this, 'render_notices_action' ) );
353
- }
354
 
 
355
  /**
356
- * Renders requirement notices in admin panel
357
- *
358
- * @return void
359
  */
360
- public function render_notices() {
361
- add_action( self::HOOK_ADMIN_NOTICES_ACTION, array( $this, 'render_notices_action' ) );
362
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
363
 
364
- /**
365
- * Renders requirement notices in admin panel
366
- *
367
- * @return void
368
- */
369
- public function disable_plugin() {
370
- add_action( self::HOOK_ADMIN_NOTICES_ACTION, array( $this, 'deactivate_action' ) );
371
- }
372
 
373
- /**
374
- * @internal Do not use as public. Public only for wp action.
375
- *
376
- * @return void
377
- */
378
- public function deactivate_action() {
379
- if ( isset( $this->plugin_file ) ) {
380
- deactivate_plugins( plugin_basename( $this->plugin_file ) );
381
  }
382
- }
383
 
384
- /**
385
- * Should be called as WordPress action
386
- *
387
- * @internal Do not use as public. Public only for wp action.
388
- *
389
- * @return void
390
- */
391
- public function render_notices_action() {
392
- foreach ( $this->notices as $notice ) {
393
- echo $notice;
394
- }
395
- }
396
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  require_once 'Translatable.php';
5
  }
6
 
7
+ if ( ! interface_exists( 'WPDesk_Requirement_Checker' ) ) {
8
+ require_once 'Requirement_Checker.php';
9
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
 
11
+ if (! class_exists('WPDesk_Basic_Requirement_Checker') ) {
12
  /**
13
+ * Checks requirements for plugin
14
+ * have to be compatible with PHP 5.2.x
 
15
  */
16
+ class WPDesk_Basic_Requirement_Checker implements WPDesk_Translatable, WPDesk_Requirement_Checker
17
+ {
18
+ const EXTENSION_NAME_OPENSSL = 'openssl';
19
+ const HOOK_ADMIN_NOTICES_ACTION = 'admin_notices';
20
+
21
+ /** @var string */
22
+ private $plugin_name;
23
+ /** @var string */
24
+ private $plugin_file;
25
+ /** @var string */
26
+ private $min_php_version;
27
+ /** @var string */
28
+ private $min_wp_version;
29
+ /** @var string|null */
30
+ private $min_wc_version = null;
31
+ /** @var int|null */
32
+ private $min_openssl_version = null;
33
+ /** @var array */
34
+ private $plugin_require;
35
+ /** @var array */
36
+ private $module_require;
37
+ /** @var array */
38
+ private $setting_require;
39
+ /** @var array */
40
+ private $notices;
41
+ /** @var @string */
42
+ private $text_domain;
43
+
44
+ /**
45
+ * @param string $plugin_file
46
+ * @param string $plugin_name
47
+ * @param string $text_domain
48
+ * @param string $php_version
49
+ * @param string $wp_version
50
+ */
51
+ public function __construct( $plugin_file, $plugin_name, $text_domain, $php_version, $wp_version ) {
52
+ $this->plugin_file = $plugin_file;
53
+ $this->plugin_name = $plugin_name;
54
+ $this->text_domain = $text_domain;
55
+
56
+ $this->set_min_php_require( $php_version );
57
+ $this->set_min_wp_require( $wp_version );
58
+
59
+ $this->plugin_require = array();
60
+ $this->module_require = array();
61
+ $this->setting_require = array();
62
+ $this->notices = array();
63
+ }
64
 
65
+ /**
66
+ * @param string $version
67
+ *
68
+ * @return $this
69
+ */
70
+ public function set_min_php_require( $version ) {
71
+ $this->min_php_version = $version;
 
72
 
73
+ return $this;
 
 
 
 
 
 
 
74
  }
 
75
 
76
+ /**
77
+ * @param string $version
78
+ *
79
+ * @return $this
80
+ */
81
+ public function set_min_wp_require( $version ) {
82
+ $this->min_wp_version = $version;
83
+
84
+ return $this;
85
+ }
86
+
87
+ /**
88
+ * @param string $version
89
+ *
90
+ * @return $this
91
+ */
92
+ public function set_min_wc_require( $version ) {
93
+ $this->min_wc_version = $version;
94
+
95
+ return $this;
96
+ }
97
+
98
+ /**
99
+ * @param $version
100
+ *
101
+ * @return $this
102
+ */
103
+ public function set_min_openssl_require( $version ) {
104
+ $this->min_openssl_version = $version;
105
+
106
+ return $this;
107
+ }
108
+
109
+ /**
110
+ * @param string $plugin_name
111
+ * @param string $nice_plugin_name Nice plugin name for better looks in notice
112
+ *
113
+ * @return $this
114
+ */
115
+ public function add_plugin_require( $plugin_name, $nice_plugin_name = null ) {
116
+ if ( $nice_plugin_name === null ) {
117
+ $this->plugin_require[ $plugin_name ] = $plugin_name;
118
+ } else {
119
+ $this->plugin_require[ $plugin_name ] = $nice_plugin_name;
120
+ }
121
+
122
+ return $this;
123
+ }
124
+
125
+ /**
126
+ * @param string $module_name
127
+ * @param string $nice_name Nice module name for better looks in notice
128
+ *
129
+ * @return $this
130
+ */
131
+ public function add_php_module_require( $module_name, $nice_name = null ) {
132
+ if ( $nice_name === null ) {
133
+ $this->module_require[ $module_name ] = $module_name;
134
+ } else {
135
+ $this->module_require[ $module_name ] = $nice_name;
136
+ }
137
+
138
+ return $this;
139
+ }
140
+
141
+ /**
142
+ * @param string $setting
143
+ * @param mixed $value
144
+ *
145
+ * @return $this
146
+ */
147
+ public function add_php_setting_require( $setting, $value ) {
148
+ $this->setting_require[ $setting ] = $value;
149
+
150
+ return $this;
151
+ }
152
+
153
+ /**
154
+ * @return bool
155
+ */
156
+ public function are_requirements_met() {
157
+ $this->notices = $this->prepare_requirement_notices();
158
+
159
+ return count( $this->notices ) === 0;
160
+ }
161
+
162
+ /**
163
+ * @return array
164
+ */
165
+ private function prepare_requirement_notices() {
166
+ $notices = array();
167
+ if ( ! self::is_php_at_least( $this->min_php_version ) ) {
168
+ $notices[] = $this->prepare_notice_message( sprintf( __( 'The &#8220;%s&#8221; plugin cannot run on PHP versions older than %s. Please contact your host and ask them to upgrade.',
169
+ $this->get_text_domain() ), esc_html( $this->plugin_name ), $this->min_php_version ) );
170
+ }
171
+ if ( ! self::is_wp_at_least( $this->min_wp_version ) ) {
172
+ $notices[] = $this->prepare_notice_message( sprintf( __( 'The &#8220;%s&#8221; plugin cannot run on WordPress versions older than %s. Please update WordPress.',
173
+ $this->get_text_domain() ), esc_html( $this->plugin_name ), $this->min_wp_version ) );
174
+ }
175
+ if ( $this->min_wc_version !== null && $this->can_check_plugin_version() && ! self::is_wc_at_least( $this->min_wc_version ) ) {
176
+ $notices[] = $this->prepare_notice_message( sprintf( __( 'The &#8220;%s&#8221; plugin cannot run on WooCommerce versions older than %s. Please update WooCommerce.',
177
+ $this->get_text_domain() ), esc_html( $this->plugin_name ), $this->min_wc_version ) );
178
+ }
179
+ if ( $this->min_openssl_version !== null && ! self::is_open_ssl_at_least( $this->min_openssl_version ) ) {
180
+ $notices[] = $this->prepare_notice_message( sprintf( __( 'The &#8220;%s&#8221; plugin cannot run without OpenSSL module version at least %s. Please update OpenSSL module.',
181
+ $this->get_text_domain() ), esc_html( $this->plugin_name ),
182
+ '0x' . dechex( $this->min_openssl_version ) ) );
183
+ }
184
+
185
+ $notices = $this->append_plugin_require_notices( $notices );
186
+ $notices = $this->append_module_require_notices( $notices );
187
+ $notices = $this->append_settings_require_notices( $notices );
188
+
189
+ return $notices;
190
+ }
191
+
192
+ /**
193
+ * @param $min_version
194
+ *
195
+ * @return mixed
196
+ */
197
+ public static function is_php_at_least( $min_version ) {
198
+ return version_compare( PHP_VERSION, $min_version, '>=' );
199
+ }
200
+
201
+ /**
202
+ * Prepares message in html format
203
+ *
204
+ * @param string $message
205
+ *
206
+ * @return string
207
+ */
208
+ private function prepare_notice_message( $message ) {
209
+ return '<div class="error"><p>' . $message . '</p></div>';
210
+ }
211
+
212
+ public function get_text_domain() {
213
+ return $this->text_domain;
214
+ }
215
+
216
+ /**
217
+ * @param string $min_version
218
+ *
219
+ * @return bool
220
+ */
221
+ public static function is_wp_at_least( $min_version ) {
222
+ return version_compare( get_bloginfo( 'version' ), $min_version, '>=' );
223
+ }
224
+
225
+ /**
226
+ * Are plugins loaded so we can check the version
227
+ *
228
+ * @return bool
229
+ */
230
+ private function can_check_plugin_version() {
231
+ return did_action( 'plugins_loaded' ) > 0;
232
+ }
233
+
234
+ /**
235
+ * Checks if plugin is active and have designated version. Needs to be enabled in deferred way.
236
+ *
237
+ * @param string $min_version
238
+ *
239
+ * @return bool
240
+ */
241
+ public static function is_wc_at_least( $min_version ) {
242
+ return defined( 'WC_VERSION' ) &&
243
+ version_compare( WC_VERSION, $min_version, '>=' );
244
+ }
245
+
246
+ /**
247
+ * Checks if ssl version is valid
248
+ *
249
+ * @param int $required_version Version in hex. Version 9.6 is 0x000906000
250
+ *
251
+ * @see https://www.openssl.org/docs/man1.1.0/crypto/OPENSSL_VERSION_NUMBER.html
252
+ *
253
+ * @return bool
254
+ */
255
+ public static function is_open_ssl_at_least( $required_version ) {
256
+ return defined( 'OPENSSL_VERSION_NUMBER' ) && OPENSSL_VERSION_NUMBER > (int) $required_version;
257
+ }
258
+
259
+ /**
260
+ * @param array $notices
261
+ *
262
+ * @return array
263
+ */
264
+ private function append_plugin_require_notices( $notices ) {
265
+ if ( count( $this->plugin_require ) > 0 ) {
266
+ foreach ( $this->plugin_require as $plugin_name => $nice_plugin_name ) {
267
+ if ( ! self::is_wp_plugin_active( $plugin_name ) ) {
268
+ $notices[] = $this->prepare_notice_message( sprintf( __( 'The &#8220;%s&#8221; plugin cannot run without %s active. Please install and activate %s plugin.',
269
+ $this->get_text_domain() ), esc_html( $this->plugin_name ),
270
+ esc_html( basename( $nice_plugin_name ) ), esc_html( basename( $nice_plugin_name ) ) ) );
271
+ }
272
+ }
273
+ }
274
+
275
+ return $notices;
276
+ }
277
+
278
+ /**
279
+ * Checks if plugin is active. Needs to be enabled in deferred way.
280
+ *
281
+ * @param string $plugin_file
282
+ *
283
+ * @return bool
284
+ */
285
+ public static function is_wp_plugin_active( $plugin_file ) {
286
+ $active_plugins = (array) get_option( 'active_plugins', array() );
287
+
288
+ if ( is_multisite() ) {
289
+ $active_plugins = array_merge( $active_plugins, get_site_option( 'active_sitewide_plugins', array() ) );
290
+ }
291
+
292
+ return in_array( $plugin_file, $active_plugins ) || array_key_exists( $plugin_file, $active_plugins );
293
+ }
294
+
295
+ /**
296
+ * @param array $notices
297
+ *
298
+ * @return array
299
+ */
300
+ private function append_module_require_notices( $notices ) {
301
+ if ( count( $this->module_require ) > 0 ) {
302
+ foreach ( $this->module_require as $module_name => $nice_module_name ) {
303
+ if ( ! self::is_module_active( $module_name ) ) {
304
+ $notices[] = $this->prepare_notice_message( sprintf( __( 'The &#8220;%s&#8221; plugin cannot run without %s php module installed. Please contact your host and ask them to install %s.',
305
+ $this->get_text_domain() ), esc_html( $this->plugin_name ),
306
+ esc_html( basename( $nice_module_name ) ), esc_html( basename( $nice_module_name ) ) ) );
307
+ }
308
+ }
309
+ }
310
+
311
+ return $notices;
312
+ }
313
+
314
+ /**
315
+ * @param string $name
316
+ *
317
+ * @return bool
318
+ */
319
+ public static function is_module_active( $name ) {
320
+ return extension_loaded( $name );
321
+ }
322
+
323
+ /**
324
+ * @param array $notices
325
+ *
326
+ * @return array
327
+ */
328
+ private function append_settings_require_notices( $notices ) {
329
+ if ( count( $this->setting_require ) > 0 ) {
330
+ foreach ( $this->setting_require as $setting => $value ) {
331
+ if ( ! self::is_setting_set( $setting, $value ) ) {
332
+ $notices[] = $this->prepare_notice_message( sprintf( __( 'The &#8220;%s&#8221; plugin cannot run without %s php setting set to %s. Please contact your host and ask them to set %s.',
333
+ $this->get_text_domain() ), esc_html( $this->plugin_name ), esc_html( basename( $setting ) ),
334
+ esc_html( basename( $value ) ), esc_html( basename( $setting ) ) ) );
335
+ }
336
+ }
337
+ }
338
+
339
+ return $notices;
340
+ }
341
+
342
+ /**
343
+ * @param string $name
344
+ * @param mixed $value
345
+ *
346
+ * @return bool
347
+ */
348
+ public static function is_setting_set( $name, $value ) {
349
+ return ini_get( $name ) === (string) $value;
350
+ }
351
+
352
+ /**
353
+ * @return void
354
+ *
355
+ * @deprecated use render_notices or disable_plugin
356
+ */
357
+ public function disable_plugin_render_notice() {
358
+ add_action( self::HOOK_ADMIN_NOTICES_ACTION, array( $this, 'handle_render_notices_action') );
359
+ }
360
+
361
+ /**
362
+ * Renders requirement notices in admin panel
363
+ *
364
+ * @return void
365
+ */
366
+ public function render_notices() {
367
+ add_action( self::HOOK_ADMIN_NOTICES_ACTION, array( $this, 'handle_render_notices_action') );
368
+ }
369
+
370
+ /**
371
+ * Renders requirement notices in admin panel
372
+ *
373
+ * @return void
374
+ */
375
+ public function disable_plugin() {
376
+ add_action( self::HOOK_ADMIN_NOTICES_ACTION, array( $this, 'handle_deactivate_action') );
377
+ }
378
+
379
+ /**
380
+ * @internal Do not use as public. Public only for wp action.
381
+ *
382
+ * @return void
383
+ */
384
+ public function handle_deactivate_action() {
385
+ if ( isset( $this->plugin_file ) ) {
386
+ deactivate_plugins( plugin_basename( $this->plugin_file ) );
387
+ }
388
+ }
389
+
390
+ /**
391
+ * Should be called as WordPress action
392
+ *
393
+ * @internal Do not use as public. Public only for wp action.
394
+ *
395
+ * @return void
396
+ */
397
+ public function handle_render_notices_action() {
398
+ foreach ( $this->notices as $notice ) {
399
+ echo $notice;
400
+ }
401
+ }
402
+ }
403
+ }
vendor/wpdesk/wp-basic-requirements/src/Basic_Requirement_Checker_Factory.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( ! class_exists('Basic_Requirement_Checker')) {
4
+ require_once 'Basic_Requirement_Checker.php';
5
+ }
6
+
7
+ class WPDesk_Basic_Requirement_Checker_Factory
8
+ {
9
+ /**
10
+ * @param $plugin_file
11
+ * @param $plugin_name
12
+ * @param $text_domain
13
+ * @param $php_version
14
+ * @param $wp_version
15
+ *
16
+ * @return WPDesk_Requirement_Checker
17
+ */
18
+ public function create_requirement_checker($plugin_file, $plugin_name, $text_domain)
19
+ {
20
+ return new WPDesk_Basic_Requirement_Checker($plugin_file, $plugin_name, $text_domain, null, null);
21
+ }
22
+ }
vendor/wpdesk/wp-basic-requirements/src/Requirement_Checker.php ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Checks requirements for plugin
4
+ * have to be compatible with PHP 5.2.x
5
+ */
6
+ interface WPDesk_Requirement_Checker
7
+ {
8
+ /**
9
+ * @param string $version
10
+ *
11
+ * @return $this
12
+ */
13
+ public function set_min_php_require($version);
14
+
15
+ /**
16
+ * @param string $version
17
+ *
18
+ * @return $this
19
+ */
20
+ public function set_min_wp_require($version);
21
+
22
+ /**
23
+ * @param string $version
24
+ *
25
+ * @return $this
26
+ */
27
+ public function set_min_wc_require($version);
28
+
29
+ /**
30
+ * @param $version
31
+ *
32
+ * @return $this
33
+ */
34
+ public function set_min_openssl_require($version);
35
+
36
+ /**
37
+ * @param string $plugin_name
38
+ * @param string $nice_plugin_name Nice plugin name for better looks in notice
39
+ *
40
+ * @return $this
41
+ */
42
+ public function add_plugin_require($plugin_name, $nice_plugin_name = null);
43
+
44
+ /**
45
+ * @param string $module_name
46
+ * @param string $nice_name Nice module name for better looks in notice
47
+ *
48
+ * @return $this
49
+ */
50
+ public function add_php_module_require($module_name, $nice_name = null);
51
+
52
+ /**
53
+ * @param string $setting
54
+ * @param mixed $value
55
+ *
56
+ * @return $this
57
+ */
58
+ public function add_php_setting_require($setting, $value);
59
+
60
+ /**
61
+ * @return bool
62
+ */
63
+ public function are_requirements_met();
64
+
65
+ /**
66
+ * @return void
67
+ */
68
+ public function disable_plugin_render_notice();
69
+
70
+ /**
71
+ * @return void
72
+ */
73
+ public function render_notices();
74
+
75
+ /**
76
+ * Renders requirement notices in admin panel
77
+ *
78
+ * @return void
79
+ */
80
+ public function disable_plugin();
81
+ }
vendor/wpdesk/wp-basic-requirements/src/Requirement_Checker_Factory.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ interface WPDesk_Requirement_Checker_Factory
4
+ {
5
+ /**
6
+ * @param $plugin_file
7
+ * @param $plugin_name
8
+ * @param $text_domain
9
+ * @param $php_version
10
+ * @param $wp_version
11
+ *
12
+ * @return WPDesk_Requirement_Checker
13
+ */
14
+ public function create_requirement_checker($plugin_file, $plugin_name, $text_domain);
15
+ }
vendor/wpdesk/wp-basic-requirements/tests/unit/Test_Basic_Requirement_Checker.php CHANGED
@@ -46,7 +46,7 @@ class Test_Basic_Requirement_Checker extends PHPUnit\Framework\TestCase {
46
  $requirements->set_min_php_require( self::ALWAYS_NOT_VALID_PHP_VERSION );
47
  $requirements->are_requirements_met();
48
  $this->expectOutputRegex( "/PHP/" );
49
- $requirements->render_notices_action();
50
  }
51
 
52
  /**
@@ -73,7 +73,7 @@ class Test_Basic_Requirement_Checker extends PHPUnit\Framework\TestCase {
73
  'Should fail because required WP should be at least ' . $wp_version_fail );
74
 
75
  $this->expectOutputRegex( "/WordPress/" );
76
- $requirements->render_notices_action();
77
  }
78
 
79
  /**
@@ -88,7 +88,7 @@ class Test_Basic_Requirement_Checker extends PHPUnit\Framework\TestCase {
88
  $this->assertTrue( $requirements->are_requirements_met(), 'Curl should exists' );
89
 
90
  $this->expectOutputRegex( "/^$/" );
91
- $requirements->render_notices_action();
92
  }
93
 
94
  public function test_plugin_check_with_multisite() {
@@ -122,7 +122,7 @@ class Test_Basic_Requirement_Checker extends PHPUnit\Framework\TestCase {
122
  $this->assertFalse( $requirements->are_requirements_met(), 'Plugin should not exists' );
123
 
124
  $this->expectOutputRegex( "/$not_existing_plugin_name/" );
125
- $requirements->render_notices_action();
126
  }
127
 
128
  /**
@@ -147,7 +147,7 @@ class Test_Basic_Requirement_Checker extends PHPUnit\Framework\TestCase {
147
  'Requirement OpenSSL should fail for that high number' );
148
 
149
  $this->expectOutputRegex( '/without OpenSSL module/' );
150
- $requirements->render_notices_action();
151
  }
152
 
153
  public function test_deactivate_plugin_notice() {
@@ -155,13 +155,13 @@ class Test_Basic_Requirement_Checker extends PHPUnit\Framework\TestCase {
155
  self::ALWAYS_VALID_WP_VERSION );
156
 
157
  WP_Mock::expectActionAdded( WPDesk_Basic_Requirement_Checker::HOOK_ADMIN_NOTICES_ACTION,
158
- [ $requirements, 'render_notices_action' ] );
159
 
160
  $this->assertFalse( $requirements->are_requirements_met() );
161
  $requirements->disable_plugin();
162
  $requirements->render_notices();
163
 
164
  $this->expectOutputRegex( '/cannot run on PHP/' );
165
- $requirements->render_notices_action();
166
  }
167
  }
46
  $requirements->set_min_php_require( self::ALWAYS_NOT_VALID_PHP_VERSION );
47
  $requirements->are_requirements_met();
48
  $this->expectOutputRegex( "/PHP/" );
49
+ $requirements->handle_render_notices_action();
50
  }
51
 
52
  /**
73
  'Should fail because required WP should be at least ' . $wp_version_fail );
74
 
75
  $this->expectOutputRegex( "/WordPress/" );
76
+ $requirements->handle_render_notices_action();
77
  }
78
 
79
  /**
88
  $this->assertTrue( $requirements->are_requirements_met(), 'Curl should exists' );
89
 
90
  $this->expectOutputRegex( "/^$/" );
91
+ $requirements->handle_render_notices_action();
92
  }
93
 
94
  public function test_plugin_check_with_multisite() {
122
  $this->assertFalse( $requirements->are_requirements_met(), 'Plugin should not exists' );
123
 
124
  $this->expectOutputRegex( "/$not_existing_plugin_name/" );
125
+ $requirements->handle_render_notices_action();
126
  }
127
 
128
  /**
147
  'Requirement OpenSSL should fail for that high number' );
148
 
149
  $this->expectOutputRegex( '/without OpenSSL module/' );
150
+ $requirements->handle_render_notices_action();
151
  }
152
 
153
  public function test_deactivate_plugin_notice() {
155
  self::ALWAYS_VALID_WP_VERSION );
156
 
157
  WP_Mock::expectActionAdded( WPDesk_Basic_Requirement_Checker::HOOK_ADMIN_NOTICES_ACTION,
158
+ [ $requirements, 'handle_render_notices_action'] );
159
 
160
  $this->assertFalse( $requirements->are_requirements_met() );
161
  $requirements->disable_plugin();
162
  $requirements->render_notices();
163
 
164
  $this->expectOutputRegex( '/cannot run on PHP/' );
165
+ $requirements->handle_render_notices_action();
166
  }
167
  }
vendor/wpdesk/wp-saas-platform-client/src/ApiClient/ClientImplementation.php CHANGED
@@ -17,7 +17,7 @@ class ClientImplementation implements Client, LoggerAwareInterface
17
  {
18
  const CLIENT_VERSION = '1.9.1';
19
 
20
- const DEFAULT_TIMEOUT = 10;
21
 
22
  /** @var HttpClient */
23
  private $client;
17
  {
18
  const CLIENT_VERSION = '1.9.1';
19
 
20
+ const DEFAULT_TIMEOUT = 30;
21
 
22
  /** @var HttpClient */
23
  private $client;
vendor/wpdesk/wp-saas-platform-client/src/HttpClient/HttpClientResponse.php CHANGED
@@ -22,6 +22,9 @@ class HttpClientResponse
22
  */
23
  public function __construct($headers, $body, $code)
24
  {
 
 
 
25
  $this->headers = $headers;
26
  $this->body = $body;
27
  $this->code = $code;
22
  */
23
  public function __construct($headers, $body, $code)
24
  {
25
+ if (empty($body)) {
26
+ $body = '{}';
27
+ }
28
  $this->headers = $headers;
29
  $this->body = $body;
30
  $this->code = $code;
vendor/wpdesk/wp-saas-platform-client/src/Model/ShipmentDocument/SendDocumentsResponse.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace WPDesk\SaasPlatformClient\Model\ShipmentDocument;
4
+
5
+ use WPDesk\SaasPlatformClient\Model\AbstractModel;
6
+
7
+ class SendDocumentsResponse extends AbstractModel
8
+ {
9
+
10
+ /**
11
+ * @var array
12
+ */
13
+ protected $documentStatuses;
14
+
15
+ /**
16
+ * @return array
17
+ */
18
+ public function getDocumentStatuses()
19
+ {
20
+ return $this->documentStatuses;
21
+ }
22
+
23
+ }
vendor/wpdesk/wp-saas-platform-client/src/Model/ShipmentDocument/ShipmentDocument.php ADDED
@@ -0,0 +1,193 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace WPDesk\SaasPlatformClient\Model\ShipmentDocument;
4
+
5
+ use WPDesk\SaasPlatformClient\Model\AbstractModel;
6
+ use WPDesk\SaasPlatformClient\Model\Shipment\ShipmentAdminContext;
7
+
8
+ class ShipmentDocument extends AbstractModel
9
+ {
10
+
11
+ /**
12
+ * @var string
13
+ */
14
+ protected $message;
15
+
16
+ /**
17
+ * @var int Unique numeric ID.
18
+ */
19
+ protected $id;
20
+
21
+ /**
22
+ * @var string document type.
23
+ */
24
+ protected $documentType;
25
+
26
+ /**
27
+ * @var string
28
+ */
29
+ protected $fileName;
30
+
31
+ /**
32
+ * Content encoded in base64
33
+ * @var string
34
+ */
35
+ protected $fileContent;
36
+
37
+ /**
38
+ * @var string
39
+ */
40
+ protected $status;
41
+
42
+ /**
43
+ * @var \DateTime
44
+ */
45
+ protected $createdAt;
46
+
47
+ /**
48
+ * @var \DateTime
49
+ */
50
+ protected $updatedAt;
51
+
52
+ /**
53
+ * @var ShipmentAdminContext
54
+ */
55
+ protected $shipment;
56
+
57
+ /**
58
+ * @return int
59
+ */
60
+ public function getId()
61
+ {
62
+ return $this->id;
63
+ }
64
+
65
+ /**
66
+ * @param int $id
67
+ */
68
+ public function setId($id)
69
+ {
70
+ $this->id = $id;
71
+ }
72
+
73
+ /**
74
+ * @return string
75
+ */
76
+ public function getDocumentType()
77
+ {
78
+ return $this->documentType;
79
+ }
80
+
81
+ /**
82
+ * @param string $documentType
83
+ */
84
+ public function setDocumentType($documentType)
85
+ {
86
+ $this->documentType = $documentType;
87
+ }
88
+
89
+ /**
90
+ * @return string
91
+ */
92
+ public function getFileName()
93
+ {
94
+ return $this->fileName;
95
+ }
96
+
97
+ /**
98
+ * @param string $fileName
99
+ */
100
+ public function setFileName($fileName)
101
+ {
102
+ $this->fileName = $fileName;
103
+ }
104
+
105
+ /**
106
+ * @return string
107
+ */
108
+ public function getFileContent()
109
+ {
110
+ return $this->fileContent;
111
+ }
112
+
113
+ /**
114
+ * @param string $fileContent
115
+ */
116
+ public function setFileContent($fileContent)
117
+ {
118
+ $this->fileContent = $fileContent;
119
+ }
120
+
121
+ /**
122
+ * @return string
123
+ */
124
+ public function getStatus()
125
+ {
126
+ return $this->status;
127
+ }
128
+
129
+ /**
130
+ * @param string $status
131
+ */
132
+ public function setStatus($status)
133
+ {
134
+ $this->status = $status;
135
+ }
136
+
137
+ /**
138
+ * @return \DateTime
139
+ */
140
+ public function getCreatedAt()
141
+ {
142
+ return $this->createdAt;
143
+ }
144
+
145
+ /**
146
+ * @param \DateTime $createdAt
147
+ */
148
+ public function setCreatedAt($createdAt)
149
+ {
150
+ $this->createdAt = $createdAt;
151
+ }
152
+
153
+ /**
154
+ * @return \DateTime
155
+ */
156
+ public function getUpdatedAt()
157
+ {
158
+ return $this->updatedAt;
159
+ }
160
+
161
+ /**
162
+ * @param \DateTime $updatedAt
163
+ */
164
+ public function setUpdatedAt($updatedAt)
165
+ {
166
+ $this->updatedAt = $updatedAt;
167
+ }
168
+
169
+ /**
170
+ * @return ShipmentAdminContext
171
+ */
172
+ public function getShipment()
173
+ {
174
+ return $this->shipment;
175
+ }
176
+
177
+ /**
178
+ * @param ShipmentAdminContext $shipment
179
+ */
180
+ public function setShipment($shipment)
181
+ {
182
+ $this->shipment = $shipment;
183
+ }
184
+
185
+ /**
186
+ * @return string
187
+ */
188
+ public function getMessage()
189
+ {
190
+ return $this->message;
191
+ }
192
+
193
+ }
vendor/wpdesk/wp-saas-platform-client/src/Model/ShipmentDocument/ShipmentDocumentRequest.php ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace WPDesk\SaasPlatformClient\Model\ShipmentDocument;
4
+
5
+ use WPDesk\SaasPlatformClient\Model\AbstractModel;
6
+
7
+ class ShipmentDocumentRequest extends AbstractModel
8
+ {
9
+
10
+ /**
11
+ * @var string document type.
12
+ */
13
+ protected $documentType;
14
+
15
+ /**
16
+ * @var string
17
+ */
18
+ protected $fileName;
19
+
20
+ /**
21
+ * Content encoded in base64
22
+ * @var string
23
+ */
24
+ protected $fileContent;
25
+
26
+ /**
27
+ * @return string
28
+ */
29
+ public function getDocumentType()
30
+ {
31
+ return $this->documentType;
32
+ }
33
+
34
+ /**
35
+ * @param string $documentType
36
+ */
37
+ public function setDocumentType($documentType)
38
+ {
39
+ $this->documentType = $documentType;
40
+ }
41
+
42
+ /**
43
+ * @return string
44
+ */
45
+ public function getFileName()
46
+ {
47
+ return $this->fileName;
48
+ }
49
+
50
+ /**
51
+ * @param string $fileName
52
+ */
53
+ public function setFileName($fileName)
54
+ {
55
+ $this->fileName = $fileName;
56
+ }
57
+
58
+ /**
59
+ * @return string
60
+ */
61
+ public function getFileContent()
62
+ {
63
+ return $this->fileContent;
64
+ }
65
+
66
+ /**
67
+ * @param string $fileContent
68
+ */
69
+ public function setFileContent($fileContent)
70
+ {
71
+ $this->fileContent = $fileContent;
72
+ }
73
+
74
+ }
vendor/wpdesk/wp-saas-platform-client/src/Platform.php CHANGED
@@ -11,20 +11,22 @@ use WPDesk\SaasPlatformClient\Authentication\NullToken;
11
  use WPDesk\SaasPlatformClient\Authentication\Token;
12
  use WPDesk\SaasPlatformClient\ApiClient\Client;
13
  use WPDesk\SaasPlatformClient\Model\ParcelCollectionPoints\SearchRequest;
14
- use WPDesk\SaasPlatformClient\Model\ParcelCollectionPoints\SearchResponse;
15
  use WPDesk\SaasPlatformClient\Model\ParcelCollectionPoints\SingleRequest;
16
- use WPDesk\SaasPlatformClient\Model\ParcelCollectionPoints\SingleResponse;
17
  use WPDesk\SaasPlatformClient\Model\Rate\RateRequest;
18
  use WPDesk\SaasPlatformClient\Model\Shipment\ShipmentRequest;
 
19
  use WPDesk\SaasPlatformClient\Model\ShippingServiceSetting;
20
  use WPDesk\SaasPlatformClient\Request\Authentication\RegisterRequest;
21
  use WPDesk\SaasPlatformClient\Request\AuthRequest;
22
- use WPDesk\SaasPlatformClient\Request\Cancel\PostCancelRequest;
23
  use WPDesk\SaasPlatformClient\Request\Fields\GetFieldsRequest;
24
  use WPDesk\SaasPlatformClient\Request\Label\PostLabelRequest;
25
  use WPDesk\SaasPlatformClient\Request\ParcelCollectionPoints\GetSingleRequest;
26
  use WPDesk\SaasPlatformClient\Request\ParcelCollectionPoints\PostSearchRequest;
27
  use WPDesk\SaasPlatformClient\Request\Rate\PostRateRequest;
 
 
 
28
  use WPDesk\SaasPlatformClient\Request\ShippingServices\GetListRequest;
29
  use WPDesk\SaasPlatformClient\Request\ShippingServices\GetServiceRequest;
30
  use WPDesk\SaasPlatformClient\Request\Shipment\PostShipmentRequest;
@@ -43,8 +45,11 @@ use WPDesk\SaasPlatformClient\Response\ParcelCollectionPoints\GetSingleResponse;
43
  use WPDesk\SaasPlatformClient\Response\ParcelCollectionPoints\PostSearchResponse;
44
  use WPDesk\SaasPlatformClient\Response\ProtectedResponse;
45
  use WPDesk\SaasPlatformClient\Response\Response;
46
- use WPDesk\SaasPlatformClient\Response\Cancel\PostCancelResponse;
47
  use WPDesk\SaasPlatformClient\Response\Rate\PostRateResponse;
 
 
 
48
  use WPDesk\SaasPlatformClient\Response\ShippingServices;
49
  use WPDesk\SaasPlatformClient\Response\Authentication\TokenResponse;
50
  use WPDesk\SaasPlatformClient\Response\ShippingServicesSettings\GetSettingsResponse;
@@ -204,6 +209,51 @@ class Platform implements LoggerAwareInterface
204
  return new PostRateResponse(new ProtectedResponse($response));
205
  }
206
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
207
  /**
208
  * Search Parcel Collection Points
209
  *
@@ -287,6 +337,23 @@ class Platform implements LoggerAwareInterface
287
  return new PostCancelResponse(new ProtectedResponse($response));
288
  }
289
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
290
  /**
291
  * Fetch dynamic fields
292
  *
11
  use WPDesk\SaasPlatformClient\Authentication\Token;
12
  use WPDesk\SaasPlatformClient\ApiClient\Client;
13
  use WPDesk\SaasPlatformClient\Model\ParcelCollectionPoints\SearchRequest;
 
14
  use WPDesk\SaasPlatformClient\Model\ParcelCollectionPoints\SingleRequest;
 
15
  use WPDesk\SaasPlatformClient\Model\Rate\RateRequest;
16
  use WPDesk\SaasPlatformClient\Model\Shipment\ShipmentRequest;
17
+ use WPDesk\SaasPlatformClient\Model\ShipmentDocument\ShipmentDocumentRequest;
18
  use WPDesk\SaasPlatformClient\Model\ShippingServiceSetting;
19
  use WPDesk\SaasPlatformClient\Request\Authentication\RegisterRequest;
20
  use WPDesk\SaasPlatformClient\Request\AuthRequest;
21
+ use WPDesk\SaasPlatformClient\Request\ShipmentCancel\PostCancelRequest;
22
  use WPDesk\SaasPlatformClient\Request\Fields\GetFieldsRequest;
23
  use WPDesk\SaasPlatformClient\Request\Label\PostLabelRequest;
24
  use WPDesk\SaasPlatformClient\Request\ParcelCollectionPoints\GetSingleRequest;
25
  use WPDesk\SaasPlatformClient\Request\ParcelCollectionPoints\PostSearchRequest;
26
  use WPDesk\SaasPlatformClient\Request\Rate\PostRateRequest;
27
+ use WPDesk\SaasPlatformClient\Request\ShipmentDocument\DeleteShipmentDocumentRequest;
28
+ use WPDesk\SaasPlatformClient\Request\ShipmentDocument\PostShipmentDocumentRequest;
29
+ use WPDesk\SaasPlatformClient\Request\ShipmentDocumentsSend\PostSendRequest;
30
  use WPDesk\SaasPlatformClient\Request\ShippingServices\GetListRequest;
31
  use WPDesk\SaasPlatformClient\Request\ShippingServices\GetServiceRequest;
32
  use WPDesk\SaasPlatformClient\Request\Shipment\PostShipmentRequest;
45
  use WPDesk\SaasPlatformClient\Response\ParcelCollectionPoints\PostSearchResponse;
46
  use WPDesk\SaasPlatformClient\Response\ProtectedResponse;
47
  use WPDesk\SaasPlatformClient\Response\Response;
48
+ use WPDesk\SaasPlatformClient\Response\ShipmentCancel\PostCancelResponse;
49
  use WPDesk\SaasPlatformClient\Response\Rate\PostRateResponse;
50
+ use WPDesk\SaasPlatformClient\Response\ShipmentDocument\DeleteShipmentDocumentResponse;
51
+ use WPDesk\SaasPlatformClient\Response\ShipmentDocument\PostShipmentDocumentResponse;
52
+ use WPDesk\SaasPlatformClient\Response\ShipmentDocumentsSend\PostSendResponse;
53
  use WPDesk\SaasPlatformClient\Response\ShippingServices;
54
  use WPDesk\SaasPlatformClient\Response\Authentication\TokenResponse;
55
  use WPDesk\SaasPlatformClient\Response\ShippingServicesSettings\GetSettingsResponse;
209
  return new PostRateResponse(new ProtectedResponse($response));
210
  }
211
 
212
+ /**
213
+ * Creates document for shipment.
214
+ *
215
+ * @param ShipmentDocumentRequest $shipmentDocumentRequest
216
+ * @param int $serviceId
217
+ * @param int $shipmentId
218
+ * @return PostShipmentDocumentResponse
219
+ */
220
+ public function requestPostShipmentDocument(
221
+ ShipmentDocumentRequest $shipmentDocumentRequest,
222
+ $serviceId,
223
+ $shipmentId
224
+ ) {
225
+ $saasToken = new JWTSaasToken($this->getToken());
226
+
227
+ $postShipmentDocumentRequest = new PostShipmentDocumentRequest(
228
+ $this->getToken(),
229
+ $shipmentId,
230
+ $serviceId,
231
+ $saasToken->getShopId(),
232
+ $shipmentDocumentRequest
233
+ );
234
+ $response = $this->sendRequestWithInvalidTokenHandling($postShipmentDocumentRequest);
235
+ /** @noinspection PhpMethodParametersCountMismatchInspection PHPStorm bug with wrapped traits */
236
+ return new PostShipmentDocumentResponse(new ProtectedResponse($response));
237
+ }
238
+
239
+ /**
240
+ * Deletes document from shipment.
241
+ *
242
+ * @param int $documentId
243
+ * @return DeleteShipmentDocumentResponse
244
+ */
245
+ public function requestDeleteShipmentDocument(
246
+ $documentId
247
+ ) {
248
+ $deleteShipmentDocumentRequest = new DeleteShipmentDocumentRequest(
249
+ $this->getToken(),
250
+ $documentId
251
+ );
252
+ $response = $this->sendRequestWithInvalidTokenHandling($deleteShipmentDocumentRequest);
253
+ /** @noinspection PhpMethodParametersCountMismatchInspection PHPStorm bug with wrapped traits */
254
+ return new DeleteShipmentDocumentResponse(new ProtectedResponse($response));
255
+ }
256
+
257
  /**
258
  * Search Parcel Collection Points
259
  *
337
  return new PostCancelResponse(new ProtectedResponse($response));
338
  }
339
 
340
+ /**
341
+ * Send documents
342
+ *
343
+ * @param int $shipmentId
344
+ * @param int $serviceId
345
+ * @return PostSendResponse
346
+ */
347
+ public function requestPostSendDocuments($shipmentId, $serviceId)
348
+ {
349
+ $saasToken = new JWTSaasToken($this->getToken());
350
+
351
+ $postCancelRequest = new PostSendRequest($this->getToken(), $serviceId, $saasToken->getShopId(), $shipmentId);
352
+ $response = $this->sendRequestWithInvalidTokenHandling($postCancelRequest);
353
+ /** @noinspection PhpMethodParametersCountMismatchInspection PHPStorm bug with wrapped traits */
354
+ return new PostSendResponse(new ProtectedResponse($response));
355
+ }
356
+
357
  /**
358
  * Fetch dynamic fields
359
  *
vendor/wpdesk/wp-saas-platform-client/src/Request/{Cancel → ShipmentCancel}/PostCancelRequest.php RENAMED
@@ -1,6 +1,6 @@
1
  <?php
2
 
3
- namespace WPDesk\SaasPlatformClient\Request\Cancel;
4
 
5
  use WPDesk\SaasPlatformClient\Authentication\Token;
6
  use WPDesk\SaasPlatformClient\Request\AuthRequest;
1
  <?php
2
 
3
+ namespace WPDesk\SaasPlatformClient\Request\ShipmentCancel;
4
 
5
  use WPDesk\SaasPlatformClient\Authentication\Token;
6
  use WPDesk\SaasPlatformClient\Request\AuthRequest;
vendor/wpdesk/wp-saas-platform-client/src/Request/ShipmentDocument/DeleteShipmentDocumentRequest.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace WPDesk\SaasPlatformClient\Request\ShipmentDocument;
4
+
5
+ use WPDesk\SaasPlatformClient\Authentication\Token;
6
+ use WPDesk\SaasPlatformClient\Request\AuthRequest;
7
+
8
+ final class DeleteShipmentDocumentRequest extends AuthRequest
9
+ {
10
+
11
+ /** @var string */
12
+ protected $method = 'DELETE';
13
+
14
+ /** @var string */
15
+ protected $endPoint = '/documents/{document}';
16
+
17
+ /**
18
+ * PostShipmentRequest constructor.
19
+ * @param Token $token
20
+ * @param int $documentId
21
+ */
22
+ public function __construct(
23
+ Token $token,
24
+ $documentId
25
+ ) {
26
+ parent::__construct($token);
27
+
28
+ $this->endPoint = str_replace(
29
+ '{document}',
30
+ $documentId,
31
+ $this->endPoint
32
+ );
33
+ }
34
+
35
+ }
vendor/wpdesk/wp-saas-platform-client/src/Request/ShipmentDocument/PostShipmentDocumentRequest.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace WPDesk\SaasPlatformClient\Request\ShipmentDocument;
4
+
5
+ use WPDesk\SaasPlatformClient\Model\ShipmentDocument\ShipmentDocumentRequest;
6
+ use WPDesk\SaasPlatformClient\Authentication\Token;
7
+ use WPDesk\SaasPlatformClient\Request\AuthRequest;
8
+
9
+ final class PostShipmentDocumentRequest extends AuthRequest
10
+ {
11
+
12
+ /** @var string */
13
+ protected $method = 'POST';
14
+
15
+ /** @var string */
16
+ protected $endPoint = '/shops/{shop}/shipping_services/{service}/shipments/{shipment}/documents';
17
+
18
+ /**
19
+ * PostShipmentRequest constructor.
20
+ * @param Token $token
21
+ * @param int $shipmentId
22
+ * @param int $shippingServiceId
23
+ * @param int $shopId
24
+ * @param ShipmentDocumentRequest $request
25
+ */
26
+ public function __construct(
27
+ Token $token,
28
+ $shipmentId,
29
+ $shippingServiceId,
30
+ $shopId,
31
+ ShipmentDocumentRequest $request
32
+ ) {
33
+ parent::__construct($token);
34
+
35
+ $this->endPoint = str_replace(
36
+ ['{shop}', '{service}', '{shipment}'],
37
+ [$shopId, $shippingServiceId, $shipmentId],
38
+ $this->endPoint
39
+ );
40
+
41
+ $this->data = $request->toArray();
42
+ }
43
+
44
+
45
+ }
vendor/wpdesk/wp-saas-platform-client/src/Request/ShipmentDocumentsSend/PostSendRequest.php ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace WPDesk\SaasPlatformClient\Request\ShipmentDocumentsSend;
4
+
5
+ use WPDesk\SaasPlatformClient\Authentication\Token;
6
+ use WPDesk\SaasPlatformClient\Request\AuthRequest;
7
+
8
+ final class PostSendRequest extends AuthRequest
9
+ {
10
+
11
+ /** @var string */
12
+ protected $method = 'POST';
13
+
14
+ /** @var string */
15
+ protected $endPoint = '/shops/{shop}/shipping_services/{service}/shipments/{shipment}/documents/send';
16
+
17
+ /**
18
+ * PostShipmentRequest constructor.
19
+ * @param Token $token
20
+ * @param int $shippingServiceId
21
+ * @param int $shopId
22
+ * @param int $shipmentId
23
+ */
24
+ public function __construct(
25
+ Token $token,
26
+ $shippingServiceId,
27
+ $shopId,
28
+ $shipmentId
29
+ ) {
30
+ parent::__construct($token);
31
+
32
+ $this->endPoint = str_replace(
33
+ ['{shop}', '{service}', '{shipment}'],
34
+ [$shopId, $shippingServiceId, $shipmentId],
35
+ $this->endPoint
36
+ );
37
+
38
+ $this->data = [];
39
+ }
40
+
41
+ }
vendor/wpdesk/wp-saas-platform-client/src/Response/RawResponse.php CHANGED
@@ -64,6 +64,19 @@ class RawResponse implements Response
64
  return $this->data;
65
  }
66
 
 
 
 
 
 
 
 
 
 
 
 
 
 
67
  /**
68
  * Returns response body as array
69
  *
64
  return $this->data;
65
  }
66
 
67
+ /**
68
+ * Returns response error message if present or empty string.
69
+ *
70
+ * @return string|null
71
+ */
72
+ public function getResponseMessage()
73
+ {
74
+ if (is_array($this->data) && !empty($this->data['message'])) {
75
+ return $this->data['message'];
76
+ }
77
+ return '';
78
+ }
79
+
80
  /**
81
  * Returns response body as array
82
  *
vendor/wpdesk/wp-saas-platform-client/src/Response/Response.php CHANGED
@@ -2,7 +2,6 @@
2
 
3
  namespace WPDesk\SaasPlatformClient\Response;
4
 
5
-
6
  interface Response
7
  {
8
  /**
@@ -19,6 +18,13 @@ interface Response
19
  /** @return array */
20
  public function getResponseErrorBody();
21
 
 
 
 
 
 
 
 
22
  /**
23
  * Is any error occured
24
  *
2
 
3
  namespace WPDesk\SaasPlatformClient\Response;
4
 
 
5
  interface Response
6
  {
7
  /**
18
  /** @return array */
19
  public function getResponseErrorBody();
20
 
21
+ /**
22
+ * Returns response error message if present or null.
23
+ *
24
+ * @return string|null
25
+ */
26
+ public function getResponseMessage();
27
+
28
  /**
29
  * Is any error occured
30
  *
vendor/wpdesk/wp-saas-platform-client/src/Response/{Cancel → ShipmentCancel}/PostCancelResponse.php RENAMED
@@ -1,6 +1,6 @@
1
  <?php
2
 
3
- namespace WPDesk\SaasPlatformClient\Response\Cancel;
4
 
5
  use WPDesk\SaasPlatformClient\Response\ApiResponse;
6
  use WPDesk\SaasPlatformClient\Response\Traits\AuthApiResponseDecorator;
1
  <?php
2
 
3
+ namespace WPDesk\SaasPlatformClient\Response\ShipmentCancel;
4
 
5
  use WPDesk\SaasPlatformClient\Response\ApiResponse;
6
  use WPDesk\SaasPlatformClient\Response\Traits\AuthApiResponseDecorator;
vendor/wpdesk/wp-saas-platform-client/src/Response/ShipmentDocument/DeleteShipmentDocumentResponse.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace WPDesk\SaasPlatformClient\Response\ShipmentDocument;
4
+
5
+ use WPDesk\SaasPlatformClient\Response\ApiResponse;
6
+ use WPDesk\SaasPlatformClient\Response\Traits\AuthApiResponseDecorator;
7
+
8
+ class DeleteShipmentDocumentResponse implements ApiResponse
9
+ {
10
+ use AuthApiResponseDecorator;
11
+ }
vendor/wpdesk/wp-saas-platform-client/src/Response/ShipmentDocument/PostShipmentDocumentResponse.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace WPDesk\SaasPlatformClient\Response\ShipmentDocument;
4
+
5
+ use WPDesk\SaasPlatformClient\Model\ShipmentDocument\ShipmentDocument;
6
+ use WPDesk\SaasPlatformClient\Response\ApiResponse;
7
+ use WPDesk\SaasPlatformClient\Response\Traits\AuthApiResponseDecorator;
8
+
9
+ class PostShipmentDocumentResponse implements ApiResponse
10
+ {
11
+ use AuthApiResponseDecorator;
12
+
13
+ /**
14
+ * @return ShipmentDocument
15
+ */
16
+ public function getShipmentDocument()
17
+ {
18
+ return new ShipmentDocument($this->getResponseBody());
19
+ }
20
+
21
+ }
vendor/wpdesk/wp-saas-platform-client/src/Response/ShipmentDocumentsSend/PostSendResponse.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace WPDesk\SaasPlatformClient\Response\ShipmentDocumentsSend;
4
+
5
+ use WPDesk\SaasPlatformClient\Model\ShipmentDocument\SendDocumentsResponse;
6
+ use WPDesk\SaasPlatformClient\Response\ApiResponse;
7
+ use WPDesk\SaasPlatformClient\Response\Traits\AuthApiResponseDecorator;
8
+
9
+ class PostSendResponse implements ApiResponse
10
+ {
11
+ use AuthApiResponseDecorator;
12
+
13
+ /**
14
+ * @return SendDocumentsResponse
15
+ */
16
+ public function getDocumentStatusesResponse()
17
+ {
18
+ return new SendDocumentsResponse($this->getResponseBody());
19
+ }
20
+
21
+ }
vendor/wpdesk/wp-saas-platform-client/src/Response/Traits/ApiResponseDecorator.php CHANGED
@@ -51,6 +51,16 @@ trait ApiResponseDecorator
51
  return $this->rawResponse->getResponseErrorBody();
52
  }
53
 
 
 
 
 
 
 
 
 
 
 
54
  /**
55
  * Returns response body as array
56
  *
51
  return $this->rawResponse->getResponseErrorBody();
52
  }
53
 
54
+ /**
55
+ * Returns response error message if present or empty string.
56
+ *
57
+ * @return string
58
+ */
59
+ public function getResponseMessage()
60
+ {
61
+ return $this->rawResponse->getResponseMessage();
62
+ }
63
+
64
  /**
65
  * Returns response body as array
66
  *