Version Description
- Add - Rework onboarding code and add REST controller for integration with the OBW. #121
- Fix - Remove spinner on click, on cancel and on error. #124
Download this release
Release Info
Developer | woothemes |
Plugin | WooCommerce PayPal Payments |
Version | 1.2.0 |
Comparing to | |
See all releases |
Code changes from version 1.1.0 to 1.2.0
- changelog.txt +4 -0
- modules/ppcp-api-client/src/Repository/class-partnerreferralsdata.php +6 -5
- modules/ppcp-button/assets/js/button.js +1 -1
- modules/ppcp-button/assets/js/button.js.map +1 -1
- modules/ppcp-button/resources/js/modules/ActionHandler/CheckoutActionHandler.js +5 -4
- modules/ppcp-button/resources/js/modules/Renderer/CreditCardRenderer.js +4 -1
- modules/ppcp-onboarding/assets/js/onboarding.js +119 -33
- modules/ppcp-onboarding/services.php +4 -0
- modules/ppcp-onboarding/src/Assets/class-onboardingassets.php +15 -8
- modules/ppcp-onboarding/src/Render/class-onboardingrenderer.php +26 -22
- modules/ppcp-onboarding/src/class-onboarding-rest-controller.php +321 -0
- modules/ppcp-onboarding/src/class-onboardingmodule.php +4 -1
- modules/ppcp-wc-gateway/src/Settings/class-settings.php +1 -1
- modules/ppcp-wc-gateway/src/Settings/class-settingslistener.php +6 -2
- package-lock.json +10 -2
- readme.txt +5 -1
- vendor/autoload.php +1 -1
- vendor/composer/autoload_classmap.php +1 -0
- vendor/composer/autoload_real.php +7 -7
- vendor/composer/autoload_static.php +5 -4
- vendor/composer/installed.json +12 -15
- vendor/psr/container/README.md +11 -3
- vendor/psr/container/composer.json +2 -7
- vendor/psr/container/src/ContainerExceptionInterface.php +0 -3
- vendor/psr/container/src/ContainerInterface.php +4 -5
- vendor/psr/container/src/NotFoundExceptionInterface.php +0 -3
- woocommerce-paypal-payments.php +1 -1
changelog.txt
CHANGED
@@ -1,5 +1,9 @@
|
|
1 |
*** Changelog ***
|
2 |
|
|
|
|
|
|
|
|
|
3 |
= 1.1.0 - 2021-02-01 =
|
4 |
* Add - Buy Now Pay Later for UK. #104
|
5 |
* Add - DE now has 12 month installments. #106
|
1 |
*** Changelog ***
|
2 |
|
3 |
+
= 1.2.0 - 2021-03-08 =
|
4 |
+
* Add - Rework onboarding code and add REST controller for integration with the OBW. #121
|
5 |
+
* Fix - Remove spinner on click, on cancel and on error. #124
|
6 |
+
|
7 |
= 1.1.0 - 2021-02-01 =
|
8 |
* Add - Buy Now Pay Later for UK. #104
|
9 |
* Add - DE now has 12 month installments. #106
|
modules/ppcp-api-client/src/Repository/class-partnerreferralsdata.php
CHANGED
@@ -74,12 +74,13 @@ class PartnerReferralsData {
|
|
74 |
return array(
|
75 |
'partner_config_override' => array(
|
76 |
'partner_logo_url' => 'https://connect.woocommerce.com/images/woocommerce_logo.png',
|
77 |
-
'return_url' =>
|
78 |
-
'
|
|
|
79 |
),
|
80 |
-
'return_url_description' =>
|
81 |
-
'
|
82 |
-
'woocommerce-paypal-payments'
|
83 |
),
|
84 |
'show_add_credit_card' => true,
|
85 |
),
|
74 |
return array(
|
75 |
'partner_config_override' => array(
|
76 |
'partner_logo_url' => 'https://connect.woocommerce.com/images/woocommerce_logo.png',
|
77 |
+
'return_url' => apply_filters(
|
78 |
+
'woocommerce_paypal_payments_partner_config_override_return_url',
|
79 |
+
admin_url( 'admin.php?page=wc-settings&tab=checkout§ion=ppcp-gateway' )
|
80 |
),
|
81 |
+
'return_url_description' => apply_filters(
|
82 |
+
'woocommerce_paypal_payments_partner_config_override_return_url_description',
|
83 |
+
__( 'Return to your shop.', 'woocommerce-paypal-payments' )
|
84 |
),
|
85 |
'show_add_credit_card' => true,
|
86 |
),
|
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";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
|
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),onCancel:()=>{e.unblock()},onError:()=>{this.errorHandler.genericError(),e.unblock()}}}};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))).catch(()=>{this.spinner.unblock(),this.errorHandler.genericError()})}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","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,EAAiBE,GAAUC,QAGnC,IAAIC,EAASJ,EAAiBE,GAAY,CACzCG,EAAGH,EACHI,GAAG,EACHH,QAAS,IAUV,OANAI,EAAQL,GAAUM,KAAKJ,EAAOD,QAASC,EAAQA,EAAOD,QAASF,GAG/DG,EAAOE,GAAI,EAGJF,EAAOD,QAKfF,EAAoBQ,EAAIF,EAGxBN,EAAoBS,EAAIV,EAGxBC,EAAoBU,EAAI,SAASR,EAASS,EAAMC,GAC3CZ,EAAoBa,EAAEX,EAASS,IAClCG,OAAOC,eAAeb,EAASS,EAAM,CAAEK,YAAY,EAAMC,IAAKL,KAKhEZ,EAAoBkB,EAAI,SAAShB,GACX,oBAAXiB,QAA0BA,OAAOC,aAC1CN,OAAOC,eAAeb,EAASiB,OAAOC,YAAa,CAAEC,MAAO,WAE7DP,OAAOC,eAAeb,EAAS,aAAc,CAAEmB,OAAO,KAQvDrB,EAAoBsB,EAAI,SAASD,EAAOE,GAEvC,GADU,EAAPA,IAAUF,EAAQrB,EAAoBqB,IAC/B,EAAPE,EAAU,OAAOF,EACpB,GAAW,EAAPE,GAA8B,iBAAVF,GAAsBA,GAASA,EAAMG,WAAY,OAAOH,EAChF,IAAII,EAAKX,OAAOY,OAAO,MAGvB,GAFA1B,EAAoBkB,EAAEO,GACtBX,OAAOC,eAAeU,EAAI,UAAW,CAAET,YAAY,EAAMK,MAAOA,IACtD,EAAPE,GAA4B,iBAATF,EAAmB,IAAI,IAAIM,KAAON,EAAOrB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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":""}
|
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","onCancel","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","setTarget","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,EAAQL,GAAUM,KAAKJ,EAAOD,QAASC,EAAQA,EAAOD,QAASF,GAG/DG,EAAOE,GAAI,EAGJF,EAAOD,QAKfF,EAAoBQ,EAAIF,EAGxBN,EAAoBS,EAAIV,EAGxBC,EAAoBU,EAAI,SAASR,EAASS,EAAMC,GAC3CZ,EAAoBa,EAAEX,EAASS,IAClCG,OAAOC,eAAeb,EAASS,EAAM,CAAEK,YAAY,EAAMC,IAAKL,KAKhEZ,EAAoBkB,EAAI,SAAShB,GACX,oBAAXiB,QAA0BA,OAAOC,aAC1CN,OAAOC,eAAeb,EAASiB,OAAOC,YAAa,CAAEC,MAAO,WAE7DP,OAAOC,eAAeb,EAAS,aAAc,CAAEmB,OAAO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YAAZ5D,EAAwB,CACA,IAAI4I,EACxBhH,sBACA8B,EACA0L,EACA9H,GAEY1D,OAGJ,aAAZ5D,GACAoP,EAAgBrL,UAaZsL,KAEJtB,EAAO9F,aAAa,MAAOrG,sBAAsBsC,OAAOoL,KACxDrS,OAAOsS,QAAQ3N,sBAAsB4N,mBAAmBpJ,QACnDqJ,IACG1B,EAAO9F,aAAawH,EAAS,GAAIA,EAAS,MAI9C7N,sBAAsB8N,eAAeC,cACrC7B,EAA6BC,EAAQnM,sBAAsB8N,gBAI/D9Q,SAAS8B,KAAKyH,OAAO4F","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 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 onCancel: () => {\n spinner.unblock();\n },\n onError: () => {\n this.errorHandler.genericError();\n spinner.unblock();\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 }).catch(() => {\n this.spinner.unblock();\n this.errorHandler.genericError()\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;\n","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/modules/ActionHandler/CheckoutActionHandler.js
CHANGED
@@ -19,9 +19,6 @@ class CheckoutActionHandler {
|
|
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, {
|
@@ -53,8 +50,12 @@ class CheckoutActionHandler {
|
|
53 |
return {
|
54 |
createOrder,
|
55 |
onApprove:onApprove(this, this.errorHandler, this.spinner),
|
56 |
-
|
|
|
|
|
|
|
57 |
this.errorHandler.genericError();
|
|
|
58 |
}
|
59 |
}
|
60 |
}
|
19 |
const errorHandler = this.errorHandler;
|
20 |
|
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, {
|
50 |
return {
|
51 |
createOrder,
|
52 |
onApprove:onApprove(this, this.errorHandler, this.spinner),
|
53 |
+
onCancel: () => {
|
54 |
+
spinner.unblock();
|
55 |
+
},
|
56 |
+
onError: () => {
|
57 |
this.errorHandler.genericError();
|
58 |
+
spinner.unblock();
|
59 |
}
|
60 |
}
|
61 |
}
|
modules/ppcp-button/resources/js/modules/Renderer/CreditCardRenderer.js
CHANGED
@@ -115,6 +115,9 @@ class CreditCardRenderer {
|
|
115 |
payload.orderID = payload.orderId;
|
116 |
this.spinner.unblock();
|
117 |
return contextConfig.onApprove(payload);
|
|
|
|
|
|
|
118 |
});
|
119 |
} else {
|
120 |
this.spinner.unblock();
|
@@ -147,4 +150,4 @@ class CreditCardRenderer {
|
|
147 |
)
|
148 |
}
|
149 |
}
|
150 |
-
export default CreditCardRenderer;
|
115 |
payload.orderID = payload.orderId;
|
116 |
this.spinner.unblock();
|
117 |
return contextConfig.onApprove(payload);
|
118 |
+
}).catch(() => {
|
119 |
+
this.spinner.unblock();
|
120 |
+
this.errorHandler.genericError()
|
121 |
});
|
122 |
} else {
|
123 |
this.spinner.unblock();
|
150 |
)
|
151 |
}
|
152 |
}
|
153 |
+
export default CreditCardRenderer;
|
modules/ppcp-onboarding/assets/js/onboarding.js
CHANGED
@@ -1,22 +1,104 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
}
|
17 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
}
|
19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
}
|
21 |
|
22 |
/**
|
@@ -174,21 +256,23 @@ const disconnect = (event) => {
|
|
174 |
);
|
175 |
|
176 |
// Prevent a possibly dirty form arising from this particular checkbox.
|
177 |
-
sandboxSwitchElement
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
|
|
|
|
192 |
|
193 |
// document.querySelectorAll('#mainform input[type="checkbox"]').forEach(
|
194 |
// (checkbox) => {
|
@@ -207,6 +291,8 @@ const disconnect = (event) => {
|
|
207 |
}
|
208 |
)
|
209 |
}
|
210 |
-
)
|
211 |
|
|
|
|
|
212 |
})();
|
1 |
+
// Onboarding.
|
2 |
+
const ppcp_onboarding = {
|
3 |
+
BUTTON_SELECTOR: '[data-paypal-onboard-button]',
|
4 |
+
PAYPAL_JS_ID: 'ppcp-onboarding-paypal-js',
|
5 |
+
_timeout: false,
|
6 |
+
|
7 |
+
init: function() {
|
8 |
+
document.addEventListener('DOMContentLoaded', this.reload);
|
9 |
+
},
|
10 |
+
|
11 |
+
reload: function() {
|
12 |
+
const buttons = document.querySelectorAll(ppcp_onboarding.BUTTON_SELECTOR);
|
13 |
+
|
14 |
+
if (0 === buttons.length) {
|
15 |
+
return;
|
16 |
+
}
|
17 |
+
|
18 |
+
// Add event listeners to buttons.
|
19 |
+
buttons.forEach(
|
20 |
+
(element) => {
|
21 |
+
if (element.hasAttribute('data-ppcp-button-initialized')) {
|
22 |
+
return;
|
23 |
}
|
24 |
+
|
25 |
+
element.addEventListener(
|
26 |
+
'click',
|
27 |
+
(e) => {
|
28 |
+
if (!element.hasAttribute('data-ppcp-button-initialized') || 'undefined' === typeof window.PAYPAL) {
|
29 |
+
e.preventDefault();
|
30 |
+
}
|
31 |
+
}
|
32 |
+
);
|
33 |
+
}
|
34 |
+
);
|
35 |
+
|
36 |
+
// Clear any previous PayPal scripts.
|
37 |
+
[ppcp_onboarding.PAYPAL_JS_ID, 'signup-js', 'biz-js'].forEach(
|
38 |
+
(scriptID) => {
|
39 |
+
const scriptTag = document.getElementById(scriptID);
|
40 |
+
|
41 |
+
if (scriptTag) {
|
42 |
+
scriptTag.parentNode.removeChild(scriptTag);
|
43 |
+
}
|
44 |
+
|
45 |
+
if ('undefined' !== typeof window.PAYPAL) {
|
46 |
+
delete window.PAYPAL;
|
47 |
+
}
|
48 |
+
}
|
49 |
+
);
|
50 |
+
|
51 |
+
// Load PayPal scripts.
|
52 |
+
const paypalScriptTag = document.createElement('script');
|
53 |
+
paypalScriptTag.id = ppcp_onboarding.PAYPAL_JS_ID;
|
54 |
+
paypalScriptTag.src = PayPalCommerceGatewayOnboarding.paypal_js_url;
|
55 |
+
document.body.append(paypalScriptTag);
|
56 |
+
|
57 |
+
if (ppcp_onboarding._timeout) {
|
58 |
+
clearTimeout(ppcp_onboarding._timeout);
|
59 |
}
|
60 |
+
|
61 |
+
ppcp_onboarding._timeout = setTimeout(
|
62 |
+
() => {
|
63 |
+
buttons.forEach((element) => { element.setAttribute('data-ppcp-button-initialized', 'true'); });
|
64 |
+
|
65 |
+
if ('undefined' !== window.PAYPAL.apps.Signup) {
|
66 |
+
window.PAYPAL.apps.Signup.render();
|
67 |
+
}
|
68 |
+
},
|
69 |
+
1000
|
70 |
+
);
|
71 |
+
},
|
72 |
+
|
73 |
+
loginSeller: function(env, authCode, sharedId) {
|
74 |
+
fetch(
|
75 |
+
PayPalCommerceGatewayOnboarding.endpoint,
|
76 |
+
{
|
77 |
+
method: 'POST',
|
78 |
+
headers: {
|
79 |
+
'content-type': 'application/json'
|
80 |
+
},
|
81 |
+
body: JSON.stringify(
|
82 |
+
{
|
83 |
+
authCode: authCode,
|
84 |
+
sharedId: sharedId,
|
85 |
+
nonce: PayPalCommerceGatewayOnboarding.nonce,
|
86 |
+
env: env
|
87 |
+
}
|
88 |
+
)
|
89 |
+
}
|
90 |
+
);
|
91 |
+
},
|
92 |
+
|
93 |
+
|
94 |
+
};
|
95 |
+
|
96 |
+
function ppcp_onboarding_sandboxCallback(...args) {
|
97 |
+
return ppcp_onboarding.loginSeller('sandbox', ...args);
|
98 |
+
}
|
99 |
+
|
100 |
+
function ppcp_onboarding_productionCallback(...args) {
|
101 |
+
return ppcp_onboarding.loginSeller('production', ...args);
|
102 |
}
|
103 |
|
104 |
/**
|
256 |
);
|
257 |
|
258 |
// Prevent a possibly dirty form arising from this particular checkbox.
|
259 |
+
if (sandboxSwitchElement) {
|
260 |
+
sandboxSwitchElement.addEventListener(
|
261 |
+
'click',
|
262 |
+
(event) => {
|
263 |
+
const value = event.target.checked;
|
264 |
+
|
265 |
+
toggleSandboxProduction( ! value );
|
266 |
+
|
267 |
+
event.preventDefault();
|
268 |
+
event.stopPropagation();
|
269 |
+
setTimeout( () => {
|
270 |
+
event.target.checked = value;
|
271 |
+
}, 1
|
272 |
+
);
|
273 |
+
}
|
274 |
+
);
|
275 |
+
}
|
276 |
|
277 |
// document.querySelectorAll('#mainform input[type="checkbox"]').forEach(
|
278 |
// (checkbox) => {
|
291 |
}
|
292 |
)
|
293 |
}
|
294 |
+
);
|
295 |
|
296 |
+
// Onboarding buttons.
|
297 |
+
ppcp_onboarding.init();
|
298 |
})();
|
modules/ppcp-onboarding/services.php
CHANGED
@@ -18,6 +18,7 @@ use WooCommerce\PayPalCommerce\ApiClient\Helper\Cache;
|
|
18 |
use WooCommerce\PayPalCommerce\Onboarding\Assets\OnboardingAssets;
|
19 |
use WooCommerce\PayPalCommerce\Onboarding\Endpoint\LoginSellerEndpoint;
|
20 |
use WooCommerce\PayPalCommerce\Onboarding\Render\OnboardingRenderer;
|
|
|
21 |
|
22 |
return array(
|
23 |
'api.sandbox-host' => static function ( $container ): string {
|
@@ -207,4 +208,7 @@ return array(
|
|
207 |
$partner_referrals_sandbox
|
208 |
);
|
209 |
},
|
|
|
|
|
|
|
210 |
);
|
18 |
use WooCommerce\PayPalCommerce\Onboarding\Assets\OnboardingAssets;
|
19 |
use WooCommerce\PayPalCommerce\Onboarding\Endpoint\LoginSellerEndpoint;
|
20 |
use WooCommerce\PayPalCommerce\Onboarding\Render\OnboardingRenderer;
|
21 |
+
use WooCommerce\PayPalCommerce\Onboarding\Onboarding_REST_Controller;
|
22 |
|
23 |
return array(
|
24 |
'api.sandbox-host' => static function ( $container ): string {
|
208 |
$partner_referrals_sandbox
|
209 |
);
|
210 |
},
|
211 |
+
'onboarding.rest' => static function( $container ) : Onboarding_REST_Controller {
|
212 |
+
return new Onboarding_REST_Controller( $container );
|
213 |
+
},
|
214 |
);
|
modules/ppcp-onboarding/src/Assets/class-onboardingassets.php
CHANGED
@@ -51,7 +51,7 @@ class OnboardingAssets {
|
|
51 |
LoginSellerEndpoint $login_seller_endpoint
|
52 |
) {
|
53 |
|
54 |
-
$this->module_url = $module_url;
|
55 |
$this->state = $state;
|
56 |
$this->login_seller_endpoint = $login_seller_endpoint;
|
57 |
}
|
@@ -78,9 +78,6 @@ class OnboardingAssets {
|
|
78 |
1,
|
79 |
true
|
80 |
);
|
81 |
-
if ( ! $this->should_render_onboarding_script() ) {
|
82 |
-
return false;
|
83 |
-
}
|
84 |
|
85 |
$url = $this->module_url . '/assets/js/onboarding.js';
|
86 |
wp_register_script(
|
@@ -93,15 +90,25 @@ class OnboardingAssets {
|
|
93 |
wp_localize_script(
|
94 |
'ppcp-onboarding',
|
95 |
'PayPalCommerceGatewayOnboarding',
|
96 |
-
|
97 |
-
'endpoint' => home_url( \WC_AJAX::get_endpoint( LoginSellerEndpoint::ENDPOINT ) ),
|
98 |
-
'nonce' => wp_create_nonce( $this->login_seller_endpoint::nonce() ),
|
99 |
-
)
|
100 |
);
|
101 |
|
102 |
return true;
|
103 |
}
|
104 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
105 |
/**
|
106 |
* Enqueues the necessary scripts.
|
107 |
*
|
51 |
LoginSellerEndpoint $login_seller_endpoint
|
52 |
) {
|
53 |
|
54 |
+
$this->module_url = untrailingslashit( $module_url );
|
55 |
$this->state = $state;
|
56 |
$this->login_seller_endpoint = $login_seller_endpoint;
|
57 |
}
|
78 |
1,
|
79 |
true
|
80 |
);
|
|
|
|
|
|
|
81 |
|
82 |
$url = $this->module_url . '/assets/js/onboarding.js';
|
83 |
wp_register_script(
|
90 |
wp_localize_script(
|
91 |
'ppcp-onboarding',
|
92 |
'PayPalCommerceGatewayOnboarding',
|
93 |
+
$this->get_script_data()
|
|
|
|
|
|
|
94 |
);
|
95 |
|
96 |
return true;
|
97 |
}
|
98 |
|
99 |
+
/**
|
100 |
+
* Returns the data associated to the onboarding script.
|
101 |
+
*
|
102 |
+
* @return array
|
103 |
+
*/
|
104 |
+
public function get_script_data() {
|
105 |
+
return array(
|
106 |
+
'endpoint' => home_url( \WC_AJAX::get_endpoint( LoginSellerEndpoint::ENDPOINT ) ),
|
107 |
+
'nonce' => wp_create_nonce( $this->login_seller_endpoint::nonce() ),
|
108 |
+
'paypal_js_url' => 'https://www.paypal.com/webapps/merchantboarding/js/lib/lightbox/partner.js',
|
109 |
+
);
|
110 |
+
}
|
111 |
+
|
112 |
/**
|
113 |
* Enqueues the necessary scripts.
|
114 |
*
|
modules/ppcp-onboarding/src/Render/class-onboardingrenderer.php
CHANGED
@@ -52,6 +52,23 @@ class OnboardingRenderer {
|
|
52 |
$this->sandbox_partner_referrals = $sandbox_partner_referrals;
|
53 |
}
|
54 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
55 |
/**
|
56 |
* Renders the "Connect to PayPal" button.
|
57 |
*
|
@@ -59,27 +76,12 @@ class OnboardingRenderer {
|
|
59 |
*/
|
60 |
public function render( bool $is_production ) {
|
61 |
try {
|
62 |
-
$
|
63 |
-
|
|
|
|
|
|
|
64 |
);
|
65 |
-
|
66 |
-
$url = $is_production ? $this->production_partner_referrals->signup_link() : $this->sandbox_partner_referrals->signup_link();
|
67 |
-
$url = add_query_arg( $args, $url );
|
68 |
-
$id = $is_production ? 'connect-to-production' : 'connect-to-sandbox';
|
69 |
-
$label = $is_production ? __( 'Connect to PayPal', 'woocommerce-paypal-payments' ) : __( 'Connect to PayPal Sandbox', 'woocommerce-paypal-payments' );
|
70 |
-
$this->render_button(
|
71 |
-
$url,
|
72 |
-
$id,
|
73 |
-
$label
|
74 |
-
);
|
75 |
-
|
76 |
-
$script_url = 'https://www.paypal.com/webapps/merchantboarding/js/lib/lightbox/partner.js'; ?>
|
77 |
-
<script>document.querySelectorAll('[data-paypal-onboard-complete=onboardingCallback]').forEach( (element) => { element.addEventListener('click', (e) => {if ('undefined' === typeof PAYPAL ) e.preventDefault(); }) });</script>
|
78 |
-
<script
|
79 |
-
id="paypal-js"
|
80 |
-
src="<?php echo esc_url( $script_url ); ?>"
|
81 |
-
></script>
|
82 |
-
<?php
|
83 |
} catch ( RuntimeException $exception ) {
|
84 |
esc_html_e(
|
85 |
'We could not properly connect to PayPal. Please reload the page to continue',
|
@@ -94,14 +96,16 @@ class OnboardingRenderer {
|
|
94 |
* @param string $url The url of the button.
|
95 |
* @param string $id The ID of the button.
|
96 |
* @param string $label The button text.
|
|
|
97 |
*/
|
98 |
-
private function render_button( string $url, string $id, string $label ) {
|
99 |
?>
|
100 |
<a
|
101 |
target="_blank"
|
102 |
class="button-primary"
|
103 |
id="<?php echo esc_attr( $id ); ?>"
|
104 |
-
data-paypal-onboard-complete="
|
|
|
105 |
href="<?php echo esc_url( $url ); ?>"
|
106 |
data-paypal-button="true"
|
107 |
>
|
52 |
$this->sandbox_partner_referrals = $sandbox_partner_referrals;
|
53 |
}
|
54 |
|
55 |
+
/**
|
56 |
+
* Returns the action URL for the onboarding button/link.
|
57 |
+
*
|
58 |
+
* @param boolean $is_production Whether the production or sandbox button should be rendered.
|
59 |
+
* @return string URL.
|
60 |
+
*/
|
61 |
+
public function get_signup_link( bool $is_production ) {
|
62 |
+
$args = array(
|
63 |
+
'displayMode' => 'minibrowser',
|
64 |
+
);
|
65 |
+
|
66 |
+
$url = $is_production ? $this->production_partner_referrals->signup_link() : $this->sandbox_partner_referrals->signup_link();
|
67 |
+
$url = add_query_arg( $args, $url );
|
68 |
+
|
69 |
+
return $url;
|
70 |
+
}
|
71 |
+
|
72 |
/**
|
73 |
* Renders the "Connect to PayPal" button.
|
74 |
*
|
76 |
*/
|
77 |
public function render( bool $is_production ) {
|
78 |
try {
|
79 |
+
$this->render_button(
|
80 |
+
$this->get_signup_link( $is_production ),
|
81 |
+
$is_production ? 'connect-to-production' : 'connect-to-sandbox',
|
82 |
+
$is_production ? __( 'Connect to PayPal', 'woocommerce-paypal-payments' ) : __( 'Connect to PayPal Sandbox', 'woocommerce-paypal-payments' ),
|
83 |
+
$is_production ? 'production' : 'sandbox'
|
84 |
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
85 |
} catch ( RuntimeException $exception ) {
|
86 |
esc_html_e(
|
87 |
'We could not properly connect to PayPal. Please reload the page to continue',
|
96 |
* @param string $url The url of the button.
|
97 |
* @param string $id The ID of the button.
|
98 |
* @param string $label The button text.
|
99 |
+
* @param string $env The environment ('production' or 'sandbox').
|
100 |
*/
|
101 |
+
private function render_button( string $url, string $id, string $label, string $env ) {
|
102 |
?>
|
103 |
<a
|
104 |
target="_blank"
|
105 |
class="button-primary"
|
106 |
id="<?php echo esc_attr( $id ); ?>"
|
107 |
+
data-paypal-onboard-complete="ppcp_onboarding_<?php echo esc_attr( $env ); ?>Callback"
|
108 |
+
data-paypal-onboard-button="true"
|
109 |
href="<?php echo esc_url( $url ); ?>"
|
110 |
data-paypal-button="true"
|
111 |
>
|
modules/ppcp-onboarding/src/class-onboarding-rest-controller.php
ADDED
@@ -0,0 +1,321 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Onboarding REST controller.
|
4 |
+
*
|
5 |
+
* @package WooCommerce\PayPalCommerce\Onboarding
|
6 |
+
*/
|
7 |
+
|
8 |
+
declare(strict_types=1);
|
9 |
+
|
10 |
+
namespace WooCommerce\PayPalCommerce\Onboarding;
|
11 |
+
|
12 |
+
use Psr\Container\ContainerInterface;
|
13 |
+
use WooCommerce\PayPalCommerce\Onboarding\State;
|
14 |
+
use WooCommerce\PayPalCommerce\WcGateway\Gateway\PayPalGateway;
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Exposes and handles REST routes related to onboarding.
|
18 |
+
*/
|
19 |
+
class Onboarding_REST_Controller {
|
20 |
+
|
21 |
+
/**
|
22 |
+
* REST namespace.
|
23 |
+
*
|
24 |
+
* @var string
|
25 |
+
*/
|
26 |
+
protected $rest_namespace = 'wc-paypal/v1';
|
27 |
+
|
28 |
+
/**
|
29 |
+
* REST base.
|
30 |
+
*
|
31 |
+
* @var string
|
32 |
+
*/
|
33 |
+
protected $rest_base = 'onboarding';
|
34 |
+
|
35 |
+
/**
|
36 |
+
* Module container with access to plugin services.
|
37 |
+
*
|
38 |
+
* @var ContainerInterface
|
39 |
+
*/
|
40 |
+
private $container = null;
|
41 |
+
|
42 |
+
/**
|
43 |
+
* Used to temporarily store URL arguments to add to the return URL associated to a signup link.
|
44 |
+
*
|
45 |
+
* @var array
|
46 |
+
*/
|
47 |
+
private $return_url_args = array();
|
48 |
+
|
49 |
+
|
50 |
+
/**
|
51 |
+
* OnboardingRESTController constructor.
|
52 |
+
*
|
53 |
+
* @param ContainerInterface $container Module container with access to plugin services.
|
54 |
+
*/
|
55 |
+
public function __construct( ContainerInterface $container ) {
|
56 |
+
$this->container = $container;
|
57 |
+
}
|
58 |
+
|
59 |
+
/**
|
60 |
+
* Registers REST routes under 'wc-paypal/v1/onboarding'.
|
61 |
+
* Specifically:
|
62 |
+
* - `/onboarding/get-params`, which returns information useful to display an onboarding button.
|
63 |
+
* - `/onboarding/get-status`, which returns information about the current environment and its onboarding state.
|
64 |
+
* - `/onboarding/set-credentials`, which allows setting merchant/API credentials.
|
65 |
+
*/
|
66 |
+
public function register_routes() {
|
67 |
+
register_rest_route(
|
68 |
+
$this->rest_namespace,
|
69 |
+
'/' . $this->rest_base . '/get-params',
|
70 |
+
array(
|
71 |
+
'methods' => 'POST',
|
72 |
+
'callback' => array( $this, 'get_params' ),
|
73 |
+
'permission_callback' => array( $this, 'check_permission' ),
|
74 |
+
)
|
75 |
+
);
|
76 |
+
|
77 |
+
register_rest_route(
|
78 |
+
$this->rest_namespace,
|
79 |
+
'/' . $this->rest_base . '/get-status',
|
80 |
+
array(
|
81 |
+
'methods' => 'GET',
|
82 |
+
'callback' => array( $this, 'get_status' ),
|
83 |
+
'permission_callback' => array( $this, 'check_permission' ),
|
84 |
+
)
|
85 |
+
);
|
86 |
+
|
87 |
+
register_rest_route(
|
88 |
+
$this->rest_namespace,
|
89 |
+
'/' . $this->rest_base . '/set-credentials',
|
90 |
+
array(
|
91 |
+
'methods' => 'POST',
|
92 |
+
'callback' => array( $this, 'set_credentials' ),
|
93 |
+
'permission_callback' => array( $this, 'check_permission' ),
|
94 |
+
)
|
95 |
+
);
|
96 |
+
}
|
97 |
+
|
98 |
+
/**
|
99 |
+
* Validate the requester's permissions.
|
100 |
+
*
|
101 |
+
* @param WP_REST_Request $request The request.
|
102 |
+
* @return bool
|
103 |
+
*/
|
104 |
+
public function check_permission( $request ) {
|
105 |
+
return current_user_can( 'install_plugins' );
|
106 |
+
}
|
107 |
+
|
108 |
+
/**
|
109 |
+
* Callback for the `/onboarding/get-params` endpoint.
|
110 |
+
*
|
111 |
+
* @param WP_REST_Request $request The request.
|
112 |
+
* @return array
|
113 |
+
*/
|
114 |
+
public function get_params( $request ) {
|
115 |
+
$params = $request->get_json_params();
|
116 |
+
|
117 |
+
$environment = ( isset( $params['environment'] ) && in_array( $params['environment'], array( 'production', 'sandbox' ), true ) ) ? $params['environment'] : 'sandbox';
|
118 |
+
|
119 |
+
return array(
|
120 |
+
'scriptURL' => trailingslashit( $this->container->get( 'onboarding.url' ) ) . 'assets/js/onboarding.js',
|
121 |
+
'scriptData' => $this->container->get( 'onboarding.assets' )->get_script_data(),
|
122 |
+
'environment' => $environment,
|
123 |
+
'onboardCompleteCallback' => 'ppcp_onboarding_' . $environment . 'Callback',
|
124 |
+
'signupLink' => $this->generate_signup_link( $environment, ( ! empty( $params['returnUrlArgs'] ) ? $params['returnUrlArgs'] : array() ) ),
|
125 |
+
);
|
126 |
+
}
|
127 |
+
|
128 |
+
/**
|
129 |
+
* Callback for the `/onboarding/get-status` endpoint.
|
130 |
+
*
|
131 |
+
* @param WP_REST_Request $request The request.
|
132 |
+
* @return array
|
133 |
+
*/
|
134 |
+
public function get_status( $request ) {
|
135 |
+
$environment = $this->container->get( 'onboarding.environment' );
|
136 |
+
$state = $this->container->get( 'onboarding.state' );
|
137 |
+
|
138 |
+
return array(
|
139 |
+
'environment' => $environment->current_environment(),
|
140 |
+
'onboarded' => ( $state->current_state() >= State::STATE_ONBOARDED ),
|
141 |
+
'state' => $this->get_onboarding_state_name( $state->current_state() ),
|
142 |
+
'sandbox' => array(
|
143 |
+
'state' => $this->get_onboarding_state_name( $state->sandbox_state() ),
|
144 |
+
'onboarded' => ( $state->sandbox_state() >= State::STATE_ONBOARDED ),
|
145 |
+
),
|
146 |
+
'production' => array(
|
147 |
+
'state' => $this->get_onboarding_state_name( $state->production_state() ),
|
148 |
+
'onboarded' => ( $state->production_state() >= State::STATE_ONBOARDED ),
|
149 |
+
),
|
150 |
+
);
|
151 |
+
}
|
152 |
+
|
153 |
+
/**
|
154 |
+
* Callback for the `/onboarding/set-credentials` endpoint.
|
155 |
+
*
|
156 |
+
* @param WP_REST_Request $request The request.
|
157 |
+
* @return WP_Error|array
|
158 |
+
*/
|
159 |
+
public function set_credentials( $request ) {
|
160 |
+
static $credential_keys = array(
|
161 |
+
'merchant_id',
|
162 |
+
'merchant_email',
|
163 |
+
'client_id',
|
164 |
+
'client_secret',
|
165 |
+
);
|
166 |
+
|
167 |
+
// Sanitize params.
|
168 |
+
$params = array_filter( array_map( 'trim', $request->get_json_params() ) );
|
169 |
+
|
170 |
+
// Validate 'environment'.
|
171 |
+
if ( empty( $params['environment'] ) || ! in_array( $params['environment'], array( 'sandbox', 'production' ), true ) ) {
|
172 |
+
return new \WP_Error(
|
173 |
+
'woocommerce_paypal_payments_invalid_environment',
|
174 |
+
sprintf(
|
175 |
+
/* translators: placeholder is an arbitrary string. */
|
176 |
+
__( 'Environment "%s" is invalid. Use "sandbox" or "production".', 'woocommerce-paypal-payments' ),
|
177 |
+
isset( $params['environment'] ) ? $params['environment'] : ''
|
178 |
+
),
|
179 |
+
array( 'status' => 400 )
|
180 |
+
);
|
181 |
+
}
|
182 |
+
|
183 |
+
// Validate the other fields.
|
184 |
+
$missing_keys = array_values( array_diff( $credential_keys, array_keys( $params ) ) );
|
185 |
+
if ( $missing_keys ) {
|
186 |
+
return new \WP_Error(
|
187 |
+
'woocommerce_paypal_payments_credentials_incomplete',
|
188 |
+
sprintf(
|
189 |
+
/* translators: placeholder is a comma-separated list of fields. */
|
190 |
+
__( 'Credentials are incomplete. Missing fields: %s.', 'woocommerce-paypal-payments' ),
|
191 |
+
implode( ', ', $missing_keys )
|
192 |
+
),
|
193 |
+
array(
|
194 |
+
'missing_fields' => $missing_keys,
|
195 |
+
'status' => 400,
|
196 |
+
)
|
197 |
+
);
|
198 |
+
}
|
199 |
+
|
200 |
+
$settings = $this->container->get( 'wcgateway.settings' );
|
201 |
+
$skip_persist = true;
|
202 |
+
|
203 |
+
// Enable gateway.
|
204 |
+
if ( ! $settings->has( 'enabled' ) || ! $settings->get( 'enabled' ) ) {
|
205 |
+
$settings->set( 'enabled', true );
|
206 |
+
$skip_persist = false;
|
207 |
+
}
|
208 |
+
|
209 |
+
foreach ( WC()->payment_gateways->payment_gateways() as $gateway ) {
|
210 |
+
if ( PayPalGateway::ID === $gateway->id ) {
|
211 |
+
$gateway->update_option( 'enabled', 'yes' );
|
212 |
+
break;
|
213 |
+
}
|
214 |
+
}
|
215 |
+
|
216 |
+
// Update settings.
|
217 |
+
$sandbox_on = ( 'sandbox' === $params['environment'] );
|
218 |
+
if ( ! $settings->has( 'sandbox_on' ) || ( (bool) $settings->get( 'sandbox_on' ) !== $sandbox_on ) ) {
|
219 |
+
$settings->set( 'sandbox_on', $sandbox_on );
|
220 |
+
$skip_persist = false;
|
221 |
+
}
|
222 |
+
|
223 |
+
foreach ( $credential_keys as $key ) {
|
224 |
+
$value = $params[ $key ];
|
225 |
+
$env_key = $key . '_' . $params['environment'];
|
226 |
+
|
227 |
+
if ( ! $settings->has( $key ) || ! $settings->has( $env_key ) || $settings->get( $key ) !== $value || $settings->get( $env_key ) !== $value ) {
|
228 |
+
$settings->set( $key, $value );
|
229 |
+
$settings->set( $env_key, $value );
|
230 |
+
$skip_persist = false;
|
231 |
+
}
|
232 |
+
}
|
233 |
+
|
234 |
+
if ( $skip_persist ) {
|
235 |
+
return array();
|
236 |
+
}
|
237 |
+
|
238 |
+
$settings->set( 'products_dcc_enabled', null );
|
239 |
+
|
240 |
+
if ( ! $settings->persist() ) {
|
241 |
+
return new \WP_Error(
|
242 |
+
'woocommerce_paypal_payments_credentials_not_saved',
|
243 |
+
__( 'An error occurred while saving the credentials.', 'woocommerce-paypal-payments' ),
|
244 |
+
array(
|
245 |
+
'status' => 500,
|
246 |
+
)
|
247 |
+
);
|
248 |
+
}
|
249 |
+
|
250 |
+
$webhook_registrar = $this->container->get( 'webhook.registrar' );
|
251 |
+
$webhook_registrar->unregister();
|
252 |
+
$webhook_registrar->register();
|
253 |
+
|
254 |
+
return array();
|
255 |
+
}
|
256 |
+
|
257 |
+
/**
|
258 |
+
* Appends URL parameters stored in this class to a given URL.
|
259 |
+
*
|
260 |
+
* @hooked woocommerce_paypal_payments_partner_config_override_return_url - 10
|
261 |
+
* @param string $url URL.
|
262 |
+
* @return string The URL with the stored URL parameters added to it.
|
263 |
+
*/
|
264 |
+
public function add_args_to_return_url( $url ) {
|
265 |
+
return add_query_arg( $this->return_url_args, $url );
|
266 |
+
}
|
267 |
+
|
268 |
+
/**
|
269 |
+
* Translates an onboarding state to a string.
|
270 |
+
*
|
271 |
+
* @param int $state An onboarding state to translate as returned by {@link State} methods.
|
272 |
+
* @return string A string representing the state: "start", "progressive" or "onboarded".
|
273 |
+
* @see State::current_state(), State::sandbox_state(), State::production_state().
|
274 |
+
*/
|
275 |
+
public function get_onboarding_state_name( $state ) {
|
276 |
+
$name = 'unknown';
|
277 |
+
|
278 |
+
switch ( absint( $state ) ) {
|
279 |
+
case State::STATE_START:
|
280 |
+
$name = 'start';
|
281 |
+
break;
|
282 |
+
case State::STATE_PROGRESSIVE:
|
283 |
+
$name = 'progressive';
|
284 |
+
break;
|
285 |
+
case State::STATE_ONBOARDED:
|
286 |
+
$name = 'onboarded';
|
287 |
+
break;
|
288 |
+
default:
|
289 |
+
break;
|
290 |
+
|
291 |
+
}
|
292 |
+
|
293 |
+
return $name;
|
294 |
+
}
|
295 |
+
|
296 |
+
/**
|
297 |
+
* Generates a signup link for onboarding for a given environment and optionally adding certain URL arguments
|
298 |
+
* to the URL users are redirected after completing the onboarding flow.
|
299 |
+
*
|
300 |
+
* @param string $environment The environment to use. Either 'sandbox' or 'production'. Defaults to 'sandbox'.
|
301 |
+
* @param array $url_args An array of URL arguments to add to the return URL via {@link add_query_arg()}.
|
302 |
+
* @return string
|
303 |
+
*/
|
304 |
+
private function generate_signup_link( $environment = 'sandbox', $url_args = array() ) {
|
305 |
+
$this->return_url_args = ( ! empty( $url_args ) && is_array( $url_args ) ) ? $url_args : array();
|
306 |
+
|
307 |
+
if ( $this->return_url_args ) {
|
308 |
+
add_filter( 'woocommerce_paypal_payments_partner_config_override_return_url', array( $this, 'add_args_to_return_url' ) );
|
309 |
+
}
|
310 |
+
|
311 |
+
$link = $this->container->get( 'onboarding.render' )->get_signup_link( 'production' === $environment );
|
312 |
+
|
313 |
+
if ( $this->return_url_args ) {
|
314 |
+
remove_filter( 'woocommerce_paypal_payments_partner_config_override_return_url', array( $this, 'add_args_to_return_url' ) );
|
315 |
+
$this->return_url_args = array();
|
316 |
+
}
|
317 |
+
|
318 |
+
return $link;
|
319 |
+
}
|
320 |
+
|
321 |
+
}
|
modules/ppcp-onboarding/src/class-onboardingmodule.php
CHANGED
@@ -41,7 +41,6 @@ class OnboardingModule implements ModuleInterface {
|
|
41 |
* @param ContainerInterface|null $container The container.
|
42 |
*/
|
43 |
public function run( ContainerInterface $container = null ) {
|
44 |
-
|
45 |
$asset_loader = $container->get( 'onboarding.assets' );
|
46 |
/**
|
47 |
* The OnboardingAssets.
|
@@ -100,6 +99,10 @@ class OnboardingModule implements ModuleInterface {
|
|
100 |
$endpoint->handle_request();
|
101 |
}
|
102 |
);
|
|
|
|
|
|
|
|
|
103 |
}
|
104 |
|
105 |
/**
|
41 |
* @param ContainerInterface|null $container The container.
|
42 |
*/
|
43 |
public function run( ContainerInterface $container = null ) {
|
|
|
44 |
$asset_loader = $container->get( 'onboarding.assets' );
|
45 |
/**
|
46 |
* The OnboardingAssets.
|
99 |
$endpoint->handle_request();
|
100 |
}
|
101 |
);
|
102 |
+
|
103 |
+
// Initialize REST routes at the appropriate time.
|
104 |
+
$rest_controller = $container->get( 'onboarding.rest' );
|
105 |
+
add_action( 'rest_api_init', array( $rest_controller, 'register_routes' ) );
|
106 |
}
|
107 |
|
108 |
/**
|
modules/ppcp-wc-gateway/src/Settings/class-settings.php
CHANGED
@@ -69,7 +69,7 @@ class Settings implements ContainerInterface {
|
|
69 |
*/
|
70 |
public function persist() {
|
71 |
|
72 |
-
update_option( self::KEY, $this->settings );
|
73 |
}
|
74 |
|
75 |
|
69 |
*/
|
70 |
public function persist() {
|
71 |
|
72 |
+
return update_option( self::KEY, $this->settings );
|
73 |
}
|
74 |
|
75 |
|
modules/ppcp-wc-gateway/src/Settings/class-settingslistener.php
CHANGED
@@ -117,10 +117,14 @@ class SettingsListener {
|
|
117 |
$this->settings->set( 'merchant_email_production', $merchant_email );
|
118 |
}
|
119 |
$this->settings->persist();
|
120 |
-
|
|
|
|
|
|
|
121 |
if ( ! $this->settings->has( 'client_id' ) || ! $this->settings->get( 'client_id' ) ) {
|
122 |
-
$redirect_url =
|
123 |
}
|
|
|
124 |
wp_safe_redirect( $redirect_url, 302 );
|
125 |
exit;
|
126 |
}
|
117 |
$this->settings->set( 'merchant_email_production', $merchant_email );
|
118 |
}
|
119 |
$this->settings->persist();
|
120 |
+
|
121 |
+
do_action( 'woocommerce_paypal_payments_onboarding_before_redirect' );
|
122 |
+
|
123 |
+
$redirect_url = apply_filters( 'woocommerce_paypal_payments_onboarding_redirect_url', admin_url( 'admin.php?page=wc-settings&tab=checkout§ion=ppcp-gateway' ) );
|
124 |
if ( ! $this->settings->has( 'client_id' ) || ! $this->settings->get( 'client_id' ) ) {
|
125 |
+
$redirect_url = add_query_arg( 'ppcp-onboarding-error', '1', $redirect_url );
|
126 |
}
|
127 |
+
|
128 |
wp_safe_redirect( $redirect_url, 302 );
|
129 |
exit;
|
130 |
}
|
package-lock.json
CHANGED
@@ -1,5 +1,13 @@
|
|
1 |
{
|
2 |
"name": "woocommerce-paypal-payments",
|
3 |
-
"version": "1.
|
4 |
-
"lockfileVersion":
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
}
|
1 |
{
|
2 |
"name": "woocommerce-paypal-payments",
|
3 |
+
"version": "1.2.0",
|
4 |
+
"lockfileVersion": 2,
|
5 |
+
"requires": true,
|
6 |
+
"packages": {
|
7 |
+
"": {
|
8 |
+
"version": "1.2.0",
|
9 |
+
"license": "GPL-2.0",
|
10 |
+
"devDependencies": {}
|
11 |
+
}
|
12 |
+
}
|
13 |
}
|
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.
|
8 |
License: GPLv2
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -58,6 +58,10 @@ Follow the steps below to connect the plugin to your PayPal account:
|
|
58 |
|
59 |
== Changelog ==
|
60 |
|
|
|
|
|
|
|
|
|
61 |
= 1.1.0 =
|
62 |
* Add - Buy Now Pay Later for UK. #104
|
63 |
* Add - DE now has 12 month installments. #106
|
4 |
Requires at least: 5.3
|
5 |
Tested up to: 5.6
|
6 |
Requires PHP: 7.0
|
7 |
+
Stable tag: 1.2.0
|
8 |
License: GPLv2
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
58 |
|
59 |
== Changelog ==
|
60 |
|
61 |
+
= 1.2.0 =
|
62 |
+
* Add - Rework onboarding code and add REST controller for integration with the OBW. #121
|
63 |
+
* Fix - Remove spinner on click, on cancel and on error. #124
|
64 |
+
|
65 |
= 1.1.0 =
|
66 |
* Add - Buy Now Pay Later for UK. #104
|
67 |
* Add - DE now has 12 month installments. #106
|
vendor/autoload.php
CHANGED
@@ -4,4 +4,4 @@
|
|
4 |
|
5 |
require_once __DIR__ . '/composer/autoload_real.php';
|
6 |
|
7 |
-
return
|
4 |
|
5 |
require_once __DIR__ . '/composer/autoload_real.php';
|
6 |
|
7 |
+
return ComposerAutoloaderInit214179756601a67475f16210e8a2d0f3::getLoader();
|
vendor/composer/autoload_classmap.php
CHANGED
@@ -104,6 +104,7 @@ return array(
|
|
104 |
'WooCommerce\\PayPalCommerce\\Onboarding\\Endpoint\\LoginSellerEndpoint' => $baseDir . '/modules/ppcp-onboarding/src/Endpoint/class-loginsellerendpoint.php',
|
105 |
'WooCommerce\\PayPalCommerce\\Onboarding\\Environment' => $baseDir . '/modules/ppcp-onboarding/src/class-environment.php',
|
106 |
'WooCommerce\\PayPalCommerce\\Onboarding\\OnboardingModule' => $baseDir . '/modules/ppcp-onboarding/src/class-onboardingmodule.php',
|
|
|
107 |
'WooCommerce\\PayPalCommerce\\Onboarding\\Render\\OnboardingRenderer' => $baseDir . '/modules/ppcp-onboarding/src/Render/class-onboardingrenderer.php',
|
108 |
'WooCommerce\\PayPalCommerce\\Onboarding\\State' => $baseDir . '/modules/ppcp-onboarding/src/class-state.php',
|
109 |
'WooCommerce\\PayPalCommerce\\PluginModule' => $baseDir . '/src/class-pluginmodule.php',
|
104 |
'WooCommerce\\PayPalCommerce\\Onboarding\\Endpoint\\LoginSellerEndpoint' => $baseDir . '/modules/ppcp-onboarding/src/Endpoint/class-loginsellerendpoint.php',
|
105 |
'WooCommerce\\PayPalCommerce\\Onboarding\\Environment' => $baseDir . '/modules/ppcp-onboarding/src/class-environment.php',
|
106 |
'WooCommerce\\PayPalCommerce\\Onboarding\\OnboardingModule' => $baseDir . '/modules/ppcp-onboarding/src/class-onboardingmodule.php',
|
107 |
+
'WooCommerce\\PayPalCommerce\\Onboarding\\Onboarding_REST_Controller' => $baseDir . '/modules/ppcp-onboarding/src/class-onboarding-rest-controller.php',
|
108 |
'WooCommerce\\PayPalCommerce\\Onboarding\\Render\\OnboardingRenderer' => $baseDir . '/modules/ppcp-onboarding/src/Render/class-onboardingrenderer.php',
|
109 |
'WooCommerce\\PayPalCommerce\\Onboarding\\State' => $baseDir . '/modules/ppcp-onboarding/src/class-state.php',
|
110 |
'WooCommerce\\PayPalCommerce\\PluginModule' => $baseDir . '/src/class-pluginmodule.php',
|
vendor/composer/autoload_real.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
|
3 |
// autoload_real.php @generated by Composer
|
4 |
|
5 |
-
class
|
6 |
{
|
7 |
private static $loader;
|
8 |
|
@@ -22,15 +22,15 @@ class ComposerAutoloaderInit1d807336893326b54d6d768e9f857b17
|
|
22 |
return self::$loader;
|
23 |
}
|
24 |
|
25 |
-
spl_autoload_register(array('
|
26 |
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
27 |
-
spl_autoload_unregister(array('
|
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\
|
34 |
} else {
|
35 |
$map = require __DIR__ . '/autoload_namespaces.php';
|
36 |
foreach ($map as $namespace => $path) {
|
@@ -51,19 +51,19 @@ class ComposerAutoloaderInit1d807336893326b54d6d768e9f857b17
|
|
51 |
$loader->register(true);
|
52 |
|
53 |
if ($useStaticLoader) {
|
54 |
-
$includeFiles = Composer\Autoload\
|
55 |
} else {
|
56 |
$includeFiles = require __DIR__ . '/autoload_files.php';
|
57 |
}
|
58 |
foreach ($includeFiles as $fileIdentifier => $file) {
|
59 |
-
|
60 |
}
|
61 |
|
62 |
return $loader;
|
63 |
}
|
64 |
}
|
65 |
|
66 |
-
function
|
67 |
{
|
68 |
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
69 |
require $file;
|
2 |
|
3 |
// autoload_real.php @generated by Composer
|
4 |
|
5 |
+
class ComposerAutoloaderInit214179756601a67475f16210e8a2d0f3
|
6 |
{
|
7 |
private static $loader;
|
8 |
|
22 |
return self::$loader;
|
23 |
}
|
24 |
|
25 |
+
spl_autoload_register(array('ComposerAutoloaderInit214179756601a67475f16210e8a2d0f3', 'loadClassLoader'), true, true);
|
26 |
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
27 |
+
spl_autoload_unregister(array('ComposerAutoloaderInit214179756601a67475f16210e8a2d0f3', '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\ComposerStaticInit214179756601a67475f16210e8a2d0f3::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\ComposerStaticInit214179756601a67475f16210e8a2d0f3::$files;
|
55 |
} else {
|
56 |
$includeFiles = require __DIR__ . '/autoload_files.php';
|
57 |
}
|
58 |
foreach ($includeFiles as $fileIdentifier => $file) {
|
59 |
+
composerRequire214179756601a67475f16210e8a2d0f3($fileIdentifier, $file);
|
60 |
}
|
61 |
|
62 |
return $loader;
|
63 |
}
|
64 |
}
|
65 |
|
66 |
+
function composerRequire214179756601a67475f16210e8a2d0f3($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
|
8 |
{
|
9 |
public static $files = array (
|
10 |
'7b11c4dc42b3b3023073cb14e519683c' => __DIR__ . '/..' . '/ralouphie/getallheaders/src/getallheaders.php',
|
@@ -184,6 +184,7 @@ class ComposerStaticInit1d807336893326b54d6d768e9f857b17
|
|
184 |
'WooCommerce\\PayPalCommerce\\Onboarding\\Endpoint\\LoginSellerEndpoint' => __DIR__ . '/../..' . '/modules/ppcp-onboarding/src/Endpoint/class-loginsellerendpoint.php',
|
185 |
'WooCommerce\\PayPalCommerce\\Onboarding\\Environment' => __DIR__ . '/../..' . '/modules/ppcp-onboarding/src/class-environment.php',
|
186 |
'WooCommerce\\PayPalCommerce\\Onboarding\\OnboardingModule' => __DIR__ . '/../..' . '/modules/ppcp-onboarding/src/class-onboardingmodule.php',
|
|
|
187 |
'WooCommerce\\PayPalCommerce\\Onboarding\\Render\\OnboardingRenderer' => __DIR__ . '/../..' . '/modules/ppcp-onboarding/src/Render/class-onboardingrenderer.php',
|
188 |
'WooCommerce\\PayPalCommerce\\Onboarding\\State' => __DIR__ . '/../..' . '/modules/ppcp-onboarding/src/class-state.php',
|
189 |
'WooCommerce\\PayPalCommerce\\PluginModule' => __DIR__ . '/../..' . '/src/class-pluginmodule.php',
|
@@ -236,9 +237,9 @@ class ComposerStaticInit1d807336893326b54d6d768e9f857b17
|
|
236 |
public static function getInitializer(ClassLoader $loader)
|
237 |
{
|
238 |
return \Closure::bind(function () use ($loader) {
|
239 |
-
$loader->prefixLengthsPsr4 =
|
240 |
-
$loader->prefixDirsPsr4 =
|
241 |
-
$loader->classMap =
|
242 |
|
243 |
}, null, ClassLoader::class);
|
244 |
}
|
4 |
|
5 |
namespace Composer\Autoload;
|
6 |
|
7 |
+
class ComposerStaticInit214179756601a67475f16210e8a2d0f3
|
8 |
{
|
9 |
public static $files = array (
|
10 |
'7b11c4dc42b3b3023073cb14e519683c' => __DIR__ . '/..' . '/ralouphie/getallheaders/src/getallheaders.php',
|
184 |
'WooCommerce\\PayPalCommerce\\Onboarding\\Endpoint\\LoginSellerEndpoint' => __DIR__ . '/../..' . '/modules/ppcp-onboarding/src/Endpoint/class-loginsellerendpoint.php',
|
185 |
'WooCommerce\\PayPalCommerce\\Onboarding\\Environment' => __DIR__ . '/../..' . '/modules/ppcp-onboarding/src/class-environment.php',
|
186 |
'WooCommerce\\PayPalCommerce\\Onboarding\\OnboardingModule' => __DIR__ . '/../..' . '/modules/ppcp-onboarding/src/class-onboardingmodule.php',
|
187 |
+
'WooCommerce\\PayPalCommerce\\Onboarding\\Onboarding_REST_Controller' => __DIR__ . '/../..' . '/modules/ppcp-onboarding/src/class-onboarding-rest-controller.php',
|
188 |
'WooCommerce\\PayPalCommerce\\Onboarding\\Render\\OnboardingRenderer' => __DIR__ . '/../..' . '/modules/ppcp-onboarding/src/Render/class-onboardingrenderer.php',
|
189 |
'WooCommerce\\PayPalCommerce\\Onboarding\\State' => __DIR__ . '/../..' . '/modules/ppcp-onboarding/src/class-state.php',
|
190 |
'WooCommerce\\PayPalCommerce\\PluginModule' => __DIR__ . '/../..' . '/src/class-pluginmodule.php',
|
237 |
public static function getInitializer(ClassLoader $loader)
|
238 |
{
|
239 |
return \Closure::bind(function () use ($loader) {
|
240 |
+
$loader->prefixLengthsPsr4 = ComposerStaticInit214179756601a67475f16210e8a2d0f3::$prefixLengthsPsr4;
|
241 |
+
$loader->prefixDirsPsr4 = ComposerStaticInit214179756601a67475f16210e8a2d0f3::$prefixDirsPsr4;
|
242 |
+
$loader->classMap = ComposerStaticInit214179756601a67475f16210e8a2d0f3::$classMap;
|
243 |
|
244 |
}, null, ClassLoader::class);
|
245 |
}
|
vendor/composer/installed.json
CHANGED
@@ -440,7 +440,8 @@
|
|
440 |
"email": "development@dhii.co"
|
441 |
}
|
442 |
],
|
443 |
-
"description": "Interoperability interface for objects that can be cast to string"
|
|
|
444 |
},
|
445 |
{
|
446 |
"name": "dhii/wp-containers",
|
@@ -497,33 +498,29 @@
|
|
497 |
"dependency injection",
|
498 |
"di",
|
499 |
"wordpress"
|
500 |
-
]
|
|
|
501 |
},
|
502 |
{
|
503 |
"name": "psr/container",
|
504 |
-
"version": "1.
|
505 |
-
"version_normalized": "1.
|
506 |
"source": {
|
507 |
"type": "git",
|
508 |
"url": "https://github.com/php-fig/container.git",
|
509 |
-
"reference": "
|
510 |
},
|
511 |
"dist": {
|
512 |
"type": "zip",
|
513 |
-
"url": "https://api.github.com/repos/php-fig/container/zipball/
|
514 |
-
"reference": "
|
515 |
"shasum": ""
|
516 |
},
|
517 |
"require": {
|
518 |
-
"php": ">=
|
519 |
},
|
520 |
-
"time": "
|
521 |
"type": "library",
|
522 |
-
"extra": {
|
523 |
-
"branch-alias": {
|
524 |
-
"dev-master": "1.0.x-dev"
|
525 |
-
}
|
526 |
-
},
|
527 |
"installation-source": "dist",
|
528 |
"autoload": {
|
529 |
"psr-4": {
|
@@ -537,7 +534,7 @@
|
|
537 |
"authors": [
|
538 |
{
|
539 |
"name": "PHP-FIG",
|
540 |
-
"homepage": "
|
541 |
}
|
542 |
],
|
543 |
"description": "Common Container Interface (PHP FIG PSR-11)",
|
440 |
"email": "development@dhii.co"
|
441 |
}
|
442 |
],
|
443 |
+
"description": "Interoperability interface for objects that can be cast to string",
|
444 |
+
"abandoned": "symfony/polyfill-php80"
|
445 |
},
|
446 |
{
|
447 |
"name": "dhii/wp-containers",
|
498 |
"dependency injection",
|
499 |
"di",
|
500 |
"wordpress"
|
501 |
+
],
|
502 |
+
"abandoned": "wp-oop/containers"
|
503 |
},
|
504 |
{
|
505 |
"name": "psr/container",
|
506 |
+
"version": "1.1.1",
|
507 |
+
"version_normalized": "1.1.1.0",
|
508 |
"source": {
|
509 |
"type": "git",
|
510 |
"url": "https://github.com/php-fig/container.git",
|
511 |
+
"reference": "8622567409010282b7aeebe4bb841fe98b58dcaf"
|
512 |
},
|
513 |
"dist": {
|
514 |
"type": "zip",
|
515 |
+
"url": "https://api.github.com/repos/php-fig/container/zipball/8622567409010282b7aeebe4bb841fe98b58dcaf",
|
516 |
+
"reference": "8622567409010282b7aeebe4bb841fe98b58dcaf",
|
517 |
"shasum": ""
|
518 |
},
|
519 |
"require": {
|
520 |
+
"php": ">=7.2.0"
|
521 |
},
|
522 |
+
"time": "2021-03-05T17:36:06+00:00",
|
523 |
"type": "library",
|
|
|
|
|
|
|
|
|
|
|
524 |
"installation-source": "dist",
|
525 |
"autoload": {
|
526 |
"psr-4": {
|
534 |
"authors": [
|
535 |
{
|
536 |
"name": "PHP-FIG",
|
537 |
+
"homepage": "https://www.php-fig.org/"
|
538 |
}
|
539 |
],
|
540 |
"description": "Common Container Interface (PHP FIG PSR-11)",
|
vendor/psr/container/README.md
CHANGED
@@ -1,5 +1,13 @@
|
|
1 |
-
|
|
|
2 |
|
3 |
-
This repository holds all interfaces
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
|
5 |
-
Note that this is not a container implementation of its own. See the specification for more details.
|
1 |
+
Container interface
|
2 |
+
==============
|
3 |
|
4 |
+
This repository holds all interfaces related to [PSR-11 (Container Interface)][psr-url].
|
5 |
+
|
6 |
+
Note that this is not a Container implementation of its own. It is merely abstractions that describe the components of a Dependency Injection Container.
|
7 |
+
|
8 |
+
The installable [package][package-url] and [implementations][implementation-url] are listed on Packagist.
|
9 |
+
|
10 |
+
[psr-url]: https://www.php-fig.org/psr/psr-11/
|
11 |
+
[package-url]: https://packagist.org/packages/psr/container
|
12 |
+
[implementation-url]: https://packagist.org/providers/psr/container-implementation
|
13 |
|
|
vendor/psr/container/composer.json
CHANGED
@@ -8,20 +8,15 @@
|
|
8 |
"authors": [
|
9 |
{
|
10 |
"name": "PHP-FIG",
|
11 |
-
"homepage": "
|
12 |
}
|
13 |
],
|
14 |
"require": {
|
15 |
-
"php": ">=
|
16 |
},
|
17 |
"autoload": {
|
18 |
"psr-4": {
|
19 |
"Psr\\Container\\": "src/"
|
20 |
}
|
21 |
-
},
|
22 |
-
"extra": {
|
23 |
-
"branch-alias": {
|
24 |
-
"dev-master": "1.0.x-dev"
|
25 |
-
}
|
26 |
}
|
27 |
}
|
8 |
"authors": [
|
9 |
{
|
10 |
"name": "PHP-FIG",
|
11 |
+
"homepage": "https://www.php-fig.org/"
|
12 |
}
|
13 |
],
|
14 |
"require": {
|
15 |
+
"php": ">=7.2.0"
|
16 |
},
|
17 |
"autoload": {
|
18 |
"psr-4": {
|
19 |
"Psr\\Container\\": "src/"
|
20 |
}
|
|
|
|
|
|
|
|
|
|
|
21 |
}
|
22 |
}
|
vendor/psr/container/src/ContainerExceptionInterface.php
CHANGED
@@ -1,7 +1,4 @@
|
|
1 |
<?php
|
2 |
-
/**
|
3 |
-
* @license http://www.opensource.org/licenses/mit-license.php MIT (see the LICENSE file)
|
4 |
-
*/
|
5 |
|
6 |
namespace Psr\Container;
|
7 |
|
1 |
<?php
|
|
|
|
|
|
|
2 |
|
3 |
namespace Psr\Container;
|
4 |
|
vendor/psr/container/src/ContainerInterface.php
CHANGED
@@ -1,7 +1,6 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
-
|
4 |
-
*/
|
5 |
|
6 |
namespace Psr\Container;
|
7 |
|
@@ -20,7 +19,7 @@ interface ContainerInterface
|
|
20 |
*
|
21 |
* @return mixed Entry.
|
22 |
*/
|
23 |
-
public function get($id);
|
24 |
|
25 |
/**
|
26 |
* Returns true if the container can return an entry for the given identifier.
|
@@ -33,5 +32,5 @@ interface ContainerInterface
|
|
33 |
*
|
34 |
* @return bool
|
35 |
*/
|
36 |
-
public function has($id);
|
37 |
}
|
1 |
<?php
|
2 |
+
|
3 |
+
declare(strict_types=1);
|
|
|
4 |
|
5 |
namespace Psr\Container;
|
6 |
|
19 |
*
|
20 |
* @return mixed Entry.
|
21 |
*/
|
22 |
+
public function get(string $id);
|
23 |
|
24 |
/**
|
25 |
* Returns true if the container can return an entry for the given identifier.
|
32 |
*
|
33 |
* @return bool
|
34 |
*/
|
35 |
+
public function has(string $id);
|
36 |
}
|
vendor/psr/container/src/NotFoundExceptionInterface.php
CHANGED
@@ -1,7 +1,4 @@
|
|
1 |
<?php
|
2 |
-
/**
|
3 |
-
* @license http://www.opensource.org/licenses/mit-license.php MIT (see the LICENSE file)
|
4 |
-
*/
|
5 |
|
6 |
namespace Psr\Container;
|
7 |
|
1 |
<?php
|
|
|
|
|
|
|
2 |
|
3 |
namespace Psr\Container;
|
4 |
|
woocommerce-paypal-payments.php
CHANGED
@@ -3,7 +3,7 @@
|
|
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.
|
7 |
* Author: WooCommerce
|
8 |
* Author URI: https://woocommerce.com/
|
9 |
* License: GPL-2.0
|
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.2.0
|
7 |
* Author: WooCommerce
|
8 |
* Author URI: https://woocommerce.com/
|
9 |
* License: GPL-2.0
|