WooCommerce PayPal Payments - Version 1.0.4

Version Description

  • Fix - Check if WooCommerce is active before initialize. #99
  • Fix - Payment buttons only visible on order-pay site when Mini Cart is enabled; payment fails. #96
  • Fix - High volume of failed calls to /v1/notifications/webhooks #93
  • Fix - GB country has ACDC blocked. #91
Download this release

Release Info

Developer woothemes
Plugin Icon 128x128 WooCommerce PayPal Payments
Version 1.0.4
Comparing to
See all releases

Code changes from version 1.0.3 to 1.0.4

Files changed (57) hide show
  1. changelog.txt +6 -0
  2. modules/ppcp-button/assets/js/button.js +1 -1
  3. modules/ppcp-button/assets/js/button.js.map +1 -1
  4. modules/ppcp-button/resources/js/button.js +3 -2
  5. modules/ppcp-button/resources/js/modules/ActionHandler/CheckoutActionHandler.js +4 -1
  6. modules/ppcp-button/resources/js/modules/ContextBootstrap/PayNowBootstrap.js +5 -3
  7. modules/ppcp-button/resources/js/modules/Helper/Spinner.js +6 -1
  8. modules/ppcp-button/src/Assets/class-smartbutton.php +5 -1
  9. modules/ppcp-button/src/Endpoint/class-createorderendpoint.php +1 -1
  10. modules/ppcp-webhooks/src/class-webhookregistrar.php +0 -4
  11. package-lock.json +2 -2
  12. readme.txt +7 -1
  13. vendor/autoload.php +1 -1
  14. vendor/composer/autoload_real.php +7 -7
  15. vendor/composer/autoload_static.php +4 -4
  16. vendor/composer/installed.json +27 -20
  17. vendor/composer/installers/composer.json +14 -7
  18. vendor/composer/installers/phpstan.neon.dist +10 -0
  19. vendor/composer/installers/src/Composer/Installers/BaseInstaller.php +6 -6
  20. vendor/composer/installers/src/Composer/Installers/CakePHPInstaller.php +2 -9
  21. vendor/composer/installers/src/Composer/Installers/CockpitInstaller.php +1 -3
  22. vendor/composer/installers/src/Composer/Installers/Installer.php +23 -9
  23. vendor/composer/installers/src/Composer/Installers/MoodleInstaller.php +1 -0
  24. vendor/composer/installers/src/Composer/Installers/OxidInstaller.php +1 -1
  25. vendor/composer/installers/src/Composer/Installers/ProcessWireInstaller.php +22 -0
  26. vendor/composer/installers/src/Composer/Installers/StarbugInstaller.php +12 -0
  27. vendor/composer/installers/src/Composer/Installers/SyDESInstaller.php +1 -3
  28. vendor/composer/installers/src/Composer/Installers/TaoInstaller.php +18 -0
  29. vendor/dhii/collections-interface/.env.example +5 -1
  30. vendor/dhii/collections-interface/CHANGELOG.md +5 -0
  31. vendor/dhii/collections-interface/composer.json +4 -4
  32. vendor/dhii/collections-interface/docker-compose.yml +25 -9
  33. vendor/dhii/collections-interface/docker/Dockerfile +39 -0
  34. vendor/dhii/collections-interface/docker/Dockerfile_php +0 -6
  35. vendor/dhii/collections-interface/phpunit.xml.dist +2 -5
  36. vendor/dhii/collections-interface/psalm.xml.dist +139 -11
  37. vendor/dhii/collections-interface/src/ClearableContainerInterface.php +1 -0
  38. vendor/dhii/collections-interface/tests/bootstrap.php +5 -0
  39. vendor/dhii/collections-interface/tests/unit/ClearableContainerInterfaceTest.php +53 -0
  40. vendor/dhii/collections-interface/tests/unit/ContainerFactoryInterfaceTest.php +42 -0
  41. vendor/dhii/collections-interface/tests/unit/ContainerInterfaceTest.php +59 -0
  42. vendor/dhii/collections-interface/tests/unit/CountableListInterfaceTest.php +58 -0
  43. vendor/dhii/collections-interface/tests/unit/CountableMapInterfaceTest.php +58 -0
  44. vendor/dhii/collections-interface/tests/unit/CountableSetInterfaceTest.php +58 -0
  45. vendor/dhii/collections-interface/tests/unit/HasCapableInterfaceTest.php +47 -0
  46. vendor/dhii/collections-interface/tests/unit/HasItemCapableInterfaceTest.php +46 -0
  47. vendor/dhii/collections-interface/tests/unit/MapFactoryInterfaceTest.php +44 -0
  48. vendor/dhii/collections-interface/tests/unit/MapInterfaceTest.php +58 -0
  49. vendor/dhii/collections-interface/tests/unit/MutableContainerInterfaceTest.php +53 -0
  50. vendor/dhii/collections-interface/tests/unit/SetFactoryInterfaceTest.php +42 -0
  51. vendor/dhii/collections-interface/tests/unit/SetInterfaceTest.php +58 -0
  52. vendor/dhii/collections-interface/tests/unit/WritableContainerInterfaceTest.php +52 -0
  53. vendor/dhii/collections-interface/tests/unit/WritableMapFactoryInterfaceTest.php +46 -0
  54. vendor/dhii/collections-interface/tests/unit/WritableMapInterfaceTest.php +58 -0
  55. vendor/dhii/collections-interface/tests/unit/WritableSetFactoryInterfaceTest.php +44 -0
  56. vendor/dhii/collections-interface/tests/unit/WritableSetInterfaceTest.php +52 -0
  57. woocommerce-paypal-payments.php +25 -1
changelog.txt CHANGED
@@ -1,5 +1,11 @@
1
  *** Changelog ***
2
 
 
 
 
 
 
 
3
  = 1.0.3 - 2020-11-30 =
4
  * Fix - Order with Payment received when Hosted Fields transaction is declined. #88
5
 
1
  *** Changelog ***
2
 
3
+ = 1.0.4 - 2021-01-18 =
4
+ * Fix - Check if WooCommerce is active before initialize. #99
5
+ * Fix - Payment buttons only visible on order-pay site when Mini Cart is enabled; payment fails. #96
6
+ * Fix - High volume of failed calls to /v1/notifications/webhooks #93
7
+ * Fix - GB country has ACDC blocked. #91
8
+
9
  = 1.0.3 - 2020-11-30 =
10
  * Fix - Order with Payment received when Hosted Fields transaction is declined. #88
11
 
modules/ppcp-button/assets/js/button.js CHANGED
@@ -1,2 +1,2 @@
1
- !function(e){var t={};function r(n){if(t[n])return t[n].exports;var a=t[n]={i:n,l:!1,exports:{}};return e[n].call(a.exports,a,a.exports,r),a.l=!0,a.exports}r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)r.d(n,a,function(t){return e[t]}.bind(null,a));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=1)}([,function(e,t,r){"use strict";r.r(t);var n=class{constructor(e){this.genericErrorText=e,this.wrapper=document.querySelector(".woocommerce-notices-wrapper")}genericError(){this.wrapper.classList.contains("ppcp-persist")||(this.clear(),this.message(this.genericErrorText))}message(e,t=!1){this.wrapper.classList.add("woocommerce-error"),t?this.wrapper.classList.add("ppcp-persist"):this.wrapper.classList.remove("ppcp-persist"),this.wrapper.innerHTML=this.sanitize(e),jQuery.scroll_to_notices(jQuery(".woocommerce-notices-wrapper"))}sanitize(e){const t=document.createElement("textarea");return t.innerHTML=e,t.value.replace("Error: ","")}clear(){this.wrapper.classList.contains("woocommerce-error")&&(this.wrapper.classList.remove("woocommerce-error"),this.wrapper.innerText="")}};var a=(e,t)=>(r,n)=>fetch(e.config.ajax.approve_order.endpoint,{method:"POST",body:JSON.stringify({nonce:e.config.ajax.approve_order.nonce,order_id:r.orderID})}).then(e=>e.json()).then(r=>{if(!r.success)return t.genericError(),n.restart().catch(e=>{t.genericError()});location.href=e.config.redirect});const o=()=>{const e=PayPalCommerceGateway.payer;if(!e)return null;const t=document.querySelector("#billing_phone")||void 0!==e.phone?{phone_type:"HOME",phone_number:{national_number:document.querySelector("#billing_phone")?document.querySelector("#billing_phone").value:e.phone.phone_number.national_number}}:null,r={email_address:document.querySelector("#billing_email")?document.querySelector("#billing_email").value:e.email_address,name:{surname:document.querySelector("#billing_last_name")?document.querySelector("#billing_last_name").value:e.name.surname,given_name:document.querySelector("#billing_first_name")?document.querySelector("#billing_first_name").value:e.name.given_name},address:{country_code:document.querySelector("#billing_country")?document.querySelector("#billing_country").value:e.address.country_code,address_line_1:document.querySelector("#billing_address_1")?document.querySelector("#billing_address_1").value:e.address.address_line_1,address_line_2:document.querySelector("#billing_address_2")?document.querySelector("#billing_address_2").value:e.address.address_line_2,admin_area_1:document.querySelector("#billing_state")?document.querySelector("#billing_state").value:e.address.admin_area_1,admin_area_2:document.querySelector("#billing_city")?document.querySelector("#billing_city").value:e.address.admin_area_2,postal_code:document.querySelector("#billing_postcode")?document.querySelector("#billing_postcode").value:e.address.postal_code}};return t&&(r.phone=t),r};var s=class{constructor(e,t){this.config=e,this.errorHandler=t}configuration(){return{createOrder:(e,t)=>{const r=o(),n=void 0!==this.config.bn_codes[this.config.context]?this.config.bn_codes[this.config.context]:"";return fetch(this.config.ajax.create_order.endpoint,{method:"POST",body:JSON.stringify({nonce:this.config.ajax.create_order.nonce,purchase_units:[],bn_code:n,payer:r,context:this.config.context})}).then((function(e){return e.json()})).then((function(e){if(!e.success)throw console.error(e),Error(e.data.message);return e.data.id}))},onApprove:a(this,this.errorHandler),onError:e=>{this.errorHandler.genericError()}}}};var i=class{constructor(e,t){this.gateway=e,this.renderer=t,this.actionHandler=null}init(){this.actionHandler=new s(PayPalCommerceGateway,new n(this.gateway.labels.error.generic)),this.render(),jQuery(document.body).on("wc_fragments_loaded wc_fragments_refreshed",()=>{this.render()})}shouldRender(){return null!==document.querySelector(this.gateway.button.mini_cart_wrapper)||null!==document.querySelector(this.gateway.hosted_fields.mini_cart_wrapper)}render(){this.shouldRender()&&this.renderer.render(this.gateway.button.mini_cart_wrapper,this.gateway.hosted_fields.mini_cart_wrapper,this.actionHandler.configuration())}};var c=class{constructor(e,t,r){this.id=e,this.quantity=t,this.variations=r}data(){return{id:this.id,quantity:this.quantity,variations:this.variations}}};var d=class{constructor(e,t){this.endpoint=e,this.nonce=t}update(e,t){return new Promise((r,n)=>{fetch(this.endpoint,{method:"POST",body:JSON.stringify({nonce:this.nonce,products:t})}).then(e=>e.json()).then(t=>{if(!t.success)return void n(t.data);const a=e(t.data);r(a)})})}};var u=class{constructor(e,t,r){this.element=e,this.showCallback=t,this.hideCallback=r,this.observer=null}init(){const e=()=>{this.element.classList.contains("disabled")?this.hideCallback():this.showCallback()};this.observer=new MutationObserver(e),this.observer.observe(this.element,{attributes:!0}),e()}disconnect(){this.observer.disconnect()}};var l=class{constructor(e,t,r,n,a,o){this.config=e,this.updateCart=t,this.showButtonCallback=r,this.hideButtonCallback=n,this.formElement=a,this.errorHandler=o}configuration(){if(this.hasVariations()){new u(this.formElement.querySelector(".single_add_to_cart_button"),this.showButtonCallback,this.hideButtonCallback).init()}return{createOrder:this.createOrder(),onApprove:a(this,this.errorHandler),onError:e=>{this.errorHandler.genericError()}}}createOrder(){var e=null;e=this.isGroupedProduct()?()=>{const e=[];return this.formElement.querySelectorAll('input[type="number"]').forEach(t=>{if(!t.value)return;const r=t.getAttribute("name").match(/quantity\[([\d]*)\]/);if(2!==r.length)return;const n=parseInt(r[1]),a=parseInt(t.value);e.push(new c(n,a,null))}),e}:()=>{const e=document.querySelector('[name="add-to-cart"]').value,t=document.querySelector('[name="quantity"]').value,r=this.variations();return[new c(e,t,r)]};return(t,r)=>{this.errorHandler.clear();return this.updateCart.update(e=>{const t=o(),r=void 0!==this.config.bn_codes[this.config.context]?this.config.bn_codes[this.config.context]:"";return fetch(this.config.ajax.create_order.endpoint,{method:"POST",body:JSON.stringify({nonce:this.config.ajax.create_order.nonce,purchase_units:e,payer:t,bn_code:r,context:this.config.context})}).then((function(e){return e.json()})).then((function(e){if(!e.success)throw console.error(e),Error(e.data.message);return e.data.id}))},e())}}variations(){if(!this.hasVariations())return null;return[...this.formElement.querySelectorAll("[name^='attribute_']")].map(e=>({value:e.value,name:e.name}))}hasVariations(){return this.formElement.classList.contains("variations_form")}isGroupedProduct(){return this.formElement.classList.contains("grouped_form")}};var h=class{constructor(e,t,r){this.gateway=e,this.renderer=t,this.messages=r}init(){this.shouldRender()?this.render():this.renderer.hideButtons(this.gateway.hosted_fields.wrapper)}shouldRender(){return null!==document.querySelector("form.cart")}render(){const e=new l(this.gateway,new d(this.gateway.ajax.change_cart.endpoint,this.gateway.ajax.change_cart.nonce),()=>{this.renderer.showButtons(this.gateway.button.wrapper),this.renderer.showButtons(this.gateway.hosted_fields.wrapper);let e="0";document.querySelector("form.cart ins .woocommerce-Price-amount")?e=document.querySelector("form.cart ins .woocommerce-Price-amount").innerText:document.querySelector("form.cart .woocommerce-Price-amount")&&(e=document.querySelector("form.cart .woocommerce-Price-amount").innerText);const t=parseInt(e.replace(/([^\d,\.\s]*)/g,""));this.messages.renderWithAmount(t)},()=>{this.renderer.hideButtons(this.gateway.button.wrapper),this.renderer.hideButtons(this.gateway.hosted_fields.wrapper)},document.querySelector("form.cart"),new n(this.gateway.labels.error.generic));this.renderer.render(this.gateway.button.wrapper,this.gateway.hosted_fields.wrapper,e.configuration())}};var p=class{constructor(e,t){this.gateway=e,this.renderer=t}init(){this.shouldRender()&&(this.render(),jQuery(document.body).on("updated_cart_totals updated_checkout",()=>{this.render()}))}shouldRender(){return null!==document.querySelector(this.gateway.button.wrapper)||null!==document.querySelector(this.gateway.hosted_fields.wrapper)}render(){const e=new s(PayPalCommerceGateway,new n(this.gateway.labels.error.generic));this.renderer.render(this.gateway.button.wrapper,this.gateway.hosted_fields.wrapper,e.configuration())}};var y=(e,t,r)=>(n,a)=>(r.block(),fetch(e.config.ajax.approve_order.endpoint,{method:"POST",body:JSON.stringify({nonce:e.config.ajax.approve_order.nonce,order_id:n.orderID})}).then(e=>e.json()).then(e=>{if(r.unblock(),!e.success){if(100===e.data.code?t.message(e.data.message):t.genericError(),void 0!==a&&void 0!==a.restart)return a.restart();throw new Error(e.data.message)}document.querySelector("#place_order").click()}));var m=class{constructor(e,t,r){this.config=e,this.errorHandler=t,this.spinner=r}configuration(){const e=this.spinner;return{createOrder:(t,r)=>{const n=o(),a=void 0!==this.config.bn_codes[this.config.context]?this.config.bn_codes[this.config.context]:"",s=this.errorHandler,i="checkout"===this.config.context?"form.checkout":"form#order_review",c=jQuery(i).serialize();return fetch(this.config.ajax.create_order.endpoint,{method:"POST",body:JSON.stringify({nonce:this.config.ajax.create_order.nonce,payer:n,bn_code:a,context:this.config.context,order_id:this.config.order_id,form:c})}).then((function(e){return e.json()})).then((function(t){if(!t.success)return e.unblock(),void s.message(t.data.message,!0);const r=document.createElement("input");return r.setAttribute("type","hidden"),r.setAttribute("name","ppcp-resume-order"),r.setAttribute("value",t.data.purchase_units[0].custom_id),document.querySelector(i).append(r),t.data.id}))},onApprove:y(this,this.errorHandler,this.spinner),onError:e=>{this.errorHandler.genericError()}}}};var g=class{constructor(e,t,r,n){this.gateway=e,this.renderer=t,this.messages=r,this.spinner=n}init(){this.render(),jQuery(document.body).on("updated_checkout",()=>{this.render()}),jQuery(document.body).on("updated_checkout payment_method_selected",()=>{this.switchBetweenPayPalandOrderButton()}),this.switchBetweenPayPalandOrderButton()}shouldRender(){return!document.querySelector(this.gateway.button.cancel_wrapper)&&(null!==document.querySelector(this.gateway.button.wrapper)||null!==document.querySelector(this.gateway.hosted_fields.wrapper))}render(){if(!this.shouldRender())return;document.querySelector(this.gateway.hosted_fields.wrapper+">div")&&document.querySelector(this.gateway.hosted_fields.wrapper+">div").setAttribute("style","");const e=new m(PayPalCommerceGateway,new n(this.gateway.labels.error.generic),this.spinner);this.renderer.render(this.gateway.button.wrapper,this.gateway.hosted_fields.wrapper,e.configuration())}switchBetweenPayPalandOrderButton(){const e=jQuery('input[name="payment_method"]:checked').val();"ppcp-gateway"!==e&&"ppcp-credit-card-gateway"!==e?(this.renderer.hideButtons(this.gateway.button.wrapper),this.renderer.hideButtons(this.gateway.messages.wrapper),this.renderer.hideButtons(this.gateway.hosted_fields.wrapper),jQuery("#place_order").show()):(jQuery("#place_order").hide(),"ppcp-gateway"===e&&(this.renderer.showButtons(this.gateway.button.wrapper),this.renderer.showButtons(this.gateway.messages.wrapper),this.messages.render(),this.renderer.hideButtons(this.gateway.hosted_fields.wrapper)),"ppcp-credit-card-gateway"===e&&(this.renderer.hideButtons(this.gateway.button.wrapper),this.renderer.hideButtons(this.gateway.messages.wrapper),this.renderer.showButtons(this.gateway.hosted_fields.wrapper)))}};var w=class{constructor(e,t,r){this.gateway=e,this.renderer=t,this.messages=r}init(){this.render(),jQuery(document.body).on("updated_checkout",()=>{this.render()}),jQuery(document.body).on("updated_checkout payment_method_selected",()=>{this.switchBetweenPayPalandOrderButton()}),this.switchBetweenPayPalandOrderButton()}shouldRender(){return!document.querySelector(this.gateway.button.cancel_wrapper)&&(null!==document.querySelector(this.gateway.button.wrapper)||null!==document.querySelector(this.gateway.hosted_fields.wrapper))}render(){if(!this.shouldRender())return;document.querySelector(this.gateway.hosted_fields.wrapper+">div")&&document.querySelector(this.gateway.hosted_fields.wrapper+">div").setAttribute("style","");const e=new m(PayPalCommerceGateway,new n(this.gateway.labels.error.generic));this.renderer.render(this.gateway.button.wrapper,this.gateway.hosted_fields.wrapper,e.configuration())}switchBetweenPayPalandOrderButton(){const e=jQuery('input[name="payment_method"]:checked').val();"ppcp-gateway"!==e&&"ppcp-credit-card-gateway"!==e?(this.renderer.hideButtons(this.gateway.button.wrapper),this.renderer.hideButtons(this.gateway.messages.wrapper),this.renderer.hideButtons(this.gateway.hosted_fields.wrapper),jQuery("#place_order").show()):(jQuery("#place_order").hide(),"ppcp-gateway"===e&&(this.renderer.showButtons(this.gateway.button.wrapper),this.renderer.showButtons(this.gateway.messages.wrapper),this.messages.render(),this.renderer.hideButtons(this.gateway.hosted_fields.wrapper)),"ppcp-credit-card-gateway"===e&&(this.renderer.hideButtons(this.gateway.button.wrapper),this.renderer.hideButtons(this.gateway.messages.wrapper),this.renderer.showButtons(this.gateway.hosted_fields.wrapper)))}};var f=class{constructor(e,t){this.defaultConfig=t,this.creditCardRenderer=e}render(e,t,r){this.renderButtons(e,r),this.creditCardRenderer.render(t,r)}renderButtons(e,t){if(!document.querySelector(e)||this.isAlreadyRendered(e)||void 0===paypal.Buttons)return;const r=e===this.defaultConfig.button.wrapper?this.defaultConfig.button.style:this.defaultConfig.button.mini_cart_style;paypal.Buttons({style:r,...t}).render(e)}isAlreadyRendered(e){return document.querySelector(e).hasChildNodes()}hideButtons(e){const t=document.querySelector(e);return!!t&&(t.style.display="none",!0)}showButtons(e){const t=document.querySelector(e);return!!t&&(t.style.display="block",!0)}};var _=e=>{const t=window.getComputedStyle(e),r=document.createElement("span");return r.setAttribute("id",e.id),Object.values(t).forEach(e=>{t[e]&&isNaN(e)&&r.style.setProperty(e,""+t[e])}),r};var b=class{constructor(e,t,r){this.defaultConfig=e,this.errorHandler=t,this.spinner=r,this.cardValid=!1}render(e,t){if("checkout"!==this.defaultConfig.context&&"pay-now"!==this.defaultConfig.context||null===e||null===document.querySelector(e))return;if(void 0===paypal.HostedFields||!paypal.HostedFields.isEligible()){const t=document.querySelector(e);return void t.parentNode.removeChild(t)}const r=document.querySelector(".payment_box.payment_method_ppcp-credit-card-gateway"),n=r.style.display;r.style.display="block";const a=document.querySelector("#ppcp-hide-dcc");a&&a.parentNode.removeChild(a);const o=document.querySelector("#ppcp-credit-card-gateway-card-number"),s=window.getComputedStyle(o);let i={};Object.values(s).forEach(e=>{s[e]&&(i[e]=""+s[e])});const c=_(o);o.parentNode.replaceChild(c,o);const d=document.querySelector("#ppcp-credit-card-gateway-card-expiry"),u=_(d);d.parentNode.replaceChild(u,d);const l=document.querySelector("#ppcp-credit-card-gateway-card-cvc"),h=_(l);l.parentNode.replaceChild(h,l),r.style.display=n;const p=".payment_box payment_method_ppcp-credit-card-gateway";this.defaultConfig.enforce_vault&&document.querySelector(p+" .ppcp-credit-card-vault")&&(document.querySelector(p+" .ppcp-credit-card-vault").checked=!0,document.querySelector(p+" .ppcp-credit-card-vault").setAttribute("disabled",!0)),paypal.HostedFields.render({createOrder:t.createOrder,styles:{input:i},fields:{number:{selector:"#ppcp-credit-card-gateway-card-number",placeholder:this.defaultConfig.hosted_fields.labels.credit_card_number},cvv:{selector:"#ppcp-credit-card-gateway-card-cvc",placeholder:this.defaultConfig.hosted_fields.labels.cvv},expirationDate:{selector:"#ppcp-credit-card-gateway-card-expiry",placeholder:this.defaultConfig.hosted_fields.labels.mm_yyyy}}}).then(r=>{const n=n=>{this.spinner.block(),n&&n.preventDefault(),this.errorHandler.clear();const a=r.getState();if(Object.keys(a.fields).every((function(e){return a.fields[e].isValid}))&&this.cardValid){let n=!!document.querySelector(e+" .ppcp-credit-card-vault")&&document.querySelector(e+" .ppcp-credit-card-vault").checked;n=this.defaultConfig.enforce_vault||n,r.submit({contingencies:["3D_SECURE"],vault:n}).then(e=>(e.orderID=e.orderId,this.spinner.unblock(),t.onApprove(e)))}else{this.spinner.unblock();const e=this.cardValid?this.defaultConfig.hosted_fields.labels.fields_not_valid:this.defaultConfig.hosted_fields.labels.card_not_supported;this.errorHandler.message(e)}};r.on("inputSubmitRequest",(function(){n(null)})),r.on("cardTypeChange",e=>{if(!e.cards.length)return void(this.cardValid=!1);const t=this.defaultConfig.hosted_fields.valid_cards;this.cardValid=-1!==t.indexOf(e.cards[0].type)}),document.querySelector(e+" button").addEventListener("click",n)}),document.querySelector("#payment_method_ppcp-credit-card-gateway").addEventListener("click",()=>{document.querySelector("label[for=ppcp-credit-card-gateway-card-number]").click()})}};const v=(e,t)=>{if(!e)return!1;if(e.user!==t)return!1;return!((new Date).getTime()>=1e3*e.expiration)};var S=(e,t)=>{const r=(e=>{const t=JSON.parse(sessionStorage.getItem("ppcp-data-client-id"));return v(t,e)?t.token:null})(t.user);if(r)return e.setAttribute("data-client-token",r),void document.body.append(e);fetch(t.endpoint,{method:"POST",body:JSON.stringify({nonce:t.nonce})}).then(e=>e.json()).then(r=>{v(r,t.user)&&((e=>{sessionStorage.setItem("ppcp-data-client-id",JSON.stringify(e))})(r),e.setAttribute("data-client-token",r.token),document.body.append(e))})};var q=class{constructor(e){this.config=e}render(){this.shouldRender()&&paypal.Messages({amount:this.config.amount,placement:this.config.placement,style:this.config.style}).render(this.config.wrapper)}renderWithAmount(e){if(!this.shouldRender())return;const t=document.createElement("div");t.setAttribute("id",this.config.wrapper.replace("#",""));const r=document.querySelector(this.config.wrapper).nextSibling;document.querySelector(this.config.wrapper).parentElement.removeChild(document.querySelector(this.config.wrapper)),r.parentElement.insertBefore(t,r),paypal.Messages({amount:e,placement:this.config.placement,style:this.config.style}).render(this.config.wrapper)}shouldRender(){return void 0!==paypal.Messages&&void 0!==this.config.wrapper&&!!document.querySelector(this.config.wrapper)}};var P=class{constructor(){this.target="form.woocommerce-checkout"}block(){jQuery(this.target).block({message:null,overlayCSS:{background:"#fff",opacity:.6}})}unblock(){jQuery(this.target).unblock()}};document.addEventListener("DOMContentLoaded",()=>{const e=document.createElement("script");e.addEventListener("load",e=>{(()=>{const e=new n(PayPalCommerceGateway.labels.error.generic),t=new P,r=new b(PayPalCommerceGateway,e,t),a=new f(r,PayPalCommerceGateway),o=new q(PayPalCommerceGateway.messages),s=PayPalCommerceGateway.context;if("mini-cart"===s||"product"===s){new i(PayPalCommerceGateway,a).init()}if("product"===s){new h(PayPalCommerceGateway,a,o).init()}if("cart"===s){new p(PayPalCommerceGateway,a).init()}if("checkout"===s){new g(PayPalCommerceGateway,a,o,t).init()}if("pay-now"===s){new w(PayPalCommerceGateway,a,o).init()}"checkout"!==s&&o.render()})()}),e.setAttribute("src",PayPalCommerceGateway.button.url),Object.entries(PayPalCommerceGateway.script_attributes).forEach(t=>{e.setAttribute(t[0],t[1])}),PayPalCommerceGateway.data_client_id.set_attribute?S(e,PayPalCommerceGateway.data_client_id):document.body.append(e)})}]);
2
  //# sourceMappingURL=button.js.map
1
+ !function(e){var t={};function r(n){if(t[n])return t[n].exports;var a=t[n]={i:n,l:!1,exports:{}};return e[n].call(a.exports,a,a.exports,r),a.l=!0,a.exports}r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)r.d(n,a,function(t){return e[t]}.bind(null,a));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=1)}([,function(e,t,r){"use strict";r.r(t);var n=class{constructor(e){this.genericErrorText=e,this.wrapper=document.querySelector(".woocommerce-notices-wrapper")}genericError(){this.wrapper.classList.contains("ppcp-persist")||(this.clear(),this.message(this.genericErrorText))}message(e,t=!1){this.wrapper.classList.add("woocommerce-error"),t?this.wrapper.classList.add("ppcp-persist"):this.wrapper.classList.remove("ppcp-persist"),this.wrapper.innerHTML=this.sanitize(e),jQuery.scroll_to_notices(jQuery(".woocommerce-notices-wrapper"))}sanitize(e){const t=document.createElement("textarea");return t.innerHTML=e,t.value.replace("Error: ","")}clear(){this.wrapper.classList.contains("woocommerce-error")&&(this.wrapper.classList.remove("woocommerce-error"),this.wrapper.innerText="")}};var a=(e,t)=>(r,n)=>fetch(e.config.ajax.approve_order.endpoint,{method:"POST",body:JSON.stringify({nonce:e.config.ajax.approve_order.nonce,order_id:r.orderID})}).then(e=>e.json()).then(r=>{if(!r.success)return t.genericError(),n.restart().catch(e=>{t.genericError()});location.href=e.config.redirect});const o=()=>{const e=PayPalCommerceGateway.payer;if(!e)return null;const t=document.querySelector("#billing_phone")||void 0!==e.phone?{phone_type:"HOME",phone_number:{national_number:document.querySelector("#billing_phone")?document.querySelector("#billing_phone").value:e.phone.phone_number.national_number}}:null,r={email_address:document.querySelector("#billing_email")?document.querySelector("#billing_email").value:e.email_address,name:{surname:document.querySelector("#billing_last_name")?document.querySelector("#billing_last_name").value:e.name.surname,given_name:document.querySelector("#billing_first_name")?document.querySelector("#billing_first_name").value:e.name.given_name},address:{country_code:document.querySelector("#billing_country")?document.querySelector("#billing_country").value:e.address.country_code,address_line_1:document.querySelector("#billing_address_1")?document.querySelector("#billing_address_1").value:e.address.address_line_1,address_line_2:document.querySelector("#billing_address_2")?document.querySelector("#billing_address_2").value:e.address.address_line_2,admin_area_1:document.querySelector("#billing_state")?document.querySelector("#billing_state").value:e.address.admin_area_1,admin_area_2:document.querySelector("#billing_city")?document.querySelector("#billing_city").value:e.address.admin_area_2,postal_code:document.querySelector("#billing_postcode")?document.querySelector("#billing_postcode").value:e.address.postal_code}};return t&&(r.phone=t),r};var s=class{constructor(e,t){this.config=e,this.errorHandler=t}configuration(){return{createOrder:(e,t)=>{const r=o(),n=void 0!==this.config.bn_codes[this.config.context]?this.config.bn_codes[this.config.context]:"";return fetch(this.config.ajax.create_order.endpoint,{method:"POST",body:JSON.stringify({nonce:this.config.ajax.create_order.nonce,purchase_units:[],bn_code:n,payer:r,context:this.config.context})}).then((function(e){return e.json()})).then((function(e){if(!e.success)throw console.error(e),Error(e.data.message);return e.data.id}))},onApprove:a(this,this.errorHandler),onError:e=>{this.errorHandler.genericError()}}}};var i=class{constructor(e,t){this.gateway=e,this.renderer=t,this.actionHandler=null}init(){this.actionHandler=new s(PayPalCommerceGateway,new n(this.gateway.labels.error.generic)),this.render(),jQuery(document.body).on("wc_fragments_loaded wc_fragments_refreshed",()=>{this.render()})}shouldRender(){return null!==document.querySelector(this.gateway.button.mini_cart_wrapper)||null!==document.querySelector(this.gateway.hosted_fields.mini_cart_wrapper)}render(){this.shouldRender()&&this.renderer.render(this.gateway.button.mini_cart_wrapper,this.gateway.hosted_fields.mini_cart_wrapper,this.actionHandler.configuration())}};var c=class{constructor(e,t,r){this.id=e,this.quantity=t,this.variations=r}data(){return{id:this.id,quantity:this.quantity,variations:this.variations}}};var d=class{constructor(e,t){this.endpoint=e,this.nonce=t}update(e,t){return new Promise((r,n)=>{fetch(this.endpoint,{method:"POST",body:JSON.stringify({nonce:this.nonce,products:t})}).then(e=>e.json()).then(t=>{if(!t.success)return void n(t.data);const a=e(t.data);r(a)})})}};var u=class{constructor(e,t,r){this.element=e,this.showCallback=t,this.hideCallback=r,this.observer=null}init(){const e=()=>{this.element.classList.contains("disabled")?this.hideCallback():this.showCallback()};this.observer=new MutationObserver(e),this.observer.observe(this.element,{attributes:!0}),e()}disconnect(){this.observer.disconnect()}};var l=class{constructor(e,t,r,n,a,o){this.config=e,this.updateCart=t,this.showButtonCallback=r,this.hideButtonCallback=n,this.formElement=a,this.errorHandler=o}configuration(){if(this.hasVariations()){new u(this.formElement.querySelector(".single_add_to_cart_button"),this.showButtonCallback,this.hideButtonCallback).init()}return{createOrder:this.createOrder(),onApprove:a(this,this.errorHandler),onError:e=>{this.errorHandler.genericError()}}}createOrder(){var e=null;e=this.isGroupedProduct()?()=>{const e=[];return this.formElement.querySelectorAll('input[type="number"]').forEach(t=>{if(!t.value)return;const r=t.getAttribute("name").match(/quantity\[([\d]*)\]/);if(2!==r.length)return;const n=parseInt(r[1]),a=parseInt(t.value);e.push(new c(n,a,null))}),e}:()=>{const e=document.querySelector('[name="add-to-cart"]').value,t=document.querySelector('[name="quantity"]').value,r=this.variations();return[new c(e,t,r)]};return(t,r)=>{this.errorHandler.clear();return this.updateCart.update(e=>{const t=o(),r=void 0!==this.config.bn_codes[this.config.context]?this.config.bn_codes[this.config.context]:"";return fetch(this.config.ajax.create_order.endpoint,{method:"POST",body:JSON.stringify({nonce:this.config.ajax.create_order.nonce,purchase_units:e,payer:t,bn_code:r,context:this.config.context})}).then((function(e){return e.json()})).then((function(e){if(!e.success)throw console.error(e),Error(e.data.message);return e.data.id}))},e())}}variations(){if(!this.hasVariations())return null;return[...this.formElement.querySelectorAll("[name^='attribute_']")].map(e=>({value:e.value,name:e.name}))}hasVariations(){return this.formElement.classList.contains("variations_form")}isGroupedProduct(){return this.formElement.classList.contains("grouped_form")}};var h=class{constructor(e,t,r){this.gateway=e,this.renderer=t,this.messages=r}init(){this.shouldRender()?this.render():this.renderer.hideButtons(this.gateway.hosted_fields.wrapper)}shouldRender(){return null!==document.querySelector("form.cart")}render(){const e=new l(this.gateway,new d(this.gateway.ajax.change_cart.endpoint,this.gateway.ajax.change_cart.nonce),()=>{this.renderer.showButtons(this.gateway.button.wrapper),this.renderer.showButtons(this.gateway.hosted_fields.wrapper);let e="0";document.querySelector("form.cart ins .woocommerce-Price-amount")?e=document.querySelector("form.cart ins .woocommerce-Price-amount").innerText:document.querySelector("form.cart .woocommerce-Price-amount")&&(e=document.querySelector("form.cart .woocommerce-Price-amount").innerText);const t=parseInt(e.replace(/([^\d,\.\s]*)/g,""));this.messages.renderWithAmount(t)},()=>{this.renderer.hideButtons(this.gateway.button.wrapper),this.renderer.hideButtons(this.gateway.hosted_fields.wrapper)},document.querySelector("form.cart"),new n(this.gateway.labels.error.generic));this.renderer.render(this.gateway.button.wrapper,this.gateway.hosted_fields.wrapper,e.configuration())}};var p=class{constructor(e,t){this.gateway=e,this.renderer=t}init(){this.shouldRender()&&(this.render(),jQuery(document.body).on("updated_cart_totals updated_checkout",()=>{this.render()}))}shouldRender(){return null!==document.querySelector(this.gateway.button.wrapper)||null!==document.querySelector(this.gateway.hosted_fields.wrapper)}render(){const e=new s(PayPalCommerceGateway,new n(this.gateway.labels.error.generic));this.renderer.render(this.gateway.button.wrapper,this.gateway.hosted_fields.wrapper,e.configuration())}};var y=(e,t,r)=>(n,a)=>(r.block(),fetch(e.config.ajax.approve_order.endpoint,{method:"POST",body:JSON.stringify({nonce:e.config.ajax.approve_order.nonce,order_id:n.orderID})}).then(e=>e.json()).then(e=>{if(r.unblock(),!e.success){if(100===e.data.code?t.message(e.data.message):t.genericError(),void 0!==a&&void 0!==a.restart)return a.restart();throw new Error(e.data.message)}document.querySelector("#place_order").click()}));var m=class{constructor(e,t,r){this.config=e,this.errorHandler=t,this.spinner=r}configuration(){const e=this.spinner;return{createOrder:(t,r)=>{const n=o(),a=void 0!==this.config.bn_codes[this.config.context]?this.config.bn_codes[this.config.context]:"",s=this.errorHandler,i="checkout"===this.config.context?"form.checkout":"form#order_review";e.setTarget(i),e.block();const c=jQuery(i).serialize();return fetch(this.config.ajax.create_order.endpoint,{method:"POST",body:JSON.stringify({nonce:this.config.ajax.create_order.nonce,payer:n,bn_code:a,context:this.config.context,order_id:this.config.order_id,form:c})}).then((function(e){return e.json()})).then((function(t){if(!t.success)return e.unblock(),void s.message(t.data.message,!0);const r=document.createElement("input");return r.setAttribute("type","hidden"),r.setAttribute("name","ppcp-resume-order"),r.setAttribute("value",t.data.purchase_units[0].custom_id),document.querySelector(i).append(r),t.data.id}))},onApprove:y(this,this.errorHandler,this.spinner),onError:e=>{this.errorHandler.genericError()}}}};var g=class{constructor(e,t,r,n){this.gateway=e,this.renderer=t,this.messages=r,this.spinner=n}init(){this.render(),jQuery(document.body).on("updated_checkout",()=>{this.render()}),jQuery(document.body).on("updated_checkout payment_method_selected",()=>{this.switchBetweenPayPalandOrderButton()}),this.switchBetweenPayPalandOrderButton()}shouldRender(){return!document.querySelector(this.gateway.button.cancel_wrapper)&&(null!==document.querySelector(this.gateway.button.wrapper)||null!==document.querySelector(this.gateway.hosted_fields.wrapper))}render(){if(!this.shouldRender())return;document.querySelector(this.gateway.hosted_fields.wrapper+">div")&&document.querySelector(this.gateway.hosted_fields.wrapper+">div").setAttribute("style","");const e=new m(PayPalCommerceGateway,new n(this.gateway.labels.error.generic),this.spinner);this.renderer.render(this.gateway.button.wrapper,this.gateway.hosted_fields.wrapper,e.configuration())}switchBetweenPayPalandOrderButton(){const e=jQuery('input[name="payment_method"]:checked').val();"ppcp-gateway"!==e&&"ppcp-credit-card-gateway"!==e?(this.renderer.hideButtons(this.gateway.button.wrapper),this.renderer.hideButtons(this.gateway.messages.wrapper),this.renderer.hideButtons(this.gateway.hosted_fields.wrapper),jQuery("#place_order").show()):(jQuery("#place_order").hide(),"ppcp-gateway"===e&&(this.renderer.showButtons(this.gateway.button.wrapper),this.renderer.showButtons(this.gateway.messages.wrapper),this.messages.render(),this.renderer.hideButtons(this.gateway.hosted_fields.wrapper)),"ppcp-credit-card-gateway"===e&&(this.renderer.hideButtons(this.gateway.button.wrapper),this.renderer.hideButtons(this.gateway.messages.wrapper),this.renderer.showButtons(this.gateway.hosted_fields.wrapper)))}};var w=class{constructor(e,t,r,n){this.gateway=e,this.renderer=t,this.messages=r,this.spinner=n}init(){this.render(),jQuery(document.body).on("updated_checkout",()=>{this.render()}),jQuery(document.body).on("updated_checkout payment_method_selected",()=>{this.switchBetweenPayPalandOrderButton()}),this.switchBetweenPayPalandOrderButton()}shouldRender(){return!document.querySelector(this.gateway.button.cancel_wrapper)&&(null!==document.querySelector(this.gateway.button.wrapper)||null!==document.querySelector(this.gateway.hosted_fields.wrapper))}render(){if(!this.shouldRender())return;document.querySelector(this.gateway.hosted_fields.wrapper+">div")&&document.querySelector(this.gateway.hosted_fields.wrapper+">div").setAttribute("style","");const e=new m(PayPalCommerceGateway,new n(this.gateway.labels.error.generic),this.spinner);this.renderer.render(this.gateway.button.wrapper,this.gateway.hosted_fields.wrapper,e.configuration())}switchBetweenPayPalandOrderButton(){const e=jQuery('input[name="payment_method"]:checked').val();"ppcp-gateway"!==e&&"ppcp-credit-card-gateway"!==e?(this.renderer.hideButtons(this.gateway.button.wrapper),this.renderer.hideButtons(this.gateway.messages.wrapper),this.renderer.hideButtons(this.gateway.hosted_fields.wrapper),jQuery("#place_order").show()):(jQuery("#place_order").hide(),"ppcp-gateway"===e&&(this.renderer.showButtons(this.gateway.button.wrapper),this.renderer.showButtons(this.gateway.messages.wrapper),this.messages.render(),this.renderer.hideButtons(this.gateway.hosted_fields.wrapper)),"ppcp-credit-card-gateway"===e&&(this.renderer.hideButtons(this.gateway.button.wrapper),this.renderer.hideButtons(this.gateway.messages.wrapper),this.renderer.showButtons(this.gateway.hosted_fields.wrapper)))}};var f=class{constructor(e,t){this.defaultConfig=t,this.creditCardRenderer=e}render(e,t,r){this.renderButtons(e,r),this.creditCardRenderer.render(t,r)}renderButtons(e,t){if(!document.querySelector(e)||this.isAlreadyRendered(e)||void 0===paypal.Buttons)return;const r=e===this.defaultConfig.button.wrapper?this.defaultConfig.button.style:this.defaultConfig.button.mini_cart_style;paypal.Buttons({style:r,...t}).render(e)}isAlreadyRendered(e){return document.querySelector(e).hasChildNodes()}hideButtons(e){const t=document.querySelector(e);return!!t&&(t.style.display="none",!0)}showButtons(e){const t=document.querySelector(e);return!!t&&(t.style.display="block",!0)}};var _=e=>{const t=window.getComputedStyle(e),r=document.createElement("span");return r.setAttribute("id",e.id),Object.values(t).forEach(e=>{t[e]&&isNaN(e)&&r.style.setProperty(e,""+t[e])}),r};var b=class{constructor(e,t,r){this.defaultConfig=e,this.errorHandler=t,this.spinner=r,this.cardValid=!1}render(e,t){if("checkout"!==this.defaultConfig.context&&"pay-now"!==this.defaultConfig.context||null===e||null===document.querySelector(e))return;if(void 0===paypal.HostedFields||!paypal.HostedFields.isEligible()){const t=document.querySelector(e);return void t.parentNode.removeChild(t)}const r=document.querySelector(".payment_box.payment_method_ppcp-credit-card-gateway"),n=r.style.display;r.style.display="block";const a=document.querySelector("#ppcp-hide-dcc");a&&a.parentNode.removeChild(a);const o=document.querySelector("#ppcp-credit-card-gateway-card-number"),s=window.getComputedStyle(o);let i={};Object.values(s).forEach(e=>{s[e]&&(i[e]=""+s[e])});const c=_(o);o.parentNode.replaceChild(c,o);const d=document.querySelector("#ppcp-credit-card-gateway-card-expiry"),u=_(d);d.parentNode.replaceChild(u,d);const l=document.querySelector("#ppcp-credit-card-gateway-card-cvc"),h=_(l);l.parentNode.replaceChild(h,l),r.style.display=n;const p=".payment_box payment_method_ppcp-credit-card-gateway";this.defaultConfig.enforce_vault&&document.querySelector(p+" .ppcp-credit-card-vault")&&(document.querySelector(p+" .ppcp-credit-card-vault").checked=!0,document.querySelector(p+" .ppcp-credit-card-vault").setAttribute("disabled",!0)),paypal.HostedFields.render({createOrder:t.createOrder,styles:{input:i},fields:{number:{selector:"#ppcp-credit-card-gateway-card-number",placeholder:this.defaultConfig.hosted_fields.labels.credit_card_number},cvv:{selector:"#ppcp-credit-card-gateway-card-cvc",placeholder:this.defaultConfig.hosted_fields.labels.cvv},expirationDate:{selector:"#ppcp-credit-card-gateway-card-expiry",placeholder:this.defaultConfig.hosted_fields.labels.mm_yyyy}}}).then(r=>{const n=n=>{this.spinner.block(),n&&n.preventDefault(),this.errorHandler.clear();const a=r.getState();if(Object.keys(a.fields).every((function(e){return a.fields[e].isValid}))&&this.cardValid){let n=!!document.querySelector(e+" .ppcp-credit-card-vault")&&document.querySelector(e+" .ppcp-credit-card-vault").checked;n=this.defaultConfig.enforce_vault||n,r.submit({contingencies:["3D_SECURE"],vault:n}).then(e=>(e.orderID=e.orderId,this.spinner.unblock(),t.onApprove(e)))}else{this.spinner.unblock();const e=this.cardValid?this.defaultConfig.hosted_fields.labels.fields_not_valid:this.defaultConfig.hosted_fields.labels.card_not_supported;this.errorHandler.message(e)}};r.on("inputSubmitRequest",(function(){n(null)})),r.on("cardTypeChange",e=>{if(!e.cards.length)return void(this.cardValid=!1);const t=this.defaultConfig.hosted_fields.valid_cards;this.cardValid=-1!==t.indexOf(e.cards[0].type)}),document.querySelector(e+" button").addEventListener("click",n)}),document.querySelector("#payment_method_ppcp-credit-card-gateway").addEventListener("click",()=>{document.querySelector("label[for=ppcp-credit-card-gateway-card-number]").click()})}};const v=(e,t)=>{if(!e)return!1;if(e.user!==t)return!1;return!((new Date).getTime()>=1e3*e.expiration)};var S=(e,t)=>{const r=(e=>{const t=JSON.parse(sessionStorage.getItem("ppcp-data-client-id"));return v(t,e)?t.token:null})(t.user);if(r)return e.setAttribute("data-client-token",r),void document.body.append(e);fetch(t.endpoint,{method:"POST",body:JSON.stringify({nonce:t.nonce})}).then(e=>e.json()).then(r=>{v(r,t.user)&&((e=>{sessionStorage.setItem("ppcp-data-client-id",JSON.stringify(e))})(r),e.setAttribute("data-client-token",r.token),document.body.append(e))})};var q=class{constructor(e){this.config=e}render(){this.shouldRender()&&paypal.Messages({amount:this.config.amount,placement:this.config.placement,style:this.config.style}).render(this.config.wrapper)}renderWithAmount(e){if(!this.shouldRender())return;const t=document.createElement("div");t.setAttribute("id",this.config.wrapper.replace("#",""));const r=document.querySelector(this.config.wrapper).nextSibling;document.querySelector(this.config.wrapper).parentElement.removeChild(document.querySelector(this.config.wrapper)),r.parentElement.insertBefore(t,r),paypal.Messages({amount:e,placement:this.config.placement,style:this.config.style}).render(this.config.wrapper)}shouldRender(){return void 0!==paypal.Messages&&void 0!==this.config.wrapper&&!!document.querySelector(this.config.wrapper)}};var P=class{constructor(){this.target="form.woocommerce-checkout"}setTarget(e){this.target=e}block(){jQuery(this.target).block({message:null,overlayCSS:{background:"#fff",opacity:.6}})}unblock(){jQuery(this.target).unblock()}};document.addEventListener("DOMContentLoaded",()=>{const e=document.createElement("script");e.addEventListener("load",e=>{(()=>{const e=new n(PayPalCommerceGateway.labels.error.generic),t=new P,r=new b(PayPalCommerceGateway,e,t),a=new f(r,PayPalCommerceGateway),o=new q(PayPalCommerceGateway.messages),s=PayPalCommerceGateway.context;if("mini-cart"===s||"product"===s){new i(PayPalCommerceGateway,a).init()}if("product"===s){new h(PayPalCommerceGateway,a,o).init()}if("cart"===s){new p(PayPalCommerceGateway,a).init()}if("checkout"===s){new g(PayPalCommerceGateway,a,o,t).init()}if("pay-now"===s){new w(PayPalCommerceGateway,a,o,t).init()}"checkout"!==s&&o.render()})()}),e.setAttribute("src",PayPalCommerceGateway.button.url),Object.entries(PayPalCommerceGateway.script_attributes).forEach(t=>{e.setAttribute(t[0],t[1])}),PayPalCommerceGateway.data_client_id.set_attribute?S(e,PayPalCommerceGateway.data_client_id):document.body.append(e)})}]);
2
  //# sourceMappingURL=button.js.map
modules/ppcp-button/assets/js/button.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./resources/js/modules/ErrorHandler.js","webpack:///./resources/js/modules/OnApproveHandler/onApproveForContinue.js","webpack:///./resources/js/modules/Helper/PayerData.js","webpack:///./resources/js/modules/ActionHandler/CartActionHandler.js","webpack:///./resources/js/modules/ContextBootstrap/MiniCartBootstap.js","webpack:///./resources/js/modules/Entity/Product.js","webpack:///./resources/js/modules/Helper/UpdateCart.js","webpack:///./resources/js/modules/Helper/ButtonsToggleListener.js","webpack:///./resources/js/modules/ActionHandler/SingleProductActionHandler.js","webpack:///./resources/js/modules/ContextBootstrap/SingleProductBootstap.js","webpack:///./resources/js/modules/ContextBootstrap/CartBootstap.js","webpack:///./resources/js/modules/OnApproveHandler/onApproveForPayNow.js","webpack:///./resources/js/modules/ActionHandler/CheckoutActionHandler.js","webpack:///./resources/js/modules/ContextBootstrap/CheckoutBootstap.js","webpack:///./resources/js/modules/ContextBootstrap/PayNowBootstrap.js","webpack:///./resources/js/modules/Renderer/Renderer.js","webpack:///./resources/js/modules/Helper/DccInputFactory.js","webpack:///./resources/js/modules/Renderer/CreditCardRenderer.js","webpack:///./resources/js/modules/DataClientIdAttributeHandler.js","webpack:///./resources/js/modules/Renderer/MessageRenderer.js","webpack:///./resources/js/modules/Helper/Spinner.js","webpack:///./resources/js/button.js"],"names":["installedModules","__webpack_require__","moduleId","exports","module","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","ErrorHandler","constructor","genericErrorText","this","wrapper","document","querySelector","genericError","classList","contains","clear","message","text","persist","add","remove","innerHTML","sanitize","jQuery","scroll_to_notices","textarea","createElement","replace","innerText","onApprove","context","errorHandler","data","actions","fetch","config","ajax","approve_order","endpoint","method","body","JSON","stringify","nonce","order_id","orderID","then","res","json","success","restart","catch","err","location","href","redirect","payerData","payer","PayPalCommerceGateway","phone","phone_type","phone_number","national_number","email_address","surname","given_name","address","country_code","address_line_1","address_line_2","admin_area_1","admin_area_2","postal_code","CartActionHandler","configuration","createOrder","bnCode","bn_codes","create_order","purchase_units","bn_code","console","error","Error","id","onError","MiniCartBootstap","gateway","renderer","actionHandler","init","labels","generic","render","on","shouldRender","button","mini_cart_wrapper","hosted_fields","Product","quantity","variations","UpdateCart","update","onResolve","products","Promise","resolve","reject","result","resolved","ButtonsToggleListener","element","showCallback","hideCallback","observer","callback","MutationObserver","observe","attributes","disconnect","SingleProductActionHandler","updateCart","showButtonCallback","hideButtonCallback","formElement","hasVariations","getProducts","isGroupedProduct","querySelectorAll","forEach","elementName","getAttribute","match","length","parseInt","push","qty","map","SingleProductBootstap","messages","hideButtons","change_cart","showButtons","priceText","amount","renderWithAmount","CartBootstrap","spinner","block","unblock","code","click","CheckoutActionHandler","formSelector","formValues","serialize","form","input","setAttribute","custom_id","append","CheckoutBootstap","switchBetweenPayPalandOrderButton","cancel_wrapper","currentPaymentMethod","val","show","hide","PayNowBootstrap","Renderer","creditCardRenderer","defaultConfig","hostedFieldsWrapper","contextConfig","renderButtons","isAlreadyRendered","paypal","Buttons","style","mini_cart_style","hasChildNodes","domElement","display","dccInputFactory","original","styles","window","getComputedStyle","newElement","values","prop","isNaN","setProperty","CreditCardRenderer","cardValid","HostedFields","isEligible","wrapperElement","parentNode","removeChild","gateWayBox","oldDisplayStyle","hideDccGateway","cardNumberField","stylesRaw","cardNumber","replaceChild","cardExpiryField","cardExpiry","cardCodeField","cardCode","formWrapper","enforce_vault","checked","fields","number","selector","placeholder","credit_card_number","cvv","expirationDate","mm_yyyy","hostedFields","submitEvent","event","preventDefault","state","getState","keys","every","isValid","vault","submit","contingencies","payload","orderId","fields_not_valid","card_not_supported","cards","validCards","valid_cards","indexOf","type","addEventListener","validateToken","token","user","Date","getTime","expiration","dataClientIdAttributeHandler","script","parse","sessionStorage","getItem","storedTokenForUser","setItem","storeToken","MessageRenderer","Messages","placement","newWrapper","sibling","nextSibling","parentElement","insertBefore","Spinner","target","overlayCSS","background","opacity","messageRenderer","bootstrap","url","entries","script_attributes","keyValue","data_client_id","set_attribute"],"mappings":"aACE,IAAIA,EAAmB,GAGvB,SAASC,EAAoBC,GAG5B,GAAGF,EAAiBE,GACnB,OAAOF,EAAiBE,GAAUC,QAGnC,IAAIC,EAASJ,EAAiBE,GAAY,CACzCG,EAAGH,EACHI,GAAG,EACHH,QAAS,IAUV,OANAI,EAAQ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GtB,GAAgB,YAAZ5D,EAAuB,CACQ,IAAI6G,EAC/BjF,sBACA8B,EACAwL,GAGmBtL,OAG3B,GAAgB,SAAZ5D,EAAoB,CACE,IAAIqH,EACtBzF,sBACA8B,GAGUE,OAGlB,GAAgB,aAAZ5D,EAAwB,CACC,IAAIoI,EACzBxG,sBACA8B,EACAwL,EACA5H,GAGa1D,OAGrB,GAAgB,YAAZ5D,EAAwB,CACA,IAAI2I,EACxB/G,sBACA8B,EACAwL,GAEYtL,OAGJ,aAAZ5D,GACAkP,EAAgBnL,UAaZoL,KAEJrB,EAAO7F,aAAa,MAAOrG,sBAAsBsC,OAAOkL,KACxDnS,OAAOoS,QAAQzN,sBAAsB0N,mBAAmBlJ,QACnDmJ,IACGzB,EAAO7F,aAAasH,EAAS,GAAIA,EAAS,MAI9C3N,sBAAsB4N,eAAeC,cACrC5B,EAA6BC,EAAQlM,sBAAsB4N,gBAI/D5Q,SAAS8B,KAAKyH,OAAO2F","file":"js/button.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 1);\n","class ErrorHandler {\n\n constructor(genericErrorText)\n {\n this.genericErrorText = genericErrorText;\n this.wrapper = document.querySelector('.woocommerce-notices-wrapper');\n }\n\n genericError() {\n if (this.wrapper.classList.contains('ppcp-persist')) {\n return;\n }\n this.clear();\n this.message(this.genericErrorText)\n }\n\n message(text, persist = false)\n {\n this.wrapper.classList.add('woocommerce-error');\n if (persist) {\n this.wrapper.classList.add('ppcp-persist');\n } else {\n this.wrapper.classList.remove('ppcp-persist');\n }\n this.wrapper.innerHTML = this.sanitize(text);\n jQuery.scroll_to_notices(jQuery('.woocommerce-notices-wrapper'))\n }\n\n sanitize(text)\n {\n const textarea = document.createElement('textarea');\n textarea.innerHTML = text;\n return textarea.value.replace('Error: ', '');\n }\n\n clear()\n {\n if (! this.wrapper.classList.contains('woocommerce-error')) {\n return;\n }\n this.wrapper.classList.remove('woocommerce-error');\n this.wrapper.innerText = '';\n }\n}\n\nexport default ErrorHandler;\n","const onApprove = (context, errorHandler) => {\n return (data, actions) => {\n return fetch(context.config.ajax.approve_order.endpoint, {\n method: 'POST',\n body: JSON.stringify({\n nonce: context.config.ajax.approve_order.nonce,\n order_id:data.orderID\n })\n }).then((res)=>{\n return res.json();\n }).then((data)=>{\n if (!data.success) {\n errorHandler.genericError();\n return actions.restart().catch(err => {\n errorHandler.genericError();\n });;\n }\n location.href = context.config.redirect;\n });\n\n }\n}\n\nexport default onApprove;\n","export const payerData = () => {\n const payer = PayPalCommerceGateway.payer;\n if (! payer) {\n return null;\n }\n\n const phone = (document.querySelector('#billing_phone') || typeof payer.phone !== 'undefined') ?\n {\n phone_type:\"HOME\",\n phone_number:{\n national_number : (document.querySelector('#billing_phone')) ? document.querySelector('#billing_phone').value : payer.phone.phone_number.national_number\n }\n } : null;\n const payerData = {\n email_address:(document.querySelector('#billing_email')) ? document.querySelector('#billing_email').value : payer.email_address,\n name : {\n surname: (document.querySelector('#billing_last_name')) ? document.querySelector('#billing_last_name').value : payer.name.surname,\n given_name: (document.querySelector('#billing_first_name')) ? document.querySelector('#billing_first_name').value : payer.name.given_name\n },\n address : {\n country_code : (document.querySelector('#billing_country')) ? document.querySelector('#billing_country').value : payer.address.country_code,\n address_line_1 : (document.querySelector('#billing_address_1')) ? document.querySelector('#billing_address_1').value : payer.address.address_line_1,\n address_line_2 : (document.querySelector('#billing_address_2')) ? document.querySelector('#billing_address_2').value : payer.address.address_line_2,\n admin_area_1 : (document.querySelector('#billing_state')) ? document.querySelector('#billing_state').value : payer.address.admin_area_1,\n admin_area_2 : (document.querySelector('#billing_city')) ? document.querySelector('#billing_city').value : payer.address.admin_area_2,\n postal_code : (document.querySelector('#billing_postcode')) ? document.querySelector('#billing_postcode').value : payer.address.postal_code\n }\n };\n\n if (phone) {\n payerData.phone = phone;\n }\n return payerData;\n}\n","import onApprove from '../OnApproveHandler/onApproveForContinue.js';\nimport {payerData} from \"../Helper/PayerData\";\n\nclass CartActionHandler {\n\n constructor(config, errorHandler) {\n this.config = config;\n this.errorHandler = errorHandler;\n }\n\n configuration() {\n const createOrder = (data, actions) => {\n const payer = payerData();\n const bnCode = typeof this.config.bn_codes[this.config.context] !== 'undefined' ?\n this.config.bn_codes[this.config.context] : '';\n return fetch(this.config.ajax.create_order.endpoint, {\n method: 'POST',\n body: JSON.stringify({\n nonce: this.config.ajax.create_order.nonce,\n purchase_units: [],\n bn_code:bnCode,\n payer,\n context:this.config.context\n }),\n }).then(function(res) {\n return res.json();\n }).then(function(data) {\n if (!data.success) {\n console.error(data);\n throw Error(data.data.message);\n }\n return data.data.id;\n });\n };\n\n return {\n createOrder,\n onApprove: onApprove(this, this.errorHandler),\n onError: (error) => {\n this.errorHandler.genericError();\n }\n };\n }\n}\n\nexport default CartActionHandler;\n","import ErrorHandler from '../ErrorHandler';\nimport CartActionHandler from '../ActionHandler/CartActionHandler';\n\nclass MiniCartBootstap {\n constructor(gateway, renderer) {\n this.gateway = gateway;\n this.renderer = renderer;\n this.actionHandler = null;\n }\n\n init() {\n\n this.actionHandler = new CartActionHandler(\n PayPalCommerceGateway,\n new ErrorHandler(this.gateway.labels.error.generic),\n );\n this.render();\n\n jQuery(document.body).on('wc_fragments_loaded wc_fragments_refreshed', () => {\n this.render();\n });\n }\n\n shouldRender() {\n return document.querySelector(this.gateway.button.mini_cart_wrapper) !==\n null || document.querySelector(this.gateway.hosted_fields.mini_cart_wrapper) !==\n null;\n }\n\n render() {\n if (!this.shouldRender()) {\n return;\n }\n\n this.renderer.render(\n this.gateway.button.mini_cart_wrapper,\n this.gateway.hosted_fields.mini_cart_wrapper,\n this.actionHandler.configuration()\n );\n }\n}\n\nexport default MiniCartBootstap;","class Product {\n\n constructor(id, quantity, variations) {\n this.id = id;\n this.quantity = quantity;\n this.variations = variations;\n }\n\n data() {\n return {\n id:this.id,\n quantity:this.quantity,\n variations:this.variations\n }\n }\n}\n\nexport default Product;","import Product from \"../Entity/Product\";\nclass UpdateCart {\n\n constructor(endpoint, nonce)\n {\n this.endpoint = endpoint;\n this.nonce = nonce;\n }\n\n /**\n *\n * @param onResolve\n * @param {Product[]} products\n * @returns {Promise<unknown>}\n */\n update(onResolve, products)\n {\n return new Promise((resolve, reject) => {\n fetch(\n this.endpoint,\n {\n method: 'POST',\n body: JSON.stringify({\n nonce: this.nonce,\n products,\n })\n }\n ).then(\n (result) => {\n return result.json();\n }\n ).then((result) => {\n if (! result.success) {\n reject(result.data);\n return;\n }\n\n const resolved = onResolve(result.data);\n resolve(resolved);\n })\n });\n }\n}\n\nexport default UpdateCart;","/**\n * When you can't add something to the cart, the PayPal buttons should not show.\n * Therefore we listen for changes on the add to cart button and show/hide the buttons accordingly.\n */\n\nclass ButtonsToggleListener {\n constructor(element, showCallback, hideCallback)\n {\n this.element = element;\n this.showCallback = showCallback;\n this.hideCallback = hideCallback;\n this.observer = null;\n }\n\n init()\n {\n const config = { attributes : true };\n const callback = () => {\n if (this.element.classList.contains('disabled')) {\n this.hideCallback();\n return;\n }\n this.showCallback();\n }\n this.observer = new MutationObserver(callback);\n this.observer.observe(this.element, config);\n callback();\n }\n\n disconnect()\n {\n this.observer.disconnect();\n }\n}\n\nexport default ButtonsToggleListener;","import ButtonsToggleListener from '../Helper/ButtonsToggleListener';\nimport Product from '../Entity/Product';\nimport onApprove from '../OnApproveHandler/onApproveForContinue';\nimport {payerData} from \"../Helper/PayerData\";\n\nclass SingleProductActionHandler {\n\n constructor(\n config,\n updateCart,\n showButtonCallback,\n hideButtonCallback,\n formElement,\n errorHandler\n ) {\n this.config = config;\n this.updateCart = updateCart;\n this.showButtonCallback = showButtonCallback;\n this.hideButtonCallback = hideButtonCallback;\n this.formElement = formElement;\n this.errorHandler = errorHandler;\n }\n\n configuration()\n {\n\n if ( this.hasVariations() ) {\n const observer = new ButtonsToggleListener(\n this.formElement.querySelector('.single_add_to_cart_button'),\n this.showButtonCallback,\n this.hideButtonCallback\n );\n observer.init();\n }\n\n return {\n createOrder: this.createOrder(),\n onApprove: onApprove(this, this.errorHandler),\n onError: (error) => {\n this.errorHandler.genericError();\n }\n }\n }\n\n createOrder()\n {\n var getProducts = null;\n if (! this.isGroupedProduct() ) {\n getProducts = () => {\n const id = document.querySelector('[name=\"add-to-cart\"]').value;\n const qty = document.querySelector('[name=\"quantity\"]').value;\n const variations = this.variations();\n return [new Product(id, qty, variations)];\n }\n } else {\n getProducts = () => {\n const products = [];\n this.formElement.querySelectorAll('input[type=\"number\"]').forEach((element) => {\n if (! element.value) {\n return;\n }\n const elementName = element.getAttribute('name').match(/quantity\\[([\\d]*)\\]/);\n if (elementName.length !== 2) {\n return;\n }\n const id = parseInt(elementName[1]);\n const quantity = parseInt(element.value);\n products.push(new Product(id, quantity, null));\n })\n return products;\n }\n }\n const createOrder = (data, actions) => {\n this.errorHandler.clear();\n\n const onResolve = (purchase_units) => {\n const payer = payerData();\n const bnCode = typeof this.config.bn_codes[this.config.context] !== 'undefined' ?\n this.config.bn_codes[this.config.context] : '';\n return fetch(this.config.ajax.create_order.endpoint, {\n method: 'POST',\n body: JSON.stringify({\n nonce: this.config.ajax.create_order.nonce,\n purchase_units,\n payer,\n bn_code:bnCode,\n context:this.config.context\n })\n }).then(function (res) {\n return res.json();\n }).then(function (data) {\n if (!data.success) {\n console.error(data);\n throw Error(data.data.message);\n }\n return data.data.id;\n });\n };\n\n const promise = this.updateCart.update(onResolve, getProducts());\n return promise;\n };\n return createOrder;\n }\n\n variations()\n {\n\n if (! this.hasVariations()) {\n return null;\n }\n const attributes = [...this.formElement.querySelectorAll(\"[name^='attribute_']\")].map(\n (element) => {\n return {\n value:element.value,\n name:element.name\n }\n }\n );\n return attributes;\n }\n\n hasVariations()\n {\n return this.formElement.classList.contains('variations_form');\n }\n\n isGroupedProduct()\n {\n return this.formElement.classList.contains('grouped_form');\n }\n}\nexport default SingleProductActionHandler;\n","import ErrorHandler from '../ErrorHandler';\nimport UpdateCart from \"../Helper/UpdateCart\";\nimport SingleProductActionHandler from \"../ActionHandler/SingleProductActionHandler\";\n\nclass SingleProductBootstap {\n constructor(gateway, renderer, messages) {\n this.gateway = gateway;\n this.renderer = renderer;\n this.messages = messages;\n }\n\n init() {\n if (!this.shouldRender()) {\n this.renderer.hideButtons(this.gateway.hosted_fields.wrapper);\n return;\n }\n\n this.render();\n }\n\n shouldRender() {\n if (document.querySelector('form.cart') === null) {\n return false;\n }\n\n return true;\n }\n\n render() {\n const actionHandler = new SingleProductActionHandler(\n this.gateway,\n new UpdateCart(\n this.gateway.ajax.change_cart.endpoint,\n this.gateway.ajax.change_cart.nonce,\n ),\n () => {\n this.renderer.showButtons(this.gateway.button.wrapper);\n this.renderer.showButtons(this.gateway.hosted_fields.wrapper);\n let priceText = \"0\";\n if (document.querySelector('form.cart ins .woocommerce-Price-amount')) {\n priceText = document.querySelector('form.cart ins .woocommerce-Price-amount').innerText;\n }\n else if (document.querySelector('form.cart .woocommerce-Price-amount')) {\n priceText = document.querySelector('form.cart .woocommerce-Price-amount').innerText;\n }\n const amount = parseInt(priceText.replace(/([^\\d,\\.\\s]*)/g, ''));\n this.messages.renderWithAmount(amount)\n },\n () => {\n this.renderer.hideButtons(this.gateway.button.wrapper);\n this.renderer.hideButtons(this.gateway.hosted_fields.wrapper);\n },\n document.querySelector('form.cart'),\n new ErrorHandler(this.gateway.labels.error.generic),\n );\n\n this.renderer.render(\n this.gateway.button.wrapper,\n this.gateway.hosted_fields.wrapper,\n actionHandler.configuration(),\n );\n }\n}\n\nexport default SingleProductBootstap;","import CartActionHandler from '../ActionHandler/CartActionHandler';\nimport ErrorHandler from '../ErrorHandler';\n\nclass CartBootstrap {\n constructor(gateway, renderer) {\n this.gateway = gateway;\n this.renderer = renderer;\n }\n\n init() {\n if (!this.shouldRender()) {\n return;\n }\n\n this.render();\n\n jQuery(document.body).on('updated_cart_totals updated_checkout', () => {\n this.render();\n });\n }\n\n shouldRender() {\n return document.querySelector(this.gateway.button.wrapper) !==\n null || document.querySelector(this.gateway.hosted_fields.wrapper) !==\n null;\n }\n\n render() {\n const actionHandler = new CartActionHandler(\n PayPalCommerceGateway,\n new ErrorHandler(this.gateway.labels.error.generic),\n );\n\n this.renderer.render(\n this.gateway.button.wrapper,\n this.gateway.hosted_fields.wrapper,\n actionHandler.configuration(),\n );\n }\n}\n\nexport default CartBootstrap;","const onApprove = (context, errorHandler, spinner) => {\n return (data, actions) => {\n spinner.block();\n return fetch(context.config.ajax.approve_order.endpoint, {\n method: 'POST',\n body: JSON.stringify({\n nonce: context.config.ajax.approve_order.nonce,\n order_id:data.orderID\n })\n }).then((res)=>{\n return res.json();\n }).then((data)=>{\n spinner.unblock();\n if (!data.success) {\n if (data.data.code === 100) {\n errorHandler.message(data.data.message);\n } else {\n errorHandler.genericError();\n }\n if (typeof actions !== 'undefined' && typeof actions.restart !== 'undefined') {\n return actions.restart();\n }\n throw new Error(data.data.message);\n }\n document.querySelector('#place_order').click()\n });\n\n }\n}\n\nexport default onApprove;\n","import onApprove from '../OnApproveHandler/onApproveForPayNow.js';\nimport {payerData} from \"../Helper/PayerData\";\n\nclass CheckoutActionHandler {\n\n constructor(config, errorHandler, spinner) {\n this.config = config;\n this.errorHandler = errorHandler;\n this.spinner = spinner;\n }\n\n configuration() {\n const spinner = this.spinner;\n const createOrder = (data, actions) => {\n const payer = payerData();\n const bnCode = typeof this.config.bn_codes[this.config.context] !== 'undefined' ?\n this.config.bn_codes[this.config.context] : '';\n\n\n const errorHandler = this.errorHandler;\n const formSelector = this.config.context === 'checkout' ? 'form.checkout' : 'form#order_review';\n const formValues = jQuery(formSelector).serialize();\n\n return fetch(this.config.ajax.create_order.endpoint, {\n method: 'POST',\n body: JSON.stringify({\n nonce: this.config.ajax.create_order.nonce,\n payer,\n bn_code:bnCode,\n context:this.config.context,\n order_id:this.config.order_id,\n form:formValues\n })\n }).then(function (res) {\n return res.json();\n }).then(function (data) {\n if (!data.success) {\n spinner.unblock();\n errorHandler.message(data.data.message, true);\n return;\n }\n const input = document.createElement('input');\n input.setAttribute('type', 'hidden');\n input.setAttribute('name', 'ppcp-resume-order');\n input.setAttribute('value', data.data.purchase_units[0].custom_id);\n document.querySelector(formSelector).append(input);\n return data.data.id;\n });\n }\n return {\n createOrder,\n onApprove:onApprove(this, this.errorHandler, this.spinner),\n onError: (error) => {\n this.errorHandler.genericError();\n }\n }\n }\n}\n\nexport default CheckoutActionHandler;\n","import ErrorHandler from '../ErrorHandler';\nimport CheckoutActionHandler from '../ActionHandler/CheckoutActionHandler';\n\nclass CheckoutBootstap {\n constructor(gateway, renderer, messages, spinner) {\n this.gateway = gateway;\n this.renderer = renderer;\n this.messages = messages;\n this.spinner = spinner;\n }\n\n init() {\n\n this.render();\n\n jQuery(document.body).on('updated_checkout', () => {\n this.render();\n });\n\n jQuery(document.body).\n on('updated_checkout payment_method_selected', () => {\n this.switchBetweenPayPalandOrderButton();\n });\n this.switchBetweenPayPalandOrderButton();\n }\n\n shouldRender() {\n if (document.querySelector(this.gateway.button.cancel_wrapper)) {\n return false;\n }\n\n return document.querySelector(this.gateway.button.wrapper) !== null || document.querySelector(this.gateway.hosted_fields.wrapper) !== null;\n }\n\n render() {\n if (!this.shouldRender()) {\n return;\n }\n if (document.querySelector(this.gateway.hosted_fields.wrapper + '>div')) {\n document.querySelector(this.gateway.hosted_fields.wrapper + '>div').setAttribute('style', '');\n }\n const actionHandler = new CheckoutActionHandler(\n PayPalCommerceGateway,\n new ErrorHandler(this.gateway.labels.error.generic),\n this.spinner\n );\n\n this.renderer.render(\n this.gateway.button.wrapper,\n this.gateway.hosted_fields.wrapper,\n actionHandler.configuration(),\n );\n }\n\n switchBetweenPayPalandOrderButton() {\n const currentPaymentMethod = jQuery(\n 'input[name=\"payment_method\"]:checked').val();\n\n if (currentPaymentMethod !== 'ppcp-gateway' && currentPaymentMethod !== 'ppcp-credit-card-gateway') {\n this.renderer.hideButtons(this.gateway.button.wrapper);\n this.renderer.hideButtons(this.gateway.messages.wrapper);\n this.renderer.hideButtons(this.gateway.hosted_fields.wrapper);\n jQuery('#place_order').show();\n }\n else {\n jQuery('#place_order').hide();\n if (currentPaymentMethod === 'ppcp-gateway') {\n this.renderer.showButtons(this.gateway.button.wrapper);\n this.renderer.showButtons(this.gateway.messages.wrapper);\n this.messages.render();\n this.renderer.hideButtons(this.gateway.hosted_fields.wrapper);\n }\n if (currentPaymentMethod === 'ppcp-credit-card-gateway') {\n this.renderer.hideButtons(this.gateway.button.wrapper);\n this.renderer.hideButtons(this.gateway.messages.wrapper);\n this.renderer.showButtons(this.gateway.hosted_fields.wrapper);\n }\n }\n }\n}\n\nexport default CheckoutBootstap;","import ErrorHandler from '../ErrorHandler';\nimport CheckoutActionHandler from '../ActionHandler/CheckoutActionHandler';\n\nclass PayNowBootstrap {\n constructor(gateway, renderer, messages) {\n this.gateway = gateway;\n this.renderer = renderer;\n this.messages = messages\n }\n\n init() {\n\n this.render();\n\n jQuery(document.body).on('updated_checkout', () => {\n this.render();\n });\n\n jQuery(document.body).\n on('updated_checkout payment_method_selected', () => {\n this.switchBetweenPayPalandOrderButton();\n });\n this.switchBetweenPayPalandOrderButton();\n }\n\n shouldRender() {\n if (document.querySelector(this.gateway.button.cancel_wrapper)) {\n return false;\n }\n\n return document.querySelector(this.gateway.button.wrapper) !== null || document.querySelector(this.gateway.hosted_fields.wrapper) !== null;\n }\n\n render() {\n if (!this.shouldRender()) {\n return;\n }\n if (document.querySelector(this.gateway.hosted_fields.wrapper + '>div')) {\n document.querySelector(this.gateway.hosted_fields.wrapper + '>div').setAttribute('style', '');\n }\n const actionHandler = new CheckoutActionHandler(\n PayPalCommerceGateway,\n new ErrorHandler(this.gateway.labels.error.generic),\n );\n\n this.renderer.render(\n this.gateway.button.wrapper,\n this.gateway.hosted_fields.wrapper,\n actionHandler.configuration(),\n );\n }\n\n switchBetweenPayPalandOrderButton() {\n const currentPaymentMethod = jQuery(\n 'input[name=\"payment_method\"]:checked').val();\n\n if (currentPaymentMethod !== 'ppcp-gateway' && currentPaymentMethod !== 'ppcp-credit-card-gateway') {\n this.renderer.hideButtons(this.gateway.button.wrapper);\n this.renderer.hideButtons(this.gateway.messages.wrapper);\n this.renderer.hideButtons(this.gateway.hosted_fields.wrapper);\n jQuery('#place_order').show();\n }\n else {\n jQuery('#place_order').hide();\n if (currentPaymentMethod === 'ppcp-gateway') {\n this.renderer.showButtons(this.gateway.button.wrapper);\n this.renderer.showButtons(this.gateway.messages.wrapper);\n this.messages.render();\n this.renderer.hideButtons(this.gateway.hosted_fields.wrapper);\n }\n if (currentPaymentMethod === 'ppcp-credit-card-gateway') {\n this.renderer.hideButtons(this.gateway.button.wrapper);\n this.renderer.hideButtons(this.gateway.messages.wrapper);\n this.renderer.showButtons(this.gateway.hosted_fields.wrapper);\n }\n }\n }\n}\n\nexport default PayNowBootstrap;","class Renderer {\n constructor(creditCardRenderer, defaultConfig) {\n this.defaultConfig = defaultConfig;\n this.creditCardRenderer = creditCardRenderer;\n }\n\n render(wrapper, hostedFieldsWrapper, contextConfig) {\n\n this.renderButtons(wrapper, contextConfig);\n this.creditCardRenderer.render(hostedFieldsWrapper, contextConfig);\n }\n\n renderButtons(wrapper, contextConfig) {\n if (! document.querySelector(wrapper) || this.isAlreadyRendered(wrapper) || 'undefined' === typeof paypal.Buttons ) {\n return;\n }\n\n const style = wrapper === this.defaultConfig.button.wrapper ? this.defaultConfig.button.style : this.defaultConfig.button.mini_cart_style;\n paypal.Buttons({\n style,\n ...contextConfig,\n }).render(wrapper);\n }\n\n isAlreadyRendered(wrapper) {\n return document.querySelector(wrapper).hasChildNodes();\n }\n\n hideButtons(element) {\n const domElement = document.querySelector(element);\n if (! domElement ) {\n return false;\n }\n domElement.style.display = 'none';\n return true;\n }\n\n showButtons(element) {\n const domElement = document.querySelector(element);\n if (! domElement ) {\n return false;\n }\n domElement.style.display = 'block';\n return true;\n }\n}\n\nexport default Renderer;","const dccInputFactory = (original) => {\n const styles = window.getComputedStyle(original);\n const newElement = document.createElement('span');\n newElement.setAttribute('id', original.id);\n Object.values(styles).forEach( (prop) => {\n if (! styles[prop] || ! isNaN(prop) ) {\n return;\n }\n newElement.style.setProperty(prop,'' + styles[prop]);\n });\n return newElement;\n}\n\nexport default dccInputFactory;","import dccInputFactory from \"../Helper/DccInputFactory\";\n\nclass CreditCardRenderer {\n\n constructor(defaultConfig, errorHandler, spinner) {\n this.defaultConfig = defaultConfig;\n this.errorHandler = errorHandler;\n this.spinner = spinner;\n this.cardValid = false;\n }\n\n render(wrapper, contextConfig) {\n\n if (\n (\n this.defaultConfig.context !== 'checkout'\n && this.defaultConfig.context !== 'pay-now'\n )\n || wrapper === null\n || document.querySelector(wrapper) === null\n ) {\n return;\n }\n if (\n typeof paypal.HostedFields === 'undefined'\n || ! paypal.HostedFields.isEligible()\n ) {\n const wrapperElement = document.querySelector(wrapper);\n wrapperElement.parentNode.removeChild(wrapperElement);\n return;\n }\n\n const gateWayBox = document.querySelector('.payment_box.payment_method_ppcp-credit-card-gateway');\n const oldDisplayStyle = gateWayBox.style.display;\n gateWayBox.style.display = 'block';\n\n const hideDccGateway = document.querySelector('#ppcp-hide-dcc');\n if (hideDccGateway) {\n hideDccGateway.parentNode.removeChild(hideDccGateway);\n }\n\n const cardNumberField = document.querySelector('#ppcp-credit-card-gateway-card-number');\n\n const stylesRaw = window.getComputedStyle(cardNumberField);\n let styles = {};\n Object.values(stylesRaw).forEach( (prop) => {\n if (! stylesRaw[prop]) {\n return;\n }\n styles[prop] = '' + stylesRaw[prop];\n });\n\n const cardNumber = dccInputFactory(cardNumberField);\n cardNumberField.parentNode.replaceChild(cardNumber, cardNumberField);\n\n const cardExpiryField = document.querySelector('#ppcp-credit-card-gateway-card-expiry');\n const cardExpiry = dccInputFactory(cardExpiryField);\n cardExpiryField.parentNode.replaceChild(cardExpiry, cardExpiryField);\n\n const cardCodeField = document.querySelector('#ppcp-credit-card-gateway-card-cvc');\n const cardCode = dccInputFactory(cardCodeField);\n cardCodeField.parentNode.replaceChild(cardCode, cardCodeField);\n\n gateWayBox.style.display = oldDisplayStyle;\n\n const formWrapper = '.payment_box payment_method_ppcp-credit-card-gateway';\n if (\n this.defaultConfig.enforce_vault\n && document.querySelector(formWrapper + ' .ppcp-credit-card-vault')\n ) {\n document.querySelector(formWrapper + ' .ppcp-credit-card-vault').checked = true;\n document.querySelector(formWrapper + ' .ppcp-credit-card-vault').setAttribute('disabled', true);\n }\n paypal.HostedFields.render({\n createOrder: contextConfig.createOrder,\n styles: {\n 'input': styles\n },\n fields: {\n number: {\n selector: '#ppcp-credit-card-gateway-card-number',\n placeholder: this.defaultConfig.hosted_fields.labels.credit_card_number,\n },\n cvv: {\n selector: '#ppcp-credit-card-gateway-card-cvc',\n placeholder: this.defaultConfig.hosted_fields.labels.cvv,\n },\n expirationDate: {\n selector: '#ppcp-credit-card-gateway-card-expiry',\n placeholder: this.defaultConfig.hosted_fields.labels.mm_yyyy,\n }\n }\n }).then(hostedFields => {\n const submitEvent = (event) => {\n this.spinner.block();\n if (event) {\n event.preventDefault();\n }\n this.errorHandler.clear();\n const state = hostedFields.getState();\n const formValid = Object.keys(state.fields).every(function (key) {\n return state.fields[key].isValid;\n });\n\n if (formValid && this.cardValid) {\n\n let vault = document.querySelector(wrapper + ' .ppcp-credit-card-vault') ?\n document.querySelector(wrapper + ' .ppcp-credit-card-vault').checked : false;\n vault = this.defaultConfig.enforce_vault || vault;\n\n hostedFields.submit({\n contingencies: ['3D_SECURE'],\n vault\n }).then((payload) => {\n payload.orderID = payload.orderId;\n this.spinner.unblock();\n return contextConfig.onApprove(payload);\n });\n } else {\n this.spinner.unblock();\n const message = ! this.cardValid ? this.defaultConfig.hosted_fields.labels.card_not_supported : this.defaultConfig.hosted_fields.labels.fields_not_valid;\n this.errorHandler.message(message);\n }\n }\n hostedFields.on('inputSubmitRequest', function () {\n submitEvent(null);\n });\n hostedFields.on('cardTypeChange', (event) => {\n if ( ! event.cards.length ) {\n this.cardValid = false;\n return;\n }\n const validCards = this.defaultConfig.hosted_fields.valid_cards;\n this.cardValid = validCards.indexOf(event.cards[0].type) !== -1;\n })\n document.querySelector(wrapper + ' button').addEventListener(\n 'click',\n submitEvent\n );\n });\n\n document.querySelector('#payment_method_ppcp-credit-card-gateway').addEventListener(\n 'click',\n () => {\n document.querySelector('label[for=ppcp-credit-card-gateway-card-number]').click();\n }\n )\n }\n}\nexport default CreditCardRenderer;","const storageKey = 'ppcp-data-client-id';\n\nconst validateToken = (token, user) => {\n if (! token) {\n return false;\n }\n if (token.user !== user) {\n return false;\n }\n const currentTime = new Date().getTime();\n const isExpired = currentTime >= token.expiration * 1000;\n return ! isExpired;\n}\n\nconst storedTokenForUser = (user) => {\n const token = JSON.parse(sessionStorage.getItem(storageKey));\n if (validateToken(token, user)) {\n return token.token;\n }\n return null;\n}\n\nconst storeToken = (token) => {\n sessionStorage.setItem(storageKey, JSON.stringify(token));\n}\n\nconst dataClientIdAttributeHandler = (script, config) => {\n const token = storedTokenForUser(config.user);\n if (token) {\n script.setAttribute('data-client-token', token);\n document.body.append(script);\n return;\n }\n fetch(config.endpoint, {\n method: 'POST',\n body: JSON.stringify({\n nonce: config.nonce\n })\n }).then((res)=>{\n return res.json();\n }).then((data)=>{\n const isValid = validateToken(data, config.user);\n if (!isValid) {\n return;\n }\n storeToken(data);\n script.setAttribute('data-client-token', data.token);\n document.body.append(script);\n });\n}\n\nexport default dataClientIdAttributeHandler;","class MessageRenderer {\n\n constructor(config) {\n this.config = config;\n }\n\n render() {\n if (! this.shouldRender()) {\n return;\n }\n\n paypal.Messages({\n amount: this.config.amount,\n placement: this.config.placement,\n style: this.config.style\n }).render(this.config.wrapper);\n }\n\n renderWithAmount(amount) {\n\n if (! this.shouldRender()) {\n return;\n }\n\n const newWrapper = document.createElement('div');\n newWrapper.setAttribute('id', this.config.wrapper.replace('#', ''));\n\n const sibling = document.querySelector(this.config.wrapper).nextSibling;\n document.querySelector(this.config.wrapper).parentElement.removeChild(document.querySelector(this.config.wrapper));\n sibling.parentElement.insertBefore(newWrapper, sibling);\n paypal.Messages({\n amount,\n placement: this.config.placement,\n style: this.config.style\n }).render(this.config.wrapper);\n }\n\n shouldRender() {\n\n if (typeof paypal.Messages === 'undefined' || typeof this.config.wrapper === 'undefined' ) {\n return false;\n }\n if (! document.querySelector(this.config.wrapper)) {\n return false;\n }\n return true;\n }\n}\nexport default MessageRenderer;","class Spinner {\n\n constructor() {\n this.target = 'form.woocommerce-checkout';\n }\n block() {\n\n jQuery( this.target ).block({\n message: null,\n overlayCSS: {\n background: '#fff',\n opacity: 0.6\n }\n });\n }\n\n unblock() {\n\n jQuery( this.target ).unblock();\n }\n}\n\nexport default Spinner;","import MiniCartBootstap from './modules/ContextBootstrap/MiniCartBootstap';\nimport SingleProductBootstap from './modules/ContextBootstrap/SingleProductBootstap';\nimport CartBootstrap from './modules/ContextBootstrap/CartBootstap';\nimport CheckoutBootstap from './modules/ContextBootstrap/CheckoutBootstap';\nimport PayNowBootstrap from \"./modules/ContextBootstrap/PayNowBootstrap\";\nimport Renderer from './modules/Renderer/Renderer';\nimport ErrorHandler from './modules/ErrorHandler';\nimport CreditCardRenderer from \"./modules/Renderer/CreditCardRenderer\";\nimport dataClientIdAttributeHandler from \"./modules/DataClientIdAttributeHandler\";\nimport MessageRenderer from \"./modules/Renderer/MessageRenderer\";\nimport Spinner from \"./modules/Helper/Spinner\";\n\nconst bootstrap = () => {\n const errorHandler = new ErrorHandler(PayPalCommerceGateway.labels.error.generic);\n const spinner = new Spinner();\n const creditCardRenderer = new CreditCardRenderer(PayPalCommerceGateway, errorHandler, spinner);\n const renderer = new Renderer(creditCardRenderer, PayPalCommerceGateway);\n const messageRenderer = new MessageRenderer(PayPalCommerceGateway.messages);\n const context = PayPalCommerceGateway.context;\n if (context === 'mini-cart' || context === 'product') {\n const miniCartBootstrap = new MiniCartBootstap(\n PayPalCommerceGateway,\n renderer\n );\n\n miniCartBootstrap.init();\n }\n\n if (context === 'product') {\n const singleProductBootstrap = new SingleProductBootstap(\n PayPalCommerceGateway,\n renderer,\n messageRenderer,\n );\n\n singleProductBootstrap.init();\n }\n\n if (context === 'cart') {\n const cartBootstrap = new CartBootstrap(\n PayPalCommerceGateway,\n renderer,\n );\n\n cartBootstrap.init();\n }\n\n if (context === 'checkout') {\n const checkoutBootstap = new CheckoutBootstap(\n PayPalCommerceGateway,\n renderer,\n messageRenderer,\n spinner\n );\n\n checkoutBootstap.init();\n }\n\n if (context === 'pay-now' ) {\n const payNowBootstrap = new PayNowBootstrap(\n PayPalCommerceGateway,\n renderer,\n messageRenderer\n );\n payNowBootstrap.init();\n }\n\n if (context !== 'checkout') {\n messageRenderer.render();\n }\n};\ndocument.addEventListener(\n 'DOMContentLoaded',\n () => {\n if (!typeof (PayPalCommerceGateway)) {\n console.error('PayPal button could not be configured.');\n return;\n }\n const script = document.createElement('script');\n\n script.addEventListener('load', (event) => {\n bootstrap();\n });\n script.setAttribute('src', PayPalCommerceGateway.button.url);\n Object.entries(PayPalCommerceGateway.script_attributes).forEach(\n (keyValue) => {\n script.setAttribute(keyValue[0], keyValue[1]);\n }\n );\n\n if (PayPalCommerceGateway.data_client_id.set_attribute) {\n dataClientIdAttributeHandler(script, PayPalCommerceGateway.data_client_id);\n return;\n }\n\n document.body.append(script);\n },\n);"],"sourceRoot":""}
1
+ {"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./resources/js/modules/ErrorHandler.js","webpack:///./resources/js/modules/OnApproveHandler/onApproveForContinue.js","webpack:///./resources/js/modules/Helper/PayerData.js","webpack:///./resources/js/modules/ActionHandler/CartActionHandler.js","webpack:///./resources/js/modules/ContextBootstrap/MiniCartBootstap.js","webpack:///./resources/js/modules/Entity/Product.js","webpack:///./resources/js/modules/Helper/UpdateCart.js","webpack:///./resources/js/modules/Helper/ButtonsToggleListener.js","webpack:///./resources/js/modules/ActionHandler/SingleProductActionHandler.js","webpack:///./resources/js/modules/ContextBootstrap/SingleProductBootstap.js","webpack:///./resources/js/modules/ContextBootstrap/CartBootstap.js","webpack:///./resources/js/modules/OnApproveHandler/onApproveForPayNow.js","webpack:///./resources/js/modules/ActionHandler/CheckoutActionHandler.js","webpack:///./resources/js/modules/ContextBootstrap/CheckoutBootstap.js","webpack:///./resources/js/modules/ContextBootstrap/PayNowBootstrap.js","webpack:///./resources/js/modules/Renderer/Renderer.js","webpack:///./resources/js/modules/Helper/DccInputFactory.js","webpack:///./resources/js/modules/Renderer/CreditCardRenderer.js","webpack:///./resources/js/modules/DataClientIdAttributeHandler.js","webpack:///./resources/js/modules/Renderer/MessageRenderer.js","webpack:///./resources/js/modules/Helper/Spinner.js","webpack:///./resources/js/button.js"],"names":["installedModules","__webpack_require__","moduleId","exports","module","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","ErrorHandler","constructor","genericErrorText","this","wrapper","document","querySelector","genericError","classList","contains","clear","message","text","persist","add","remove","innerHTML","sanitize","jQuery","scroll_to_notices","textarea","createElement","replace","innerText","onApprove","context","errorHandler","data","actions","fetch","config","ajax","approve_order","endpoint","method","body","JSON","stringify","nonce","order_id","orderID","then","res","json","success","restart","catch","err","location","href","redirect","payerData","payer","PayPalCommerceGateway","phone","phone_type","phone_number","national_number","email_address","surname","given_name","address","country_code","address_line_1","address_line_2","admin_area_1","admin_area_2","postal_code","CartActionHandler","configuration","createOrder","bnCode","bn_codes","create_order","purchase_units","bn_code","console","error","Error","id","onError","MiniCartBootstap","gateway","renderer","actionHandler","init","labels","generic","render","on","shouldRender","button","mini_cart_wrapper","hosted_fields","Product","quantity","variations","UpdateCart","update","onResolve","products","Promise","resolve","reject","result","resolved","ButtonsToggleListener","element","showCallback","hideCallback","observer","callback","MutationObserver","observe","attributes","disconnect","SingleProductActionHandler","updateCart","showButtonCallback","hideButtonCallback","formElement","hasVariations","getProducts","isGroupedProduct","querySelectorAll","forEach","elementName","getAttribute","match","length","parseInt","push","qty","map","SingleProductBootstap","messages","hideButtons","change_cart","showButtons","priceText","amount","renderWithAmount","CartBootstrap","spinner","block","unblock","code","click","CheckoutActionHandler","formSelector","setTarget","formValues","serialize","form","input","setAttribute","custom_id","append","CheckoutBootstap","switchBetweenPayPalandOrderButton","cancel_wrapper","currentPaymentMethod","val","show","hide","PayNowBootstrap","Renderer","creditCardRenderer","defaultConfig","hostedFieldsWrapper","contextConfig","renderButtons","isAlreadyRendered","paypal","Buttons","style","mini_cart_style","hasChildNodes","domElement","display","dccInputFactory","original","styles","window","getComputedStyle","newElement","values","prop","isNaN","setProperty","CreditCardRenderer","cardValid","HostedFields","isEligible","wrapperElement","parentNode","removeChild","gateWayBox","oldDisplayStyle","hideDccGateway","cardNumberField","stylesRaw","cardNumber","replaceChild","cardExpiryField","cardExpiry","cardCodeField","cardCode","formWrapper","enforce_vault","checked","fields","number","selector","placeholder","credit_card_number","cvv","expirationDate","mm_yyyy","hostedFields","submitEvent","event","preventDefault","state","getState","keys","every","isValid","vault","submit","contingencies","payload","orderId","fields_not_valid","card_not_supported","cards","validCards","valid_cards","indexOf","type","addEventListener","validateToken","token","user","Date","getTime","expiration","dataClientIdAttributeHandler","script","parse","sessionStorage","getItem","storedTokenForUser","setItem","storeToken","MessageRenderer","Messages","placement","newWrapper","sibling","nextSibling","parentElement","insertBefore","Spinner","target","overlayCSS","background","opacity","messageRenderer","bootstrap","url","entries","script_attributes","keyValue","data_client_id","set_attribute"],"mappings":"aACE,IAAIA,EAAmB,GAGvB,SAASC,EAAoBC,GAG5B,GAAGF,EAAiBE,GACnB,OAAOF,EAA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hG,EAAqB,IAAIuB,EAAmBzI,sBAAuB3B,EAAcqH,GACjF5D,EAAW,IAAImF,EAASC,EAAoBlH,uBAC5CuN,EAAkB,IAAIb,EAAgB1M,sBAAsBkF,UAC5D9G,EAAU4B,sBAAsB5B,QACtC,GAAgB,cAAZA,GAAuC,YAAZA,EAAuB,CACxB,IAAIwD,EAC1B5B,sBACA8B,GAGcE,OAGtB,GAAgB,YAAZ5D,EAAuB,CACQ,IAAI6G,EAC/BjF,sBACA8B,EACAyL,GAGmBvL,OAG3B,GAAgB,SAAZ5D,EAAoB,CACE,IAAIqH,EACtBzF,sBACA8B,GAGUE,OAGlB,GAAgB,aAAZ5D,EAAwB,CACC,IAAIqI,EACzBzG,sBACA8B,EACAyL,EACA7H,GAGa1D,OAGrB,GAAgB,YAAZ5D,EAAwB,CACA,IAAI4I,EACxBhH,sBACA8B,EACAyL,EACA7H,GAEY1D,OAGJ,aAAZ5D,GACAmP,EAAgBpL,UAaZqL,KAEJrB,EAAO7F,aAAa,MAAOtG,sBAAsBsC,OAAOmL,KACxDpS,OAAOqS,QAAQ1N,sBAAsB2N,mBAAmBnJ,QACnDoJ,IACGzB,EAAO7F,aAAasH,EAAS,GAAIA,EAAS,MAI9C5N,sBAAsB6N,eAAeC,cACrC5B,EAA6BC,EAAQnM,sBAAsB6N,gBAI/D7Q,SAAS8B,KAAK0H,OAAO2F","file":"js/button.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 1);\n","class ErrorHandler {\n\n constructor(genericErrorText)\n {\n this.genericErrorText = genericErrorText;\n this.wrapper = document.querySelector('.woocommerce-notices-wrapper');\n }\n\n genericError() {\n if (this.wrapper.classList.contains('ppcp-persist')) {\n return;\n }\n this.clear();\n this.message(this.genericErrorText)\n }\n\n message(text, persist = false)\n {\n this.wrapper.classList.add('woocommerce-error');\n if (persist) {\n this.wrapper.classList.add('ppcp-persist');\n } else {\n this.wrapper.classList.remove('ppcp-persist');\n }\n this.wrapper.innerHTML = this.sanitize(text);\n jQuery.scroll_to_notices(jQuery('.woocommerce-notices-wrapper'))\n }\n\n sanitize(text)\n {\n const textarea = document.createElement('textarea');\n textarea.innerHTML = text;\n return textarea.value.replace('Error: ', '');\n }\n\n clear()\n {\n if (! this.wrapper.classList.contains('woocommerce-error')) {\n return;\n }\n this.wrapper.classList.remove('woocommerce-error');\n this.wrapper.innerText = '';\n }\n}\n\nexport default ErrorHandler;\n","const onApprove = (context, errorHandler) => {\n return (data, actions) => {\n return fetch(context.config.ajax.approve_order.endpoint, {\n method: 'POST',\n body: JSON.stringify({\n nonce: context.config.ajax.approve_order.nonce,\n order_id:data.orderID\n })\n }).then((res)=>{\n return res.json();\n }).then((data)=>{\n if (!data.success) {\n errorHandler.genericError();\n return actions.restart().catch(err => {\n errorHandler.genericError();\n });;\n }\n location.href = context.config.redirect;\n });\n\n }\n}\n\nexport default onApprove;\n","export const payerData = () => {\n const payer = PayPalCommerceGateway.payer;\n if (! payer) {\n return null;\n }\n\n const phone = (document.querySelector('#billing_phone') || typeof payer.phone !== 'undefined') ?\n {\n phone_type:\"HOME\",\n phone_number:{\n national_number : (document.querySelector('#billing_phone')) ? document.querySelector('#billing_phone').value : payer.phone.phone_number.national_number\n }\n } : null;\n const payerData = {\n email_address:(document.querySelector('#billing_email')) ? document.querySelector('#billing_email').value : payer.email_address,\n name : {\n surname: (document.querySelector('#billing_last_name')) ? document.querySelector('#billing_last_name').value : payer.name.surname,\n given_name: (document.querySelector('#billing_first_name')) ? document.querySelector('#billing_first_name').value : payer.name.given_name\n },\n address : {\n country_code : (document.querySelector('#billing_country')) ? document.querySelector('#billing_country').value : payer.address.country_code,\n address_line_1 : (document.querySelector('#billing_address_1')) ? document.querySelector('#billing_address_1').value : payer.address.address_line_1,\n address_line_2 : (document.querySelector('#billing_address_2')) ? document.querySelector('#billing_address_2').value : payer.address.address_line_2,\n admin_area_1 : (document.querySelector('#billing_state')) ? document.querySelector('#billing_state').value : payer.address.admin_area_1,\n admin_area_2 : (document.querySelector('#billing_city')) ? document.querySelector('#billing_city').value : payer.address.admin_area_2,\n postal_code : (document.querySelector('#billing_postcode')) ? document.querySelector('#billing_postcode').value : payer.address.postal_code\n }\n };\n\n if (phone) {\n payerData.phone = phone;\n }\n return payerData;\n}\n","import onApprove from '../OnApproveHandler/onApproveForContinue.js';\nimport {payerData} from \"../Helper/PayerData\";\n\nclass CartActionHandler {\n\n constructor(config, errorHandler) {\n this.config = config;\n this.errorHandler = errorHandler;\n }\n\n configuration() {\n const createOrder = (data, actions) => {\n const payer = payerData();\n const bnCode = typeof this.config.bn_codes[this.config.context] !== 'undefined' ?\n this.config.bn_codes[this.config.context] : '';\n return fetch(this.config.ajax.create_order.endpoint, {\n method: 'POST',\n body: JSON.stringify({\n nonce: this.config.ajax.create_order.nonce,\n purchase_units: [],\n bn_code:bnCode,\n payer,\n context:this.config.context\n }),\n }).then(function(res) {\n return res.json();\n }).then(function(data) {\n if (!data.success) {\n console.error(data);\n throw Error(data.data.message);\n }\n return data.data.id;\n });\n };\n\n return {\n createOrder,\n onApprove: onApprove(this, this.errorHandler),\n onError: (error) => {\n this.errorHandler.genericError();\n }\n };\n }\n}\n\nexport default CartActionHandler;\n","import ErrorHandler from '../ErrorHandler';\nimport CartActionHandler from '../ActionHandler/CartActionHandler';\n\nclass MiniCartBootstap {\n constructor(gateway, renderer) {\n this.gateway = gateway;\n this.renderer = renderer;\n this.actionHandler = null;\n }\n\n init() {\n\n this.actionHandler = new CartActionHandler(\n PayPalCommerceGateway,\n new ErrorHandler(this.gateway.labels.error.generic),\n );\n this.render();\n\n jQuery(document.body).on('wc_fragments_loaded wc_fragments_refreshed', () => {\n this.render();\n });\n }\n\n shouldRender() {\n return document.querySelector(this.gateway.button.mini_cart_wrapper) !==\n null || document.querySelector(this.gateway.hosted_fields.mini_cart_wrapper) !==\n null;\n }\n\n render() {\n if (!this.shouldRender()) {\n return;\n }\n\n this.renderer.render(\n this.gateway.button.mini_cart_wrapper,\n this.gateway.hosted_fields.mini_cart_wrapper,\n this.actionHandler.configuration()\n );\n }\n}\n\nexport default MiniCartBootstap;","class Product {\n\n constructor(id, quantity, variations) {\n this.id = id;\n this.quantity = quantity;\n this.variations = variations;\n }\n\n data() {\n return {\n id:this.id,\n quantity:this.quantity,\n variations:this.variations\n }\n }\n}\n\nexport default Product;","import Product from \"../Entity/Product\";\nclass UpdateCart {\n\n constructor(endpoint, nonce)\n {\n this.endpoint = endpoint;\n this.nonce = nonce;\n }\n\n /**\n *\n * @param onResolve\n * @param {Product[]} products\n * @returns {Promise<unknown>}\n */\n update(onResolve, products)\n {\n return new Promise((resolve, reject) => {\n fetch(\n this.endpoint,\n {\n method: 'POST',\n body: JSON.stringify({\n nonce: this.nonce,\n products,\n })\n }\n ).then(\n (result) => {\n return result.json();\n }\n ).then((result) => {\n if (! result.success) {\n reject(result.data);\n return;\n }\n\n const resolved = onResolve(result.data);\n resolve(resolved);\n })\n });\n }\n}\n\nexport default UpdateCart;","/**\n * When you can't add something to the cart, the PayPal buttons should not show.\n * Therefore we listen for changes on the add to cart button and show/hide the buttons accordingly.\n */\n\nclass ButtonsToggleListener {\n constructor(element, showCallback, hideCallback)\n {\n this.element = element;\n this.showCallback = showCallback;\n this.hideCallback = hideCallback;\n this.observer = null;\n }\n\n init()\n {\n const config = { attributes : true };\n const callback = () => {\n if (this.element.classList.contains('disabled')) {\n this.hideCallback();\n return;\n }\n this.showCallback();\n }\n this.observer = new MutationObserver(callback);\n this.observer.observe(this.element, config);\n callback();\n }\n\n disconnect()\n {\n this.observer.disconnect();\n }\n}\n\nexport default ButtonsToggleListener;","import ButtonsToggleListener from '../Helper/ButtonsToggleListener';\nimport Product from '../Entity/Product';\nimport onApprove from '../OnApproveHandler/onApproveForContinue';\nimport {payerData} from \"../Helper/PayerData\";\n\nclass SingleProductActionHandler {\n\n constructor(\n config,\n updateCart,\n showButtonCallback,\n hideButtonCallback,\n formElement,\n errorHandler\n ) {\n this.config = config;\n this.updateCart = updateCart;\n this.showButtonCallback = showButtonCallback;\n this.hideButtonCallback = hideButtonCallback;\n this.formElement = formElement;\n this.errorHandler = errorHandler;\n }\n\n configuration()\n {\n\n if ( this.hasVariations() ) {\n const observer = new ButtonsToggleListener(\n this.formElement.querySelector('.single_add_to_cart_button'),\n this.showButtonCallback,\n this.hideButtonCallback\n );\n observer.init();\n }\n\n return {\n createOrder: this.createOrder(),\n onApprove: onApprove(this, this.errorHandler),\n onError: (error) => {\n this.errorHandler.genericError();\n }\n }\n }\n\n createOrder()\n {\n var getProducts = null;\n if (! this.isGroupedProduct() ) {\n getProducts = () => {\n const id = document.querySelector('[name=\"add-to-cart\"]').value;\n const qty = document.querySelector('[name=\"quantity\"]').value;\n const variations = this.variations();\n return [new Product(id, qty, variations)];\n }\n } else {\n getProducts = () => {\n const products = [];\n this.formElement.querySelectorAll('input[type=\"number\"]').forEach((element) => {\n if (! element.value) {\n return;\n }\n const elementName = element.getAttribute('name').match(/quantity\\[([\\d]*)\\]/);\n if (elementName.length !== 2) {\n return;\n }\n const id = parseInt(elementName[1]);\n const quantity = parseInt(element.value);\n products.push(new Product(id, quantity, null));\n })\n return products;\n }\n }\n const createOrder = (data, actions) => {\n this.errorHandler.clear();\n\n const onResolve = (purchase_units) => {\n const payer = payerData();\n const bnCode = typeof this.config.bn_codes[this.config.context] !== 'undefined' ?\n this.config.bn_codes[this.config.context] : '';\n return fetch(this.config.ajax.create_order.endpoint, {\n method: 'POST',\n body: JSON.stringify({\n nonce: this.config.ajax.create_order.nonce,\n purchase_units,\n payer,\n bn_code:bnCode,\n context:this.config.context\n })\n }).then(function (res) {\n return res.json();\n }).then(function (data) {\n if (!data.success) {\n console.error(data);\n throw Error(data.data.message);\n }\n return data.data.id;\n });\n };\n\n const promise = this.updateCart.update(onResolve, getProducts());\n return promise;\n };\n return createOrder;\n }\n\n variations()\n {\n\n if (! this.hasVariations()) {\n return null;\n }\n const attributes = [...this.formElement.querySelectorAll(\"[name^='attribute_']\")].map(\n (element) => {\n return {\n value:element.value,\n name:element.name\n }\n }\n );\n return attributes;\n }\n\n hasVariations()\n {\n return this.formElement.classList.contains('variations_form');\n }\n\n isGroupedProduct()\n {\n return this.formElement.classList.contains('grouped_form');\n }\n}\nexport default SingleProductActionHandler;\n","import ErrorHandler from '../ErrorHandler';\nimport UpdateCart from \"../Helper/UpdateCart\";\nimport SingleProductActionHandler from \"../ActionHandler/SingleProductActionHandler\";\n\nclass SingleProductBootstap {\n constructor(gateway, renderer, messages) {\n this.gateway = gateway;\n this.renderer = renderer;\n this.messages = messages;\n }\n\n init() {\n if (!this.shouldRender()) {\n this.renderer.hideButtons(this.gateway.hosted_fields.wrapper);\n return;\n }\n\n this.render();\n }\n\n shouldRender() {\n if (document.querySelector('form.cart') === null) {\n return false;\n }\n\n return true;\n }\n\n render() {\n const actionHandler = new SingleProductActionHandler(\n this.gateway,\n new UpdateCart(\n this.gateway.ajax.change_cart.endpoint,\n this.gateway.ajax.change_cart.nonce,\n ),\n () => {\n this.renderer.showButtons(this.gateway.button.wrapper);\n this.renderer.showButtons(this.gateway.hosted_fields.wrapper);\n let priceText = \"0\";\n if (document.querySelector('form.cart ins .woocommerce-Price-amount')) {\n priceText = document.querySelector('form.cart ins .woocommerce-Price-amount').innerText;\n }\n else if (document.querySelector('form.cart .woocommerce-Price-amount')) {\n priceText = document.querySelector('form.cart .woocommerce-Price-amount').innerText;\n }\n const amount = parseInt(priceText.replace(/([^\\d,\\.\\s]*)/g, ''));\n this.messages.renderWithAmount(amount)\n },\n () => {\n this.renderer.hideButtons(this.gateway.button.wrapper);\n this.renderer.hideButtons(this.gateway.hosted_fields.wrapper);\n },\n document.querySelector('form.cart'),\n new ErrorHandler(this.gateway.labels.error.generic),\n );\n\n this.renderer.render(\n this.gateway.button.wrapper,\n this.gateway.hosted_fields.wrapper,\n actionHandler.configuration(),\n );\n }\n}\n\nexport default SingleProductBootstap;","import CartActionHandler from '../ActionHandler/CartActionHandler';\nimport ErrorHandler from '../ErrorHandler';\n\nclass CartBootstrap {\n constructor(gateway, renderer) {\n this.gateway = gateway;\n this.renderer = renderer;\n }\n\n init() {\n if (!this.shouldRender()) {\n return;\n }\n\n this.render();\n\n jQuery(document.body).on('updated_cart_totals updated_checkout', () => {\n this.render();\n });\n }\n\n shouldRender() {\n return document.querySelector(this.gateway.button.wrapper) !==\n null || document.querySelector(this.gateway.hosted_fields.wrapper) !==\n null;\n }\n\n render() {\n const actionHandler = new CartActionHandler(\n PayPalCommerceGateway,\n new ErrorHandler(this.gateway.labels.error.generic),\n );\n\n this.renderer.render(\n this.gateway.button.wrapper,\n this.gateway.hosted_fields.wrapper,\n actionHandler.configuration(),\n );\n }\n}\n\nexport default CartBootstrap;","const onApprove = (context, errorHandler, spinner) => {\n return (data, actions) => {\n spinner.block();\n return fetch(context.config.ajax.approve_order.endpoint, {\n method: 'POST',\n body: JSON.stringify({\n nonce: context.config.ajax.approve_order.nonce,\n order_id:data.orderID\n })\n }).then((res)=>{\n return res.json();\n }).then((data)=>{\n spinner.unblock();\n if (!data.success) {\n if (data.data.code === 100) {\n errorHandler.message(data.data.message);\n } else {\n errorHandler.genericError();\n }\n if (typeof actions !== 'undefined' && typeof actions.restart !== 'undefined') {\n return actions.restart();\n }\n throw new Error(data.data.message);\n }\n document.querySelector('#place_order').click()\n });\n\n }\n}\n\nexport default onApprove;\n","import onApprove from '../OnApproveHandler/onApproveForPayNow.js';\nimport {payerData} from \"../Helper/PayerData\";\n\nclass CheckoutActionHandler {\n\n constructor(config, errorHandler, spinner) {\n this.config = config;\n this.errorHandler = errorHandler;\n this.spinner = spinner;\n }\n\n configuration() {\n const spinner = this.spinner;\n const createOrder = (data, actions) => {\n const payer = payerData();\n const bnCode = typeof this.config.bn_codes[this.config.context] !== 'undefined' ?\n this.config.bn_codes[this.config.context] : '';\n\n const errorHandler = this.errorHandler;\n\n const formSelector = this.config.context === 'checkout' ? 'form.checkout' : 'form#order_review';\n spinner.setTarget(formSelector);\n spinner.block();\n\n const formValues = jQuery(formSelector).serialize();\n\n return fetch(this.config.ajax.create_order.endpoint, {\n method: 'POST',\n body: JSON.stringify({\n nonce: this.config.ajax.create_order.nonce,\n payer,\n bn_code:bnCode,\n context:this.config.context,\n order_id:this.config.order_id,\n form:formValues\n })\n }).then(function (res) {\n return res.json();\n }).then(function (data) {\n if (!data.success) {\n spinner.unblock();\n errorHandler.message(data.data.message, true);\n return;\n }\n const input = document.createElement('input');\n input.setAttribute('type', 'hidden');\n input.setAttribute('name', 'ppcp-resume-order');\n input.setAttribute('value', data.data.purchase_units[0].custom_id);\n document.querySelector(formSelector).append(input);\n return data.data.id;\n });\n }\n return {\n createOrder,\n onApprove:onApprove(this, this.errorHandler, this.spinner),\n onError: (error) => {\n this.errorHandler.genericError();\n }\n }\n }\n}\n\nexport default CheckoutActionHandler;\n","import ErrorHandler from '../ErrorHandler';\nimport CheckoutActionHandler from '../ActionHandler/CheckoutActionHandler';\n\nclass CheckoutBootstap {\n constructor(gateway, renderer, messages, spinner) {\n this.gateway = gateway;\n this.renderer = renderer;\n this.messages = messages;\n this.spinner = spinner;\n }\n\n init() {\n\n this.render();\n\n jQuery(document.body).on('updated_checkout', () => {\n this.render();\n });\n\n jQuery(document.body).\n on('updated_checkout payment_method_selected', () => {\n this.switchBetweenPayPalandOrderButton();\n });\n this.switchBetweenPayPalandOrderButton();\n }\n\n shouldRender() {\n if (document.querySelector(this.gateway.button.cancel_wrapper)) {\n return false;\n }\n\n return document.querySelector(this.gateway.button.wrapper) !== null || document.querySelector(this.gateway.hosted_fields.wrapper) !== null;\n }\n\n render() {\n if (!this.shouldRender()) {\n return;\n }\n if (document.querySelector(this.gateway.hosted_fields.wrapper + '>div')) {\n document.querySelector(this.gateway.hosted_fields.wrapper + '>div').setAttribute('style', '');\n }\n const actionHandler = new CheckoutActionHandler(\n PayPalCommerceGateway,\n new ErrorHandler(this.gateway.labels.error.generic),\n this.spinner\n );\n\n this.renderer.render(\n this.gateway.button.wrapper,\n this.gateway.hosted_fields.wrapper,\n actionHandler.configuration(),\n );\n }\n\n switchBetweenPayPalandOrderButton() {\n const currentPaymentMethod = jQuery(\n 'input[name=\"payment_method\"]:checked').val();\n\n if (currentPaymentMethod !== 'ppcp-gateway' && currentPaymentMethod !== 'ppcp-credit-card-gateway') {\n this.renderer.hideButtons(this.gateway.button.wrapper);\n this.renderer.hideButtons(this.gateway.messages.wrapper);\n this.renderer.hideButtons(this.gateway.hosted_fields.wrapper);\n jQuery('#place_order').show();\n }\n else {\n jQuery('#place_order').hide();\n if (currentPaymentMethod === 'ppcp-gateway') {\n this.renderer.showButtons(this.gateway.button.wrapper);\n this.renderer.showButtons(this.gateway.messages.wrapper);\n this.messages.render();\n this.renderer.hideButtons(this.gateway.hosted_fields.wrapper);\n }\n if (currentPaymentMethod === 'ppcp-credit-card-gateway') {\n this.renderer.hideButtons(this.gateway.button.wrapper);\n this.renderer.hideButtons(this.gateway.messages.wrapper);\n this.renderer.showButtons(this.gateway.hosted_fields.wrapper);\n }\n }\n }\n}\n\nexport default CheckoutBootstap;","import ErrorHandler from '../ErrorHandler';\nimport CheckoutActionHandler from '../ActionHandler/CheckoutActionHandler';\n\nclass PayNowBootstrap {\n constructor(gateway, renderer, messages, spinner) {\n this.gateway = gateway;\n this.renderer = renderer;\n this.messages = messages;\n this.spinner = spinner;\n }\n\n init() {\n\n this.render();\n\n jQuery(document.body).on('updated_checkout', () => {\n this.render();\n });\n\n jQuery(document.body).\n on('updated_checkout payment_method_selected', () => {\n this.switchBetweenPayPalandOrderButton();\n });\n this.switchBetweenPayPalandOrderButton();\n }\n\n shouldRender() {\n if (document.querySelector(this.gateway.button.cancel_wrapper)) {\n return false;\n }\n\n return document.querySelector(this.gateway.button.wrapper) !== null || document.querySelector(this.gateway.hosted_fields.wrapper) !== null;\n }\n\n render() {\n if (!this.shouldRender()) {\n return;\n }\n if (document.querySelector(this.gateway.hosted_fields.wrapper + '>div')) {\n document.querySelector(this.gateway.hosted_fields.wrapper + '>div').setAttribute('style', '');\n }\n const actionHandler = new CheckoutActionHandler(\n PayPalCommerceGateway,\n new ErrorHandler(this.gateway.labels.error.generic),\n this.spinner\n );\n\n this.renderer.render(\n this.gateway.button.wrapper,\n this.gateway.hosted_fields.wrapper,\n actionHandler.configuration(),\n );\n }\n\n switchBetweenPayPalandOrderButton() {\n const currentPaymentMethod = jQuery(\n 'input[name=\"payment_method\"]:checked').val();\n\n if (currentPaymentMethod !== 'ppcp-gateway' && currentPaymentMethod !== 'ppcp-credit-card-gateway') {\n this.renderer.hideButtons(this.gateway.button.wrapper);\n this.renderer.hideButtons(this.gateway.messages.wrapper);\n this.renderer.hideButtons(this.gateway.hosted_fields.wrapper);\n jQuery('#place_order').show();\n }\n else {\n jQuery('#place_order').hide();\n if (currentPaymentMethod === 'ppcp-gateway') {\n this.renderer.showButtons(this.gateway.button.wrapper);\n this.renderer.showButtons(this.gateway.messages.wrapper);\n this.messages.render();\n this.renderer.hideButtons(this.gateway.hosted_fields.wrapper);\n }\n if (currentPaymentMethod === 'ppcp-credit-card-gateway') {\n this.renderer.hideButtons(this.gateway.button.wrapper);\n this.renderer.hideButtons(this.gateway.messages.wrapper);\n this.renderer.showButtons(this.gateway.hosted_fields.wrapper);\n }\n }\n }\n}\n\nexport default PayNowBootstrap;\n","class Renderer {\n constructor(creditCardRenderer, defaultConfig) {\n this.defaultConfig = defaultConfig;\n this.creditCardRenderer = creditCardRenderer;\n }\n\n render(wrapper, hostedFieldsWrapper, contextConfig) {\n\n this.renderButtons(wrapper, contextConfig);\n this.creditCardRenderer.render(hostedFieldsWrapper, contextConfig);\n }\n\n renderButtons(wrapper, contextConfig) {\n if (! document.querySelector(wrapper) || this.isAlreadyRendered(wrapper) || 'undefined' === typeof paypal.Buttons ) {\n return;\n }\n\n const style = wrapper === this.defaultConfig.button.wrapper ? this.defaultConfig.button.style : this.defaultConfig.button.mini_cart_style;\n paypal.Buttons({\n style,\n ...contextConfig,\n }).render(wrapper);\n }\n\n isAlreadyRendered(wrapper) {\n return document.querySelector(wrapper).hasChildNodes();\n }\n\n hideButtons(element) {\n const domElement = document.querySelector(element);\n if (! domElement ) {\n return false;\n }\n domElement.style.display = 'none';\n return true;\n }\n\n showButtons(element) {\n const domElement = document.querySelector(element);\n if (! domElement ) {\n return false;\n }\n domElement.style.display = 'block';\n return true;\n }\n}\n\nexport default Renderer;","const dccInputFactory = (original) => {\n const styles = window.getComputedStyle(original);\n const newElement = document.createElement('span');\n newElement.setAttribute('id', original.id);\n Object.values(styles).forEach( (prop) => {\n if (! styles[prop] || ! isNaN(prop) ) {\n return;\n }\n newElement.style.setProperty(prop,'' + styles[prop]);\n });\n return newElement;\n}\n\nexport default dccInputFactory;","import dccInputFactory from \"../Helper/DccInputFactory\";\n\nclass CreditCardRenderer {\n\n constructor(defaultConfig, errorHandler, spinner) {\n this.defaultConfig = defaultConfig;\n this.errorHandler = errorHandler;\n this.spinner = spinner;\n this.cardValid = false;\n }\n\n render(wrapper, contextConfig) {\n\n if (\n (\n this.defaultConfig.context !== 'checkout'\n && this.defaultConfig.context !== 'pay-now'\n )\n || wrapper === null\n || document.querySelector(wrapper) === null\n ) {\n return;\n }\n if (\n typeof paypal.HostedFields === 'undefined'\n || ! paypal.HostedFields.isEligible()\n ) {\n const wrapperElement = document.querySelector(wrapper);\n wrapperElement.parentNode.removeChild(wrapperElement);\n return;\n }\n\n const gateWayBox = document.querySelector('.payment_box.payment_method_ppcp-credit-card-gateway');\n const oldDisplayStyle = gateWayBox.style.display;\n gateWayBox.style.display = 'block';\n\n const hideDccGateway = document.querySelector('#ppcp-hide-dcc');\n if (hideDccGateway) {\n hideDccGateway.parentNode.removeChild(hideDccGateway);\n }\n\n const cardNumberField = document.querySelector('#ppcp-credit-card-gateway-card-number');\n\n const stylesRaw = window.getComputedStyle(cardNumberField);\n let styles = {};\n Object.values(stylesRaw).forEach( (prop) => {\n if (! stylesRaw[prop]) {\n return;\n }\n styles[prop] = '' + stylesRaw[prop];\n });\n\n const cardNumber = dccInputFactory(cardNumberField);\n cardNumberField.parentNode.replaceChild(cardNumber, cardNumberField);\n\n const cardExpiryField = document.querySelector('#ppcp-credit-card-gateway-card-expiry');\n const cardExpiry = dccInputFactory(cardExpiryField);\n cardExpiryField.parentNode.replaceChild(cardExpiry, cardExpiryField);\n\n const cardCodeField = document.querySelector('#ppcp-credit-card-gateway-card-cvc');\n const cardCode = dccInputFactory(cardCodeField);\n cardCodeField.parentNode.replaceChild(cardCode, cardCodeField);\n\n gateWayBox.style.display = oldDisplayStyle;\n\n const formWrapper = '.payment_box payment_method_ppcp-credit-card-gateway';\n if (\n this.defaultConfig.enforce_vault\n && document.querySelector(formWrapper + ' .ppcp-credit-card-vault')\n ) {\n document.querySelector(formWrapper + ' .ppcp-credit-card-vault').checked = true;\n document.querySelector(formWrapper + ' .ppcp-credit-card-vault').setAttribute('disabled', true);\n }\n paypal.HostedFields.render({\n createOrder: contextConfig.createOrder,\n styles: {\n 'input': styles\n },\n fields: {\n number: {\n selector: '#ppcp-credit-card-gateway-card-number',\n placeholder: this.defaultConfig.hosted_fields.labels.credit_card_number,\n },\n cvv: {\n selector: '#ppcp-credit-card-gateway-card-cvc',\n placeholder: this.defaultConfig.hosted_fields.labels.cvv,\n },\n expirationDate: {\n selector: '#ppcp-credit-card-gateway-card-expiry',\n placeholder: this.defaultConfig.hosted_fields.labels.mm_yyyy,\n }\n }\n }).then(hostedFields => {\n const submitEvent = (event) => {\n this.spinner.block();\n if (event) {\n event.preventDefault();\n }\n this.errorHandler.clear();\n const state = hostedFields.getState();\n const formValid = Object.keys(state.fields).every(function (key) {\n return state.fields[key].isValid;\n });\n\n if (formValid && this.cardValid) {\n\n let vault = document.querySelector(wrapper + ' .ppcp-credit-card-vault') ?\n document.querySelector(wrapper + ' .ppcp-credit-card-vault').checked : false;\n vault = this.defaultConfig.enforce_vault || vault;\n\n hostedFields.submit({\n contingencies: ['3D_SECURE'],\n vault\n }).then((payload) => {\n payload.orderID = payload.orderId;\n this.spinner.unblock();\n return contextConfig.onApprove(payload);\n });\n } else {\n this.spinner.unblock();\n const message = ! this.cardValid ? this.defaultConfig.hosted_fields.labels.card_not_supported : this.defaultConfig.hosted_fields.labels.fields_not_valid;\n this.errorHandler.message(message);\n }\n }\n hostedFields.on('inputSubmitRequest', function () {\n submitEvent(null);\n });\n hostedFields.on('cardTypeChange', (event) => {\n if ( ! event.cards.length ) {\n this.cardValid = false;\n return;\n }\n const validCards = this.defaultConfig.hosted_fields.valid_cards;\n this.cardValid = validCards.indexOf(event.cards[0].type) !== -1;\n })\n document.querySelector(wrapper + ' button').addEventListener(\n 'click',\n submitEvent\n );\n });\n\n document.querySelector('#payment_method_ppcp-credit-card-gateway').addEventListener(\n 'click',\n () => {\n document.querySelector('label[for=ppcp-credit-card-gateway-card-number]').click();\n }\n )\n }\n}\nexport default CreditCardRenderer;","const storageKey = 'ppcp-data-client-id';\n\nconst validateToken = (token, user) => {\n if (! token) {\n return false;\n }\n if (token.user !== user) {\n return false;\n }\n const currentTime = new Date().getTime();\n const isExpired = currentTime >= token.expiration * 1000;\n return ! isExpired;\n}\n\nconst storedTokenForUser = (user) => {\n const token = JSON.parse(sessionStorage.getItem(storageKey));\n if (validateToken(token, user)) {\n return token.token;\n }\n return null;\n}\n\nconst storeToken = (token) => {\n sessionStorage.setItem(storageKey, JSON.stringify(token));\n}\n\nconst dataClientIdAttributeHandler = (script, config) => {\n const token = storedTokenForUser(config.user);\n if (token) {\n script.setAttribute('data-client-token', token);\n document.body.append(script);\n return;\n }\n fetch(config.endpoint, {\n method: 'POST',\n body: JSON.stringify({\n nonce: config.nonce\n })\n }).then((res)=>{\n return res.json();\n }).then((data)=>{\n const isValid = validateToken(data, config.user);\n if (!isValid) {\n return;\n }\n storeToken(data);\n script.setAttribute('data-client-token', data.token);\n document.body.append(script);\n });\n}\n\nexport default dataClientIdAttributeHandler;","class MessageRenderer {\n\n constructor(config) {\n this.config = config;\n }\n\n render() {\n if (! this.shouldRender()) {\n return;\n }\n\n paypal.Messages({\n amount: this.config.amount,\n placement: this.config.placement,\n style: this.config.style\n }).render(this.config.wrapper);\n }\n\n renderWithAmount(amount) {\n\n if (! this.shouldRender()) {\n return;\n }\n\n const newWrapper = document.createElement('div');\n newWrapper.setAttribute('id', this.config.wrapper.replace('#', ''));\n\n const sibling = document.querySelector(this.config.wrapper).nextSibling;\n document.querySelector(this.config.wrapper).parentElement.removeChild(document.querySelector(this.config.wrapper));\n sibling.parentElement.insertBefore(newWrapper, sibling);\n paypal.Messages({\n amount,\n placement: this.config.placement,\n style: this.config.style\n }).render(this.config.wrapper);\n }\n\n shouldRender() {\n\n if (typeof paypal.Messages === 'undefined' || typeof this.config.wrapper === 'undefined' ) {\n return false;\n }\n if (! document.querySelector(this.config.wrapper)) {\n return false;\n }\n return true;\n }\n}\nexport default MessageRenderer;","class Spinner {\n\n constructor() {\n this.target = 'form.woocommerce-checkout';\n }\n\n setTarget(target) {\n this.target = target;\n }\n\n block() {\n\n jQuery( this.target ).block({\n message: null,\n overlayCSS: {\n background: '#fff',\n opacity: 0.6\n }\n });\n }\n\n unblock() {\n\n jQuery( this.target ).unblock();\n }\n}\n\nexport default Spinner;\n","import MiniCartBootstap from './modules/ContextBootstrap/MiniCartBootstap';\nimport SingleProductBootstap from './modules/ContextBootstrap/SingleProductBootstap';\nimport CartBootstrap from './modules/ContextBootstrap/CartBootstap';\nimport CheckoutBootstap from './modules/ContextBootstrap/CheckoutBootstap';\nimport PayNowBootstrap from \"./modules/ContextBootstrap/PayNowBootstrap\";\nimport Renderer from './modules/Renderer/Renderer';\nimport ErrorHandler from './modules/ErrorHandler';\nimport CreditCardRenderer from \"./modules/Renderer/CreditCardRenderer\";\nimport dataClientIdAttributeHandler from \"./modules/DataClientIdAttributeHandler\";\nimport MessageRenderer from \"./modules/Renderer/MessageRenderer\";\nimport Spinner from \"./modules/Helper/Spinner\";\n\nconst bootstrap = () => {\n const errorHandler = new ErrorHandler(PayPalCommerceGateway.labels.error.generic);\n const spinner = new Spinner();\n const creditCardRenderer = new CreditCardRenderer(PayPalCommerceGateway, errorHandler, spinner);\n const renderer = new Renderer(creditCardRenderer, PayPalCommerceGateway);\n const messageRenderer = new MessageRenderer(PayPalCommerceGateway.messages);\n const context = PayPalCommerceGateway.context;\n if (context === 'mini-cart' || context === 'product') {\n const miniCartBootstrap = new MiniCartBootstap(\n PayPalCommerceGateway,\n renderer\n );\n\n miniCartBootstrap.init();\n }\n\n if (context === 'product') {\n const singleProductBootstrap = new SingleProductBootstap(\n PayPalCommerceGateway,\n renderer,\n messageRenderer,\n );\n\n singleProductBootstrap.init();\n }\n\n if (context === 'cart') {\n const cartBootstrap = new CartBootstrap(\n PayPalCommerceGateway,\n renderer,\n );\n\n cartBootstrap.init();\n }\n\n if (context === 'checkout') {\n const checkoutBootstap = new CheckoutBootstap(\n PayPalCommerceGateway,\n renderer,\n messageRenderer,\n spinner\n );\n\n checkoutBootstap.init();\n }\n\n if (context === 'pay-now' ) {\n const payNowBootstrap = new PayNowBootstrap(\n PayPalCommerceGateway,\n renderer,\n messageRenderer,\n spinner\n );\n payNowBootstrap.init();\n }\n\n if (context !== 'checkout') {\n messageRenderer.render();\n }\n};\ndocument.addEventListener(\n 'DOMContentLoaded',\n () => {\n if (!typeof (PayPalCommerceGateway)) {\n console.error('PayPal button could not be configured.');\n return;\n }\n const script = document.createElement('script');\n\n script.addEventListener('load', (event) => {\n bootstrap();\n });\n script.setAttribute('src', PayPalCommerceGateway.button.url);\n Object.entries(PayPalCommerceGateway.script_attributes).forEach(\n (keyValue) => {\n script.setAttribute(keyValue[0], keyValue[1]);\n }\n );\n\n if (PayPalCommerceGateway.data_client_id.set_attribute) {\n dataClientIdAttributeHandler(script, PayPalCommerceGateway.data_client_id);\n return;\n }\n\n document.body.append(script);\n },\n);\n"],"sourceRoot":""}
modules/ppcp-button/resources/js/button.js CHANGED
@@ -60,7 +60,8 @@ const bootstrap = () => {
60
  const payNowBootstrap = new PayNowBootstrap(
61
  PayPalCommerceGateway,
62
  renderer,
63
- messageRenderer
 
64
  );
65
  payNowBootstrap.init();
66
  }
@@ -95,4 +96,4 @@ document.addEventListener(
95
 
96
  document.body.append(script);
97
  },
98
- );
60
  const payNowBootstrap = new PayNowBootstrap(
61
  PayPalCommerceGateway,
62
  renderer,
63
+ messageRenderer,
64
+ spinner
65
  );
66
  payNowBootstrap.init();
67
  }
96
 
97
  document.body.append(script);
98
  },
99
+ );
modules/ppcp-button/resources/js/modules/ActionHandler/CheckoutActionHandler.js CHANGED
@@ -16,9 +16,12 @@ class CheckoutActionHandler {
16
  const bnCode = typeof this.config.bn_codes[this.config.context] !== 'undefined' ?
17
  this.config.bn_codes[this.config.context] : '';
18
 
19
-
20
  const errorHandler = this.errorHandler;
 
21
  const formSelector = this.config.context === 'checkout' ? 'form.checkout' : 'form#order_review';
 
 
 
22
  const formValues = jQuery(formSelector).serialize();
23
 
24
  return fetch(this.config.ajax.create_order.endpoint, {
16
  const bnCode = typeof this.config.bn_codes[this.config.context] !== 'undefined' ?
17
  this.config.bn_codes[this.config.context] : '';
18
 
 
19
  const errorHandler = this.errorHandler;
20
+
21
  const formSelector = this.config.context === 'checkout' ? 'form.checkout' : 'form#order_review';
22
+ spinner.setTarget(formSelector);
23
+ spinner.block();
24
+
25
  const formValues = jQuery(formSelector).serialize();
26
 
27
  return fetch(this.config.ajax.create_order.endpoint, {
modules/ppcp-button/resources/js/modules/ContextBootstrap/PayNowBootstrap.js CHANGED
@@ -2,10 +2,11 @@ import ErrorHandler from '../ErrorHandler';
2
  import CheckoutActionHandler from '../ActionHandler/CheckoutActionHandler';
3
 
4
  class PayNowBootstrap {
5
- constructor(gateway, renderer, messages) {
6
  this.gateway = gateway;
7
  this.renderer = renderer;
8
- this.messages = messages
 
9
  }
10
 
11
  init() {
@@ -41,6 +42,7 @@ class PayNowBootstrap {
41
  const actionHandler = new CheckoutActionHandler(
42
  PayPalCommerceGateway,
43
  new ErrorHandler(this.gateway.labels.error.generic),
 
44
  );
45
 
46
  this.renderer.render(
@@ -77,4 +79,4 @@ class PayNowBootstrap {
77
  }
78
  }
79
 
80
- export default PayNowBootstrap;
2
  import CheckoutActionHandler from '../ActionHandler/CheckoutActionHandler';
3
 
4
  class PayNowBootstrap {
5
+ constructor(gateway, renderer, messages, spinner) {
6
  this.gateway = gateway;
7
  this.renderer = renderer;
8
+ this.messages = messages;
9
+ this.spinner = spinner;
10
  }
11
 
12
  init() {
42
  const actionHandler = new CheckoutActionHandler(
43
  PayPalCommerceGateway,
44
  new ErrorHandler(this.gateway.labels.error.generic),
45
+ this.spinner
46
  );
47
 
48
  this.renderer.render(
79
  }
80
  }
81
 
82
+ export default PayNowBootstrap;
modules/ppcp-button/resources/js/modules/Helper/Spinner.js CHANGED
@@ -3,6 +3,11 @@ class Spinner {
3
  constructor() {
4
  this.target = 'form.woocommerce-checkout';
5
  }
 
 
 
 
 
6
  block() {
7
 
8
  jQuery( this.target ).block({
@@ -20,4 +25,4 @@ class Spinner {
20
  }
21
  }
22
 
23
- export default Spinner;
3
  constructor() {
4
  this.target = 'form.woocommerce-checkout';
5
  }
6
+
7
+ setTarget(target) {
8
+ this.target = target;
9
+ }
10
+
11
  block() {
12
 
13
  jQuery( this.target ).block({
25
  }
26
  }
27
 
28
+ export default Spinner;
modules/ppcp-button/src/Assets/class-smartbutton.php CHANGED
@@ -737,7 +737,7 @@ class SmartButton implements SmartButtonInterface {
737
  $region = wc_get_base_location();
738
  $country = $region['country'];
739
  if ( 'GB' === $country ) {
740
- $disable_funding[] = 'card';
741
  }
742
  $params['disable-funding'] = implode( ',', array_unique( $disable_funding ) );
743
 
@@ -840,6 +840,10 @@ class SmartButton implements SmartButtonInterface {
840
  ) {
841
  $load_buttons = true;
842
  }
 
 
 
 
843
  return $load_buttons;
844
  }
845
 
737
  $region = wc_get_base_location();
738
  $country = $region['country'];
739
  if ( 'GB' === $country ) {
740
+ $disable_funding[] = 'credit';
741
  }
742
  $params['disable-funding'] = implode( ',', array_unique( $disable_funding ) );
743
 
840
  ) {
841
  $load_buttons = true;
842
  }
843
+ if ( $this->context() === 'pay-now' ) {
844
+ $load_buttons = true;
845
+ }
846
+
847
  return $load_buttons;
848
  }
849
 
modules/ppcp-button/src/Endpoint/class-createorderendpoint.php CHANGED
@@ -175,7 +175,7 @@ class CreateOrderEndpoint implements EndpointInterface {
175
  if ( 'checkout' === $data['context'] ) {
176
  $this->validate_checkout_form( $data['form'], $order );
177
  }
178
- if ( 'pay-now' === $data['context'] ) {
179
  $this->validate_paynow_form( $data['form'] );
180
  }
181
  wp_send_json_success( $order->to_array() );
175
  if ( 'checkout' === $data['context'] ) {
176
  $this->validate_checkout_form( $data['form'], $order );
177
  }
178
+ if ( 'pay-now' === $data['context'] && get_option( 'woocommerce_terms_page_id', '' ) !== '' ) {
179
  $this->validate_paynow_form( $data['form'] );
180
  }
181
  wp_send_json_success( $order->to_array() );
modules/ppcp-webhooks/src/class-webhookregistrar.php CHANGED
@@ -83,10 +83,6 @@ class WebhookRegistrar {
83
  );
84
  return true;
85
  } catch ( RuntimeException $error ) {
86
- wp_schedule_single_event(
87
- time() - 1,
88
- self::EVENT_HOOK
89
- );
90
  return false;
91
  }
92
  }
83
  );
84
  return true;
85
  } catch ( RuntimeException $error ) {
 
 
 
 
86
  return false;
87
  }
88
  }
package-lock.json CHANGED
@@ -1,11 +1,11 @@
1
  {
2
  "name": "woocommerce-paypal-payments",
3
- "version": "1.0.3",
4
  "lockfileVersion": 2,
5
  "requires": true,
6
  "packages": {
7
  "": {
8
- "version": "1.0.3",
9
  "license": "GPL-2.0",
10
  "devDependencies": {}
11
  }
1
  {
2
  "name": "woocommerce-paypal-payments",
3
+ "version": "1.0.4",
4
  "lockfileVersion": 2,
5
  "requires": true,
6
  "packages": {
7
  "": {
8
+ "version": "1.0.4",
9
  "license": "GPL-2.0",
10
  "devDependencies": {}
11
  }
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: woocommerce, paypal, payments, ecommerce, e-commerce, store, sales, sell,
4
  Requires at least: 5.3
5
  Tested up to: 5.6
6
  Requires PHP: 7.0
7
- Stable tag: 1.0.3
8
  License: GPLv2
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -58,6 +58,12 @@ Follow the steps below to connect the plugin to your PayPal account:
58
 
59
  == Changelog ==
60
 
 
 
 
 
 
 
61
  = 1.0.3 =
62
  * Fix - Order with Payment received when Hosted Fields transaction is declined. #88
63
 
4
  Requires at least: 5.3
5
  Tested up to: 5.6
6
  Requires PHP: 7.0
7
+ Stable tag: 1.0.4
8
  License: GPLv2
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
58
 
59
  == Changelog ==
60
 
61
+ = 1.0.4 =
62
+ * Fix - Check if WooCommerce is active before initialize. #99
63
+ * Fix - Payment buttons only visible on order-pay site when Mini Cart is enabled; payment fails. #96
64
+ * Fix - High volume of failed calls to /v1/notifications/webhooks #93
65
+ * Fix - GB country has ACDC blocked. #91
66
+
67
  = 1.0.3 =
68
  * Fix - Order with Payment received when Hosted Fields transaction is declined. #88
69
 
vendor/autoload.php CHANGED
@@ -4,4 +4,4 @@
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
- return ComposerAutoloaderInit49901b8419ad001b0370271fab697743::getLoader();
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
+ return ComposerAutoloaderInitd155c2047eaef319e1c9510b94fc195a::getLoader();
vendor/composer/autoload_real.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
- class ComposerAutoloaderInit49901b8419ad001b0370271fab697743
6
  {
7
  private static $loader;
8
 
@@ -22,15 +22,15 @@ class ComposerAutoloaderInit49901b8419ad001b0370271fab697743
22
  return self::$loader;
23
  }
24
 
25
- spl_autoload_register(array('ComposerAutoloaderInit49901b8419ad001b0370271fab697743', 'loadClassLoader'), true, true);
26
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
27
- spl_autoload_unregister(array('ComposerAutoloaderInit49901b8419ad001b0370271fab697743', 'loadClassLoader'));
28
 
29
  $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
30
  if ($useStaticLoader) {
31
  require_once __DIR__ . '/autoload_static.php';
32
 
33
- call_user_func(\Composer\Autoload\ComposerStaticInit49901b8419ad001b0370271fab697743::getInitializer($loader));
34
  } else {
35
  $map = require __DIR__ . '/autoload_namespaces.php';
36
  foreach ($map as $namespace => $path) {
@@ -51,19 +51,19 @@ class ComposerAutoloaderInit49901b8419ad001b0370271fab697743
51
  $loader->register(true);
52
 
53
  if ($useStaticLoader) {
54
- $includeFiles = Composer\Autoload\ComposerStaticInit49901b8419ad001b0370271fab697743::$files;
55
  } else {
56
  $includeFiles = require __DIR__ . '/autoload_files.php';
57
  }
58
  foreach ($includeFiles as $fileIdentifier => $file) {
59
- composerRequire49901b8419ad001b0370271fab697743($fileIdentifier, $file);
60
  }
61
 
62
  return $loader;
63
  }
64
  }
65
 
66
- function composerRequire49901b8419ad001b0370271fab697743($fileIdentifier, $file)
67
  {
68
  if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
69
  require $file;
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
+ class ComposerAutoloaderInitd155c2047eaef319e1c9510b94fc195a
6
  {
7
  private static $loader;
8
 
22
  return self::$loader;
23
  }
24
 
25
+ spl_autoload_register(array('ComposerAutoloaderInitd155c2047eaef319e1c9510b94fc195a', 'loadClassLoader'), true, true);
26
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
27
+ spl_autoload_unregister(array('ComposerAutoloaderInitd155c2047eaef319e1c9510b94fc195a', 'loadClassLoader'));
28
 
29
  $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
30
  if ($useStaticLoader) {
31
  require_once __DIR__ . '/autoload_static.php';
32
 
33
+ call_user_func(\Composer\Autoload\ComposerStaticInitd155c2047eaef319e1c9510b94fc195a::getInitializer($loader));
34
  } else {
35
  $map = require __DIR__ . '/autoload_namespaces.php';
36
  foreach ($map as $namespace => $path) {
51
  $loader->register(true);
52
 
53
  if ($useStaticLoader) {
54
+ $includeFiles = Composer\Autoload\ComposerStaticInitd155c2047eaef319e1c9510b94fc195a::$files;
55
  } else {
56
  $includeFiles = require __DIR__ . '/autoload_files.php';
57
  }
58
  foreach ($includeFiles as $fileIdentifier => $file) {
59
+ composerRequired155c2047eaef319e1c9510b94fc195a($fileIdentifier, $file);
60
  }
61
 
62
  return $loader;
63
  }
64
  }
65
 
66
+ function composerRequired155c2047eaef319e1c9510b94fc195a($fileIdentifier, $file)
67
  {
68
  if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
69
  require $file;
vendor/composer/autoload_static.php CHANGED
@@ -4,7 +4,7 @@
4
 
5
  namespace Composer\Autoload;
6
 
7
- class ComposerStaticInit49901b8419ad001b0370271fab697743
8
  {
9
  public static $files = array (
10
  '7b11c4dc42b3b3023073cb14e519683c' => __DIR__ . '/..' . '/ralouphie/getallheaders/src/getallheaders.php',
@@ -252,9 +252,9 @@ class ComposerStaticInit49901b8419ad001b0370271fab697743
252
  public static function getInitializer(ClassLoader $loader)
253
  {
254
  return \Closure::bind(function () use ($loader) {
255
- $loader->prefixLengthsPsr4 = ComposerStaticInit49901b8419ad001b0370271fab697743::$prefixLengthsPsr4;
256
- $loader->prefixDirsPsr4 = ComposerStaticInit49901b8419ad001b0370271fab697743::$prefixDirsPsr4;
257
- $loader->classMap = ComposerStaticInit49901b8419ad001b0370271fab697743::$classMap;
258
 
259
  }, null, ClassLoader::class);
260
  }
4
 
5
  namespace Composer\Autoload;
6
 
7
+ class ComposerStaticInitd155c2047eaef319e1c9510b94fc195a
8
  {
9
  public static $files = array (
10
  '7b11c4dc42b3b3023073cb14e519683c' => __DIR__ . '/..' . '/ralouphie/getallheaders/src/getallheaders.php',
252
  public static function getInitializer(ClassLoader $loader)
253
  {
254
  return \Closure::bind(function () use ($loader) {
255
+ $loader->prefixLengthsPsr4 = ComposerStaticInitd155c2047eaef319e1c9510b94fc195a::$prefixLengthsPsr4;
256
+ $loader->prefixDirsPsr4 = ComposerStaticInitd155c2047eaef319e1c9510b94fc195a::$prefixDirsPsr4;
257
+ $loader->classMap = ComposerStaticInitd155c2047eaef319e1c9510b94fc195a::$classMap;
258
 
259
  }, null, ClassLoader::class);
260
  }
vendor/composer/installed.json CHANGED
@@ -1,17 +1,17 @@
1
  [
2
  {
3
  "name": "composer/installers",
4
- "version": "v1.9.0",
5
- "version_normalized": "1.9.0.0",
6
  "source": {
7
  "type": "git",
8
  "url": "https://github.com/composer/installers.git",
9
- "reference": "b93bcf0fa1fccb0b7d176b0967d969691cd74cca"
10
  },
11
  "dist": {
12
  "type": "zip",
13
- "url": "https://api.github.com/repos/composer/installers/zipball/b93bcf0fa1fccb0b7d176b0967d969691cd74cca",
14
- "reference": "b93bcf0fa1fccb0b7d176b0967d969691cd74cca",
15
  "shasum": ""
16
  },
17
  "require": {
@@ -22,18 +22,19 @@
22
  "shama/baton": "*"
23
  },
24
  "require-dev": {
25
- "composer/composer": "1.6.* || 2.0.*@dev",
26
- "composer/semver": "1.0.* || 2.0.*@dev",
27
- "phpunit/phpunit": "^4.8.36",
28
- "sebastian/comparator": "^1.2.4",
 
29
  "symfony/process": "^2.3"
30
  },
31
- "time": "2020-04-07T06:57:05+00:00",
32
  "type": "composer-plugin",
33
  "extra": {
34
  "class": "Composer\\Installers\\Plugin",
35
  "branch-alias": {
36
- "dev-master": "1.0-dev"
37
  }
38
  },
39
  "installation-source": "dist",
@@ -72,6 +73,7 @@
72
  "Porto",
73
  "RadPHP",
74
  "SMF",
 
75
  "Thelia",
76
  "Whmcs",
77
  "WolfCMS",
@@ -112,6 +114,7 @@
112
  "phpbb",
113
  "piwik",
114
  "ppi",
 
115
  "puppet",
116
  "pxcms",
117
  "reindex",
@@ -132,6 +135,10 @@
132
  "url": "https://packagist.com",
133
  "type": "custom"
134
  },
 
 
 
 
135
  {
136
  "url": "https://tidelift.com/funding/github/packagist/composer/composer",
137
  "type": "tidelift"
@@ -173,29 +180,29 @@
173
  },
174
  {
175
  "name": "dhii/collections-interface",
176
- "version": "v0.3.0-alpha2",
177
- "version_normalized": "0.3.0.0-alpha2",
178
  "source": {
179
  "type": "git",
180
  "url": "https://github.com/Dhii/collections-interface.git",
181
- "reference": "0fa5a14c407995cb0b9634ee42f127a91f24aafc"
182
  },
183
  "dist": {
184
  "type": "zip",
185
- "url": "https://api.github.com/repos/Dhii/collections-interface/zipball/0fa5a14c407995cb0b9634ee42f127a91f24aafc",
186
- "reference": "0fa5a14c407995cb0b9634ee42f127a91f24aafc",
187
  "shasum": ""
188
  },
189
  "require": {
190
- "php": "^7.1",
191
  "psr/container": "^1.0"
192
  },
193
  "require-dev": {
194
- "phpunit/phpunit": "^7.0 | ^8.0",
195
  "slevomat/coding-standard": "^6.0",
196
- "vimeo/psalm": "^3.0"
197
  },
198
- "time": "2020-10-13T08:27:37+00:00",
199
  "type": "library",
200
  "extra": {
201
  "branch-alias": {
1
  [
2
  {
3
  "name": "composer/installers",
4
+ "version": "v1.10.0",
5
+ "version_normalized": "1.10.0.0",
6
  "source": {
7
  "type": "git",
8
  "url": "https://github.com/composer/installers.git",
9
+ "reference": "1a0357fccad9d1cc1ea0c9a05b8847fbccccb78d"
10
  },
11
  "dist": {
12
  "type": "zip",
13
+ "url": "https://api.github.com/repos/composer/installers/zipball/1a0357fccad9d1cc1ea0c9a05b8847fbccccb78d",
14
+ "reference": "1a0357fccad9d1cc1ea0c9a05b8847fbccccb78d",
15
  "shasum": ""
16
  },
17
  "require": {
22
  "shama/baton": "*"
23
  },
24
  "require-dev": {
25
+ "composer/composer": "1.6.* || ^2.0",
26
+ "composer/semver": "^1 || ^3",
27
+ "phpstan/phpstan": "^0.12.55",
28
+ "phpstan/phpstan-phpunit": "^0.12.16",
29
+ "symfony/phpunit-bridge": "^4.2 || ^5",
30
  "symfony/process": "^2.3"
31
  },
32
+ "time": "2021-01-14T11:07:16+00:00",
33
  "type": "composer-plugin",
34
  "extra": {
35
  "class": "Composer\\Installers\\Plugin",
36
  "branch-alias": {
37
+ "dev-main": "1.x-dev"
38
  }
39
  },
40
  "installation-source": "dist",
73
  "Porto",
74
  "RadPHP",
75
  "SMF",
76
+ "Starbug",
77
  "Thelia",
78
  "Whmcs",
79
  "WolfCMS",
114
  "phpbb",
115
  "piwik",
116
  "ppi",
117
+ "processwire",
118
  "puppet",
119
  "pxcms",
120
  "reindex",
135
  "url": "https://packagist.com",
136
  "type": "custom"
137
  },
138
+ {
139
+ "url": "https://github.com/composer",
140
+ "type": "github"
141
+ },
142
  {
143
  "url": "https://tidelift.com/funding/github/packagist/composer/composer",
144
  "type": "tidelift"
180
  },
181
  {
182
  "name": "dhii/collections-interface",
183
+ "version": "v0.3.0-alpha3",
184
+ "version_normalized": "0.3.0.0-alpha3",
185
  "source": {
186
  "type": "git",
187
  "url": "https://github.com/Dhii/collections-interface.git",
188
+ "reference": "7c7c4b4459dda9e6db406860d99916d0cee58ccf"
189
  },
190
  "dist": {
191
  "type": "zip",
192
+ "url": "https://api.github.com/repos/Dhii/collections-interface/zipball/7c7c4b4459dda9e6db406860d99916d0cee58ccf",
193
+ "reference": "7c7c4b4459dda9e6db406860d99916d0cee58ccf",
194
  "shasum": ""
195
  },
196
  "require": {
197
+ "php": "^7.1 | ^8.0",
198
  "psr/container": "^1.0"
199
  },
200
  "require-dev": {
201
+ "phpunit/phpunit": "^7.0 | ^8.0 | ^9.0",
202
  "slevomat/coding-standard": "^6.0",
203
+ "vimeo/psalm": "^3.11.7 | ^4.0"
204
  },
205
+ "time": "2021-01-14T17:33:46+00:00",
206
  "type": "library",
207
  "extra": {
208
  "branch-alias": {
vendor/composer/installers/composer.json CHANGED
@@ -57,12 +57,14 @@
57
  "PPI",
58
  "Puppet",
59
  "Porto",
 
60
  "RadPHP",
61
  "ReIndex",
62
  "Roundcube",
63
  "shopware",
64
  "SilverStripe",
65
  "SMF",
 
66
  "SyDES",
67
  "Sylius",
68
  "symfony",
@@ -86,10 +88,13 @@
86
  "autoload": {
87
  "psr-4": { "Composer\\Installers\\": "src/Composer/Installers" }
88
  },
 
 
 
89
  "extra": {
90
  "class": "Composer\\Installers\\Plugin",
91
  "branch-alias": {
92
- "dev-master": "1.0-dev"
93
  }
94
  },
95
  "replace": {
@@ -100,13 +105,15 @@
100
  "composer-plugin-api": "^1.0 || ^2.0"
101
  },
102
  "require-dev": {
103
- "composer/composer": "1.6.* || 2.0.*@dev",
104
- "composer/semver": "1.0.* || 2.0.*@dev",
105
- "phpunit/phpunit": "^4.8.36",
106
- "sebastian/comparator": "^1.2.4",
107
- "symfony/process": "^2.3"
 
108
  },
109
  "scripts": {
110
- "test": "phpunit"
 
111
  }
112
  }
57
  "PPI",
58
  "Puppet",
59
  "Porto",
60
+ "ProcessWire",
61
  "RadPHP",
62
  "ReIndex",
63
  "Roundcube",
64
  "shopware",
65
  "SilverStripe",
66
  "SMF",
67
+ "Starbug",
68
  "SyDES",
69
  "Sylius",
70
  "symfony",
88
  "autoload": {
89
  "psr-4": { "Composer\\Installers\\": "src/Composer/Installers" }
90
  },
91
+ "autoload-dev": {
92
+ "psr-4": { "Composer\\Installers\\Test\\": "tests/Composer/Installers/Test" }
93
+ },
94
  "extra": {
95
  "class": "Composer\\Installers\\Plugin",
96
  "branch-alias": {
97
+ "dev-main": "1.x-dev"
98
  }
99
  },
100
  "replace": {
105
  "composer-plugin-api": "^1.0 || ^2.0"
106
  },
107
  "require-dev": {
108
+ "composer/composer": "1.6.* || ^2.0",
109
+ "composer/semver": "^1 || ^3",
110
+ "symfony/phpunit-bridge": "^4.2 || ^5",
111
+ "phpstan/phpstan": "^0.12.55",
112
+ "symfony/process": "^2.3",
113
+ "phpstan/phpstan-phpunit": "^0.12.16"
114
  },
115
  "scripts": {
116
+ "test": "SYMFONY_PHPUNIT_REMOVE_RETURN_TYPEHINT=1 vendor/bin/simple-phpunit",
117
+ "phpstan": "vendor/bin/phpstan analyse"
118
  }
119
  }
vendor/composer/installers/phpstan.neon.dist ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ parameters:
2
+ level: 5
3
+ paths:
4
+ - src
5
+ - tests
6
+ excludes_analyse:
7
+ - tests/Composer/Installers/Test/PolyfillTestCase.php
8
+
9
+ includes:
10
+ - vendor/phpstan/phpstan-phpunit/extension.neon
vendor/composer/installers/src/Composer/Installers/BaseInstaller.php CHANGED
@@ -74,8 +74,8 @@ abstract class BaseInstaller
74
  /**
75
  * For an installer to override to modify the vars per installer.
76
  *
77
- * @param array $vars
78
- * @return array
79
  */
80
  public function inflectPackageVars($vars)
81
  {
@@ -85,7 +85,7 @@ abstract class BaseInstaller
85
  /**
86
  * Gets the installer's locations
87
  *
88
- * @return array
89
  */
90
  public function getLocations()
91
  {
@@ -95,8 +95,8 @@ abstract class BaseInstaller
95
  /**
96
  * Replace vars in a path
97
  *
98
- * @param string $path
99
- * @param array $vars
100
  * @return string
101
  */
102
  protected function templatePath($path, array $vars = array())
@@ -121,7 +121,7 @@ abstract class BaseInstaller
121
  * @param string $name
122
  * @param string $type
123
  * @param string $vendor = NULL
124
- * @return string
125
  */
126
  protected function mapCustomInstallPaths(array $paths, $name, $type, $vendor = NULL)
127
  {
74
  /**
75
  * For an installer to override to modify the vars per installer.
76
  *
77
+ * @param array<string, string> $vars This will normally receive array{name: string, vendor: string, type: string}
78
+ * @return array<string, string>
79
  */
80
  public function inflectPackageVars($vars)
81
  {
85
  /**
86
  * Gets the installer's locations
87
  *
88
+ * @return array<string, string> map of package types => install path
89
  */
90
  public function getLocations()
91
  {
95
  /**
96
  * Replace vars in a path
97
  *
98
+ * @param string $path
99
+ * @param array<string, string> $vars
100
  * @return string
101
  */
102
  protected function templatePath($path, array $vars = array())
121
  * @param string $name
122
  * @param string $type
123
  * @param string $vendor = NULL
124
+ * @return string|false
125
  */
126
  protected function mapCustomInstallPaths(array $paths, $name, $type, $vendor = NULL)
127
  {
vendor/composer/installers/src/Composer/Installers/CakePHPInstaller.php CHANGED
@@ -2,6 +2,7 @@
2
  namespace Composer\Installers;
3
 
4
  use Composer\DependencyResolver\Pool;
 
5
 
6
  class CakePHPInstaller extends BaseInstaller
7
  {
@@ -49,14 +50,6 @@ class CakePHPInstaller extends BaseInstaller
49
  */
50
  protected function matchesCakeVersion($matcher, $version)
51
  {
52
- if (class_exists('Composer\Semver\Constraint\MultiConstraint')) {
53
- $multiClass = 'Composer\Semver\Constraint\MultiConstraint';
54
- $constraintClass = 'Composer\Semver\Constraint\Constraint';
55
- } else {
56
- $multiClass = 'Composer\Package\LinkConstraint\MultiConstraint';
57
- $constraintClass = 'Composer\Package\LinkConstraint\VersionConstraint';
58
- }
59
-
60
  $repositoryManager = $this->composer->getRepositoryManager();
61
  if (! $repositoryManager) {
62
  return false;
@@ -67,6 +60,6 @@ class CakePHPInstaller extends BaseInstaller
67
  return false;
68
  }
69
 
70
- return $repos->findPackage('cakephp/cakephp', new $constraintClass($matcher, $version)) !== null;
71
  }
72
  }
2
  namespace Composer\Installers;
3
 
4
  use Composer\DependencyResolver\Pool;
5
+ use Composer\Semver\Constraint\Constraint;
6
 
7
  class CakePHPInstaller extends BaseInstaller
8
  {
50
  */
51
  protected function matchesCakeVersion($matcher, $version)
52
  {
 
 
 
 
 
 
 
 
53
  $repositoryManager = $this->composer->getRepositoryManager();
54
  if (! $repositoryManager) {
55
  return false;
60
  return false;
61
  }
62
 
63
+ return $repos->findPackage('cakephp/cakephp', new Constraint($matcher, $version)) !== null;
64
  }
65
  }
vendor/composer/installers/src/Composer/Installers/CockpitInstaller.php CHANGED
@@ -12,9 +12,7 @@ class CockpitInstaller extends BaseInstaller
12
  *
13
  * Strip `module-` prefix from package name.
14
  *
15
- * @param array @vars
16
- *
17
- * @return array
18
  */
19
  public function inflectPackageVars($vars)
20
  {
12
  *
13
  * Strip `module-` prefix from package name.
14
  *
15
+ * {@inheritDoc}
 
 
16
  */
17
  public function inflectPackageVars($vars)
18
  {
vendor/composer/installers/src/Composer/Installers/Installer.php CHANGED
@@ -9,6 +9,7 @@ use Composer\IO\IOInterface;
9
  use Composer\Package\PackageInterface;
10
  use Composer\Repository\InstalledRepositoryInterface;
11
  use Composer\Util\Filesystem;
 
12
 
13
  class Installer extends LibraryInstaller
14
  {
@@ -87,6 +88,7 @@ class Installer extends LibraryInstaller
87
  'radphp' => 'RadPHPInstaller',
88
  'phifty' => 'PhiftyInstaller',
89
  'porto' => 'PortoInstaller',
 
90
  'redaxo' => 'RedaxoInstaller',
91
  'redaxo5' => 'Redaxo5Installer',
92
  'reindex' => 'ReIndexInstaller',
@@ -95,6 +97,7 @@ class Installer extends LibraryInstaller
95
  'sitedirect' => 'SiteDirectInstaller',
96
  'silverstripe' => 'SilverStripeInstaller',
97
  'smf' => 'SMFInstaller',
 
98
  'sydes' => 'SyDESInstaller',
99
  'sylius' => 'SyliusInstaller',
100
  'symfony1' => 'Symfony1Installer',
@@ -160,9 +163,23 @@ class Installer extends LibraryInstaller
160
 
161
  public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
162
  {
163
- parent::uninstall($repo, $package);
164
  $installPath = $this->getPackageBasePath($package);
165
- $this->io->write(sprintf('Deleting %s - %s', $installPath, !file_exists($installPath) ? '<comment>deleted</comment>' : '<error>not deleted</error>'));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
166
  }
167
 
168
  /**
@@ -184,23 +201,20 @@ class Installer extends LibraryInstaller
184
  /**
185
  * Finds a supported framework type if it exists and returns it
186
  *
187
- * @param string $type
188
- * @return string
189
  */
190
  protected function findFrameworkType($type)
191
  {
192
- $frameworkType = false;
193
-
194
  krsort($this->supportedTypes);
195
 
196
  foreach ($this->supportedTypes as $key => $val) {
197
  if ($key === substr($type, 0, strlen($key))) {
198
- $frameworkType = substr($type, 0, strlen($key));
199
- break;
200
  }
201
  }
202
 
203
- return $frameworkType;
204
  }
205
 
206
  /**
9
  use Composer\Package\PackageInterface;
10
  use Composer\Repository\InstalledRepositoryInterface;
11
  use Composer\Util\Filesystem;
12
+ use React\Promise\PromiseInterface;
13
 
14
  class Installer extends LibraryInstaller
15
  {
88
  'radphp' => 'RadPHPInstaller',
89
  'phifty' => 'PhiftyInstaller',
90
  'porto' => 'PortoInstaller',
91
+ 'processwire' => 'ProcessWireInstaller',
92
  'redaxo' => 'RedaxoInstaller',
93
  'redaxo5' => 'Redaxo5Installer',
94
  'reindex' => 'ReIndexInstaller',
97
  'sitedirect' => 'SiteDirectInstaller',
98
  'silverstripe' => 'SilverStripeInstaller',
99
  'smf' => 'SMFInstaller',
100
+ 'starbug' => 'StarbugInstaller',
101
  'sydes' => 'SyDESInstaller',
102
  'sylius' => 'SyliusInstaller',
103
  'symfony1' => 'Symfony1Installer',
163
 
164
  public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
165
  {
 
166
  $installPath = $this->getPackageBasePath($package);
167
+ $io = $this->io;
168
+ $outputStatus = function () use ($io, $installPath) {
169
+ $io->write(sprintf('Deleting %s - %s', $installPath, !file_exists($installPath) ? '<comment>deleted</comment>' : '<error>not deleted</error>'));
170
+ };
171
+
172
+ $promise = parent::uninstall($repo, $package);
173
+
174
+ // Composer v2 might return a promise here
175
+ if ($promise instanceof PromiseInterface) {
176
+ return $promise->then($outputStatus);
177
+ }
178
+
179
+ // If not, execute the code right away as parent::uninstall executed synchronously (composer v1, or v2 without async)
180
+ $outputStatus();
181
+
182
+ return null;
183
  }
184
 
185
  /**
201
  /**
202
  * Finds a supported framework type if it exists and returns it
203
  *
204
+ * @param string $type
205
+ * @return string|false
206
  */
207
  protected function findFrameworkType($type)
208
  {
 
 
209
  krsort($this->supportedTypes);
210
 
211
  foreach ($this->supportedTypes as $key => $val) {
212
  if ($key === substr($type, 0, strlen($key))) {
213
+ return substr($type, 0, strlen($key));
 
214
  }
215
  }
216
 
217
+ return false;
218
  }
219
 
220
  /**
vendor/composer/installers/src/Composer/Installers/MoodleInstaller.php CHANGED
@@ -18,6 +18,7 @@ class MoodleInstaller extends BaseInstaller
18
  'cachestore' => 'cache/stores/{$name}/',
19
  'cachelock' => 'cache/locks/{$name}/',
20
  'calendartype' => 'calendar/type/{$name}/',
 
21
  'format' => 'course/format/{$name}/',
22
  'coursereport' => 'course/report/{$name}/',
23
  'customcertelement' => 'mod/customcert/element/{$name}/',
18
  'cachestore' => 'cache/stores/{$name}/',
19
  'cachelock' => 'cache/locks/{$name}/',
20
  'calendartype' => 'calendar/type/{$name}/',
21
+ 'fileconverter' => 'files/converter/{$name}/',
22
  'format' => 'course/format/{$name}/',
23
  'coursereport' => 'course/report/{$name}/',
24
  'customcertelement' => 'mod/customcert/element/{$name}/',
vendor/composer/installers/src/Composer/Installers/OxidInstaller.php CHANGED
@@ -18,7 +18,7 @@ class OxidInstaller extends BaseInstaller
18
  *
19
  * @param PackageInterface $package
20
  * @param string $frameworkType
21
- * @return void
22
  */
23
  public function getInstallPath(PackageInterface $package, $frameworkType = '')
24
  {
18
  *
19
  * @param PackageInterface $package
20
  * @param string $frameworkType
21
+ * @return string
22
  */
23
  public function getInstallPath(PackageInterface $package, $frameworkType = '')
24
  {
vendor/composer/installers/src/Composer/Installers/ProcessWireInstaller.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Composer\Installers;
4
+
5
+ class ProcessWireInstaller extends BaseInstaller
6
+ {
7
+ protected $locations = array(
8
+ 'module' => 'site/modules/{$name}/',
9
+ );
10
+
11
+ /**
12
+ * Format package name to CamelCase
13
+ */
14
+ public function inflectPackageVars($vars)
15
+ {
16
+ $vars['name'] = strtolower(preg_replace('/(?<=\\w)([A-Z])/', '_\\1', $vars['name']));
17
+ $vars['name'] = str_replace(array('-', '_'), ' ', $vars['name']);
18
+ $vars['name'] = str_replace(' ', '', ucwords($vars['name']));
19
+
20
+ return $vars;
21
+ }
22
+ }
vendor/composer/installers/src/Composer/Installers/StarbugInstaller.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class StarbugInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'module' => 'modules/{$name}/',
8
+ 'theme' => 'themes/{$name}/',
9
+ 'custom-module' => 'app/modules/{$name}/',
10
+ 'custom-theme' => 'app/themes/{$name}/'
11
+ );
12
+ }
vendor/composer/installers/src/Composer/Installers/SyDESInstaller.php CHANGED
@@ -13,9 +13,7 @@ class SyDESInstaller extends BaseInstaller
13
  *
14
  * Strip `sydes-` prefix and a trailing '-theme' or '-module' from package name if present.
15
  *
16
- * @param array @vars
17
- *
18
- * @return array
19
  */
20
  public function inflectPackageVars($vars)
21
  {
13
  *
14
  * Strip `sydes-` prefix and a trailing '-theme' or '-module' from package name if present.
15
  *
16
+ * {@inerhitDoc}
 
 
17
  */
18
  public function inflectPackageVars($vars)
19
  {
vendor/composer/installers/src/Composer/Installers/TaoInstaller.php CHANGED
@@ -6,7 +6,25 @@ namespace Composer\Installers;
6
  */
7
  class TaoInstaller extends BaseInstaller
8
  {
 
 
9
  protected $locations = array(
10
  'extension' => '{$name}'
11
  );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12
  }
6
  */
7
  class TaoInstaller extends BaseInstaller
8
  {
9
+ const EXTRA_TAO_EXTENSION_NAME = 'tao-extension-name';
10
+
11
  protected $locations = array(
12
  'extension' => '{$name}'
13
  );
14
+
15
+ public function inflectPackageVars($vars)
16
+ {
17
+ $extra = $this->package->getExtra();
18
+
19
+ if (array_key_exists(self::EXTRA_TAO_EXTENSION_NAME, $extra)) {
20
+ $vars['name'] = $extra[self::EXTRA_TAO_EXTENSION_NAME];
21
+ return $vars;
22
+ }
23
+
24
+ $vars['name'] = str_replace('extension-', '', $vars['name']);
25
+ $vars['name'] = str_replace('-', ' ', $vars['name']);
26
+ $vars['name'] = lcfirst(str_replace(' ', '', ucwords($vars['name'])));
27
+
28
+ return $vars;
29
+ }
30
  }
vendor/dhii/collections-interface/.env.example CHANGED
@@ -1,2 +1,6 @@
1
  BASE_PATH=./
2
- PROJECT_NAME=dhii_collections-interface
 
 
 
 
1
  BASE_PATH=./
2
+ BUILD_ROOT_PATH=/app/
3
+ PROJECT_NAME=dhii_collections-interface
4
+
5
+ PHP_BUILD_VERSION=7.1
6
+ PHP_TEST_VERSION=7.4
vendor/dhii/collections-interface/CHANGELOG.md CHANGED
@@ -6,6 +6,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
6
 
7
  ## [[*next-version*]] - YYYY-MM-DD
8
 
 
 
 
 
 
9
  ## [0.3.0-alpha2] - 2020-10-13
10
  ### Added
11
  - `ClearableContainerInterface`.
6
 
7
  ## [[*next-version*]] - YYYY-MM-DD
8
 
9
+ ## [0.3.0-alpha3] - 2021-01-14
10
+ ### Changed
11
+ - Supports PHP 8, and newer tools.
12
+ - Upgraded outdated configuration.
13
+
14
  ## [0.3.0-alpha2] - 2020-10-13
15
  ### Added
16
  - `ClearableContainerInterface`.
vendor/dhii/collections-interface/composer.json CHANGED
@@ -16,13 +16,13 @@
16
  "minimum-stability": "dev",
17
  "prefer-stable": true,
18
  "require": {
19
- "php": "^7.1",
20
  "psr/container": "^1.0"
21
  },
22
  "require-dev": {
23
- "phpunit/phpunit": "^7.0 | ^8.0",
24
  "slevomat/coding-standard": "^6.0",
25
- "vimeo/psalm": "^3.0"
26
  },
27
  "autoload": {
28
  "psr-4": {
@@ -31,7 +31,7 @@
31
  },
32
  "autoload-dev": {
33
  "psr-4": {
34
- "Dhii\\Collection\\UnitTest\\": "test/unit"
35
  }
36
  },
37
  "extra": {
16
  "minimum-stability": "dev",
17
  "prefer-stable": true,
18
  "require": {
19
+ "php": "^7.1 | ^8.0",
20
  "psr/container": "^1.0"
21
  },
22
  "require-dev": {
23
+ "phpunit/phpunit": "^7.0 | ^8.0 | ^9.0",
24
  "slevomat/coding-standard": "^6.0",
25
+ "vimeo/psalm": "^3.11.7 | ^4.0"
26
  },
27
  "autoload": {
28
  "psr-4": {
31
  },
32
  "autoload-dev": {
33
  "psr-4": {
34
+ "Dhii\\Collection\\UnitTest\\": "tests/unit"
35
  }
36
  },
37
  "extra": {
vendor/dhii/collections-interface/docker-compose.yml CHANGED
@@ -1,13 +1,29 @@
1
- version: '3.2'
2
  services:
3
- php:
4
- container_name: "${PROJECT_NAME}_php"
5
  build:
6
- context: docker
7
- dockerfile: Dockerfile_php
 
 
 
 
 
 
8
  volumes:
9
- - ${BASE_PATH}:/srv/
10
- - psalm_cache:/var/tmp/psalm
11
 
12
- volumes:
13
- psalm_cache:
 
 
 
 
 
 
 
 
 
 
 
1
+ version: '3.4'
2
  services:
3
+
4
+ build:
5
  build:
6
+ context: ./
7
+ dockerfile: docker/Dockerfile
8
+ target: build
9
+ args:
10
+ PHP_BUILD_VERSION: $PHP_BUILD_VERSION
11
+ BUILD_ROOT_PATH: $BUILD_ROOT_PATH
12
+ container_name: "${PROJECT_NAME}_build"
13
+ working_dir: ${BUILD_ROOT_PATH}
14
  volumes:
15
+ - ${BASE_PATH}:${BUILD_ROOT_PATH}
 
16
 
17
+ test:
18
+ build:
19
+ context: ./
20
+ dockerfile: docker/Dockerfile
21
+ target: test
22
+ args:
23
+ BUILD_ROOT_PATH: $BUILD_ROOT_PATH
24
+ PHP_BUILD_VERSION: $PHP_BUILD_VERSION
25
+ PHP_TEST_VERSION: $PHP_TEST_VERSION
26
+ container_name: "${PROJECT_NAME}_test"
27
+ working_dir: ${BUILD_ROOT_PATH}
28
+ volumes:
29
+ - ${BASE_PATH}:${BUILD_ROOT_PATH}
vendor/dhii/collections-interface/docker/Dockerfile ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ARG PHP_BUILD_VERSION
2
+ ARG PHP_TEST_VERSION
3
+
4
+ # Composer on correct PHP version
5
+ FROM php:${PHP_BUILD_VERSION}-cli as build
6
+
7
+ ARG BUILD_ROOT_PATH
8
+
9
+ RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"
10
+ RUN apt-get update
11
+ RUN apt-get install -y zip unzip curl git
12
+ RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
13
+ RUN php composer-setup.php --install-dir=/usr/bin --filename=composer
14
+ RUN php -r "unlink('composer-setup.php');"
15
+
16
+ WORKDIR ${BUILD_ROOT_PATH}
17
+ COPY . ./
18
+
19
+
20
+ FROM php:${PHP_TEST_VERSION}-cli as test
21
+
22
+ ARG BUILD_ROOT_PATH
23
+
24
+ RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"
25
+ RUN pecl install xdebug-2.6.0
26
+ RUN docker-php-ext-install pcntl
27
+ RUN docker-php-ext-install posix
28
+
29
+ WORKDIR ${BUILD_ROOT_PATH}
30
+ COPY --from=build ${BUILD_ROOT_PATH} ${BUILD_ROOT_PATH}
31
+
32
+
33
+ # Install PHP dev dependencies
34
+ FROM build as vendor-dev
35
+
36
+ ARG BUILD_ROOT_PATH
37
+
38
+ WORKDIR ${BUILD_ROOT_PATH}
39
+ RUN composer install
vendor/dhii/collections-interface/docker/Dockerfile_php DELETED
@@ -1,6 +0,0 @@
1
- FROM dockette/php:7.1
2
-
3
- RUN apt-get update \
4
- && apt-get -y install software-properties-common dirmngr apt-transport-https lsb-release ca-certificates \
5
- && add-apt-repository -y ppa:ondrej/php \
6
- && apt-get install -y php7.1-xdebug
 
 
 
 
 
 
vendor/dhii/collections-interface/phpunit.xml.dist CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0" encoding="UTF-8"?>
2
  <phpunit
3
  colors="true"
4
- bootstrap="test/bootstrap.php"
5
  >
6
  <php>
7
  <ini name="display_errors" value="1" />
@@ -9,10 +9,7 @@
9
  </php>
10
  <testsuites>
11
  <testsuite name="unit">
12
- <directory>./test/unit/</directory>
13
- </testsuite>
14
- <testsuite name="functional">
15
- <directory>./test/functional/</directory>
16
  </testsuite>
17
  </testsuites>
18
  <filter>
1
  <?xml version="1.0" encoding="UTF-8"?>
2
  <phpunit
3
  colors="true"
4
+ bootstrap="tests/bootstrap.php"
5
  >
6
  <php>
7
  <ini name="display_errors" value="1" />
9
  </php>
10
  <testsuites>
11
  <testsuite name="unit">
12
+ <directory>tests/unit</directory>
 
 
 
13
  </testsuite>
14
  </testsuites>
15
  <filter>
vendor/dhii/collections-interface/psalm.xml.dist CHANGED
@@ -2,24 +2,152 @@
2
  <psalm
3
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4
  xmlns="https://getpsalm.org/schema/config"
 
 
 
5
  useDocblockTypes="true"
6
- errorLevel="1"
7
- strictBinaryOperands="false"
8
  rememberPropertyAssignmentsAfterCall="true"
9
- checkForThrowsDocblock="false"
10
- throwExceptionOnError="0"
11
- findUnusedCode="true"
12
- ensureArrayStringOffsetsExist="true"
13
- ensureArrayIntOffsetsExist="false"
14
- xsi:noNamespaceSchemaLocation="https://getpsalm.org/schema/config"
15
- cacheDirectory="/var/tmp/psalm"
 
 
 
 
 
 
16
  >
17
  <projectFiles>
18
  <directory name="src"/>
19
  </projectFiles>
20
 
 
 
 
 
 
 
 
21
  <issueHandlers>
22
- <InvalidThrow errorLevel="suppress"></InvalidThrow>
23
- <UnusedClass errorLevel="suppress"></UnusedClass>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24
  </issueHandlers>
25
  </psalm>
2
  <psalm
3
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4
  xmlns="https://getpsalm.org/schema/config"
5
+ xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
6
+ xmlns:xi="http://www.w3.org/2001/XInclude"
7
+ totallyTyped="false"
8
  useDocblockTypes="true"
9
+ usePhpDocMethodsWithoutMagicCall="false"
10
+ strictBinaryOperands="true"
11
  rememberPropertyAssignmentsAfterCall="true"
12
+ allowPhpStormGenerics="true"
13
+ allowCoercionFromStringToClassConst="false"
14
+ allowStringToStandInForClass="false"
15
+ memoizeMethodCallResults="false"
16
+ hoistConstants="false"
17
+ addParamDefaultToDocblockType="false"
18
+ checkForThrowsDocblock="true"
19
+ checkForThrowsInGlobalScope="false"
20
+ ignoreInternalFunctionFalseReturn="false"
21
+ ignoreInternalFunctionNullReturn="false"
22
+ throwExceptionOnError="false"
23
+ hideExternalErrors="true"
24
+ allowFileIncludes="true"
25
  >
26
  <projectFiles>
27
  <directory name="src"/>
28
  </projectFiles>
29
 
30
+ <extraFiles>
31
+ <ignoreFiles>
32
+ <directory name="vendor/phpspec/prophecy"/>
33
+ </ignoreFiles>
34
+ </extraFiles>
35
+
36
+
37
  <issueHandlers>
38
+ <ConflictingReferenceConstraint errorLevel="error"/>
39
+ <ContinueOutsideLoop errorLevel="error"/>
40
+ <DuplicateArrayKey errorLevel="error"/>
41
+ <DuplicateClass errorLevel="error"/>
42
+ <DuplicateFunction errorLevel="error"/>
43
+ <DuplicateMethod errorLevel="error"/>
44
+ <DuplicateParam errorLevel="error"/>
45
+ <EmptyArrayAccess errorLevel="error"/>
46
+ <FalsableReturnStatement errorLevel="error"/>
47
+ <FalseOperand errorLevel="error"/>
48
+ <ForbiddenCode errorLevel="error"/>
49
+ <ForbiddenEcho errorLevel="error"/>
50
+ <InaccessibleClassConstant errorLevel="error"/>
51
+ <InaccessibleMethod errorLevel="error"/>
52
+ <InterfaceInstantiation errorLevel="error"/>
53
+ <InaccessibleProperty errorLevel="error"/>
54
+ <InternalClass errorLevel="error"/>
55
+ <InternalMethod errorLevel="error"/>
56
+ <InternalProperty errorLevel="error"/>
57
+ <InvalidArgument errorLevel="error"/>
58
+ <InvalidArrayAccess errorLevel="error"/>
59
+ <InvalidArrayAssignment errorLevel="error"/>
60
+ <InvalidArrayOffset errorLevel="error"/>
61
+ <InvalidCast errorLevel="error"/>
62
+ <InvalidCatch errorLevel="error"/>
63
+ <InvalidClass errorLevel="error"/>
64
+ <InvalidClone errorLevel="error"/>
65
+ <InvalidFalsableReturnType errorLevel="error"/>
66
+ <InvalidThrow errorLevel="error"/>
67
+ <InvalidToString errorLevel="error"/>
68
+ <LoopInvalidation errorLevel="error"/>
69
+ <InvalidNullableReturnType errorLevel="error"/>
70
+ <LessSpecificReturnType errorLevel="error"/>
71
+ <InvalidGlobal errorLevel="error"/>
72
+ <InvalidIterator errorLevel="error"/>
73
+ <InvalidMethodCall errorLevel="error"/>
74
+ <InvalidFunctionCall errorLevel="error"/>
75
+ <ImplicitToStringCast errorLevel="error"/>
76
+ <ImplementedReturnTypeMismatch errorLevel="error"/>
77
+ <InvalidParamDefault errorLevel="error"/>
78
+ <InvalidPassByReference errorLevel="error"/>
79
+ <InvalidPropertyAssignment errorLevel="error"/>
80
+ <InvalidPropertyAssignmentValue errorLevel="error"/>
81
+ <InvalidPropertyFetch errorLevel="error"/>
82
+ <InvalidReturnStatement errorLevel="error"/>
83
+ <InvalidReturnType errorLevel="error"/>
84
+ <InvalidScalarArgument errorLevel="error"/>
85
+ <InvalidScope errorLevel="error"/>
86
+ <InvalidStaticInvocation errorLevel="error"/>
87
+ <MissingConstructor errorLevel="error"/>
88
+ <MissingDependency errorLevel="error"/>
89
+ <MissingFile errorLevel="error"/>
90
+ <MixedArgument errorLevel="error"/>
91
+ <MoreSpecificImplementedParamType errorLevel="error"/>
92
+ <MoreSpecificReturnType errorLevel="error"/>
93
+ <NoValue errorLevel="error"/>
94
+ <NoInterfaceProperties errorLevel="error"/>
95
+ <NonStaticSelfCall errorLevel="error"/>
96
+ <NullableReturnStatement errorLevel="error"/>
97
+ <NullArgument errorLevel="error"/>
98
+ <NullArrayAccess errorLevel="error"/>
99
+ <NullArrayOffset errorLevel="error"/>
100
+ <NullFunctionCall errorLevel="error"/>
101
+ <NullIterator errorLevel="error"/>
102
+ <NullOperand errorLevel="error"/>
103
+ <NullPropertyAssignment errorLevel="error"/>
104
+ <NullPropertyFetch errorLevel="error"/>
105
+ <NullReference errorLevel="error"/>
106
+ <OverriddenMethodAccess errorLevel="error"/>
107
+ <OverriddenPropertyAccess errorLevel="error"/>
108
+ <ParadoxicalCondition errorLevel="error"/>
109
+ <ParentNotFound errorLevel="error"/>
110
+ <LessSpecificImplementedReturnType errorLevel="error"/>
111
+ <MissingParamType errorLevel="error"/>
112
+ <MissingClosureParamType errorLevel="error"/>
113
+ <MissingClosureReturnType errorLevel="error"/>
114
+ <MissingPropertyType errorLevel="error"/>
115
+ <UndefinedConstant errorLevel="error"/>
116
+
117
+ <AssignmentToVoid errorLevel="info"/>
118
+ <DeprecatedClass errorLevel="info"/>
119
+ <DeprecatedConstant errorLevel="info"/>
120
+ <DeprecatedTrait errorLevel="info"/>
121
+ <DocblockTypeContradiction errorLevel="info"/>
122
+ <InvalidDocblock errorLevel="info"/>
123
+ <InvalidDocblockParamName errorLevel="info"/>
124
+ <InvalidTemplateParam errorLevel="info"/>
125
+ <DeprecatedInterface errorLevel="info"/>
126
+ <DeprecatedMethod errorLevel="info"/>
127
+ <DeprecatedProperty errorLevel="info"/>
128
+ <MethodSignatureMustOmitReturnType errorLevel="info"/>
129
+ <MismatchingDocblockParamType errorLevel="info"/>
130
+ <MismatchingDocblockReturnType errorLevel="info"/>
131
+ <MissingDocblockType errorLevel="info"/>
132
+ <MissingParamType errorLevel="info"/>
133
+ <MissingTemplateParam errorLevel="info"/>
134
+ <MissingThrowsDocblock errorLevel="info"/>
135
+ <MixedArgumentTypeCoercion errorLevel="info"/>
136
+ <MixedArrayAccess errorLevel="info"/>
137
+ <MixedArrayAssignment errorLevel="info"/>
138
+ <MixedArrayOffset errorLevel="info"/>
139
+ <MixedArrayTypeCoercion errorLevel="info"/>
140
+ <MixedAssignment errorLevel="info"/>
141
+ <MixedFunctionCall errorLevel="info"/>
142
+ <MixedInferredReturnType errorLevel="info"/>
143
+ <MixedMethodCall errorLevel="info"/>
144
+ <MixedOperand errorLevel="info"/>
145
+ <MixedPropertyAssignment errorLevel="info"/>
146
+ <MixedPropertyFetch errorLevel="info"/>
147
+ <MixedPropertyTypeCoercion errorLevel="info"/>
148
+ <MixedReturnStatement errorLevel="info"/>
149
+ <MixedReturnTypeCoercion errorLevel="info"/>
150
+ <MixedStringOffsetAssignment errorLevel="info"/>
151
+ <RedundantConditionGivenDocblockType errorLevel="info"/>
152
  </issueHandlers>
153
  </psalm>
vendor/dhii/collections-interface/src/ClearableContainerInterface.php CHANGED
@@ -12,6 +12,7 @@ interface ClearableContainerInterface extends PsrContainerInterface
12
  /**
13
  * Removes all members from this container.
14
  *
 
15
  * @throws ContainerExceptionInterface If problem removing.
16
  */
17
  public function clear(): void;
12
  /**
13
  * Removes all members from this container.
14
  *
15
+ * @psalm-suppress InvalidThrow In PSR-11, this interface does not extend `Throwable`.
16
  * @throws ContainerExceptionInterface If problem removing.
17
  */
18
  public function clear(): void;
vendor/dhii/collections-interface/tests/bootstrap.php ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ <?php
2
+
3
+ error_reporting(E_ALL | E_STRICT);
4
+
5
+ require_once dirname(__FILE__).'/../vendor/autoload.php';
vendor/dhii/collections-interface/tests/unit/ClearableContainerInterfaceTest.php ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Dhii\Collection\UnitTest;
4
+
5
+ use Dhii\Collection\ClearableContainerInterface as TestSubject;
6
+ use PHPUnit\Framework\TestCase;
7
+ use PHPUnit\Framework\MockObject\MockObject as MockObject;
8
+ use Psr\Container\ContainerInterface;
9
+
10
+ /**
11
+ * Tests {@see TestSubject}.
12
+ *
13
+ * @since [*next-version*]
14
+ */
15
+ class ClearableContainerInterfaceTest extends TestCase
16
+ {
17
+
18
+ /**
19
+ * Creates a new instance of the test subject.
20
+ *
21
+ * @since [*next-version*]
22
+ *
23
+ * @return TestSubject&MockObject The new instance.
24
+ */
25
+ public function createInstance()
26
+ {
27
+ $mock = $this->getMockBuilder(TestSubject::class)
28
+ ->getMock();
29
+
30
+ return $mock;
31
+ }
32
+
33
+ /**
34
+ * Tests whether a valid instance of the test subject can be created.
35
+ *
36
+ * @since [*next-version*]
37
+ */
38
+ public function testCanBeCreated()
39
+ {
40
+ $subject = $this->createInstance();
41
+
42
+ $this->assertInstanceOf(
43
+ TestSubject::class,
44
+ $subject,
45
+ 'A valid instance of the test subject could not be created.'
46
+ );
47
+ $this->assertInstanceOf(
48
+ ContainerInterface::class,
49
+ $subject,
50
+ 'Subject does not implement a required interface.'
51
+ );
52
+ }
53
+ }
vendor/dhii/collections-interface/tests/unit/ContainerFactoryInterfaceTest.php ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Dhii\Collection\UnitTest;
4
+
5
+ use Dhii\Collection\ContainerFactoryInterface as TestSubject;
6
+ use PHPUnit\Framework\TestCase;
7
+ use PHPUnit\Framework\MockObject\MockObject as MockObject;
8
+
9
+ /**
10
+ * Tests {@see TestSubject}.
11
+ *
12
+ * @since 0.2
13
+ */
14
+ class ContainerFactoryInterfaceTest extends TestCase
15
+ {
16
+ /**
17
+ * Creates a new instance of the test subject.
18
+ *
19
+ * @since 0.2
20
+ *
21
+ * @return TestSubject&MockObject The new instance.
22
+ */
23
+ public function createInstance()
24
+ {
25
+ $mock = $this->getMockBuilder(TestSubject::class)
26
+ ->getMock();
27
+
28
+ return $mock;
29
+ }
30
+
31
+ /**
32
+ * Tests whether a valid instance of the test subject can be created.
33
+ *
34
+ * @since 0.2
35
+ */
36
+ public function testCanBeCreated()
37
+ {
38
+ $subject = $this->createInstance();
39
+
40
+ $this->assertInstanceOf(TestSubject::class, $subject, 'A valid instance of the test subject could not be created.');
41
+ }
42
+ }
vendor/dhii/collections-interface/tests/unit/ContainerInterfaceTest.php ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Dhii\Collection\UnitTest;
4
+
5
+ use Dhii\Collection\ContainerInterface as TestSubject;
6
+ use Dhii\Collection\HasCapableInterface;
7
+ use PHPUnit\Framework\TestCase;
8
+ use PHPUnit\Framework\MockObject\MockObject as MockObject;
9
+ use Psr\Container\ContainerInterface;
10
+
11
+ /**
12
+ * Tests {@see TestSubject}.
13
+ *
14
+ * @since [*next-version*]
15
+ */
16
+ class ContainerInterfaceTest extends TestCase
17
+ {
18
+
19
+ /**
20
+ * Creates a new instance of the test subject.
21
+ *
22
+ * @since [*next-version*]
23
+ *
24
+ * @return TestSubject&MockObject The new instance.
25
+ */
26
+ public function createInstance()
27
+ {
28
+ $mock = $this->getMockBuilder(TestSubject::class)
29
+ ->getMock();
30
+
31
+ return $mock;
32
+ }
33
+
34
+ /**
35
+ * Tests whether a valid instance of the test subject can be created.
36
+ *
37
+ * @since [*next-version*]
38
+ */
39
+ public function testCanBeCreated()
40
+ {
41
+ $subject = $this->createInstance();
42
+
43
+ $this->assertInstanceOf(
44
+ TestSubject::class,
45
+ $subject,
46
+ 'A valid instance of the test subject could not be created.'
47
+ );
48
+ $this->assertInstanceOf(
49
+ HasCapableInterface::class,
50
+ $subject,
51
+ 'Subject does not implement a required interface.'
52
+ );
53
+ $this->assertInstanceOf(
54
+ ContainerInterface::class,
55
+ $subject,
56
+ 'Subject does not implement a required interface.'
57
+ );
58
+ }
59
+ }
vendor/dhii/collections-interface/tests/unit/CountableListInterfaceTest.php ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Dhii\Collection\UnitTest;
4
+
5
+ use Countable;
6
+ use Dhii\Collection\CountableListInterface as TestSubject;
7
+ use PHPUnit\Framework\TestCase;
8
+ use PHPUnit\Framework\MockObject\MockObject as MockObject;
9
+ use Traversable;
10
+
11
+ /**
12
+ * Tests {@see TestSubject}.
13
+ *
14
+ * @since 0.2
15
+ */
16
+ class CountableListInterfaceTest extends TestCase
17
+ {
18
+ /**
19
+ * Creates a new instance of the test subject.
20
+ *
21
+ * @since 0.2
22
+ *
23
+ * @return TestSubject&MockObject The new instance.
24
+ */
25
+ public function createInstance()
26
+ {
27
+ $mock = $this->getMockBuilder(TestSubject::class)
28
+ ->getMock();
29
+
30
+ return $mock;
31
+ }
32
+
33
+ /**
34
+ * Tests whether a valid instance of the test subject can be created.
35
+ *
36
+ * @since 0.2
37
+ */
38
+ public function testCanBeCreated()
39
+ {
40
+ $subject = $this->createInstance();
41
+
42
+ $this->assertInstanceOf(
43
+ TestSubject::class,
44
+ $subject,
45
+ 'A valid instance of the test subject could not be created.'
46
+ );
47
+ $this->assertInstanceOf(
48
+ Countable::class,
49
+ $subject,
50
+ 'Test subject does not implement required interface.'
51
+ );
52
+ $this->assertInstanceOf(
53
+ Traversable::class,
54
+ $subject,
55
+ 'Test subject does not implement required interface.'
56
+ );
57
+ }
58
+ }
vendor/dhii/collections-interface/tests/unit/CountableMapInterfaceTest.php ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Dhii\Collection\UnitTest;
4
+
5
+ use Dhii\Collection\CountableListInterface;
6
+ use Dhii\Collection\CountableMapInterface as TestSubject;
7
+ use Dhii\Collection\MapInterface;
8
+ use PHPUnit\Framework\TestCase;
9
+ use PHPUnit\Framework\MockObject\MockObject as MockObject;
10
+
11
+ /**
12
+ * Tests {@see TestSubject}.
13
+ *
14
+ * @since 0.2
15
+ */
16
+ class CountableMapInterfaceTest extends TestCase
17
+ {
18
+ /**
19
+ * Creates a new instance of the test subject.
20
+ *
21
+ * @since 0.2
22
+ *
23
+ * @return TestSubject&MockObject The new instance.
24
+ */
25
+ public function createInstance()
26
+ {
27
+ $mock = $this->getMockBuilder(TestSubject::class)
28
+ ->getMock();
29
+
30
+ return $mock;
31
+ }
32
+
33
+ /**
34
+ * Tests whether a valid instance of the test subject can be created.
35
+ *
36
+ * @since 0.2
37
+ */
38
+ public function testCanBeCreated()
39
+ {
40
+ $subject = $this->createInstance();
41
+
42
+ $this->assertInstanceOf(
43
+ TestSubject::class,
44
+ $subject,
45
+ 'A valid instance of the test subject could not be created.'
46
+ );
47
+ $this->assertInstanceOf(
48
+ CountableListInterface::class,
49
+ $subject,
50
+ 'Test subject does not implement required interface.'
51
+ );
52
+ $this->assertInstanceOf(
53
+ MapInterface::class,
54
+ $subject,
55
+ 'Test subject does not implement required interface.'
56
+ );
57
+ }
58
+ }
vendor/dhii/collections-interface/tests/unit/CountableSetInterfaceTest.php ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Dhii\Collection\UnitTest;
4
+
5
+ use Dhii\Collection\CountableListInterface;
6
+ use Dhii\Collection\CountableSetInterface as TestSubject;
7
+ use Dhii\Collection\SetInterface;
8
+ use PHPUnit\Framework\TestCase;
9
+ use PHPUnit\Framework\MockObject\MockObject as MockObject;
10
+
11
+ /**
12
+ * Tests {@see TestSubject}.
13
+ *
14
+ * @since 0.2
15
+ */
16
+ class CountableSetInterfaceTest extends TestCase
17
+ {
18
+ /**
19
+ * Creates a new instance of the test subject.
20
+ *
21
+ * @since 0.2
22
+ *
23
+ * @return TestSubject&MockObject The new instance.
24
+ */
25
+ public function createInstance()
26
+ {
27
+ $mock = $this->getMockBuilder(TestSubject::class)
28
+ ->getMock();
29
+
30
+ return $mock;
31
+ }
32
+
33
+ /**
34
+ * Tests whether a valid instance of the test subject can be created.
35
+ *
36
+ * @since 0.2
37
+ */
38
+ public function testCanBeCreated()
39
+ {
40
+ $subject = $this->createInstance();
41
+
42
+ $this->assertInstanceOf(
43
+ TestSubject::class,
44
+ $subject,
45
+ 'A valid instance of the test subject could not be created.'
46
+ );
47
+ $this->assertInstanceOf(
48
+ SetInterface::class,
49
+ $subject,
50
+ 'Test subject does not implement required interface.'
51
+ );
52
+ $this->assertInstanceOf(
53
+ CountableListInterface::class,
54
+ $subject,
55
+ 'Test subject does not implement required interface.'
56
+ );
57
+ }
58
+ }
vendor/dhii/collections-interface/tests/unit/HasCapableInterfaceTest.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Dhii\Collection\UnitTest;
4
+
5
+ use Dhii\Collection\HasCapableInterface as TestSubject;
6
+ use PHPUnit\Framework\TestCase;
7
+ use PHPUnit\Framework\MockObject\MockObject as MockObject;
8
+
9
+ /**
10
+ * Tests {@see TestSubject}.
11
+ *
12
+ * @since [*next-version*]
13
+ */
14
+ class HasCapableInterfaceTest extends TestCase
15
+ {
16
+
17
+ /**
18
+ * Creates a new instance of the test subject.
19
+ *
20
+ * @since [*next-version*]
21
+ *
22
+ * @return TestSubject&MockObject The new instance.
23
+ */
24
+ public function createInstance()
25
+ {
26
+ $mock = $this->getMockBuilder(TestSubject::class)
27
+ ->getMock();
28
+
29
+ return $mock;
30
+ }
31
+
32
+ /**
33
+ * Tests whether a valid instance of the test subject can be created.
34
+ *
35
+ * @since [*next-version*]
36
+ */
37
+ public function testCanBeCreated()
38
+ {
39
+ $subject = $this->createInstance();
40
+
41
+ $this->assertInstanceOf(
42
+ TestSubject::class,
43
+ $subject,
44
+ 'A valid instance of the test subject could not be created.'
45
+ );
46
+ }
47
+ }
vendor/dhii/collections-interface/tests/unit/HasItemCapableInterfaceTest.php ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Dhii\Collection\UnitTest;
4
+
5
+ use Dhii\Collection\HasItemCapableInterface as TestSubject;
6
+ use PHPUnit\Framework\TestCase;
7
+ use PHPUnit\Framework\MockObject\MockObject as MockObject;
8
+
9
+ /**
10
+ * Tests {@see TestSubject}.
11
+ *
12
+ * @since 0.2
13
+ */
14
+ class HasItemCapableInterfaceTest extends TestCase
15
+ {
16
+ /**
17
+ * Creates a new instance of the test subject.
18
+ *
19
+ * @since 0.2
20
+ *
21
+ * @return TestSubject&MockObject The new instance.
22
+ */
23
+ public function createInstance()
24
+ {
25
+ $mock = $this->getMockBuilder(TestSubject::class)
26
+ ->getMock();
27
+
28
+ return $mock;
29
+ }
30
+
31
+ /**
32
+ * Tests whether a valid instance of the test subject can be created.
33
+ *
34
+ * @since 0.2
35
+ */
36
+ public function testCanBeCreated()
37
+ {
38
+ $subject = $this->createInstance();
39
+
40
+ $this->assertInstanceOf(
41
+ TestSubject::class,
42
+ $subject,
43
+ 'A valid instance of the test subject could not be created.'
44
+ );
45
+ }
46
+ }
vendor/dhii/collections-interface/tests/unit/MapFactoryInterfaceTest.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Dhii\Collection\UnitTest;
4
+
5
+ use Dhii\Collection\ContainerFactoryInterface;
6
+ use Dhii\Collection\MapFactoryInterface as TestSubject;
7
+ use PHPUnit\Framework\TestCase;
8
+ use PHPUnit\Framework\MockObject\MockObject as MockObject;
9
+
10
+ /**
11
+ * Tests {@see TestSubject}.
12
+ *
13
+ * @since 0.2
14
+ */
15
+ class MapFactoryInterfaceTest extends TestCase
16
+ {
17
+ /**
18
+ * Creates a new instance of the test subject.
19
+ *
20
+ * @since 0.2
21
+ *
22
+ * @return TestSubject&MockObject The new instance.
23
+ */
24
+ public function createInstance()
25
+ {
26
+ $mock = $this->getMockBuilder(TestSubject::class)
27
+ ->getMock();
28
+
29
+ return $mock;
30
+ }
31
+
32
+ /**
33
+ * Tests whether a valid instance of the test subject can be created.
34
+ *
35
+ * @since 0.2
36
+ */
37
+ public function testCanBeCreated()
38
+ {
39
+ $subject = $this->createInstance();
40
+
41
+ $this->assertInstanceOf(TestSubject::class, $subject, 'A valid instance of the test subject could not be created.');
42
+ $this->assertInstanceOf(ContainerFactoryInterface::class, $subject, 'Test subject does not implement required interface.');
43
+ }
44
+ }
vendor/dhii/collections-interface/tests/unit/MapInterfaceTest.php ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Dhii\Collection\UnitTest;
4
+
5
+ use Dhii\Collection\MapInterface as TestSubject;
6
+ use PHPUnit\Framework\TestCase;
7
+ use PHPUnit\Framework\MockObject\MockObject as MockObject;
8
+ use Psr\Container\ContainerInterface;
9
+ use Traversable;
10
+
11
+ /**
12
+ * Tests {@see TestSubject}.
13
+ *
14
+ * @since 0.2
15
+ */
16
+ class MapInterfaceTest extends TestCase
17
+ {
18
+ /**
19
+ * Creates a new instance of the test subject.
20
+ *
21
+ * @since 0.2
22
+ *
23
+ * @return TestSubject&MockObject The new instance.
24
+ */
25
+ public function createInstance()
26
+ {
27
+ $mock = $this->getMockBuilder(TestSubject::class)
28
+ ->getMock();
29
+
30
+ return $mock;
31
+ }
32
+
33
+ /**
34
+ * Tests whether a valid instance of the test subject can be created.
35
+ *
36
+ * @since 0.2
37
+ */
38
+ public function testCanBeCreated()
39
+ {
40
+ $subject = $this->createInstance();
41
+
42
+ $this->assertInstanceOf(
43
+ TestSubject::class,
44
+ $subject,
45
+ 'A valid instance of the test subject could not be created.'
46
+ );
47
+ $this->assertInstanceOf(
48
+ ContainerInterface::class,
49
+ $subject,
50
+ 'Test subject does not implement required interface.'
51
+ );
52
+ $this->assertInstanceOf(
53
+ Traversable::class,
54
+ $subject,
55
+ 'Test subject does not implement required interface.'
56
+ );
57
+ }
58
+ }
vendor/dhii/collections-interface/tests/unit/MutableContainerInterfaceTest.php ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Dhii\Collection\UnitTest;
4
+
5
+ use Dhii\Collection\ContainerInterface as Subject;
6
+ use PHPUnit\Framework\TestCase;
7
+ use PHPUnit\Framework\MockObject\MockObject as MockObject;
8
+ use Psr\Container\ContainerInterface;
9
+
10
+ /**
11
+ * Tests {@see Subject}.
12
+ *
13
+ * @since [*next-version*]
14
+ */
15
+ class MutableContainerInterfaceTest extends TestCase
16
+ {
17
+
18
+ /**
19
+ * Creates a new instance of the test subject.
20
+ *
21
+ * @since [*next-version*]
22
+ *
23
+ * @return Subject&MockObject The new instance.
24
+ */
25
+ public function createInstance()
26
+ {
27
+ $mock = $this->getMockBuilder(Subject::class)
28
+ ->getMock();
29
+
30
+ return $mock;
31
+ }
32
+
33
+ /**
34
+ * Tests whether a valid instance of the test subject can be created.
35
+ *
36
+ * @since [*next-version*]
37
+ */
38
+ public function testCanBeCreated()
39
+ {
40
+ $subject = $this->createInstance();
41
+
42
+ $this->assertInstanceOf(
43
+ Subject::class,
44
+ $subject,
45
+ 'A valid instance of the test subject could not be created.'
46
+ );
47
+ $this->assertInstanceOf(
48
+ ContainerInterface::class,
49
+ $subject,
50
+ 'Subject does not implement a required interface.'
51
+ );
52
+ }
53
+ }
vendor/dhii/collections-interface/tests/unit/SetFactoryInterfaceTest.php ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Dhii\Collection\UnitTest;
4
+
5
+ use Dhii\Collection\SetFactoryInterface as TestSubject;
6
+ use PHPUnit\Framework\TestCase;
7
+ use PHPUnit\Framework\MockObject\MockObject as MockObject;
8
+
9
+ /**
10
+ * Tests {@see TestSubject}.
11
+ *
12
+ * @since 0.2
13
+ */
14
+ class SetFactoryInterfaceTest extends TestCase
15
+ {
16
+ /**
17
+ * Creates a new instance of the test subject.
18
+ *
19
+ * @since 0.2
20
+ *
21
+ * @return TestSubject&MockObject The new instance.
22
+ */
23
+ public function createInstance()
24
+ {
25
+ $mock = $this->getMockBuilder(TestSubject::class)
26
+ ->getMock();
27
+
28
+ return $mock;
29
+ }
30
+
31
+ /**
32
+ * Tests whether a valid instance of the test subject can be created.
33
+ *
34
+ * @since 0.2
35
+ */
36
+ public function testCanBeCreated()
37
+ {
38
+ $subject = $this->createInstance();
39
+
40
+ $this->assertInstanceOf(TestSubject::class, $subject, 'A valid instance of the test subject could not be created.');
41
+ }
42
+ }
vendor/dhii/collections-interface/tests/unit/SetInterfaceTest.php ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Dhii\Collection\UnitTest;
4
+
5
+ use Dhii\Collection\HasItemCapableInterface;
6
+ use Dhii\Collection\SetInterface as TestSubject;
7
+ use PHPUnit\Framework\TestCase;
8
+ use PHPUnit\Framework\MockObject\MockObject as MockObject;
9
+ use Traversable;
10
+
11
+ /**
12
+ * Tests {@see TestSubject}.
13
+ *
14
+ * @since 0.2
15
+ */
16
+ class SetInterfaceTest extends TestCase
17
+ {
18
+ /**
19
+ * Creates a new instance of the test subject.
20
+ *
21
+ * @since 0.2
22
+ *
23
+ * @return TestSubject&MockObject The new instance.
24
+ */
25
+ public function createInstance()
26
+ {
27
+ $mock = $this->getMockBuilder(TestSubject::class)
28
+ ->getMock();
29
+
30
+ return $mock;
31
+ }
32
+
33
+ /**
34
+ * Tests whether a valid instance of the test subject can be created.
35
+ *
36
+ * @since 0.2
37
+ */
38
+ public function testCanBeCreated()
39
+ {
40
+ $subject = $this->createInstance();
41
+
42
+ $this->assertInstanceOf(
43
+ TestSubject::class,
44
+ $subject,
45
+ 'A valid instance of the test subject could not be created.'
46
+ );
47
+ $this->assertInstanceOf(
48
+ Traversable::class,
49
+ $subject,
50
+ 'Test subject does not implement required interface.'
51
+ );
52
+ $this->assertInstanceOf(
53
+ HasItemCapableInterface::class,
54
+ $subject,
55
+ 'Test subject does not implement required interface.'
56
+ );
57
+ }
58
+ }
vendor/dhii/collections-interface/tests/unit/WritableContainerInterfaceTest.php ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Dhii\Collection\UnitTest;
4
+
5
+ use Dhii\Collection\ContainerInterface;
6
+ use Dhii\Collection\WritableContainerInterface as TestSubject;
7
+ use PHPUnit\Framework\TestCase;
8
+ use PHPUnit\Framework\MockObject\MockObject as MockObject;
9
+
10
+ /**
11
+ * Tests {@see TestSubject}.
12
+ *
13
+ * @since [*next-version*]
14
+ */
15
+ class WritableContainerInterfaceTest extends TestCase
16
+ {
17
+ /**
18
+ * Creates a new instance of the test subject.
19
+ *
20
+ * @since [*next-version*]
21
+ *
22
+ * @return TestSubject&MockObject The new instance.
23
+ */
24
+ public function createInstance()
25
+ {
26
+ $mock = $this->getMockBuilder(TestSubject::class)
27
+ ->getMock();
28
+
29
+ return $mock;
30
+ }
31
+
32
+ /**
33
+ * Tests whether a valid instance of the test subject can be created.
34
+ *
35
+ * @since [*next-version*]
36
+ */
37
+ public function testCanBeCreated()
38
+ {
39
+ $subject = $this->createInstance();
40
+
41
+ $this->assertInstanceOf(
42
+ TestSubject::class,
43
+ $subject,
44
+ 'A valid instance of the test subject could not be created.'
45
+ );
46
+ $this->assertInstanceOf(
47
+ ContainerInterface::class,
48
+ $subject,
49
+ 'Test subject does not implement required interface.'
50
+ );
51
+ }
52
+ }
vendor/dhii/collections-interface/tests/unit/WritableMapFactoryInterfaceTest.php ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Dhii\Collection\UnitTest;
4
+
5
+ use Dhii\Collection\MapFactoryInterface;
6
+ use Dhii\Collection\WritableContainerFactoryInterface;
7
+ use Dhii\Collection\WritableMapFactoryInterface as TestSubject;
8
+ use PHPUnit\Framework\TestCase;
9
+ use PHPUnit\Framework\MockObject\MockObject as MockObject;
10
+
11
+ /**
12
+ * Tests {@see TestSubject}.
13
+ *
14
+ * @since [*next-version*]
15
+ */
16
+ class WritableMapFactoryInterfaceTest extends TestCase
17
+ {
18
+ /**
19
+ * Creates a new instance of the test subject.
20
+ *
21
+ * @since [*next-version*]
22
+ *
23
+ * @return TestSubject&MockObject The new instance.
24
+ */
25
+ public function createInstance()
26
+ {
27
+ $mock = $this->getMockBuilder(TestSubject::class)
28
+ ->getMock();
29
+
30
+ return $mock;
31
+ }
32
+
33
+ /**
34
+ * Tests whether a valid instance of the test subject can be created.
35
+ *
36
+ * @since [*next-version*]
37
+ */
38
+ public function testCanBeCreated()
39
+ {
40
+ $subject = $this->createInstance();
41
+
42
+ $this->assertInstanceOf(TestSubject::class, $subject, 'A valid instance of the test subject could not be created.');
43
+ $this->assertInstanceOf(MapFactoryInterface::class, $subject, 'Test subject does not implement required interface.');
44
+ $this->assertInstanceOf(WritableContainerFactoryInterface::class, $subject, 'Test subject does not implement required interface.');
45
+ }
46
+ }
vendor/dhii/collections-interface/tests/unit/WritableMapInterfaceTest.php ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Dhii\Collection\UnitTest;
4
+
5
+ use Dhii\Collection\MapInterface;
6
+ use Dhii\Collection\WritableContainerInterface;
7
+ use Dhii\Collection\WritableMapInterface as TestSubject;
8
+ use PHPUnit\Framework\TestCase;
9
+ use PHPUnit\Framework\MockObject\MockObject as MockObject;
10
+
11
+ /**
12
+ * Tests {@see TestSubject}.
13
+ *
14
+ * @since [*next-version*]
15
+ */
16
+ class WritableMapInterfaceTest extends TestCase
17
+ {
18
+ /**
19
+ * Creates a new instance of the test subject.
20
+ *
21
+ * @since [*next-version*]
22
+ *
23
+ * @return TestSubject&MockObject The new instance.
24
+ */
25
+ public function createInstance()
26
+ {
27
+ $mock = $this->getMockBuilder(TestSubject::class)
28
+ ->getMock();
29
+
30
+ return $mock;
31
+ }
32
+
33
+ /**
34
+ * Tests whether a valid instance of the test subject can be created.
35
+ *
36
+ * @since [*next-version*]
37
+ */
38
+ public function testCanBeCreated()
39
+ {
40
+ $subject = $this->createInstance();
41
+
42
+ $this->assertInstanceOf(
43
+ TestSubject::class,
44
+ $subject,
45
+ 'A valid instance of the test subject could not be created.'
46
+ );
47
+ $this->assertInstanceOf(
48
+ MapInterface::class,
49
+ $subject,
50
+ 'Test subject does not implement required interface.'
51
+ );
52
+ $this->assertInstanceOf(
53
+ WritableContainerInterface::class,
54
+ $subject,
55
+ 'Test subject does not implement required interface.'
56
+ );
57
+ }
58
+ }
vendor/dhii/collections-interface/tests/unit/WritableSetFactoryInterfaceTest.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Dhii\Collection\UnitTest;
4
+
5
+ use Dhii\Collection\SetFactoryInterface;
6
+ use Dhii\Collection\WritableSetFactoryInterface as TestSubject;
7
+ use PHPUnit\Framework\TestCase;
8
+ use PHPUnit\Framework\MockObject\MockObject as MockObject;
9
+
10
+ /**
11
+ * Tests {@see TestSubject}.
12
+ *
13
+ * @since [*next-version*]
14
+ */
15
+ class WritableSetFactoryInterfaceTest extends TestCase
16
+ {
17
+ /**
18
+ * Creates a new instance of the test subject.
19
+ *
20
+ * @since [*next-version*]
21
+ *
22
+ * @return TestSubject&MockObject The new instance.
23
+ */
24
+ public function createInstance()
25
+ {
26
+ $mock = $this->getMockBuilder(TestSubject::class)
27
+ ->getMock();
28
+
29
+ return $mock;
30
+ }
31
+
32
+ /**
33
+ * Tests whether a valid instance of the test subject can be created.
34
+ *
35
+ * @since [*next-version*]
36
+ */
37
+ public function testCanBeCreated()
38
+ {
39
+ $subject = $this->createInstance();
40
+
41
+ $this->assertInstanceOf(TestSubject::class, $subject, 'A valid instance of the test subject could not be created.');
42
+ $this->assertInstanceOf(SetFactoryInterface::class, $subject, 'Test subject does not implement required interface.');
43
+ }
44
+ }
vendor/dhii/collections-interface/tests/unit/WritableSetInterfaceTest.php ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Dhii\Collection\UnitTest;
4
+
5
+ use Dhii\Collection\SetInterface;
6
+ use Dhii\Collection\WritableSetInterface as TestSubject;
7
+ use PHPUnit\Framework\TestCase;
8
+ use PHPUnit\Framework\MockObject\MockObject as MockObject;
9
+
10
+ /**
11
+ * Tests {@see TestSubject}.
12
+ *
13
+ * @since 0.2
14
+ */
15
+ class WritableSetInterfaceTest extends TestCase
16
+ {
17
+ /**
18
+ * Creates a new instance of the test subject.
19
+ *
20
+ * @since 0.2
21
+ *
22
+ * @return TestSubject&MockObject The new instance.
23
+ */
24
+ public function createInstance()
25
+ {
26
+ $mock = $this->getMockBuilder(TestSubject::class)
27
+ ->getMock();
28
+
29
+ return $mock;
30
+ }
31
+
32
+ /**
33
+ * Tests whether a valid instance of the test subject can be created.
34
+ *
35
+ * @since 0.2
36
+ */
37
+ public function testCanBeCreated()
38
+ {
39
+ $subject = $this->createInstance();
40
+
41
+ $this->assertInstanceOf(
42
+ TestSubject::class,
43
+ $subject,
44
+ 'A valid instance of the test subject could not be created.'
45
+ );
46
+ $this->assertInstanceOf(
47
+ SetInterface::class,
48
+ $subject,
49
+ 'Test subject does not implement required interface.'
50
+ );
51
+ }
52
+ }
woocommerce-paypal-payments.php CHANGED
@@ -3,10 +3,12 @@
3
  * Plugin Name: WooCommerce PayPal Payments
4
  * Plugin URI: https://woocommerce.com/products/woocommerce-paypal-payments/
5
  * Description: PayPal's latest complete payments processing solution. Accept PayPal, PayPal Credit, credit/debit cards, alternative digital wallets local payment types and bank accounts. Turn on only PayPal options or process a full suite of payment methods. Enable global transaction with extensive currency and country coverage.
6
- * Version: 1.0.3
7
  * Author: WooCommerce
8
  * Author URI: https://woocommerce.com/
9
  * License: GPL-2.0
 
 
10
  * Text Domain: woocommerce-paypal-payments
11
  *
12
  * @package WooCommerce\PayPalCommerce
@@ -40,6 +42,21 @@ define( 'PAYPAL_INTEGRATION_DATE', '2020-10-15' );
40
  * Initialize the plugin and its modules.
41
  */
42
  function init() {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
43
  static $initialized;
44
  if ( ! $initialized ) {
45
  $modules = array( new PluginModule() );
@@ -89,6 +106,13 @@ define( 'PAYPAL_INTEGRATION_DATE', '2020-10-15' );
89
  add_filter(
90
  'plugin_action_links_' . plugin_basename( __FILE__ ),
91
  function( $links ) {
 
 
 
 
 
 
 
92
  array_unshift(
93
  $links,
94
  sprintf(
3
  * Plugin Name: WooCommerce PayPal Payments
4
  * Plugin URI: https://woocommerce.com/products/woocommerce-paypal-payments/
5
  * Description: PayPal's latest complete payments processing solution. Accept PayPal, PayPal Credit, credit/debit cards, alternative digital wallets local payment types and bank accounts. Turn on only PayPal options or process a full suite of payment methods. Enable global transaction with extensive currency and country coverage.
6
+ * Version: 1.0.4
7
  * Author: WooCommerce
8
  * Author URI: https://woocommerce.com/
9
  * License: GPL-2.0
10
+ * WC requires at least: 3.9
11
+ * WC tested up to: 4.9
12
  * Text Domain: woocommerce-paypal-payments
13
  *
14
  * @package WooCommerce\PayPalCommerce
42
  * Initialize the plugin and its modules.
43
  */
44
  function init() {
45
+ if ( ! function_exists( 'is_plugin_active' ) ) {
46
+ require_once ABSPATH . '/wp-admin/includes/plugin.php';
47
+ }
48
+ if ( ! is_plugin_active( 'woocommerce/woocommerce.php' ) ) {
49
+ add_action(
50
+ 'admin_notices',
51
+ function() {
52
+ /* translators: 1. URL link. */
53
+ echo '<div class="error"><p><strong>' . sprintf( esc_html__( 'WooCommerce PayPal Payments requires WooCommerce to be installed and active. You can download %s here.', 'woocommerce-paypal-payments' ), '<a href="https://woocommerce.com/" target="_blank">WooCommerce</a>' ) . '</strong></p></div>';
54
+ }
55
+ );
56
+
57
+ return;
58
+ }
59
+
60
  static $initialized;
61
  if ( ! $initialized ) {
62
  $modules = array( new PluginModule() );
106
  add_filter(
107
  'plugin_action_links_' . plugin_basename( __FILE__ ),
108
  function( $links ) {
109
+ if ( ! function_exists( 'is_plugin_active' ) ) {
110
+ require_once ABSPATH . '/wp-admin/includes/plugin.php';
111
+ }
112
+ if ( ! is_plugin_active( 'woocommerce/woocommerce.php' ) ) {
113
+ return $links;
114
+ }
115
+
116
  array_unshift(
117
  $links,
118
  sprintf(